blob: 48ebfe65aedafa414127663aef3c6a12b9ac7439 [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
Lysandros Nikolaou15acc4e2020-10-27 20:54:20 +0200219#define invalid_primary_type 1150 // Left-recursive
220#define invalid_comprehension_type 1151
221#define invalid_dict_comprehension_type 1152
222#define invalid_parameters_type 1153
223#define invalid_lambda_parameters_type 1154
224#define invalid_star_etc_type 1155
225#define invalid_lambda_star_etc_type 1156
226#define invalid_double_type_comments_type 1157
227#define invalid_with_item_type 1158
228#define invalid_for_target_type 1159
229#define invalid_group_type 1160
230#define invalid_import_from_targets_type 1161
231#define _loop0_1_type 1162
232#define _loop0_2_type 1163
233#define _loop0_4_type 1164
234#define _gather_3_type 1165
235#define _loop0_6_type 1166
236#define _gather_5_type 1167
237#define _loop0_8_type 1168
238#define _gather_7_type 1169
239#define _loop0_10_type 1170
240#define _gather_9_type 1171
241#define _loop1_11_type 1172
242#define _loop0_13_type 1173
243#define _gather_12_type 1174
244#define _tmp_14_type 1175
245#define _tmp_15_type 1176
246#define _tmp_16_type 1177
247#define _tmp_17_type 1178
248#define _tmp_18_type 1179
249#define _tmp_19_type 1180
250#define _tmp_20_type 1181
251#define _tmp_21_type 1182
252#define _loop1_22_type 1183
253#define _tmp_23_type 1184
254#define _tmp_24_type 1185
255#define _loop0_26_type 1186
256#define _gather_25_type 1187
257#define _loop0_28_type 1188
258#define _gather_27_type 1189
259#define _tmp_29_type 1190
260#define _tmp_30_type 1191
261#define _loop0_31_type 1192
262#define _loop1_32_type 1193
263#define _loop0_34_type 1194
264#define _gather_33_type 1195
265#define _tmp_35_type 1196
266#define _loop0_37_type 1197
267#define _gather_36_type 1198
268#define _tmp_38_type 1199
269#define _loop0_40_type 1200
270#define _gather_39_type 1201
271#define _loop0_42_type 1202
272#define _gather_41_type 1203
273#define _loop0_44_type 1204
274#define _gather_43_type 1205
275#define _loop0_46_type 1206
276#define _gather_45_type 1207
277#define _tmp_47_type 1208
278#define _loop1_48_type 1209
279#define _tmp_49_type 1210
280#define _tmp_50_type 1211
281#define _tmp_51_type 1212
282#define _tmp_52_type 1213
283#define _tmp_53_type 1214
284#define _loop0_54_type 1215
285#define _loop0_55_type 1216
286#define _loop0_56_type 1217
287#define _loop1_57_type 1218
288#define _loop0_58_type 1219
289#define _loop1_59_type 1220
290#define _loop1_60_type 1221
291#define _loop1_61_type 1222
292#define _loop0_62_type 1223
293#define _loop1_63_type 1224
294#define _loop0_64_type 1225
295#define _loop1_65_type 1226
296#define _loop0_66_type 1227
297#define _loop1_67_type 1228
298#define _loop1_68_type 1229
299#define _tmp_69_type 1230
300#define _loop0_71_type 1231
301#define _gather_70_type 1232
302#define _loop1_72_type 1233
303#define _loop0_74_type 1234
304#define _gather_73_type 1235
305#define _loop1_75_type 1236
306#define _loop0_76_type 1237
307#define _loop0_77_type 1238
308#define _loop0_78_type 1239
309#define _loop1_79_type 1240
310#define _loop0_80_type 1241
311#define _loop1_81_type 1242
312#define _loop1_82_type 1243
313#define _loop1_83_type 1244
314#define _loop0_84_type 1245
315#define _loop1_85_type 1246
316#define _loop0_86_type 1247
317#define _loop1_87_type 1248
318#define _loop0_88_type 1249
319#define _loop1_89_type 1250
320#define _loop1_90_type 1251
321#define _loop1_91_type 1252
322#define _loop1_92_type 1253
323#define _tmp_93_type 1254
324#define _loop0_95_type 1255
325#define _gather_94_type 1256
326#define _tmp_96_type 1257
327#define _tmp_97_type 1258
328#define _tmp_98_type 1259
329#define _tmp_99_type 1260
330#define _loop1_100_type 1261
331#define _tmp_101_type 1262
332#define _tmp_102_type 1263
333#define _loop0_104_type 1264
334#define _gather_103_type 1265
335#define _loop1_105_type 1266
336#define _loop0_106_type 1267
337#define _loop0_107_type 1268
338#define _loop0_109_type 1269
339#define _gather_108_type 1270
340#define _tmp_110_type 1271
341#define _loop0_112_type 1272
342#define _gather_111_type 1273
343#define _loop0_114_type 1274
344#define _gather_113_type 1275
345#define _loop0_116_type 1276
346#define _gather_115_type 1277
347#define _loop0_118_type 1278
348#define _gather_117_type 1279
349#define _loop0_119_type 1280
350#define _loop0_121_type 1281
351#define _gather_120_type 1282
352#define _tmp_122_type 1283
353#define _loop0_124_type 1284
354#define _gather_123_type 1285
355#define _loop0_126_type 1286
356#define _gather_125_type 1287
357#define _tmp_127_type 1288
358#define _loop0_128_type 1289
359#define _loop0_129_type 1290
360#define _loop0_130_type 1291
361#define _tmp_131_type 1292
362#define _tmp_132_type 1293
363#define _loop0_133_type 1294
364#define _tmp_134_type 1295
365#define _loop0_135_type 1296
366#define _tmp_136_type 1297
367#define _tmp_137_type 1298
368#define _tmp_138_type 1299
369#define _tmp_139_type 1300
370#define _tmp_140_type 1301
371#define _tmp_141_type 1302
372#define _tmp_142_type 1303
373#define _tmp_143_type 1304
374#define _tmp_144_type 1305
375#define _tmp_145_type 1306
376#define _tmp_146_type 1307
377#define _tmp_147_type 1308
378#define _tmp_148_type 1309
379#define _tmp_149_type 1310
380#define _tmp_150_type 1311
381#define _tmp_151_type 1312
382#define _tmp_152_type 1313
383#define _loop1_153_type 1314
384#define _loop1_154_type 1315
385#define _tmp_155_type 1316
386#define _tmp_156_type 1317
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100387
388static mod_ty file_rule(Parser *p);
389static mod_ty interactive_rule(Parser *p);
390static mod_ty eval_rule(Parser *p);
391static mod_ty func_type_rule(Parser *p);
392static expr_ty fstring_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100393static asdl_expr_seq* type_expressions_rule(Parser *p);
394static asdl_stmt_seq* statements_rule(Parser *p);
395static asdl_stmt_seq* statement_rule(Parser *p);
396static asdl_stmt_seq* statement_newline_rule(Parser *p);
397static asdl_stmt_seq* simple_stmt_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100398static stmt_ty small_stmt_rule(Parser *p);
399static stmt_ty compound_stmt_rule(Parser *p);
400static stmt_ty assignment_rule(Parser *p);
401static AugOperator* augassign_rule(Parser *p);
402static stmt_ty global_stmt_rule(Parser *p);
403static stmt_ty nonlocal_stmt_rule(Parser *p);
404static stmt_ty yield_stmt_rule(Parser *p);
405static stmt_ty assert_stmt_rule(Parser *p);
406static stmt_ty del_stmt_rule(Parser *p);
407static stmt_ty import_stmt_rule(Parser *p);
408static stmt_ty import_name_rule(Parser *p);
409static stmt_ty import_from_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100410static asdl_alias_seq* import_from_targets_rule(Parser *p);
411static asdl_alias_seq* import_from_as_names_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100412static alias_ty import_from_as_name_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100413static asdl_alias_seq* dotted_as_names_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100414static alias_ty dotted_as_name_rule(Parser *p);
415static expr_ty dotted_name_rule(Parser *p);
416static stmt_ty if_stmt_rule(Parser *p);
417static stmt_ty elif_stmt_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100418static asdl_stmt_seq* else_block_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100419static stmt_ty while_stmt_rule(Parser *p);
420static stmt_ty for_stmt_rule(Parser *p);
421static stmt_ty with_stmt_rule(Parser *p);
422static withitem_ty with_item_rule(Parser *p);
423static stmt_ty try_stmt_rule(Parser *p);
424static excepthandler_ty except_block_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100425static asdl_stmt_seq* finally_block_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100426static stmt_ty return_stmt_rule(Parser *p);
427static stmt_ty raise_stmt_rule(Parser *p);
428static stmt_ty function_def_rule(Parser *p);
429static stmt_ty function_def_raw_rule(Parser *p);
430static Token* func_type_comment_rule(Parser *p);
431static arguments_ty params_rule(Parser *p);
432static arguments_ty parameters_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100433static asdl_arg_seq* slash_no_default_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100434static SlashWithDefault* slash_with_default_rule(Parser *p);
435static StarEtc* star_etc_rule(Parser *p);
436static arg_ty kwds_rule(Parser *p);
437static arg_ty param_no_default_rule(Parser *p);
438static NameDefaultPair* param_with_default_rule(Parser *p);
439static NameDefaultPair* param_maybe_default_rule(Parser *p);
440static arg_ty param_rule(Parser *p);
441static expr_ty annotation_rule(Parser *p);
442static expr_ty default_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100443static asdl_expr_seq* decorators_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100444static stmt_ty class_def_rule(Parser *p);
445static stmt_ty class_def_raw_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100446static asdl_stmt_seq* block_rule(Parser *p);
447static asdl_expr_seq* expressions_list_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100448static expr_ty star_expressions_rule(Parser *p);
449static expr_ty star_expression_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100450static asdl_expr_seq* star_named_expressions_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100451static expr_ty star_named_expression_rule(Parser *p);
452static expr_ty named_expression_rule(Parser *p);
453static expr_ty annotated_rhs_rule(Parser *p);
454static expr_ty expressions_rule(Parser *p);
455static expr_ty expression_rule(Parser *p);
456static expr_ty lambdef_rule(Parser *p);
457static arguments_ty lambda_params_rule(Parser *p);
458static arguments_ty lambda_parameters_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100459static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100460static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
461static StarEtc* lambda_star_etc_rule(Parser *p);
462static arg_ty lambda_kwds_rule(Parser *p);
463static arg_ty lambda_param_no_default_rule(Parser *p);
464static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
465static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
466static arg_ty lambda_param_rule(Parser *p);
467static expr_ty disjunction_rule(Parser *p);
468static expr_ty conjunction_rule(Parser *p);
469static expr_ty inversion_rule(Parser *p);
470static expr_ty comparison_rule(Parser *p);
471static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
472static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
473static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
474static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
475static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
476static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
477static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
478static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
479static CmpopExprPair* in_bitwise_or_rule(Parser *p);
480static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
481static CmpopExprPair* is_bitwise_or_rule(Parser *p);
482static expr_ty bitwise_or_rule(Parser *p);
483static expr_ty bitwise_xor_rule(Parser *p);
484static expr_ty bitwise_and_rule(Parser *p);
485static expr_ty shift_expr_rule(Parser *p);
486static expr_ty sum_rule(Parser *p);
487static expr_ty term_rule(Parser *p);
488static expr_ty factor_rule(Parser *p);
489static expr_ty power_rule(Parser *p);
490static expr_ty await_primary_rule(Parser *p);
491static expr_ty primary_rule(Parser *p);
492static expr_ty slices_rule(Parser *p);
493static expr_ty slice_rule(Parser *p);
494static expr_ty atom_rule(Parser *p);
495static expr_ty strings_rule(Parser *p);
496static expr_ty list_rule(Parser *p);
497static expr_ty listcomp_rule(Parser *p);
498static expr_ty tuple_rule(Parser *p);
499static expr_ty group_rule(Parser *p);
500static expr_ty genexp_rule(Parser *p);
501static expr_ty set_rule(Parser *p);
502static expr_ty setcomp_rule(Parser *p);
503static expr_ty dict_rule(Parser *p);
504static expr_ty dictcomp_rule(Parser *p);
505static asdl_seq* double_starred_kvpairs_rule(Parser *p);
506static KeyValuePair* double_starred_kvpair_rule(Parser *p);
507static KeyValuePair* kvpair_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100508static asdl_comprehension_seq* for_if_clauses_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100509static comprehension_ty for_if_clause_rule(Parser *p);
510static expr_ty yield_expr_rule(Parser *p);
511static expr_ty arguments_rule(Parser *p);
512static expr_ty args_rule(Parser *p);
513static asdl_seq* kwargs_rule(Parser *p);
514static expr_ty starred_expression_rule(Parser *p);
515static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
516static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
517static expr_ty star_targets_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100518static asdl_expr_seq* star_targets_seq_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100519static expr_ty star_target_rule(Parser *p);
520static expr_ty star_atom_rule(Parser *p);
521static expr_ty single_target_rule(Parser *p);
522static expr_ty single_subscript_attribute_target_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100523static asdl_expr_seq* del_targets_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100524static expr_ty del_target_rule(Parser *p);
525static expr_ty del_t_atom_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100526static asdl_expr_seq* targets_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100527static expr_ty target_rule(Parser *p);
528static expr_ty t_primary_rule(Parser *p);
529static void *t_lookahead_rule(Parser *p);
530static expr_ty t_atom_rule(Parser *p);
Lysandros Nikolaoubca70142020-10-27 00:42:04 +0200531static void *invalid_arguments_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100532static void *invalid_kwarg_rule(Parser *p);
533static void *invalid_named_expression_rule(Parser *p);
534static void *invalid_assignment_rule(Parser *p);
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300535static expr_ty invalid_ann_assign_target_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300536static void *invalid_del_stmt_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100537static void *invalid_block_rule(Parser *p);
Lysandros Nikolaou15acc4e2020-10-27 20:54:20 +0200538static void *invalid_primary_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100539static void *invalid_comprehension_rule(Parser *p);
540static void *invalid_dict_comprehension_rule(Parser *p);
541static void *invalid_parameters_rule(Parser *p);
542static void *invalid_lambda_parameters_rule(Parser *p);
543static void *invalid_star_etc_rule(Parser *p);
544static void *invalid_lambda_star_etc_rule(Parser *p);
545static void *invalid_double_type_comments_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300546static void *invalid_with_item_rule(Parser *p);
547static void *invalid_for_target_rule(Parser *p);
548static void *invalid_group_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100549static void *invalid_import_from_targets_rule(Parser *p);
550static asdl_seq *_loop0_1_rule(Parser *p);
551static asdl_seq *_loop0_2_rule(Parser *p);
552static asdl_seq *_loop0_4_rule(Parser *p);
553static asdl_seq *_gather_3_rule(Parser *p);
554static asdl_seq *_loop0_6_rule(Parser *p);
555static asdl_seq *_gather_5_rule(Parser *p);
556static asdl_seq *_loop0_8_rule(Parser *p);
557static asdl_seq *_gather_7_rule(Parser *p);
558static asdl_seq *_loop0_10_rule(Parser *p);
559static asdl_seq *_gather_9_rule(Parser *p);
560static asdl_seq *_loop1_11_rule(Parser *p);
561static asdl_seq *_loop0_13_rule(Parser *p);
562static asdl_seq *_gather_12_rule(Parser *p);
563static void *_tmp_14_rule(Parser *p);
564static void *_tmp_15_rule(Parser *p);
565static void *_tmp_16_rule(Parser *p);
566static void *_tmp_17_rule(Parser *p);
567static void *_tmp_18_rule(Parser *p);
568static void *_tmp_19_rule(Parser *p);
569static void *_tmp_20_rule(Parser *p);
570static void *_tmp_21_rule(Parser *p);
571static asdl_seq *_loop1_22_rule(Parser *p);
572static void *_tmp_23_rule(Parser *p);
573static void *_tmp_24_rule(Parser *p);
574static asdl_seq *_loop0_26_rule(Parser *p);
575static asdl_seq *_gather_25_rule(Parser *p);
576static asdl_seq *_loop0_28_rule(Parser *p);
577static asdl_seq *_gather_27_rule(Parser *p);
578static void *_tmp_29_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300579static void *_tmp_30_rule(Parser *p);
580static asdl_seq *_loop0_31_rule(Parser *p);
581static asdl_seq *_loop1_32_rule(Parser *p);
582static asdl_seq *_loop0_34_rule(Parser *p);
583static asdl_seq *_gather_33_rule(Parser *p);
584static void *_tmp_35_rule(Parser *p);
585static asdl_seq *_loop0_37_rule(Parser *p);
586static asdl_seq *_gather_36_rule(Parser *p);
587static void *_tmp_38_rule(Parser *p);
588static asdl_seq *_loop0_40_rule(Parser *p);
589static asdl_seq *_gather_39_rule(Parser *p);
590static asdl_seq *_loop0_42_rule(Parser *p);
591static asdl_seq *_gather_41_rule(Parser *p);
592static asdl_seq *_loop0_44_rule(Parser *p);
593static asdl_seq *_gather_43_rule(Parser *p);
594static asdl_seq *_loop0_46_rule(Parser *p);
595static asdl_seq *_gather_45_rule(Parser *p);
596static void *_tmp_47_rule(Parser *p);
597static asdl_seq *_loop1_48_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100598static void *_tmp_49_rule(Parser *p);
599static void *_tmp_50_rule(Parser *p);
600static void *_tmp_51_rule(Parser *p);
601static void *_tmp_52_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300602static void *_tmp_53_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100603static asdl_seq *_loop0_54_rule(Parser *p);
604static asdl_seq *_loop0_55_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300605static asdl_seq *_loop0_56_rule(Parser *p);
606static asdl_seq *_loop1_57_rule(Parser *p);
607static asdl_seq *_loop0_58_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100608static asdl_seq *_loop1_59_rule(Parser *p);
609static asdl_seq *_loop1_60_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300610static asdl_seq *_loop1_61_rule(Parser *p);
611static asdl_seq *_loop0_62_rule(Parser *p);
612static asdl_seq *_loop1_63_rule(Parser *p);
613static asdl_seq *_loop0_64_rule(Parser *p);
614static asdl_seq *_loop1_65_rule(Parser *p);
615static asdl_seq *_loop0_66_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100616static asdl_seq *_loop1_67_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300617static asdl_seq *_loop1_68_rule(Parser *p);
618static void *_tmp_69_rule(Parser *p);
619static asdl_seq *_loop0_71_rule(Parser *p);
620static asdl_seq *_gather_70_rule(Parser *p);
621static asdl_seq *_loop1_72_rule(Parser *p);
622static asdl_seq *_loop0_74_rule(Parser *p);
623static asdl_seq *_gather_73_rule(Parser *p);
624static asdl_seq *_loop1_75_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100625static asdl_seq *_loop0_76_rule(Parser *p);
626static asdl_seq *_loop0_77_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300627static asdl_seq *_loop0_78_rule(Parser *p);
628static asdl_seq *_loop1_79_rule(Parser *p);
629static asdl_seq *_loop0_80_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100630static asdl_seq *_loop1_81_rule(Parser *p);
631static asdl_seq *_loop1_82_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300632static asdl_seq *_loop1_83_rule(Parser *p);
633static asdl_seq *_loop0_84_rule(Parser *p);
634static asdl_seq *_loop1_85_rule(Parser *p);
635static asdl_seq *_loop0_86_rule(Parser *p);
636static asdl_seq *_loop1_87_rule(Parser *p);
637static asdl_seq *_loop0_88_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100638static asdl_seq *_loop1_89_rule(Parser *p);
639static asdl_seq *_loop1_90_rule(Parser *p);
640static asdl_seq *_loop1_91_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300641static asdl_seq *_loop1_92_rule(Parser *p);
642static void *_tmp_93_rule(Parser *p);
643static asdl_seq *_loop0_95_rule(Parser *p);
644static asdl_seq *_gather_94_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100645static void *_tmp_96_rule(Parser *p);
646static void *_tmp_97_rule(Parser *p);
647static void *_tmp_98_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300648static void *_tmp_99_rule(Parser *p);
649static asdl_seq *_loop1_100_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100650static void *_tmp_101_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300651static void *_tmp_102_rule(Parser *p);
652static asdl_seq *_loop0_104_rule(Parser *p);
653static asdl_seq *_gather_103_rule(Parser *p);
654static asdl_seq *_loop1_105_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100655static asdl_seq *_loop0_106_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300656static asdl_seq *_loop0_107_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100657static asdl_seq *_loop0_109_rule(Parser *p);
658static asdl_seq *_gather_108_rule(Parser *p);
659static void *_tmp_110_rule(Parser *p);
660static asdl_seq *_loop0_112_rule(Parser *p);
661static asdl_seq *_gather_111_rule(Parser *p);
662static asdl_seq *_loop0_114_rule(Parser *p);
663static asdl_seq *_gather_113_rule(Parser *p);
664static asdl_seq *_loop0_116_rule(Parser *p);
665static asdl_seq *_gather_115_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300666static asdl_seq *_loop0_118_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100667static asdl_seq *_gather_117_rule(Parser *p);
668static asdl_seq *_loop0_119_rule(Parser *p);
669static asdl_seq *_loop0_121_rule(Parser *p);
670static asdl_seq *_gather_120_rule(Parser *p);
671static void *_tmp_122_rule(Parser *p);
672static asdl_seq *_loop0_124_rule(Parser *p);
673static asdl_seq *_gather_123_rule(Parser *p);
674static asdl_seq *_loop0_126_rule(Parser *p);
675static asdl_seq *_gather_125_rule(Parser *p);
676static void *_tmp_127_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300677static asdl_seq *_loop0_128_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100678static asdl_seq *_loop0_129_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100679static asdl_seq *_loop0_130_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100680static void *_tmp_131_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100681static void *_tmp_132_rule(Parser *p);
682static asdl_seq *_loop0_133_rule(Parser *p);
683static void *_tmp_134_rule(Parser *p);
684static asdl_seq *_loop0_135_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100685static void *_tmp_136_rule(Parser *p);
686static void *_tmp_137_rule(Parser *p);
687static void *_tmp_138_rule(Parser *p);
688static void *_tmp_139_rule(Parser *p);
689static void *_tmp_140_rule(Parser *p);
690static void *_tmp_141_rule(Parser *p);
691static void *_tmp_142_rule(Parser *p);
692static void *_tmp_143_rule(Parser *p);
693static void *_tmp_144_rule(Parser *p);
694static void *_tmp_145_rule(Parser *p);
695static void *_tmp_146_rule(Parser *p);
696static void *_tmp_147_rule(Parser *p);
697static void *_tmp_148_rule(Parser *p);
698static void *_tmp_149_rule(Parser *p);
699static void *_tmp_150_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100700static void *_tmp_151_rule(Parser *p);
701static void *_tmp_152_rule(Parser *p);
702static asdl_seq *_loop1_153_rule(Parser *p);
703static asdl_seq *_loop1_154_rule(Parser *p);
704static void *_tmp_155_rule(Parser *p);
705static void *_tmp_156_rule(Parser *p);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000706
707
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100708// file: statements? $
709static mod_ty
710file_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000711{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100712 D(p->level++);
713 if (p->error_indicator) {
714 D(p->level--);
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000715 return NULL;
716 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100717 mod_ty _res = NULL;
718 int _mark = p->mark;
719 { // statements? $
720 if (p->error_indicator) {
721 D(p->level--);
722 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000723 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100724 D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $"));
725 void *a;
726 Token * endmarker_var;
727 if (
728 (a = statements_rule(p), 1) // statements?
729 &&
730 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
731 )
732 {
733 D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $"));
734 _res = _PyPegen_make_module ( p , a );
735 if (_res == NULL && PyErr_Occurred()) {
736 p->error_indicator = 1;
737 D(p->level--);
738 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000739 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100740 goto done;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000741 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100742 p->mark = _mark;
743 D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ',
744 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000745 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100746 _res = NULL;
747 done:
748 D(p->level--);
749 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000750}
751
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100752// interactive: statement_newline
753static mod_ty
754interactive_rule(Parser *p)
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000755{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100756 D(p->level++);
757 if (p->error_indicator) {
758 D(p->level--);
759 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000760 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100761 mod_ty _res = NULL;
762 int _mark = p->mark;
763 { // statement_newline
764 if (p->error_indicator) {
765 D(p->level--);
766 return NULL;
767 }
768 D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline"));
Pablo Galindoa5634c42020-09-16 19:42:00 +0100769 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100770 if (
771 (a = statement_newline_rule(p)) // statement_newline
772 )
773 {
774 D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline"));
775 _res = Interactive ( a , p -> arena );
776 if (_res == NULL && PyErr_Occurred()) {
777 p->error_indicator = 1;
778 D(p->level--);
779 return NULL;
780 }
781 goto done;
782 }
783 p->mark = _mark;
784 D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ',
785 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline"));
786 }
787 _res = NULL;
788 done:
789 D(p->level--);
790 return _res;
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000791}
792
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100793// eval: expressions NEWLINE* $
794static mod_ty
795eval_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000796{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100797 D(p->level++);
798 if (p->error_indicator) {
799 D(p->level--);
800 return NULL;
801 }
802 mod_ty _res = NULL;
803 int _mark = p->mark;
804 { // expressions NEWLINE* $
805 if (p->error_indicator) {
806 D(p->level--);
807 return NULL;
808 }
809 D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
810 asdl_seq * _loop0_1_var;
811 expr_ty a;
812 Token * endmarker_var;
813 if (
814 (a = expressions_rule(p)) // expressions
815 &&
816 (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE*
817 &&
818 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
819 )
820 {
821 D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
822 _res = Expression ( a , p -> arena );
823 if (_res == NULL && PyErr_Occurred()) {
824 p->error_indicator = 1;
825 D(p->level--);
826 return NULL;
827 }
828 goto done;
829 }
830 p->mark = _mark;
831 D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ',
832 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $"));
833 }
834 _res = NULL;
835 done:
836 D(p->level--);
837 return _res;
838}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000839
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100840// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
841static mod_ty
842func_type_rule(Parser *p)
843{
844 D(p->level++);
845 if (p->error_indicator) {
846 D(p->level--);
847 return NULL;
848 }
849 mod_ty _res = NULL;
850 int _mark = p->mark;
851 { // '(' type_expressions? ')' '->' expression NEWLINE* $
852 if (p->error_indicator) {
853 D(p->level--);
854 return NULL;
855 }
856 D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
857 Token * _literal;
858 Token * _literal_1;
859 Token * _literal_2;
860 asdl_seq * _loop0_2_var;
861 void *a;
862 expr_ty b;
863 Token * endmarker_var;
864 if (
865 (_literal = _PyPegen_expect_token(p, 7)) // token='('
866 &&
867 (a = type_expressions_rule(p), 1) // type_expressions?
868 &&
869 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
870 &&
871 (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->'
872 &&
873 (b = expression_rule(p)) // expression
874 &&
875 (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE*
876 &&
877 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
878 )
879 {
880 D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
881 _res = FunctionType ( a , b , p -> arena );
882 if (_res == NULL && PyErr_Occurred()) {
883 p->error_indicator = 1;
884 D(p->level--);
885 return NULL;
886 }
887 goto done;
888 }
889 p->mark = _mark;
890 D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ',
891 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
892 }
893 _res = NULL;
894 done:
895 D(p->level--);
896 return _res;
897}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000898
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100899// fstring: star_expressions
900static expr_ty
901fstring_rule(Parser *p)
902{
903 D(p->level++);
904 if (p->error_indicator) {
905 D(p->level--);
906 return NULL;
907 }
908 expr_ty _res = NULL;
909 int _mark = p->mark;
910 { // star_expressions
911 if (p->error_indicator) {
912 D(p->level--);
913 return NULL;
914 }
915 D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
916 expr_ty star_expressions_var;
917 if (
918 (star_expressions_var = star_expressions_rule(p)) // star_expressions
919 )
920 {
921 D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
922 _res = star_expressions_var;
923 goto done;
924 }
925 p->mark = _mark;
926 D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ',
927 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
928 }
929 _res = NULL;
930 done:
931 D(p->level--);
932 return _res;
933}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000934
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100935// type_expressions:
936// | ','.expression+ ',' '*' expression ',' '**' expression
937// | ','.expression+ ',' '*' expression
938// | ','.expression+ ',' '**' expression
939// | '*' expression ',' '**' expression
940// | '*' expression
941// | '**' expression
942// | ','.expression+
Pablo Galindoa5634c42020-09-16 19:42:00 +0100943static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100944type_expressions_rule(Parser *p)
945{
946 D(p->level++);
947 if (p->error_indicator) {
948 D(p->level--);
949 return NULL;
950 }
Pablo Galindoa5634c42020-09-16 19:42:00 +0100951 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100952 int _mark = p->mark;
953 { // ','.expression+ ',' '*' expression ',' '**' expression
954 if (p->error_indicator) {
955 D(p->level--);
956 return NULL;
957 }
958 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
959 Token * _literal;
960 Token * _literal_1;
961 Token * _literal_2;
962 Token * _literal_3;
963 asdl_seq * a;
964 expr_ty b;
965 expr_ty c;
966 if (
967 (a = _gather_3_rule(p)) // ','.expression+
968 &&
969 (_literal = _PyPegen_expect_token(p, 12)) // token=','
970 &&
971 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
972 &&
973 (b = expression_rule(p)) // expression
974 &&
975 (_literal_2 = _PyPegen_expect_token(p, 12)) // token=','
976 &&
977 (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**'
978 &&
979 (c = expression_rule(p)) // expression
980 )
981 {
982 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 +0300983 _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 +0100984 if (_res == NULL && PyErr_Occurred()) {
985 p->error_indicator = 1;
986 D(p->level--);
987 return NULL;
988 }
989 goto done;
990 }
991 p->mark = _mark;
992 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
993 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
994 }
995 { // ','.expression+ ',' '*' expression
996 if (p->error_indicator) {
997 D(p->level--);
998 return NULL;
999 }
1000 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
1001 Token * _literal;
1002 Token * _literal_1;
1003 asdl_seq * a;
1004 expr_ty b;
1005 if (
1006 (a = _gather_5_rule(p)) // ','.expression+
1007 &&
1008 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1009 &&
1010 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
1011 &&
1012 (b = expression_rule(p)) // expression
1013 )
1014 {
1015 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 +01001016 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001017 if (_res == NULL && PyErr_Occurred()) {
1018 p->error_indicator = 1;
1019 D(p->level--);
1020 return NULL;
1021 }
1022 goto done;
1023 }
1024 p->mark = _mark;
1025 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1026 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
1027 }
1028 { // ','.expression+ ',' '**' expression
1029 if (p->error_indicator) {
1030 D(p->level--);
1031 return NULL;
1032 }
1033 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
1034 Token * _literal;
1035 Token * _literal_1;
1036 asdl_seq * a;
1037 expr_ty b;
1038 if (
1039 (a = _gather_7_rule(p)) // ','.expression+
1040 &&
1041 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1042 &&
1043 (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**'
1044 &&
1045 (b = expression_rule(p)) // expression
1046 )
1047 {
1048 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 +01001049 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001050 if (_res == NULL && PyErr_Occurred()) {
1051 p->error_indicator = 1;
1052 D(p->level--);
1053 return NULL;
1054 }
1055 goto done;
1056 }
1057 p->mark = _mark;
1058 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1059 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
1060 }
1061 { // '*' expression ',' '**' expression
1062 if (p->error_indicator) {
1063 D(p->level--);
1064 return NULL;
1065 }
1066 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
1067 Token * _literal;
1068 Token * _literal_1;
1069 Token * _literal_2;
1070 expr_ty a;
1071 expr_ty b;
1072 if (
1073 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1074 &&
1075 (a = expression_rule(p)) // expression
1076 &&
1077 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
1078 &&
1079 (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**'
1080 &&
1081 (b = expression_rule(p)) // expression
1082 )
1083 {
1084 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 +03001085 _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 +01001086 if (_res == NULL && PyErr_Occurred()) {
1087 p->error_indicator = 1;
1088 D(p->level--);
1089 return NULL;
1090 }
1091 goto done;
1092 }
1093 p->mark = _mark;
1094 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1095 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
1096 }
1097 { // '*' expression
1098 if (p->error_indicator) {
1099 D(p->level--);
1100 return NULL;
1101 }
1102 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
1103 Token * _literal;
1104 expr_ty a;
1105 if (
1106 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1107 &&
1108 (a = expression_rule(p)) // expression
1109 )
1110 {
1111 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001112 _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001113 if (_res == NULL && PyErr_Occurred()) {
1114 p->error_indicator = 1;
1115 D(p->level--);
1116 return NULL;
1117 }
1118 goto done;
1119 }
1120 p->mark = _mark;
1121 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1122 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
1123 }
1124 { // '**' expression
1125 if (p->error_indicator) {
1126 D(p->level--);
1127 return NULL;
1128 }
1129 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
1130 Token * _literal;
1131 expr_ty a;
1132 if (
1133 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
1134 &&
1135 (a = expression_rule(p)) // expression
1136 )
1137 {
1138 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001139 _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001140 if (_res == NULL && PyErr_Occurred()) {
1141 p->error_indicator = 1;
1142 D(p->level--);
1143 return NULL;
1144 }
1145 goto done;
1146 }
1147 p->mark = _mark;
1148 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1149 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
1150 }
1151 { // ','.expression+
1152 if (p->error_indicator) {
1153 D(p->level--);
1154 return NULL;
1155 }
1156 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001157 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001158 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01001159 (a = (asdl_expr_seq*)_gather_9_rule(p)) // ','.expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001160 )
1161 {
1162 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001163 _res = a;
1164 if (_res == NULL && PyErr_Occurred()) {
1165 p->error_indicator = 1;
1166 D(p->level--);
1167 return NULL;
1168 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001169 goto done;
1170 }
1171 p->mark = _mark;
1172 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1173 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
1174 }
1175 _res = NULL;
1176 done:
1177 D(p->level--);
1178 return _res;
1179}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001180
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001181// statements: statement+
Pablo Galindoa5634c42020-09-16 19:42:00 +01001182static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001183statements_rule(Parser *p)
1184{
1185 D(p->level++);
1186 if (p->error_indicator) {
1187 D(p->level--);
1188 return NULL;
1189 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001190 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001191 int _mark = p->mark;
1192 { // statement+
1193 if (p->error_indicator) {
1194 D(p->level--);
1195 return NULL;
1196 }
1197 D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
1198 asdl_seq * a;
1199 if (
1200 (a = _loop1_11_rule(p)) // statement+
1201 )
1202 {
1203 D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001204 _res = ( asdl_stmt_seq * ) _PyPegen_seq_flatten ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001205 if (_res == NULL && PyErr_Occurred()) {
1206 p->error_indicator = 1;
1207 D(p->level--);
1208 return NULL;
1209 }
1210 goto done;
1211 }
1212 p->mark = _mark;
1213 D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ',
1214 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+"));
1215 }
1216 _res = NULL;
1217 done:
1218 D(p->level--);
1219 return _res;
1220}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001221
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001222// statement: compound_stmt | simple_stmt
Pablo Galindoa5634c42020-09-16 19:42:00 +01001223static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001224statement_rule(Parser *p)
1225{
1226 D(p->level++);
1227 if (p->error_indicator) {
1228 D(p->level--);
1229 return NULL;
1230 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001231 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001232 int _mark = p->mark;
1233 { // compound_stmt
1234 if (p->error_indicator) {
1235 D(p->level--);
1236 return NULL;
1237 }
1238 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
1239 stmt_ty a;
1240 if (
1241 (a = compound_stmt_rule(p)) // compound_stmt
1242 )
1243 {
1244 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001245 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001246 if (_res == NULL && PyErr_Occurred()) {
1247 p->error_indicator = 1;
1248 D(p->level--);
1249 return NULL;
1250 }
1251 goto done;
1252 }
1253 p->mark = _mark;
1254 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1255 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt"));
1256 }
1257 { // simple_stmt
1258 if (p->error_indicator) {
1259 D(p->level--);
1260 return NULL;
1261 }
1262 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001263 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001264 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01001265 (a = (asdl_stmt_seq*)simple_stmt_rule(p)) // simple_stmt
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001266 )
1267 {
1268 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001269 _res = a;
1270 if (_res == NULL && PyErr_Occurred()) {
1271 p->error_indicator = 1;
1272 D(p->level--);
1273 return NULL;
1274 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001275 goto done;
1276 }
1277 p->mark = _mark;
1278 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1279 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1280 }
1281 _res = NULL;
1282 done:
1283 D(p->level--);
1284 return _res;
1285}
1286
1287// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
Pablo Galindoa5634c42020-09-16 19:42:00 +01001288static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001289statement_newline_rule(Parser *p)
1290{
1291 D(p->level++);
1292 if (p->error_indicator) {
1293 D(p->level--);
1294 return NULL;
1295 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001296 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001297 int _mark = p->mark;
1298 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1299 p->error_indicator = 1;
1300 D(p->level--);
1301 return NULL;
1302 }
1303 int _start_lineno = p->tokens[_mark]->lineno;
1304 UNUSED(_start_lineno); // Only used by EXTRA macro
1305 int _start_col_offset = p->tokens[_mark]->col_offset;
1306 UNUSED(_start_col_offset); // Only used by EXTRA macro
1307 { // compound_stmt NEWLINE
1308 if (p->error_indicator) {
1309 D(p->level--);
1310 return NULL;
1311 }
1312 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
1313 stmt_ty a;
1314 Token * newline_var;
1315 if (
1316 (a = compound_stmt_rule(p)) // compound_stmt
1317 &&
1318 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1319 )
1320 {
1321 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 +01001322 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001323 if (_res == NULL && PyErr_Occurred()) {
1324 p->error_indicator = 1;
1325 D(p->level--);
1326 return NULL;
1327 }
1328 goto done;
1329 }
1330 p->mark = _mark;
1331 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1332 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE"));
1333 }
1334 { // simple_stmt
1335 if (p->error_indicator) {
1336 D(p->level--);
1337 return NULL;
1338 }
1339 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001340 asdl_stmt_seq* simple_stmt_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001341 if (
1342 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
1343 )
1344 {
1345 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1346 _res = simple_stmt_var;
1347 goto done;
1348 }
1349 p->mark = _mark;
1350 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1351 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1352 }
1353 { // NEWLINE
1354 if (p->error_indicator) {
1355 D(p->level--);
1356 return NULL;
1357 }
1358 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1359 Token * newline_var;
1360 if (
1361 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1362 )
1363 {
1364 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1365 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1366 if (_token == NULL) {
1367 D(p->level--);
1368 return NULL;
1369 }
1370 int _end_lineno = _token->end_lineno;
1371 UNUSED(_end_lineno); // Only used by EXTRA macro
1372 int _end_col_offset = _token->end_col_offset;
1373 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03001374 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , CHECK ( stmt_ty , _Py_Pass ( EXTRA ) ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001375 if (_res == NULL && PyErr_Occurred()) {
1376 p->error_indicator = 1;
1377 D(p->level--);
1378 return NULL;
1379 }
1380 goto done;
1381 }
1382 p->mark = _mark;
1383 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1384 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
1385 }
1386 { // $
1387 if (p->error_indicator) {
1388 D(p->level--);
1389 return NULL;
1390 }
1391 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$"));
1392 Token * endmarker_var;
1393 if (
1394 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
1395 )
1396 {
1397 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
1398 _res = _PyPegen_interactive_exit ( p );
1399 if (_res == NULL && PyErr_Occurred()) {
1400 p->error_indicator = 1;
1401 D(p->level--);
1402 return NULL;
1403 }
1404 goto done;
1405 }
1406 p->mark = _mark;
1407 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1408 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$"));
1409 }
1410 _res = NULL;
1411 done:
1412 D(p->level--);
1413 return _res;
1414}
1415
1416// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
Pablo Galindoa5634c42020-09-16 19:42:00 +01001417static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001418simple_stmt_rule(Parser *p)
1419{
1420 D(p->level++);
1421 if (p->error_indicator) {
1422 D(p->level--);
1423 return NULL;
1424 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001425 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001426 int _mark = p->mark;
1427 { // small_stmt !';' NEWLINE
1428 if (p->error_indicator) {
1429 D(p->level--);
1430 return NULL;
1431 }
1432 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
1433 stmt_ty a;
1434 Token * newline_var;
1435 if (
1436 (a = small_stmt_rule(p)) // small_stmt
1437 &&
1438 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';'
1439 &&
1440 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1441 )
1442 {
1443 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 +01001444 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001445 if (_res == NULL && PyErr_Occurred()) {
1446 p->error_indicator = 1;
1447 D(p->level--);
1448 return NULL;
1449 }
1450 goto done;
1451 }
1452 p->mark = _mark;
1453 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1454 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt !';' NEWLINE"));
1455 }
1456 { // ';'.small_stmt+ ';'? NEWLINE
1457 if (p->error_indicator) {
1458 D(p->level--);
1459 return NULL;
1460 }
1461 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1462 void *_opt_var;
1463 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01001464 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001465 Token * newline_var;
1466 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01001467 (a = (asdl_stmt_seq*)_gather_12_rule(p)) // ';'.small_stmt+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001468 &&
1469 (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'?
1470 &&
1471 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1472 )
1473 {
1474 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1475 _res = a;
1476 if (_res == NULL && PyErr_Occurred()) {
1477 p->error_indicator = 1;
1478 D(p->level--);
1479 return NULL;
1480 }
1481 goto done;
1482 }
1483 p->mark = _mark;
1484 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1485 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1486 }
1487 _res = NULL;
1488 done:
1489 D(p->level--);
1490 return _res;
1491}
1492
1493// small_stmt:
1494// | assignment
1495// | star_expressions
1496// | &'return' return_stmt
1497// | &('import' | 'from') import_stmt
1498// | &'raise' raise_stmt
1499// | 'pass'
1500// | &'del' del_stmt
1501// | &'yield' yield_stmt
1502// | &'assert' assert_stmt
1503// | 'break'
1504// | 'continue'
1505// | &'global' global_stmt
1506// | &'nonlocal' nonlocal_stmt
1507static stmt_ty
1508small_stmt_rule(Parser *p)
1509{
1510 D(p->level++);
1511 if (p->error_indicator) {
1512 D(p->level--);
1513 return NULL;
1514 }
1515 stmt_ty _res = NULL;
1516 if (_PyPegen_is_memoized(p, small_stmt_type, &_res)) {
1517 D(p->level--);
1518 return _res;
1519 }
1520 int _mark = p->mark;
1521 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1522 p->error_indicator = 1;
1523 D(p->level--);
1524 return NULL;
1525 }
1526 int _start_lineno = p->tokens[_mark]->lineno;
1527 UNUSED(_start_lineno); // Only used by EXTRA macro
1528 int _start_col_offset = p->tokens[_mark]->col_offset;
1529 UNUSED(_start_col_offset); // Only used by EXTRA macro
1530 { // assignment
1531 if (p->error_indicator) {
1532 D(p->level--);
1533 return NULL;
1534 }
1535 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment"));
1536 stmt_ty assignment_var;
1537 if (
1538 (assignment_var = assignment_rule(p)) // assignment
1539 )
1540 {
1541 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment"));
1542 _res = assignment_var;
1543 goto done;
1544 }
1545 p->mark = _mark;
1546 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1547 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment"));
1548 }
1549 { // star_expressions
1550 if (p->error_indicator) {
1551 D(p->level--);
1552 return NULL;
1553 }
1554 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1555 expr_ty e;
1556 if (
1557 (e = star_expressions_rule(p)) // star_expressions
1558 )
1559 {
1560 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1561 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1562 if (_token == NULL) {
1563 D(p->level--);
1564 return NULL;
1565 }
1566 int _end_lineno = _token->end_lineno;
1567 UNUSED(_end_lineno); // Only used by EXTRA macro
1568 int _end_col_offset = _token->end_col_offset;
1569 UNUSED(_end_col_offset); // Only used by EXTRA macro
1570 _res = _Py_Expr ( e , EXTRA );
1571 if (_res == NULL && PyErr_Occurred()) {
1572 p->error_indicator = 1;
1573 D(p->level--);
1574 return NULL;
1575 }
1576 goto done;
1577 }
1578 p->mark = _mark;
1579 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1580 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
1581 }
1582 { // &'return' return_stmt
1583 if (p->error_indicator) {
1584 D(p->level--);
1585 return NULL;
1586 }
1587 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1588 stmt_ty return_stmt_var;
1589 if (
1590 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return'
1591 &&
1592 (return_stmt_var = return_stmt_rule(p)) // return_stmt
1593 )
1594 {
1595 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1596 _res = return_stmt_var;
1597 goto done;
1598 }
1599 p->mark = _mark;
1600 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1601 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt"));
1602 }
1603 { // &('import' | 'from') import_stmt
1604 if (p->error_indicator) {
1605 D(p->level--);
1606 return NULL;
1607 }
1608 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1609 stmt_ty import_stmt_var;
1610 if (
1611 _PyPegen_lookahead(1, _tmp_14_rule, p)
1612 &&
1613 (import_stmt_var = import_stmt_rule(p)) // import_stmt
1614 )
1615 {
1616 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1617 _res = import_stmt_var;
1618 goto done;
1619 }
1620 p->mark = _mark;
1621 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1622 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt"));
1623 }
1624 { // &'raise' raise_stmt
1625 if (p->error_indicator) {
1626 D(p->level--);
1627 return NULL;
1628 }
1629 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1630 stmt_ty raise_stmt_var;
1631 if (
1632 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise'
1633 &&
1634 (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt
1635 )
1636 {
1637 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1638 _res = raise_stmt_var;
1639 goto done;
1640 }
1641 p->mark = _mark;
1642 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1643 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt"));
1644 }
1645 { // 'pass'
1646 if (p->error_indicator) {
1647 D(p->level--);
1648 return NULL;
1649 }
1650 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'"));
1651 Token * _keyword;
1652 if (
1653 (_keyword = _PyPegen_expect_token(p, 502)) // token='pass'
1654 )
1655 {
1656 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'"));
1657 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1658 if (_token == NULL) {
1659 D(p->level--);
1660 return NULL;
1661 }
1662 int _end_lineno = _token->end_lineno;
1663 UNUSED(_end_lineno); // Only used by EXTRA macro
1664 int _end_col_offset = _token->end_col_offset;
1665 UNUSED(_end_col_offset); // Only used by EXTRA macro
1666 _res = _Py_Pass ( EXTRA );
1667 if (_res == NULL && PyErr_Occurred()) {
1668 p->error_indicator = 1;
1669 D(p->level--);
1670 return NULL;
1671 }
1672 goto done;
1673 }
1674 p->mark = _mark;
1675 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1676 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'"));
1677 }
1678 { // &'del' del_stmt
1679 if (p->error_indicator) {
1680 D(p->level--);
1681 return NULL;
1682 }
1683 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1684 stmt_ty del_stmt_var;
1685 if (
1686 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del'
1687 &&
1688 (del_stmt_var = del_stmt_rule(p)) // del_stmt
1689 )
1690 {
1691 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1692 _res = del_stmt_var;
1693 goto done;
1694 }
1695 p->mark = _mark;
1696 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1697 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt"));
1698 }
1699 { // &'yield' yield_stmt
1700 if (p->error_indicator) {
1701 D(p->level--);
1702 return NULL;
1703 }
1704 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1705 stmt_ty yield_stmt_var;
1706 if (
1707 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield'
1708 &&
1709 (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt
1710 )
1711 {
1712 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1713 _res = yield_stmt_var;
1714 goto done;
1715 }
1716 p->mark = _mark;
1717 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1718 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt"));
1719 }
1720 { // &'assert' assert_stmt
1721 if (p->error_indicator) {
1722 D(p->level--);
1723 return NULL;
1724 }
1725 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1726 stmt_ty assert_stmt_var;
1727 if (
1728 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert'
1729 &&
1730 (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt
1731 )
1732 {
1733 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1734 _res = assert_stmt_var;
1735 goto done;
1736 }
1737 p->mark = _mark;
1738 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1739 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt"));
1740 }
1741 { // 'break'
1742 if (p->error_indicator) {
1743 D(p->level--);
1744 return NULL;
1745 }
1746 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'"));
1747 Token * _keyword;
1748 if (
1749 (_keyword = _PyPegen_expect_token(p, 506)) // token='break'
1750 )
1751 {
1752 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'"));
1753 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1754 if (_token == NULL) {
1755 D(p->level--);
1756 return NULL;
1757 }
1758 int _end_lineno = _token->end_lineno;
1759 UNUSED(_end_lineno); // Only used by EXTRA macro
1760 int _end_col_offset = _token->end_col_offset;
1761 UNUSED(_end_col_offset); // Only used by EXTRA macro
1762 _res = _Py_Break ( EXTRA );
1763 if (_res == NULL && PyErr_Occurred()) {
1764 p->error_indicator = 1;
1765 D(p->level--);
1766 return NULL;
1767 }
1768 goto done;
1769 }
1770 p->mark = _mark;
1771 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1772 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'"));
1773 }
1774 { // 'continue'
1775 if (p->error_indicator) {
1776 D(p->level--);
1777 return NULL;
1778 }
1779 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'"));
1780 Token * _keyword;
1781 if (
1782 (_keyword = _PyPegen_expect_token(p, 507)) // token='continue'
1783 )
1784 {
1785 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'"));
1786 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1787 if (_token == NULL) {
1788 D(p->level--);
1789 return NULL;
1790 }
1791 int _end_lineno = _token->end_lineno;
1792 UNUSED(_end_lineno); // Only used by EXTRA macro
1793 int _end_col_offset = _token->end_col_offset;
1794 UNUSED(_end_col_offset); // Only used by EXTRA macro
1795 _res = _Py_Continue ( EXTRA );
1796 if (_res == NULL && PyErr_Occurred()) {
1797 p->error_indicator = 1;
1798 D(p->level--);
1799 return NULL;
1800 }
1801 goto done;
1802 }
1803 p->mark = _mark;
1804 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1805 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'"));
1806 }
1807 { // &'global' global_stmt
1808 if (p->error_indicator) {
1809 D(p->level--);
1810 return NULL;
1811 }
1812 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1813 stmt_ty global_stmt_var;
1814 if (
1815 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global'
1816 &&
1817 (global_stmt_var = global_stmt_rule(p)) // global_stmt
1818 )
1819 {
1820 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1821 _res = global_stmt_var;
1822 goto done;
1823 }
1824 p->mark = _mark;
1825 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1826 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt"));
1827 }
1828 { // &'nonlocal' nonlocal_stmt
1829 if (p->error_indicator) {
1830 D(p->level--);
1831 return NULL;
1832 }
1833 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1834 stmt_ty nonlocal_stmt_var;
1835 if (
1836 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal'
1837 &&
1838 (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt
1839 )
1840 {
1841 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1842 _res = nonlocal_stmt_var;
1843 goto done;
1844 }
1845 p->mark = _mark;
1846 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1847 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1848 }
1849 _res = NULL;
1850 done:
1851 _PyPegen_insert_memo(p, _mark, small_stmt_type, _res);
1852 D(p->level--);
1853 return _res;
1854}
1855
1856// compound_stmt:
1857// | &('def' | '@' | ASYNC) function_def
1858// | &'if' if_stmt
1859// | &('class' | '@') class_def
1860// | &('with' | ASYNC) with_stmt
1861// | &('for' | ASYNC) for_stmt
1862// | &'try' try_stmt
1863// | &'while' while_stmt
1864static stmt_ty
1865compound_stmt_rule(Parser *p)
1866{
1867 D(p->level++);
1868 if (p->error_indicator) {
1869 D(p->level--);
1870 return NULL;
1871 }
1872 stmt_ty _res = NULL;
1873 int _mark = p->mark;
1874 { // &('def' | '@' | ASYNC) function_def
1875 if (p->error_indicator) {
1876 D(p->level--);
1877 return NULL;
1878 }
1879 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1880 stmt_ty function_def_var;
1881 if (
1882 _PyPegen_lookahead(1, _tmp_15_rule, p)
1883 &&
1884 (function_def_var = function_def_rule(p)) // function_def
1885 )
1886 {
1887 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1888 _res = function_def_var;
1889 goto done;
1890 }
1891 p->mark = _mark;
1892 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1893 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1894 }
1895 { // &'if' if_stmt
1896 if (p->error_indicator) {
1897 D(p->level--);
1898 return NULL;
1899 }
1900 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1901 stmt_ty if_stmt_var;
1902 if (
1903 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if'
1904 &&
1905 (if_stmt_var = if_stmt_rule(p)) // if_stmt
1906 )
1907 {
1908 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1909 _res = if_stmt_var;
1910 goto done;
1911 }
1912 p->mark = _mark;
1913 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1914 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt"));
1915 }
1916 { // &('class' | '@') class_def
1917 if (p->error_indicator) {
1918 D(p->level--);
1919 return NULL;
1920 }
1921 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1922 stmt_ty class_def_var;
1923 if (
1924 _PyPegen_lookahead(1, _tmp_16_rule, p)
1925 &&
1926 (class_def_var = class_def_rule(p)) // class_def
1927 )
1928 {
1929 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1930 _res = class_def_var;
1931 goto done;
1932 }
1933 p->mark = _mark;
1934 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1935 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def"));
1936 }
1937 { // &('with' | ASYNC) with_stmt
1938 if (p->error_indicator) {
1939 D(p->level--);
1940 return NULL;
1941 }
1942 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1943 stmt_ty with_stmt_var;
1944 if (
1945 _PyPegen_lookahead(1, _tmp_17_rule, p)
1946 &&
1947 (with_stmt_var = with_stmt_rule(p)) // with_stmt
1948 )
1949 {
1950 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1951 _res = with_stmt_var;
1952 goto done;
1953 }
1954 p->mark = _mark;
1955 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1956 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1957 }
1958 { // &('for' | ASYNC) for_stmt
1959 if (p->error_indicator) {
1960 D(p->level--);
1961 return NULL;
1962 }
1963 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1964 stmt_ty for_stmt_var;
1965 if (
1966 _PyPegen_lookahead(1, _tmp_18_rule, p)
1967 &&
1968 (for_stmt_var = for_stmt_rule(p)) // for_stmt
1969 )
1970 {
1971 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1972 _res = for_stmt_var;
1973 goto done;
1974 }
1975 p->mark = _mark;
1976 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1977 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1978 }
1979 { // &'try' try_stmt
1980 if (p->error_indicator) {
1981 D(p->level--);
1982 return NULL;
1983 }
1984 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1985 stmt_ty try_stmt_var;
1986 if (
1987 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try'
1988 &&
1989 (try_stmt_var = try_stmt_rule(p)) // try_stmt
1990 )
1991 {
1992 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1993 _res = try_stmt_var;
1994 goto done;
1995 }
1996 p->mark = _mark;
1997 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1998 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt"));
1999 }
2000 { // &'while' while_stmt
2001 if (p->error_indicator) {
2002 D(p->level--);
2003 return NULL;
2004 }
2005 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
2006 stmt_ty while_stmt_var;
2007 if (
2008 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while'
2009 &&
2010 (while_stmt_var = while_stmt_rule(p)) // while_stmt
2011 )
2012 {
2013 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
2014 _res = while_stmt_var;
2015 goto done;
2016 }
2017 p->mark = _mark;
2018 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2019 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt"));
2020 }
2021 _res = NULL;
2022 done:
2023 D(p->level--);
2024 return _res;
2025}
2026
2027// assignment:
2028// | NAME ':' expression ['=' annotated_rhs]
2029// | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2030// | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002031// | single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002032// | invalid_assignment
2033static stmt_ty
2034assignment_rule(Parser *p)
2035{
2036 D(p->level++);
2037 if (p->error_indicator) {
2038 D(p->level--);
2039 return NULL;
2040 }
2041 stmt_ty _res = NULL;
2042 int _mark = p->mark;
2043 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2044 p->error_indicator = 1;
2045 D(p->level--);
2046 return NULL;
2047 }
2048 int _start_lineno = p->tokens[_mark]->lineno;
2049 UNUSED(_start_lineno); // Only used by EXTRA macro
2050 int _start_col_offset = p->tokens[_mark]->col_offset;
2051 UNUSED(_start_col_offset); // Only used by EXTRA macro
2052 { // NAME ':' expression ['=' annotated_rhs]
2053 if (p->error_indicator) {
2054 D(p->level--);
2055 return NULL;
2056 }
2057 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2058 Token * _literal;
2059 expr_ty a;
2060 expr_ty b;
2061 void *c;
2062 if (
2063 (a = _PyPegen_name_token(p)) // NAME
2064 &&
2065 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2066 &&
2067 (b = expression_rule(p)) // expression
2068 &&
2069 (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs]
2070 )
2071 {
2072 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2073 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2074 if (_token == NULL) {
2075 D(p->level--);
2076 return NULL;
2077 }
2078 int _end_lineno = _token->end_lineno;
2079 UNUSED(_end_lineno); // Only used by EXTRA macro
2080 int _end_col_offset = _token->end_col_offset;
2081 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002082 _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 +01002083 if (_res == NULL && PyErr_Occurred()) {
2084 p->error_indicator = 1;
2085 D(p->level--);
2086 return NULL;
2087 }
2088 goto done;
2089 }
2090 p->mark = _mark;
2091 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2092 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2093 }
2094 { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2095 if (p->error_indicator) {
2096 D(p->level--);
2097 return NULL;
2098 }
2099 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2100 Token * _literal;
2101 void *a;
2102 expr_ty b;
2103 void *c;
2104 if (
2105 (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
2106 &&
2107 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2108 &&
2109 (b = expression_rule(p)) // expression
2110 &&
2111 (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs]
2112 )
2113 {
2114 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2115 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2116 if (_token == NULL) {
2117 D(p->level--);
2118 return NULL;
2119 }
2120 int _end_lineno = _token->end_lineno;
2121 UNUSED(_end_lineno); // Only used by EXTRA macro
2122 int _end_col_offset = _token->end_col_offset;
2123 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002124 _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002125 if (_res == NULL && PyErr_Occurred()) {
2126 p->error_indicator = 1;
2127 D(p->level--);
2128 return NULL;
2129 }
2130 goto done;
2131 }
2132 p->mark = _mark;
2133 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2134 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2135 }
2136 { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
2137 if (p->error_indicator) {
2138 D(p->level--);
2139 return NULL;
2140 }
2141 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 +01002142 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002143 void *b;
2144 void *tc;
2145 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01002146 (a = (asdl_expr_seq*)_loop1_22_rule(p)) // ((star_targets '='))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002147 &&
2148 (b = _tmp_23_rule(p)) // yield_expr | star_expressions
2149 &&
2150 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
2151 &&
2152 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
2153 )
2154 {
2155 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2156 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2157 if (_token == NULL) {
2158 D(p->level--);
2159 return NULL;
2160 }
2161 int _end_lineno = _token->end_lineno;
2162 UNUSED(_end_lineno); // Only used by EXTRA macro
2163 int _end_col_offset = _token->end_col_offset;
2164 UNUSED(_end_col_offset); // Only used by EXTRA macro
2165 _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
2166 if (_res == NULL && PyErr_Occurred()) {
2167 p->error_indicator = 1;
2168 D(p->level--);
2169 return NULL;
2170 }
2171 goto done;
2172 }
2173 p->mark = _mark;
2174 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2175 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2176 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002177 { // single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002178 if (p->error_indicator) {
2179 D(p->level--);
2180 return NULL;
2181 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002182 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2183 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002184 expr_ty a;
2185 AugOperator* b;
2186 void *c;
2187 if (
2188 (a = single_target_rule(p)) // single_target
2189 &&
2190 (b = augassign_rule(p)) // augassign
2191 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002192 (_cut_var = 1)
2193 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002194 (c = _tmp_24_rule(p)) // yield_expr | star_expressions
2195 )
2196 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002197 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 +01002198 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2199 if (_token == NULL) {
2200 D(p->level--);
2201 return NULL;
2202 }
2203 int _end_lineno = _token->end_lineno;
2204 UNUSED(_end_lineno); // Only used by EXTRA macro
2205 int _end_col_offset = _token->end_col_offset;
2206 UNUSED(_end_col_offset); // Only used by EXTRA macro
2207 _res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
2208 if (_res == NULL && PyErr_Occurred()) {
2209 p->error_indicator = 1;
2210 D(p->level--);
2211 return NULL;
2212 }
2213 goto done;
2214 }
2215 p->mark = _mark;
2216 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002217 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2218 if (_cut_var) {
2219 D(p->level--);
2220 return NULL;
2221 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002222 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02002223 if (p->call_invalid_rules) { // invalid_assignment
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002224 if (p->error_indicator) {
2225 D(p->level--);
2226 return NULL;
2227 }
2228 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2229 void *invalid_assignment_var;
2230 if (
2231 (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment
2232 )
2233 {
2234 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2235 _res = invalid_assignment_var;
2236 goto done;
2237 }
2238 p->mark = _mark;
2239 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2240 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment"));
2241 }
2242 _res = NULL;
2243 done:
2244 D(p->level--);
2245 return _res;
2246}
2247
2248// augassign:
2249// | '+='
2250// | '-='
2251// | '*='
2252// | '@='
2253// | '/='
2254// | '%='
2255// | '&='
2256// | '|='
2257// | '^='
2258// | '<<='
2259// | '>>='
2260// | '**='
2261// | '//='
2262static AugOperator*
2263augassign_rule(Parser *p)
2264{
2265 D(p->level++);
2266 if (p->error_indicator) {
2267 D(p->level--);
2268 return NULL;
2269 }
2270 AugOperator* _res = NULL;
2271 int _mark = p->mark;
2272 { // '+='
2273 if (p->error_indicator) {
2274 D(p->level--);
2275 return NULL;
2276 }
2277 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='"));
2278 Token * _literal;
2279 if (
2280 (_literal = _PyPegen_expect_token(p, 36)) // token='+='
2281 )
2282 {
2283 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
2284 _res = _PyPegen_augoperator ( p , Add );
2285 if (_res == NULL && PyErr_Occurred()) {
2286 p->error_indicator = 1;
2287 D(p->level--);
2288 return NULL;
2289 }
2290 goto done;
2291 }
2292 p->mark = _mark;
2293 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2294 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='"));
2295 }
2296 { // '-='
2297 if (p->error_indicator) {
2298 D(p->level--);
2299 return NULL;
2300 }
2301 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='"));
2302 Token * _literal;
2303 if (
2304 (_literal = _PyPegen_expect_token(p, 37)) // token='-='
2305 )
2306 {
2307 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
2308 _res = _PyPegen_augoperator ( p , Sub );
2309 if (_res == NULL && PyErr_Occurred()) {
2310 p->error_indicator = 1;
2311 D(p->level--);
2312 return NULL;
2313 }
2314 goto done;
2315 }
2316 p->mark = _mark;
2317 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2318 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='"));
2319 }
2320 { // '*='
2321 if (p->error_indicator) {
2322 D(p->level--);
2323 return NULL;
2324 }
2325 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='"));
2326 Token * _literal;
2327 if (
2328 (_literal = _PyPegen_expect_token(p, 38)) // token='*='
2329 )
2330 {
2331 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
2332 _res = _PyPegen_augoperator ( p , Mult );
2333 if (_res == NULL && PyErr_Occurred()) {
2334 p->error_indicator = 1;
2335 D(p->level--);
2336 return NULL;
2337 }
2338 goto done;
2339 }
2340 p->mark = _mark;
2341 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2342 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='"));
2343 }
2344 { // '@='
2345 if (p->error_indicator) {
2346 D(p->level--);
2347 return NULL;
2348 }
2349 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='"));
2350 Token * _literal;
2351 if (
2352 (_literal = _PyPegen_expect_token(p, 50)) // token='@='
2353 )
2354 {
2355 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002356 _res = CHECK_VERSION ( AugOperator * , 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002357 if (_res == NULL && PyErr_Occurred()) {
2358 p->error_indicator = 1;
2359 D(p->level--);
2360 return NULL;
2361 }
2362 goto done;
2363 }
2364 p->mark = _mark;
2365 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2366 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='"));
2367 }
2368 { // '/='
2369 if (p->error_indicator) {
2370 D(p->level--);
2371 return NULL;
2372 }
2373 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='"));
2374 Token * _literal;
2375 if (
2376 (_literal = _PyPegen_expect_token(p, 39)) // token='/='
2377 )
2378 {
2379 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
2380 _res = _PyPegen_augoperator ( p , Div );
2381 if (_res == NULL && PyErr_Occurred()) {
2382 p->error_indicator = 1;
2383 D(p->level--);
2384 return NULL;
2385 }
2386 goto done;
2387 }
2388 p->mark = _mark;
2389 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2390 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='"));
2391 }
2392 { // '%='
2393 if (p->error_indicator) {
2394 D(p->level--);
2395 return NULL;
2396 }
2397 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='"));
2398 Token * _literal;
2399 if (
2400 (_literal = _PyPegen_expect_token(p, 40)) // token='%='
2401 )
2402 {
2403 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
2404 _res = _PyPegen_augoperator ( p , Mod );
2405 if (_res == NULL && PyErr_Occurred()) {
2406 p->error_indicator = 1;
2407 D(p->level--);
2408 return NULL;
2409 }
2410 goto done;
2411 }
2412 p->mark = _mark;
2413 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2414 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='"));
2415 }
2416 { // '&='
2417 if (p->error_indicator) {
2418 D(p->level--);
2419 return NULL;
2420 }
2421 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='"));
2422 Token * _literal;
2423 if (
2424 (_literal = _PyPegen_expect_token(p, 41)) // token='&='
2425 )
2426 {
2427 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
2428 _res = _PyPegen_augoperator ( p , BitAnd );
2429 if (_res == NULL && PyErr_Occurred()) {
2430 p->error_indicator = 1;
2431 D(p->level--);
2432 return NULL;
2433 }
2434 goto done;
2435 }
2436 p->mark = _mark;
2437 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2438 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='"));
2439 }
2440 { // '|='
2441 if (p->error_indicator) {
2442 D(p->level--);
2443 return NULL;
2444 }
2445 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='"));
2446 Token * _literal;
2447 if (
2448 (_literal = _PyPegen_expect_token(p, 42)) // token='|='
2449 )
2450 {
2451 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
2452 _res = _PyPegen_augoperator ( p , BitOr );
2453 if (_res == NULL && PyErr_Occurred()) {
2454 p->error_indicator = 1;
2455 D(p->level--);
2456 return NULL;
2457 }
2458 goto done;
2459 }
2460 p->mark = _mark;
2461 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2462 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='"));
2463 }
2464 { // '^='
2465 if (p->error_indicator) {
2466 D(p->level--);
2467 return NULL;
2468 }
2469 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='"));
2470 Token * _literal;
2471 if (
2472 (_literal = _PyPegen_expect_token(p, 43)) // token='^='
2473 )
2474 {
2475 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
2476 _res = _PyPegen_augoperator ( p , BitXor );
2477 if (_res == NULL && PyErr_Occurred()) {
2478 p->error_indicator = 1;
2479 D(p->level--);
2480 return NULL;
2481 }
2482 goto done;
2483 }
2484 p->mark = _mark;
2485 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2486 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='"));
2487 }
2488 { // '<<='
2489 if (p->error_indicator) {
2490 D(p->level--);
2491 return NULL;
2492 }
2493 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='"));
2494 Token * _literal;
2495 if (
2496 (_literal = _PyPegen_expect_token(p, 44)) // token='<<='
2497 )
2498 {
2499 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
2500 _res = _PyPegen_augoperator ( p , LShift );
2501 if (_res == NULL && PyErr_Occurred()) {
2502 p->error_indicator = 1;
2503 D(p->level--);
2504 return NULL;
2505 }
2506 goto done;
2507 }
2508 p->mark = _mark;
2509 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2510 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='"));
2511 }
2512 { // '>>='
2513 if (p->error_indicator) {
2514 D(p->level--);
2515 return NULL;
2516 }
2517 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='"));
2518 Token * _literal;
2519 if (
2520 (_literal = _PyPegen_expect_token(p, 45)) // token='>>='
2521 )
2522 {
2523 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
2524 _res = _PyPegen_augoperator ( p , RShift );
2525 if (_res == NULL && PyErr_Occurred()) {
2526 p->error_indicator = 1;
2527 D(p->level--);
2528 return NULL;
2529 }
2530 goto done;
2531 }
2532 p->mark = _mark;
2533 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2534 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='"));
2535 }
2536 { // '**='
2537 if (p->error_indicator) {
2538 D(p->level--);
2539 return NULL;
2540 }
2541 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='"));
2542 Token * _literal;
2543 if (
2544 (_literal = _PyPegen_expect_token(p, 46)) // token='**='
2545 )
2546 {
2547 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
2548 _res = _PyPegen_augoperator ( p , Pow );
2549 if (_res == NULL && PyErr_Occurred()) {
2550 p->error_indicator = 1;
2551 D(p->level--);
2552 return NULL;
2553 }
2554 goto done;
2555 }
2556 p->mark = _mark;
2557 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2558 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='"));
2559 }
2560 { // '//='
2561 if (p->error_indicator) {
2562 D(p->level--);
2563 return NULL;
2564 }
2565 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='"));
2566 Token * _literal;
2567 if (
2568 (_literal = _PyPegen_expect_token(p, 48)) // token='//='
2569 )
2570 {
2571 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
2572 _res = _PyPegen_augoperator ( p , FloorDiv );
2573 if (_res == NULL && PyErr_Occurred()) {
2574 p->error_indicator = 1;
2575 D(p->level--);
2576 return NULL;
2577 }
2578 goto done;
2579 }
2580 p->mark = _mark;
2581 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2582 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='"));
2583 }
2584 _res = NULL;
2585 done:
2586 D(p->level--);
2587 return _res;
2588}
2589
2590// global_stmt: 'global' ','.NAME+
2591static stmt_ty
2592global_stmt_rule(Parser *p)
2593{
2594 D(p->level++);
2595 if (p->error_indicator) {
2596 D(p->level--);
2597 return NULL;
2598 }
2599 stmt_ty _res = NULL;
2600 int _mark = p->mark;
2601 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2602 p->error_indicator = 1;
2603 D(p->level--);
2604 return NULL;
2605 }
2606 int _start_lineno = p->tokens[_mark]->lineno;
2607 UNUSED(_start_lineno); // Only used by EXTRA macro
2608 int _start_col_offset = p->tokens[_mark]->col_offset;
2609 UNUSED(_start_col_offset); // Only used by EXTRA macro
2610 { // 'global' ','.NAME+
2611 if (p->error_indicator) {
2612 D(p->level--);
2613 return NULL;
2614 }
2615 D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2616 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01002617 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002618 if (
2619 (_keyword = _PyPegen_expect_token(p, 508)) // token='global'
2620 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01002621 (a = (asdl_expr_seq*)_gather_25_rule(p)) // ','.NAME+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002622 )
2623 {
2624 D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2625 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2626 if (_token == NULL) {
2627 D(p->level--);
2628 return NULL;
2629 }
2630 int _end_lineno = _token->end_lineno;
2631 UNUSED(_end_lineno); // Only used by EXTRA macro
2632 int _end_col_offset = _token->end_col_offset;
2633 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002634 _res = _Py_Global ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002635 if (_res == NULL && PyErr_Occurred()) {
2636 p->error_indicator = 1;
2637 D(p->level--);
2638 return NULL;
2639 }
2640 goto done;
2641 }
2642 p->mark = _mark;
2643 D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2644 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
2645 }
2646 _res = NULL;
2647 done:
2648 D(p->level--);
2649 return _res;
2650}
2651
2652// nonlocal_stmt: 'nonlocal' ','.NAME+
2653static stmt_ty
2654nonlocal_stmt_rule(Parser *p)
2655{
2656 D(p->level++);
2657 if (p->error_indicator) {
2658 D(p->level--);
2659 return NULL;
2660 }
2661 stmt_ty _res = NULL;
2662 int _mark = p->mark;
2663 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2664 p->error_indicator = 1;
2665 D(p->level--);
2666 return NULL;
2667 }
2668 int _start_lineno = p->tokens[_mark]->lineno;
2669 UNUSED(_start_lineno); // Only used by EXTRA macro
2670 int _start_col_offset = p->tokens[_mark]->col_offset;
2671 UNUSED(_start_col_offset); // Only used by EXTRA macro
2672 { // 'nonlocal' ','.NAME+
2673 if (p->error_indicator) {
2674 D(p->level--);
2675 return NULL;
2676 }
2677 D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2678 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01002679 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002680 if (
2681 (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal'
2682 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01002683 (a = (asdl_expr_seq*)_gather_27_rule(p)) // ','.NAME+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002684 )
2685 {
2686 D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2687 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2688 if (_token == NULL) {
2689 D(p->level--);
2690 return NULL;
2691 }
2692 int _end_lineno = _token->end_lineno;
2693 UNUSED(_end_lineno); // Only used by EXTRA macro
2694 int _end_col_offset = _token->end_col_offset;
2695 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002696 _res = _Py_Nonlocal ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002697 if (_res == NULL && PyErr_Occurred()) {
2698 p->error_indicator = 1;
2699 D(p->level--);
2700 return NULL;
2701 }
2702 goto done;
2703 }
2704 p->mark = _mark;
2705 D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2706 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
2707 }
2708 _res = NULL;
2709 done:
2710 D(p->level--);
2711 return _res;
2712}
2713
2714// yield_stmt: yield_expr
2715static stmt_ty
2716yield_stmt_rule(Parser *p)
2717{
2718 D(p->level++);
2719 if (p->error_indicator) {
2720 D(p->level--);
2721 return NULL;
2722 }
2723 stmt_ty _res = NULL;
2724 int _mark = p->mark;
2725 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2726 p->error_indicator = 1;
2727 D(p->level--);
2728 return NULL;
2729 }
2730 int _start_lineno = p->tokens[_mark]->lineno;
2731 UNUSED(_start_lineno); // Only used by EXTRA macro
2732 int _start_col_offset = p->tokens[_mark]->col_offset;
2733 UNUSED(_start_col_offset); // Only used by EXTRA macro
2734 { // yield_expr
2735 if (p->error_indicator) {
2736 D(p->level--);
2737 return NULL;
2738 }
2739 D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2740 expr_ty y;
2741 if (
2742 (y = yield_expr_rule(p)) // yield_expr
2743 )
2744 {
2745 D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2746 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2747 if (_token == NULL) {
2748 D(p->level--);
2749 return NULL;
2750 }
2751 int _end_lineno = _token->end_lineno;
2752 UNUSED(_end_lineno); // Only used by EXTRA macro
2753 int _end_col_offset = _token->end_col_offset;
2754 UNUSED(_end_col_offset); // Only used by EXTRA macro
2755 _res = _Py_Expr ( y , EXTRA );
2756 if (_res == NULL && PyErr_Occurred()) {
2757 p->error_indicator = 1;
2758 D(p->level--);
2759 return NULL;
2760 }
2761 goto done;
2762 }
2763 p->mark = _mark;
2764 D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2765 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
2766 }
2767 _res = NULL;
2768 done:
2769 D(p->level--);
2770 return _res;
2771}
2772
2773// assert_stmt: 'assert' expression [',' expression]
2774static stmt_ty
2775assert_stmt_rule(Parser *p)
2776{
2777 D(p->level++);
2778 if (p->error_indicator) {
2779 D(p->level--);
2780 return NULL;
2781 }
2782 stmt_ty _res = NULL;
2783 int _mark = p->mark;
2784 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2785 p->error_indicator = 1;
2786 D(p->level--);
2787 return NULL;
2788 }
2789 int _start_lineno = p->tokens[_mark]->lineno;
2790 UNUSED(_start_lineno); // Only used by EXTRA macro
2791 int _start_col_offset = p->tokens[_mark]->col_offset;
2792 UNUSED(_start_col_offset); // Only used by EXTRA macro
2793 { // 'assert' expression [',' expression]
2794 if (p->error_indicator) {
2795 D(p->level--);
2796 return NULL;
2797 }
2798 D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2799 Token * _keyword;
2800 expr_ty a;
2801 void *b;
2802 if (
2803 (_keyword = _PyPegen_expect_token(p, 505)) // token='assert'
2804 &&
2805 (a = expression_rule(p)) // expression
2806 &&
2807 (b = _tmp_29_rule(p), 1) // [',' expression]
2808 )
2809 {
2810 D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2811 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2812 if (_token == NULL) {
2813 D(p->level--);
2814 return NULL;
2815 }
2816 int _end_lineno = _token->end_lineno;
2817 UNUSED(_end_lineno); // Only used by EXTRA macro
2818 int _end_col_offset = _token->end_col_offset;
2819 UNUSED(_end_col_offset); // Only used by EXTRA macro
2820 _res = _Py_Assert ( a , b , EXTRA );
2821 if (_res == NULL && PyErr_Occurred()) {
2822 p->error_indicator = 1;
2823 D(p->level--);
2824 return NULL;
2825 }
2826 goto done;
2827 }
2828 p->mark = _mark;
2829 D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2830 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
2831 }
2832 _res = NULL;
2833 done:
2834 D(p->level--);
2835 return _res;
2836}
2837
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002838// del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002839static stmt_ty
2840del_stmt_rule(Parser *p)
2841{
2842 D(p->level++);
2843 if (p->error_indicator) {
2844 D(p->level--);
2845 return NULL;
2846 }
2847 stmt_ty _res = NULL;
2848 int _mark = p->mark;
2849 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2850 p->error_indicator = 1;
2851 D(p->level--);
2852 return NULL;
2853 }
2854 int _start_lineno = p->tokens[_mark]->lineno;
2855 UNUSED(_start_lineno); // Only used by EXTRA macro
2856 int _start_col_offset = p->tokens[_mark]->col_offset;
2857 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002858 { // 'del' del_targets &(';' | NEWLINE)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002859 if (p->error_indicator) {
2860 D(p->level--);
2861 return NULL;
2862 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002863 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 +01002864 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01002865 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002866 if (
2867 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
2868 &&
2869 (a = del_targets_rule(p)) // del_targets
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002870 &&
2871 _PyPegen_lookahead(1, _tmp_30_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002872 )
2873 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002874 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 +01002875 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2876 if (_token == NULL) {
2877 D(p->level--);
2878 return NULL;
2879 }
2880 int _end_lineno = _token->end_lineno;
2881 UNUSED(_end_lineno); // Only used by EXTRA macro
2882 int _end_col_offset = _token->end_col_offset;
2883 UNUSED(_end_col_offset); // Only used by EXTRA macro
2884 _res = _Py_Delete ( a , EXTRA );
2885 if (_res == NULL && PyErr_Occurred()) {
2886 p->error_indicator = 1;
2887 D(p->level--);
2888 return NULL;
2889 }
2890 goto done;
2891 }
2892 p->mark = _mark;
2893 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002894 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
2895 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02002896 if (p->call_invalid_rules) { // invalid_del_stmt
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002897 if (p->error_indicator) {
2898 D(p->level--);
2899 return NULL;
2900 }
2901 D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2902 void *invalid_del_stmt_var;
2903 if (
2904 (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt
2905 )
2906 {
2907 D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2908 _res = invalid_del_stmt_var;
2909 goto done;
2910 }
2911 p->mark = _mark;
2912 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2913 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002914 }
2915 _res = NULL;
2916 done:
2917 D(p->level--);
2918 return _res;
2919}
2920
2921// import_stmt: import_name | import_from
2922static stmt_ty
2923import_stmt_rule(Parser *p)
2924{
2925 D(p->level++);
2926 if (p->error_indicator) {
2927 D(p->level--);
2928 return NULL;
2929 }
2930 stmt_ty _res = NULL;
2931 int _mark = p->mark;
2932 { // import_name
2933 if (p->error_indicator) {
2934 D(p->level--);
2935 return NULL;
2936 }
2937 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name"));
2938 stmt_ty import_name_var;
2939 if (
2940 (import_name_var = import_name_rule(p)) // import_name
2941 )
2942 {
2943 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name"));
2944 _res = import_name_var;
2945 goto done;
2946 }
2947 p->mark = _mark;
2948 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2949 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name"));
2950 }
2951 { // import_from
2952 if (p->error_indicator) {
2953 D(p->level--);
2954 return NULL;
2955 }
2956 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from"));
2957 stmt_ty import_from_var;
2958 if (
2959 (import_from_var = import_from_rule(p)) // import_from
2960 )
2961 {
2962 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from"));
2963 _res = import_from_var;
2964 goto done;
2965 }
2966 p->mark = _mark;
2967 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2968 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from"));
2969 }
2970 _res = NULL;
2971 done:
2972 D(p->level--);
2973 return _res;
2974}
2975
2976// import_name: 'import' dotted_as_names
2977static stmt_ty
2978import_name_rule(Parser *p)
2979{
2980 D(p->level++);
2981 if (p->error_indicator) {
2982 D(p->level--);
2983 return NULL;
2984 }
2985 stmt_ty _res = NULL;
2986 int _mark = p->mark;
2987 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2988 p->error_indicator = 1;
2989 D(p->level--);
2990 return NULL;
2991 }
2992 int _start_lineno = p->tokens[_mark]->lineno;
2993 UNUSED(_start_lineno); // Only used by EXTRA macro
2994 int _start_col_offset = p->tokens[_mark]->col_offset;
2995 UNUSED(_start_col_offset); // Only used by EXTRA macro
2996 { // 'import' dotted_as_names
2997 if (p->error_indicator) {
2998 D(p->level--);
2999 return NULL;
3000 }
3001 D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
3002 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003003 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003004 if (
3005 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
3006 &&
3007 (a = dotted_as_names_rule(p)) // dotted_as_names
3008 )
3009 {
3010 D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
3011 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3012 if (_token == NULL) {
3013 D(p->level--);
3014 return NULL;
3015 }
3016 int _end_lineno = _token->end_lineno;
3017 UNUSED(_end_lineno); // Only used by EXTRA macro
3018 int _end_col_offset = _token->end_col_offset;
3019 UNUSED(_end_col_offset); // Only used by EXTRA macro
3020 _res = _Py_Import ( a , EXTRA );
3021 if (_res == NULL && PyErr_Occurred()) {
3022 p->error_indicator = 1;
3023 D(p->level--);
3024 return NULL;
3025 }
3026 goto done;
3027 }
3028 p->mark = _mark;
3029 D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ',
3030 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names"));
3031 }
3032 _res = NULL;
3033 done:
3034 D(p->level--);
3035 return _res;
3036}
3037
3038// import_from:
3039// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3040// | 'from' (('.' | '...'))+ 'import' import_from_targets
3041static stmt_ty
3042import_from_rule(Parser *p)
3043{
3044 D(p->level++);
3045 if (p->error_indicator) {
3046 D(p->level--);
3047 return NULL;
3048 }
3049 stmt_ty _res = NULL;
3050 int _mark = p->mark;
3051 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3052 p->error_indicator = 1;
3053 D(p->level--);
3054 return NULL;
3055 }
3056 int _start_lineno = p->tokens[_mark]->lineno;
3057 UNUSED(_start_lineno); // Only used by EXTRA macro
3058 int _start_col_offset = p->tokens[_mark]->col_offset;
3059 UNUSED(_start_col_offset); // Only used by EXTRA macro
3060 { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3061 if (p->error_indicator) {
3062 D(p->level--);
3063 return NULL;
3064 }
3065 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3066 Token * _keyword;
3067 Token * _keyword_1;
3068 asdl_seq * a;
3069 expr_ty b;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003070 asdl_alias_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003071 if (
3072 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3073 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003074 (a = _loop0_31_rule(p)) // (('.' | '...'))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003075 &&
3076 (b = dotted_name_rule(p)) // dotted_name
3077 &&
3078 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3079 &&
3080 (c = import_from_targets_rule(p)) // import_from_targets
3081 )
3082 {
3083 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3084 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3085 if (_token == NULL) {
3086 D(p->level--);
3087 return NULL;
3088 }
3089 int _end_lineno = _token->end_lineno;
3090 UNUSED(_end_lineno); // Only used by EXTRA macro
3091 int _end_col_offset = _token->end_col_offset;
3092 UNUSED(_end_col_offset); // Only used by EXTRA macro
3093 _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
3094 if (_res == NULL && PyErr_Occurred()) {
3095 p->error_indicator = 1;
3096 D(p->level--);
3097 return NULL;
3098 }
3099 goto done;
3100 }
3101 p->mark = _mark;
3102 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3103 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3104 }
3105 { // 'from' (('.' | '...'))+ 'import' import_from_targets
3106 if (p->error_indicator) {
3107 D(p->level--);
3108 return NULL;
3109 }
3110 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3111 Token * _keyword;
3112 Token * _keyword_1;
3113 asdl_seq * a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003114 asdl_alias_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003115 if (
3116 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3117 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003118 (a = _loop1_32_rule(p)) // (('.' | '...'))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003119 &&
3120 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3121 &&
3122 (b = import_from_targets_rule(p)) // import_from_targets
3123 )
3124 {
3125 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3126 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3127 if (_token == NULL) {
3128 D(p->level--);
3129 return NULL;
3130 }
3131 int _end_lineno = _token->end_lineno;
3132 UNUSED(_end_lineno); // Only used by EXTRA macro
3133 int _end_col_offset = _token->end_col_offset;
3134 UNUSED(_end_col_offset); // Only used by EXTRA macro
3135 _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
3136 if (_res == NULL && PyErr_Occurred()) {
3137 p->error_indicator = 1;
3138 D(p->level--);
3139 return NULL;
3140 }
3141 goto done;
3142 }
3143 p->mark = _mark;
3144 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3145 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3146 }
3147 _res = NULL;
3148 done:
3149 D(p->level--);
3150 return _res;
3151}
3152
3153// import_from_targets:
3154// | '(' import_from_as_names ','? ')'
3155// | import_from_as_names !','
3156// | '*'
3157// | invalid_import_from_targets
Pablo Galindoa5634c42020-09-16 19:42:00 +01003158static asdl_alias_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003159import_from_targets_rule(Parser *p)
3160{
3161 D(p->level++);
3162 if (p->error_indicator) {
3163 D(p->level--);
3164 return NULL;
3165 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003166 asdl_alias_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003167 int _mark = p->mark;
3168 { // '(' import_from_as_names ','? ')'
3169 if (p->error_indicator) {
3170 D(p->level--);
3171 return NULL;
3172 }
3173 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3174 Token * _literal;
3175 Token * _literal_1;
3176 void *_opt_var;
3177 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01003178 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003179 if (
3180 (_literal = _PyPegen_expect_token(p, 7)) // token='('
3181 &&
3182 (a = import_from_as_names_rule(p)) // import_from_as_names
3183 &&
3184 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
3185 &&
3186 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
3187 )
3188 {
3189 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3190 _res = a;
3191 if (_res == NULL && PyErr_Occurred()) {
3192 p->error_indicator = 1;
3193 D(p->level--);
3194 return NULL;
3195 }
3196 goto done;
3197 }
3198 p->mark = _mark;
3199 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3200 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3201 }
3202 { // import_from_as_names !','
3203 if (p->error_indicator) {
3204 D(p->level--);
3205 return NULL;
3206 }
3207 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 +01003208 asdl_alias_seq* import_from_as_names_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003209 if (
3210 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
3211 &&
3212 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
3213 )
3214 {
3215 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
3216 _res = import_from_as_names_var;
3217 goto done;
3218 }
3219 p->mark = _mark;
3220 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3221 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','"));
3222 }
3223 { // '*'
3224 if (p->error_indicator) {
3225 D(p->level--);
3226 return NULL;
3227 }
3228 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
3229 Token * _literal;
3230 if (
3231 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
3232 )
3233 {
3234 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03003235 _res = ( asdl_alias_seq * ) _PyPegen_singleton_seq ( p , CHECK ( alias_ty , _PyPegen_alias_for_star ( p ) ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003236 if (_res == NULL && PyErr_Occurred()) {
3237 p->error_indicator = 1;
3238 D(p->level--);
3239 return NULL;
3240 }
3241 goto done;
3242 }
3243 p->mark = _mark;
3244 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3245 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
3246 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02003247 if (p->call_invalid_rules) { // invalid_import_from_targets
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003248 if (p->error_indicator) {
3249 D(p->level--);
3250 return NULL;
3251 }
3252 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3253 void *invalid_import_from_targets_var;
3254 if (
3255 (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets
3256 )
3257 {
3258 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3259 _res = invalid_import_from_targets_var;
3260 goto done;
3261 }
3262 p->mark = _mark;
3263 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3264 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets"));
3265 }
3266 _res = NULL;
3267 done:
3268 D(p->level--);
3269 return _res;
3270}
3271
3272// import_from_as_names: ','.import_from_as_name+
Pablo Galindoa5634c42020-09-16 19:42:00 +01003273static asdl_alias_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003274import_from_as_names_rule(Parser *p)
3275{
3276 D(p->level++);
3277 if (p->error_indicator) {
3278 D(p->level--);
3279 return NULL;
3280 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003281 asdl_alias_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003282 int _mark = p->mark;
3283 { // ','.import_from_as_name+
3284 if (p->error_indicator) {
3285 D(p->level--);
3286 return NULL;
3287 }
3288 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 +01003289 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003290 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01003291 (a = (asdl_alias_seq*)_gather_33_rule(p)) // ','.import_from_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003292 )
3293 {
3294 D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
3295 _res = a;
3296 if (_res == NULL && PyErr_Occurred()) {
3297 p->error_indicator = 1;
3298 D(p->level--);
3299 return NULL;
3300 }
3301 goto done;
3302 }
3303 p->mark = _mark;
3304 D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3305 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+"));
3306 }
3307 _res = NULL;
3308 done:
3309 D(p->level--);
3310 return _res;
3311}
3312
3313// import_from_as_name: NAME ['as' NAME]
3314static alias_ty
3315import_from_as_name_rule(Parser *p)
3316{
3317 D(p->level++);
3318 if (p->error_indicator) {
3319 D(p->level--);
3320 return NULL;
3321 }
3322 alias_ty _res = NULL;
3323 int _mark = p->mark;
3324 { // NAME ['as' NAME]
3325 if (p->error_indicator) {
3326 D(p->level--);
3327 return NULL;
3328 }
3329 D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3330 expr_ty a;
3331 void *b;
3332 if (
3333 (a = _PyPegen_name_token(p)) // NAME
3334 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003335 (b = _tmp_35_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003336 )
3337 {
3338 D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3339 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3340 if (_res == NULL && PyErr_Occurred()) {
3341 p->error_indicator = 1;
3342 D(p->level--);
3343 return NULL;
3344 }
3345 goto done;
3346 }
3347 p->mark = _mark;
3348 D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3349 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]"));
3350 }
3351 _res = NULL;
3352 done:
3353 D(p->level--);
3354 return _res;
3355}
3356
3357// dotted_as_names: ','.dotted_as_name+
Pablo Galindoa5634c42020-09-16 19:42:00 +01003358static asdl_alias_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003359dotted_as_names_rule(Parser *p)
3360{
3361 D(p->level++);
3362 if (p->error_indicator) {
3363 D(p->level--);
3364 return NULL;
3365 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003366 asdl_alias_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003367 int _mark = p->mark;
3368 { // ','.dotted_as_name+
3369 if (p->error_indicator) {
3370 D(p->level--);
3371 return NULL;
3372 }
3373 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 +01003374 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003375 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01003376 (a = (asdl_alias_seq*)_gather_36_rule(p)) // ','.dotted_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003377 )
3378 {
3379 D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
3380 _res = a;
3381 if (_res == NULL && PyErr_Occurred()) {
3382 p->error_indicator = 1;
3383 D(p->level--);
3384 return NULL;
3385 }
3386 goto done;
3387 }
3388 p->mark = _mark;
3389 D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3390 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+"));
3391 }
3392 _res = NULL;
3393 done:
3394 D(p->level--);
3395 return _res;
3396}
3397
3398// dotted_as_name: dotted_name ['as' NAME]
3399static alias_ty
3400dotted_as_name_rule(Parser *p)
3401{
3402 D(p->level++);
3403 if (p->error_indicator) {
3404 D(p->level--);
3405 return NULL;
3406 }
3407 alias_ty _res = NULL;
3408 int _mark = p->mark;
3409 { // dotted_name ['as' NAME]
3410 if (p->error_indicator) {
3411 D(p->level--);
3412 return NULL;
3413 }
3414 D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3415 expr_ty a;
3416 void *b;
3417 if (
3418 (a = dotted_name_rule(p)) // dotted_name
3419 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003420 (b = _tmp_38_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003421 )
3422 {
3423 D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3424 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3425 if (_res == NULL && PyErr_Occurred()) {
3426 p->error_indicator = 1;
3427 D(p->level--);
3428 return NULL;
3429 }
3430 goto done;
3431 }
3432 p->mark = _mark;
3433 D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3434 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]"));
3435 }
3436 _res = NULL;
3437 done:
3438 D(p->level--);
3439 return _res;
3440}
3441
3442// Left-recursive
3443// dotted_name: dotted_name '.' NAME | NAME
3444static expr_ty dotted_name_raw(Parser *);
3445static expr_ty
3446dotted_name_rule(Parser *p)
3447{
3448 D(p->level++);
3449 expr_ty _res = NULL;
3450 if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) {
3451 D(p->level--);
3452 return _res;
3453 }
3454 int _mark = p->mark;
3455 int _resmark = p->mark;
3456 while (1) {
3457 int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res);
3458 if (tmpvar_0) {
3459 D(p->level--);
3460 return _res;
3461 }
3462 p->mark = _mark;
3463 void *_raw = dotted_name_raw(p);
Lysandros Nikolaou02cdfc92020-10-31 20:31:41 +02003464 if (p->error_indicator)
3465 return NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003466 if (_raw == NULL || p->mark <= _resmark)
3467 break;
3468 _resmark = p->mark;
3469 _res = _raw;
3470 }
3471 p->mark = _resmark;
3472 D(p->level--);
3473 return _res;
3474}
3475static expr_ty
3476dotted_name_raw(Parser *p)
3477{
3478 D(p->level++);
3479 if (p->error_indicator) {
3480 D(p->level--);
3481 return NULL;
3482 }
3483 expr_ty _res = NULL;
3484 int _mark = p->mark;
3485 { // dotted_name '.' NAME
3486 if (p->error_indicator) {
3487 D(p->level--);
3488 return NULL;
3489 }
3490 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3491 Token * _literal;
3492 expr_ty a;
3493 expr_ty b;
3494 if (
3495 (a = dotted_name_rule(p)) // dotted_name
3496 &&
3497 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
3498 &&
3499 (b = _PyPegen_name_token(p)) // NAME
3500 )
3501 {
3502 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3503 _res = _PyPegen_join_names_with_dot ( p , a , b );
3504 if (_res == NULL && PyErr_Occurred()) {
3505 p->error_indicator = 1;
3506 D(p->level--);
3507 return NULL;
3508 }
3509 goto done;
3510 }
3511 p->mark = _mark;
3512 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3513 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME"));
3514 }
3515 { // NAME
3516 if (p->error_indicator) {
3517 D(p->level--);
3518 return NULL;
3519 }
3520 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
3521 expr_ty name_var;
3522 if (
3523 (name_var = _PyPegen_name_token(p)) // NAME
3524 )
3525 {
3526 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
3527 _res = name_var;
3528 goto done;
3529 }
3530 p->mark = _mark;
3531 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3532 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
3533 }
3534 _res = NULL;
3535 done:
3536 D(p->level--);
3537 return _res;
3538}
3539
3540// if_stmt:
3541// | 'if' named_expression ':' block elif_stmt
3542// | 'if' named_expression ':' block else_block?
3543static stmt_ty
3544if_stmt_rule(Parser *p)
3545{
3546 D(p->level++);
3547 if (p->error_indicator) {
3548 D(p->level--);
3549 return NULL;
3550 }
3551 stmt_ty _res = NULL;
3552 int _mark = p->mark;
3553 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3554 p->error_indicator = 1;
3555 D(p->level--);
3556 return NULL;
3557 }
3558 int _start_lineno = p->tokens[_mark]->lineno;
3559 UNUSED(_start_lineno); // Only used by EXTRA macro
3560 int _start_col_offset = p->tokens[_mark]->col_offset;
3561 UNUSED(_start_col_offset); // Only used by EXTRA macro
3562 { // 'if' named_expression ':' block elif_stmt
3563 if (p->error_indicator) {
3564 D(p->level--);
3565 return NULL;
3566 }
3567 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3568 Token * _keyword;
3569 Token * _literal;
3570 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003571 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003572 stmt_ty c;
3573 if (
3574 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3575 &&
3576 (a = named_expression_rule(p)) // named_expression
3577 &&
3578 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3579 &&
3580 (b = block_rule(p)) // block
3581 &&
3582 (c = elif_stmt_rule(p)) // elif_stmt
3583 )
3584 {
3585 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3586 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3587 if (_token == NULL) {
3588 D(p->level--);
3589 return NULL;
3590 }
3591 int _end_lineno = _token->end_lineno;
3592 UNUSED(_end_lineno); // Only used by EXTRA macro
3593 int _end_col_offset = _token->end_col_offset;
3594 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03003595 _res = _Py_If ( a , b , CHECK ( asdl_stmt_seq * , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003596 if (_res == NULL && PyErr_Occurred()) {
3597 p->error_indicator = 1;
3598 D(p->level--);
3599 return NULL;
3600 }
3601 goto done;
3602 }
3603 p->mark = _mark;
3604 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3605 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3606 }
3607 { // 'if' named_expression ':' block else_block?
3608 if (p->error_indicator) {
3609 D(p->level--);
3610 return NULL;
3611 }
3612 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3613 Token * _keyword;
3614 Token * _literal;
3615 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003616 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003617 void *c;
3618 if (
3619 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3620 &&
3621 (a = named_expression_rule(p)) // named_expression
3622 &&
3623 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3624 &&
3625 (b = block_rule(p)) // block
3626 &&
3627 (c = else_block_rule(p), 1) // else_block?
3628 )
3629 {
3630 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3631 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3632 if (_token == NULL) {
3633 D(p->level--);
3634 return NULL;
3635 }
3636 int _end_lineno = _token->end_lineno;
3637 UNUSED(_end_lineno); // Only used by EXTRA macro
3638 int _end_col_offset = _token->end_col_offset;
3639 UNUSED(_end_col_offset); // Only used by EXTRA macro
3640 _res = _Py_If ( a , b , c , EXTRA );
3641 if (_res == NULL && PyErr_Occurred()) {
3642 p->error_indicator = 1;
3643 D(p->level--);
3644 return NULL;
3645 }
3646 goto done;
3647 }
3648 p->mark = _mark;
3649 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3650 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?"));
3651 }
3652 _res = NULL;
3653 done:
3654 D(p->level--);
3655 return _res;
3656}
3657
3658// elif_stmt:
3659// | 'elif' named_expression ':' block elif_stmt
3660// | 'elif' named_expression ':' block else_block?
3661static stmt_ty
3662elif_stmt_rule(Parser *p)
3663{
3664 D(p->level++);
3665 if (p->error_indicator) {
3666 D(p->level--);
3667 return NULL;
3668 }
3669 stmt_ty _res = NULL;
3670 int _mark = p->mark;
3671 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3672 p->error_indicator = 1;
3673 D(p->level--);
3674 return NULL;
3675 }
3676 int _start_lineno = p->tokens[_mark]->lineno;
3677 UNUSED(_start_lineno); // Only used by EXTRA macro
3678 int _start_col_offset = p->tokens[_mark]->col_offset;
3679 UNUSED(_start_col_offset); // Only used by EXTRA macro
3680 { // 'elif' named_expression ':' block elif_stmt
3681 if (p->error_indicator) {
3682 D(p->level--);
3683 return NULL;
3684 }
3685 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3686 Token * _keyword;
3687 Token * _literal;
3688 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003689 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003690 stmt_ty c;
3691 if (
3692 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3693 &&
3694 (a = named_expression_rule(p)) // named_expression
3695 &&
3696 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3697 &&
3698 (b = block_rule(p)) // block
3699 &&
3700 (c = elif_stmt_rule(p)) // elif_stmt
3701 )
3702 {
3703 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3704 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3705 if (_token == NULL) {
3706 D(p->level--);
3707 return NULL;
3708 }
3709 int _end_lineno = _token->end_lineno;
3710 UNUSED(_end_lineno); // Only used by EXTRA macro
3711 int _end_col_offset = _token->end_col_offset;
3712 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03003713 _res = _Py_If ( a , b , CHECK ( asdl_stmt_seq * , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003714 if (_res == NULL && PyErr_Occurred()) {
3715 p->error_indicator = 1;
3716 D(p->level--);
3717 return NULL;
3718 }
3719 goto done;
3720 }
3721 p->mark = _mark;
3722 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3723 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3724 }
3725 { // 'elif' named_expression ':' block else_block?
3726 if (p->error_indicator) {
3727 D(p->level--);
3728 return NULL;
3729 }
3730 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3731 Token * _keyword;
3732 Token * _literal;
3733 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003734 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003735 void *c;
3736 if (
3737 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3738 &&
3739 (a = named_expression_rule(p)) // named_expression
3740 &&
3741 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3742 &&
3743 (b = block_rule(p)) // block
3744 &&
3745 (c = else_block_rule(p), 1) // else_block?
3746 )
3747 {
3748 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3749 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3750 if (_token == NULL) {
3751 D(p->level--);
3752 return NULL;
3753 }
3754 int _end_lineno = _token->end_lineno;
3755 UNUSED(_end_lineno); // Only used by EXTRA macro
3756 int _end_col_offset = _token->end_col_offset;
3757 UNUSED(_end_col_offset); // Only used by EXTRA macro
3758 _res = _Py_If ( a , b , c , EXTRA );
3759 if (_res == NULL && PyErr_Occurred()) {
3760 p->error_indicator = 1;
3761 D(p->level--);
3762 return NULL;
3763 }
3764 goto done;
3765 }
3766 p->mark = _mark;
3767 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3768 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3769 }
3770 _res = NULL;
3771 done:
3772 D(p->level--);
3773 return _res;
3774}
3775
3776// else_block: 'else' ':' block
Pablo Galindoa5634c42020-09-16 19:42:00 +01003777static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003778else_block_rule(Parser *p)
3779{
3780 D(p->level++);
3781 if (p->error_indicator) {
3782 D(p->level--);
3783 return NULL;
3784 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003785 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003786 int _mark = p->mark;
3787 { // 'else' ':' block
3788 if (p->error_indicator) {
3789 D(p->level--);
3790 return NULL;
3791 }
3792 D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3793 Token * _keyword;
3794 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003795 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003796 if (
3797 (_keyword = _PyPegen_expect_token(p, 516)) // token='else'
3798 &&
3799 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3800 &&
3801 (b = block_rule(p)) // block
3802 )
3803 {
3804 D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3805 _res = b;
3806 if (_res == NULL && PyErr_Occurred()) {
3807 p->error_indicator = 1;
3808 D(p->level--);
3809 return NULL;
3810 }
3811 goto done;
3812 }
3813 p->mark = _mark;
3814 D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
3815 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block"));
3816 }
3817 _res = NULL;
3818 done:
3819 D(p->level--);
3820 return _res;
3821}
3822
3823// while_stmt: 'while' named_expression ':' block else_block?
3824static stmt_ty
3825while_stmt_rule(Parser *p)
3826{
3827 D(p->level++);
3828 if (p->error_indicator) {
3829 D(p->level--);
3830 return NULL;
3831 }
3832 stmt_ty _res = NULL;
3833 int _mark = p->mark;
3834 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3835 p->error_indicator = 1;
3836 D(p->level--);
3837 return NULL;
3838 }
3839 int _start_lineno = p->tokens[_mark]->lineno;
3840 UNUSED(_start_lineno); // Only used by EXTRA macro
3841 int _start_col_offset = p->tokens[_mark]->col_offset;
3842 UNUSED(_start_col_offset); // Only used by EXTRA macro
3843 { // 'while' named_expression ':' block else_block?
3844 if (p->error_indicator) {
3845 D(p->level--);
3846 return NULL;
3847 }
3848 D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3849 Token * _keyword;
3850 Token * _literal;
3851 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003852 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003853 void *c;
3854 if (
3855 (_keyword = _PyPegen_expect_token(p, 512)) // token='while'
3856 &&
3857 (a = named_expression_rule(p)) // named_expression
3858 &&
3859 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3860 &&
3861 (b = block_rule(p)) // block
3862 &&
3863 (c = else_block_rule(p), 1) // else_block?
3864 )
3865 {
3866 D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3867 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3868 if (_token == NULL) {
3869 D(p->level--);
3870 return NULL;
3871 }
3872 int _end_lineno = _token->end_lineno;
3873 UNUSED(_end_lineno); // Only used by EXTRA macro
3874 int _end_col_offset = _token->end_col_offset;
3875 UNUSED(_end_col_offset); // Only used by EXTRA macro
3876 _res = _Py_While ( a , b , c , EXTRA );
3877 if (_res == NULL && PyErr_Occurred()) {
3878 p->error_indicator = 1;
3879 D(p->level--);
3880 return NULL;
3881 }
3882 goto done;
3883 }
3884 p->mark = _mark;
3885 D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3886 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?"));
3887 }
3888 _res = NULL;
3889 done:
3890 D(p->level--);
3891 return _res;
3892}
3893
3894// for_stmt:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003895// | 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3896// | ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3897// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003898static stmt_ty
3899for_stmt_rule(Parser *p)
3900{
3901 D(p->level++);
3902 if (p->error_indicator) {
3903 D(p->level--);
3904 return NULL;
3905 }
3906 stmt_ty _res = NULL;
3907 int _mark = p->mark;
3908 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3909 p->error_indicator = 1;
3910 D(p->level--);
3911 return NULL;
3912 }
3913 int _start_lineno = p->tokens[_mark]->lineno;
3914 UNUSED(_start_lineno); // Only used by EXTRA macro
3915 int _start_col_offset = p->tokens[_mark]->col_offset;
3916 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003917 { // 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003918 if (p->error_indicator) {
3919 D(p->level--);
3920 return NULL;
3921 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003922 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?"));
3923 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003924 Token * _keyword;
3925 Token * _keyword_1;
3926 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003927 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003928 void *el;
3929 expr_ty ex;
3930 expr_ty t;
3931 void *tc;
3932 if (
3933 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3934 &&
3935 (t = star_targets_rule(p)) // star_targets
3936 &&
3937 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3938 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003939 (_cut_var = 1)
3940 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003941 (ex = star_expressions_rule(p)) // star_expressions
3942 &&
3943 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3944 &&
3945 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
3946 &&
3947 (b = block_rule(p)) // block
3948 &&
3949 (el = else_block_rule(p), 1) // else_block?
3950 )
3951 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003952 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 +01003953 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3954 if (_token == NULL) {
3955 D(p->level--);
3956 return NULL;
3957 }
3958 int _end_lineno = _token->end_lineno;
3959 UNUSED(_end_lineno); // Only used by EXTRA macro
3960 int _end_col_offset = _token->end_col_offset;
3961 UNUSED(_end_col_offset); // Only used by EXTRA macro
3962 _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
3963 if (_res == NULL && PyErr_Occurred()) {
3964 p->error_indicator = 1;
3965 D(p->level--);
3966 return NULL;
3967 }
3968 goto done;
3969 }
3970 p->mark = _mark;
3971 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003972 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
3973 if (_cut_var) {
3974 D(p->level--);
3975 return NULL;
3976 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003977 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003978 { // ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003979 if (p->error_indicator) {
3980 D(p->level--);
3981 return NULL;
3982 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003983 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?"));
3984 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003985 Token * _keyword;
3986 Token * _keyword_1;
3987 Token * _literal;
3988 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003989 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003990 void *el;
3991 expr_ty ex;
3992 expr_ty t;
3993 void *tc;
3994 if (
3995 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
3996 &&
3997 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3998 &&
3999 (t = star_targets_rule(p)) // star_targets
4000 &&
4001 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
4002 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004003 (_cut_var = 1)
4004 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004005 (ex = star_expressions_rule(p)) // star_expressions
4006 &&
4007 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4008 &&
4009 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4010 &&
4011 (b = block_rule(p)) // block
4012 &&
4013 (el = else_block_rule(p), 1) // else_block?
4014 )
4015 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004016 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 +01004017 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4018 if (_token == NULL) {
4019 D(p->level--);
4020 return NULL;
4021 }
4022 int _end_lineno = _token->end_lineno;
4023 UNUSED(_end_lineno); // Only used by EXTRA macro
4024 int _end_col_offset = _token->end_col_offset;
4025 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004026 _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 +01004027 if (_res == NULL && PyErr_Occurred()) {
4028 p->error_indicator = 1;
4029 D(p->level--);
4030 return NULL;
4031 }
4032 goto done;
4033 }
4034 p->mark = _mark;
4035 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004036 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
4037 if (_cut_var) {
4038 D(p->level--);
4039 return NULL;
4040 }
4041 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02004042 if (p->call_invalid_rules) { // invalid_for_target
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004043 if (p->error_indicator) {
4044 D(p->level--);
4045 return NULL;
4046 }
4047 D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4048 void *invalid_for_target_var;
4049 if (
4050 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
4051 )
4052 {
4053 D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4054 _res = invalid_for_target_var;
4055 goto done;
4056 }
4057 p->mark = _mark;
4058 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4059 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004060 }
4061 _res = NULL;
4062 done:
4063 D(p->level--);
4064 return _res;
4065}
4066
4067// with_stmt:
4068// | 'with' '(' ','.with_item+ ','? ')' ':' block
4069// | 'with' ','.with_item+ ':' TYPE_COMMENT? block
4070// | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4071// | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4072static stmt_ty
4073with_stmt_rule(Parser *p)
4074{
4075 D(p->level++);
4076 if (p->error_indicator) {
4077 D(p->level--);
4078 return NULL;
4079 }
4080 stmt_ty _res = NULL;
4081 int _mark = p->mark;
4082 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4083 p->error_indicator = 1;
4084 D(p->level--);
4085 return NULL;
4086 }
4087 int _start_lineno = p->tokens[_mark]->lineno;
4088 UNUSED(_start_lineno); // Only used by EXTRA macro
4089 int _start_col_offset = p->tokens[_mark]->col_offset;
4090 UNUSED(_start_col_offset); // Only used by EXTRA macro
4091 { // 'with' '(' ','.with_item+ ','? ')' ':' block
4092 if (p->error_indicator) {
4093 D(p->level--);
4094 return NULL;
4095 }
4096 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4097 Token * _keyword;
4098 Token * _literal;
4099 Token * _literal_1;
4100 Token * _literal_2;
4101 void *_opt_var;
4102 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01004103 asdl_withitem_seq* a;
4104 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004105 if (
4106 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4107 &&
4108 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4109 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004110 (a = (asdl_withitem_seq*)_gather_39_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004111 &&
4112 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4113 &&
4114 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4115 &&
4116 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4117 &&
4118 (b = block_rule(p)) // block
4119 )
4120 {
4121 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4122 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4123 if (_token == NULL) {
4124 D(p->level--);
4125 return NULL;
4126 }
4127 int _end_lineno = _token->end_lineno;
4128 UNUSED(_end_lineno); // Only used by EXTRA macro
4129 int _end_col_offset = _token->end_col_offset;
4130 UNUSED(_end_col_offset); // Only used by EXTRA macro
4131 _res = _Py_With ( a , b , NULL , EXTRA );
4132 if (_res == NULL && PyErr_Occurred()) {
4133 p->error_indicator = 1;
4134 D(p->level--);
4135 return NULL;
4136 }
4137 goto done;
4138 }
4139 p->mark = _mark;
4140 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4141 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4142 }
4143 { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
4144 if (p->error_indicator) {
4145 D(p->level--);
4146 return NULL;
4147 }
4148 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4149 Token * _keyword;
4150 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004151 asdl_withitem_seq* a;
4152 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004153 void *tc;
4154 if (
4155 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4156 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004157 (a = (asdl_withitem_seq*)_gather_41_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004158 &&
4159 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4160 &&
4161 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4162 &&
4163 (b = block_rule(p)) // block
4164 )
4165 {
4166 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4167 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4168 if (_token == NULL) {
4169 D(p->level--);
4170 return NULL;
4171 }
4172 int _end_lineno = _token->end_lineno;
4173 UNUSED(_end_lineno); // Only used by EXTRA macro
4174 int _end_col_offset = _token->end_col_offset;
4175 UNUSED(_end_col_offset); // Only used by EXTRA macro
4176 _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4177 if (_res == NULL && PyErr_Occurred()) {
4178 p->error_indicator = 1;
4179 D(p->level--);
4180 return NULL;
4181 }
4182 goto done;
4183 }
4184 p->mark = _mark;
4185 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4186 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4187 }
4188 { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4189 if (p->error_indicator) {
4190 D(p->level--);
4191 return NULL;
4192 }
4193 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4194 Token * _keyword;
4195 Token * _literal;
4196 Token * _literal_1;
4197 Token * _literal_2;
4198 void *_opt_var;
4199 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01004200 asdl_withitem_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004201 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004202 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004203 if (
4204 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4205 &&
4206 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4207 &&
4208 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4209 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004210 (a = (asdl_withitem_seq*)_gather_43_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004211 &&
4212 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4213 &&
4214 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4215 &&
4216 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4217 &&
4218 (b = block_rule(p)) // block
4219 )
4220 {
4221 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4222 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4223 if (_token == NULL) {
4224 D(p->level--);
4225 return NULL;
4226 }
4227 int _end_lineno = _token->end_lineno;
4228 UNUSED(_end_lineno); // Only used by EXTRA macro
4229 int _end_col_offset = _token->end_col_offset;
4230 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004231 _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004232 if (_res == NULL && PyErr_Occurred()) {
4233 p->error_indicator = 1;
4234 D(p->level--);
4235 return NULL;
4236 }
4237 goto done;
4238 }
4239 p->mark = _mark;
4240 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4241 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4242 }
4243 { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4244 if (p->error_indicator) {
4245 D(p->level--);
4246 return NULL;
4247 }
4248 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4249 Token * _keyword;
4250 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004251 asdl_withitem_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004252 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004253 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004254 void *tc;
4255 if (
4256 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4257 &&
4258 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4259 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004260 (a = (asdl_withitem_seq*)_gather_45_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004261 &&
4262 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4263 &&
4264 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4265 &&
4266 (b = block_rule(p)) // block
4267 )
4268 {
4269 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4270 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4271 if (_token == NULL) {
4272 D(p->level--);
4273 return NULL;
4274 }
4275 int _end_lineno = _token->end_lineno;
4276 UNUSED(_end_lineno); // Only used by EXTRA macro
4277 int _end_col_offset = _token->end_col_offset;
4278 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004279 _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 +01004280 if (_res == NULL && PyErr_Occurred()) {
4281 p->error_indicator = 1;
4282 D(p->level--);
4283 return NULL;
4284 }
4285 goto done;
4286 }
4287 p->mark = _mark;
4288 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4289 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4290 }
4291 _res = NULL;
4292 done:
4293 D(p->level--);
4294 return _res;
4295}
4296
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004297// with_item:
4298// | expression 'as' star_target &(',' | ')' | ':')
4299// | invalid_with_item
4300// | expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004301static withitem_ty
4302with_item_rule(Parser *p)
4303{
4304 D(p->level++);
4305 if (p->error_indicator) {
4306 D(p->level--);
4307 return NULL;
4308 }
4309 withitem_ty _res = NULL;
4310 int _mark = p->mark;
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004311 { // expression 'as' star_target &(',' | ')' | ':')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004312 if (p->error_indicator) {
4313 D(p->level--);
4314 return NULL;
4315 }
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004316 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 +03004317 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004318 expr_ty e;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004319 expr_ty t;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004320 if (
4321 (e = expression_rule(p)) // expression
4322 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004323 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
4324 &&
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004325 (t = star_target_rule(p)) // star_target
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004326 &&
4327 _PyPegen_lookahead(1, _tmp_47_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004328 )
4329 {
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004330 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 +03004331 _res = _Py_withitem ( e , t , p -> arena );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004332 if (_res == NULL && PyErr_Occurred()) {
4333 p->error_indicator = 1;
4334 D(p->level--);
4335 return NULL;
4336 }
4337 goto done;
4338 }
4339 p->mark = _mark;
4340 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004341 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004342 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02004343 if (p->call_invalid_rules) { // invalid_with_item
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004344 if (p->error_indicator) {
4345 D(p->level--);
4346 return NULL;
4347 }
4348 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4349 void *invalid_with_item_var;
4350 if (
4351 (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item
4352 )
4353 {
4354 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4355 _res = invalid_with_item_var;
4356 goto done;
4357 }
4358 p->mark = _mark;
4359 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4360 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
4361 }
4362 { // expression
4363 if (p->error_indicator) {
4364 D(p->level--);
4365 return NULL;
4366 }
4367 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
4368 expr_ty e;
4369 if (
4370 (e = expression_rule(p)) // expression
4371 )
4372 {
4373 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
4374 _res = _Py_withitem ( e , NULL , p -> arena );
4375 if (_res == NULL && PyErr_Occurred()) {
4376 p->error_indicator = 1;
4377 D(p->level--);
4378 return NULL;
4379 }
4380 goto done;
4381 }
4382 p->mark = _mark;
4383 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4384 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004385 }
4386 _res = NULL;
4387 done:
4388 D(p->level--);
4389 return _res;
4390}
4391
4392// try_stmt:
4393// | 'try' ':' block finally_block
4394// | 'try' ':' block except_block+ else_block? finally_block?
4395static stmt_ty
4396try_stmt_rule(Parser *p)
4397{
4398 D(p->level++);
4399 if (p->error_indicator) {
4400 D(p->level--);
4401 return NULL;
4402 }
4403 stmt_ty _res = NULL;
4404 int _mark = p->mark;
4405 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4406 p->error_indicator = 1;
4407 D(p->level--);
4408 return NULL;
4409 }
4410 int _start_lineno = p->tokens[_mark]->lineno;
4411 UNUSED(_start_lineno); // Only used by EXTRA macro
4412 int _start_col_offset = p->tokens[_mark]->col_offset;
4413 UNUSED(_start_col_offset); // Only used by EXTRA macro
4414 { // 'try' ':' block finally_block
4415 if (p->error_indicator) {
4416 D(p->level--);
4417 return NULL;
4418 }
4419 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4420 Token * _keyword;
4421 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004422 asdl_stmt_seq* b;
4423 asdl_stmt_seq* f;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004424 if (
4425 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4426 &&
4427 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4428 &&
4429 (b = block_rule(p)) // block
4430 &&
4431 (f = finally_block_rule(p)) // finally_block
4432 )
4433 {
4434 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4435 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4436 if (_token == NULL) {
4437 D(p->level--);
4438 return NULL;
4439 }
4440 int _end_lineno = _token->end_lineno;
4441 UNUSED(_end_lineno); // Only used by EXTRA macro
4442 int _end_col_offset = _token->end_col_offset;
4443 UNUSED(_end_col_offset); // Only used by EXTRA macro
4444 _res = _Py_Try ( b , NULL , NULL , f , EXTRA );
4445 if (_res == NULL && PyErr_Occurred()) {
4446 p->error_indicator = 1;
4447 D(p->level--);
4448 return NULL;
4449 }
4450 goto done;
4451 }
4452 p->mark = _mark;
4453 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4454 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block finally_block"));
4455 }
4456 { // 'try' ':' block except_block+ else_block? finally_block?
4457 if (p->error_indicator) {
4458 D(p->level--);
4459 return NULL;
4460 }
4461 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4462 Token * _keyword;
4463 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004464 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004465 void *el;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004466 asdl_excepthandler_seq* ex;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004467 void *f;
4468 if (
4469 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4470 &&
4471 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4472 &&
4473 (b = block_rule(p)) // block
4474 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004475 (ex = (asdl_excepthandler_seq*)_loop1_48_rule(p)) // except_block+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004476 &&
4477 (el = else_block_rule(p), 1) // else_block?
4478 &&
4479 (f = finally_block_rule(p), 1) // finally_block?
4480 )
4481 {
4482 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4483 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4484 if (_token == NULL) {
4485 D(p->level--);
4486 return NULL;
4487 }
4488 int _end_lineno = _token->end_lineno;
4489 UNUSED(_end_lineno); // Only used by EXTRA macro
4490 int _end_col_offset = _token->end_col_offset;
4491 UNUSED(_end_col_offset); // Only used by EXTRA macro
4492 _res = _Py_Try ( b , ex , el , f , EXTRA );
4493 if (_res == NULL && PyErr_Occurred()) {
4494 p->error_indicator = 1;
4495 D(p->level--);
4496 return NULL;
4497 }
4498 goto done;
4499 }
4500 p->mark = _mark;
4501 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4502 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4503 }
4504 _res = NULL;
4505 done:
4506 D(p->level--);
4507 return _res;
4508}
4509
4510// except_block: 'except' expression ['as' NAME] ':' block | 'except' ':' block
4511static excepthandler_ty
4512except_block_rule(Parser *p)
4513{
4514 D(p->level++);
4515 if (p->error_indicator) {
4516 D(p->level--);
4517 return NULL;
4518 }
4519 excepthandler_ty _res = NULL;
4520 int _mark = p->mark;
4521 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4522 p->error_indicator = 1;
4523 D(p->level--);
4524 return NULL;
4525 }
4526 int _start_lineno = p->tokens[_mark]->lineno;
4527 UNUSED(_start_lineno); // Only used by EXTRA macro
4528 int _start_col_offset = p->tokens[_mark]->col_offset;
4529 UNUSED(_start_col_offset); // Only used by EXTRA macro
4530 { // 'except' expression ['as' NAME] ':' block
4531 if (p->error_indicator) {
4532 D(p->level--);
4533 return NULL;
4534 }
4535 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4536 Token * _keyword;
4537 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004538 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004539 expr_ty e;
4540 void *t;
4541 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004542 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004543 &&
4544 (e = expression_rule(p)) // expression
4545 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004546 (t = _tmp_49_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004547 &&
4548 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4549 &&
4550 (b = block_rule(p)) // block
4551 )
4552 {
4553 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4554 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4555 if (_token == NULL) {
4556 D(p->level--);
4557 return NULL;
4558 }
4559 int _end_lineno = _token->end_lineno;
4560 UNUSED(_end_lineno); // Only used by EXTRA macro
4561 int _end_col_offset = _token->end_col_offset;
4562 UNUSED(_end_col_offset); // Only used by EXTRA macro
4563 _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
4564 if (_res == NULL && PyErr_Occurred()) {
4565 p->error_indicator = 1;
4566 D(p->level--);
4567 return NULL;
4568 }
4569 goto done;
4570 }
4571 p->mark = _mark;
4572 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4573 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4574 }
4575 { // 'except' ':' block
4576 if (p->error_indicator) {
4577 D(p->level--);
4578 return NULL;
4579 }
4580 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4581 Token * _keyword;
4582 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004583 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004584 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004585 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004586 &&
4587 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4588 &&
4589 (b = block_rule(p)) // block
4590 )
4591 {
4592 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4593 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4594 if (_token == NULL) {
4595 D(p->level--);
4596 return NULL;
4597 }
4598 int _end_lineno = _token->end_lineno;
4599 UNUSED(_end_lineno); // Only used by EXTRA macro
4600 int _end_col_offset = _token->end_col_offset;
4601 UNUSED(_end_col_offset); // Only used by EXTRA macro
4602 _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
4603 if (_res == NULL && PyErr_Occurred()) {
4604 p->error_indicator = 1;
4605 D(p->level--);
4606 return NULL;
4607 }
4608 goto done;
4609 }
4610 p->mark = _mark;
4611 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4612 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
4613 }
4614 _res = NULL;
4615 done:
4616 D(p->level--);
4617 return _res;
4618}
4619
4620// finally_block: 'finally' ':' block
Pablo Galindoa5634c42020-09-16 19:42:00 +01004621static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004622finally_block_rule(Parser *p)
4623{
4624 D(p->level++);
4625 if (p->error_indicator) {
4626 D(p->level--);
4627 return NULL;
4628 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01004629 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004630 int _mark = p->mark;
4631 { // 'finally' ':' block
4632 if (p->error_indicator) {
4633 D(p->level--);
4634 return NULL;
4635 }
4636 D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4637 Token * _keyword;
4638 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004639 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004640 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004641 (_keyword = _PyPegen_expect_token(p, 522)) // token='finally'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004642 &&
4643 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4644 &&
4645 (a = block_rule(p)) // block
4646 )
4647 {
4648 D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4649 _res = a;
4650 if (_res == NULL && PyErr_Occurred()) {
4651 p->error_indicator = 1;
4652 D(p->level--);
4653 return NULL;
4654 }
4655 goto done;
4656 }
4657 p->mark = _mark;
4658 D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
4659 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block"));
4660 }
4661 _res = NULL;
4662 done:
4663 D(p->level--);
4664 return _res;
4665}
4666
4667// return_stmt: 'return' star_expressions?
4668static stmt_ty
4669return_stmt_rule(Parser *p)
4670{
4671 D(p->level++);
4672 if (p->error_indicator) {
4673 D(p->level--);
4674 return NULL;
4675 }
4676 stmt_ty _res = NULL;
4677 int _mark = p->mark;
4678 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4679 p->error_indicator = 1;
4680 D(p->level--);
4681 return NULL;
4682 }
4683 int _start_lineno = p->tokens[_mark]->lineno;
4684 UNUSED(_start_lineno); // Only used by EXTRA macro
4685 int _start_col_offset = p->tokens[_mark]->col_offset;
4686 UNUSED(_start_col_offset); // Only used by EXTRA macro
4687 { // 'return' star_expressions?
4688 if (p->error_indicator) {
4689 D(p->level--);
4690 return NULL;
4691 }
4692 D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4693 Token * _keyword;
4694 void *a;
4695 if (
4696 (_keyword = _PyPegen_expect_token(p, 500)) // token='return'
4697 &&
4698 (a = star_expressions_rule(p), 1) // star_expressions?
4699 )
4700 {
4701 D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4702 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4703 if (_token == NULL) {
4704 D(p->level--);
4705 return NULL;
4706 }
4707 int _end_lineno = _token->end_lineno;
4708 UNUSED(_end_lineno); // Only used by EXTRA macro
4709 int _end_col_offset = _token->end_col_offset;
4710 UNUSED(_end_col_offset); // Only used by EXTRA macro
4711 _res = _Py_Return ( a , EXTRA );
4712 if (_res == NULL && PyErr_Occurred()) {
4713 p->error_indicator = 1;
4714 D(p->level--);
4715 return NULL;
4716 }
4717 goto done;
4718 }
4719 p->mark = _mark;
4720 D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4721 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
4722 }
4723 _res = NULL;
4724 done:
4725 D(p->level--);
4726 return _res;
4727}
4728
4729// raise_stmt: 'raise' expression ['from' expression] | 'raise'
4730static stmt_ty
4731raise_stmt_rule(Parser *p)
4732{
4733 D(p->level++);
4734 if (p->error_indicator) {
4735 D(p->level--);
4736 return NULL;
4737 }
4738 stmt_ty _res = NULL;
4739 int _mark = p->mark;
4740 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4741 p->error_indicator = 1;
4742 D(p->level--);
4743 return NULL;
4744 }
4745 int _start_lineno = p->tokens[_mark]->lineno;
4746 UNUSED(_start_lineno); // Only used by EXTRA macro
4747 int _start_col_offset = p->tokens[_mark]->col_offset;
4748 UNUSED(_start_col_offset); // Only used by EXTRA macro
4749 { // 'raise' expression ['from' expression]
4750 if (p->error_indicator) {
4751 D(p->level--);
4752 return NULL;
4753 }
4754 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4755 Token * _keyword;
4756 expr_ty a;
4757 void *b;
4758 if (
4759 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4760 &&
4761 (a = expression_rule(p)) // expression
4762 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004763 (b = _tmp_50_rule(p), 1) // ['from' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004764 )
4765 {
4766 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4767 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4768 if (_token == NULL) {
4769 D(p->level--);
4770 return NULL;
4771 }
4772 int _end_lineno = _token->end_lineno;
4773 UNUSED(_end_lineno); // Only used by EXTRA macro
4774 int _end_col_offset = _token->end_col_offset;
4775 UNUSED(_end_col_offset); // Only used by EXTRA macro
4776 _res = _Py_Raise ( a , b , EXTRA );
4777 if (_res == NULL && PyErr_Occurred()) {
4778 p->error_indicator = 1;
4779 D(p->level--);
4780 return NULL;
4781 }
4782 goto done;
4783 }
4784 p->mark = _mark;
4785 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4786 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
4787 }
4788 { // 'raise'
4789 if (p->error_indicator) {
4790 D(p->level--);
4791 return NULL;
4792 }
4793 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
4794 Token * _keyword;
4795 if (
4796 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4797 )
4798 {
4799 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
4800 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4801 if (_token == NULL) {
4802 D(p->level--);
4803 return NULL;
4804 }
4805 int _end_lineno = _token->end_lineno;
4806 UNUSED(_end_lineno); // Only used by EXTRA macro
4807 int _end_col_offset = _token->end_col_offset;
4808 UNUSED(_end_col_offset); // Only used by EXTRA macro
4809 _res = _Py_Raise ( NULL , NULL , EXTRA );
4810 if (_res == NULL && PyErr_Occurred()) {
4811 p->error_indicator = 1;
4812 D(p->level--);
4813 return NULL;
4814 }
4815 goto done;
4816 }
4817 p->mark = _mark;
4818 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4819 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
4820 }
4821 _res = NULL;
4822 done:
4823 D(p->level--);
4824 return _res;
4825}
4826
4827// function_def: decorators function_def_raw | function_def_raw
4828static stmt_ty
4829function_def_rule(Parser *p)
4830{
4831 D(p->level++);
4832 if (p->error_indicator) {
4833 D(p->level--);
4834 return NULL;
4835 }
4836 stmt_ty _res = NULL;
4837 int _mark = p->mark;
4838 { // decorators function_def_raw
4839 if (p->error_indicator) {
4840 D(p->level--);
4841 return NULL;
4842 }
4843 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 +01004844 asdl_expr_seq* d;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004845 stmt_ty f;
4846 if (
4847 (d = decorators_rule(p)) // decorators
4848 &&
4849 (f = function_def_raw_rule(p)) // function_def_raw
4850 )
4851 {
4852 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4853 _res = _PyPegen_function_def_decorators ( p , d , f );
4854 if (_res == NULL && PyErr_Occurred()) {
4855 p->error_indicator = 1;
4856 D(p->level--);
4857 return NULL;
4858 }
4859 goto done;
4860 }
4861 p->mark = _mark;
4862 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4863 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
4864 }
4865 { // function_def_raw
4866 if (p->error_indicator) {
4867 D(p->level--);
4868 return NULL;
4869 }
4870 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4871 stmt_ty function_def_raw_var;
4872 if (
4873 (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
4874 )
4875 {
4876 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4877 _res = function_def_raw_var;
4878 goto done;
4879 }
4880 p->mark = _mark;
4881 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4882 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
4883 }
4884 _res = NULL;
4885 done:
4886 D(p->level--);
4887 return _res;
4888}
4889
4890// function_def_raw:
4891// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4892// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4893static stmt_ty
4894function_def_raw_rule(Parser *p)
4895{
4896 D(p->level++);
4897 if (p->error_indicator) {
4898 D(p->level--);
4899 return NULL;
4900 }
4901 stmt_ty _res = NULL;
4902 int _mark = p->mark;
4903 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4904 p->error_indicator = 1;
4905 D(p->level--);
4906 return NULL;
4907 }
4908 int _start_lineno = p->tokens[_mark]->lineno;
4909 UNUSED(_start_lineno); // Only used by EXTRA macro
4910 int _start_col_offset = p->tokens[_mark]->col_offset;
4911 UNUSED(_start_col_offset); // Only used by EXTRA macro
4912 { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4913 if (p->error_indicator) {
4914 D(p->level--);
4915 return NULL;
4916 }
4917 D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4918 Token * _keyword;
4919 Token * _literal;
4920 Token * _literal_1;
4921 Token * _literal_2;
4922 void *a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004923 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004924 expr_ty n;
4925 void *params;
4926 void *tc;
4927 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004928 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004929 &&
4930 (n = _PyPegen_name_token(p)) // NAME
4931 &&
4932 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4933 &&
4934 (params = params_rule(p), 1) // params?
4935 &&
4936 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4937 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004938 (a = _tmp_51_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004939 &&
4940 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4941 &&
4942 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4943 &&
4944 (b = block_rule(p)) // block
4945 )
4946 {
4947 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"));
4948 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4949 if (_token == NULL) {
4950 D(p->level--);
4951 return NULL;
4952 }
4953 int _end_lineno = _token->end_lineno;
4954 UNUSED(_end_lineno); // Only used by EXTRA macro
4955 int _end_col_offset = _token->end_col_offset;
4956 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004957 _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 +01004958 if (_res == NULL && PyErr_Occurred()) {
4959 p->error_indicator = 1;
4960 D(p->level--);
4961 return NULL;
4962 }
4963 goto done;
4964 }
4965 p->mark = _mark;
4966 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
4967 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4968 }
4969 { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4970 if (p->error_indicator) {
4971 D(p->level--);
4972 return NULL;
4973 }
4974 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"));
4975 Token * _keyword;
4976 Token * _literal;
4977 Token * _literal_1;
4978 Token * _literal_2;
4979 void *a;
4980 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004981 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004982 expr_ty n;
4983 void *params;
4984 void *tc;
4985 if (
4986 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4987 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004988 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004989 &&
4990 (n = _PyPegen_name_token(p)) // NAME
4991 &&
4992 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4993 &&
4994 (params = params_rule(p), 1) // params?
4995 &&
4996 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4997 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004998 (a = _tmp_52_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004999 &&
5000 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
5001 &&
5002 (tc = func_type_comment_rule(p), 1) // func_type_comment?
5003 &&
5004 (b = block_rule(p)) // block
5005 )
5006 {
5007 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"));
5008 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5009 if (_token == NULL) {
5010 D(p->level--);
5011 return NULL;
5012 }
5013 int _end_lineno = _token->end_lineno;
5014 UNUSED(_end_lineno); // Only used by EXTRA macro
5015 int _end_col_offset = _token->end_col_offset;
5016 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03005017 _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 +01005018 if (_res == NULL && PyErr_Occurred()) {
5019 p->error_indicator = 1;
5020 D(p->level--);
5021 return NULL;
5022 }
5023 goto done;
5024 }
5025 p->mark = _mark;
5026 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
5027 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
5028 }
5029 _res = NULL;
5030 done:
5031 D(p->level--);
5032 return _res;
5033}
5034
5035// func_type_comment:
5036// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5037// | invalid_double_type_comments
5038// | TYPE_COMMENT
5039static Token*
5040func_type_comment_rule(Parser *p)
5041{
5042 D(p->level++);
5043 if (p->error_indicator) {
5044 D(p->level--);
5045 return NULL;
5046 }
5047 Token* _res = NULL;
5048 int _mark = p->mark;
5049 { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5050 if (p->error_indicator) {
5051 D(p->level--);
5052 return NULL;
5053 }
5054 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5055 Token * newline_var;
5056 Token * t;
5057 if (
5058 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
5059 &&
5060 (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5061 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005062 _PyPegen_lookahead(1, _tmp_53_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005063 )
5064 {
5065 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5066 _res = t;
5067 if (_res == NULL && PyErr_Occurred()) {
5068 p->error_indicator = 1;
5069 D(p->level--);
5070 return NULL;
5071 }
5072 goto done;
5073 }
5074 p->mark = _mark;
5075 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5076 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5077 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02005078 if (p->call_invalid_rules) { // invalid_double_type_comments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005079 if (p->error_indicator) {
5080 D(p->level--);
5081 return NULL;
5082 }
5083 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5084 void *invalid_double_type_comments_var;
5085 if (
5086 (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
5087 )
5088 {
5089 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5090 _res = invalid_double_type_comments_var;
5091 goto done;
5092 }
5093 p->mark = _mark;
5094 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5095 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
5096 }
5097 { // TYPE_COMMENT
5098 if (p->error_indicator) {
5099 D(p->level--);
5100 return NULL;
5101 }
5102 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5103 Token * type_comment_var;
5104 if (
5105 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5106 )
5107 {
5108 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5109 _res = type_comment_var;
5110 goto done;
5111 }
5112 p->mark = _mark;
5113 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5114 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
5115 }
5116 _res = NULL;
5117 done:
5118 D(p->level--);
5119 return _res;
5120}
5121
5122// params: invalid_parameters | parameters
5123static arguments_ty
5124params_rule(Parser *p)
5125{
5126 D(p->level++);
5127 if (p->error_indicator) {
5128 D(p->level--);
5129 return NULL;
5130 }
5131 arguments_ty _res = NULL;
5132 int _mark = p->mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02005133 if (p->call_invalid_rules) { // invalid_parameters
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005134 if (p->error_indicator) {
5135 D(p->level--);
5136 return NULL;
5137 }
5138 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5139 void *invalid_parameters_var;
5140 if (
5141 (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
5142 )
5143 {
5144 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5145 _res = invalid_parameters_var;
5146 goto done;
5147 }
5148 p->mark = _mark;
5149 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5150 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
5151 }
5152 { // parameters
5153 if (p->error_indicator) {
5154 D(p->level--);
5155 return NULL;
5156 }
5157 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
5158 arguments_ty parameters_var;
5159 if (
5160 (parameters_var = parameters_rule(p)) // parameters
5161 )
5162 {
5163 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
5164 _res = parameters_var;
5165 goto done;
5166 }
5167 p->mark = _mark;
5168 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5169 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
5170 }
5171 _res = NULL;
5172 done:
5173 D(p->level--);
5174 return _res;
5175}
5176
5177// parameters:
5178// | slash_no_default param_no_default* param_with_default* star_etc?
5179// | slash_with_default param_with_default* star_etc?
5180// | param_no_default+ param_with_default* star_etc?
5181// | param_with_default+ star_etc?
5182// | star_etc
5183static arguments_ty
5184parameters_rule(Parser *p)
5185{
5186 D(p->level++);
5187 if (p->error_indicator) {
5188 D(p->level--);
5189 return NULL;
5190 }
5191 arguments_ty _res = NULL;
5192 int _mark = p->mark;
5193 { // slash_no_default param_no_default* param_with_default* star_etc?
5194 if (p->error_indicator) {
5195 D(p->level--);
5196 return NULL;
5197 }
5198 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 +01005199 asdl_arg_seq* a;
5200 asdl_arg_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005201 asdl_seq * c;
5202 void *d;
5203 if (
5204 (a = slash_no_default_rule(p)) // slash_no_default
5205 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01005206 (b = (asdl_arg_seq*)_loop0_54_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005207 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005208 (c = _loop0_55_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005209 &&
5210 (d = star_etc_rule(p), 1) // star_etc?
5211 )
5212 {
5213 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?"));
5214 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
5215 if (_res == NULL && PyErr_Occurred()) {
5216 p->error_indicator = 1;
5217 D(p->level--);
5218 return NULL;
5219 }
5220 goto done;
5221 }
5222 p->mark = _mark;
5223 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5224 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
5225 }
5226 { // slash_with_default param_with_default* star_etc?
5227 if (p->error_indicator) {
5228 D(p->level--);
5229 return NULL;
5230 }
5231 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5232 SlashWithDefault* a;
5233 asdl_seq * b;
5234 void *c;
5235 if (
5236 (a = slash_with_default_rule(p)) // slash_with_default
5237 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005238 (b = _loop0_56_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005239 &&
5240 (c = star_etc_rule(p), 1) // star_etc?
5241 )
5242 {
5243 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5244 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
5245 if (_res == NULL && PyErr_Occurred()) {
5246 p->error_indicator = 1;
5247 D(p->level--);
5248 return NULL;
5249 }
5250 goto done;
5251 }
5252 p->mark = _mark;
5253 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5254 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5255 }
5256 { // param_no_default+ param_with_default* star_etc?
5257 if (p->error_indicator) {
5258 D(p->level--);
5259 return NULL;
5260 }
5261 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 +01005262 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005263 asdl_seq * b;
5264 void *c;
5265 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005266 (a = (asdl_arg_seq*)_loop1_57_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005267 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005268 (b = _loop0_58_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005269 &&
5270 (c = star_etc_rule(p), 1) // star_etc?
5271 )
5272 {
5273 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5274 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
5275 if (_res == NULL && PyErr_Occurred()) {
5276 p->error_indicator = 1;
5277 D(p->level--);
5278 return NULL;
5279 }
5280 goto done;
5281 }
5282 p->mark = _mark;
5283 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5284 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5285 }
5286 { // param_with_default+ star_etc?
5287 if (p->error_indicator) {
5288 D(p->level--);
5289 return NULL;
5290 }
5291 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5292 asdl_seq * a;
5293 void *b;
5294 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005295 (a = _loop1_59_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005296 &&
5297 (b = star_etc_rule(p), 1) // star_etc?
5298 )
5299 {
5300 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5301 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
5302 if (_res == NULL && PyErr_Occurred()) {
5303 p->error_indicator = 1;
5304 D(p->level--);
5305 return NULL;
5306 }
5307 goto done;
5308 }
5309 p->mark = _mark;
5310 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5311 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
5312 }
5313 { // star_etc
5314 if (p->error_indicator) {
5315 D(p->level--);
5316 return NULL;
5317 }
5318 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
5319 StarEtc* a;
5320 if (
5321 (a = star_etc_rule(p)) // star_etc
5322 )
5323 {
5324 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
5325 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
5326 if (_res == NULL && PyErr_Occurred()) {
5327 p->error_indicator = 1;
5328 D(p->level--);
5329 return NULL;
5330 }
5331 goto done;
5332 }
5333 p->mark = _mark;
5334 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5335 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
5336 }
5337 _res = NULL;
5338 done:
5339 D(p->level--);
5340 return _res;
5341}
5342
5343// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
Pablo Galindoa5634c42020-09-16 19:42:00 +01005344static asdl_arg_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005345slash_no_default_rule(Parser *p)
5346{
5347 D(p->level++);
5348 if (p->error_indicator) {
5349 D(p->level--);
5350 return NULL;
5351 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01005352 asdl_arg_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005353 int _mark = p->mark;
5354 { // param_no_default+ '/' ','
5355 if (p->error_indicator) {
5356 D(p->level--);
5357 return NULL;
5358 }
5359 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5360 Token * _literal;
5361 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +01005362 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005363 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005364 (a = (asdl_arg_seq*)_loop1_60_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005365 &&
5366 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5367 &&
5368 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5369 )
5370 {
5371 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5372 _res = a;
5373 if (_res == NULL && PyErr_Occurred()) {
5374 p->error_indicator = 1;
5375 D(p->level--);
5376 return NULL;
5377 }
5378 goto done;
5379 }
5380 p->mark = _mark;
5381 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5382 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
5383 }
5384 { // param_no_default+ '/' &')'
5385 if (p->error_indicator) {
5386 D(p->level--);
5387 return NULL;
5388 }
5389 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5390 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01005391 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005392 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005393 (a = (asdl_arg_seq*)_loop1_61_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005394 &&
5395 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5396 &&
5397 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5398 )
5399 {
5400 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5401 _res = a;
5402 if (_res == NULL && PyErr_Occurred()) {
5403 p->error_indicator = 1;
5404 D(p->level--);
5405 return NULL;
5406 }
5407 goto done;
5408 }
5409 p->mark = _mark;
5410 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5411 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
5412 }
5413 _res = NULL;
5414 done:
5415 D(p->level--);
5416 return _res;
5417}
5418
5419// slash_with_default:
5420// | param_no_default* param_with_default+ '/' ','
5421// | param_no_default* param_with_default+ '/' &')'
5422static SlashWithDefault*
5423slash_with_default_rule(Parser *p)
5424{
5425 D(p->level++);
5426 if (p->error_indicator) {
5427 D(p->level--);
5428 return NULL;
5429 }
5430 SlashWithDefault* _res = NULL;
5431 int _mark = p->mark;
5432 { // param_no_default* param_with_default+ '/' ','
5433 if (p->error_indicator) {
5434 D(p->level--);
5435 return NULL;
5436 }
5437 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5438 Token * _literal;
5439 Token * _literal_1;
5440 asdl_seq * a;
5441 asdl_seq * b;
5442 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005443 (a = _loop0_62_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005444 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005445 (b = _loop1_63_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005446 &&
5447 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5448 &&
5449 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5450 )
5451 {
5452 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 +01005453 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005454 if (_res == NULL && PyErr_Occurred()) {
5455 p->error_indicator = 1;
5456 D(p->level--);
5457 return NULL;
5458 }
5459 goto done;
5460 }
5461 p->mark = _mark;
5462 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5463 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5464 }
5465 { // param_no_default* param_with_default+ '/' &')'
5466 if (p->error_indicator) {
5467 D(p->level--);
5468 return NULL;
5469 }
5470 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5471 Token * _literal;
5472 asdl_seq * a;
5473 asdl_seq * b;
5474 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005475 (a = _loop0_64_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005476 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005477 (b = _loop1_65_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005478 &&
5479 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5480 &&
5481 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5482 )
5483 {
5484 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 +01005485 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005486 if (_res == NULL && PyErr_Occurred()) {
5487 p->error_indicator = 1;
5488 D(p->level--);
5489 return NULL;
5490 }
5491 goto done;
5492 }
5493 p->mark = _mark;
5494 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5495 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5496 }
5497 _res = NULL;
5498 done:
5499 D(p->level--);
5500 return _res;
5501}
5502
5503// star_etc:
5504// | '*' param_no_default param_maybe_default* kwds?
5505// | '*' ',' param_maybe_default+ kwds?
5506// | kwds
5507// | invalid_star_etc
5508static StarEtc*
5509star_etc_rule(Parser *p)
5510{
5511 D(p->level++);
5512 if (p->error_indicator) {
5513 D(p->level--);
5514 return NULL;
5515 }
5516 StarEtc* _res = NULL;
5517 int _mark = p->mark;
5518 { // '*' param_no_default param_maybe_default* kwds?
5519 if (p->error_indicator) {
5520 D(p->level--);
5521 return NULL;
5522 }
5523 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5524 Token * _literal;
5525 arg_ty a;
5526 asdl_seq * b;
5527 void *c;
5528 if (
5529 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5530 &&
5531 (a = param_no_default_rule(p)) // param_no_default
5532 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005533 (b = _loop0_66_rule(p)) // param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005534 &&
5535 (c = kwds_rule(p), 1) // kwds?
5536 )
5537 {
5538 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5539 _res = _PyPegen_star_etc ( p , a , b , c );
5540 if (_res == NULL && PyErr_Occurred()) {
5541 p->error_indicator = 1;
5542 D(p->level--);
5543 return NULL;
5544 }
5545 goto done;
5546 }
5547 p->mark = _mark;
5548 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5549 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5550 }
5551 { // '*' ',' param_maybe_default+ kwds?
5552 if (p->error_indicator) {
5553 D(p->level--);
5554 return NULL;
5555 }
5556 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5557 Token * _literal;
5558 Token * _literal_1;
5559 asdl_seq * b;
5560 void *c;
5561 if (
5562 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5563 &&
5564 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5565 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005566 (b = _loop1_67_rule(p)) // param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005567 &&
5568 (c = kwds_rule(p), 1) // kwds?
5569 )
5570 {
5571 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5572 _res = _PyPegen_star_etc ( p , NULL , b , c );
5573 if (_res == NULL && PyErr_Occurred()) {
5574 p->error_indicator = 1;
5575 D(p->level--);
5576 return NULL;
5577 }
5578 goto done;
5579 }
5580 p->mark = _mark;
5581 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5582 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5583 }
5584 { // kwds
5585 if (p->error_indicator) {
5586 D(p->level--);
5587 return NULL;
5588 }
5589 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
5590 arg_ty a;
5591 if (
5592 (a = kwds_rule(p)) // kwds
5593 )
5594 {
5595 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
5596 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
5597 if (_res == NULL && PyErr_Occurred()) {
5598 p->error_indicator = 1;
5599 D(p->level--);
5600 return NULL;
5601 }
5602 goto done;
5603 }
5604 p->mark = _mark;
5605 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5606 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
5607 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02005608 if (p->call_invalid_rules) { // invalid_star_etc
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005609 if (p->error_indicator) {
5610 D(p->level--);
5611 return NULL;
5612 }
5613 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5614 void *invalid_star_etc_var;
5615 if (
5616 (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
5617 )
5618 {
5619 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5620 _res = invalid_star_etc_var;
5621 goto done;
5622 }
5623 p->mark = _mark;
5624 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5625 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
5626 }
5627 _res = NULL;
5628 done:
5629 D(p->level--);
5630 return _res;
5631}
5632
5633// kwds: '**' param_no_default
5634static arg_ty
5635kwds_rule(Parser *p)
5636{
5637 D(p->level++);
5638 if (p->error_indicator) {
5639 D(p->level--);
5640 return NULL;
5641 }
5642 arg_ty _res = NULL;
5643 int _mark = p->mark;
5644 { // '**' param_no_default
5645 if (p->error_indicator) {
5646 D(p->level--);
5647 return NULL;
5648 }
5649 D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5650 Token * _literal;
5651 arg_ty a;
5652 if (
5653 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
5654 &&
5655 (a = param_no_default_rule(p)) // param_no_default
5656 )
5657 {
5658 D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5659 _res = a;
5660 if (_res == NULL && PyErr_Occurred()) {
5661 p->error_indicator = 1;
5662 D(p->level--);
5663 return NULL;
5664 }
5665 goto done;
5666 }
5667 p->mark = _mark;
5668 D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
5669 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
5670 }
5671 _res = NULL;
5672 done:
5673 D(p->level--);
5674 return _res;
5675}
5676
5677// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
5678static arg_ty
5679param_no_default_rule(Parser *p)
5680{
5681 D(p->level++);
5682 if (p->error_indicator) {
5683 D(p->level--);
5684 return NULL;
5685 }
5686 arg_ty _res = NULL;
5687 int _mark = p->mark;
5688 { // param ',' TYPE_COMMENT?
5689 if (p->error_indicator) {
5690 D(p->level--);
5691 return NULL;
5692 }
5693 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5694 Token * _literal;
5695 arg_ty a;
5696 void *tc;
5697 if (
5698 (a = param_rule(p)) // param
5699 &&
5700 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5701 &&
5702 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5703 )
5704 {
5705 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5706 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5707 if (_res == NULL && PyErr_Occurred()) {
5708 p->error_indicator = 1;
5709 D(p->level--);
5710 return NULL;
5711 }
5712 goto done;
5713 }
5714 p->mark = _mark;
5715 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5716 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
5717 }
5718 { // param TYPE_COMMENT? &')'
5719 if (p->error_indicator) {
5720 D(p->level--);
5721 return NULL;
5722 }
5723 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5724 arg_ty a;
5725 void *tc;
5726 if (
5727 (a = param_rule(p)) // param
5728 &&
5729 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5730 &&
5731 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5732 )
5733 {
5734 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5735 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5736 if (_res == NULL && PyErr_Occurred()) {
5737 p->error_indicator = 1;
5738 D(p->level--);
5739 return NULL;
5740 }
5741 goto done;
5742 }
5743 p->mark = _mark;
5744 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5745 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
5746 }
5747 _res = NULL;
5748 done:
5749 D(p->level--);
5750 return _res;
5751}
5752
5753// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
5754static NameDefaultPair*
5755param_with_default_rule(Parser *p)
5756{
5757 D(p->level++);
5758 if (p->error_indicator) {
5759 D(p->level--);
5760 return NULL;
5761 }
5762 NameDefaultPair* _res = NULL;
5763 int _mark = p->mark;
5764 { // param default ',' TYPE_COMMENT?
5765 if (p->error_indicator) {
5766 D(p->level--);
5767 return NULL;
5768 }
5769 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5770 Token * _literal;
5771 arg_ty a;
5772 expr_ty c;
5773 void *tc;
5774 if (
5775 (a = param_rule(p)) // param
5776 &&
5777 (c = default_rule(p)) // default
5778 &&
5779 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5780 &&
5781 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5782 )
5783 {
5784 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5785 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5786 if (_res == NULL && PyErr_Occurred()) {
5787 p->error_indicator = 1;
5788 D(p->level--);
5789 return NULL;
5790 }
5791 goto done;
5792 }
5793 p->mark = _mark;
5794 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5795 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5796 }
5797 { // param default TYPE_COMMENT? &')'
5798 if (p->error_indicator) {
5799 D(p->level--);
5800 return NULL;
5801 }
5802 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5803 arg_ty a;
5804 expr_ty c;
5805 void *tc;
5806 if (
5807 (a = param_rule(p)) // param
5808 &&
5809 (c = default_rule(p)) // default
5810 &&
5811 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5812 &&
5813 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5814 )
5815 {
5816 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5817 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5818 if (_res == NULL && PyErr_Occurred()) {
5819 p->error_indicator = 1;
5820 D(p->level--);
5821 return NULL;
5822 }
5823 goto done;
5824 }
5825 p->mark = _mark;
5826 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5827 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5828 }
5829 _res = NULL;
5830 done:
5831 D(p->level--);
5832 return _res;
5833}
5834
5835// param_maybe_default:
5836// | param default? ',' TYPE_COMMENT?
5837// | param default? TYPE_COMMENT? &')'
5838static NameDefaultPair*
5839param_maybe_default_rule(Parser *p)
5840{
5841 D(p->level++);
5842 if (p->error_indicator) {
5843 D(p->level--);
5844 return NULL;
5845 }
5846 NameDefaultPair* _res = NULL;
5847 int _mark = p->mark;
5848 { // param default? ',' TYPE_COMMENT?
5849 if (p->error_indicator) {
5850 D(p->level--);
5851 return NULL;
5852 }
5853 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5854 Token * _literal;
5855 arg_ty a;
5856 void *c;
5857 void *tc;
5858 if (
5859 (a = param_rule(p)) // param
5860 &&
5861 (c = default_rule(p), 1) // default?
5862 &&
5863 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5864 &&
5865 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5866 )
5867 {
5868 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5869 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5870 if (_res == NULL && PyErr_Occurred()) {
5871 p->error_indicator = 1;
5872 D(p->level--);
5873 return NULL;
5874 }
5875 goto done;
5876 }
5877 p->mark = _mark;
5878 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5879 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5880 }
5881 { // param default? TYPE_COMMENT? &')'
5882 if (p->error_indicator) {
5883 D(p->level--);
5884 return NULL;
5885 }
5886 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5887 arg_ty a;
5888 void *c;
5889 void *tc;
5890 if (
5891 (a = param_rule(p)) // param
5892 &&
5893 (c = default_rule(p), 1) // default?
5894 &&
5895 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5896 &&
5897 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5898 )
5899 {
5900 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5901 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5902 if (_res == NULL && PyErr_Occurred()) {
5903 p->error_indicator = 1;
5904 D(p->level--);
5905 return NULL;
5906 }
5907 goto done;
5908 }
5909 p->mark = _mark;
5910 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5911 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5912 }
5913 _res = NULL;
5914 done:
5915 D(p->level--);
5916 return _res;
5917}
5918
5919// param: NAME annotation?
5920static arg_ty
5921param_rule(Parser *p)
5922{
5923 D(p->level++);
5924 if (p->error_indicator) {
5925 D(p->level--);
5926 return NULL;
5927 }
5928 arg_ty _res = NULL;
5929 int _mark = p->mark;
5930 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5931 p->error_indicator = 1;
5932 D(p->level--);
5933 return NULL;
5934 }
5935 int _start_lineno = p->tokens[_mark]->lineno;
5936 UNUSED(_start_lineno); // Only used by EXTRA macro
5937 int _start_col_offset = p->tokens[_mark]->col_offset;
5938 UNUSED(_start_col_offset); // Only used by EXTRA macro
5939 { // NAME annotation?
5940 if (p->error_indicator) {
5941 D(p->level--);
5942 return NULL;
5943 }
5944 D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5945 expr_ty a;
5946 void *b;
5947 if (
5948 (a = _PyPegen_name_token(p)) // NAME
5949 &&
5950 (b = annotation_rule(p), 1) // annotation?
5951 )
5952 {
5953 D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5954 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5955 if (_token == NULL) {
5956 D(p->level--);
5957 return NULL;
5958 }
5959 int _end_lineno = _token->end_lineno;
5960 UNUSED(_end_lineno); // Only used by EXTRA macro
5961 int _end_col_offset = _token->end_col_offset;
5962 UNUSED(_end_col_offset); // Only used by EXTRA macro
5963 _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
5964 if (_res == NULL && PyErr_Occurred()) {
5965 p->error_indicator = 1;
5966 D(p->level--);
5967 return NULL;
5968 }
5969 goto done;
5970 }
5971 p->mark = _mark;
5972 D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
5973 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
5974 }
5975 _res = NULL;
5976 done:
5977 D(p->level--);
5978 return _res;
5979}
5980
5981// annotation: ':' expression
5982static expr_ty
5983annotation_rule(Parser *p)
5984{
5985 D(p->level++);
5986 if (p->error_indicator) {
5987 D(p->level--);
5988 return NULL;
5989 }
5990 expr_ty _res = NULL;
5991 int _mark = p->mark;
5992 { // ':' expression
5993 if (p->error_indicator) {
5994 D(p->level--);
5995 return NULL;
5996 }
5997 D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
5998 Token * _literal;
5999 expr_ty a;
6000 if (
6001 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
6002 &&
6003 (a = expression_rule(p)) // expression
6004 )
6005 {
6006 D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
6007 _res = a;
6008 if (_res == NULL && PyErr_Occurred()) {
6009 p->error_indicator = 1;
6010 D(p->level--);
6011 return NULL;
6012 }
6013 goto done;
6014 }
6015 p->mark = _mark;
6016 D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
6017 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
6018 }
6019 _res = NULL;
6020 done:
6021 D(p->level--);
6022 return _res;
6023}
6024
6025// default: '=' expression
6026static expr_ty
6027default_rule(Parser *p)
6028{
6029 D(p->level++);
6030 if (p->error_indicator) {
6031 D(p->level--);
6032 return NULL;
6033 }
6034 expr_ty _res = NULL;
6035 int _mark = p->mark;
6036 { // '=' expression
6037 if (p->error_indicator) {
6038 D(p->level--);
6039 return NULL;
6040 }
6041 D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6042 Token * _literal;
6043 expr_ty a;
6044 if (
6045 (_literal = _PyPegen_expect_token(p, 22)) // token='='
6046 &&
6047 (a = expression_rule(p)) // expression
6048 )
6049 {
6050 D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6051 _res = a;
6052 if (_res == NULL && PyErr_Occurred()) {
6053 p->error_indicator = 1;
6054 D(p->level--);
6055 return NULL;
6056 }
6057 goto done;
6058 }
6059 p->mark = _mark;
6060 D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
6061 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
6062 }
6063 _res = NULL;
6064 done:
6065 D(p->level--);
6066 return _res;
6067}
6068
6069// decorators: (('@' named_expression NEWLINE))+
Pablo Galindoa5634c42020-09-16 19:42:00 +01006070static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006071decorators_rule(Parser *p)
6072{
6073 D(p->level++);
6074 if (p->error_indicator) {
6075 D(p->level--);
6076 return NULL;
6077 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006078 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006079 int _mark = p->mark;
6080 { // (('@' named_expression NEWLINE))+
6081 if (p->error_indicator) {
6082 D(p->level--);
6083 return NULL;
6084 }
6085 D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006086 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006087 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006088 (a = (asdl_expr_seq*)_loop1_68_rule(p)) // (('@' named_expression NEWLINE))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006089 )
6090 {
6091 D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6092 _res = a;
6093 if (_res == NULL && PyErr_Occurred()) {
6094 p->error_indicator = 1;
6095 D(p->level--);
6096 return NULL;
6097 }
6098 goto done;
6099 }
6100 p->mark = _mark;
6101 D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
6102 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6103 }
6104 _res = NULL;
6105 done:
6106 D(p->level--);
6107 return _res;
6108}
6109
6110// class_def: decorators class_def_raw | class_def_raw
6111static stmt_ty
6112class_def_rule(Parser *p)
6113{
6114 D(p->level++);
6115 if (p->error_indicator) {
6116 D(p->level--);
6117 return NULL;
6118 }
6119 stmt_ty _res = NULL;
6120 int _mark = p->mark;
6121 { // decorators class_def_raw
6122 if (p->error_indicator) {
6123 D(p->level--);
6124 return NULL;
6125 }
6126 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 +01006127 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006128 stmt_ty b;
6129 if (
6130 (a = decorators_rule(p)) // decorators
6131 &&
6132 (b = class_def_raw_rule(p)) // class_def_raw
6133 )
6134 {
6135 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6136 _res = _PyPegen_class_def_decorators ( p , a , b );
6137 if (_res == NULL && PyErr_Occurred()) {
6138 p->error_indicator = 1;
6139 D(p->level--);
6140 return NULL;
6141 }
6142 goto done;
6143 }
6144 p->mark = _mark;
6145 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6146 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
6147 }
6148 { // class_def_raw
6149 if (p->error_indicator) {
6150 D(p->level--);
6151 return NULL;
6152 }
6153 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6154 stmt_ty class_def_raw_var;
6155 if (
6156 (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
6157 )
6158 {
6159 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6160 _res = class_def_raw_var;
6161 goto done;
6162 }
6163 p->mark = _mark;
6164 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6165 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
6166 }
6167 _res = NULL;
6168 done:
6169 D(p->level--);
6170 return _res;
6171}
6172
6173// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
6174static stmt_ty
6175class_def_raw_rule(Parser *p)
6176{
6177 D(p->level++);
6178 if (p->error_indicator) {
6179 D(p->level--);
6180 return NULL;
6181 }
6182 stmt_ty _res = NULL;
6183 int _mark = p->mark;
6184 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6185 p->error_indicator = 1;
6186 D(p->level--);
6187 return NULL;
6188 }
6189 int _start_lineno = p->tokens[_mark]->lineno;
6190 UNUSED(_start_lineno); // Only used by EXTRA macro
6191 int _start_col_offset = p->tokens[_mark]->col_offset;
6192 UNUSED(_start_col_offset); // Only used by EXTRA macro
6193 { // 'class' NAME ['(' arguments? ')'] ':' block
6194 if (p->error_indicator) {
6195 D(p->level--);
6196 return NULL;
6197 }
6198 D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6199 Token * _keyword;
6200 Token * _literal;
6201 expr_ty a;
6202 void *b;
Pablo Galindoa5634c42020-09-16 19:42:00 +01006203 asdl_stmt_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006204 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006205 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006206 &&
6207 (a = _PyPegen_name_token(p)) // NAME
6208 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006209 (b = _tmp_69_rule(p), 1) // ['(' arguments? ')']
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006210 &&
6211 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
6212 &&
6213 (c = block_rule(p)) // block
6214 )
6215 {
6216 D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6217 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6218 if (_token == NULL) {
6219 D(p->level--);
6220 return NULL;
6221 }
6222 int _end_lineno = _token->end_lineno;
6223 UNUSED(_end_lineno); // Only used by EXTRA macro
6224 int _end_col_offset = _token->end_col_offset;
6225 UNUSED(_end_col_offset); // Only used by EXTRA macro
6226 _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 );
6227 if (_res == NULL && PyErr_Occurred()) {
6228 p->error_indicator = 1;
6229 D(p->level--);
6230 return NULL;
6231 }
6232 goto done;
6233 }
6234 p->mark = _mark;
6235 D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
6236 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6237 }
6238 _res = NULL;
6239 done:
6240 D(p->level--);
6241 return _res;
6242}
6243
6244// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
Pablo Galindoa5634c42020-09-16 19:42:00 +01006245static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006246block_rule(Parser *p)
6247{
6248 D(p->level++);
6249 if (p->error_indicator) {
6250 D(p->level--);
6251 return NULL;
6252 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006253 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006254 if (_PyPegen_is_memoized(p, block_type, &_res)) {
6255 D(p->level--);
6256 return _res;
6257 }
6258 int _mark = p->mark;
6259 { // NEWLINE INDENT statements DEDENT
6260 if (p->error_indicator) {
6261 D(p->level--);
6262 return NULL;
6263 }
6264 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 +01006265 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006266 Token * dedent_var;
6267 Token * indent_var;
6268 Token * newline_var;
6269 if (
6270 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
6271 &&
6272 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
6273 &&
6274 (a = statements_rule(p)) // statements
6275 &&
6276 (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
6277 )
6278 {
6279 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6280 _res = a;
6281 if (_res == NULL && PyErr_Occurred()) {
6282 p->error_indicator = 1;
6283 D(p->level--);
6284 return NULL;
6285 }
6286 goto done;
6287 }
6288 p->mark = _mark;
6289 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6290 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6291 }
6292 { // simple_stmt
6293 if (p->error_indicator) {
6294 D(p->level--);
6295 return NULL;
6296 }
6297 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006298 asdl_stmt_seq* simple_stmt_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006299 if (
6300 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
6301 )
6302 {
6303 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6304 _res = simple_stmt_var;
6305 goto done;
6306 }
6307 p->mark = _mark;
6308 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6309 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
6310 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02006311 if (p->call_invalid_rules) { // invalid_block
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006312 if (p->error_indicator) {
6313 D(p->level--);
6314 return NULL;
6315 }
6316 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6317 void *invalid_block_var;
6318 if (
6319 (invalid_block_var = invalid_block_rule(p)) // invalid_block
6320 )
6321 {
6322 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6323 _res = invalid_block_var;
6324 goto done;
6325 }
6326 p->mark = _mark;
6327 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6328 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
6329 }
6330 _res = NULL;
6331 done:
6332 _PyPegen_insert_memo(p, _mark, block_type, _res);
6333 D(p->level--);
6334 return _res;
6335}
6336
6337// expressions_list: ','.star_expression+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +01006338static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006339expressions_list_rule(Parser *p)
6340{
6341 D(p->level++);
6342 if (p->error_indicator) {
6343 D(p->level--);
6344 return NULL;
6345 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006346 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006347 int _mark = p->mark;
6348 { // ','.star_expression+ ','?
6349 if (p->error_indicator) {
6350 D(p->level--);
6351 return NULL;
6352 }
6353 D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6354 void *_opt_var;
6355 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01006356 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006357 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006358 (a = (asdl_expr_seq*)_gather_70_rule(p)) // ','.star_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006359 &&
6360 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6361 )
6362 {
6363 D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6364 _res = a;
6365 if (_res == NULL && PyErr_Occurred()) {
6366 p->error_indicator = 1;
6367 D(p->level--);
6368 return NULL;
6369 }
6370 goto done;
6371 }
6372 p->mark = _mark;
6373 D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ',
6374 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?"));
6375 }
6376 _res = NULL;
6377 done:
6378 D(p->level--);
6379 return _res;
6380}
6381
6382// star_expressions:
6383// | star_expression ((',' star_expression))+ ','?
6384// | star_expression ','
6385// | star_expression
6386static expr_ty
6387star_expressions_rule(Parser *p)
6388{
6389 D(p->level++);
6390 if (p->error_indicator) {
6391 D(p->level--);
6392 return NULL;
6393 }
6394 expr_ty _res = NULL;
6395 int _mark = p->mark;
6396 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6397 p->error_indicator = 1;
6398 D(p->level--);
6399 return NULL;
6400 }
6401 int _start_lineno = p->tokens[_mark]->lineno;
6402 UNUSED(_start_lineno); // Only used by EXTRA macro
6403 int _start_col_offset = p->tokens[_mark]->col_offset;
6404 UNUSED(_start_col_offset); // Only used by EXTRA macro
6405 { // star_expression ((',' star_expression))+ ','?
6406 if (p->error_indicator) {
6407 D(p->level--);
6408 return NULL;
6409 }
6410 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6411 void *_opt_var;
6412 UNUSED(_opt_var); // Silence compiler warnings
6413 expr_ty a;
6414 asdl_seq * b;
6415 if (
6416 (a = star_expression_rule(p)) // star_expression
6417 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006418 (b = _loop1_72_rule(p)) // ((',' star_expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006419 &&
6420 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6421 )
6422 {
6423 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6424 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6425 if (_token == NULL) {
6426 D(p->level--);
6427 return NULL;
6428 }
6429 int _end_lineno = _token->end_lineno;
6430 UNUSED(_end_lineno); // Only used by EXTRA macro
6431 int _end_col_offset = _token->end_col_offset;
6432 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006433 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006434 if (_res == NULL && PyErr_Occurred()) {
6435 p->error_indicator = 1;
6436 D(p->level--);
6437 return NULL;
6438 }
6439 goto done;
6440 }
6441 p->mark = _mark;
6442 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6443 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6444 }
6445 { // star_expression ','
6446 if (p->error_indicator) {
6447 D(p->level--);
6448 return NULL;
6449 }
6450 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6451 Token * _literal;
6452 expr_ty a;
6453 if (
6454 (a = star_expression_rule(p)) // star_expression
6455 &&
6456 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6457 )
6458 {
6459 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6460 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6461 if (_token == NULL) {
6462 D(p->level--);
6463 return NULL;
6464 }
6465 int _end_lineno = _token->end_lineno;
6466 UNUSED(_end_lineno); // Only used by EXTRA macro
6467 int _end_col_offset = _token->end_col_offset;
6468 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006469 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006470 if (_res == NULL && PyErr_Occurred()) {
6471 p->error_indicator = 1;
6472 D(p->level--);
6473 return NULL;
6474 }
6475 goto done;
6476 }
6477 p->mark = _mark;
6478 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6479 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','"));
6480 }
6481 { // star_expression
6482 if (p->error_indicator) {
6483 D(p->level--);
6484 return NULL;
6485 }
6486 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
6487 expr_ty star_expression_var;
6488 if (
6489 (star_expression_var = star_expression_rule(p)) // star_expression
6490 )
6491 {
6492 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
6493 _res = star_expression_var;
6494 goto done;
6495 }
6496 p->mark = _mark;
6497 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
6499 }
6500 _res = NULL;
6501 done:
6502 D(p->level--);
6503 return _res;
6504}
6505
6506// star_expression: '*' bitwise_or | expression
6507static expr_ty
6508star_expression_rule(Parser *p)
6509{
6510 D(p->level++);
6511 if (p->error_indicator) {
6512 D(p->level--);
6513 return NULL;
6514 }
6515 expr_ty _res = NULL;
6516 if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
6517 D(p->level--);
6518 return _res;
6519 }
6520 int _mark = p->mark;
6521 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6522 p->error_indicator = 1;
6523 D(p->level--);
6524 return NULL;
6525 }
6526 int _start_lineno = p->tokens[_mark]->lineno;
6527 UNUSED(_start_lineno); // Only used by EXTRA macro
6528 int _start_col_offset = p->tokens[_mark]->col_offset;
6529 UNUSED(_start_col_offset); // Only used by EXTRA macro
6530 { // '*' bitwise_or
6531 if (p->error_indicator) {
6532 D(p->level--);
6533 return NULL;
6534 }
6535 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6536 Token * _literal;
6537 expr_ty a;
6538 if (
6539 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6540 &&
6541 (a = bitwise_or_rule(p)) // bitwise_or
6542 )
6543 {
6544 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6545 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6546 if (_token == NULL) {
6547 D(p->level--);
6548 return NULL;
6549 }
6550 int _end_lineno = _token->end_lineno;
6551 UNUSED(_end_lineno); // Only used by EXTRA macro
6552 int _end_col_offset = _token->end_col_offset;
6553 UNUSED(_end_col_offset); // Only used by EXTRA macro
6554 _res = _Py_Starred ( a , Load , EXTRA );
6555 if (_res == NULL && PyErr_Occurred()) {
6556 p->error_indicator = 1;
6557 D(p->level--);
6558 return NULL;
6559 }
6560 goto done;
6561 }
6562 p->mark = _mark;
6563 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6564 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6565 }
6566 { // expression
6567 if (p->error_indicator) {
6568 D(p->level--);
6569 return NULL;
6570 }
6571 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6572 expr_ty expression_var;
6573 if (
6574 (expression_var = expression_rule(p)) // expression
6575 )
6576 {
6577 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6578 _res = expression_var;
6579 goto done;
6580 }
6581 p->mark = _mark;
6582 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6583 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6584 }
6585 _res = NULL;
6586 done:
6587 _PyPegen_insert_memo(p, _mark, star_expression_type, _res);
6588 D(p->level--);
6589 return _res;
6590}
6591
6592// star_named_expressions: ','.star_named_expression+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +01006593static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006594star_named_expressions_rule(Parser *p)
6595{
6596 D(p->level++);
6597 if (p->error_indicator) {
6598 D(p->level--);
6599 return NULL;
6600 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006601 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006602 int _mark = p->mark;
6603 { // ','.star_named_expression+ ','?
6604 if (p->error_indicator) {
6605 D(p->level--);
6606 return NULL;
6607 }
6608 D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6609 void *_opt_var;
6610 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01006611 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006612 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006613 (a = (asdl_expr_seq*)_gather_73_rule(p)) // ','.star_named_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006614 &&
6615 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6616 )
6617 {
6618 D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6619 _res = a;
6620 if (_res == NULL && PyErr_Occurred()) {
6621 p->error_indicator = 1;
6622 D(p->level--);
6623 return NULL;
6624 }
6625 goto done;
6626 }
6627 p->mark = _mark;
6628 D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6629 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
6630 }
6631 _res = NULL;
6632 done:
6633 D(p->level--);
6634 return _res;
6635}
6636
6637// star_named_expression: '*' bitwise_or | named_expression
6638static expr_ty
6639star_named_expression_rule(Parser *p)
6640{
6641 D(p->level++);
6642 if (p->error_indicator) {
6643 D(p->level--);
6644 return NULL;
6645 }
6646 expr_ty _res = NULL;
6647 int _mark = p->mark;
6648 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6649 p->error_indicator = 1;
6650 D(p->level--);
6651 return NULL;
6652 }
6653 int _start_lineno = p->tokens[_mark]->lineno;
6654 UNUSED(_start_lineno); // Only used by EXTRA macro
6655 int _start_col_offset = p->tokens[_mark]->col_offset;
6656 UNUSED(_start_col_offset); // Only used by EXTRA macro
6657 { // '*' bitwise_or
6658 if (p->error_indicator) {
6659 D(p->level--);
6660 return NULL;
6661 }
6662 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6663 Token * _literal;
6664 expr_ty a;
6665 if (
6666 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6667 &&
6668 (a = bitwise_or_rule(p)) // bitwise_or
6669 )
6670 {
6671 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6672 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6673 if (_token == NULL) {
6674 D(p->level--);
6675 return NULL;
6676 }
6677 int _end_lineno = _token->end_lineno;
6678 UNUSED(_end_lineno); // Only used by EXTRA macro
6679 int _end_col_offset = _token->end_col_offset;
6680 UNUSED(_end_col_offset); // Only used by EXTRA macro
6681 _res = _Py_Starred ( a , Load , EXTRA );
6682 if (_res == NULL && PyErr_Occurred()) {
6683 p->error_indicator = 1;
6684 D(p->level--);
6685 return NULL;
6686 }
6687 goto done;
6688 }
6689 p->mark = _mark;
6690 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6691 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6692 }
6693 { // named_expression
6694 if (p->error_indicator) {
6695 D(p->level--);
6696 return NULL;
6697 }
6698 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
6699 expr_ty named_expression_var;
6700 if (
6701 (named_expression_var = named_expression_rule(p)) // named_expression
6702 )
6703 {
6704 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
6705 _res = named_expression_var;
6706 goto done;
6707 }
6708 p->mark = _mark;
6709 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6710 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
6711 }
6712 _res = NULL;
6713 done:
6714 D(p->level--);
6715 return _res;
6716}
6717
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006718// named_expression: NAME ':=' ~ expression | expression !':=' | invalid_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006719static expr_ty
6720named_expression_rule(Parser *p)
6721{
6722 D(p->level++);
6723 if (p->error_indicator) {
6724 D(p->level--);
6725 return NULL;
6726 }
6727 expr_ty _res = NULL;
6728 int _mark = p->mark;
6729 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6730 p->error_indicator = 1;
6731 D(p->level--);
6732 return NULL;
6733 }
6734 int _start_lineno = p->tokens[_mark]->lineno;
6735 UNUSED(_start_lineno); // Only used by EXTRA macro
6736 int _start_col_offset = p->tokens[_mark]->col_offset;
6737 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006738 { // NAME ':=' ~ expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006739 if (p->error_indicator) {
6740 D(p->level--);
6741 return NULL;
6742 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006743 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
6744 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006745 Token * _literal;
6746 expr_ty a;
6747 expr_ty b;
6748 if (
6749 (a = _PyPegen_name_token(p)) // NAME
6750 &&
6751 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
6752 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006753 (_cut_var = 1)
6754 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006755 (b = expression_rule(p)) // expression
6756 )
6757 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006758 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 +01006759 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6760 if (_token == NULL) {
6761 D(p->level--);
6762 return NULL;
6763 }
6764 int _end_lineno = _token->end_lineno;
6765 UNUSED(_end_lineno); // Only used by EXTRA macro
6766 int _end_col_offset = _token->end_col_offset;
6767 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006768 _res = _Py_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006769 if (_res == NULL && PyErr_Occurred()) {
6770 p->error_indicator = 1;
6771 D(p->level--);
6772 return NULL;
6773 }
6774 goto done;
6775 }
6776 p->mark = _mark;
6777 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006778 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
6779 if (_cut_var) {
6780 D(p->level--);
6781 return NULL;
6782 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006783 }
6784 { // expression !':='
6785 if (p->error_indicator) {
6786 D(p->level--);
6787 return NULL;
6788 }
6789 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6790 expr_ty expression_var;
6791 if (
6792 (expression_var = expression_rule(p)) // expression
6793 &&
6794 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
6795 )
6796 {
6797 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6798 _res = expression_var;
6799 goto done;
6800 }
6801 p->mark = _mark;
6802 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6803 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
6804 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02006805 if (p->call_invalid_rules) { // invalid_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006806 if (p->error_indicator) {
6807 D(p->level--);
6808 return NULL;
6809 }
6810 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6811 void *invalid_named_expression_var;
6812 if (
6813 (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression
6814 )
6815 {
6816 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6817 _res = invalid_named_expression_var;
6818 goto done;
6819 }
6820 p->mark = _mark;
6821 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6822 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
6823 }
6824 _res = NULL;
6825 done:
6826 D(p->level--);
6827 return _res;
6828}
6829
6830// annotated_rhs: yield_expr | star_expressions
6831static expr_ty
6832annotated_rhs_rule(Parser *p)
6833{
6834 D(p->level++);
6835 if (p->error_indicator) {
6836 D(p->level--);
6837 return NULL;
6838 }
6839 expr_ty _res = NULL;
6840 int _mark = p->mark;
6841 { // yield_expr
6842 if (p->error_indicator) {
6843 D(p->level--);
6844 return NULL;
6845 }
6846 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6847 expr_ty yield_expr_var;
6848 if (
6849 (yield_expr_var = yield_expr_rule(p)) // yield_expr
6850 )
6851 {
6852 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6853 _res = yield_expr_var;
6854 goto done;
6855 }
6856 p->mark = _mark;
6857 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6858 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
6859 }
6860 { // star_expressions
6861 if (p->error_indicator) {
6862 D(p->level--);
6863 return NULL;
6864 }
6865 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6866 expr_ty star_expressions_var;
6867 if (
6868 (star_expressions_var = star_expressions_rule(p)) // star_expressions
6869 )
6870 {
6871 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6872 _res = star_expressions_var;
6873 goto done;
6874 }
6875 p->mark = _mark;
6876 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6877 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
6878 }
6879 _res = NULL;
6880 done:
6881 D(p->level--);
6882 return _res;
6883}
6884
6885// expressions: expression ((',' expression))+ ','? | expression ',' | expression
6886static expr_ty
6887expressions_rule(Parser *p)
6888{
6889 D(p->level++);
6890 if (p->error_indicator) {
6891 D(p->level--);
6892 return NULL;
6893 }
6894 expr_ty _res = NULL;
6895 int _mark = p->mark;
6896 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6897 p->error_indicator = 1;
6898 D(p->level--);
6899 return NULL;
6900 }
6901 int _start_lineno = p->tokens[_mark]->lineno;
6902 UNUSED(_start_lineno); // Only used by EXTRA macro
6903 int _start_col_offset = p->tokens[_mark]->col_offset;
6904 UNUSED(_start_col_offset); // Only used by EXTRA macro
6905 { // expression ((',' expression))+ ','?
6906 if (p->error_indicator) {
6907 D(p->level--);
6908 return NULL;
6909 }
6910 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6911 void *_opt_var;
6912 UNUSED(_opt_var); // Silence compiler warnings
6913 expr_ty a;
6914 asdl_seq * b;
6915 if (
6916 (a = expression_rule(p)) // expression
6917 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006918 (b = _loop1_75_rule(p)) // ((',' expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006919 &&
6920 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6921 )
6922 {
6923 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6924 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6925 if (_token == NULL) {
6926 D(p->level--);
6927 return NULL;
6928 }
6929 int _end_lineno = _token->end_lineno;
6930 UNUSED(_end_lineno); // Only used by EXTRA macro
6931 int _end_col_offset = _token->end_col_offset;
6932 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006933 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006934 if (_res == NULL && PyErr_Occurred()) {
6935 p->error_indicator = 1;
6936 D(p->level--);
6937 return NULL;
6938 }
6939 goto done;
6940 }
6941 p->mark = _mark;
6942 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6943 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
6944 }
6945 { // expression ','
6946 if (p->error_indicator) {
6947 D(p->level--);
6948 return NULL;
6949 }
6950 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
6951 Token * _literal;
6952 expr_ty a;
6953 if (
6954 (a = expression_rule(p)) // expression
6955 &&
6956 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6957 )
6958 {
6959 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
6960 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6961 if (_token == NULL) {
6962 D(p->level--);
6963 return NULL;
6964 }
6965 int _end_lineno = _token->end_lineno;
6966 UNUSED(_end_lineno); // Only used by EXTRA macro
6967 int _end_col_offset = _token->end_col_offset;
6968 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006969 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006970 if (_res == NULL && PyErr_Occurred()) {
6971 p->error_indicator = 1;
6972 D(p->level--);
6973 return NULL;
6974 }
6975 goto done;
6976 }
6977 p->mark = _mark;
6978 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6979 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
6980 }
6981 { // expression
6982 if (p->error_indicator) {
6983 D(p->level--);
6984 return NULL;
6985 }
6986 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6987 expr_ty expression_var;
6988 if (
6989 (expression_var = expression_rule(p)) // expression
6990 )
6991 {
6992 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6993 _res = expression_var;
6994 goto done;
6995 }
6996 p->mark = _mark;
6997 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6998 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6999 }
7000 _res = NULL;
7001 done:
7002 D(p->level--);
7003 return _res;
7004}
7005
7006// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
7007static expr_ty
7008expression_rule(Parser *p)
7009{
7010 D(p->level++);
7011 if (p->error_indicator) {
7012 D(p->level--);
7013 return NULL;
7014 }
7015 expr_ty _res = NULL;
7016 if (_PyPegen_is_memoized(p, expression_type, &_res)) {
7017 D(p->level--);
7018 return _res;
7019 }
7020 int _mark = p->mark;
7021 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7022 p->error_indicator = 1;
7023 D(p->level--);
7024 return NULL;
7025 }
7026 int _start_lineno = p->tokens[_mark]->lineno;
7027 UNUSED(_start_lineno); // Only used by EXTRA macro
7028 int _start_col_offset = p->tokens[_mark]->col_offset;
7029 UNUSED(_start_col_offset); // Only used by EXTRA macro
7030 { // disjunction 'if' disjunction 'else' expression
7031 if (p->error_indicator) {
7032 D(p->level--);
7033 return NULL;
7034 }
7035 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7036 Token * _keyword;
7037 Token * _keyword_1;
7038 expr_ty a;
7039 expr_ty b;
7040 expr_ty c;
7041 if (
7042 (a = disjunction_rule(p)) // disjunction
7043 &&
7044 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
7045 &&
7046 (b = disjunction_rule(p)) // disjunction
7047 &&
7048 (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else'
7049 &&
7050 (c = expression_rule(p)) // expression
7051 )
7052 {
7053 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7054 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7055 if (_token == NULL) {
7056 D(p->level--);
7057 return NULL;
7058 }
7059 int _end_lineno = _token->end_lineno;
7060 UNUSED(_end_lineno); // Only used by EXTRA macro
7061 int _end_col_offset = _token->end_col_offset;
7062 UNUSED(_end_col_offset); // Only used by EXTRA macro
7063 _res = _Py_IfExp ( b , a , c , EXTRA );
7064 if (_res == NULL && PyErr_Occurred()) {
7065 p->error_indicator = 1;
7066 D(p->level--);
7067 return NULL;
7068 }
7069 goto done;
7070 }
7071 p->mark = _mark;
7072 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7073 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7074 }
7075 { // disjunction
7076 if (p->error_indicator) {
7077 D(p->level--);
7078 return NULL;
7079 }
7080 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
7081 expr_ty disjunction_var;
7082 if (
7083 (disjunction_var = disjunction_rule(p)) // disjunction
7084 )
7085 {
7086 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
7087 _res = disjunction_var;
7088 goto done;
7089 }
7090 p->mark = _mark;
7091 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7092 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
7093 }
7094 { // lambdef
7095 if (p->error_indicator) {
7096 D(p->level--);
7097 return NULL;
7098 }
7099 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
7100 expr_ty lambdef_var;
7101 if (
7102 (lambdef_var = lambdef_rule(p)) // lambdef
7103 )
7104 {
7105 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
7106 _res = lambdef_var;
7107 goto done;
7108 }
7109 p->mark = _mark;
7110 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7111 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
7112 }
7113 _res = NULL;
7114 done:
7115 _PyPegen_insert_memo(p, _mark, expression_type, _res);
7116 D(p->level--);
7117 return _res;
7118}
7119
7120// lambdef: 'lambda' lambda_params? ':' expression
7121static expr_ty
7122lambdef_rule(Parser *p)
7123{
7124 D(p->level++);
7125 if (p->error_indicator) {
7126 D(p->level--);
7127 return NULL;
7128 }
7129 expr_ty _res = NULL;
7130 int _mark = p->mark;
7131 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7132 p->error_indicator = 1;
7133 D(p->level--);
7134 return NULL;
7135 }
7136 int _start_lineno = p->tokens[_mark]->lineno;
7137 UNUSED(_start_lineno); // Only used by EXTRA macro
7138 int _start_col_offset = p->tokens[_mark]->col_offset;
7139 UNUSED(_start_col_offset); // Only used by EXTRA macro
7140 { // 'lambda' lambda_params? ':' expression
7141 if (p->error_indicator) {
7142 D(p->level--);
7143 return NULL;
7144 }
7145 D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7146 Token * _keyword;
7147 Token * _literal;
7148 void *a;
7149 expr_ty b;
7150 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007151 (_keyword = _PyPegen_expect_token(p, 525)) // token='lambda'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007152 &&
7153 (a = lambda_params_rule(p), 1) // lambda_params?
7154 &&
7155 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
7156 &&
7157 (b = expression_rule(p)) // expression
7158 )
7159 {
7160 D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7161 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7162 if (_token == NULL) {
7163 D(p->level--);
7164 return NULL;
7165 }
7166 int _end_lineno = _token->end_lineno;
7167 UNUSED(_end_lineno); // Only used by EXTRA macro
7168 int _end_col_offset = _token->end_col_offset;
7169 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03007170 _res = _Py_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007171 if (_res == NULL && PyErr_Occurred()) {
7172 p->error_indicator = 1;
7173 D(p->level--);
7174 return NULL;
7175 }
7176 goto done;
7177 }
7178 p->mark = _mark;
7179 D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
7180 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7181 }
7182 _res = NULL;
7183 done:
7184 D(p->level--);
7185 return _res;
7186}
7187
7188// lambda_params: invalid_lambda_parameters | lambda_parameters
7189static arguments_ty
7190lambda_params_rule(Parser *p)
7191{
7192 D(p->level++);
7193 if (p->error_indicator) {
7194 D(p->level--);
7195 return NULL;
7196 }
7197 arguments_ty _res = NULL;
7198 int _mark = p->mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02007199 if (p->call_invalid_rules) { // invalid_lambda_parameters
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007200 if (p->error_indicator) {
7201 D(p->level--);
7202 return NULL;
7203 }
7204 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7205 void *invalid_lambda_parameters_var;
7206 if (
7207 (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
7208 )
7209 {
7210 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7211 _res = invalid_lambda_parameters_var;
7212 goto done;
7213 }
7214 p->mark = _mark;
7215 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7216 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
7217 }
7218 { // lambda_parameters
7219 if (p->error_indicator) {
7220 D(p->level--);
7221 return NULL;
7222 }
7223 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7224 arguments_ty lambda_parameters_var;
7225 if (
7226 (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
7227 )
7228 {
7229 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7230 _res = lambda_parameters_var;
7231 goto done;
7232 }
7233 p->mark = _mark;
7234 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7235 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
7236 }
7237 _res = NULL;
7238 done:
7239 D(p->level--);
7240 return _res;
7241}
7242
7243// lambda_parameters:
7244// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7245// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7246// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7247// | lambda_param_with_default+ lambda_star_etc?
7248// | lambda_star_etc
7249static arguments_ty
7250lambda_parameters_rule(Parser *p)
7251{
7252 D(p->level++);
7253 if (p->error_indicator) {
7254 D(p->level--);
7255 return NULL;
7256 }
7257 arguments_ty _res = NULL;
7258 int _mark = p->mark;
7259 { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7260 if (p->error_indicator) {
7261 D(p->level--);
7262 return NULL;
7263 }
7264 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 +01007265 asdl_arg_seq* a;
7266 asdl_arg_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007267 asdl_seq * c;
7268 void *d;
7269 if (
7270 (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
7271 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01007272 (b = (asdl_arg_seq*)_loop0_76_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007273 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007274 (c = _loop0_77_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007275 &&
7276 (d = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7277 )
7278 {
7279 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?"));
7280 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
7281 if (_res == NULL && PyErr_Occurred()) {
7282 p->error_indicator = 1;
7283 D(p->level--);
7284 return NULL;
7285 }
7286 goto done;
7287 }
7288 p->mark = _mark;
7289 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7290 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
7291 }
7292 { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7293 if (p->error_indicator) {
7294 D(p->level--);
7295 return NULL;
7296 }
7297 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?"));
7298 SlashWithDefault* a;
7299 asdl_seq * b;
7300 void *c;
7301 if (
7302 (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
7303 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007304 (b = _loop0_78_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007305 &&
7306 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7307 )
7308 {
7309 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?"));
7310 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
7311 if (_res == NULL && PyErr_Occurred()) {
7312 p->error_indicator = 1;
7313 D(p->level--);
7314 return NULL;
7315 }
7316 goto done;
7317 }
7318 p->mark = _mark;
7319 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7320 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
7321 }
7322 { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7323 if (p->error_indicator) {
7324 D(p->level--);
7325 return NULL;
7326 }
7327 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 +01007328 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007329 asdl_seq * b;
7330 void *c;
7331 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007332 (a = (asdl_arg_seq*)_loop1_79_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007333 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007334 (b = _loop0_80_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007335 &&
7336 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7337 )
7338 {
7339 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?"));
7340 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
7341 if (_res == NULL && PyErr_Occurred()) {
7342 p->error_indicator = 1;
7343 D(p->level--);
7344 return NULL;
7345 }
7346 goto done;
7347 }
7348 p->mark = _mark;
7349 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7350 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
7351 }
7352 { // lambda_param_with_default+ lambda_star_etc?
7353 if (p->error_indicator) {
7354 D(p->level--);
7355 return NULL;
7356 }
7357 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7358 asdl_seq * a;
7359 void *b;
7360 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007361 (a = _loop1_81_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007362 &&
7363 (b = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7364 )
7365 {
7366 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7367 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
7368 if (_res == NULL && PyErr_Occurred()) {
7369 p->error_indicator = 1;
7370 D(p->level--);
7371 return NULL;
7372 }
7373 goto done;
7374 }
7375 p->mark = _mark;
7376 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7377 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7378 }
7379 { // lambda_star_etc
7380 if (p->error_indicator) {
7381 D(p->level--);
7382 return NULL;
7383 }
7384 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7385 StarEtc* a;
7386 if (
7387 (a = lambda_star_etc_rule(p)) // lambda_star_etc
7388 )
7389 {
7390 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7391 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
7392 if (_res == NULL && PyErr_Occurred()) {
7393 p->error_indicator = 1;
7394 D(p->level--);
7395 return NULL;
7396 }
7397 goto done;
7398 }
7399 p->mark = _mark;
7400 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7401 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
7402 }
7403 _res = NULL;
7404 done:
7405 D(p->level--);
7406 return _res;
7407}
7408
7409// lambda_slash_no_default:
7410// | lambda_param_no_default+ '/' ','
7411// | lambda_param_no_default+ '/' &':'
Pablo Galindoa5634c42020-09-16 19:42:00 +01007412static asdl_arg_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007413lambda_slash_no_default_rule(Parser *p)
7414{
7415 D(p->level++);
7416 if (p->error_indicator) {
7417 D(p->level--);
7418 return NULL;
7419 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01007420 asdl_arg_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007421 int _mark = p->mark;
7422 { // lambda_param_no_default+ '/' ','
7423 if (p->error_indicator) {
7424 D(p->level--);
7425 return NULL;
7426 }
7427 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7428 Token * _literal;
7429 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +01007430 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007431 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007432 (a = (asdl_arg_seq*)_loop1_82_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007433 &&
7434 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7435 &&
7436 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7437 )
7438 {
7439 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7440 _res = a;
7441 if (_res == NULL && PyErr_Occurred()) {
7442 p->error_indicator = 1;
7443 D(p->level--);
7444 return NULL;
7445 }
7446 goto done;
7447 }
7448 p->mark = _mark;
7449 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7450 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7451 }
7452 { // lambda_param_no_default+ '/' &':'
7453 if (p->error_indicator) {
7454 D(p->level--);
7455 return NULL;
7456 }
7457 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7458 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01007459 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007460 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007461 (a = (asdl_arg_seq*)_loop1_83_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007462 &&
7463 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7464 &&
7465 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7466 )
7467 {
7468 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7469 _res = a;
7470 if (_res == NULL && PyErr_Occurred()) {
7471 p->error_indicator = 1;
7472 D(p->level--);
7473 return NULL;
7474 }
7475 goto done;
7476 }
7477 p->mark = _mark;
7478 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7479 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7480 }
7481 _res = NULL;
7482 done:
7483 D(p->level--);
7484 return _res;
7485}
7486
7487// lambda_slash_with_default:
7488// | lambda_param_no_default* lambda_param_with_default+ '/' ','
7489// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
7490static SlashWithDefault*
7491lambda_slash_with_default_rule(Parser *p)
7492{
7493 D(p->level++);
7494 if (p->error_indicator) {
7495 D(p->level--);
7496 return NULL;
7497 }
7498 SlashWithDefault* _res = NULL;
7499 int _mark = p->mark;
7500 { // lambda_param_no_default* lambda_param_with_default+ '/' ','
7501 if (p->error_indicator) {
7502 D(p->level--);
7503 return NULL;
7504 }
7505 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+ '/' ','"));
7506 Token * _literal;
7507 Token * _literal_1;
7508 asdl_seq * a;
7509 asdl_seq * b;
7510 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007511 (a = _loop0_84_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007512 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007513 (b = _loop1_85_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007514 &&
7515 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7516 &&
7517 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7518 )
7519 {
7520 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 +01007521 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007522 if (_res == NULL && PyErr_Occurred()) {
7523 p->error_indicator = 1;
7524 D(p->level--);
7525 return NULL;
7526 }
7527 goto done;
7528 }
7529 p->mark = _mark;
7530 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7531 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
7532 }
7533 { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
7534 if (p->error_indicator) {
7535 D(p->level--);
7536 return NULL;
7537 }
7538 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+ '/' &':'"));
7539 Token * _literal;
7540 asdl_seq * a;
7541 asdl_seq * b;
7542 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007543 (a = _loop0_86_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007544 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007545 (b = _loop1_87_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007546 &&
7547 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7548 &&
7549 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7550 )
7551 {
7552 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 +01007553 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007554 if (_res == NULL && PyErr_Occurred()) {
7555 p->error_indicator = 1;
7556 D(p->level--);
7557 return NULL;
7558 }
7559 goto done;
7560 }
7561 p->mark = _mark;
7562 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7563 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
7564 }
7565 _res = NULL;
7566 done:
7567 D(p->level--);
7568 return _res;
7569}
7570
7571// lambda_star_etc:
7572// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7573// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
7574// | lambda_kwds
7575// | invalid_lambda_star_etc
7576static StarEtc*
7577lambda_star_etc_rule(Parser *p)
7578{
7579 D(p->level++);
7580 if (p->error_indicator) {
7581 D(p->level--);
7582 return NULL;
7583 }
7584 StarEtc* _res = NULL;
7585 int _mark = p->mark;
7586 { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7587 if (p->error_indicator) {
7588 D(p->level--);
7589 return NULL;
7590 }
7591 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?"));
7592 Token * _literal;
7593 arg_ty a;
7594 asdl_seq * b;
7595 void *c;
7596 if (
7597 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7598 &&
7599 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7600 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007601 (b = _loop0_88_rule(p)) // lambda_param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007602 &&
7603 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7604 )
7605 {
7606 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?"));
7607 _res = _PyPegen_star_etc ( p , a , b , c );
7608 if (_res == NULL && PyErr_Occurred()) {
7609 p->error_indicator = 1;
7610 D(p->level--);
7611 return NULL;
7612 }
7613 goto done;
7614 }
7615 p->mark = _mark;
7616 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7617 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
7618 }
7619 { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
7620 if (p->error_indicator) {
7621 D(p->level--);
7622 return NULL;
7623 }
7624 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7625 Token * _literal;
7626 Token * _literal_1;
7627 asdl_seq * b;
7628 void *c;
7629 if (
7630 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7631 &&
7632 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7633 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007634 (b = _loop1_89_rule(p)) // lambda_param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007635 &&
7636 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7637 )
7638 {
7639 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7640 _res = _PyPegen_star_etc ( p , NULL , b , c );
7641 if (_res == NULL && PyErr_Occurred()) {
7642 p->error_indicator = 1;
7643 D(p->level--);
7644 return NULL;
7645 }
7646 goto done;
7647 }
7648 p->mark = _mark;
7649 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7650 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7651 }
7652 { // lambda_kwds
7653 if (p->error_indicator) {
7654 D(p->level--);
7655 return NULL;
7656 }
7657 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7658 arg_ty a;
7659 if (
7660 (a = lambda_kwds_rule(p)) // lambda_kwds
7661 )
7662 {
7663 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7664 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
7665 if (_res == NULL && PyErr_Occurred()) {
7666 p->error_indicator = 1;
7667 D(p->level--);
7668 return NULL;
7669 }
7670 goto done;
7671 }
7672 p->mark = _mark;
7673 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7674 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
7675 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02007676 if (p->call_invalid_rules) { // invalid_lambda_star_etc
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007677 if (p->error_indicator) {
7678 D(p->level--);
7679 return NULL;
7680 }
7681 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7682 void *invalid_lambda_star_etc_var;
7683 if (
7684 (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
7685 )
7686 {
7687 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7688 _res = invalid_lambda_star_etc_var;
7689 goto done;
7690 }
7691 p->mark = _mark;
7692 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7693 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
7694 }
7695 _res = NULL;
7696 done:
7697 D(p->level--);
7698 return _res;
7699}
7700
7701// lambda_kwds: '**' lambda_param_no_default
7702static arg_ty
7703lambda_kwds_rule(Parser *p)
7704{
7705 D(p->level++);
7706 if (p->error_indicator) {
7707 D(p->level--);
7708 return NULL;
7709 }
7710 arg_ty _res = NULL;
7711 int _mark = p->mark;
7712 { // '**' lambda_param_no_default
7713 if (p->error_indicator) {
7714 D(p->level--);
7715 return NULL;
7716 }
7717 D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7718 Token * _literal;
7719 arg_ty a;
7720 if (
7721 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
7722 &&
7723 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7724 )
7725 {
7726 D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7727 _res = a;
7728 if (_res == NULL && PyErr_Occurred()) {
7729 p->error_indicator = 1;
7730 D(p->level--);
7731 return NULL;
7732 }
7733 goto done;
7734 }
7735 p->mark = _mark;
7736 D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
7737 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
7738 }
7739 _res = NULL;
7740 done:
7741 D(p->level--);
7742 return _res;
7743}
7744
7745// lambda_param_no_default: lambda_param ',' | lambda_param &':'
7746static arg_ty
7747lambda_param_no_default_rule(Parser *p)
7748{
7749 D(p->level++);
7750 if (p->error_indicator) {
7751 D(p->level--);
7752 return NULL;
7753 }
7754 arg_ty _res = NULL;
7755 int _mark = p->mark;
7756 { // lambda_param ','
7757 if (p->error_indicator) {
7758 D(p->level--);
7759 return NULL;
7760 }
7761 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7762 Token * _literal;
7763 arg_ty a;
7764 if (
7765 (a = lambda_param_rule(p)) // lambda_param
7766 &&
7767 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7768 )
7769 {
7770 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7771 _res = a;
7772 if (_res == NULL && PyErr_Occurred()) {
7773 p->error_indicator = 1;
7774 D(p->level--);
7775 return NULL;
7776 }
7777 goto done;
7778 }
7779 p->mark = _mark;
7780 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7781 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
7782 }
7783 { // lambda_param &':'
7784 if (p->error_indicator) {
7785 D(p->level--);
7786 return NULL;
7787 }
7788 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7789 arg_ty a;
7790 if (
7791 (a = lambda_param_rule(p)) // lambda_param
7792 &&
7793 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7794 )
7795 {
7796 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7797 _res = a;
7798 if (_res == NULL && PyErr_Occurred()) {
7799 p->error_indicator = 1;
7800 D(p->level--);
7801 return NULL;
7802 }
7803 goto done;
7804 }
7805 p->mark = _mark;
7806 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7807 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
7808 }
7809 _res = NULL;
7810 done:
7811 D(p->level--);
7812 return _res;
7813}
7814
7815// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
7816static NameDefaultPair*
7817lambda_param_with_default_rule(Parser *p)
7818{
7819 D(p->level++);
7820 if (p->error_indicator) {
7821 D(p->level--);
7822 return NULL;
7823 }
7824 NameDefaultPair* _res = NULL;
7825 int _mark = p->mark;
7826 { // lambda_param default ','
7827 if (p->error_indicator) {
7828 D(p->level--);
7829 return NULL;
7830 }
7831 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7832 Token * _literal;
7833 arg_ty a;
7834 expr_ty c;
7835 if (
7836 (a = lambda_param_rule(p)) // lambda_param
7837 &&
7838 (c = default_rule(p)) // default
7839 &&
7840 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7841 )
7842 {
7843 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7844 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7845 if (_res == NULL && PyErr_Occurred()) {
7846 p->error_indicator = 1;
7847 D(p->level--);
7848 return NULL;
7849 }
7850 goto done;
7851 }
7852 p->mark = _mark;
7853 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7854 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
7855 }
7856 { // lambda_param default &':'
7857 if (p->error_indicator) {
7858 D(p->level--);
7859 return NULL;
7860 }
7861 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7862 arg_ty a;
7863 expr_ty c;
7864 if (
7865 (a = lambda_param_rule(p)) // lambda_param
7866 &&
7867 (c = default_rule(p)) // default
7868 &&
7869 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7870 )
7871 {
7872 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7873 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7874 if (_res == NULL && PyErr_Occurred()) {
7875 p->error_indicator = 1;
7876 D(p->level--);
7877 return NULL;
7878 }
7879 goto done;
7880 }
7881 p->mark = _mark;
7882 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7883 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
7884 }
7885 _res = NULL;
7886 done:
7887 D(p->level--);
7888 return _res;
7889}
7890
7891// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
7892static NameDefaultPair*
7893lambda_param_maybe_default_rule(Parser *p)
7894{
7895 D(p->level++);
7896 if (p->error_indicator) {
7897 D(p->level--);
7898 return NULL;
7899 }
7900 NameDefaultPair* _res = NULL;
7901 int _mark = p->mark;
7902 { // lambda_param default? ','
7903 if (p->error_indicator) {
7904 D(p->level--);
7905 return NULL;
7906 }
7907 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7908 Token * _literal;
7909 arg_ty a;
7910 void *c;
7911 if (
7912 (a = lambda_param_rule(p)) // lambda_param
7913 &&
7914 (c = default_rule(p), 1) // default?
7915 &&
7916 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7917 )
7918 {
7919 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7920 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7921 if (_res == NULL && PyErr_Occurred()) {
7922 p->error_indicator = 1;
7923 D(p->level--);
7924 return NULL;
7925 }
7926 goto done;
7927 }
7928 p->mark = _mark;
7929 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7930 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
7931 }
7932 { // lambda_param default? &':'
7933 if (p->error_indicator) {
7934 D(p->level--);
7935 return NULL;
7936 }
7937 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7938 arg_ty a;
7939 void *c;
7940 if (
7941 (a = lambda_param_rule(p)) // lambda_param
7942 &&
7943 (c = default_rule(p), 1) // default?
7944 &&
7945 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7946 )
7947 {
7948 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7949 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7950 if (_res == NULL && PyErr_Occurred()) {
7951 p->error_indicator = 1;
7952 D(p->level--);
7953 return NULL;
7954 }
7955 goto done;
7956 }
7957 p->mark = _mark;
7958 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7959 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
7960 }
7961 _res = NULL;
7962 done:
7963 D(p->level--);
7964 return _res;
7965}
7966
7967// lambda_param: NAME
7968static arg_ty
7969lambda_param_rule(Parser *p)
7970{
7971 D(p->level++);
7972 if (p->error_indicator) {
7973 D(p->level--);
7974 return NULL;
7975 }
7976 arg_ty _res = NULL;
7977 int _mark = p->mark;
7978 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7979 p->error_indicator = 1;
7980 D(p->level--);
7981 return NULL;
7982 }
7983 int _start_lineno = p->tokens[_mark]->lineno;
7984 UNUSED(_start_lineno); // Only used by EXTRA macro
7985 int _start_col_offset = p->tokens[_mark]->col_offset;
7986 UNUSED(_start_col_offset); // Only used by EXTRA macro
7987 { // NAME
7988 if (p->error_indicator) {
7989 D(p->level--);
7990 return NULL;
7991 }
7992 D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
7993 expr_ty a;
7994 if (
7995 (a = _PyPegen_name_token(p)) // NAME
7996 )
7997 {
7998 D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
7999 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8000 if (_token == NULL) {
8001 D(p->level--);
8002 return NULL;
8003 }
8004 int _end_lineno = _token->end_lineno;
8005 UNUSED(_end_lineno); // Only used by EXTRA macro
8006 int _end_col_offset = _token->end_col_offset;
8007 UNUSED(_end_col_offset); // Only used by EXTRA macro
8008 _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
8009 if (_res == NULL && PyErr_Occurred()) {
8010 p->error_indicator = 1;
8011 D(p->level--);
8012 return NULL;
8013 }
8014 goto done;
8015 }
8016 p->mark = _mark;
8017 D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
8018 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
8019 }
8020 _res = NULL;
8021 done:
8022 D(p->level--);
8023 return _res;
8024}
8025
8026// disjunction: conjunction (('or' conjunction))+ | conjunction
8027static expr_ty
8028disjunction_rule(Parser *p)
8029{
8030 D(p->level++);
8031 if (p->error_indicator) {
8032 D(p->level--);
8033 return NULL;
8034 }
8035 expr_ty _res = NULL;
8036 if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
8037 D(p->level--);
8038 return _res;
8039 }
8040 int _mark = p->mark;
8041 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8042 p->error_indicator = 1;
8043 D(p->level--);
8044 return NULL;
8045 }
8046 int _start_lineno = p->tokens[_mark]->lineno;
8047 UNUSED(_start_lineno); // Only used by EXTRA macro
8048 int _start_col_offset = p->tokens[_mark]->col_offset;
8049 UNUSED(_start_col_offset); // Only used by EXTRA macro
8050 { // conjunction (('or' conjunction))+
8051 if (p->error_indicator) {
8052 D(p->level--);
8053 return NULL;
8054 }
8055 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8056 expr_ty a;
8057 asdl_seq * b;
8058 if (
8059 (a = conjunction_rule(p)) // conjunction
8060 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008061 (b = _loop1_90_rule(p)) // (('or' conjunction))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008062 )
8063 {
8064 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8065 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8066 if (_token == NULL) {
8067 D(p->level--);
8068 return NULL;
8069 }
8070 int _end_lineno = _token->end_lineno;
8071 UNUSED(_end_lineno); // Only used by EXTRA macro
8072 int _end_col_offset = _token->end_col_offset;
8073 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03008074 _res = _Py_BoolOp ( Or , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008075 if (_res == NULL && PyErr_Occurred()) {
8076 p->error_indicator = 1;
8077 D(p->level--);
8078 return NULL;
8079 }
8080 goto done;
8081 }
8082 p->mark = _mark;
8083 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8084 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+"));
8085 }
8086 { // conjunction
8087 if (p->error_indicator) {
8088 D(p->level--);
8089 return NULL;
8090 }
8091 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
8092 expr_ty conjunction_var;
8093 if (
8094 (conjunction_var = conjunction_rule(p)) // conjunction
8095 )
8096 {
8097 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
8098 _res = conjunction_var;
8099 goto done;
8100 }
8101 p->mark = _mark;
8102 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8103 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
8104 }
8105 _res = NULL;
8106 done:
8107 _PyPegen_insert_memo(p, _mark, disjunction_type, _res);
8108 D(p->level--);
8109 return _res;
8110}
8111
8112// conjunction: inversion (('and' inversion))+ | inversion
8113static expr_ty
8114conjunction_rule(Parser *p)
8115{
8116 D(p->level++);
8117 if (p->error_indicator) {
8118 D(p->level--);
8119 return NULL;
8120 }
8121 expr_ty _res = NULL;
8122 if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
8123 D(p->level--);
8124 return _res;
8125 }
8126 int _mark = p->mark;
8127 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8128 p->error_indicator = 1;
8129 D(p->level--);
8130 return NULL;
8131 }
8132 int _start_lineno = p->tokens[_mark]->lineno;
8133 UNUSED(_start_lineno); // Only used by EXTRA macro
8134 int _start_col_offset = p->tokens[_mark]->col_offset;
8135 UNUSED(_start_col_offset); // Only used by EXTRA macro
8136 { // inversion (('and' inversion))+
8137 if (p->error_indicator) {
8138 D(p->level--);
8139 return NULL;
8140 }
8141 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8142 expr_ty a;
8143 asdl_seq * b;
8144 if (
8145 (a = inversion_rule(p)) // inversion
8146 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008147 (b = _loop1_91_rule(p)) // (('and' inversion))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008148 )
8149 {
8150 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8151 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8152 if (_token == NULL) {
8153 D(p->level--);
8154 return NULL;
8155 }
8156 int _end_lineno = _token->end_lineno;
8157 UNUSED(_end_lineno); // Only used by EXTRA macro
8158 int _end_col_offset = _token->end_col_offset;
8159 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03008160 _res = _Py_BoolOp ( And , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008161 if (_res == NULL && PyErr_Occurred()) {
8162 p->error_indicator = 1;
8163 D(p->level--);
8164 return NULL;
8165 }
8166 goto done;
8167 }
8168 p->mark = _mark;
8169 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8170 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+"));
8171 }
8172 { // inversion
8173 if (p->error_indicator) {
8174 D(p->level--);
8175 return NULL;
8176 }
8177 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
8178 expr_ty inversion_var;
8179 if (
8180 (inversion_var = inversion_rule(p)) // inversion
8181 )
8182 {
8183 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
8184 _res = inversion_var;
8185 goto done;
8186 }
8187 p->mark = _mark;
8188 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8189 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
8190 }
8191 _res = NULL;
8192 done:
8193 _PyPegen_insert_memo(p, _mark, conjunction_type, _res);
8194 D(p->level--);
8195 return _res;
8196}
8197
8198// inversion: 'not' inversion | comparison
8199static expr_ty
8200inversion_rule(Parser *p)
8201{
8202 D(p->level++);
8203 if (p->error_indicator) {
8204 D(p->level--);
8205 return NULL;
8206 }
8207 expr_ty _res = NULL;
8208 if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
8209 D(p->level--);
8210 return _res;
8211 }
8212 int _mark = p->mark;
8213 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8214 p->error_indicator = 1;
8215 D(p->level--);
8216 return NULL;
8217 }
8218 int _start_lineno = p->tokens[_mark]->lineno;
8219 UNUSED(_start_lineno); // Only used by EXTRA macro
8220 int _start_col_offset = p->tokens[_mark]->col_offset;
8221 UNUSED(_start_col_offset); // Only used by EXTRA macro
8222 { // 'not' inversion
8223 if (p->error_indicator) {
8224 D(p->level--);
8225 return NULL;
8226 }
8227 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8228 Token * _keyword;
8229 expr_ty a;
8230 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008231 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008232 &&
8233 (a = inversion_rule(p)) // inversion
8234 )
8235 {
8236 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8237 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8238 if (_token == NULL) {
8239 D(p->level--);
8240 return NULL;
8241 }
8242 int _end_lineno = _token->end_lineno;
8243 UNUSED(_end_lineno); // Only used by EXTRA macro
8244 int _end_col_offset = _token->end_col_offset;
8245 UNUSED(_end_col_offset); // Only used by EXTRA macro
8246 _res = _Py_UnaryOp ( Not , a , EXTRA );
8247 if (_res == NULL && PyErr_Occurred()) {
8248 p->error_indicator = 1;
8249 D(p->level--);
8250 return NULL;
8251 }
8252 goto done;
8253 }
8254 p->mark = _mark;
8255 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8256 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion"));
8257 }
8258 { // comparison
8259 if (p->error_indicator) {
8260 D(p->level--);
8261 return NULL;
8262 }
8263 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
8264 expr_ty comparison_var;
8265 if (
8266 (comparison_var = comparison_rule(p)) // comparison
8267 )
8268 {
8269 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
8270 _res = comparison_var;
8271 goto done;
8272 }
8273 p->mark = _mark;
8274 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8275 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
8276 }
8277 _res = NULL;
8278 done:
8279 _PyPegen_insert_memo(p, _mark, inversion_type, _res);
8280 D(p->level--);
8281 return _res;
8282}
8283
8284// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
8285static expr_ty
8286comparison_rule(Parser *p)
8287{
8288 D(p->level++);
8289 if (p->error_indicator) {
8290 D(p->level--);
8291 return NULL;
8292 }
8293 expr_ty _res = NULL;
8294 int _mark = p->mark;
8295 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8296 p->error_indicator = 1;
8297 D(p->level--);
8298 return NULL;
8299 }
8300 int _start_lineno = p->tokens[_mark]->lineno;
8301 UNUSED(_start_lineno); // Only used by EXTRA macro
8302 int _start_col_offset = p->tokens[_mark]->col_offset;
8303 UNUSED(_start_col_offset); // Only used by EXTRA macro
8304 { // bitwise_or compare_op_bitwise_or_pair+
8305 if (p->error_indicator) {
8306 D(p->level--);
8307 return NULL;
8308 }
8309 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8310 expr_ty a;
8311 asdl_seq * b;
8312 if (
8313 (a = bitwise_or_rule(p)) // bitwise_or
8314 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008315 (b = _loop1_92_rule(p)) // compare_op_bitwise_or_pair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008316 )
8317 {
8318 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8319 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8320 if (_token == NULL) {
8321 D(p->level--);
8322 return NULL;
8323 }
8324 int _end_lineno = _token->end_lineno;
8325 UNUSED(_end_lineno); // Only used by EXTRA macro
8326 int _end_col_offset = _token->end_col_offset;
8327 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03008328 _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 +01008329 if (_res == NULL && PyErr_Occurred()) {
8330 p->error_indicator = 1;
8331 D(p->level--);
8332 return NULL;
8333 }
8334 goto done;
8335 }
8336 p->mark = _mark;
8337 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8338 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8339 }
8340 { // bitwise_or
8341 if (p->error_indicator) {
8342 D(p->level--);
8343 return NULL;
8344 }
8345 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8346 expr_ty bitwise_or_var;
8347 if (
8348 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
8349 )
8350 {
8351 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8352 _res = bitwise_or_var;
8353 goto done;
8354 }
8355 p->mark = _mark;
8356 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8357 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
8358 }
8359 _res = NULL;
8360 done:
8361 D(p->level--);
8362 return _res;
8363}
8364
8365// compare_op_bitwise_or_pair:
8366// | eq_bitwise_or
8367// | noteq_bitwise_or
8368// | lte_bitwise_or
8369// | lt_bitwise_or
8370// | gte_bitwise_or
8371// | gt_bitwise_or
8372// | notin_bitwise_or
8373// | in_bitwise_or
8374// | isnot_bitwise_or
8375// | is_bitwise_or
8376static CmpopExprPair*
8377compare_op_bitwise_or_pair_rule(Parser *p)
8378{
8379 D(p->level++);
8380 if (p->error_indicator) {
8381 D(p->level--);
8382 return NULL;
8383 }
8384 CmpopExprPair* _res = NULL;
8385 int _mark = p->mark;
8386 { // eq_bitwise_or
8387 if (p->error_indicator) {
8388 D(p->level--);
8389 return NULL;
8390 }
8391 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8392 CmpopExprPair* eq_bitwise_or_var;
8393 if (
8394 (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or
8395 )
8396 {
8397 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8398 _res = eq_bitwise_or_var;
8399 goto done;
8400 }
8401 p->mark = _mark;
8402 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8403 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or"));
8404 }
8405 { // noteq_bitwise_or
8406 if (p->error_indicator) {
8407 D(p->level--);
8408 return NULL;
8409 }
8410 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8411 CmpopExprPair* noteq_bitwise_or_var;
8412 if (
8413 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or
8414 )
8415 {
8416 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8417 _res = noteq_bitwise_or_var;
8418 goto done;
8419 }
8420 p->mark = _mark;
8421 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8422 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or"));
8423 }
8424 { // lte_bitwise_or
8425 if (p->error_indicator) {
8426 D(p->level--);
8427 return NULL;
8428 }
8429 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8430 CmpopExprPair* lte_bitwise_or_var;
8431 if (
8432 (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or
8433 )
8434 {
8435 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8436 _res = lte_bitwise_or_var;
8437 goto done;
8438 }
8439 p->mark = _mark;
8440 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8441 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or"));
8442 }
8443 { // lt_bitwise_or
8444 if (p->error_indicator) {
8445 D(p->level--);
8446 return NULL;
8447 }
8448 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8449 CmpopExprPair* lt_bitwise_or_var;
8450 if (
8451 (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or
8452 )
8453 {
8454 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8455 _res = lt_bitwise_or_var;
8456 goto done;
8457 }
8458 p->mark = _mark;
8459 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8460 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or"));
8461 }
8462 { // gte_bitwise_or
8463 if (p->error_indicator) {
8464 D(p->level--);
8465 return NULL;
8466 }
8467 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8468 CmpopExprPair* gte_bitwise_or_var;
8469 if (
8470 (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or
8471 )
8472 {
8473 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8474 _res = gte_bitwise_or_var;
8475 goto done;
8476 }
8477 p->mark = _mark;
8478 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8479 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or"));
8480 }
8481 { // gt_bitwise_or
8482 if (p->error_indicator) {
8483 D(p->level--);
8484 return NULL;
8485 }
8486 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8487 CmpopExprPair* gt_bitwise_or_var;
8488 if (
8489 (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or
8490 )
8491 {
8492 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8493 _res = gt_bitwise_or_var;
8494 goto done;
8495 }
8496 p->mark = _mark;
8497 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or"));
8499 }
8500 { // notin_bitwise_or
8501 if (p->error_indicator) {
8502 D(p->level--);
8503 return NULL;
8504 }
8505 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8506 CmpopExprPair* notin_bitwise_or_var;
8507 if (
8508 (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or
8509 )
8510 {
8511 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8512 _res = notin_bitwise_or_var;
8513 goto done;
8514 }
8515 p->mark = _mark;
8516 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8517 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or"));
8518 }
8519 { // in_bitwise_or
8520 if (p->error_indicator) {
8521 D(p->level--);
8522 return NULL;
8523 }
8524 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8525 CmpopExprPair* in_bitwise_or_var;
8526 if (
8527 (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or
8528 )
8529 {
8530 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8531 _res = in_bitwise_or_var;
8532 goto done;
8533 }
8534 p->mark = _mark;
8535 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8536 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or"));
8537 }
8538 { // isnot_bitwise_or
8539 if (p->error_indicator) {
8540 D(p->level--);
8541 return NULL;
8542 }
8543 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8544 CmpopExprPair* isnot_bitwise_or_var;
8545 if (
8546 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or
8547 )
8548 {
8549 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8550 _res = isnot_bitwise_or_var;
8551 goto done;
8552 }
8553 p->mark = _mark;
8554 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8555 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or"));
8556 }
8557 { // is_bitwise_or
8558 if (p->error_indicator) {
8559 D(p->level--);
8560 return NULL;
8561 }
8562 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8563 CmpopExprPair* is_bitwise_or_var;
8564 if (
8565 (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or
8566 )
8567 {
8568 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8569 _res = is_bitwise_or_var;
8570 goto done;
8571 }
8572 p->mark = _mark;
8573 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8574 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
8575 }
8576 _res = NULL;
8577 done:
8578 D(p->level--);
8579 return _res;
8580}
8581
8582// eq_bitwise_or: '==' bitwise_or
8583static CmpopExprPair*
8584eq_bitwise_or_rule(Parser *p)
8585{
8586 D(p->level++);
8587 if (p->error_indicator) {
8588 D(p->level--);
8589 return NULL;
8590 }
8591 CmpopExprPair* _res = NULL;
8592 int _mark = p->mark;
8593 { // '==' bitwise_or
8594 if (p->error_indicator) {
8595 D(p->level--);
8596 return NULL;
8597 }
8598 D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8599 Token * _literal;
8600 expr_ty a;
8601 if (
8602 (_literal = _PyPegen_expect_token(p, 27)) // token='=='
8603 &&
8604 (a = bitwise_or_rule(p)) // bitwise_or
8605 )
8606 {
8607 D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8608 _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
8609 if (_res == NULL && PyErr_Occurred()) {
8610 p->error_indicator = 1;
8611 D(p->level--);
8612 return NULL;
8613 }
8614 goto done;
8615 }
8616 p->mark = _mark;
8617 D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8618 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
8619 }
8620 _res = NULL;
8621 done:
8622 D(p->level--);
8623 return _res;
8624}
8625
8626// noteq_bitwise_or: ('!=') bitwise_or
8627static CmpopExprPair*
8628noteq_bitwise_or_rule(Parser *p)
8629{
8630 D(p->level++);
8631 if (p->error_indicator) {
8632 D(p->level--);
8633 return NULL;
8634 }
8635 CmpopExprPair* _res = NULL;
8636 int _mark = p->mark;
8637 { // ('!=') bitwise_or
8638 if (p->error_indicator) {
8639 D(p->level--);
8640 return NULL;
8641 }
8642 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 +03008643 void *_tmp_93_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008644 expr_ty a;
8645 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008646 (_tmp_93_var = _tmp_93_rule(p)) // '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008647 &&
8648 (a = bitwise_or_rule(p)) // bitwise_or
8649 )
8650 {
8651 D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
8652 _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
8653 if (_res == NULL && PyErr_Occurred()) {
8654 p->error_indicator = 1;
8655 D(p->level--);
8656 return NULL;
8657 }
8658 goto done;
8659 }
8660 p->mark = _mark;
8661 D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8662 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
8663 }
8664 _res = NULL;
8665 done:
8666 D(p->level--);
8667 return _res;
8668}
8669
8670// lte_bitwise_or: '<=' bitwise_or
8671static CmpopExprPair*
8672lte_bitwise_or_rule(Parser *p)
8673{
8674 D(p->level++);
8675 if (p->error_indicator) {
8676 D(p->level--);
8677 return NULL;
8678 }
8679 CmpopExprPair* _res = NULL;
8680 int _mark = p->mark;
8681 { // '<=' bitwise_or
8682 if (p->error_indicator) {
8683 D(p->level--);
8684 return NULL;
8685 }
8686 D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8687 Token * _literal;
8688 expr_ty a;
8689 if (
8690 (_literal = _PyPegen_expect_token(p, 29)) // token='<='
8691 &&
8692 (a = bitwise_or_rule(p)) // bitwise_or
8693 )
8694 {
8695 D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8696 _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
8697 if (_res == NULL && PyErr_Occurred()) {
8698 p->error_indicator = 1;
8699 D(p->level--);
8700 return NULL;
8701 }
8702 goto done;
8703 }
8704 p->mark = _mark;
8705 D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8706 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
8707 }
8708 _res = NULL;
8709 done:
8710 D(p->level--);
8711 return _res;
8712}
8713
8714// lt_bitwise_or: '<' bitwise_or
8715static CmpopExprPair*
8716lt_bitwise_or_rule(Parser *p)
8717{
8718 D(p->level++);
8719 if (p->error_indicator) {
8720 D(p->level--);
8721 return NULL;
8722 }
8723 CmpopExprPair* _res = NULL;
8724 int _mark = p->mark;
8725 { // '<' bitwise_or
8726 if (p->error_indicator) {
8727 D(p->level--);
8728 return NULL;
8729 }
8730 D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8731 Token * _literal;
8732 expr_ty a;
8733 if (
8734 (_literal = _PyPegen_expect_token(p, 20)) // token='<'
8735 &&
8736 (a = bitwise_or_rule(p)) // bitwise_or
8737 )
8738 {
8739 D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8740 _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
8741 if (_res == NULL && PyErr_Occurred()) {
8742 p->error_indicator = 1;
8743 D(p->level--);
8744 return NULL;
8745 }
8746 goto done;
8747 }
8748 p->mark = _mark;
8749 D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8750 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
8751 }
8752 _res = NULL;
8753 done:
8754 D(p->level--);
8755 return _res;
8756}
8757
8758// gte_bitwise_or: '>=' bitwise_or
8759static CmpopExprPair*
8760gte_bitwise_or_rule(Parser *p)
8761{
8762 D(p->level++);
8763 if (p->error_indicator) {
8764 D(p->level--);
8765 return NULL;
8766 }
8767 CmpopExprPair* _res = NULL;
8768 int _mark = p->mark;
8769 { // '>=' bitwise_or
8770 if (p->error_indicator) {
8771 D(p->level--);
8772 return NULL;
8773 }
8774 D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8775 Token * _literal;
8776 expr_ty a;
8777 if (
8778 (_literal = _PyPegen_expect_token(p, 30)) // token='>='
8779 &&
8780 (a = bitwise_or_rule(p)) // bitwise_or
8781 )
8782 {
8783 D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8784 _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
8785 if (_res == NULL && PyErr_Occurred()) {
8786 p->error_indicator = 1;
8787 D(p->level--);
8788 return NULL;
8789 }
8790 goto done;
8791 }
8792 p->mark = _mark;
8793 D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8794 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
8795 }
8796 _res = NULL;
8797 done:
8798 D(p->level--);
8799 return _res;
8800}
8801
8802// gt_bitwise_or: '>' bitwise_or
8803static CmpopExprPair*
8804gt_bitwise_or_rule(Parser *p)
8805{
8806 D(p->level++);
8807 if (p->error_indicator) {
8808 D(p->level--);
8809 return NULL;
8810 }
8811 CmpopExprPair* _res = NULL;
8812 int _mark = p->mark;
8813 { // '>' bitwise_or
8814 if (p->error_indicator) {
8815 D(p->level--);
8816 return NULL;
8817 }
8818 D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8819 Token * _literal;
8820 expr_ty a;
8821 if (
8822 (_literal = _PyPegen_expect_token(p, 21)) // token='>'
8823 &&
8824 (a = bitwise_or_rule(p)) // bitwise_or
8825 )
8826 {
8827 D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8828 _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
8829 if (_res == NULL && PyErr_Occurred()) {
8830 p->error_indicator = 1;
8831 D(p->level--);
8832 return NULL;
8833 }
8834 goto done;
8835 }
8836 p->mark = _mark;
8837 D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8838 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
8839 }
8840 _res = NULL;
8841 done:
8842 D(p->level--);
8843 return _res;
8844}
8845
8846// notin_bitwise_or: 'not' 'in' bitwise_or
8847static CmpopExprPair*
8848notin_bitwise_or_rule(Parser *p)
8849{
8850 D(p->level++);
8851 if (p->error_indicator) {
8852 D(p->level--);
8853 return NULL;
8854 }
8855 CmpopExprPair* _res = NULL;
8856 int _mark = p->mark;
8857 { // 'not' 'in' bitwise_or
8858 if (p->error_indicator) {
8859 D(p->level--);
8860 return NULL;
8861 }
8862 D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8863 Token * _keyword;
8864 Token * _keyword_1;
8865 expr_ty a;
8866 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008867 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008868 &&
8869 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
8870 &&
8871 (a = bitwise_or_rule(p)) // bitwise_or
8872 )
8873 {
8874 D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8875 _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
8876 if (_res == NULL && PyErr_Occurred()) {
8877 p->error_indicator = 1;
8878 D(p->level--);
8879 return NULL;
8880 }
8881 goto done;
8882 }
8883 p->mark = _mark;
8884 D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8885 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
8886 }
8887 _res = NULL;
8888 done:
8889 D(p->level--);
8890 return _res;
8891}
8892
8893// in_bitwise_or: 'in' bitwise_or
8894static CmpopExprPair*
8895in_bitwise_or_rule(Parser *p)
8896{
8897 D(p->level++);
8898 if (p->error_indicator) {
8899 D(p->level--);
8900 return NULL;
8901 }
8902 CmpopExprPair* _res = NULL;
8903 int _mark = p->mark;
8904 { // 'in' bitwise_or
8905 if (p->error_indicator) {
8906 D(p->level--);
8907 return NULL;
8908 }
8909 D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8910 Token * _keyword;
8911 expr_ty a;
8912 if (
8913 (_keyword = _PyPegen_expect_token(p, 518)) // token='in'
8914 &&
8915 (a = bitwise_or_rule(p)) // bitwise_or
8916 )
8917 {
8918 D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8919 _res = _PyPegen_cmpop_expr_pair ( p , In , a );
8920 if (_res == NULL && PyErr_Occurred()) {
8921 p->error_indicator = 1;
8922 D(p->level--);
8923 return NULL;
8924 }
8925 goto done;
8926 }
8927 p->mark = _mark;
8928 D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8929 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
8930 }
8931 _res = NULL;
8932 done:
8933 D(p->level--);
8934 return _res;
8935}
8936
8937// isnot_bitwise_or: 'is' 'not' bitwise_or
8938static CmpopExprPair*
8939isnot_bitwise_or_rule(Parser *p)
8940{
8941 D(p->level++);
8942 if (p->error_indicator) {
8943 D(p->level--);
8944 return NULL;
8945 }
8946 CmpopExprPair* _res = NULL;
8947 int _mark = p->mark;
8948 { // 'is' 'not' bitwise_or
8949 if (p->error_indicator) {
8950 D(p->level--);
8951 return NULL;
8952 }
8953 D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8954 Token * _keyword;
8955 Token * _keyword_1;
8956 expr_ty a;
8957 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008958 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008959 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008960 (_keyword_1 = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008961 &&
8962 (a = bitwise_or_rule(p)) // bitwise_or
8963 )
8964 {
8965 D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8966 _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
8967 if (_res == NULL && PyErr_Occurred()) {
8968 p->error_indicator = 1;
8969 D(p->level--);
8970 return NULL;
8971 }
8972 goto done;
8973 }
8974 p->mark = _mark;
8975 D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8976 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
8977 }
8978 _res = NULL;
8979 done:
8980 D(p->level--);
8981 return _res;
8982}
8983
8984// is_bitwise_or: 'is' bitwise_or
8985static CmpopExprPair*
8986is_bitwise_or_rule(Parser *p)
8987{
8988 D(p->level++);
8989 if (p->error_indicator) {
8990 D(p->level--);
8991 return NULL;
8992 }
8993 CmpopExprPair* _res = NULL;
8994 int _mark = p->mark;
8995 { // 'is' bitwise_or
8996 if (p->error_indicator) {
8997 D(p->level--);
8998 return NULL;
8999 }
9000 D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
9001 Token * _keyword;
9002 expr_ty a;
9003 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03009004 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009005 &&
9006 (a = bitwise_or_rule(p)) // bitwise_or
9007 )
9008 {
9009 D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
9010 _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
9011 if (_res == NULL && PyErr_Occurred()) {
9012 p->error_indicator = 1;
9013 D(p->level--);
9014 return NULL;
9015 }
9016 goto done;
9017 }
9018 p->mark = _mark;
9019 D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9020 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
9021 }
9022 _res = NULL;
9023 done:
9024 D(p->level--);
9025 return _res;
9026}
9027
9028// Left-recursive
9029// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
9030static expr_ty bitwise_or_raw(Parser *);
9031static expr_ty
9032bitwise_or_rule(Parser *p)
9033{
9034 D(p->level++);
9035 expr_ty _res = NULL;
9036 if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
9037 D(p->level--);
9038 return _res;
9039 }
9040 int _mark = p->mark;
9041 int _resmark = p->mark;
9042 while (1) {
9043 int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
9044 if (tmpvar_1) {
9045 D(p->level--);
9046 return _res;
9047 }
9048 p->mark = _mark;
9049 void *_raw = bitwise_or_raw(p);
Lysandros Nikolaou02cdfc92020-10-31 20:31:41 +02009050 if (p->error_indicator)
9051 return NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009052 if (_raw == NULL || p->mark <= _resmark)
9053 break;
9054 _resmark = p->mark;
9055 _res = _raw;
9056 }
9057 p->mark = _resmark;
9058 D(p->level--);
9059 return _res;
9060}
9061static expr_ty
9062bitwise_or_raw(Parser *p)
9063{
9064 D(p->level++);
9065 if (p->error_indicator) {
9066 D(p->level--);
9067 return NULL;
9068 }
9069 expr_ty _res = NULL;
9070 int _mark = p->mark;
9071 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9072 p->error_indicator = 1;
9073 D(p->level--);
9074 return NULL;
9075 }
9076 int _start_lineno = p->tokens[_mark]->lineno;
9077 UNUSED(_start_lineno); // Only used by EXTRA macro
9078 int _start_col_offset = p->tokens[_mark]->col_offset;
9079 UNUSED(_start_col_offset); // Only used by EXTRA macro
9080 { // bitwise_or '|' bitwise_xor
9081 if (p->error_indicator) {
9082 D(p->level--);
9083 return NULL;
9084 }
9085 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9086 Token * _literal;
9087 expr_ty a;
9088 expr_ty b;
9089 if (
9090 (a = bitwise_or_rule(p)) // bitwise_or
9091 &&
9092 (_literal = _PyPegen_expect_token(p, 18)) // token='|'
9093 &&
9094 (b = bitwise_xor_rule(p)) // bitwise_xor
9095 )
9096 {
9097 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9098 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9099 if (_token == NULL) {
9100 D(p->level--);
9101 return NULL;
9102 }
9103 int _end_lineno = _token->end_lineno;
9104 UNUSED(_end_lineno); // Only used by EXTRA macro
9105 int _end_col_offset = _token->end_col_offset;
9106 UNUSED(_end_col_offset); // Only used by EXTRA macro
9107 _res = _Py_BinOp ( a , BitOr , b , EXTRA );
9108 if (_res == NULL && PyErr_Occurred()) {
9109 p->error_indicator = 1;
9110 D(p->level--);
9111 return NULL;
9112 }
9113 goto done;
9114 }
9115 p->mark = _mark;
9116 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9117 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9118 }
9119 { // bitwise_xor
9120 if (p->error_indicator) {
9121 D(p->level--);
9122 return NULL;
9123 }
9124 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9125 expr_ty bitwise_xor_var;
9126 if (
9127 (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor
9128 )
9129 {
9130 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9131 _res = bitwise_xor_var;
9132 goto done;
9133 }
9134 p->mark = _mark;
9135 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9136 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
9137 }
9138 _res = NULL;
9139 done:
9140 D(p->level--);
9141 return _res;
9142}
9143
9144// Left-recursive
9145// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
9146static expr_ty bitwise_xor_raw(Parser *);
9147static expr_ty
9148bitwise_xor_rule(Parser *p)
9149{
9150 D(p->level++);
9151 expr_ty _res = NULL;
9152 if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
9153 D(p->level--);
9154 return _res;
9155 }
9156 int _mark = p->mark;
9157 int _resmark = p->mark;
9158 while (1) {
9159 int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
9160 if (tmpvar_2) {
9161 D(p->level--);
9162 return _res;
9163 }
9164 p->mark = _mark;
9165 void *_raw = bitwise_xor_raw(p);
Lysandros Nikolaou02cdfc92020-10-31 20:31:41 +02009166 if (p->error_indicator)
9167 return NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009168 if (_raw == NULL || p->mark <= _resmark)
9169 break;
9170 _resmark = p->mark;
9171 _res = _raw;
9172 }
9173 p->mark = _resmark;
9174 D(p->level--);
9175 return _res;
9176}
9177static expr_ty
9178bitwise_xor_raw(Parser *p)
9179{
9180 D(p->level++);
9181 if (p->error_indicator) {
9182 D(p->level--);
9183 return NULL;
9184 }
9185 expr_ty _res = NULL;
9186 int _mark = p->mark;
9187 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9188 p->error_indicator = 1;
9189 D(p->level--);
9190 return NULL;
9191 }
9192 int _start_lineno = p->tokens[_mark]->lineno;
9193 UNUSED(_start_lineno); // Only used by EXTRA macro
9194 int _start_col_offset = p->tokens[_mark]->col_offset;
9195 UNUSED(_start_col_offset); // Only used by EXTRA macro
9196 { // bitwise_xor '^' bitwise_and
9197 if (p->error_indicator) {
9198 D(p->level--);
9199 return NULL;
9200 }
9201 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9202 Token * _literal;
9203 expr_ty a;
9204 expr_ty b;
9205 if (
9206 (a = bitwise_xor_rule(p)) // bitwise_xor
9207 &&
9208 (_literal = _PyPegen_expect_token(p, 32)) // token='^'
9209 &&
9210 (b = bitwise_and_rule(p)) // bitwise_and
9211 )
9212 {
9213 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9214 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9215 if (_token == NULL) {
9216 D(p->level--);
9217 return NULL;
9218 }
9219 int _end_lineno = _token->end_lineno;
9220 UNUSED(_end_lineno); // Only used by EXTRA macro
9221 int _end_col_offset = _token->end_col_offset;
9222 UNUSED(_end_col_offset); // Only used by EXTRA macro
9223 _res = _Py_BinOp ( a , BitXor , b , EXTRA );
9224 if (_res == NULL && PyErr_Occurred()) {
9225 p->error_indicator = 1;
9226 D(p->level--);
9227 return NULL;
9228 }
9229 goto done;
9230 }
9231 p->mark = _mark;
9232 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9233 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9234 }
9235 { // bitwise_and
9236 if (p->error_indicator) {
9237 D(p->level--);
9238 return NULL;
9239 }
9240 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9241 expr_ty bitwise_and_var;
9242 if (
9243 (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and
9244 )
9245 {
9246 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9247 _res = bitwise_and_var;
9248 goto done;
9249 }
9250 p->mark = _mark;
9251 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9252 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
9253 }
9254 _res = NULL;
9255 done:
9256 D(p->level--);
9257 return _res;
9258}
9259
9260// Left-recursive
9261// bitwise_and: bitwise_and '&' shift_expr | shift_expr
9262static expr_ty bitwise_and_raw(Parser *);
9263static expr_ty
9264bitwise_and_rule(Parser *p)
9265{
9266 D(p->level++);
9267 expr_ty _res = NULL;
9268 if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
9269 D(p->level--);
9270 return _res;
9271 }
9272 int _mark = p->mark;
9273 int _resmark = p->mark;
9274 while (1) {
9275 int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
9276 if (tmpvar_3) {
9277 D(p->level--);
9278 return _res;
9279 }
9280 p->mark = _mark;
9281 void *_raw = bitwise_and_raw(p);
Lysandros Nikolaou02cdfc92020-10-31 20:31:41 +02009282 if (p->error_indicator)
9283 return NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009284 if (_raw == NULL || p->mark <= _resmark)
9285 break;
9286 _resmark = p->mark;
9287 _res = _raw;
9288 }
9289 p->mark = _resmark;
9290 D(p->level--);
9291 return _res;
9292}
9293static expr_ty
9294bitwise_and_raw(Parser *p)
9295{
9296 D(p->level++);
9297 if (p->error_indicator) {
9298 D(p->level--);
9299 return NULL;
9300 }
9301 expr_ty _res = NULL;
9302 int _mark = p->mark;
9303 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9304 p->error_indicator = 1;
9305 D(p->level--);
9306 return NULL;
9307 }
9308 int _start_lineno = p->tokens[_mark]->lineno;
9309 UNUSED(_start_lineno); // Only used by EXTRA macro
9310 int _start_col_offset = p->tokens[_mark]->col_offset;
9311 UNUSED(_start_col_offset); // Only used by EXTRA macro
9312 { // bitwise_and '&' shift_expr
9313 if (p->error_indicator) {
9314 D(p->level--);
9315 return NULL;
9316 }
9317 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9318 Token * _literal;
9319 expr_ty a;
9320 expr_ty b;
9321 if (
9322 (a = bitwise_and_rule(p)) // bitwise_and
9323 &&
9324 (_literal = _PyPegen_expect_token(p, 19)) // token='&'
9325 &&
9326 (b = shift_expr_rule(p)) // shift_expr
9327 )
9328 {
9329 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9330 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9331 if (_token == NULL) {
9332 D(p->level--);
9333 return NULL;
9334 }
9335 int _end_lineno = _token->end_lineno;
9336 UNUSED(_end_lineno); // Only used by EXTRA macro
9337 int _end_col_offset = _token->end_col_offset;
9338 UNUSED(_end_col_offset); // Only used by EXTRA macro
9339 _res = _Py_BinOp ( a , BitAnd , b , EXTRA );
9340 if (_res == NULL && PyErr_Occurred()) {
9341 p->error_indicator = 1;
9342 D(p->level--);
9343 return NULL;
9344 }
9345 goto done;
9346 }
9347 p->mark = _mark;
9348 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9349 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr"));
9350 }
9351 { // shift_expr
9352 if (p->error_indicator) {
9353 D(p->level--);
9354 return NULL;
9355 }
9356 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9357 expr_ty shift_expr_var;
9358 if (
9359 (shift_expr_var = shift_expr_rule(p)) // shift_expr
9360 )
9361 {
9362 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9363 _res = shift_expr_var;
9364 goto done;
9365 }
9366 p->mark = _mark;
9367 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9368 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
9369 }
9370 _res = NULL;
9371 done:
9372 D(p->level--);
9373 return _res;
9374}
9375
9376// Left-recursive
9377// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
9378static expr_ty shift_expr_raw(Parser *);
9379static expr_ty
9380shift_expr_rule(Parser *p)
9381{
9382 D(p->level++);
9383 expr_ty _res = NULL;
9384 if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
9385 D(p->level--);
9386 return _res;
9387 }
9388 int _mark = p->mark;
9389 int _resmark = p->mark;
9390 while (1) {
9391 int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
9392 if (tmpvar_4) {
9393 D(p->level--);
9394 return _res;
9395 }
9396 p->mark = _mark;
9397 void *_raw = shift_expr_raw(p);
Lysandros Nikolaou02cdfc92020-10-31 20:31:41 +02009398 if (p->error_indicator)
9399 return NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009400 if (_raw == NULL || p->mark <= _resmark)
9401 break;
9402 _resmark = p->mark;
9403 _res = _raw;
9404 }
9405 p->mark = _resmark;
9406 D(p->level--);
9407 return _res;
9408}
9409static expr_ty
9410shift_expr_raw(Parser *p)
9411{
9412 D(p->level++);
9413 if (p->error_indicator) {
9414 D(p->level--);
9415 return NULL;
9416 }
9417 expr_ty _res = NULL;
9418 int _mark = p->mark;
9419 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9420 p->error_indicator = 1;
9421 D(p->level--);
9422 return NULL;
9423 }
9424 int _start_lineno = p->tokens[_mark]->lineno;
9425 UNUSED(_start_lineno); // Only used by EXTRA macro
9426 int _start_col_offset = p->tokens[_mark]->col_offset;
9427 UNUSED(_start_col_offset); // Only used by EXTRA macro
9428 { // shift_expr '<<' sum
9429 if (p->error_indicator) {
9430 D(p->level--);
9431 return NULL;
9432 }
9433 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9434 Token * _literal;
9435 expr_ty a;
9436 expr_ty b;
9437 if (
9438 (a = shift_expr_rule(p)) // shift_expr
9439 &&
9440 (_literal = _PyPegen_expect_token(p, 33)) // token='<<'
9441 &&
9442 (b = sum_rule(p)) // sum
9443 )
9444 {
9445 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9446 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9447 if (_token == NULL) {
9448 D(p->level--);
9449 return NULL;
9450 }
9451 int _end_lineno = _token->end_lineno;
9452 UNUSED(_end_lineno); // Only used by EXTRA macro
9453 int _end_col_offset = _token->end_col_offset;
9454 UNUSED(_end_col_offset); // Only used by EXTRA macro
9455 _res = _Py_BinOp ( a , LShift , b , EXTRA );
9456 if (_res == NULL && PyErr_Occurred()) {
9457 p->error_indicator = 1;
9458 D(p->level--);
9459 return NULL;
9460 }
9461 goto done;
9462 }
9463 p->mark = _mark;
9464 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9465 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
9466 }
9467 { // shift_expr '>>' sum
9468 if (p->error_indicator) {
9469 D(p->level--);
9470 return NULL;
9471 }
9472 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9473 Token * _literal;
9474 expr_ty a;
9475 expr_ty b;
9476 if (
9477 (a = shift_expr_rule(p)) // shift_expr
9478 &&
9479 (_literal = _PyPegen_expect_token(p, 34)) // token='>>'
9480 &&
9481 (b = sum_rule(p)) // sum
9482 )
9483 {
9484 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9485 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9486 if (_token == NULL) {
9487 D(p->level--);
9488 return NULL;
9489 }
9490 int _end_lineno = _token->end_lineno;
9491 UNUSED(_end_lineno); // Only used by EXTRA macro
9492 int _end_col_offset = _token->end_col_offset;
9493 UNUSED(_end_col_offset); // Only used by EXTRA macro
9494 _res = _Py_BinOp ( a , RShift , b , EXTRA );
9495 if (_res == NULL && PyErr_Occurred()) {
9496 p->error_indicator = 1;
9497 D(p->level--);
9498 return NULL;
9499 }
9500 goto done;
9501 }
9502 p->mark = _mark;
9503 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9504 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum"));
9505 }
9506 { // sum
9507 if (p->error_indicator) {
9508 D(p->level--);
9509 return NULL;
9510 }
9511 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
9512 expr_ty sum_var;
9513 if (
9514 (sum_var = sum_rule(p)) // sum
9515 )
9516 {
9517 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
9518 _res = sum_var;
9519 goto done;
9520 }
9521 p->mark = _mark;
9522 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9523 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
9524 }
9525 _res = NULL;
9526 done:
9527 D(p->level--);
9528 return _res;
9529}
9530
9531// Left-recursive
9532// sum: sum '+' term | sum '-' term | term
9533static expr_ty sum_raw(Parser *);
9534static expr_ty
9535sum_rule(Parser *p)
9536{
9537 D(p->level++);
9538 expr_ty _res = NULL;
9539 if (_PyPegen_is_memoized(p, sum_type, &_res)) {
9540 D(p->level--);
9541 return _res;
9542 }
9543 int _mark = p->mark;
9544 int _resmark = p->mark;
9545 while (1) {
9546 int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res);
9547 if (tmpvar_5) {
9548 D(p->level--);
9549 return _res;
9550 }
9551 p->mark = _mark;
9552 void *_raw = sum_raw(p);
Lysandros Nikolaou02cdfc92020-10-31 20:31:41 +02009553 if (p->error_indicator)
9554 return NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009555 if (_raw == NULL || p->mark <= _resmark)
9556 break;
9557 _resmark = p->mark;
9558 _res = _raw;
9559 }
9560 p->mark = _resmark;
9561 D(p->level--);
9562 return _res;
9563}
9564static expr_ty
9565sum_raw(Parser *p)
9566{
9567 D(p->level++);
9568 if (p->error_indicator) {
9569 D(p->level--);
9570 return NULL;
9571 }
9572 expr_ty _res = NULL;
9573 int _mark = p->mark;
9574 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9575 p->error_indicator = 1;
9576 D(p->level--);
9577 return NULL;
9578 }
9579 int _start_lineno = p->tokens[_mark]->lineno;
9580 UNUSED(_start_lineno); // Only used by EXTRA macro
9581 int _start_col_offset = p->tokens[_mark]->col_offset;
9582 UNUSED(_start_col_offset); // Only used by EXTRA macro
9583 { // sum '+' term
9584 if (p->error_indicator) {
9585 D(p->level--);
9586 return NULL;
9587 }
9588 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9589 Token * _literal;
9590 expr_ty a;
9591 expr_ty b;
9592 if (
9593 (a = sum_rule(p)) // sum
9594 &&
9595 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9596 &&
9597 (b = term_rule(p)) // term
9598 )
9599 {
9600 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9601 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9602 if (_token == NULL) {
9603 D(p->level--);
9604 return NULL;
9605 }
9606 int _end_lineno = _token->end_lineno;
9607 UNUSED(_end_lineno); // Only used by EXTRA macro
9608 int _end_col_offset = _token->end_col_offset;
9609 UNUSED(_end_col_offset); // Only used by EXTRA macro
9610 _res = _Py_BinOp ( a , Add , b , EXTRA );
9611 if (_res == NULL && PyErr_Occurred()) {
9612 p->error_indicator = 1;
9613 D(p->level--);
9614 return NULL;
9615 }
9616 goto done;
9617 }
9618 p->mark = _mark;
9619 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9620 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
9621 }
9622 { // sum '-' term
9623 if (p->error_indicator) {
9624 D(p->level--);
9625 return NULL;
9626 }
9627 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9628 Token * _literal;
9629 expr_ty a;
9630 expr_ty b;
9631 if (
9632 (a = sum_rule(p)) // sum
9633 &&
9634 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
9635 &&
9636 (b = term_rule(p)) // term
9637 )
9638 {
9639 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9640 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9641 if (_token == NULL) {
9642 D(p->level--);
9643 return NULL;
9644 }
9645 int _end_lineno = _token->end_lineno;
9646 UNUSED(_end_lineno); // Only used by EXTRA macro
9647 int _end_col_offset = _token->end_col_offset;
9648 UNUSED(_end_col_offset); // Only used by EXTRA macro
9649 _res = _Py_BinOp ( a , Sub , b , EXTRA );
9650 if (_res == NULL && PyErr_Occurred()) {
9651 p->error_indicator = 1;
9652 D(p->level--);
9653 return NULL;
9654 }
9655 goto done;
9656 }
9657 p->mark = _mark;
9658 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9659 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term"));
9660 }
9661 { // term
9662 if (p->error_indicator) {
9663 D(p->level--);
9664 return NULL;
9665 }
9666 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
9667 expr_ty term_var;
9668 if (
9669 (term_var = term_rule(p)) // term
9670 )
9671 {
9672 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
9673 _res = term_var;
9674 goto done;
9675 }
9676 p->mark = _mark;
9677 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9678 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
9679 }
9680 _res = NULL;
9681 done:
9682 D(p->level--);
9683 return _res;
9684}
9685
9686// Left-recursive
9687// term:
9688// | term '*' factor
9689// | term '/' factor
9690// | term '//' factor
9691// | term '%' factor
9692// | term '@' factor
9693// | factor
9694static expr_ty term_raw(Parser *);
9695static expr_ty
9696term_rule(Parser *p)
9697{
9698 D(p->level++);
9699 expr_ty _res = NULL;
9700 if (_PyPegen_is_memoized(p, term_type, &_res)) {
9701 D(p->level--);
9702 return _res;
9703 }
9704 int _mark = p->mark;
9705 int _resmark = p->mark;
9706 while (1) {
9707 int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res);
9708 if (tmpvar_6) {
9709 D(p->level--);
9710 return _res;
9711 }
9712 p->mark = _mark;
9713 void *_raw = term_raw(p);
Lysandros Nikolaou02cdfc92020-10-31 20:31:41 +02009714 if (p->error_indicator)
9715 return NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009716 if (_raw == NULL || p->mark <= _resmark)
9717 break;
9718 _resmark = p->mark;
9719 _res = _raw;
9720 }
9721 p->mark = _resmark;
9722 D(p->level--);
9723 return _res;
9724}
9725static expr_ty
9726term_raw(Parser *p)
9727{
9728 D(p->level++);
9729 if (p->error_indicator) {
9730 D(p->level--);
9731 return NULL;
9732 }
9733 expr_ty _res = NULL;
9734 int _mark = p->mark;
9735 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9736 p->error_indicator = 1;
9737 D(p->level--);
9738 return NULL;
9739 }
9740 int _start_lineno = p->tokens[_mark]->lineno;
9741 UNUSED(_start_lineno); // Only used by EXTRA macro
9742 int _start_col_offset = p->tokens[_mark]->col_offset;
9743 UNUSED(_start_col_offset); // Only used by EXTRA macro
9744 { // term '*' factor
9745 if (p->error_indicator) {
9746 D(p->level--);
9747 return NULL;
9748 }
9749 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9750 Token * _literal;
9751 expr_ty a;
9752 expr_ty b;
9753 if (
9754 (a = term_rule(p)) // term
9755 &&
9756 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
9757 &&
9758 (b = factor_rule(p)) // factor
9759 )
9760 {
9761 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9762 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9763 if (_token == NULL) {
9764 D(p->level--);
9765 return NULL;
9766 }
9767 int _end_lineno = _token->end_lineno;
9768 UNUSED(_end_lineno); // Only used by EXTRA macro
9769 int _end_col_offset = _token->end_col_offset;
9770 UNUSED(_end_col_offset); // Only used by EXTRA macro
9771 _res = _Py_BinOp ( a , Mult , b , EXTRA );
9772 if (_res == NULL && PyErr_Occurred()) {
9773 p->error_indicator = 1;
9774 D(p->level--);
9775 return NULL;
9776 }
9777 goto done;
9778 }
9779 p->mark = _mark;
9780 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9781 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
9782 }
9783 { // term '/' factor
9784 if (p->error_indicator) {
9785 D(p->level--);
9786 return NULL;
9787 }
9788 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9789 Token * _literal;
9790 expr_ty a;
9791 expr_ty b;
9792 if (
9793 (a = term_rule(p)) // term
9794 &&
9795 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
9796 &&
9797 (b = factor_rule(p)) // factor
9798 )
9799 {
9800 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9801 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9802 if (_token == NULL) {
9803 D(p->level--);
9804 return NULL;
9805 }
9806 int _end_lineno = _token->end_lineno;
9807 UNUSED(_end_lineno); // Only used by EXTRA macro
9808 int _end_col_offset = _token->end_col_offset;
9809 UNUSED(_end_col_offset); // Only used by EXTRA macro
9810 _res = _Py_BinOp ( a , Div , b , EXTRA );
9811 if (_res == NULL && PyErr_Occurred()) {
9812 p->error_indicator = 1;
9813 D(p->level--);
9814 return NULL;
9815 }
9816 goto done;
9817 }
9818 p->mark = _mark;
9819 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9820 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
9821 }
9822 { // term '//' factor
9823 if (p->error_indicator) {
9824 D(p->level--);
9825 return NULL;
9826 }
9827 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9828 Token * _literal;
9829 expr_ty a;
9830 expr_ty b;
9831 if (
9832 (a = term_rule(p)) // term
9833 &&
9834 (_literal = _PyPegen_expect_token(p, 47)) // token='//'
9835 &&
9836 (b = factor_rule(p)) // factor
9837 )
9838 {
9839 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9840 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9841 if (_token == NULL) {
9842 D(p->level--);
9843 return NULL;
9844 }
9845 int _end_lineno = _token->end_lineno;
9846 UNUSED(_end_lineno); // Only used by EXTRA macro
9847 int _end_col_offset = _token->end_col_offset;
9848 UNUSED(_end_col_offset); // Only used by EXTRA macro
9849 _res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
9850 if (_res == NULL && PyErr_Occurred()) {
9851 p->error_indicator = 1;
9852 D(p->level--);
9853 return NULL;
9854 }
9855 goto done;
9856 }
9857 p->mark = _mark;
9858 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9859 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
9860 }
9861 { // term '%' factor
9862 if (p->error_indicator) {
9863 D(p->level--);
9864 return NULL;
9865 }
9866 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9867 Token * _literal;
9868 expr_ty a;
9869 expr_ty b;
9870 if (
9871 (a = term_rule(p)) // term
9872 &&
9873 (_literal = _PyPegen_expect_token(p, 24)) // token='%'
9874 &&
9875 (b = factor_rule(p)) // factor
9876 )
9877 {
9878 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9879 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9880 if (_token == NULL) {
9881 D(p->level--);
9882 return NULL;
9883 }
9884 int _end_lineno = _token->end_lineno;
9885 UNUSED(_end_lineno); // Only used by EXTRA macro
9886 int _end_col_offset = _token->end_col_offset;
9887 UNUSED(_end_col_offset); // Only used by EXTRA macro
9888 _res = _Py_BinOp ( a , Mod , b , EXTRA );
9889 if (_res == NULL && PyErr_Occurred()) {
9890 p->error_indicator = 1;
9891 D(p->level--);
9892 return NULL;
9893 }
9894 goto done;
9895 }
9896 p->mark = _mark;
9897 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9898 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
9899 }
9900 { // term '@' factor
9901 if (p->error_indicator) {
9902 D(p->level--);
9903 return NULL;
9904 }
9905 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9906 Token * _literal;
9907 expr_ty a;
9908 expr_ty b;
9909 if (
9910 (a = term_rule(p)) // term
9911 &&
9912 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
9913 &&
9914 (b = factor_rule(p)) // factor
9915 )
9916 {
9917 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9918 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9919 if (_token == NULL) {
9920 D(p->level--);
9921 return NULL;
9922 }
9923 int _end_lineno = _token->end_lineno;
9924 UNUSED(_end_lineno); // Only used by EXTRA macro
9925 int _end_col_offset = _token->end_col_offset;
9926 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03009927 _res = CHECK_VERSION ( expr_ty , 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009928 if (_res == NULL && PyErr_Occurred()) {
9929 p->error_indicator = 1;
9930 D(p->level--);
9931 return NULL;
9932 }
9933 goto done;
9934 }
9935 p->mark = _mark;
9936 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9937 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor"));
9938 }
9939 { // factor
9940 if (p->error_indicator) {
9941 D(p->level--);
9942 return NULL;
9943 }
9944 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
9945 expr_ty factor_var;
9946 if (
9947 (factor_var = factor_rule(p)) // factor
9948 )
9949 {
9950 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
9951 _res = factor_var;
9952 goto done;
9953 }
9954 p->mark = _mark;
9955 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9956 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
9957 }
9958 _res = NULL;
9959 done:
9960 D(p->level--);
9961 return _res;
9962}
9963
9964// factor: '+' factor | '-' factor | '~' factor | power
9965static expr_ty
9966factor_rule(Parser *p)
9967{
9968 D(p->level++);
9969 if (p->error_indicator) {
9970 D(p->level--);
9971 return NULL;
9972 }
9973 expr_ty _res = NULL;
9974 if (_PyPegen_is_memoized(p, factor_type, &_res)) {
9975 D(p->level--);
9976 return _res;
9977 }
9978 int _mark = p->mark;
9979 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9980 p->error_indicator = 1;
9981 D(p->level--);
9982 return NULL;
9983 }
9984 int _start_lineno = p->tokens[_mark]->lineno;
9985 UNUSED(_start_lineno); // Only used by EXTRA macro
9986 int _start_col_offset = p->tokens[_mark]->col_offset;
9987 UNUSED(_start_col_offset); // Only used by EXTRA macro
9988 { // '+' factor
9989 if (p->error_indicator) {
9990 D(p->level--);
9991 return NULL;
9992 }
9993 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9994 Token * _literal;
9995 expr_ty a;
9996 if (
9997 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9998 &&
9999 (a = factor_rule(p)) // factor
10000 )
10001 {
10002 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
10003 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10004 if (_token == NULL) {
10005 D(p->level--);
10006 return NULL;
10007 }
10008 int _end_lineno = _token->end_lineno;
10009 UNUSED(_end_lineno); // Only used by EXTRA macro
10010 int _end_col_offset = _token->end_col_offset;
10011 UNUSED(_end_col_offset); // Only used by EXTRA macro
10012 _res = _Py_UnaryOp ( UAdd , a , EXTRA );
10013 if (_res == NULL && PyErr_Occurred()) {
10014 p->error_indicator = 1;
10015 D(p->level--);
10016 return NULL;
10017 }
10018 goto done;
10019 }
10020 p->mark = _mark;
10021 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10022 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
10023 }
10024 { // '-' factor
10025 if (p->error_indicator) {
10026 D(p->level--);
10027 return NULL;
10028 }
10029 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10030 Token * _literal;
10031 expr_ty a;
10032 if (
10033 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
10034 &&
10035 (a = factor_rule(p)) // factor
10036 )
10037 {
10038 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10039 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10040 if (_token == NULL) {
10041 D(p->level--);
10042 return NULL;
10043 }
10044 int _end_lineno = _token->end_lineno;
10045 UNUSED(_end_lineno); // Only used by EXTRA macro
10046 int _end_col_offset = _token->end_col_offset;
10047 UNUSED(_end_col_offset); // Only used by EXTRA macro
10048 _res = _Py_UnaryOp ( USub , a , EXTRA );
10049 if (_res == NULL && PyErr_Occurred()) {
10050 p->error_indicator = 1;
10051 D(p->level--);
10052 return NULL;
10053 }
10054 goto done;
10055 }
10056 p->mark = _mark;
10057 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10058 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
10059 }
10060 { // '~' factor
10061 if (p->error_indicator) {
10062 D(p->level--);
10063 return NULL;
10064 }
10065 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10066 Token * _literal;
10067 expr_ty a;
10068 if (
10069 (_literal = _PyPegen_expect_token(p, 31)) // token='~'
10070 &&
10071 (a = factor_rule(p)) // factor
10072 )
10073 {
10074 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10075 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10076 if (_token == NULL) {
10077 D(p->level--);
10078 return NULL;
10079 }
10080 int _end_lineno = _token->end_lineno;
10081 UNUSED(_end_lineno); // Only used by EXTRA macro
10082 int _end_col_offset = _token->end_col_offset;
10083 UNUSED(_end_col_offset); // Only used by EXTRA macro
10084 _res = _Py_UnaryOp ( Invert , a , EXTRA );
10085 if (_res == NULL && PyErr_Occurred()) {
10086 p->error_indicator = 1;
10087 D(p->level--);
10088 return NULL;
10089 }
10090 goto done;
10091 }
10092 p->mark = _mark;
10093 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10094 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor"));
10095 }
10096 { // power
10097 if (p->error_indicator) {
10098 D(p->level--);
10099 return NULL;
10100 }
10101 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
10102 expr_ty power_var;
10103 if (
10104 (power_var = power_rule(p)) // power
10105 )
10106 {
10107 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
10108 _res = power_var;
10109 goto done;
10110 }
10111 p->mark = _mark;
10112 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10113 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
10114 }
10115 _res = NULL;
10116 done:
10117 _PyPegen_insert_memo(p, _mark, factor_type, _res);
10118 D(p->level--);
10119 return _res;
10120}
10121
10122// power: await_primary '**' factor | await_primary
10123static expr_ty
10124power_rule(Parser *p)
10125{
10126 D(p->level++);
10127 if (p->error_indicator) {
10128 D(p->level--);
10129 return NULL;
10130 }
10131 expr_ty _res = NULL;
10132 int _mark = p->mark;
10133 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10134 p->error_indicator = 1;
10135 D(p->level--);
10136 return NULL;
10137 }
10138 int _start_lineno = p->tokens[_mark]->lineno;
10139 UNUSED(_start_lineno); // Only used by EXTRA macro
10140 int _start_col_offset = p->tokens[_mark]->col_offset;
10141 UNUSED(_start_col_offset); // Only used by EXTRA macro
10142 { // await_primary '**' factor
10143 if (p->error_indicator) {
10144 D(p->level--);
10145 return NULL;
10146 }
10147 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10148 Token * _literal;
10149 expr_ty a;
10150 expr_ty b;
10151 if (
10152 (a = await_primary_rule(p)) // await_primary
10153 &&
10154 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
10155 &&
10156 (b = factor_rule(p)) // factor
10157 )
10158 {
10159 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10160 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10161 if (_token == NULL) {
10162 D(p->level--);
10163 return NULL;
10164 }
10165 int _end_lineno = _token->end_lineno;
10166 UNUSED(_end_lineno); // Only used by EXTRA macro
10167 int _end_col_offset = _token->end_col_offset;
10168 UNUSED(_end_col_offset); // Only used by EXTRA macro
10169 _res = _Py_BinOp ( a , Pow , b , EXTRA );
10170 if (_res == NULL && PyErr_Occurred()) {
10171 p->error_indicator = 1;
10172 D(p->level--);
10173 return NULL;
10174 }
10175 goto done;
10176 }
10177 p->mark = _mark;
10178 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10179 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor"));
10180 }
10181 { // await_primary
10182 if (p->error_indicator) {
10183 D(p->level--);
10184 return NULL;
10185 }
10186 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
10187 expr_ty await_primary_var;
10188 if (
10189 (await_primary_var = await_primary_rule(p)) // await_primary
10190 )
10191 {
10192 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
10193 _res = await_primary_var;
10194 goto done;
10195 }
10196 p->mark = _mark;
10197 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10198 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
10199 }
10200 _res = NULL;
10201 done:
10202 D(p->level--);
10203 return _res;
10204}
10205
10206// await_primary: AWAIT primary | primary
10207static expr_ty
10208await_primary_rule(Parser *p)
10209{
10210 D(p->level++);
10211 if (p->error_indicator) {
10212 D(p->level--);
10213 return NULL;
10214 }
10215 expr_ty _res = NULL;
10216 if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
10217 D(p->level--);
10218 return _res;
10219 }
10220 int _mark = p->mark;
10221 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10222 p->error_indicator = 1;
10223 D(p->level--);
10224 return NULL;
10225 }
10226 int _start_lineno = p->tokens[_mark]->lineno;
10227 UNUSED(_start_lineno); // Only used by EXTRA macro
10228 int _start_col_offset = p->tokens[_mark]->col_offset;
10229 UNUSED(_start_col_offset); // Only used by EXTRA macro
10230 { // AWAIT primary
10231 if (p->error_indicator) {
10232 D(p->level--);
10233 return NULL;
10234 }
10235 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10236 expr_ty a;
10237 Token * await_var;
10238 if (
10239 (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT'
10240 &&
10241 (a = primary_rule(p)) // primary
10242 )
10243 {
10244 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10245 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10246 if (_token == NULL) {
10247 D(p->level--);
10248 return NULL;
10249 }
10250 int _end_lineno = _token->end_lineno;
10251 UNUSED(_end_lineno); // Only used by EXTRA macro
10252 int _end_col_offset = _token->end_col_offset;
10253 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030010254 _res = CHECK_VERSION ( expr_ty , 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010255 if (_res == NULL && PyErr_Occurred()) {
10256 p->error_indicator = 1;
10257 D(p->level--);
10258 return NULL;
10259 }
10260 goto done;
10261 }
10262 p->mark = _mark;
10263 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10264 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary"));
10265 }
10266 { // primary
10267 if (p->error_indicator) {
10268 D(p->level--);
10269 return NULL;
10270 }
10271 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
10272 expr_ty primary_var;
10273 if (
10274 (primary_var = primary_rule(p)) // primary
10275 )
10276 {
10277 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
10278 _res = primary_var;
10279 goto done;
10280 }
10281 p->mark = _mark;
10282 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10283 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
10284 }
10285 _res = NULL;
10286 done:
10287 _PyPegen_insert_memo(p, _mark, await_primary_type, _res);
10288 D(p->level--);
10289 return _res;
10290}
10291
10292// Left-recursive
10293// primary:
Lysandros Nikolaou15acc4e2020-10-27 20:54:20 +020010294// | invalid_primary
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010295// | primary '.' NAME
10296// | primary genexp
10297// | primary '(' arguments? ')'
10298// | primary '[' slices ']'
10299// | atom
10300static expr_ty primary_raw(Parser *);
10301static expr_ty
10302primary_rule(Parser *p)
10303{
10304 D(p->level++);
10305 expr_ty _res = NULL;
10306 if (_PyPegen_is_memoized(p, primary_type, &_res)) {
10307 D(p->level--);
10308 return _res;
10309 }
10310 int _mark = p->mark;
10311 int _resmark = p->mark;
10312 while (1) {
10313 int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res);
10314 if (tmpvar_7) {
10315 D(p->level--);
10316 return _res;
10317 }
10318 p->mark = _mark;
10319 void *_raw = primary_raw(p);
Lysandros Nikolaou02cdfc92020-10-31 20:31:41 +020010320 if (p->error_indicator)
10321 return NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010322 if (_raw == NULL || p->mark <= _resmark)
10323 break;
10324 _resmark = p->mark;
10325 _res = _raw;
10326 }
10327 p->mark = _resmark;
10328 D(p->level--);
10329 return _res;
10330}
10331static expr_ty
10332primary_raw(Parser *p)
10333{
10334 D(p->level++);
10335 if (p->error_indicator) {
10336 D(p->level--);
10337 return NULL;
10338 }
10339 expr_ty _res = NULL;
10340 int _mark = p->mark;
10341 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10342 p->error_indicator = 1;
10343 D(p->level--);
10344 return NULL;
10345 }
10346 int _start_lineno = p->tokens[_mark]->lineno;
10347 UNUSED(_start_lineno); // Only used by EXTRA macro
10348 int _start_col_offset = p->tokens[_mark]->col_offset;
10349 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou15acc4e2020-10-27 20:54:20 +020010350 if (p->call_invalid_rules) { // invalid_primary
10351 if (p->error_indicator) {
10352 D(p->level--);
10353 return NULL;
10354 }
10355 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_primary"));
10356 void *invalid_primary_var;
10357 if (
10358 (invalid_primary_var = invalid_primary_rule(p)) // invalid_primary
10359 )
10360 {
10361 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_primary"));
10362 _res = invalid_primary_var;
10363 goto done;
10364 }
10365 p->mark = _mark;
10366 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10367 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_primary"));
10368 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010369 { // primary '.' NAME
10370 if (p->error_indicator) {
10371 D(p->level--);
10372 return NULL;
10373 }
10374 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10375 Token * _literal;
10376 expr_ty a;
10377 expr_ty b;
10378 if (
10379 (a = primary_rule(p)) // primary
10380 &&
10381 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
10382 &&
10383 (b = _PyPegen_name_token(p)) // NAME
10384 )
10385 {
10386 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10387 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10388 if (_token == NULL) {
10389 D(p->level--);
10390 return NULL;
10391 }
10392 int _end_lineno = _token->end_lineno;
10393 UNUSED(_end_lineno); // Only used by EXTRA macro
10394 int _end_col_offset = _token->end_col_offset;
10395 UNUSED(_end_col_offset); // Only used by EXTRA macro
10396 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
10397 if (_res == NULL && PyErr_Occurred()) {
10398 p->error_indicator = 1;
10399 D(p->level--);
10400 return NULL;
10401 }
10402 goto done;
10403 }
10404 p->mark = _mark;
10405 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10406 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
10407 }
10408 { // primary genexp
10409 if (p->error_indicator) {
10410 D(p->level--);
10411 return NULL;
10412 }
10413 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10414 expr_ty a;
10415 expr_ty b;
10416 if (
10417 (a = primary_rule(p)) // primary
10418 &&
10419 (b = genexp_rule(p)) // genexp
10420 )
10421 {
10422 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10423 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10424 if (_token == NULL) {
10425 D(p->level--);
10426 return NULL;
10427 }
10428 int _end_lineno = _token->end_lineno;
10429 UNUSED(_end_lineno); // Only used by EXTRA macro
10430 int _end_col_offset = _token->end_col_offset;
10431 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030010432 _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 +010010433 if (_res == NULL && PyErr_Occurred()) {
10434 p->error_indicator = 1;
10435 D(p->level--);
10436 return NULL;
10437 }
10438 goto done;
10439 }
10440 p->mark = _mark;
10441 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10442 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
10443 }
10444 { // primary '(' arguments? ')'
10445 if (p->error_indicator) {
10446 D(p->level--);
10447 return NULL;
10448 }
10449 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10450 Token * _literal;
10451 Token * _literal_1;
10452 expr_ty a;
10453 void *b;
10454 if (
10455 (a = primary_rule(p)) // primary
10456 &&
10457 (_literal = _PyPegen_expect_token(p, 7)) // token='('
10458 &&
10459 (b = arguments_rule(p), 1) // arguments?
10460 &&
10461 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
10462 )
10463 {
10464 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10465 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10466 if (_token == NULL) {
10467 D(p->level--);
10468 return NULL;
10469 }
10470 int _end_lineno = _token->end_lineno;
10471 UNUSED(_end_lineno); // Only used by EXTRA macro
10472 int _end_col_offset = _token->end_col_offset;
10473 UNUSED(_end_col_offset); // Only used by EXTRA macro
10474 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
10475 if (_res == NULL && PyErr_Occurred()) {
10476 p->error_indicator = 1;
10477 D(p->level--);
10478 return NULL;
10479 }
10480 goto done;
10481 }
10482 p->mark = _mark;
10483 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10484 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
10485 }
10486 { // primary '[' slices ']'
10487 if (p->error_indicator) {
10488 D(p->level--);
10489 return NULL;
10490 }
10491 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10492 Token * _literal;
10493 Token * _literal_1;
10494 expr_ty a;
10495 expr_ty b;
10496 if (
10497 (a = primary_rule(p)) // primary
10498 &&
10499 (_literal = _PyPegen_expect_token(p, 9)) // token='['
10500 &&
10501 (b = slices_rule(p)) // slices
10502 &&
10503 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
10504 )
10505 {
10506 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10507 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10508 if (_token == NULL) {
10509 D(p->level--);
10510 return NULL;
10511 }
10512 int _end_lineno = _token->end_lineno;
10513 UNUSED(_end_lineno); // Only used by EXTRA macro
10514 int _end_col_offset = _token->end_col_offset;
10515 UNUSED(_end_col_offset); // Only used by EXTRA macro
10516 _res = _Py_Subscript ( a , b , Load , EXTRA );
10517 if (_res == NULL && PyErr_Occurred()) {
10518 p->error_indicator = 1;
10519 D(p->level--);
10520 return NULL;
10521 }
10522 goto done;
10523 }
10524 p->mark = _mark;
10525 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10526 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
10527 }
10528 { // atom
10529 if (p->error_indicator) {
10530 D(p->level--);
10531 return NULL;
10532 }
10533 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
10534 expr_ty atom_var;
10535 if (
10536 (atom_var = atom_rule(p)) // atom
10537 )
10538 {
10539 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
10540 _res = atom_var;
10541 goto done;
10542 }
10543 p->mark = _mark;
10544 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10545 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
10546 }
10547 _res = NULL;
10548 done:
10549 D(p->level--);
10550 return _res;
10551}
10552
10553// slices: slice !',' | ','.slice+ ','?
10554static expr_ty
10555slices_rule(Parser *p)
10556{
10557 D(p->level++);
10558 if (p->error_indicator) {
10559 D(p->level--);
10560 return NULL;
10561 }
10562 expr_ty _res = NULL;
10563 int _mark = p->mark;
10564 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10565 p->error_indicator = 1;
10566 D(p->level--);
10567 return NULL;
10568 }
10569 int _start_lineno = p->tokens[_mark]->lineno;
10570 UNUSED(_start_lineno); // Only used by EXTRA macro
10571 int _start_col_offset = p->tokens[_mark]->col_offset;
10572 UNUSED(_start_col_offset); // Only used by EXTRA macro
10573 { // slice !','
10574 if (p->error_indicator) {
10575 D(p->level--);
10576 return NULL;
10577 }
10578 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
10579 expr_ty a;
10580 if (
10581 (a = slice_rule(p)) // slice
10582 &&
10583 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
10584 )
10585 {
10586 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
10587 _res = a;
10588 if (_res == NULL && PyErr_Occurred()) {
10589 p->error_indicator = 1;
10590 D(p->level--);
10591 return NULL;
10592 }
10593 goto done;
10594 }
10595 p->mark = _mark;
10596 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10597 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
10598 }
10599 { // ','.slice+ ','?
10600 if (p->error_indicator) {
10601 D(p->level--);
10602 return NULL;
10603 }
10604 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10605 void *_opt_var;
10606 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010010607 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010608 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010010609 (a = (asdl_expr_seq*)_gather_94_rule(p)) // ','.slice+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010610 &&
10611 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
10612 )
10613 {
10614 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10615 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10616 if (_token == NULL) {
10617 D(p->level--);
10618 return NULL;
10619 }
10620 int _end_lineno = _token->end_lineno;
10621 UNUSED(_end_lineno); // Only used by EXTRA macro
10622 int _end_col_offset = _token->end_col_offset;
10623 UNUSED(_end_col_offset); // Only used by EXTRA macro
10624 _res = _Py_Tuple ( a , Load , EXTRA );
10625 if (_res == NULL && PyErr_Occurred()) {
10626 p->error_indicator = 1;
10627 D(p->level--);
10628 return NULL;
10629 }
10630 goto done;
10631 }
10632 p->mark = _mark;
10633 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10634 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?"));
10635 }
10636 _res = NULL;
10637 done:
10638 D(p->level--);
10639 return _res;
10640}
10641
10642// slice: expression? ':' expression? [':' expression?] | expression
10643static expr_ty
10644slice_rule(Parser *p)
10645{
10646 D(p->level++);
10647 if (p->error_indicator) {
10648 D(p->level--);
10649 return NULL;
10650 }
10651 expr_ty _res = NULL;
10652 int _mark = p->mark;
10653 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10654 p->error_indicator = 1;
10655 D(p->level--);
10656 return NULL;
10657 }
10658 int _start_lineno = p->tokens[_mark]->lineno;
10659 UNUSED(_start_lineno); // Only used by EXTRA macro
10660 int _start_col_offset = p->tokens[_mark]->col_offset;
10661 UNUSED(_start_col_offset); // Only used by EXTRA macro
10662 { // expression? ':' expression? [':' expression?]
10663 if (p->error_indicator) {
10664 D(p->level--);
10665 return NULL;
10666 }
10667 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10668 Token * _literal;
10669 void *a;
10670 void *b;
10671 void *c;
10672 if (
10673 (a = expression_rule(p), 1) // expression?
10674 &&
10675 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
10676 &&
10677 (b = expression_rule(p), 1) // expression?
10678 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010679 (c = _tmp_96_rule(p), 1) // [':' expression?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010680 )
10681 {
10682 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10683 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10684 if (_token == NULL) {
10685 D(p->level--);
10686 return NULL;
10687 }
10688 int _end_lineno = _token->end_lineno;
10689 UNUSED(_end_lineno); // Only used by EXTRA macro
10690 int _end_col_offset = _token->end_col_offset;
10691 UNUSED(_end_col_offset); // Only used by EXTRA macro
10692 _res = _Py_Slice ( a , b , c , EXTRA );
10693 if (_res == NULL && PyErr_Occurred()) {
10694 p->error_indicator = 1;
10695 D(p->level--);
10696 return NULL;
10697 }
10698 goto done;
10699 }
10700 p->mark = _mark;
10701 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10702 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10703 }
10704 { // expression
10705 if (p->error_indicator) {
10706 D(p->level--);
10707 return NULL;
10708 }
10709 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
10710 expr_ty a;
10711 if (
10712 (a = expression_rule(p)) // expression
10713 )
10714 {
10715 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
10716 _res = a;
10717 if (_res == NULL && PyErr_Occurred()) {
10718 p->error_indicator = 1;
10719 D(p->level--);
10720 return NULL;
10721 }
10722 goto done;
10723 }
10724 p->mark = _mark;
10725 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10726 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
10727 }
10728 _res = NULL;
10729 done:
10730 D(p->level--);
10731 return _res;
10732}
10733
10734// atom:
10735// | NAME
10736// | 'True'
10737// | 'False'
10738// | 'None'
10739// | &STRING strings
10740// | NUMBER
10741// | &'(' (tuple | group | genexp)
10742// | &'[' (list | listcomp)
10743// | &'{' (dict | set | dictcomp | setcomp)
10744// | '...'
10745static expr_ty
10746atom_rule(Parser *p)
10747{
10748 D(p->level++);
10749 if (p->error_indicator) {
10750 D(p->level--);
10751 return NULL;
10752 }
10753 expr_ty _res = NULL;
10754 int _mark = p->mark;
10755 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10756 p->error_indicator = 1;
10757 D(p->level--);
10758 return NULL;
10759 }
10760 int _start_lineno = p->tokens[_mark]->lineno;
10761 UNUSED(_start_lineno); // Only used by EXTRA macro
10762 int _start_col_offset = p->tokens[_mark]->col_offset;
10763 UNUSED(_start_col_offset); // Only used by EXTRA macro
10764 { // NAME
10765 if (p->error_indicator) {
10766 D(p->level--);
10767 return NULL;
10768 }
10769 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
10770 expr_ty name_var;
10771 if (
10772 (name_var = _PyPegen_name_token(p)) // NAME
10773 )
10774 {
10775 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
10776 _res = name_var;
10777 goto done;
10778 }
10779 p->mark = _mark;
10780 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10781 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
10782 }
10783 { // 'True'
10784 if (p->error_indicator) {
10785 D(p->level--);
10786 return NULL;
10787 }
10788 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
10789 Token * _keyword;
10790 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010791 (_keyword = _PyPegen_expect_token(p, 528)) // token='True'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010792 )
10793 {
10794 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
10795 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10796 if (_token == NULL) {
10797 D(p->level--);
10798 return NULL;
10799 }
10800 int _end_lineno = _token->end_lineno;
10801 UNUSED(_end_lineno); // Only used by EXTRA macro
10802 int _end_col_offset = _token->end_col_offset;
10803 UNUSED(_end_col_offset); // Only used by EXTRA macro
10804 _res = _Py_Constant ( Py_True , NULL , EXTRA );
10805 if (_res == NULL && PyErr_Occurred()) {
10806 p->error_indicator = 1;
10807 D(p->level--);
10808 return NULL;
10809 }
10810 goto done;
10811 }
10812 p->mark = _mark;
10813 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10814 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
10815 }
10816 { // 'False'
10817 if (p->error_indicator) {
10818 D(p->level--);
10819 return NULL;
10820 }
10821 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
10822 Token * _keyword;
10823 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010824 (_keyword = _PyPegen_expect_token(p, 529)) // token='False'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010825 )
10826 {
10827 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
10828 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10829 if (_token == NULL) {
10830 D(p->level--);
10831 return NULL;
10832 }
10833 int _end_lineno = _token->end_lineno;
10834 UNUSED(_end_lineno); // Only used by EXTRA macro
10835 int _end_col_offset = _token->end_col_offset;
10836 UNUSED(_end_col_offset); // Only used by EXTRA macro
10837 _res = _Py_Constant ( Py_False , NULL , EXTRA );
10838 if (_res == NULL && PyErr_Occurred()) {
10839 p->error_indicator = 1;
10840 D(p->level--);
10841 return NULL;
10842 }
10843 goto done;
10844 }
10845 p->mark = _mark;
10846 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10847 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
10848 }
10849 { // 'None'
10850 if (p->error_indicator) {
10851 D(p->level--);
10852 return NULL;
10853 }
10854 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
10855 Token * _keyword;
10856 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010857 (_keyword = _PyPegen_expect_token(p, 530)) // token='None'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010858 )
10859 {
10860 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
10861 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10862 if (_token == NULL) {
10863 D(p->level--);
10864 return NULL;
10865 }
10866 int _end_lineno = _token->end_lineno;
10867 UNUSED(_end_lineno); // Only used by EXTRA macro
10868 int _end_col_offset = _token->end_col_offset;
10869 UNUSED(_end_col_offset); // Only used by EXTRA macro
10870 _res = _Py_Constant ( Py_None , NULL , EXTRA );
10871 if (_res == NULL && PyErr_Occurred()) {
10872 p->error_indicator = 1;
10873 D(p->level--);
10874 return NULL;
10875 }
10876 goto done;
10877 }
10878 p->mark = _mark;
10879 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10880 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
10881 }
10882 { // &STRING strings
10883 if (p->error_indicator) {
10884 D(p->level--);
10885 return NULL;
10886 }
10887 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10888 expr_ty strings_var;
10889 if (
10890 _PyPegen_lookahead(1, _PyPegen_string_token, p)
10891 &&
10892 (strings_var = strings_rule(p)) // strings
10893 )
10894 {
10895 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10896 _res = strings_var;
10897 goto done;
10898 }
10899 p->mark = _mark;
10900 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10901 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings"));
10902 }
10903 { // NUMBER
10904 if (p->error_indicator) {
10905 D(p->level--);
10906 return NULL;
10907 }
10908 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10909 expr_ty number_var;
10910 if (
10911 (number_var = _PyPegen_number_token(p)) // NUMBER
10912 )
10913 {
10914 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10915 _res = number_var;
10916 goto done;
10917 }
10918 p->mark = _mark;
10919 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10920 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
10921 }
10922 { // &'(' (tuple | group | genexp)
10923 if (p->error_indicator) {
10924 D(p->level--);
10925 return NULL;
10926 }
10927 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010928 void *_tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010929 if (
10930 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='('
10931 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010932 (_tmp_97_var = _tmp_97_rule(p)) // tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010933 )
10934 {
10935 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 +030010936 _res = _tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010937 goto done;
10938 }
10939 p->mark = _mark;
10940 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10941 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
10942 }
10943 { // &'[' (list | listcomp)
10944 if (p->error_indicator) {
10945 D(p->level--);
10946 return NULL;
10947 }
10948 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010949 void *_tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010950 if (
10951 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='['
10952 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010953 (_tmp_98_var = _tmp_98_rule(p)) // list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010954 )
10955 {
10956 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010957 _res = _tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010958 goto done;
10959 }
10960 p->mark = _mark;
10961 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10962 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
10963 }
10964 { // &'{' (dict | set | dictcomp | setcomp)
10965 if (p->error_indicator) {
10966 D(p->level--);
10967 return NULL;
10968 }
10969 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 +030010970 void *_tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010971 if (
10972 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{'
10973 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010974 (_tmp_99_var = _tmp_99_rule(p)) // dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010975 )
10976 {
10977 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 +030010978 _res = _tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010979 goto done;
10980 }
10981 p->mark = _mark;
10982 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10983 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
10984 }
10985 { // '...'
10986 if (p->error_indicator) {
10987 D(p->level--);
10988 return NULL;
10989 }
10990 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
10991 Token * _literal;
10992 if (
10993 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
10994 )
10995 {
10996 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
10997 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10998 if (_token == NULL) {
10999 D(p->level--);
11000 return NULL;
11001 }
11002 int _end_lineno = _token->end_lineno;
11003 UNUSED(_end_lineno); // Only used by EXTRA macro
11004 int _end_col_offset = _token->end_col_offset;
11005 UNUSED(_end_col_offset); // Only used by EXTRA macro
11006 _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
11007 if (_res == NULL && PyErr_Occurred()) {
11008 p->error_indicator = 1;
11009 D(p->level--);
11010 return NULL;
11011 }
11012 goto done;
11013 }
11014 p->mark = _mark;
11015 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
11016 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
11017 }
11018 _res = NULL;
11019 done:
11020 D(p->level--);
11021 return _res;
11022}
11023
11024// strings: STRING+
11025static expr_ty
11026strings_rule(Parser *p)
11027{
11028 D(p->level++);
11029 if (p->error_indicator) {
11030 D(p->level--);
11031 return NULL;
11032 }
11033 expr_ty _res = NULL;
11034 if (_PyPegen_is_memoized(p, strings_type, &_res)) {
11035 D(p->level--);
11036 return _res;
11037 }
11038 int _mark = p->mark;
11039 { // STRING+
11040 if (p->error_indicator) {
11041 D(p->level--);
11042 return NULL;
11043 }
11044 D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
11045 asdl_seq * a;
11046 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011047 (a = _loop1_100_rule(p)) // STRING+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011048 )
11049 {
11050 D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
11051 _res = _PyPegen_concatenate_strings ( p , a );
11052 if (_res == NULL && PyErr_Occurred()) {
11053 p->error_indicator = 1;
11054 D(p->level--);
11055 return NULL;
11056 }
11057 goto done;
11058 }
11059 p->mark = _mark;
11060 D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
11061 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
11062 }
11063 _res = NULL;
11064 done:
11065 _PyPegen_insert_memo(p, _mark, strings_type, _res);
11066 D(p->level--);
11067 return _res;
11068}
11069
11070// list: '[' star_named_expressions? ']'
11071static expr_ty
11072list_rule(Parser *p)
11073{
11074 D(p->level++);
11075 if (p->error_indicator) {
11076 D(p->level--);
11077 return NULL;
11078 }
11079 expr_ty _res = NULL;
11080 int _mark = p->mark;
11081 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11082 p->error_indicator = 1;
11083 D(p->level--);
11084 return NULL;
11085 }
11086 int _start_lineno = p->tokens[_mark]->lineno;
11087 UNUSED(_start_lineno); // Only used by EXTRA macro
11088 int _start_col_offset = p->tokens[_mark]->col_offset;
11089 UNUSED(_start_col_offset); // Only used by EXTRA macro
11090 { // '[' star_named_expressions? ']'
11091 if (p->error_indicator) {
11092 D(p->level--);
11093 return NULL;
11094 }
11095 D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11096 Token * _literal;
11097 Token * _literal_1;
11098 void *a;
11099 if (
11100 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11101 &&
11102 (a = star_named_expressions_rule(p), 1) // star_named_expressions?
11103 &&
11104 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11105 )
11106 {
11107 D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11108 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11109 if (_token == NULL) {
11110 D(p->level--);
11111 return NULL;
11112 }
11113 int _end_lineno = _token->end_lineno;
11114 UNUSED(_end_lineno); // Only used by EXTRA macro
11115 int _end_col_offset = _token->end_col_offset;
11116 UNUSED(_end_col_offset); // Only used by EXTRA macro
11117 _res = _Py_List ( a , Load , EXTRA );
11118 if (_res == NULL && PyErr_Occurred()) {
11119 p->error_indicator = 1;
11120 D(p->level--);
11121 return NULL;
11122 }
11123 goto done;
11124 }
11125 p->mark = _mark;
11126 D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
11127 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
11128 }
11129 _res = NULL;
11130 done:
11131 D(p->level--);
11132 return _res;
11133}
11134
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011135// listcomp: '[' named_expression ~ for_if_clauses ']' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011136static expr_ty
11137listcomp_rule(Parser *p)
11138{
11139 D(p->level++);
11140 if (p->error_indicator) {
11141 D(p->level--);
11142 return NULL;
11143 }
11144 expr_ty _res = NULL;
11145 int _mark = p->mark;
11146 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11147 p->error_indicator = 1;
11148 D(p->level--);
11149 return NULL;
11150 }
11151 int _start_lineno = p->tokens[_mark]->lineno;
11152 UNUSED(_start_lineno); // Only used by EXTRA macro
11153 int _start_col_offset = p->tokens[_mark]->col_offset;
11154 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011155 { // '[' named_expression ~ for_if_clauses ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011156 if (p->error_indicator) {
11157 D(p->level--);
11158 return NULL;
11159 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011160 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11161 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011162 Token * _literal;
11163 Token * _literal_1;
11164 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011165 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011166 if (
11167 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11168 &&
11169 (a = named_expression_rule(p)) // named_expression
11170 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011171 (_cut_var = 1)
11172 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011173 (b = for_if_clauses_rule(p)) // for_if_clauses
11174 &&
11175 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11176 )
11177 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011178 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 +010011179 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11180 if (_token == NULL) {
11181 D(p->level--);
11182 return NULL;
11183 }
11184 int _end_lineno = _token->end_lineno;
11185 UNUSED(_end_lineno); // Only used by EXTRA macro
11186 int _end_col_offset = _token->end_col_offset;
11187 UNUSED(_end_col_offset); // Only used by EXTRA macro
11188 _res = _Py_ListComp ( a , b , EXTRA );
11189 if (_res == NULL && PyErr_Occurred()) {
11190 p->error_indicator = 1;
11191 D(p->level--);
11192 return NULL;
11193 }
11194 goto done;
11195 }
11196 p->mark = _mark;
11197 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011198 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11199 if (_cut_var) {
11200 D(p->level--);
11201 return NULL;
11202 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011203 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011204 if (p->call_invalid_rules) { // invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011205 if (p->error_indicator) {
11206 D(p->level--);
11207 return NULL;
11208 }
11209 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11210 void *invalid_comprehension_var;
11211 if (
11212 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11213 )
11214 {
11215 D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11216 _res = invalid_comprehension_var;
11217 goto done;
11218 }
11219 p->mark = _mark;
11220 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
11221 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11222 }
11223 _res = NULL;
11224 done:
11225 D(p->level--);
11226 return _res;
11227}
11228
11229// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
11230static expr_ty
11231tuple_rule(Parser *p)
11232{
11233 D(p->level++);
11234 if (p->error_indicator) {
11235 D(p->level--);
11236 return NULL;
11237 }
11238 expr_ty _res = NULL;
11239 int _mark = p->mark;
11240 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11241 p->error_indicator = 1;
11242 D(p->level--);
11243 return NULL;
11244 }
11245 int _start_lineno = p->tokens[_mark]->lineno;
11246 UNUSED(_start_lineno); // Only used by EXTRA macro
11247 int _start_col_offset = p->tokens[_mark]->col_offset;
11248 UNUSED(_start_col_offset); // Only used by EXTRA macro
11249 { // '(' [star_named_expression ',' star_named_expressions?] ')'
11250 if (p->error_indicator) {
11251 D(p->level--);
11252 return NULL;
11253 }
11254 D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11255 Token * _literal;
11256 Token * _literal_1;
11257 void *a;
11258 if (
11259 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11260 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011261 (a = _tmp_101_rule(p), 1) // [star_named_expression ',' star_named_expressions?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011262 &&
11263 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11264 )
11265 {
11266 D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11267 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11268 if (_token == NULL) {
11269 D(p->level--);
11270 return NULL;
11271 }
11272 int _end_lineno = _token->end_lineno;
11273 UNUSED(_end_lineno); // Only used by EXTRA macro
11274 int _end_col_offset = _token->end_col_offset;
11275 UNUSED(_end_col_offset); // Only used by EXTRA macro
11276 _res = _Py_Tuple ( a , Load , EXTRA );
11277 if (_res == NULL && PyErr_Occurred()) {
11278 p->error_indicator = 1;
11279 D(p->level--);
11280 return NULL;
11281 }
11282 goto done;
11283 }
11284 p->mark = _mark;
11285 D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
11286 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11287 }
11288 _res = NULL;
11289 done:
11290 D(p->level--);
11291 return _res;
11292}
11293
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011294// group: '(' (yield_expr | named_expression) ')' | invalid_group
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011295static expr_ty
11296group_rule(Parser *p)
11297{
11298 D(p->level++);
11299 if (p->error_indicator) {
11300 D(p->level--);
11301 return NULL;
11302 }
11303 expr_ty _res = NULL;
11304 int _mark = p->mark;
11305 { // '(' (yield_expr | named_expression) ')'
11306 if (p->error_indicator) {
11307 D(p->level--);
11308 return NULL;
11309 }
11310 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11311 Token * _literal;
11312 Token * _literal_1;
11313 void *a;
11314 if (
11315 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11316 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011317 (a = _tmp_102_rule(p)) // yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011318 &&
11319 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11320 )
11321 {
11322 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11323 _res = a;
11324 if (_res == NULL && PyErr_Occurred()) {
11325 p->error_indicator = 1;
11326 D(p->level--);
11327 return NULL;
11328 }
11329 goto done;
11330 }
11331 p->mark = _mark;
11332 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11333 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11334 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011335 if (p->call_invalid_rules) { // invalid_group
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011336 if (p->error_indicator) {
11337 D(p->level--);
11338 return NULL;
11339 }
11340 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11341 void *invalid_group_var;
11342 if (
11343 (invalid_group_var = invalid_group_rule(p)) // invalid_group
11344 )
11345 {
11346 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11347 _res = invalid_group_var;
11348 goto done;
11349 }
11350 p->mark = _mark;
11351 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11352 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
11353 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011354 _res = NULL;
11355 done:
11356 D(p->level--);
11357 return _res;
11358}
11359
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011360// genexp: '(' expression ~ for_if_clauses ')' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011361static expr_ty
11362genexp_rule(Parser *p)
11363{
11364 D(p->level++);
11365 if (p->error_indicator) {
11366 D(p->level--);
11367 return NULL;
11368 }
11369 expr_ty _res = NULL;
11370 int _mark = p->mark;
11371 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11372 p->error_indicator = 1;
11373 D(p->level--);
11374 return NULL;
11375 }
11376 int _start_lineno = p->tokens[_mark]->lineno;
11377 UNUSED(_start_lineno); // Only used by EXTRA macro
11378 int _start_col_offset = p->tokens[_mark]->col_offset;
11379 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011380 { // '(' expression ~ for_if_clauses ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011381 if (p->error_indicator) {
11382 D(p->level--);
11383 return NULL;
11384 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011385 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11386 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011387 Token * _literal;
11388 Token * _literal_1;
11389 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011390 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011391 if (
11392 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11393 &&
11394 (a = expression_rule(p)) // expression
11395 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011396 (_cut_var = 1)
11397 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011398 (b = for_if_clauses_rule(p)) // for_if_clauses
11399 &&
11400 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11401 )
11402 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011403 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 +010011404 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11405 if (_token == NULL) {
11406 D(p->level--);
11407 return NULL;
11408 }
11409 int _end_lineno = _token->end_lineno;
11410 UNUSED(_end_lineno); // Only used by EXTRA macro
11411 int _end_col_offset = _token->end_col_offset;
11412 UNUSED(_end_col_offset); // Only used by EXTRA macro
11413 _res = _Py_GeneratorExp ( a , b , EXTRA );
11414 if (_res == NULL && PyErr_Occurred()) {
11415 p->error_indicator = 1;
11416 D(p->level--);
11417 return NULL;
11418 }
11419 goto done;
11420 }
11421 p->mark = _mark;
11422 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011423 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11424 if (_cut_var) {
11425 D(p->level--);
11426 return NULL;
11427 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011428 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011429 if (p->call_invalid_rules) { // invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011430 if (p->error_indicator) {
11431 D(p->level--);
11432 return NULL;
11433 }
11434 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11435 void *invalid_comprehension_var;
11436 if (
11437 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11438 )
11439 {
11440 D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11441 _res = invalid_comprehension_var;
11442 goto done;
11443 }
11444 p->mark = _mark;
11445 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
11446 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11447 }
11448 _res = NULL;
11449 done:
11450 D(p->level--);
11451 return _res;
11452}
11453
11454// set: '{' expressions_list '}'
11455static expr_ty
11456set_rule(Parser *p)
11457{
11458 D(p->level++);
11459 if (p->error_indicator) {
11460 D(p->level--);
11461 return NULL;
11462 }
11463 expr_ty _res = NULL;
11464 int _mark = p->mark;
11465 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11466 p->error_indicator = 1;
11467 D(p->level--);
11468 return NULL;
11469 }
11470 int _start_lineno = p->tokens[_mark]->lineno;
11471 UNUSED(_start_lineno); // Only used by EXTRA macro
11472 int _start_col_offset = p->tokens[_mark]->col_offset;
11473 UNUSED(_start_col_offset); // Only used by EXTRA macro
11474 { // '{' expressions_list '}'
11475 if (p->error_indicator) {
11476 D(p->level--);
11477 return NULL;
11478 }
11479 D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11480 Token * _literal;
11481 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011482 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011483 if (
11484 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11485 &&
11486 (a = expressions_list_rule(p)) // expressions_list
11487 &&
11488 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11489 )
11490 {
11491 D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11492 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11493 if (_token == NULL) {
11494 D(p->level--);
11495 return NULL;
11496 }
11497 int _end_lineno = _token->end_lineno;
11498 UNUSED(_end_lineno); // Only used by EXTRA macro
11499 int _end_col_offset = _token->end_col_offset;
11500 UNUSED(_end_col_offset); // Only used by EXTRA macro
11501 _res = _Py_Set ( a , EXTRA );
11502 if (_res == NULL && PyErr_Occurred()) {
11503 p->error_indicator = 1;
11504 D(p->level--);
11505 return NULL;
11506 }
11507 goto done;
11508 }
11509 p->mark = _mark;
11510 D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
11511 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'"));
11512 }
11513 _res = NULL;
11514 done:
11515 D(p->level--);
11516 return _res;
11517}
11518
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011519// setcomp: '{' expression ~ for_if_clauses '}' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011520static expr_ty
11521setcomp_rule(Parser *p)
11522{
11523 D(p->level++);
11524 if (p->error_indicator) {
11525 D(p->level--);
11526 return NULL;
11527 }
11528 expr_ty _res = NULL;
11529 int _mark = p->mark;
11530 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11531 p->error_indicator = 1;
11532 D(p->level--);
11533 return NULL;
11534 }
11535 int _start_lineno = p->tokens[_mark]->lineno;
11536 UNUSED(_start_lineno); // Only used by EXTRA macro
11537 int _start_col_offset = p->tokens[_mark]->col_offset;
11538 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011539 { // '{' expression ~ for_if_clauses '}'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011540 if (p->error_indicator) {
11541 D(p->level--);
11542 return NULL;
11543 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011544 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11545 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011546 Token * _literal;
11547 Token * _literal_1;
11548 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011549 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011550 if (
11551 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11552 &&
11553 (a = expression_rule(p)) // expression
11554 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011555 (_cut_var = 1)
11556 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011557 (b = for_if_clauses_rule(p)) // for_if_clauses
11558 &&
11559 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11560 )
11561 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011562 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 +010011563 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11564 if (_token == NULL) {
11565 D(p->level--);
11566 return NULL;
11567 }
11568 int _end_lineno = _token->end_lineno;
11569 UNUSED(_end_lineno); // Only used by EXTRA macro
11570 int _end_col_offset = _token->end_col_offset;
11571 UNUSED(_end_col_offset); // Only used by EXTRA macro
11572 _res = _Py_SetComp ( a , b , EXTRA );
11573 if (_res == NULL && PyErr_Occurred()) {
11574 p->error_indicator = 1;
11575 D(p->level--);
11576 return NULL;
11577 }
11578 goto done;
11579 }
11580 p->mark = _mark;
11581 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011582 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11583 if (_cut_var) {
11584 D(p->level--);
11585 return NULL;
11586 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011587 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011588 if (p->call_invalid_rules) { // invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011589 if (p->error_indicator) {
11590 D(p->level--);
11591 return NULL;
11592 }
11593 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11594 void *invalid_comprehension_var;
11595 if (
11596 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11597 )
11598 {
11599 D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11600 _res = invalid_comprehension_var;
11601 goto done;
11602 }
11603 p->mark = _mark;
11604 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
11605 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11606 }
11607 _res = NULL;
11608 done:
11609 D(p->level--);
11610 return _res;
11611}
11612
11613// dict: '{' double_starred_kvpairs? '}'
11614static expr_ty
11615dict_rule(Parser *p)
11616{
11617 D(p->level++);
11618 if (p->error_indicator) {
11619 D(p->level--);
11620 return NULL;
11621 }
11622 expr_ty _res = NULL;
11623 int _mark = p->mark;
11624 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11625 p->error_indicator = 1;
11626 D(p->level--);
11627 return NULL;
11628 }
11629 int _start_lineno = p->tokens[_mark]->lineno;
11630 UNUSED(_start_lineno); // Only used by EXTRA macro
11631 int _start_col_offset = p->tokens[_mark]->col_offset;
11632 UNUSED(_start_col_offset); // Only used by EXTRA macro
11633 { // '{' double_starred_kvpairs? '}'
11634 if (p->error_indicator) {
11635 D(p->level--);
11636 return NULL;
11637 }
11638 D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11639 Token * _literal;
11640 Token * _literal_1;
11641 void *a;
11642 if (
11643 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11644 &&
11645 (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs?
11646 &&
11647 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11648 )
11649 {
11650 D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11651 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11652 if (_token == NULL) {
11653 D(p->level--);
11654 return NULL;
11655 }
11656 int _end_lineno = _token->end_lineno;
11657 UNUSED(_end_lineno); // Only used by EXTRA macro
11658 int _end_col_offset = _token->end_col_offset;
11659 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030011660 _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 +010011661 if (_res == NULL && PyErr_Occurred()) {
11662 p->error_indicator = 1;
11663 D(p->level--);
11664 return NULL;
11665 }
11666 goto done;
11667 }
11668 p->mark = _mark;
11669 D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
11670 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11671 }
11672 _res = NULL;
11673 done:
11674 D(p->level--);
11675 return _res;
11676}
11677
11678// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
11679static expr_ty
11680dictcomp_rule(Parser *p)
11681{
11682 D(p->level++);
11683 if (p->error_indicator) {
11684 D(p->level--);
11685 return NULL;
11686 }
11687 expr_ty _res = NULL;
11688 int _mark = p->mark;
11689 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11690 p->error_indicator = 1;
11691 D(p->level--);
11692 return NULL;
11693 }
11694 int _start_lineno = p->tokens[_mark]->lineno;
11695 UNUSED(_start_lineno); // Only used by EXTRA macro
11696 int _start_col_offset = p->tokens[_mark]->col_offset;
11697 UNUSED(_start_col_offset); // Only used by EXTRA macro
11698 { // '{' kvpair for_if_clauses '}'
11699 if (p->error_indicator) {
11700 D(p->level--);
11701 return NULL;
11702 }
11703 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11704 Token * _literal;
11705 Token * _literal_1;
11706 KeyValuePair* a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011707 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011708 if (
11709 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11710 &&
11711 (a = kvpair_rule(p)) // kvpair
11712 &&
11713 (b = for_if_clauses_rule(p)) // for_if_clauses
11714 &&
11715 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11716 )
11717 {
11718 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11719 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11720 if (_token == NULL) {
11721 D(p->level--);
11722 return NULL;
11723 }
11724 int _end_lineno = _token->end_lineno;
11725 UNUSED(_end_lineno); // Only used by EXTRA macro
11726 int _end_col_offset = _token->end_col_offset;
11727 UNUSED(_end_col_offset); // Only used by EXTRA macro
11728 _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
11729 if (_res == NULL && PyErr_Occurred()) {
11730 p->error_indicator = 1;
11731 D(p->level--);
11732 return NULL;
11733 }
11734 goto done;
11735 }
11736 p->mark = _mark;
11737 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11738 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11739 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011740 if (p->call_invalid_rules) { // invalid_dict_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011741 if (p->error_indicator) {
11742 D(p->level--);
11743 return NULL;
11744 }
11745 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11746 void *invalid_dict_comprehension_var;
11747 if (
11748 (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
11749 )
11750 {
11751 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11752 _res = invalid_dict_comprehension_var;
11753 goto done;
11754 }
11755 p->mark = _mark;
11756 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11757 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
11758 }
11759 _res = NULL;
11760 done:
11761 D(p->level--);
11762 return _res;
11763}
11764
11765// double_starred_kvpairs: ','.double_starred_kvpair+ ','?
11766static asdl_seq*
11767double_starred_kvpairs_rule(Parser *p)
11768{
11769 D(p->level++);
11770 if (p->error_indicator) {
11771 D(p->level--);
11772 return NULL;
11773 }
11774 asdl_seq* _res = NULL;
11775 int _mark = p->mark;
11776 { // ','.double_starred_kvpair+ ','?
11777 if (p->error_indicator) {
11778 D(p->level--);
11779 return NULL;
11780 }
11781 D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11782 void *_opt_var;
11783 UNUSED(_opt_var); // Silence compiler warnings
11784 asdl_seq * a;
11785 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011786 (a = _gather_103_rule(p)) // ','.double_starred_kvpair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011787 &&
11788 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
11789 )
11790 {
11791 D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11792 _res = a;
11793 if (_res == NULL && PyErr_Occurred()) {
11794 p->error_indicator = 1;
11795 D(p->level--);
11796 return NULL;
11797 }
11798 goto done;
11799 }
11800 p->mark = _mark;
11801 D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
11802 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11803 }
11804 _res = NULL;
11805 done:
11806 D(p->level--);
11807 return _res;
11808}
11809
11810// double_starred_kvpair: '**' bitwise_or | kvpair
11811static KeyValuePair*
11812double_starred_kvpair_rule(Parser *p)
11813{
11814 D(p->level++);
11815 if (p->error_indicator) {
11816 D(p->level--);
11817 return NULL;
11818 }
11819 KeyValuePair* _res = NULL;
11820 int _mark = p->mark;
11821 { // '**' bitwise_or
11822 if (p->error_indicator) {
11823 D(p->level--);
11824 return NULL;
11825 }
11826 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11827 Token * _literal;
11828 expr_ty a;
11829 if (
11830 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
11831 &&
11832 (a = bitwise_or_rule(p)) // bitwise_or
11833 )
11834 {
11835 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11836 _res = _PyPegen_key_value_pair ( p , NULL , a );
11837 if (_res == NULL && PyErr_Occurred()) {
11838 p->error_indicator = 1;
11839 D(p->level--);
11840 return NULL;
11841 }
11842 goto done;
11843 }
11844 p->mark = _mark;
11845 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11846 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
11847 }
11848 { // kvpair
11849 if (p->error_indicator) {
11850 D(p->level--);
11851 return NULL;
11852 }
11853 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
11854 KeyValuePair* kvpair_var;
11855 if (
11856 (kvpair_var = kvpair_rule(p)) // kvpair
11857 )
11858 {
11859 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
11860 _res = kvpair_var;
11861 goto done;
11862 }
11863 p->mark = _mark;
11864 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11865 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
11866 }
11867 _res = NULL;
11868 done:
11869 D(p->level--);
11870 return _res;
11871}
11872
11873// kvpair: expression ':' expression
11874static KeyValuePair*
11875kvpair_rule(Parser *p)
11876{
11877 D(p->level++);
11878 if (p->error_indicator) {
11879 D(p->level--);
11880 return NULL;
11881 }
11882 KeyValuePair* _res = NULL;
11883 int _mark = p->mark;
11884 { // expression ':' expression
11885 if (p->error_indicator) {
11886 D(p->level--);
11887 return NULL;
11888 }
11889 D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11890 Token * _literal;
11891 expr_ty a;
11892 expr_ty b;
11893 if (
11894 (a = expression_rule(p)) // expression
11895 &&
11896 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
11897 &&
11898 (b = expression_rule(p)) // expression
11899 )
11900 {
11901 D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11902 _res = _PyPegen_key_value_pair ( p , a , b );
11903 if (_res == NULL && PyErr_Occurred()) {
11904 p->error_indicator = 1;
11905 D(p->level--);
11906 return NULL;
11907 }
11908 goto done;
11909 }
11910 p->mark = _mark;
11911 D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11912 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
11913 }
11914 _res = NULL;
11915 done:
11916 D(p->level--);
11917 return _res;
11918}
11919
11920// for_if_clauses: for_if_clause+
Pablo Galindoa5634c42020-09-16 19:42:00 +010011921static asdl_comprehension_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011922for_if_clauses_rule(Parser *p)
11923{
11924 D(p->level++);
11925 if (p->error_indicator) {
11926 D(p->level--);
11927 return NULL;
11928 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010011929 asdl_comprehension_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011930 int _mark = p->mark;
11931 { // for_if_clause+
11932 if (p->error_indicator) {
11933 D(p->level--);
11934 return NULL;
11935 }
11936 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 +010011937 asdl_comprehension_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011938 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010011939 (a = (asdl_comprehension_seq*)_loop1_105_rule(p)) // for_if_clause+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011940 )
11941 {
11942 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 +010011943 _res = a;
11944 if (_res == NULL && PyErr_Occurred()) {
11945 p->error_indicator = 1;
11946 D(p->level--);
11947 return NULL;
11948 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011949 goto done;
11950 }
11951 p->mark = _mark;
11952 D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
11953 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
11954 }
11955 _res = NULL;
11956 done:
11957 D(p->level--);
11958 return _res;
11959}
11960
11961// for_if_clause:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011962// | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11963// | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11964// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011965static comprehension_ty
11966for_if_clause_rule(Parser *p)
11967{
11968 D(p->level++);
11969 if (p->error_indicator) {
11970 D(p->level--);
11971 return NULL;
11972 }
11973 comprehension_ty _res = NULL;
11974 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011975 { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011976 if (p->error_indicator) {
11977 D(p->level--);
11978 return NULL;
11979 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011980 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11981 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011982 Token * _keyword;
11983 Token * _keyword_1;
11984 expr_ty a;
11985 Token * async_var;
11986 expr_ty b;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011987 asdl_expr_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011988 if (
11989 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
11990 &&
11991 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11992 &&
11993 (a = star_targets_rule(p)) // star_targets
11994 &&
11995 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11996 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011997 (_cut_var = 1)
11998 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011999 (b = disjunction_rule(p)) // disjunction
12000 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +010012001 (c = (asdl_expr_seq*)_loop0_106_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012002 )
12003 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012004 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 +030012005 _res = CHECK_VERSION ( comprehension_ty , 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012006 if (_res == NULL && PyErr_Occurred()) {
12007 p->error_indicator = 1;
12008 D(p->level--);
12009 return NULL;
12010 }
12011 goto done;
12012 }
12013 p->mark = _mark;
12014 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012015 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
12016 if (_cut_var) {
12017 D(p->level--);
12018 return NULL;
12019 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012020 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012021 { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012022 if (p->error_indicator) {
12023 D(p->level--);
12024 return NULL;
12025 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012026 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
12027 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012028 Token * _keyword;
12029 Token * _keyword_1;
12030 expr_ty a;
12031 expr_ty b;
Pablo Galindoa5634c42020-09-16 19:42:00 +010012032 asdl_expr_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012033 if (
12034 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
12035 &&
12036 (a = star_targets_rule(p)) // star_targets
12037 &&
12038 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
12039 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012040 (_cut_var = 1)
12041 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012042 (b = disjunction_rule(p)) // disjunction
12043 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +010012044 (c = (asdl_expr_seq*)_loop0_107_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012045 )
12046 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012047 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 +010012048 _res = _Py_comprehension ( a , b , c , 0 , p -> arena );
12049 if (_res == NULL && PyErr_Occurred()) {
12050 p->error_indicator = 1;
12051 D(p->level--);
12052 return NULL;
12053 }
12054 goto done;
12055 }
12056 p->mark = _mark;
12057 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012058 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
12059 if (_cut_var) {
12060 D(p->level--);
12061 return NULL;
12062 }
12063 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012064 if (p->call_invalid_rules) { // invalid_for_target
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012065 if (p->error_indicator) {
12066 D(p->level--);
12067 return NULL;
12068 }
12069 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12070 void *invalid_for_target_var;
12071 if (
12072 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
12073 )
12074 {
12075 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12076 _res = invalid_for_target_var;
12077 goto done;
12078 }
12079 p->mark = _mark;
12080 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
12081 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012082 }
12083 _res = NULL;
12084 done:
12085 D(p->level--);
12086 return _res;
12087}
12088
12089// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
12090static expr_ty
12091yield_expr_rule(Parser *p)
12092{
12093 D(p->level++);
12094 if (p->error_indicator) {
12095 D(p->level--);
12096 return NULL;
12097 }
12098 expr_ty _res = NULL;
12099 int _mark = p->mark;
12100 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12101 p->error_indicator = 1;
12102 D(p->level--);
12103 return NULL;
12104 }
12105 int _start_lineno = p->tokens[_mark]->lineno;
12106 UNUSED(_start_lineno); // Only used by EXTRA macro
12107 int _start_col_offset = p->tokens[_mark]->col_offset;
12108 UNUSED(_start_col_offset); // Only used by EXTRA macro
12109 { // 'yield' 'from' expression
12110 if (p->error_indicator) {
12111 D(p->level--);
12112 return NULL;
12113 }
12114 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12115 Token * _keyword;
12116 Token * _keyword_1;
12117 expr_ty a;
12118 if (
12119 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12120 &&
12121 (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from'
12122 &&
12123 (a = expression_rule(p)) // expression
12124 )
12125 {
12126 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12127 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12128 if (_token == NULL) {
12129 D(p->level--);
12130 return NULL;
12131 }
12132 int _end_lineno = _token->end_lineno;
12133 UNUSED(_end_lineno); // Only used by EXTRA macro
12134 int _end_col_offset = _token->end_col_offset;
12135 UNUSED(_end_col_offset); // Only used by EXTRA macro
12136 _res = _Py_YieldFrom ( a , EXTRA );
12137 if (_res == NULL && PyErr_Occurred()) {
12138 p->error_indicator = 1;
12139 D(p->level--);
12140 return NULL;
12141 }
12142 goto done;
12143 }
12144 p->mark = _mark;
12145 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12146 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
12147 }
12148 { // 'yield' star_expressions?
12149 if (p->error_indicator) {
12150 D(p->level--);
12151 return NULL;
12152 }
12153 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12154 Token * _keyword;
12155 void *a;
12156 if (
12157 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12158 &&
12159 (a = star_expressions_rule(p), 1) // star_expressions?
12160 )
12161 {
12162 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12163 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12164 if (_token == NULL) {
12165 D(p->level--);
12166 return NULL;
12167 }
12168 int _end_lineno = _token->end_lineno;
12169 UNUSED(_end_lineno); // Only used by EXTRA macro
12170 int _end_col_offset = _token->end_col_offset;
12171 UNUSED(_end_col_offset); // Only used by EXTRA macro
12172 _res = _Py_Yield ( a , EXTRA );
12173 if (_res == NULL && PyErr_Occurred()) {
12174 p->error_indicator = 1;
12175 D(p->level--);
12176 return NULL;
12177 }
12178 goto done;
12179 }
12180 p->mark = _mark;
12181 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12182 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
12183 }
12184 _res = NULL;
12185 done:
12186 D(p->level--);
12187 return _res;
12188}
12189
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012190// arguments: args ','? &')' | invalid_arguments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012191static expr_ty
12192arguments_rule(Parser *p)
12193{
12194 D(p->level++);
12195 if (p->error_indicator) {
12196 D(p->level--);
12197 return NULL;
12198 }
12199 expr_ty _res = NULL;
12200 if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
12201 D(p->level--);
12202 return _res;
12203 }
12204 int _mark = p->mark;
12205 { // args ','? &')'
12206 if (p->error_indicator) {
12207 D(p->level--);
12208 return NULL;
12209 }
12210 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12211 void *_opt_var;
12212 UNUSED(_opt_var); // Silence compiler warnings
12213 expr_ty a;
12214 if (
12215 (a = args_rule(p)) // args
12216 &&
12217 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12218 &&
12219 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
12220 )
12221 {
12222 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12223 _res = a;
12224 if (_res == NULL && PyErr_Occurred()) {
12225 p->error_indicator = 1;
12226 D(p->level--);
12227 return NULL;
12228 }
12229 goto done;
12230 }
12231 p->mark = _mark;
12232 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12233 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
12234 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012235 if (p->call_invalid_rules) { // invalid_arguments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012236 if (p->error_indicator) {
12237 D(p->level--);
12238 return NULL;
12239 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012240 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
12241 void *invalid_arguments_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012242 if (
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012243 (invalid_arguments_var = invalid_arguments_rule(p)) // invalid_arguments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012244 )
12245 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012246 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
12247 _res = invalid_arguments_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012248 goto done;
12249 }
12250 p->mark = _mark;
12251 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012252 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arguments"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012253 }
12254 _res = NULL;
12255 done:
12256 _PyPegen_insert_memo(p, _mark, arguments_type, _res);
12257 D(p->level--);
12258 return _res;
12259}
12260
Pablo Galindo4a97b152020-09-02 17:44:19 +010012261// args: ','.(starred_expression | named_expression !'=')+ [',' kwargs] | kwargs
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012262static expr_ty
12263args_rule(Parser *p)
12264{
12265 D(p->level++);
12266 if (p->error_indicator) {
12267 D(p->level--);
12268 return NULL;
12269 }
12270 expr_ty _res = NULL;
12271 int _mark = p->mark;
12272 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12273 p->error_indicator = 1;
12274 D(p->level--);
12275 return NULL;
12276 }
12277 int _start_lineno = p->tokens[_mark]->lineno;
12278 UNUSED(_start_lineno); // Only used by EXTRA macro
12279 int _start_col_offset = p->tokens[_mark]->col_offset;
12280 UNUSED(_start_col_offset); // Only used by EXTRA macro
Pablo Galindo4a97b152020-09-02 17:44:19 +010012281 { // ','.(starred_expression | named_expression !'=')+ [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012282 if (p->error_indicator) {
12283 D(p->level--);
12284 return NULL;
12285 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010012286 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 +010012287 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012288 void *b;
12289 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010012290 (a = (asdl_expr_seq*)_gather_108_rule(p)) // ','.(starred_expression | named_expression !'=')+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012291 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012292 (b = _tmp_110_rule(p), 1) // [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012293 )
12294 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010012295 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 +010012296 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12297 if (_token == NULL) {
12298 D(p->level--);
12299 return NULL;
12300 }
12301 int _end_lineno = _token->end_lineno;
12302 UNUSED(_end_lineno); // Only used by EXTRA macro
12303 int _end_col_offset = _token->end_col_offset;
12304 UNUSED(_end_col_offset); // Only used by EXTRA macro
12305 _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012306 if (_res == NULL && PyErr_Occurred()) {
12307 p->error_indicator = 1;
12308 D(p->level--);
12309 return NULL;
12310 }
12311 goto done;
12312 }
12313 p->mark = _mark;
12314 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010012315 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012316 }
12317 { // kwargs
12318 if (p->error_indicator) {
12319 D(p->level--);
12320 return NULL;
12321 }
12322 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
12323 asdl_seq* a;
12324 if (
12325 (a = kwargs_rule(p)) // kwargs
12326 )
12327 {
12328 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
12329 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12330 if (_token == NULL) {
12331 D(p->level--);
12332 return NULL;
12333 }
12334 int _end_lineno = _token->end_lineno;
12335 UNUSED(_end_lineno); // Only used by EXTRA macro
12336 int _end_col_offset = _token->end_col_offset;
12337 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012338 _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 +010012339 if (_res == NULL && PyErr_Occurred()) {
12340 p->error_indicator = 1;
12341 D(p->level--);
12342 return NULL;
12343 }
12344 goto done;
12345 }
12346 p->mark = _mark;
12347 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12348 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
12349 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012350 _res = NULL;
12351 done:
12352 D(p->level--);
12353 return _res;
12354}
12355
12356// kwargs:
12357// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12358// | ','.kwarg_or_starred+
12359// | ','.kwarg_or_double_starred+
12360static asdl_seq*
12361kwargs_rule(Parser *p)
12362{
12363 D(p->level++);
12364 if (p->error_indicator) {
12365 D(p->level--);
12366 return NULL;
12367 }
12368 asdl_seq* _res = NULL;
12369 int _mark = p->mark;
12370 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12371 if (p->error_indicator) {
12372 D(p->level--);
12373 return NULL;
12374 }
12375 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12376 Token * _literal;
12377 asdl_seq * a;
12378 asdl_seq * b;
12379 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012380 (a = _gather_111_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012381 &&
12382 (_literal = _PyPegen_expect_token(p, 12)) // token=','
12383 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012384 (b = _gather_113_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012385 )
12386 {
12387 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12388 _res = _PyPegen_join_sequences ( p , a , b );
12389 if (_res == NULL && PyErr_Occurred()) {
12390 p->error_indicator = 1;
12391 D(p->level--);
12392 return NULL;
12393 }
12394 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_starred+ ',' ','.kwarg_or_double_starred+"));
12399 }
12400 { // ','.kwarg_or_starred+
12401 if (p->error_indicator) {
12402 D(p->level--);
12403 return NULL;
12404 }
12405 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012406 asdl_seq * _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012407 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012408 (_gather_115_var = _gather_115_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012409 )
12410 {
12411 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 +010012412 _res = _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012413 goto done;
12414 }
12415 p->mark = _mark;
12416 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12417 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
12418 }
12419 { // ','.kwarg_or_double_starred+
12420 if (p->error_indicator) {
12421 D(p->level--);
12422 return NULL;
12423 }
12424 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 +010012425 asdl_seq * _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012426 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012427 (_gather_117_var = _gather_117_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012428 )
12429 {
12430 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 +010012431 _res = _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012432 goto done;
12433 }
12434 p->mark = _mark;
12435 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12436 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
12437 }
12438 _res = NULL;
12439 done:
12440 D(p->level--);
12441 return _res;
12442}
12443
12444// starred_expression: '*' expression
12445static expr_ty
12446starred_expression_rule(Parser *p)
12447{
12448 D(p->level++);
12449 if (p->error_indicator) {
12450 D(p->level--);
12451 return NULL;
12452 }
12453 expr_ty _res = NULL;
12454 int _mark = p->mark;
12455 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12456 p->error_indicator = 1;
12457 D(p->level--);
12458 return NULL;
12459 }
12460 int _start_lineno = p->tokens[_mark]->lineno;
12461 UNUSED(_start_lineno); // Only used by EXTRA macro
12462 int _start_col_offset = p->tokens[_mark]->col_offset;
12463 UNUSED(_start_col_offset); // Only used by EXTRA macro
12464 { // '*' expression
12465 if (p->error_indicator) {
12466 D(p->level--);
12467 return NULL;
12468 }
12469 D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12470 Token * _literal;
12471 expr_ty a;
12472 if (
12473 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12474 &&
12475 (a = expression_rule(p)) // expression
12476 )
12477 {
12478 D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12479 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12480 if (_token == NULL) {
12481 D(p->level--);
12482 return NULL;
12483 }
12484 int _end_lineno = _token->end_lineno;
12485 UNUSED(_end_lineno); // Only used by EXTRA macro
12486 int _end_col_offset = _token->end_col_offset;
12487 UNUSED(_end_col_offset); // Only used by EXTRA macro
12488 _res = _Py_Starred ( a , Load , EXTRA );
12489 if (_res == NULL && PyErr_Occurred()) {
12490 p->error_indicator = 1;
12491 D(p->level--);
12492 return NULL;
12493 }
12494 goto done;
12495 }
12496 p->mark = _mark;
12497 D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
12498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
12499 }
12500 _res = NULL;
12501 done:
12502 D(p->level--);
12503 return _res;
12504}
12505
12506// kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg
12507static KeywordOrStarred*
12508kwarg_or_starred_rule(Parser *p)
12509{
12510 D(p->level++);
12511 if (p->error_indicator) {
12512 D(p->level--);
12513 return NULL;
12514 }
12515 KeywordOrStarred* _res = NULL;
12516 int _mark = p->mark;
12517 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12518 p->error_indicator = 1;
12519 D(p->level--);
12520 return NULL;
12521 }
12522 int _start_lineno = p->tokens[_mark]->lineno;
12523 UNUSED(_start_lineno); // Only used by EXTRA macro
12524 int _start_col_offset = p->tokens[_mark]->col_offset;
12525 UNUSED(_start_col_offset); // Only used by EXTRA macro
12526 { // NAME '=' expression
12527 if (p->error_indicator) {
12528 D(p->level--);
12529 return NULL;
12530 }
12531 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12532 Token * _literal;
12533 expr_ty a;
12534 expr_ty b;
12535 if (
12536 (a = _PyPegen_name_token(p)) // NAME
12537 &&
12538 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12539 &&
12540 (b = expression_rule(p)) // expression
12541 )
12542 {
12543 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12544 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12545 if (_token == NULL) {
12546 D(p->level--);
12547 return NULL;
12548 }
12549 int _end_lineno = _token->end_lineno;
12550 UNUSED(_end_lineno); // Only used by EXTRA macro
12551 int _end_col_offset = _token->end_col_offset;
12552 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012553 _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 +010012554 if (_res == NULL && PyErr_Occurred()) {
12555 p->error_indicator = 1;
12556 D(p->level--);
12557 return NULL;
12558 }
12559 goto done;
12560 }
12561 p->mark = _mark;
12562 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12563 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12564 }
12565 { // starred_expression
12566 if (p->error_indicator) {
12567 D(p->level--);
12568 return NULL;
12569 }
12570 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12571 expr_ty a;
12572 if (
12573 (a = starred_expression_rule(p)) // starred_expression
12574 )
12575 {
12576 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12577 _res = _PyPegen_keyword_or_starred ( p , a , 0 );
12578 if (_res == NULL && PyErr_Occurred()) {
12579 p->error_indicator = 1;
12580 D(p->level--);
12581 return NULL;
12582 }
12583 goto done;
12584 }
12585 p->mark = _mark;
12586 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12587 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
12588 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012589 if (p->call_invalid_rules) { // invalid_kwarg
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012590 if (p->error_indicator) {
12591 D(p->level--);
12592 return NULL;
12593 }
12594 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12595 void *invalid_kwarg_var;
12596 if (
12597 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12598 )
12599 {
12600 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12601 _res = invalid_kwarg_var;
12602 goto done;
12603 }
12604 p->mark = _mark;
12605 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12606 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12607 }
12608 _res = NULL;
12609 done:
12610 D(p->level--);
12611 return _res;
12612}
12613
12614// kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg
12615static KeywordOrStarred*
12616kwarg_or_double_starred_rule(Parser *p)
12617{
12618 D(p->level++);
12619 if (p->error_indicator) {
12620 D(p->level--);
12621 return NULL;
12622 }
12623 KeywordOrStarred* _res = NULL;
12624 int _mark = p->mark;
12625 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12626 p->error_indicator = 1;
12627 D(p->level--);
12628 return NULL;
12629 }
12630 int _start_lineno = p->tokens[_mark]->lineno;
12631 UNUSED(_start_lineno); // Only used by EXTRA macro
12632 int _start_col_offset = p->tokens[_mark]->col_offset;
12633 UNUSED(_start_col_offset); // Only used by EXTRA macro
12634 { // NAME '=' expression
12635 if (p->error_indicator) {
12636 D(p->level--);
12637 return NULL;
12638 }
12639 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12640 Token * _literal;
12641 expr_ty a;
12642 expr_ty b;
12643 if (
12644 (a = _PyPegen_name_token(p)) // NAME
12645 &&
12646 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12647 &&
12648 (b = expression_rule(p)) // expression
12649 )
12650 {
12651 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12652 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12653 if (_token == NULL) {
12654 D(p->level--);
12655 return NULL;
12656 }
12657 int _end_lineno = _token->end_lineno;
12658 UNUSED(_end_lineno); // Only used by EXTRA macro
12659 int _end_col_offset = _token->end_col_offset;
12660 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012661 _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 +010012662 if (_res == NULL && PyErr_Occurred()) {
12663 p->error_indicator = 1;
12664 D(p->level--);
12665 return NULL;
12666 }
12667 goto done;
12668 }
12669 p->mark = _mark;
12670 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12671 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12672 }
12673 { // '**' expression
12674 if (p->error_indicator) {
12675 D(p->level--);
12676 return NULL;
12677 }
12678 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12679 Token * _literal;
12680 expr_ty a;
12681 if (
12682 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
12683 &&
12684 (a = expression_rule(p)) // expression
12685 )
12686 {
12687 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12688 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12689 if (_token == NULL) {
12690 D(p->level--);
12691 return NULL;
12692 }
12693 int _end_lineno = _token->end_lineno;
12694 UNUSED(_end_lineno); // Only used by EXTRA macro
12695 int _end_col_offset = _token->end_col_offset;
12696 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012697 _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012698 if (_res == NULL && PyErr_Occurred()) {
12699 p->error_indicator = 1;
12700 D(p->level--);
12701 return NULL;
12702 }
12703 goto done;
12704 }
12705 p->mark = _mark;
12706 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12707 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
12708 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012709 if (p->call_invalid_rules) { // invalid_kwarg
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012710 if (p->error_indicator) {
12711 D(p->level--);
12712 return NULL;
12713 }
12714 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12715 void *invalid_kwarg_var;
12716 if (
12717 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12718 )
12719 {
12720 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12721 _res = invalid_kwarg_var;
12722 goto done;
12723 }
12724 p->mark = _mark;
12725 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12726 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12727 }
12728 _res = NULL;
12729 done:
12730 D(p->level--);
12731 return _res;
12732}
12733
12734// star_targets: star_target !',' | star_target ((',' star_target))* ','?
12735static expr_ty
12736star_targets_rule(Parser *p)
12737{
12738 D(p->level++);
12739 if (p->error_indicator) {
12740 D(p->level--);
12741 return NULL;
12742 }
12743 expr_ty _res = NULL;
12744 int _mark = p->mark;
12745 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12746 p->error_indicator = 1;
12747 D(p->level--);
12748 return NULL;
12749 }
12750 int _start_lineno = p->tokens[_mark]->lineno;
12751 UNUSED(_start_lineno); // Only used by EXTRA macro
12752 int _start_col_offset = p->tokens[_mark]->col_offset;
12753 UNUSED(_start_col_offset); // Only used by EXTRA macro
12754 { // star_target !','
12755 if (p->error_indicator) {
12756 D(p->level--);
12757 return NULL;
12758 }
12759 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12760 expr_ty a;
12761 if (
12762 (a = star_target_rule(p)) // star_target
12763 &&
12764 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
12765 )
12766 {
12767 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12768 _res = a;
12769 if (_res == NULL && PyErr_Occurred()) {
12770 p->error_indicator = 1;
12771 D(p->level--);
12772 return NULL;
12773 }
12774 goto done;
12775 }
12776 p->mark = _mark;
12777 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12778 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
12779 }
12780 { // star_target ((',' star_target))* ','?
12781 if (p->error_indicator) {
12782 D(p->level--);
12783 return NULL;
12784 }
12785 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12786 void *_opt_var;
12787 UNUSED(_opt_var); // Silence compiler warnings
12788 expr_ty a;
12789 asdl_seq * b;
12790 if (
12791 (a = star_target_rule(p)) // star_target
12792 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012793 (b = _loop0_119_rule(p)) // ((',' star_target))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012794 &&
12795 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12796 )
12797 {
12798 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12799 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12800 if (_token == NULL) {
12801 D(p->level--);
12802 return NULL;
12803 }
12804 int _end_lineno = _token->end_lineno;
12805 UNUSED(_end_lineno); // Only used by EXTRA macro
12806 int _end_col_offset = _token->end_col_offset;
12807 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012808 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012809 if (_res == NULL && PyErr_Occurred()) {
12810 p->error_indicator = 1;
12811 D(p->level--);
12812 return NULL;
12813 }
12814 goto done;
12815 }
12816 p->mark = _mark;
12817 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12818 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
12819 }
12820 _res = NULL;
12821 done:
12822 D(p->level--);
12823 return _res;
12824}
12825
12826// star_targets_seq: ','.star_target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010012827static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012828star_targets_seq_rule(Parser *p)
12829{
12830 D(p->level++);
12831 if (p->error_indicator) {
12832 D(p->level--);
12833 return NULL;
12834 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010012835 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012836 int _mark = p->mark;
12837 { // ','.star_target+ ','?
12838 if (p->error_indicator) {
12839 D(p->level--);
12840 return NULL;
12841 }
12842 D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12843 void *_opt_var;
12844 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010012845 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012846 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010012847 (a = (asdl_expr_seq*)_gather_120_rule(p)) // ','.star_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012848 &&
12849 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12850 )
12851 {
12852 D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12853 _res = a;
12854 if (_res == NULL && PyErr_Occurred()) {
12855 p->error_indicator = 1;
12856 D(p->level--);
12857 return NULL;
12858 }
12859 goto done;
12860 }
12861 p->mark = _mark;
12862 D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ',
12863 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
12864 }
12865 _res = NULL;
12866 done:
12867 D(p->level--);
12868 return _res;
12869}
12870
12871// star_target:
12872// | '*' (!'*' star_target)
12873// | t_primary '.' NAME !t_lookahead
12874// | t_primary '[' slices ']' !t_lookahead
12875// | star_atom
12876static expr_ty
12877star_target_rule(Parser *p)
12878{
12879 D(p->level++);
12880 if (p->error_indicator) {
12881 D(p->level--);
12882 return NULL;
12883 }
12884 expr_ty _res = NULL;
12885 if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
12886 D(p->level--);
12887 return _res;
12888 }
12889 int _mark = p->mark;
12890 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12891 p->error_indicator = 1;
12892 D(p->level--);
12893 return NULL;
12894 }
12895 int _start_lineno = p->tokens[_mark]->lineno;
12896 UNUSED(_start_lineno); // Only used by EXTRA macro
12897 int _start_col_offset = p->tokens[_mark]->col_offset;
12898 UNUSED(_start_col_offset); // Only used by EXTRA macro
12899 { // '*' (!'*' star_target)
12900 if (p->error_indicator) {
12901 D(p->level--);
12902 return NULL;
12903 }
12904 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12905 Token * _literal;
12906 void *a;
12907 if (
12908 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12909 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012910 (a = _tmp_122_rule(p)) // !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012911 )
12912 {
12913 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12914 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12915 if (_token == NULL) {
12916 D(p->level--);
12917 return NULL;
12918 }
12919 int _end_lineno = _token->end_lineno;
12920 UNUSED(_end_lineno); // Only used by EXTRA macro
12921 int _end_col_offset = _token->end_col_offset;
12922 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012923 _res = _Py_Starred ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012924 if (_res == NULL && PyErr_Occurred()) {
12925 p->error_indicator = 1;
12926 D(p->level--);
12927 return NULL;
12928 }
12929 goto done;
12930 }
12931 p->mark = _mark;
12932 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12933 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
12934 }
12935 { // t_primary '.' NAME !t_lookahead
12936 if (p->error_indicator) {
12937 D(p->level--);
12938 return NULL;
12939 }
12940 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12941 Token * _literal;
12942 expr_ty a;
12943 expr_ty b;
12944 if (
12945 (a = t_primary_rule(p)) // t_primary
12946 &&
12947 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
12948 &&
12949 (b = _PyPegen_name_token(p)) // NAME
12950 &&
12951 _PyPegen_lookahead(0, t_lookahead_rule, p)
12952 )
12953 {
12954 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12955 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12956 if (_token == NULL) {
12957 D(p->level--);
12958 return NULL;
12959 }
12960 int _end_lineno = _token->end_lineno;
12961 UNUSED(_end_lineno); // Only used by EXTRA macro
12962 int _end_col_offset = _token->end_col_offset;
12963 UNUSED(_end_col_offset); // Only used by EXTRA macro
12964 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
12965 if (_res == NULL && PyErr_Occurred()) {
12966 p->error_indicator = 1;
12967 D(p->level--);
12968 return NULL;
12969 }
12970 goto done;
12971 }
12972 p->mark = _mark;
12973 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12974 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12975 }
12976 { // t_primary '[' slices ']' !t_lookahead
12977 if (p->error_indicator) {
12978 D(p->level--);
12979 return NULL;
12980 }
12981 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12982 Token * _literal;
12983 Token * _literal_1;
12984 expr_ty a;
12985 expr_ty b;
12986 if (
12987 (a = t_primary_rule(p)) // t_primary
12988 &&
12989 (_literal = _PyPegen_expect_token(p, 9)) // token='['
12990 &&
12991 (b = slices_rule(p)) // slices
12992 &&
12993 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
12994 &&
12995 _PyPegen_lookahead(0, t_lookahead_rule, p)
12996 )
12997 {
12998 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12999 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13000 if (_token == NULL) {
13001 D(p->level--);
13002 return NULL;
13003 }
13004 int _end_lineno = _token->end_lineno;
13005 UNUSED(_end_lineno); // Only used by EXTRA macro
13006 int _end_col_offset = _token->end_col_offset;
13007 UNUSED(_end_col_offset); // Only used by EXTRA macro
13008 _res = _Py_Subscript ( a , b , Store , EXTRA );
13009 if (_res == NULL && PyErr_Occurred()) {
13010 p->error_indicator = 1;
13011 D(p->level--);
13012 return NULL;
13013 }
13014 goto done;
13015 }
13016 p->mark = _mark;
13017 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
13018 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13019 }
13020 { // star_atom
13021 if (p->error_indicator) {
13022 D(p->level--);
13023 return NULL;
13024 }
13025 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
13026 expr_ty star_atom_var;
13027 if (
13028 (star_atom_var = star_atom_rule(p)) // star_atom
13029 )
13030 {
13031 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
13032 _res = star_atom_var;
13033 goto done;
13034 }
13035 p->mark = _mark;
13036 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
13037 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
13038 }
13039 _res = NULL;
13040 done:
13041 _PyPegen_insert_memo(p, _mark, star_target_type, _res);
13042 D(p->level--);
13043 return _res;
13044}
13045
13046// star_atom:
13047// | NAME
13048// | '(' star_target ')'
13049// | '(' star_targets_seq? ')'
13050// | '[' star_targets_seq? ']'
13051static expr_ty
13052star_atom_rule(Parser *p)
13053{
13054 D(p->level++);
13055 if (p->error_indicator) {
13056 D(p->level--);
13057 return NULL;
13058 }
13059 expr_ty _res = NULL;
13060 int _mark = p->mark;
13061 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13062 p->error_indicator = 1;
13063 D(p->level--);
13064 return NULL;
13065 }
13066 int _start_lineno = p->tokens[_mark]->lineno;
13067 UNUSED(_start_lineno); // Only used by EXTRA macro
13068 int _start_col_offset = p->tokens[_mark]->col_offset;
13069 UNUSED(_start_col_offset); // Only used by EXTRA macro
13070 { // NAME
13071 if (p->error_indicator) {
13072 D(p->level--);
13073 return NULL;
13074 }
13075 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13076 expr_ty a;
13077 if (
13078 (a = _PyPegen_name_token(p)) // NAME
13079 )
13080 {
13081 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13082 _res = _PyPegen_set_expr_context ( p , a , Store );
13083 if (_res == NULL && PyErr_Occurred()) {
13084 p->error_indicator = 1;
13085 D(p->level--);
13086 return NULL;
13087 }
13088 goto done;
13089 }
13090 p->mark = _mark;
13091 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13092 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13093 }
13094 { // '(' star_target ')'
13095 if (p->error_indicator) {
13096 D(p->level--);
13097 return NULL;
13098 }
13099 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13100 Token * _literal;
13101 Token * _literal_1;
13102 expr_ty a;
13103 if (
13104 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13105 &&
13106 (a = star_target_rule(p)) // star_target
13107 &&
13108 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13109 )
13110 {
13111 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13112 _res = _PyPegen_set_expr_context ( p , a , Store );
13113 if (_res == NULL && PyErr_Occurred()) {
13114 p->error_indicator = 1;
13115 D(p->level--);
13116 return NULL;
13117 }
13118 goto done;
13119 }
13120 p->mark = _mark;
13121 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13122 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'"));
13123 }
13124 { // '(' star_targets_seq? ')'
13125 if (p->error_indicator) {
13126 D(p->level--);
13127 return NULL;
13128 }
13129 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13130 Token * _literal;
13131 Token * _literal_1;
13132 void *a;
13133 if (
13134 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13135 &&
13136 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13137 &&
13138 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13139 )
13140 {
13141 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13142 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13143 if (_token == NULL) {
13144 D(p->level--);
13145 return NULL;
13146 }
13147 int _end_lineno = _token->end_lineno;
13148 UNUSED(_end_lineno); // Only used by EXTRA macro
13149 int _end_col_offset = _token->end_col_offset;
13150 UNUSED(_end_col_offset); // Only used by EXTRA macro
13151 _res = _Py_Tuple ( a , Store , EXTRA );
13152 if (_res == NULL && PyErr_Occurred()) {
13153 p->error_indicator = 1;
13154 D(p->level--);
13155 return NULL;
13156 }
13157 goto done;
13158 }
13159 p->mark = _mark;
13160 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13161 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'"));
13162 }
13163 { // '[' star_targets_seq? ']'
13164 if (p->error_indicator) {
13165 D(p->level--);
13166 return NULL;
13167 }
13168 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13169 Token * _literal;
13170 Token * _literal_1;
13171 void *a;
13172 if (
13173 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13174 &&
13175 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13176 &&
13177 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13178 )
13179 {
13180 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13181 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13182 if (_token == NULL) {
13183 D(p->level--);
13184 return NULL;
13185 }
13186 int _end_lineno = _token->end_lineno;
13187 UNUSED(_end_lineno); // Only used by EXTRA macro
13188 int _end_col_offset = _token->end_col_offset;
13189 UNUSED(_end_col_offset); // Only used by EXTRA macro
13190 _res = _Py_List ( a , Store , EXTRA );
13191 if (_res == NULL && PyErr_Occurred()) {
13192 p->error_indicator = 1;
13193 D(p->level--);
13194 return NULL;
13195 }
13196 goto done;
13197 }
13198 p->mark = _mark;
13199 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13200 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'"));
13201 }
13202 _res = NULL;
13203 done:
13204 D(p->level--);
13205 return _res;
13206}
13207
13208// single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
13209static expr_ty
13210single_target_rule(Parser *p)
13211{
13212 D(p->level++);
13213 if (p->error_indicator) {
13214 D(p->level--);
13215 return NULL;
13216 }
13217 expr_ty _res = NULL;
13218 int _mark = p->mark;
13219 { // single_subscript_attribute_target
13220 if (p->error_indicator) {
13221 D(p->level--);
13222 return NULL;
13223 }
13224 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13225 expr_ty single_subscript_attribute_target_var;
13226 if (
13227 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
13228 )
13229 {
13230 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13231 _res = single_subscript_attribute_target_var;
13232 goto done;
13233 }
13234 p->mark = _mark;
13235 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13236 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
13237 }
13238 { // NAME
13239 if (p->error_indicator) {
13240 D(p->level--);
13241 return NULL;
13242 }
13243 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13244 expr_ty a;
13245 if (
13246 (a = _PyPegen_name_token(p)) // NAME
13247 )
13248 {
13249 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13250 _res = _PyPegen_set_expr_context ( p , a , Store );
13251 if (_res == NULL && PyErr_Occurred()) {
13252 p->error_indicator = 1;
13253 D(p->level--);
13254 return NULL;
13255 }
13256 goto done;
13257 }
13258 p->mark = _mark;
13259 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13260 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13261 }
13262 { // '(' single_target ')'
13263 if (p->error_indicator) {
13264 D(p->level--);
13265 return NULL;
13266 }
13267 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13268 Token * _literal;
13269 Token * _literal_1;
13270 expr_ty a;
13271 if (
13272 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13273 &&
13274 (a = single_target_rule(p)) // single_target
13275 &&
13276 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13277 )
13278 {
13279 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13280 _res = a;
13281 if (_res == NULL && PyErr_Occurred()) {
13282 p->error_indicator = 1;
13283 D(p->level--);
13284 return NULL;
13285 }
13286 goto done;
13287 }
13288 p->mark = _mark;
13289 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13290 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
13291 }
13292 _res = NULL;
13293 done:
13294 D(p->level--);
13295 return _res;
13296}
13297
13298// single_subscript_attribute_target:
13299// | t_primary '.' NAME !t_lookahead
13300// | t_primary '[' slices ']' !t_lookahead
13301static expr_ty
13302single_subscript_attribute_target_rule(Parser *p)
13303{
13304 D(p->level++);
13305 if (p->error_indicator) {
13306 D(p->level--);
13307 return NULL;
13308 }
13309 expr_ty _res = NULL;
13310 int _mark = p->mark;
13311 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13312 p->error_indicator = 1;
13313 D(p->level--);
13314 return NULL;
13315 }
13316 int _start_lineno = p->tokens[_mark]->lineno;
13317 UNUSED(_start_lineno); // Only used by EXTRA macro
13318 int _start_col_offset = p->tokens[_mark]->col_offset;
13319 UNUSED(_start_col_offset); // Only used by EXTRA macro
13320 { // t_primary '.' NAME !t_lookahead
13321 if (p->error_indicator) {
13322 D(p->level--);
13323 return NULL;
13324 }
13325 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13326 Token * _literal;
13327 expr_ty a;
13328 expr_ty b;
13329 if (
13330 (a = t_primary_rule(p)) // t_primary
13331 &&
13332 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13333 &&
13334 (b = _PyPegen_name_token(p)) // NAME
13335 &&
13336 _PyPegen_lookahead(0, t_lookahead_rule, p)
13337 )
13338 {
13339 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13340 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13341 if (_token == NULL) {
13342 D(p->level--);
13343 return NULL;
13344 }
13345 int _end_lineno = _token->end_lineno;
13346 UNUSED(_end_lineno); // Only used by EXTRA macro
13347 int _end_col_offset = _token->end_col_offset;
13348 UNUSED(_end_col_offset); // Only used by EXTRA macro
13349 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13350 if (_res == NULL && PyErr_Occurred()) {
13351 p->error_indicator = 1;
13352 D(p->level--);
13353 return NULL;
13354 }
13355 goto done;
13356 }
13357 p->mark = _mark;
13358 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13359 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13360 }
13361 { // t_primary '[' slices ']' !t_lookahead
13362 if (p->error_indicator) {
13363 D(p->level--);
13364 return NULL;
13365 }
13366 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13367 Token * _literal;
13368 Token * _literal_1;
13369 expr_ty a;
13370 expr_ty b;
13371 if (
13372 (a = t_primary_rule(p)) // t_primary
13373 &&
13374 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13375 &&
13376 (b = slices_rule(p)) // slices
13377 &&
13378 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13379 &&
13380 _PyPegen_lookahead(0, t_lookahead_rule, p)
13381 )
13382 {
13383 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13384 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13385 if (_token == NULL) {
13386 D(p->level--);
13387 return NULL;
13388 }
13389 int _end_lineno = _token->end_lineno;
13390 UNUSED(_end_lineno); // Only used by EXTRA macro
13391 int _end_col_offset = _token->end_col_offset;
13392 UNUSED(_end_col_offset); // Only used by EXTRA macro
13393 _res = _Py_Subscript ( a , b , Store , EXTRA );
13394 if (_res == NULL && PyErr_Occurred()) {
13395 p->error_indicator = 1;
13396 D(p->level--);
13397 return NULL;
13398 }
13399 goto done;
13400 }
13401 p->mark = _mark;
13402 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13403 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13404 }
13405 _res = NULL;
13406 done:
13407 D(p->level--);
13408 return _res;
13409}
13410
13411// del_targets: ','.del_target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010013412static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013413del_targets_rule(Parser *p)
13414{
13415 D(p->level++);
13416 if (p->error_indicator) {
13417 D(p->level--);
13418 return NULL;
13419 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010013420 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013421 int _mark = p->mark;
13422 { // ','.del_target+ ','?
13423 if (p->error_indicator) {
13424 D(p->level--);
13425 return NULL;
13426 }
13427 D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13428 void *_opt_var;
13429 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010013430 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013431 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010013432 (a = (asdl_expr_seq*)_gather_123_rule(p)) // ','.del_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013433 &&
13434 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13435 )
13436 {
13437 D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13438 _res = a;
13439 if (_res == NULL && PyErr_Occurred()) {
13440 p->error_indicator = 1;
13441 D(p->level--);
13442 return NULL;
13443 }
13444 goto done;
13445 }
13446 p->mark = _mark;
13447 D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
13448 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
13449 }
13450 _res = NULL;
13451 done:
13452 D(p->level--);
13453 return _res;
13454}
13455
13456// del_target:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013457// | t_primary '.' NAME !t_lookahead
13458// | t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013459// | del_t_atom
13460static expr_ty
13461del_target_rule(Parser *p)
13462{
13463 D(p->level++);
13464 if (p->error_indicator) {
13465 D(p->level--);
13466 return NULL;
13467 }
13468 expr_ty _res = NULL;
13469 if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
13470 D(p->level--);
13471 return _res;
13472 }
13473 int _mark = p->mark;
13474 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13475 p->error_indicator = 1;
13476 D(p->level--);
13477 return NULL;
13478 }
13479 int _start_lineno = p->tokens[_mark]->lineno;
13480 UNUSED(_start_lineno); // Only used by EXTRA macro
13481 int _start_col_offset = p->tokens[_mark]->col_offset;
13482 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013483 { // t_primary '.' NAME !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013484 if (p->error_indicator) {
13485 D(p->level--);
13486 return NULL;
13487 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013488 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013489 Token * _literal;
13490 expr_ty a;
13491 expr_ty b;
13492 if (
13493 (a = t_primary_rule(p)) // t_primary
13494 &&
13495 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13496 &&
13497 (b = _PyPegen_name_token(p)) // NAME
13498 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013499 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013500 )
13501 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013502 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 +010013503 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13504 if (_token == NULL) {
13505 D(p->level--);
13506 return NULL;
13507 }
13508 int _end_lineno = _token->end_lineno;
13509 UNUSED(_end_lineno); // Only used by EXTRA macro
13510 int _end_col_offset = _token->end_col_offset;
13511 UNUSED(_end_col_offset); // Only used by EXTRA macro
13512 _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
13513 if (_res == NULL && PyErr_Occurred()) {
13514 p->error_indicator = 1;
13515 D(p->level--);
13516 return NULL;
13517 }
13518 goto done;
13519 }
13520 p->mark = _mark;
13521 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013522 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013523 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013524 { // t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013525 if (p->error_indicator) {
13526 D(p->level--);
13527 return NULL;
13528 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013529 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 +010013530 Token * _literal;
13531 Token * _literal_1;
13532 expr_ty a;
13533 expr_ty b;
13534 if (
13535 (a = t_primary_rule(p)) // t_primary
13536 &&
13537 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13538 &&
13539 (b = slices_rule(p)) // slices
13540 &&
13541 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13542 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013543 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013544 )
13545 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013546 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 +010013547 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13548 if (_token == NULL) {
13549 D(p->level--);
13550 return NULL;
13551 }
13552 int _end_lineno = _token->end_lineno;
13553 UNUSED(_end_lineno); // Only used by EXTRA macro
13554 int _end_col_offset = _token->end_col_offset;
13555 UNUSED(_end_col_offset); // Only used by EXTRA macro
13556 _res = _Py_Subscript ( a , b , Del , EXTRA );
13557 if (_res == NULL && PyErr_Occurred()) {
13558 p->error_indicator = 1;
13559 D(p->level--);
13560 return NULL;
13561 }
13562 goto done;
13563 }
13564 p->mark = _mark;
13565 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013566 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013567 }
13568 { // del_t_atom
13569 if (p->error_indicator) {
13570 D(p->level--);
13571 return NULL;
13572 }
13573 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13574 expr_ty del_t_atom_var;
13575 if (
13576 (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom
13577 )
13578 {
13579 D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13580 _res = del_t_atom_var;
13581 goto done;
13582 }
13583 p->mark = _mark;
13584 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
13585 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
13586 }
13587 _res = NULL;
13588 done:
13589 _PyPegen_insert_memo(p, _mark, del_target_type, _res);
13590 D(p->level--);
13591 return _res;
13592}
13593
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013594// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013595static expr_ty
13596del_t_atom_rule(Parser *p)
13597{
13598 D(p->level++);
13599 if (p->error_indicator) {
13600 D(p->level--);
13601 return NULL;
13602 }
13603 expr_ty _res = NULL;
13604 int _mark = p->mark;
13605 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13606 p->error_indicator = 1;
13607 D(p->level--);
13608 return NULL;
13609 }
13610 int _start_lineno = p->tokens[_mark]->lineno;
13611 UNUSED(_start_lineno); // Only used by EXTRA macro
13612 int _start_col_offset = p->tokens[_mark]->col_offset;
13613 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013614 { // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013615 if (p->error_indicator) {
13616 D(p->level--);
13617 return NULL;
13618 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013619 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013620 expr_ty a;
13621 if (
13622 (a = _PyPegen_name_token(p)) // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013623 )
13624 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013625 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 +010013626 _res = _PyPegen_set_expr_context ( p , a , Del );
13627 if (_res == NULL && PyErr_Occurred()) {
13628 p->error_indicator = 1;
13629 D(p->level--);
13630 return NULL;
13631 }
13632 goto done;
13633 }
13634 p->mark = _mark;
13635 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013636 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013637 }
13638 { // '(' del_target ')'
13639 if (p->error_indicator) {
13640 D(p->level--);
13641 return NULL;
13642 }
13643 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13644 Token * _literal;
13645 Token * _literal_1;
13646 expr_ty a;
13647 if (
13648 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13649 &&
13650 (a = del_target_rule(p)) // del_target
13651 &&
13652 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13653 )
13654 {
13655 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13656 _res = _PyPegen_set_expr_context ( p , a , Del );
13657 if (_res == NULL && PyErr_Occurred()) {
13658 p->error_indicator = 1;
13659 D(p->level--);
13660 return NULL;
13661 }
13662 goto done;
13663 }
13664 p->mark = _mark;
13665 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13666 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
13667 }
13668 { // '(' del_targets? ')'
13669 if (p->error_indicator) {
13670 D(p->level--);
13671 return NULL;
13672 }
13673 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13674 Token * _literal;
13675 Token * _literal_1;
13676 void *a;
13677 if (
13678 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13679 &&
13680 (a = del_targets_rule(p), 1) // del_targets?
13681 &&
13682 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13683 )
13684 {
13685 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13686 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13687 if (_token == NULL) {
13688 D(p->level--);
13689 return NULL;
13690 }
13691 int _end_lineno = _token->end_lineno;
13692 UNUSED(_end_lineno); // Only used by EXTRA macro
13693 int _end_col_offset = _token->end_col_offset;
13694 UNUSED(_end_col_offset); // Only used by EXTRA macro
13695 _res = _Py_Tuple ( a , Del , EXTRA );
13696 if (_res == NULL && PyErr_Occurred()) {
13697 p->error_indicator = 1;
13698 D(p->level--);
13699 return NULL;
13700 }
13701 goto done;
13702 }
13703 p->mark = _mark;
13704 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13705 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
13706 }
13707 { // '[' del_targets? ']'
13708 if (p->error_indicator) {
13709 D(p->level--);
13710 return NULL;
13711 }
13712 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13713 Token * _literal;
13714 Token * _literal_1;
13715 void *a;
13716 if (
13717 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13718 &&
13719 (a = del_targets_rule(p), 1) // del_targets?
13720 &&
13721 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13722 )
13723 {
13724 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13725 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13726 if (_token == NULL) {
13727 D(p->level--);
13728 return NULL;
13729 }
13730 int _end_lineno = _token->end_lineno;
13731 UNUSED(_end_lineno); // Only used by EXTRA macro
13732 int _end_col_offset = _token->end_col_offset;
13733 UNUSED(_end_col_offset); // Only used by EXTRA macro
13734 _res = _Py_List ( a , Del , EXTRA );
13735 if (_res == NULL && PyErr_Occurred()) {
13736 p->error_indicator = 1;
13737 D(p->level--);
13738 return NULL;
13739 }
13740 goto done;
13741 }
13742 p->mark = _mark;
13743 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13744 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
13745 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013746 _res = NULL;
13747 done:
13748 D(p->level--);
13749 return _res;
13750}
13751
13752// targets: ','.target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010013753static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013754targets_rule(Parser *p)
13755{
13756 D(p->level++);
13757 if (p->error_indicator) {
13758 D(p->level--);
13759 return NULL;
13760 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010013761 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013762 int _mark = p->mark;
13763 { // ','.target+ ','?
13764 if (p->error_indicator) {
13765 D(p->level--);
13766 return NULL;
13767 }
13768 D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13769 void *_opt_var;
13770 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010013771 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013772 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010013773 (a = (asdl_expr_seq*)_gather_125_rule(p)) // ','.target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013774 &&
13775 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13776 )
13777 {
13778 D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13779 _res = a;
13780 if (_res == NULL && PyErr_Occurred()) {
13781 p->error_indicator = 1;
13782 D(p->level--);
13783 return NULL;
13784 }
13785 goto done;
13786 }
13787 p->mark = _mark;
13788 D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ',
13789 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?"));
13790 }
13791 _res = NULL;
13792 done:
13793 D(p->level--);
13794 return _res;
13795}
13796
13797// target:
13798// | t_primary '.' NAME !t_lookahead
13799// | t_primary '[' slices ']' !t_lookahead
13800// | t_atom
13801static expr_ty
13802target_rule(Parser *p)
13803{
13804 D(p->level++);
13805 if (p->error_indicator) {
13806 D(p->level--);
13807 return NULL;
13808 }
13809 expr_ty _res = NULL;
13810 if (_PyPegen_is_memoized(p, target_type, &_res)) {
13811 D(p->level--);
13812 return _res;
13813 }
13814 int _mark = p->mark;
13815 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13816 p->error_indicator = 1;
13817 D(p->level--);
13818 return NULL;
13819 }
13820 int _start_lineno = p->tokens[_mark]->lineno;
13821 UNUSED(_start_lineno); // Only used by EXTRA macro
13822 int _start_col_offset = p->tokens[_mark]->col_offset;
13823 UNUSED(_start_col_offset); // Only used by EXTRA macro
13824 { // t_primary '.' NAME !t_lookahead
13825 if (p->error_indicator) {
13826 D(p->level--);
13827 return NULL;
13828 }
13829 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13830 Token * _literal;
13831 expr_ty a;
13832 expr_ty b;
13833 if (
13834 (a = t_primary_rule(p)) // t_primary
13835 &&
13836 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13837 &&
13838 (b = _PyPegen_name_token(p)) // NAME
13839 &&
13840 _PyPegen_lookahead(0, t_lookahead_rule, p)
13841 )
13842 {
13843 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13844 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13845 if (_token == NULL) {
13846 D(p->level--);
13847 return NULL;
13848 }
13849 int _end_lineno = _token->end_lineno;
13850 UNUSED(_end_lineno); // Only used by EXTRA macro
13851 int _end_col_offset = _token->end_col_offset;
13852 UNUSED(_end_col_offset); // Only used by EXTRA macro
13853 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13854 if (_res == NULL && PyErr_Occurred()) {
13855 p->error_indicator = 1;
13856 D(p->level--);
13857 return NULL;
13858 }
13859 goto done;
13860 }
13861 p->mark = _mark;
13862 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13863 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13864 }
13865 { // t_primary '[' slices ']' !t_lookahead
13866 if (p->error_indicator) {
13867 D(p->level--);
13868 return NULL;
13869 }
13870 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13871 Token * _literal;
13872 Token * _literal_1;
13873 expr_ty a;
13874 expr_ty b;
13875 if (
13876 (a = t_primary_rule(p)) // t_primary
13877 &&
13878 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13879 &&
13880 (b = slices_rule(p)) // slices
13881 &&
13882 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13883 &&
13884 _PyPegen_lookahead(0, t_lookahead_rule, p)
13885 )
13886 {
13887 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13888 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13889 if (_token == NULL) {
13890 D(p->level--);
13891 return NULL;
13892 }
13893 int _end_lineno = _token->end_lineno;
13894 UNUSED(_end_lineno); // Only used by EXTRA macro
13895 int _end_col_offset = _token->end_col_offset;
13896 UNUSED(_end_col_offset); // Only used by EXTRA macro
13897 _res = _Py_Subscript ( a , b , Store , EXTRA );
13898 if (_res == NULL && PyErr_Occurred()) {
13899 p->error_indicator = 1;
13900 D(p->level--);
13901 return NULL;
13902 }
13903 goto done;
13904 }
13905 p->mark = _mark;
13906 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13907 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13908 }
13909 { // t_atom
13910 if (p->error_indicator) {
13911 D(p->level--);
13912 return NULL;
13913 }
13914 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom"));
13915 expr_ty t_atom_var;
13916 if (
13917 (t_atom_var = t_atom_rule(p)) // t_atom
13918 )
13919 {
13920 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom"));
13921 _res = t_atom_var;
13922 goto done;
13923 }
13924 p->mark = _mark;
13925 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13926 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom"));
13927 }
13928 _res = NULL;
13929 done:
13930 _PyPegen_insert_memo(p, _mark, target_type, _res);
13931 D(p->level--);
13932 return _res;
13933}
13934
13935// Left-recursive
13936// t_primary:
13937// | t_primary '.' NAME &t_lookahead
13938// | t_primary '[' slices ']' &t_lookahead
13939// | t_primary genexp &t_lookahead
13940// | t_primary '(' arguments? ')' &t_lookahead
13941// | atom &t_lookahead
13942static expr_ty t_primary_raw(Parser *);
13943static expr_ty
13944t_primary_rule(Parser *p)
13945{
13946 D(p->level++);
13947 expr_ty _res = NULL;
13948 if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
13949 D(p->level--);
13950 return _res;
13951 }
13952 int _mark = p->mark;
13953 int _resmark = p->mark;
13954 while (1) {
13955 int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
13956 if (tmpvar_8) {
13957 D(p->level--);
13958 return _res;
13959 }
13960 p->mark = _mark;
13961 void *_raw = t_primary_raw(p);
Lysandros Nikolaou02cdfc92020-10-31 20:31:41 +020013962 if (p->error_indicator)
13963 return NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013964 if (_raw == NULL || p->mark <= _resmark)
13965 break;
13966 _resmark = p->mark;
13967 _res = _raw;
13968 }
13969 p->mark = _resmark;
13970 D(p->level--);
13971 return _res;
13972}
13973static expr_ty
13974t_primary_raw(Parser *p)
13975{
13976 D(p->level++);
13977 if (p->error_indicator) {
13978 D(p->level--);
13979 return NULL;
13980 }
13981 expr_ty _res = NULL;
13982 int _mark = p->mark;
13983 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13984 p->error_indicator = 1;
13985 D(p->level--);
13986 return NULL;
13987 }
13988 int _start_lineno = p->tokens[_mark]->lineno;
13989 UNUSED(_start_lineno); // Only used by EXTRA macro
13990 int _start_col_offset = p->tokens[_mark]->col_offset;
13991 UNUSED(_start_col_offset); // Only used by EXTRA macro
13992 { // t_primary '.' NAME &t_lookahead
13993 if (p->error_indicator) {
13994 D(p->level--);
13995 return NULL;
13996 }
13997 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13998 Token * _literal;
13999 expr_ty a;
14000 expr_ty b;
14001 if (
14002 (a = t_primary_rule(p)) // t_primary
14003 &&
14004 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
14005 &&
14006 (b = _PyPegen_name_token(p)) // NAME
14007 &&
14008 _PyPegen_lookahead(1, t_lookahead_rule, p)
14009 )
14010 {
14011 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
14012 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14013 if (_token == NULL) {
14014 D(p->level--);
14015 return NULL;
14016 }
14017 int _end_lineno = _token->end_lineno;
14018 UNUSED(_end_lineno); // Only used by EXTRA macro
14019 int _end_col_offset = _token->end_col_offset;
14020 UNUSED(_end_col_offset); // Only used by EXTRA macro
14021 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
14022 if (_res == NULL && PyErr_Occurred()) {
14023 p->error_indicator = 1;
14024 D(p->level--);
14025 return NULL;
14026 }
14027 goto done;
14028 }
14029 p->mark = _mark;
14030 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14031 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
14032 }
14033 { // t_primary '[' slices ']' &t_lookahead
14034 if (p->error_indicator) {
14035 D(p->level--);
14036 return NULL;
14037 }
14038 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14039 Token * _literal;
14040 Token * _literal_1;
14041 expr_ty a;
14042 expr_ty b;
14043 if (
14044 (a = t_primary_rule(p)) // t_primary
14045 &&
14046 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14047 &&
14048 (b = slices_rule(p)) // slices
14049 &&
14050 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14051 &&
14052 _PyPegen_lookahead(1, t_lookahead_rule, p)
14053 )
14054 {
14055 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14056 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14057 if (_token == NULL) {
14058 D(p->level--);
14059 return NULL;
14060 }
14061 int _end_lineno = _token->end_lineno;
14062 UNUSED(_end_lineno); // Only used by EXTRA macro
14063 int _end_col_offset = _token->end_col_offset;
14064 UNUSED(_end_col_offset); // Only used by EXTRA macro
14065 _res = _Py_Subscript ( a , b , Load , EXTRA );
14066 if (_res == NULL && PyErr_Occurred()) {
14067 p->error_indicator = 1;
14068 D(p->level--);
14069 return NULL;
14070 }
14071 goto done;
14072 }
14073 p->mark = _mark;
14074 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14075 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14076 }
14077 { // t_primary genexp &t_lookahead
14078 if (p->error_indicator) {
14079 D(p->level--);
14080 return NULL;
14081 }
14082 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14083 expr_ty a;
14084 expr_ty b;
14085 if (
14086 (a = t_primary_rule(p)) // t_primary
14087 &&
14088 (b = genexp_rule(p)) // genexp
14089 &&
14090 _PyPegen_lookahead(1, t_lookahead_rule, p)
14091 )
14092 {
14093 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14094 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14095 if (_token == NULL) {
14096 D(p->level--);
14097 return NULL;
14098 }
14099 int _end_lineno = _token->end_lineno;
14100 UNUSED(_end_lineno); // Only used by EXTRA macro
14101 int _end_col_offset = _token->end_col_offset;
14102 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030014103 _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 +010014104 if (_res == NULL && PyErr_Occurred()) {
14105 p->error_indicator = 1;
14106 D(p->level--);
14107 return NULL;
14108 }
14109 goto done;
14110 }
14111 p->mark = _mark;
14112 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14113 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
14114 }
14115 { // t_primary '(' arguments? ')' &t_lookahead
14116 if (p->error_indicator) {
14117 D(p->level--);
14118 return NULL;
14119 }
14120 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14121 Token * _literal;
14122 Token * _literal_1;
14123 expr_ty a;
14124 void *b;
14125 if (
14126 (a = t_primary_rule(p)) // t_primary
14127 &&
14128 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14129 &&
14130 (b = arguments_rule(p), 1) // arguments?
14131 &&
14132 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14133 &&
14134 _PyPegen_lookahead(1, t_lookahead_rule, p)
14135 )
14136 {
14137 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14138 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14139 if (_token == NULL) {
14140 D(p->level--);
14141 return NULL;
14142 }
14143 int _end_lineno = _token->end_lineno;
14144 UNUSED(_end_lineno); // Only used by EXTRA macro
14145 int _end_col_offset = _token->end_col_offset;
14146 UNUSED(_end_col_offset); // Only used by EXTRA macro
14147 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
14148 if (_res == NULL && PyErr_Occurred()) {
14149 p->error_indicator = 1;
14150 D(p->level--);
14151 return NULL;
14152 }
14153 goto done;
14154 }
14155 p->mark = _mark;
14156 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14157 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14158 }
14159 { // atom &t_lookahead
14160 if (p->error_indicator) {
14161 D(p->level--);
14162 return NULL;
14163 }
14164 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14165 expr_ty a;
14166 if (
14167 (a = atom_rule(p)) // atom
14168 &&
14169 _PyPegen_lookahead(1, t_lookahead_rule, p)
14170 )
14171 {
14172 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14173 _res = a;
14174 if (_res == NULL && PyErr_Occurred()) {
14175 p->error_indicator = 1;
14176 D(p->level--);
14177 return NULL;
14178 }
14179 goto done;
14180 }
14181 p->mark = _mark;
14182 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14183 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
14184 }
14185 _res = NULL;
14186 done:
14187 D(p->level--);
14188 return _res;
14189}
14190
14191// t_lookahead: '(' | '[' | '.'
14192static void *
14193t_lookahead_rule(Parser *p)
14194{
14195 D(p->level++);
14196 if (p->error_indicator) {
14197 D(p->level--);
14198 return NULL;
14199 }
14200 void * _res = NULL;
14201 int _mark = p->mark;
14202 { // '('
14203 if (p->error_indicator) {
14204 D(p->level--);
14205 return NULL;
14206 }
14207 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
14208 Token * _literal;
14209 if (
14210 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14211 )
14212 {
14213 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
14214 _res = _literal;
14215 goto done;
14216 }
14217 p->mark = _mark;
14218 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14219 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
14220 }
14221 { // '['
14222 if (p->error_indicator) {
14223 D(p->level--);
14224 return NULL;
14225 }
14226 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
14227 Token * _literal;
14228 if (
14229 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14230 )
14231 {
14232 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
14233 _res = _literal;
14234 goto done;
14235 }
14236 p->mark = _mark;
14237 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14238 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
14239 }
14240 { // '.'
14241 if (p->error_indicator) {
14242 D(p->level--);
14243 return NULL;
14244 }
14245 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
14246 Token * _literal;
14247 if (
14248 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
14249 )
14250 {
14251 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
14252 _res = _literal;
14253 goto done;
14254 }
14255 p->mark = _mark;
14256 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14257 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
14258 }
14259 _res = NULL;
14260 done:
14261 D(p->level--);
14262 return _res;
14263}
14264
14265// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
14266static expr_ty
14267t_atom_rule(Parser *p)
14268{
14269 D(p->level++);
14270 if (p->error_indicator) {
14271 D(p->level--);
14272 return NULL;
14273 }
14274 expr_ty _res = NULL;
14275 int _mark = p->mark;
14276 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
14277 p->error_indicator = 1;
14278 D(p->level--);
14279 return NULL;
14280 }
14281 int _start_lineno = p->tokens[_mark]->lineno;
14282 UNUSED(_start_lineno); // Only used by EXTRA macro
14283 int _start_col_offset = p->tokens[_mark]->col_offset;
14284 UNUSED(_start_col_offset); // Only used by EXTRA macro
14285 { // NAME
14286 if (p->error_indicator) {
14287 D(p->level--);
14288 return NULL;
14289 }
14290 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
14291 expr_ty a;
14292 if (
14293 (a = _PyPegen_name_token(p)) // NAME
14294 )
14295 {
14296 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
14297 _res = _PyPegen_set_expr_context ( p , a , Store );
14298 if (_res == NULL && PyErr_Occurred()) {
14299 p->error_indicator = 1;
14300 D(p->level--);
14301 return NULL;
14302 }
14303 goto done;
14304 }
14305 p->mark = _mark;
14306 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14307 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
14308 }
14309 { // '(' target ')'
14310 if (p->error_indicator) {
14311 D(p->level--);
14312 return NULL;
14313 }
14314 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14315 Token * _literal;
14316 Token * _literal_1;
14317 expr_ty a;
14318 if (
14319 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14320 &&
14321 (a = target_rule(p)) // target
14322 &&
14323 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14324 )
14325 {
14326 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14327 _res = _PyPegen_set_expr_context ( p , a , Store );
14328 if (_res == NULL && PyErr_Occurred()) {
14329 p->error_indicator = 1;
14330 D(p->level--);
14331 return NULL;
14332 }
14333 goto done;
14334 }
14335 p->mark = _mark;
14336 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14337 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'"));
14338 }
14339 { // '(' targets? ')'
14340 if (p->error_indicator) {
14341 D(p->level--);
14342 return NULL;
14343 }
14344 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14345 Token * _literal;
14346 Token * _literal_1;
14347 void *b;
14348 if (
14349 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14350 &&
14351 (b = targets_rule(p), 1) // targets?
14352 &&
14353 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14354 )
14355 {
14356 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14357 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14358 if (_token == NULL) {
14359 D(p->level--);
14360 return NULL;
14361 }
14362 int _end_lineno = _token->end_lineno;
14363 UNUSED(_end_lineno); // Only used by EXTRA macro
14364 int _end_col_offset = _token->end_col_offset;
14365 UNUSED(_end_col_offset); // Only used by EXTRA macro
14366 _res = _Py_Tuple ( b , Store , EXTRA );
14367 if (_res == NULL && PyErr_Occurred()) {
14368 p->error_indicator = 1;
14369 D(p->level--);
14370 return NULL;
14371 }
14372 goto done;
14373 }
14374 p->mark = _mark;
14375 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14376 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'"));
14377 }
14378 { // '[' targets? ']'
14379 if (p->error_indicator) {
14380 D(p->level--);
14381 return NULL;
14382 }
14383 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14384 Token * _literal;
14385 Token * _literal_1;
14386 void *b;
14387 if (
14388 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14389 &&
14390 (b = targets_rule(p), 1) // targets?
14391 &&
14392 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14393 )
14394 {
14395 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14396 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14397 if (_token == NULL) {
14398 D(p->level--);
14399 return NULL;
14400 }
14401 int _end_lineno = _token->end_lineno;
14402 UNUSED(_end_lineno); // Only used by EXTRA macro
14403 int _end_col_offset = _token->end_col_offset;
14404 UNUSED(_end_col_offset); // Only used by EXTRA macro
14405 _res = _Py_List ( b , Store , EXTRA );
14406 if (_res == NULL && PyErr_Occurred()) {
14407 p->error_indicator = 1;
14408 D(p->level--);
14409 return NULL;
14410 }
14411 goto done;
14412 }
14413 p->mark = _mark;
14414 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14415 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'"));
14416 }
14417 _res = NULL;
14418 done:
14419 D(p->level--);
14420 return _res;
14421}
14422
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014423// invalid_arguments:
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014424// | args ',' '*'
14425// | expression for_if_clauses ',' [args | expression for_if_clauses]
14426// | args for_if_clauses
14427// | args ',' expression for_if_clauses
14428// | args ',' args
14429static void *
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014430invalid_arguments_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014431{
14432 D(p->level++);
14433 if (p->error_indicator) {
14434 D(p->level--);
14435 return NULL;
14436 }
14437 void * _res = NULL;
14438 int _mark = p->mark;
14439 { // args ',' '*'
14440 if (p->error_indicator) {
14441 D(p->level--);
14442 return NULL;
14443 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014444 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014445 Token * _literal;
14446 Token * _literal_1;
14447 expr_ty args_var;
14448 if (
14449 (args_var = args_rule(p)) // args
14450 &&
14451 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14452 &&
14453 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
14454 )
14455 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014456 D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014457 _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
14458 if (_res == NULL && PyErr_Occurred()) {
14459 p->error_indicator = 1;
14460 D(p->level--);
14461 return NULL;
14462 }
14463 goto done;
14464 }
14465 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014466 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014467 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'"));
14468 }
14469 { // expression for_if_clauses ',' [args | expression for_if_clauses]
14470 if (p->error_indicator) {
14471 D(p->level--);
14472 return NULL;
14473 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014474 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 +010014475 Token * _literal;
14476 void *_opt_var;
14477 UNUSED(_opt_var); // Silence compiler warnings
14478 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014479 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014480 if (
14481 (a = expression_rule(p)) // expression
14482 &&
14483 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14484 &&
14485 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14486 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014487 (_opt_var = _tmp_127_rule(p), 1) // [args | expression for_if_clauses]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014488 )
14489 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014490 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 +010014491 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14492 if (_res == NULL && PyErr_Occurred()) {
14493 p->error_indicator = 1;
14494 D(p->level--);
14495 return NULL;
14496 }
14497 goto done;
14498 }
14499 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014500 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014501 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14502 }
14503 { // args for_if_clauses
14504 if (p->error_indicator) {
14505 D(p->level--);
14506 return NULL;
14507 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014508 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 +010014509 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014510 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014511 if (
14512 (a = args_rule(p)) // args
14513 &&
14514 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14515 )
14516 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014517 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 +010014518 _res = _PyPegen_nonparen_genexp_in_call ( p , a );
14519 if (_res == NULL && PyErr_Occurred()) {
14520 p->error_indicator = 1;
14521 D(p->level--);
14522 return NULL;
14523 }
14524 goto done;
14525 }
14526 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014527 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014528 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
14529 }
14530 { // args ',' expression for_if_clauses
14531 if (p->error_indicator) {
14532 D(p->level--);
14533 return NULL;
14534 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014535 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 +010014536 Token * _literal;
14537 expr_ty a;
14538 expr_ty args_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014539 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014540 if (
14541 (args_var = args_rule(p)) // args
14542 &&
14543 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14544 &&
14545 (a = expression_rule(p)) // expression
14546 &&
14547 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14548 )
14549 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014550 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 +010014551 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14552 if (_res == NULL && PyErr_Occurred()) {
14553 p->error_indicator = 1;
14554 D(p->level--);
14555 return NULL;
14556 }
14557 goto done;
14558 }
14559 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014560 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014561 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
14562 }
14563 { // args ',' args
14564 if (p->error_indicator) {
14565 D(p->level--);
14566 return NULL;
14567 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014568 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014569 Token * _literal;
14570 expr_ty a;
14571 expr_ty args_var;
14572 if (
14573 (a = args_rule(p)) // args
14574 &&
14575 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14576 &&
14577 (args_var = args_rule(p)) // args
14578 )
14579 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014580 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 +010014581 _res = _PyPegen_arguments_parsing_error ( p , a );
14582 if (_res == NULL && PyErr_Occurred()) {
14583 p->error_indicator = 1;
14584 D(p->level--);
14585 return NULL;
14586 }
14587 goto done;
14588 }
14589 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014590 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014591 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
14592 }
14593 _res = NULL;
14594 done:
14595 D(p->level--);
14596 return _res;
14597}
14598
14599// invalid_kwarg: expression '='
14600static void *
14601invalid_kwarg_rule(Parser *p)
14602{
14603 D(p->level++);
14604 if (p->error_indicator) {
14605 D(p->level--);
14606 return NULL;
14607 }
14608 void * _res = NULL;
14609 int _mark = p->mark;
14610 { // expression '='
14611 if (p->error_indicator) {
14612 D(p->level--);
14613 return NULL;
14614 }
14615 D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='"));
14616 Token * _literal;
14617 expr_ty a;
14618 if (
14619 (a = expression_rule(p)) // expression
14620 &&
14621 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14622 )
14623 {
14624 D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='"));
14625 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" );
14626 if (_res == NULL && PyErr_Occurred()) {
14627 p->error_indicator = 1;
14628 D(p->level--);
14629 return NULL;
14630 }
14631 goto done;
14632 }
14633 p->mark = _mark;
14634 D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
14635 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='"));
14636 }
14637 _res = NULL;
14638 done:
14639 D(p->level--);
14640 return _res;
14641}
14642
14643// invalid_named_expression: expression ':=' expression
14644static void *
14645invalid_named_expression_rule(Parser *p)
14646{
14647 D(p->level++);
14648 if (p->error_indicator) {
14649 D(p->level--);
14650 return NULL;
14651 }
14652 void * _res = NULL;
14653 int _mark = p->mark;
14654 { // expression ':=' expression
14655 if (p->error_indicator) {
14656 D(p->level--);
14657 return NULL;
14658 }
14659 D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14660 Token * _literal;
14661 expr_ty a;
14662 expr_ty expression_var;
14663 if (
14664 (a = expression_rule(p)) // expression
14665 &&
14666 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
14667 &&
14668 (expression_var = expression_rule(p)) // expression
14669 )
14670 {
14671 D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14672 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
14673 if (_res == NULL && PyErr_Occurred()) {
14674 p->error_indicator = 1;
14675 D(p->level--);
14676 return NULL;
14677 }
14678 goto done;
14679 }
14680 p->mark = _mark;
14681 D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
14682 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
14683 }
14684 _res = NULL;
14685 done:
14686 D(p->level--);
14687 return _res;
14688}
14689
14690// invalid_assignment:
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014691// | invalid_ann_assign_target ':' expression
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014692// | star_named_expression ',' star_named_expressions* ':' expression
14693// | expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014694// | ((star_targets '='))* star_expressions '='
14695// | ((star_targets '='))* yield_expr '='
14696// | star_expressions augassign (yield_expr | star_expressions)
14697static void *
14698invalid_assignment_rule(Parser *p)
14699{
14700 D(p->level++);
14701 if (p->error_indicator) {
14702 D(p->level--);
14703 return NULL;
14704 }
14705 void * _res = NULL;
14706 int _mark = p->mark;
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014707 { // invalid_ann_assign_target ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014708 if (p->error_indicator) {
14709 D(p->level--);
14710 return NULL;
14711 }
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014712 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 +010014713 Token * _literal;
14714 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014715 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014716 if (
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014717 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014718 &&
14719 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014720 &&
14721 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014722 )
14723 {
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014724 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
14725 _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 +010014726 if (_res == NULL && PyErr_Occurred()) {
14727 p->error_indicator = 1;
14728 D(p->level--);
14729 return NULL;
14730 }
14731 goto done;
14732 }
14733 p->mark = _mark;
14734 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014735 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014736 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014737 { // star_named_expression ',' star_named_expressions* ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014738 if (p->error_indicator) {
14739 D(p->level--);
14740 return NULL;
14741 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014742 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 +010014743 Token * _literal;
14744 Token * _literal_1;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014745 asdl_seq * _loop0_128_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014746 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014747 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014748 if (
14749 (a = star_named_expression_rule(p)) // star_named_expression
14750 &&
14751 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14752 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014753 (_loop0_128_var = _loop0_128_rule(p)) // star_named_expressions*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014754 &&
14755 (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014756 &&
14757 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014758 )
14759 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014760 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 +010014761 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
14762 if (_res == NULL && PyErr_Occurred()) {
14763 p->error_indicator = 1;
14764 D(p->level--);
14765 return NULL;
14766 }
14767 goto done;
14768 }
14769 p->mark = _mark;
14770 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014771 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014772 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014773 { // expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014774 if (p->error_indicator) {
14775 D(p->level--);
14776 return NULL;
14777 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014778 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014779 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014780 expr_ty a;
14781 expr_ty expression_var;
14782 if (
14783 (a = expression_rule(p)) // expression
14784 &&
14785 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
14786 &&
14787 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014788 )
14789 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014790 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 +010014791 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
14792 if (_res == NULL && PyErr_Occurred()) {
14793 p->error_indicator = 1;
14794 D(p->level--);
14795 return NULL;
14796 }
14797 goto done;
14798 }
14799 p->mark = _mark;
14800 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014801 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014802 }
14803 { // ((star_targets '='))* star_expressions '='
14804 if (p->error_indicator) {
14805 D(p->level--);
14806 return NULL;
14807 }
14808 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14809 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014810 asdl_seq * _loop0_129_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014811 expr_ty a;
14812 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014813 (_loop0_129_var = _loop0_129_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014814 &&
14815 (a = star_expressions_rule(p)) // star_expressions
14816 &&
14817 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14818 )
14819 {
14820 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 +030014821 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014822 if (_res == NULL && PyErr_Occurred()) {
14823 p->error_indicator = 1;
14824 D(p->level--);
14825 return NULL;
14826 }
14827 goto done;
14828 }
14829 p->mark = _mark;
14830 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14831 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14832 }
14833 { // ((star_targets '='))* yield_expr '='
14834 if (p->error_indicator) {
14835 D(p->level--);
14836 return NULL;
14837 }
14838 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14839 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014840 asdl_seq * _loop0_130_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014841 expr_ty a;
14842 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014843 (_loop0_130_var = _loop0_130_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014844 &&
14845 (a = yield_expr_rule(p)) // yield_expr
14846 &&
14847 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14848 )
14849 {
14850 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14851 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
14852 if (_res == NULL && PyErr_Occurred()) {
14853 p->error_indicator = 1;
14854 D(p->level--);
14855 return NULL;
14856 }
14857 goto done;
14858 }
14859 p->mark = _mark;
14860 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14861 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14862 }
14863 { // star_expressions augassign (yield_expr | star_expressions)
14864 if (p->error_indicator) {
14865 D(p->level--);
14866 return NULL;
14867 }
14868 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 +010014869 void *_tmp_131_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014870 expr_ty a;
14871 AugOperator* augassign_var;
14872 if (
14873 (a = star_expressions_rule(p)) // star_expressions
14874 &&
14875 (augassign_var = augassign_rule(p)) // augassign
14876 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014877 (_tmp_131_var = _tmp_131_rule(p)) // yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014878 )
14879 {
14880 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14881 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
14882 if (_res == NULL && PyErr_Occurred()) {
14883 p->error_indicator = 1;
14884 D(p->level--);
14885 return NULL;
14886 }
14887 goto done;
14888 }
14889 p->mark = _mark;
14890 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14891 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14892 }
14893 _res = NULL;
14894 done:
14895 D(p->level--);
14896 return _res;
14897}
14898
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014899// invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
14900static expr_ty
14901invalid_ann_assign_target_rule(Parser *p)
14902{
14903 D(p->level++);
14904 if (p->error_indicator) {
14905 D(p->level--);
14906 return NULL;
14907 }
14908 expr_ty _res = NULL;
14909 int _mark = p->mark;
14910 { // list
14911 if (p->error_indicator) {
14912 D(p->level--);
14913 return NULL;
14914 }
14915 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
14916 expr_ty list_var;
14917 if (
14918 (list_var = list_rule(p)) // list
14919 )
14920 {
14921 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
14922 _res = list_var;
14923 goto done;
14924 }
14925 p->mark = _mark;
14926 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14927 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
14928 }
14929 { // tuple
14930 if (p->error_indicator) {
14931 D(p->level--);
14932 return NULL;
14933 }
14934 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
14935 expr_ty tuple_var;
14936 if (
14937 (tuple_var = tuple_rule(p)) // tuple
14938 )
14939 {
14940 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
14941 _res = tuple_var;
14942 goto done;
14943 }
14944 p->mark = _mark;
14945 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14946 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
14947 }
14948 { // '(' invalid_ann_assign_target ')'
14949 if (p->error_indicator) {
14950 D(p->level--);
14951 return NULL;
14952 }
14953 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14954 Token * _literal;
14955 Token * _literal_1;
14956 expr_ty a;
14957 if (
14958 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14959 &&
14960 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
14961 &&
14962 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14963 )
14964 {
14965 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14966 _res = a;
14967 if (_res == NULL && PyErr_Occurred()) {
14968 p->error_indicator = 1;
14969 D(p->level--);
14970 return NULL;
14971 }
14972 goto done;
14973 }
14974 p->mark = _mark;
14975 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14976 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14977 }
14978 _res = NULL;
14979 done:
14980 D(p->level--);
14981 return _res;
14982}
14983
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014984// invalid_del_stmt: 'del' star_expressions
14985static void *
14986invalid_del_stmt_rule(Parser *p)
14987{
14988 D(p->level++);
14989 if (p->error_indicator) {
14990 D(p->level--);
14991 return NULL;
14992 }
14993 void * _res = NULL;
14994 int _mark = p->mark;
14995 { // 'del' star_expressions
14996 if (p->error_indicator) {
14997 D(p->level--);
14998 return NULL;
14999 }
15000 D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
15001 Token * _keyword;
15002 expr_ty a;
15003 if (
15004 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
15005 &&
15006 (a = star_expressions_rule(p)) // star_expressions
15007 )
15008 {
15009 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 +030015010 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015011 if (_res == NULL && PyErr_Occurred()) {
15012 p->error_indicator = 1;
15013 D(p->level--);
15014 return NULL;
15015 }
15016 goto done;
15017 }
15018 p->mark = _mark;
15019 D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
15020 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
15021 }
15022 _res = NULL;
15023 done:
15024 D(p->level--);
15025 return _res;
15026}
15027
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015028// invalid_block: NEWLINE !INDENT
15029static void *
15030invalid_block_rule(Parser *p)
15031{
15032 D(p->level++);
15033 if (p->error_indicator) {
15034 D(p->level--);
15035 return NULL;
15036 }
15037 void * _res = NULL;
15038 int _mark = p->mark;
15039 { // NEWLINE !INDENT
15040 if (p->error_indicator) {
15041 D(p->level--);
15042 return NULL;
15043 }
15044 D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
15045 Token * newline_var;
15046 if (
15047 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15048 &&
15049 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
15050 )
15051 {
15052 D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
15053 _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
15054 if (_res == NULL && PyErr_Occurred()) {
15055 p->error_indicator = 1;
15056 D(p->level--);
15057 return NULL;
15058 }
15059 goto done;
15060 }
15061 p->mark = _mark;
15062 D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
15063 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
15064 }
15065 _res = NULL;
15066 done:
15067 D(p->level--);
15068 return _res;
15069}
15070
Lysandros Nikolaou15acc4e2020-10-27 20:54:20 +020015071// Left-recursive
15072// invalid_primary: primary '{'
15073static void *
15074invalid_primary_rule(Parser *p)
15075{
15076 D(p->level++);
15077 if (p->error_indicator) {
15078 D(p->level--);
15079 return NULL;
15080 }
15081 void * _res = NULL;
15082 int _mark = p->mark;
15083 { // primary '{'
15084 if (p->error_indicator) {
15085 D(p->level--);
15086 return NULL;
15087 }
15088 D(fprintf(stderr, "%*c> invalid_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '{'"));
15089 Token * a;
15090 expr_ty primary_var;
15091 if (
15092 (primary_var = primary_rule(p)) // primary
15093 &&
15094 (a = _PyPegen_expect_token(p, 25)) // token='{'
15095 )
15096 {
15097 D(fprintf(stderr, "%*c+ invalid_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '{'"));
15098 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "invalid syntax" );
15099 if (_res == NULL && PyErr_Occurred()) {
15100 p->error_indicator = 1;
15101 D(p->level--);
15102 return NULL;
15103 }
15104 goto done;
15105 }
15106 p->mark = _mark;
15107 D(fprintf(stderr, "%*c%s invalid_primary[%d-%d]: %s failed!\n", p->level, ' ',
15108 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '{'"));
15109 }
15110 _res = NULL;
15111 done:
15112 D(p->level--);
15113 return _res;
15114}
15115
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015116// invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses
15117static void *
15118invalid_comprehension_rule(Parser *p)
15119{
15120 D(p->level++);
15121 if (p->error_indicator) {
15122 D(p->level--);
15123 return NULL;
15124 }
15125 void * _res = NULL;
15126 int _mark = p->mark;
15127 { // ('[' | '(' | '{') starred_expression for_if_clauses
15128 if (p->error_indicator) {
15129 D(p->level--);
15130 return NULL;
15131 }
15132 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 +010015133 void *_tmp_132_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015134 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015135 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015136 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015137 (_tmp_132_var = _tmp_132_rule(p)) // '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015138 &&
15139 (a = starred_expression_rule(p)) // starred_expression
15140 &&
15141 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15142 )
15143 {
15144 D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15145 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
15146 if (_res == NULL && PyErr_Occurred()) {
15147 p->error_indicator = 1;
15148 D(p->level--);
15149 return NULL;
15150 }
15151 goto done;
15152 }
15153 p->mark = _mark;
15154 D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15155 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15156 }
15157 _res = NULL;
15158 done:
15159 D(p->level--);
15160 return _res;
15161}
15162
15163// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
15164static void *
15165invalid_dict_comprehension_rule(Parser *p)
15166{
15167 D(p->level++);
15168 if (p->error_indicator) {
15169 D(p->level--);
15170 return NULL;
15171 }
15172 void * _res = NULL;
15173 int _mark = p->mark;
15174 { // '{' '**' bitwise_or for_if_clauses '}'
15175 if (p->error_indicator) {
15176 D(p->level--);
15177 return NULL;
15178 }
15179 D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15180 Token * _literal;
15181 Token * _literal_1;
15182 Token * a;
15183 expr_ty bitwise_or_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015184 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015185 if (
15186 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
15187 &&
15188 (a = _PyPegen_expect_token(p, 35)) // token='**'
15189 &&
15190 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
15191 &&
15192 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15193 &&
15194 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
15195 )
15196 {
15197 D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15198 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
15199 if (_res == NULL && PyErr_Occurred()) {
15200 p->error_indicator = 1;
15201 D(p->level--);
15202 return NULL;
15203 }
15204 goto done;
15205 }
15206 p->mark = _mark;
15207 D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15208 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15209 }
15210 _res = NULL;
15211 done:
15212 D(p->level--);
15213 return _res;
15214}
15215
15216// invalid_parameters:
15217// | param_no_default* (slash_with_default | param_with_default+) param_no_default
15218static void *
15219invalid_parameters_rule(Parser *p)
15220{
15221 D(p->level++);
15222 if (p->error_indicator) {
15223 D(p->level--);
15224 return NULL;
15225 }
15226 void * _res = NULL;
15227 int _mark = p->mark;
15228 { // param_no_default* (slash_with_default | param_with_default+) param_no_default
15229 if (p->error_indicator) {
15230 D(p->level--);
15231 return NULL;
15232 }
15233 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 +010015234 asdl_seq * _loop0_133_var;
15235 void *_tmp_134_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015236 arg_ty param_no_default_var;
15237 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015238 (_loop0_133_var = _loop0_133_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015239 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015240 (_tmp_134_var = _tmp_134_rule(p)) // slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015241 &&
15242 (param_no_default_var = param_no_default_rule(p)) // param_no_default
15243 )
15244 {
15245 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"));
15246 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15247 if (_res == NULL && PyErr_Occurred()) {
15248 p->error_indicator = 1;
15249 D(p->level--);
15250 return NULL;
15251 }
15252 goto done;
15253 }
15254 p->mark = _mark;
15255 D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15256 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
15257 }
15258 _res = NULL;
15259 done:
15260 D(p->level--);
15261 return _res;
15262}
15263
15264// invalid_lambda_parameters:
15265// | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15266static void *
15267invalid_lambda_parameters_rule(Parser *p)
15268{
15269 D(p->level++);
15270 if (p->error_indicator) {
15271 D(p->level--);
15272 return NULL;
15273 }
15274 void * _res = NULL;
15275 int _mark = p->mark;
15276 { // lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15277 if (p->error_indicator) {
15278 D(p->level--);
15279 return NULL;
15280 }
15281 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 +010015282 asdl_seq * _loop0_135_var;
15283 void *_tmp_136_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015284 arg_ty lambda_param_no_default_var;
15285 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015286 (_loop0_135_var = _loop0_135_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015287 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015288 (_tmp_136_var = _tmp_136_rule(p)) // lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015289 &&
15290 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
15291 )
15292 {
15293 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"));
15294 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15295 if (_res == NULL && PyErr_Occurred()) {
15296 p->error_indicator = 1;
15297 D(p->level--);
15298 return NULL;
15299 }
15300 goto done;
15301 }
15302 p->mark = _mark;
15303 D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15304 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
15305 }
15306 _res = NULL;
15307 done:
15308 D(p->level--);
15309 return _res;
15310}
15311
15312// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT
15313static void *
15314invalid_star_etc_rule(Parser *p)
15315{
15316 D(p->level++);
15317 if (p->error_indicator) {
15318 D(p->level--);
15319 return NULL;
15320 }
15321 void * _res = NULL;
15322 int _mark = p->mark;
15323 { // '*' (')' | ',' (')' | '**'))
15324 if (p->error_indicator) {
15325 D(p->level--);
15326 return NULL;
15327 }
15328 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15329 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015330 void *_tmp_137_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015331 if (
15332 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15333 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015334 (_tmp_137_var = _tmp_137_rule(p)) // ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015335 )
15336 {
15337 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15338 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15339 if (_res == NULL && PyErr_Occurred()) {
15340 p->error_indicator = 1;
15341 D(p->level--);
15342 return NULL;
15343 }
15344 goto done;
15345 }
15346 p->mark = _mark;
15347 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15348 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15349 }
15350 { // '*' ',' TYPE_COMMENT
15351 if (p->error_indicator) {
15352 D(p->level--);
15353 return NULL;
15354 }
15355 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15356 Token * _literal;
15357 Token * _literal_1;
15358 Token * type_comment_var;
15359 if (
15360 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15361 &&
15362 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
15363 &&
15364 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15365 )
15366 {
15367 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15368 _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
15369 if (_res == NULL && PyErr_Occurred()) {
15370 p->error_indicator = 1;
15371 D(p->level--);
15372 return NULL;
15373 }
15374 goto done;
15375 }
15376 p->mark = _mark;
15377 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15378 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15379 }
15380 _res = NULL;
15381 done:
15382 D(p->level--);
15383 return _res;
15384}
15385
15386// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**'))
15387static void *
15388invalid_lambda_star_etc_rule(Parser *p)
15389{
15390 D(p->level++);
15391 if (p->error_indicator) {
15392 D(p->level--);
15393 return NULL;
15394 }
15395 void * _res = NULL;
15396 int _mark = p->mark;
15397 { // '*' (':' | ',' (':' | '**'))
15398 if (p->error_indicator) {
15399 D(p->level--);
15400 return NULL;
15401 }
15402 D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15403 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015404 void *_tmp_138_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015405 if (
15406 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15407 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015408 (_tmp_138_var = _tmp_138_rule(p)) // ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015409 )
15410 {
15411 D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15412 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15413 if (_res == NULL && PyErr_Occurred()) {
15414 p->error_indicator = 1;
15415 D(p->level--);
15416 return NULL;
15417 }
15418 goto done;
15419 }
15420 p->mark = _mark;
15421 D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15422 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15423 }
15424 _res = NULL;
15425 done:
15426 D(p->level--);
15427 return _res;
15428}
15429
15430// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15431static void *
15432invalid_double_type_comments_rule(Parser *p)
15433{
15434 D(p->level++);
15435 if (p->error_indicator) {
15436 D(p->level--);
15437 return NULL;
15438 }
15439 void * _res = NULL;
15440 int _mark = p->mark;
15441 { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15442 if (p->error_indicator) {
15443 D(p->level--);
15444 return NULL;
15445 }
15446 D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15447 Token * indent_var;
15448 Token * newline_var;
15449 Token * newline_var_1;
15450 Token * type_comment_var;
15451 Token * type_comment_var_1;
15452 if (
15453 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15454 &&
15455 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15456 &&
15457 (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15458 &&
15459 (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15460 &&
15461 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
15462 )
15463 {
15464 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"));
15465 _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
15466 if (_res == NULL && PyErr_Occurred()) {
15467 p->error_indicator = 1;
15468 D(p->level--);
15469 return NULL;
15470 }
15471 goto done;
15472 }
15473 p->mark = _mark;
15474 D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
15475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15476 }
15477 _res = NULL;
15478 done:
15479 D(p->level--);
15480 return _res;
15481}
15482
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015483// invalid_with_item: expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015484static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015485invalid_with_item_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015486{
15487 D(p->level++);
15488 if (p->error_indicator) {
15489 D(p->level--);
15490 return NULL;
15491 }
15492 void * _res = NULL;
15493 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015494 { // expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015495 if (p->error_indicator) {
15496 D(p->level--);
15497 return NULL;
15498 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015499 D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression"));
15500 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015501 expr_ty a;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015502 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015503 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015504 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015505 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015506 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
15507 &&
15508 (a = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015509 )
15510 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015511 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 +030015512 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015513 if (_res == NULL && PyErr_Occurred()) {
15514 p->error_indicator = 1;
15515 D(p->level--);
15516 return NULL;
15517 }
15518 goto done;
15519 }
15520 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015521 D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
15522 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression"));
15523 }
15524 _res = NULL;
15525 done:
15526 D(p->level--);
15527 return _res;
15528}
15529
15530// invalid_for_target: ASYNC? 'for' star_expressions
15531static void *
15532invalid_for_target_rule(Parser *p)
15533{
15534 D(p->level++);
15535 if (p->error_indicator) {
15536 D(p->level--);
15537 return NULL;
15538 }
15539 void * _res = NULL;
15540 int _mark = p->mark;
15541 { // ASYNC? 'for' star_expressions
15542 if (p->error_indicator) {
15543 D(p->level--);
15544 return NULL;
15545 }
15546 D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
15547 Token * _keyword;
15548 void *_opt_var;
15549 UNUSED(_opt_var); // Silence compiler warnings
15550 expr_ty a;
15551 if (
15552 (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
15553 &&
15554 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
15555 &&
15556 (a = star_expressions_rule(p)) // star_expressions
15557 )
15558 {
15559 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 +030015560 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015561 if (_res == NULL && PyErr_Occurred()) {
15562 p->error_indicator = 1;
15563 D(p->level--);
15564 return NULL;
15565 }
15566 goto done;
15567 }
15568 p->mark = _mark;
15569 D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
15570 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions"));
15571 }
15572 _res = NULL;
15573 done:
15574 D(p->level--);
15575 return _res;
15576}
15577
15578// invalid_group: '(' starred_expression ')'
15579static void *
15580invalid_group_rule(Parser *p)
15581{
15582 D(p->level++);
15583 if (p->error_indicator) {
15584 D(p->level--);
15585 return NULL;
15586 }
15587 void * _res = NULL;
15588 int _mark = p->mark;
15589 { // '(' starred_expression ')'
15590 if (p->error_indicator) {
15591 D(p->level--);
15592 return NULL;
15593 }
15594 D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15595 Token * _literal;
15596 Token * _literal_1;
15597 expr_ty a;
15598 if (
15599 (_literal = _PyPegen_expect_token(p, 7)) // token='('
15600 &&
15601 (a = starred_expression_rule(p)) // starred_expression
15602 &&
15603 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
15604 )
15605 {
15606 D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15607 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "can't use starred expression here" );
15608 if (_res == NULL && PyErr_Occurred()) {
15609 p->error_indicator = 1;
15610 D(p->level--);
15611 return NULL;
15612 }
15613 goto done;
15614 }
15615 p->mark = _mark;
15616 D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
15617 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015618 }
15619 _res = NULL;
15620 done:
15621 D(p->level--);
15622 return _res;
15623}
15624
15625// invalid_import_from_targets: import_from_as_names ','
15626static void *
15627invalid_import_from_targets_rule(Parser *p)
15628{
15629 D(p->level++);
15630 if (p->error_indicator) {
15631 D(p->level--);
15632 return NULL;
15633 }
15634 void * _res = NULL;
15635 int _mark = p->mark;
15636 { // import_from_as_names ','
15637 if (p->error_indicator) {
15638 D(p->level--);
15639 return NULL;
15640 }
15641 D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15642 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015643 asdl_alias_seq* import_from_as_names_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015644 if (
15645 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
15646 &&
15647 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15648 )
15649 {
15650 D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15651 _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
15652 if (_res == NULL && PyErr_Occurred()) {
15653 p->error_indicator = 1;
15654 D(p->level--);
15655 return NULL;
15656 }
15657 goto done;
15658 }
15659 p->mark = _mark;
15660 D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
15661 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','"));
15662 }
15663 _res = NULL;
15664 done:
15665 D(p->level--);
15666 return _res;
15667}
15668
15669// _loop0_1: NEWLINE
15670static asdl_seq *
15671_loop0_1_rule(Parser *p)
15672{
15673 D(p->level++);
15674 if (p->error_indicator) {
15675 D(p->level--);
15676 return NULL;
15677 }
15678 void *_res = NULL;
15679 int _mark = p->mark;
15680 int _start_mark = p->mark;
15681 void **_children = PyMem_Malloc(sizeof(void *));
15682 if (!_children) {
15683 p->error_indicator = 1;
15684 PyErr_NoMemory();
15685 D(p->level--);
15686 return NULL;
15687 }
15688 ssize_t _children_capacity = 1;
15689 ssize_t _n = 0;
15690 { // NEWLINE
15691 if (p->error_indicator) {
15692 D(p->level--);
15693 return NULL;
15694 }
15695 D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15696 Token * newline_var;
15697 while (
15698 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15699 )
15700 {
15701 _res = newline_var;
15702 if (_n == _children_capacity) {
15703 _children_capacity *= 2;
15704 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15705 if (!_new_children) {
15706 p->error_indicator = 1;
15707 PyErr_NoMemory();
15708 D(p->level--);
15709 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015710 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015711 _children = _new_children;
15712 }
15713 _children[_n++] = _res;
15714 _mark = p->mark;
15715 }
15716 p->mark = _mark;
15717 D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
15718 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15719 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015720 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015721 if (!_seq) {
15722 PyMem_Free(_children);
15723 p->error_indicator = 1;
15724 PyErr_NoMemory();
15725 D(p->level--);
15726 return NULL;
15727 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015728 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015729 PyMem_Free(_children);
15730 _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq);
15731 D(p->level--);
15732 return _seq;
15733}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015734
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015735// _loop0_2: NEWLINE
15736static asdl_seq *
15737_loop0_2_rule(Parser *p)
15738{
15739 D(p->level++);
15740 if (p->error_indicator) {
15741 D(p->level--);
15742 return NULL;
15743 }
15744 void *_res = NULL;
15745 int _mark = p->mark;
15746 int _start_mark = p->mark;
15747 void **_children = PyMem_Malloc(sizeof(void *));
15748 if (!_children) {
15749 p->error_indicator = 1;
15750 PyErr_NoMemory();
15751 D(p->level--);
15752 return NULL;
15753 }
15754 ssize_t _children_capacity = 1;
15755 ssize_t _n = 0;
15756 { // NEWLINE
15757 if (p->error_indicator) {
15758 D(p->level--);
15759 return NULL;
15760 }
15761 D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15762 Token * newline_var;
15763 while (
15764 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15765 )
15766 {
15767 _res = newline_var;
15768 if (_n == _children_capacity) {
15769 _children_capacity *= 2;
15770 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15771 if (!_new_children) {
15772 p->error_indicator = 1;
15773 PyErr_NoMemory();
15774 D(p->level--);
15775 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015776 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015777 _children = _new_children;
15778 }
15779 _children[_n++] = _res;
15780 _mark = p->mark;
15781 }
15782 p->mark = _mark;
15783 D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
15784 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15785 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015786 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015787 if (!_seq) {
15788 PyMem_Free(_children);
15789 p->error_indicator = 1;
15790 PyErr_NoMemory();
15791 D(p->level--);
15792 return NULL;
15793 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015794 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015795 PyMem_Free(_children);
15796 _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq);
15797 D(p->level--);
15798 return _seq;
15799}
15800
15801// _loop0_4: ',' expression
15802static asdl_seq *
15803_loop0_4_rule(Parser *p)
15804{
15805 D(p->level++);
15806 if (p->error_indicator) {
15807 D(p->level--);
15808 return NULL;
15809 }
15810 void *_res = NULL;
15811 int _mark = p->mark;
15812 int _start_mark = p->mark;
15813 void **_children = PyMem_Malloc(sizeof(void *));
15814 if (!_children) {
15815 p->error_indicator = 1;
15816 PyErr_NoMemory();
15817 D(p->level--);
15818 return NULL;
15819 }
15820 ssize_t _children_capacity = 1;
15821 ssize_t _n = 0;
15822 { // ',' expression
15823 if (p->error_indicator) {
15824 D(p->level--);
15825 return NULL;
15826 }
15827 D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15828 Token * _literal;
15829 expr_ty elem;
15830 while (
15831 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15832 &&
15833 (elem = expression_rule(p)) // expression
15834 )
15835 {
15836 _res = elem;
15837 if (_res == NULL && PyErr_Occurred()) {
15838 p->error_indicator = 1;
15839 PyMem_Free(_children);
15840 D(p->level--);
15841 return NULL;
15842 }
15843 if (_n == _children_capacity) {
15844 _children_capacity *= 2;
15845 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15846 if (!_new_children) {
15847 p->error_indicator = 1;
15848 PyErr_NoMemory();
15849 D(p->level--);
15850 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015851 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015852 _children = _new_children;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015853 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015854 _children[_n++] = _res;
15855 _mark = p->mark;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015856 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015857 p->mark = _mark;
15858 D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
15859 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015860 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015861 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015862 if (!_seq) {
15863 PyMem_Free(_children);
15864 p->error_indicator = 1;
15865 PyErr_NoMemory();
15866 D(p->level--);
15867 return NULL;
15868 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015869 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015870 PyMem_Free(_children);
15871 _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
15872 D(p->level--);
15873 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015874}
15875
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015876// _gather_3: expression _loop0_4
15877static asdl_seq *
15878_gather_3_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015879{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015880 D(p->level++);
15881 if (p->error_indicator) {
15882 D(p->level--);
15883 return NULL;
15884 }
15885 asdl_seq * _res = NULL;
15886 int _mark = p->mark;
15887 { // expression _loop0_4
15888 if (p->error_indicator) {
15889 D(p->level--);
15890 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015891 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015892 D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15893 expr_ty elem;
15894 asdl_seq * seq;
15895 if (
15896 (elem = expression_rule(p)) // expression
15897 &&
15898 (seq = _loop0_4_rule(p)) // _loop0_4
15899 )
15900 {
15901 D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15902 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15903 goto done;
15904 }
15905 p->mark = _mark;
15906 D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ',
15907 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015908 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015909 _res = NULL;
15910 done:
15911 D(p->level--);
15912 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015913}
15914
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015915// _loop0_6: ',' expression
15916static asdl_seq *
15917_loop0_6_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015918{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015919 D(p->level++);
15920 if (p->error_indicator) {
15921 D(p->level--);
15922 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015923 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015924 void *_res = NULL;
15925 int _mark = p->mark;
15926 int _start_mark = p->mark;
15927 void **_children = PyMem_Malloc(sizeof(void *));
15928 if (!_children) {
15929 p->error_indicator = 1;
15930 PyErr_NoMemory();
15931 D(p->level--);
15932 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015933 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015934 ssize_t _children_capacity = 1;
15935 ssize_t _n = 0;
15936 { // ',' expression
15937 if (p->error_indicator) {
15938 D(p->level--);
15939 return NULL;
15940 }
15941 D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15942 Token * _literal;
15943 expr_ty elem;
15944 while (
15945 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15946 &&
15947 (elem = expression_rule(p)) // expression
15948 )
15949 {
15950 _res = elem;
15951 if (_res == NULL && PyErr_Occurred()) {
15952 p->error_indicator = 1;
15953 PyMem_Free(_children);
15954 D(p->level--);
15955 return NULL;
15956 }
15957 if (_n == _children_capacity) {
15958 _children_capacity *= 2;
15959 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15960 if (!_new_children) {
15961 p->error_indicator = 1;
15962 PyErr_NoMemory();
15963 D(p->level--);
15964 return NULL;
15965 }
15966 _children = _new_children;
15967 }
15968 _children[_n++] = _res;
15969 _mark = p->mark;
15970 }
15971 p->mark = _mark;
15972 D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
15973 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
15974 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015975 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015976 if (!_seq) {
15977 PyMem_Free(_children);
15978 p->error_indicator = 1;
15979 PyErr_NoMemory();
15980 D(p->level--);
15981 return NULL;
15982 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015983 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015984 PyMem_Free(_children);
15985 _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
15986 D(p->level--);
15987 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015988}
15989
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015990// _gather_5: expression _loop0_6
15991static asdl_seq *
15992_gather_5_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015993{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015994 D(p->level++);
15995 if (p->error_indicator) {
15996 D(p->level--);
15997 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015998 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015999 asdl_seq * _res = NULL;
16000 int _mark = p->mark;
16001 { // expression _loop0_6
16002 if (p->error_indicator) {
16003 D(p->level--);
16004 return NULL;
16005 }
16006 D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
16007 expr_ty elem;
16008 asdl_seq * seq;
16009 if (
16010 (elem = expression_rule(p)) // expression
16011 &&
16012 (seq = _loop0_6_rule(p)) // _loop0_6
16013 )
16014 {
16015 D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
16016 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16017 goto done;
16018 }
16019 p->mark = _mark;
16020 D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ',
16021 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6"));
16022 }
16023 _res = NULL;
16024 done:
16025 D(p->level--);
16026 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016027}
16028
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016029// _loop0_8: ',' expression
16030static asdl_seq *
16031_loop0_8_rule(Parser *p)
16032{
16033 D(p->level++);
16034 if (p->error_indicator) {
16035 D(p->level--);
16036 return NULL;
16037 }
16038 void *_res = NULL;
16039 int _mark = p->mark;
16040 int _start_mark = p->mark;
16041 void **_children = PyMem_Malloc(sizeof(void *));
16042 if (!_children) {
16043 p->error_indicator = 1;
16044 PyErr_NoMemory();
16045 D(p->level--);
16046 return NULL;
16047 }
16048 ssize_t _children_capacity = 1;
16049 ssize_t _n = 0;
16050 { // ',' expression
16051 if (p->error_indicator) {
16052 D(p->level--);
16053 return NULL;
16054 }
16055 D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
16056 Token * _literal;
16057 expr_ty elem;
16058 while (
16059 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16060 &&
16061 (elem = expression_rule(p)) // expression
16062 )
16063 {
16064 _res = elem;
16065 if (_res == NULL && PyErr_Occurred()) {
16066 p->error_indicator = 1;
16067 PyMem_Free(_children);
16068 D(p->level--);
16069 return NULL;
16070 }
16071 if (_n == _children_capacity) {
16072 _children_capacity *= 2;
16073 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16074 if (!_new_children) {
16075 p->error_indicator = 1;
16076 PyErr_NoMemory();
16077 D(p->level--);
16078 return NULL;
16079 }
16080 _children = _new_children;
16081 }
16082 _children[_n++] = _res;
16083 _mark = p->mark;
16084 }
16085 p->mark = _mark;
16086 D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
16087 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16088 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016089 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016090 if (!_seq) {
16091 PyMem_Free(_children);
16092 p->error_indicator = 1;
16093 PyErr_NoMemory();
16094 D(p->level--);
16095 return NULL;
16096 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016097 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016098 PyMem_Free(_children);
16099 _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
16100 D(p->level--);
16101 return _seq;
16102}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016103
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016104// _gather_7: expression _loop0_8
16105static asdl_seq *
16106_gather_7_rule(Parser *p)
16107{
16108 D(p->level++);
16109 if (p->error_indicator) {
16110 D(p->level--);
16111 return NULL;
16112 }
16113 asdl_seq * _res = NULL;
16114 int _mark = p->mark;
16115 { // expression _loop0_8
16116 if (p->error_indicator) {
16117 D(p->level--);
16118 return NULL;
16119 }
16120 D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16121 expr_ty elem;
16122 asdl_seq * seq;
16123 if (
16124 (elem = expression_rule(p)) // expression
16125 &&
16126 (seq = _loop0_8_rule(p)) // _loop0_8
16127 )
16128 {
16129 D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16130 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16131 goto done;
16132 }
16133 p->mark = _mark;
16134 D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ',
16135 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8"));
16136 }
16137 _res = NULL;
16138 done:
16139 D(p->level--);
16140 return _res;
16141}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016142
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016143// _loop0_10: ',' expression
16144static asdl_seq *
16145_loop0_10_rule(Parser *p)
16146{
16147 D(p->level++);
16148 if (p->error_indicator) {
16149 D(p->level--);
16150 return NULL;
16151 }
16152 void *_res = NULL;
16153 int _mark = p->mark;
16154 int _start_mark = p->mark;
16155 void **_children = PyMem_Malloc(sizeof(void *));
16156 if (!_children) {
16157 p->error_indicator = 1;
16158 PyErr_NoMemory();
16159 D(p->level--);
16160 return NULL;
16161 }
16162 ssize_t _children_capacity = 1;
16163 ssize_t _n = 0;
16164 { // ',' expression
16165 if (p->error_indicator) {
16166 D(p->level--);
16167 return NULL;
16168 }
16169 D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
16170 Token * _literal;
16171 expr_ty elem;
16172 while (
16173 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16174 &&
16175 (elem = expression_rule(p)) // expression
16176 )
16177 {
16178 _res = elem;
16179 if (_res == NULL && PyErr_Occurred()) {
16180 p->error_indicator = 1;
16181 PyMem_Free(_children);
16182 D(p->level--);
16183 return NULL;
16184 }
16185 if (_n == _children_capacity) {
16186 _children_capacity *= 2;
16187 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16188 if (!_new_children) {
16189 p->error_indicator = 1;
16190 PyErr_NoMemory();
16191 D(p->level--);
16192 return NULL;
16193 }
16194 _children = _new_children;
16195 }
16196 _children[_n++] = _res;
16197 _mark = p->mark;
16198 }
16199 p->mark = _mark;
16200 D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
16201 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16202 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016203 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016204 if (!_seq) {
16205 PyMem_Free(_children);
16206 p->error_indicator = 1;
16207 PyErr_NoMemory();
16208 D(p->level--);
16209 return NULL;
16210 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016211 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016212 PyMem_Free(_children);
16213 _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
16214 D(p->level--);
16215 return _seq;
16216}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016217
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016218// _gather_9: expression _loop0_10
16219static asdl_seq *
16220_gather_9_rule(Parser *p)
16221{
16222 D(p->level++);
16223 if (p->error_indicator) {
16224 D(p->level--);
16225 return NULL;
16226 }
16227 asdl_seq * _res = NULL;
16228 int _mark = p->mark;
16229 { // expression _loop0_10
16230 if (p->error_indicator) {
16231 D(p->level--);
16232 return NULL;
16233 }
16234 D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16235 expr_ty elem;
16236 asdl_seq * seq;
16237 if (
16238 (elem = expression_rule(p)) // expression
16239 &&
16240 (seq = _loop0_10_rule(p)) // _loop0_10
16241 )
16242 {
16243 D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16244 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16245 goto done;
16246 }
16247 p->mark = _mark;
16248 D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ',
16249 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10"));
16250 }
16251 _res = NULL;
16252 done:
16253 D(p->level--);
16254 return _res;
16255}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016256
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016257// _loop1_11: statement
16258static asdl_seq *
16259_loop1_11_rule(Parser *p)
16260{
16261 D(p->level++);
16262 if (p->error_indicator) {
16263 D(p->level--);
16264 return NULL;
16265 }
16266 void *_res = NULL;
16267 int _mark = p->mark;
16268 int _start_mark = p->mark;
16269 void **_children = PyMem_Malloc(sizeof(void *));
16270 if (!_children) {
16271 p->error_indicator = 1;
16272 PyErr_NoMemory();
16273 D(p->level--);
16274 return NULL;
16275 }
16276 ssize_t _children_capacity = 1;
16277 ssize_t _n = 0;
16278 { // statement
16279 if (p->error_indicator) {
16280 D(p->level--);
16281 return NULL;
16282 }
16283 D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010016284 asdl_stmt_seq* statement_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016285 while (
16286 (statement_var = statement_rule(p)) // statement
16287 )
16288 {
16289 _res = statement_var;
16290 if (_n == _children_capacity) {
16291 _children_capacity *= 2;
16292 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16293 if (!_new_children) {
16294 p->error_indicator = 1;
16295 PyErr_NoMemory();
16296 D(p->level--);
16297 return NULL;
16298 }
16299 _children = _new_children;
16300 }
16301 _children[_n++] = _res;
16302 _mark = p->mark;
16303 }
16304 p->mark = _mark;
16305 D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ',
16306 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
16307 }
16308 if (_n == 0 || p->error_indicator) {
16309 PyMem_Free(_children);
16310 D(p->level--);
16311 return NULL;
16312 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016313 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016314 if (!_seq) {
16315 PyMem_Free(_children);
16316 p->error_indicator = 1;
16317 PyErr_NoMemory();
16318 D(p->level--);
16319 return NULL;
16320 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016321 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016322 PyMem_Free(_children);
16323 _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
16324 D(p->level--);
16325 return _seq;
16326}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016327
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016328// _loop0_13: ';' small_stmt
16329static asdl_seq *
16330_loop0_13_rule(Parser *p)
16331{
16332 D(p->level++);
16333 if (p->error_indicator) {
16334 D(p->level--);
16335 return NULL;
16336 }
16337 void *_res = NULL;
16338 int _mark = p->mark;
16339 int _start_mark = p->mark;
16340 void **_children = PyMem_Malloc(sizeof(void *));
16341 if (!_children) {
16342 p->error_indicator = 1;
16343 PyErr_NoMemory();
16344 D(p->level--);
16345 return NULL;
16346 }
16347 ssize_t _children_capacity = 1;
16348 ssize_t _n = 0;
16349 { // ';' small_stmt
16350 if (p->error_indicator) {
16351 D(p->level--);
16352 return NULL;
16353 }
16354 D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt"));
16355 Token * _literal;
16356 stmt_ty elem;
16357 while (
16358 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
16359 &&
16360 (elem = small_stmt_rule(p)) // small_stmt
16361 )
16362 {
16363 _res = elem;
16364 if (_res == NULL && PyErr_Occurred()) {
16365 p->error_indicator = 1;
16366 PyMem_Free(_children);
16367 D(p->level--);
16368 return NULL;
16369 }
16370 if (_n == _children_capacity) {
16371 _children_capacity *= 2;
16372 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16373 if (!_new_children) {
16374 p->error_indicator = 1;
16375 PyErr_NoMemory();
16376 D(p->level--);
16377 return NULL;
16378 }
16379 _children = _new_children;
16380 }
16381 _children[_n++] = _res;
16382 _mark = p->mark;
16383 }
16384 p->mark = _mark;
16385 D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
16386 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt"));
16387 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016388 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016389 if (!_seq) {
16390 PyMem_Free(_children);
16391 p->error_indicator = 1;
16392 PyErr_NoMemory();
16393 D(p->level--);
16394 return NULL;
16395 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016396 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016397 PyMem_Free(_children);
16398 _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
16399 D(p->level--);
16400 return _seq;
16401}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016402
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016403// _gather_12: small_stmt _loop0_13
16404static asdl_seq *
16405_gather_12_rule(Parser *p)
16406{
16407 D(p->level++);
16408 if (p->error_indicator) {
16409 D(p->level--);
16410 return NULL;
16411 }
16412 asdl_seq * _res = NULL;
16413 int _mark = p->mark;
16414 { // small_stmt _loop0_13
16415 if (p->error_indicator) {
16416 D(p->level--);
16417 return NULL;
16418 }
16419 D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16420 stmt_ty elem;
16421 asdl_seq * seq;
16422 if (
16423 (elem = small_stmt_rule(p)) // small_stmt
16424 &&
16425 (seq = _loop0_13_rule(p)) // _loop0_13
16426 )
16427 {
16428 D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16429 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16430 goto done;
16431 }
16432 p->mark = _mark;
16433 D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ',
16434 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13"));
16435 }
16436 _res = NULL;
16437 done:
16438 D(p->level--);
16439 return _res;
16440}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016441
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016442// _tmp_14: 'import' | 'from'
16443static void *
16444_tmp_14_rule(Parser *p)
16445{
16446 D(p->level++);
16447 if (p->error_indicator) {
16448 D(p->level--);
16449 return NULL;
16450 }
16451 void * _res = NULL;
16452 int _mark = p->mark;
16453 { // 'import'
16454 if (p->error_indicator) {
16455 D(p->level--);
16456 return NULL;
16457 }
16458 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
16459 Token * _keyword;
16460 if (
16461 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
16462 )
16463 {
16464 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
16465 _res = _keyword;
16466 goto done;
16467 }
16468 p->mark = _mark;
16469 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16470 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
16471 }
16472 { // 'from'
16473 if (p->error_indicator) {
16474 D(p->level--);
16475 return NULL;
16476 }
16477 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
16478 Token * _keyword;
16479 if (
16480 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
16481 )
16482 {
16483 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
16484 _res = _keyword;
16485 goto done;
16486 }
16487 p->mark = _mark;
16488 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16489 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
16490 }
16491 _res = NULL;
16492 done:
16493 D(p->level--);
16494 return _res;
16495}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016496
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016497// _tmp_15: 'def' | '@' | ASYNC
16498static void *
16499_tmp_15_rule(Parser *p)
16500{
16501 D(p->level++);
16502 if (p->error_indicator) {
16503 D(p->level--);
16504 return NULL;
16505 }
16506 void * _res = NULL;
16507 int _mark = p->mark;
16508 { // 'def'
16509 if (p->error_indicator) {
16510 D(p->level--);
16511 return NULL;
16512 }
16513 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
16514 Token * _keyword;
16515 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016516 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016517 )
16518 {
16519 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
16520 _res = _keyword;
16521 goto done;
16522 }
16523 p->mark = _mark;
16524 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16525 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
16526 }
16527 { // '@'
16528 if (p->error_indicator) {
16529 D(p->level--);
16530 return NULL;
16531 }
16532 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16533 Token * _literal;
16534 if (
16535 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16536 )
16537 {
16538 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16539 _res = _literal;
16540 goto done;
16541 }
16542 p->mark = _mark;
16543 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16544 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16545 }
16546 { // ASYNC
16547 if (p->error_indicator) {
16548 D(p->level--);
16549 return NULL;
16550 }
16551 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16552 Token * async_var;
16553 if (
16554 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16555 )
16556 {
16557 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16558 _res = async_var;
16559 goto done;
16560 }
16561 p->mark = _mark;
16562 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16563 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16564 }
16565 _res = NULL;
16566 done:
16567 D(p->level--);
16568 return _res;
16569}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016570
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016571// _tmp_16: 'class' | '@'
16572static void *
16573_tmp_16_rule(Parser *p)
16574{
16575 D(p->level++);
16576 if (p->error_indicator) {
16577 D(p->level--);
16578 return NULL;
16579 }
16580 void * _res = NULL;
16581 int _mark = p->mark;
16582 { // 'class'
16583 if (p->error_indicator) {
16584 D(p->level--);
16585 return NULL;
16586 }
16587 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
16588 Token * _keyword;
16589 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016590 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016591 )
16592 {
16593 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
16594 _res = _keyword;
16595 goto done;
16596 }
16597 p->mark = _mark;
16598 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16599 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
16600 }
16601 { // '@'
16602 if (p->error_indicator) {
16603 D(p->level--);
16604 return NULL;
16605 }
16606 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16607 Token * _literal;
16608 if (
16609 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16610 )
16611 {
16612 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16613 _res = _literal;
16614 goto done;
16615 }
16616 p->mark = _mark;
16617 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16618 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16619 }
16620 _res = NULL;
16621 done:
16622 D(p->level--);
16623 return _res;
16624}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016625
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016626// _tmp_17: 'with' | ASYNC
16627static void *
16628_tmp_17_rule(Parser *p)
16629{
16630 D(p->level++);
16631 if (p->error_indicator) {
16632 D(p->level--);
16633 return NULL;
16634 }
16635 void * _res = NULL;
16636 int _mark = p->mark;
16637 { // 'with'
16638 if (p->error_indicator) {
16639 D(p->level--);
16640 return NULL;
16641 }
16642 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
16643 Token * _keyword;
16644 if (
16645 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
16646 )
16647 {
16648 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
16649 _res = _keyword;
16650 goto done;
16651 }
16652 p->mark = _mark;
16653 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16654 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
16655 }
16656 { // ASYNC
16657 if (p->error_indicator) {
16658 D(p->level--);
16659 return NULL;
16660 }
16661 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16662 Token * async_var;
16663 if (
16664 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16665 )
16666 {
16667 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16668 _res = async_var;
16669 goto done;
16670 }
16671 p->mark = _mark;
16672 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16673 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16674 }
16675 _res = NULL;
16676 done:
16677 D(p->level--);
16678 return _res;
16679}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016680
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016681// _tmp_18: 'for' | ASYNC
16682static void *
16683_tmp_18_rule(Parser *p)
16684{
16685 D(p->level++);
16686 if (p->error_indicator) {
16687 D(p->level--);
16688 return NULL;
16689 }
16690 void * _res = NULL;
16691 int _mark = p->mark;
16692 { // 'for'
16693 if (p->error_indicator) {
16694 D(p->level--);
16695 return NULL;
16696 }
16697 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
16698 Token * _keyword;
16699 if (
16700 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
16701 )
16702 {
16703 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
16704 _res = _keyword;
16705 goto done;
16706 }
16707 p->mark = _mark;
16708 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16709 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
16710 }
16711 { // ASYNC
16712 if (p->error_indicator) {
16713 D(p->level--);
16714 return NULL;
16715 }
16716 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16717 Token * async_var;
16718 if (
16719 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16720 )
16721 {
16722 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16723 _res = async_var;
16724 goto done;
16725 }
16726 p->mark = _mark;
16727 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16728 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16729 }
16730 _res = NULL;
16731 done:
16732 D(p->level--);
16733 return _res;
16734}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016735
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016736// _tmp_19: '=' annotated_rhs
16737static void *
16738_tmp_19_rule(Parser *p)
16739{
16740 D(p->level++);
16741 if (p->error_indicator) {
16742 D(p->level--);
16743 return NULL;
16744 }
16745 void * _res = NULL;
16746 int _mark = p->mark;
16747 { // '=' annotated_rhs
16748 if (p->error_indicator) {
16749 D(p->level--);
16750 return NULL;
16751 }
16752 D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16753 Token * _literal;
16754 expr_ty d;
16755 if (
16756 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16757 &&
16758 (d = annotated_rhs_rule(p)) // annotated_rhs
16759 )
16760 {
16761 D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16762 _res = d;
16763 if (_res == NULL && PyErr_Occurred()) {
16764 p->error_indicator = 1;
16765 D(p->level--);
16766 return NULL;
16767 }
16768 goto done;
16769 }
16770 p->mark = _mark;
16771 D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ',
16772 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16773 }
16774 _res = NULL;
16775 done:
16776 D(p->level--);
16777 return _res;
16778}
16779
16780// _tmp_20: '(' single_target ')' | single_subscript_attribute_target
16781static void *
16782_tmp_20_rule(Parser *p)
16783{
16784 D(p->level++);
16785 if (p->error_indicator) {
16786 D(p->level--);
16787 return NULL;
16788 }
16789 void * _res = NULL;
16790 int _mark = p->mark;
16791 { // '(' single_target ')'
16792 if (p->error_indicator) {
16793 D(p->level--);
16794 return NULL;
16795 }
16796 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16797 Token * _literal;
16798 Token * _literal_1;
16799 expr_ty b;
16800 if (
16801 (_literal = _PyPegen_expect_token(p, 7)) // token='('
16802 &&
16803 (b = single_target_rule(p)) // single_target
16804 &&
16805 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
16806 )
16807 {
16808 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16809 _res = b;
16810 if (_res == NULL && PyErr_Occurred()) {
16811 p->error_indicator = 1;
16812 D(p->level--);
16813 return NULL;
16814 }
16815 goto done;
16816 }
16817 p->mark = _mark;
16818 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16819 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
16820 }
16821 { // single_subscript_attribute_target
16822 if (p->error_indicator) {
16823 D(p->level--);
16824 return NULL;
16825 }
16826 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16827 expr_ty single_subscript_attribute_target_var;
16828 if (
16829 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
16830 )
16831 {
16832 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16833 _res = single_subscript_attribute_target_var;
16834 goto done;
16835 }
16836 p->mark = _mark;
16837 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16838 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
16839 }
16840 _res = NULL;
16841 done:
16842 D(p->level--);
16843 return _res;
16844}
16845
16846// _tmp_21: '=' annotated_rhs
16847static void *
16848_tmp_21_rule(Parser *p)
16849{
16850 D(p->level++);
16851 if (p->error_indicator) {
16852 D(p->level--);
16853 return NULL;
16854 }
16855 void * _res = NULL;
16856 int _mark = p->mark;
16857 { // '=' annotated_rhs
16858 if (p->error_indicator) {
16859 D(p->level--);
16860 return NULL;
16861 }
16862 D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16863 Token * _literal;
16864 expr_ty d;
16865 if (
16866 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16867 &&
16868 (d = annotated_rhs_rule(p)) // annotated_rhs
16869 )
16870 {
16871 D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16872 _res = d;
16873 if (_res == NULL && PyErr_Occurred()) {
16874 p->error_indicator = 1;
16875 D(p->level--);
16876 return NULL;
16877 }
16878 goto done;
16879 }
16880 p->mark = _mark;
16881 D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ',
16882 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16883 }
16884 _res = NULL;
16885 done:
16886 D(p->level--);
16887 return _res;
16888}
16889
16890// _loop1_22: (star_targets '=')
16891static asdl_seq *
16892_loop1_22_rule(Parser *p)
16893{
16894 D(p->level++);
16895 if (p->error_indicator) {
16896 D(p->level--);
16897 return NULL;
16898 }
16899 void *_res = NULL;
16900 int _mark = p->mark;
16901 int _start_mark = p->mark;
16902 void **_children = PyMem_Malloc(sizeof(void *));
16903 if (!_children) {
16904 p->error_indicator = 1;
16905 PyErr_NoMemory();
16906 D(p->level--);
16907 return NULL;
16908 }
16909 ssize_t _children_capacity = 1;
16910 ssize_t _n = 0;
16911 { // (star_targets '=')
16912 if (p->error_indicator) {
16913 D(p->level--);
16914 return NULL;
16915 }
16916 D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010016917 void *_tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016918 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010016919 (_tmp_139_var = _tmp_139_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016920 )
16921 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010016922 _res = _tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016923 if (_n == _children_capacity) {
16924 _children_capacity *= 2;
16925 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16926 if (!_new_children) {
16927 p->error_indicator = 1;
16928 PyErr_NoMemory();
16929 D(p->level--);
16930 return NULL;
16931 }
16932 _children = _new_children;
16933 }
16934 _children[_n++] = _res;
16935 _mark = p->mark;
16936 }
16937 p->mark = _mark;
16938 D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ',
16939 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
16940 }
16941 if (_n == 0 || p->error_indicator) {
16942 PyMem_Free(_children);
16943 D(p->level--);
16944 return NULL;
16945 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016946 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016947 if (!_seq) {
16948 PyMem_Free(_children);
16949 p->error_indicator = 1;
16950 PyErr_NoMemory();
16951 D(p->level--);
16952 return NULL;
16953 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016954 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016955 PyMem_Free(_children);
16956 _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
16957 D(p->level--);
16958 return _seq;
16959}
16960
16961// _tmp_23: yield_expr | star_expressions
16962static void *
16963_tmp_23_rule(Parser *p)
16964{
16965 D(p->level++);
16966 if (p->error_indicator) {
16967 D(p->level--);
16968 return NULL;
16969 }
16970 void * _res = NULL;
16971 int _mark = p->mark;
16972 { // yield_expr
16973 if (p->error_indicator) {
16974 D(p->level--);
16975 return NULL;
16976 }
16977 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16978 expr_ty yield_expr_var;
16979 if (
16980 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16981 )
16982 {
16983 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16984 _res = yield_expr_var;
16985 goto done;
16986 }
16987 p->mark = _mark;
16988 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16989 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16990 }
16991 { // star_expressions
16992 if (p->error_indicator) {
16993 D(p->level--);
16994 return NULL;
16995 }
16996 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16997 expr_ty star_expressions_var;
16998 if (
16999 (star_expressions_var = star_expressions_rule(p)) // star_expressions
17000 )
17001 {
17002 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
17003 _res = star_expressions_var;
17004 goto done;
17005 }
17006 p->mark = _mark;
17007 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
17008 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
17009 }
17010 _res = NULL;
17011 done:
17012 D(p->level--);
17013 return _res;
17014}
17015
17016// _tmp_24: yield_expr | star_expressions
17017static void *
17018_tmp_24_rule(Parser *p)
17019{
17020 D(p->level++);
17021 if (p->error_indicator) {
17022 D(p->level--);
17023 return NULL;
17024 }
17025 void * _res = NULL;
17026 int _mark = p->mark;
17027 { // yield_expr
17028 if (p->error_indicator) {
17029 D(p->level--);
17030 return NULL;
17031 }
17032 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
17033 expr_ty yield_expr_var;
17034 if (
17035 (yield_expr_var = yield_expr_rule(p)) // yield_expr
17036 )
17037 {
17038 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
17039 _res = yield_expr_var;
17040 goto done;
17041 }
17042 p->mark = _mark;
17043 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
17044 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
17045 }
17046 { // star_expressions
17047 if (p->error_indicator) {
17048 D(p->level--);
17049 return NULL;
17050 }
17051 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
17052 expr_ty star_expressions_var;
17053 if (
17054 (star_expressions_var = star_expressions_rule(p)) // star_expressions
17055 )
17056 {
17057 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
17058 _res = star_expressions_var;
17059 goto done;
17060 }
17061 p->mark = _mark;
17062 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
17063 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
17064 }
17065 _res = NULL;
17066 done:
17067 D(p->level--);
17068 return _res;
17069}
17070
17071// _loop0_26: ',' NAME
17072static asdl_seq *
17073_loop0_26_rule(Parser *p)
17074{
17075 D(p->level++);
17076 if (p->error_indicator) {
17077 D(p->level--);
17078 return NULL;
17079 }
17080 void *_res = NULL;
17081 int _mark = p->mark;
17082 int _start_mark = p->mark;
17083 void **_children = PyMem_Malloc(sizeof(void *));
17084 if (!_children) {
17085 p->error_indicator = 1;
17086 PyErr_NoMemory();
17087 D(p->level--);
17088 return NULL;
17089 }
17090 ssize_t _children_capacity = 1;
17091 ssize_t _n = 0;
17092 { // ',' NAME
17093 if (p->error_indicator) {
17094 D(p->level--);
17095 return NULL;
17096 }
17097 D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17098 Token * _literal;
17099 expr_ty elem;
17100 while (
17101 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17102 &&
17103 (elem = _PyPegen_name_token(p)) // NAME
17104 )
17105 {
17106 _res = elem;
17107 if (_res == NULL && PyErr_Occurred()) {
17108 p->error_indicator = 1;
17109 PyMem_Free(_children);
17110 D(p->level--);
17111 return NULL;
17112 }
17113 if (_n == _children_capacity) {
17114 _children_capacity *= 2;
17115 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17116 if (!_new_children) {
17117 p->error_indicator = 1;
17118 PyErr_NoMemory();
17119 D(p->level--);
17120 return NULL;
17121 }
17122 _children = _new_children;
17123 }
17124 _children[_n++] = _res;
17125 _mark = p->mark;
17126 }
17127 p->mark = _mark;
17128 D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
17129 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17130 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017131 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017132 if (!_seq) {
17133 PyMem_Free(_children);
17134 p->error_indicator = 1;
17135 PyErr_NoMemory();
17136 D(p->level--);
17137 return NULL;
17138 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017139 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017140 PyMem_Free(_children);
17141 _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
17142 D(p->level--);
17143 return _seq;
17144}
17145
17146// _gather_25: NAME _loop0_26
17147static asdl_seq *
17148_gather_25_rule(Parser *p)
17149{
17150 D(p->level++);
17151 if (p->error_indicator) {
17152 D(p->level--);
17153 return NULL;
17154 }
17155 asdl_seq * _res = NULL;
17156 int _mark = p->mark;
17157 { // NAME _loop0_26
17158 if (p->error_indicator) {
17159 D(p->level--);
17160 return NULL;
17161 }
17162 D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17163 expr_ty elem;
17164 asdl_seq * seq;
17165 if (
17166 (elem = _PyPegen_name_token(p)) // NAME
17167 &&
17168 (seq = _loop0_26_rule(p)) // _loop0_26
17169 )
17170 {
17171 D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17172 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17173 goto done;
17174 }
17175 p->mark = _mark;
17176 D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ',
17177 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26"));
17178 }
17179 _res = NULL;
17180 done:
17181 D(p->level--);
17182 return _res;
17183}
17184
17185// _loop0_28: ',' NAME
17186static asdl_seq *
17187_loop0_28_rule(Parser *p)
17188{
17189 D(p->level++);
17190 if (p->error_indicator) {
17191 D(p->level--);
17192 return NULL;
17193 }
17194 void *_res = NULL;
17195 int _mark = p->mark;
17196 int _start_mark = p->mark;
17197 void **_children = PyMem_Malloc(sizeof(void *));
17198 if (!_children) {
17199 p->error_indicator = 1;
17200 PyErr_NoMemory();
17201 D(p->level--);
17202 return NULL;
17203 }
17204 ssize_t _children_capacity = 1;
17205 ssize_t _n = 0;
17206 { // ',' NAME
17207 if (p->error_indicator) {
17208 D(p->level--);
17209 return NULL;
17210 }
17211 D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17212 Token * _literal;
17213 expr_ty elem;
17214 while (
17215 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17216 &&
17217 (elem = _PyPegen_name_token(p)) // NAME
17218 )
17219 {
17220 _res = elem;
17221 if (_res == NULL && PyErr_Occurred()) {
17222 p->error_indicator = 1;
17223 PyMem_Free(_children);
17224 D(p->level--);
17225 return NULL;
17226 }
17227 if (_n == _children_capacity) {
17228 _children_capacity *= 2;
17229 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17230 if (!_new_children) {
17231 p->error_indicator = 1;
17232 PyErr_NoMemory();
17233 D(p->level--);
17234 return NULL;
17235 }
17236 _children = _new_children;
17237 }
17238 _children[_n++] = _res;
17239 _mark = p->mark;
17240 }
17241 p->mark = _mark;
17242 D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
17243 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17244 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017245 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017246 if (!_seq) {
17247 PyMem_Free(_children);
17248 p->error_indicator = 1;
17249 PyErr_NoMemory();
17250 D(p->level--);
17251 return NULL;
17252 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017253 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017254 PyMem_Free(_children);
17255 _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
17256 D(p->level--);
17257 return _seq;
17258}
17259
17260// _gather_27: NAME _loop0_28
17261static asdl_seq *
17262_gather_27_rule(Parser *p)
17263{
17264 D(p->level++);
17265 if (p->error_indicator) {
17266 D(p->level--);
17267 return NULL;
17268 }
17269 asdl_seq * _res = NULL;
17270 int _mark = p->mark;
17271 { // NAME _loop0_28
17272 if (p->error_indicator) {
17273 D(p->level--);
17274 return NULL;
17275 }
17276 D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17277 expr_ty elem;
17278 asdl_seq * seq;
17279 if (
17280 (elem = _PyPegen_name_token(p)) // NAME
17281 &&
17282 (seq = _loop0_28_rule(p)) // _loop0_28
17283 )
17284 {
17285 D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17286 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17287 goto done;
17288 }
17289 p->mark = _mark;
17290 D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ',
17291 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28"));
17292 }
17293 _res = NULL;
17294 done:
17295 D(p->level--);
17296 return _res;
17297}
17298
17299// _tmp_29: ',' expression
17300static void *
17301_tmp_29_rule(Parser *p)
17302{
17303 D(p->level++);
17304 if (p->error_indicator) {
17305 D(p->level--);
17306 return NULL;
17307 }
17308 void * _res = NULL;
17309 int _mark = p->mark;
17310 { // ',' expression
17311 if (p->error_indicator) {
17312 D(p->level--);
17313 return NULL;
17314 }
17315 D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
17316 Token * _literal;
17317 expr_ty z;
17318 if (
17319 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17320 &&
17321 (z = expression_rule(p)) // expression
17322 )
17323 {
17324 D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
17325 _res = z;
17326 if (_res == NULL && PyErr_Occurred()) {
17327 p->error_indicator = 1;
17328 D(p->level--);
17329 return NULL;
17330 }
17331 goto done;
17332 }
17333 p->mark = _mark;
17334 D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ',
17335 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
17336 }
17337 _res = NULL;
17338 done:
17339 D(p->level--);
17340 return _res;
17341}
17342
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017343// _tmp_30: ';' | NEWLINE
17344static void *
17345_tmp_30_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017346{
17347 D(p->level++);
17348 if (p->error_indicator) {
17349 D(p->level--);
17350 return NULL;
17351 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017352 void * _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017353 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017354 { // ';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017355 if (p->error_indicator) {
17356 D(p->level--);
17357 return NULL;
17358 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017359 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
17360 Token * _literal;
17361 if (
17362 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017363 )
17364 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017365 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
17366 _res = _literal;
17367 goto done;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017368 }
17369 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017370 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17371 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017372 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017373 { // NEWLINE
17374 if (p->error_indicator) {
17375 D(p->level--);
17376 return NULL;
17377 }
17378 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17379 Token * newline_var;
17380 if (
17381 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
17382 )
17383 {
17384 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17385 _res = newline_var;
17386 goto done;
17387 }
17388 p->mark = _mark;
17389 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17390 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017391 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017392 _res = NULL;
17393 done:
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017394 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017395 return _res;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017396}
17397
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017398// _loop0_31: ('.' | '...')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017399static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017400_loop0_31_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017401{
17402 D(p->level++);
17403 if (p->error_indicator) {
17404 D(p->level--);
17405 return NULL;
17406 }
17407 void *_res = NULL;
17408 int _mark = p->mark;
17409 int _start_mark = p->mark;
17410 void **_children = PyMem_Malloc(sizeof(void *));
17411 if (!_children) {
17412 p->error_indicator = 1;
17413 PyErr_NoMemory();
17414 D(p->level--);
17415 return NULL;
17416 }
17417 ssize_t _children_capacity = 1;
17418 ssize_t _n = 0;
17419 { // ('.' | '...')
17420 if (p->error_indicator) {
17421 D(p->level--);
17422 return NULL;
17423 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017424 D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017425 void *_tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017426 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017427 (_tmp_140_var = _tmp_140_rule(p)) // '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017428 )
17429 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017430 _res = _tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017431 if (_n == _children_capacity) {
17432 _children_capacity *= 2;
17433 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17434 if (!_new_children) {
17435 p->error_indicator = 1;
17436 PyErr_NoMemory();
17437 D(p->level--);
17438 return NULL;
17439 }
17440 _children = _new_children;
17441 }
17442 _children[_n++] = _res;
17443 _mark = p->mark;
17444 }
17445 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017446 D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
17447 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17448 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017449 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017450 if (!_seq) {
17451 PyMem_Free(_children);
17452 p->error_indicator = 1;
17453 PyErr_NoMemory();
17454 D(p->level--);
17455 return NULL;
17456 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017457 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017458 PyMem_Free(_children);
17459 _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
17460 D(p->level--);
17461 return _seq;
17462}
17463
17464// _loop1_32: ('.' | '...')
17465static asdl_seq *
17466_loop1_32_rule(Parser *p)
17467{
17468 D(p->level++);
17469 if (p->error_indicator) {
17470 D(p->level--);
17471 return NULL;
17472 }
17473 void *_res = NULL;
17474 int _mark = p->mark;
17475 int _start_mark = p->mark;
17476 void **_children = PyMem_Malloc(sizeof(void *));
17477 if (!_children) {
17478 p->error_indicator = 1;
17479 PyErr_NoMemory();
17480 D(p->level--);
17481 return NULL;
17482 }
17483 ssize_t _children_capacity = 1;
17484 ssize_t _n = 0;
17485 { // ('.' | '...')
17486 if (p->error_indicator) {
17487 D(p->level--);
17488 return NULL;
17489 }
17490 D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017491 void *_tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017492 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017493 (_tmp_141_var = _tmp_141_rule(p)) // '.' | '...'
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017494 )
17495 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017496 _res = _tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017497 if (_n == _children_capacity) {
17498 _children_capacity *= 2;
17499 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17500 if (!_new_children) {
17501 p->error_indicator = 1;
17502 PyErr_NoMemory();
17503 D(p->level--);
17504 return NULL;
17505 }
17506 _children = _new_children;
17507 }
17508 _children[_n++] = _res;
17509 _mark = p->mark;
17510 }
17511 p->mark = _mark;
17512 D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017513 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17514 }
17515 if (_n == 0 || p->error_indicator) {
17516 PyMem_Free(_children);
17517 D(p->level--);
17518 return NULL;
17519 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017520 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017521 if (!_seq) {
17522 PyMem_Free(_children);
17523 p->error_indicator = 1;
17524 PyErr_NoMemory();
17525 D(p->level--);
17526 return NULL;
17527 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017528 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017529 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017530 _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017531 D(p->level--);
17532 return _seq;
17533}
17534
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017535// _loop0_34: ',' import_from_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017536static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017537_loop0_34_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017538{
17539 D(p->level++);
17540 if (p->error_indicator) {
17541 D(p->level--);
17542 return NULL;
17543 }
17544 void *_res = NULL;
17545 int _mark = p->mark;
17546 int _start_mark = p->mark;
17547 void **_children = PyMem_Malloc(sizeof(void *));
17548 if (!_children) {
17549 p->error_indicator = 1;
17550 PyErr_NoMemory();
17551 D(p->level--);
17552 return NULL;
17553 }
17554 ssize_t _children_capacity = 1;
17555 ssize_t _n = 0;
17556 { // ',' import_from_as_name
17557 if (p->error_indicator) {
17558 D(p->level--);
17559 return NULL;
17560 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017561 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 +010017562 Token * _literal;
17563 alias_ty elem;
17564 while (
17565 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17566 &&
17567 (elem = import_from_as_name_rule(p)) // import_from_as_name
17568 )
17569 {
17570 _res = elem;
17571 if (_res == NULL && PyErr_Occurred()) {
17572 p->error_indicator = 1;
17573 PyMem_Free(_children);
17574 D(p->level--);
17575 return NULL;
17576 }
17577 if (_n == _children_capacity) {
17578 _children_capacity *= 2;
17579 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17580 if (!_new_children) {
17581 p->error_indicator = 1;
17582 PyErr_NoMemory();
17583 D(p->level--);
17584 return NULL;
17585 }
17586 _children = _new_children;
17587 }
17588 _children[_n++] = _res;
17589 _mark = p->mark;
17590 }
17591 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017592 D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017593 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
17594 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017595 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017596 if (!_seq) {
17597 PyMem_Free(_children);
17598 p->error_indicator = 1;
17599 PyErr_NoMemory();
17600 D(p->level--);
17601 return NULL;
17602 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017603 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017604 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017605 _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017606 D(p->level--);
17607 return _seq;
17608}
17609
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017610// _gather_33: import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017611static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017612_gather_33_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017613{
17614 D(p->level++);
17615 if (p->error_indicator) {
17616 D(p->level--);
17617 return NULL;
17618 }
17619 asdl_seq * _res = NULL;
17620 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017621 { // import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017622 if (p->error_indicator) {
17623 D(p->level--);
17624 return NULL;
17625 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017626 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 +010017627 alias_ty elem;
17628 asdl_seq * seq;
17629 if (
17630 (elem = import_from_as_name_rule(p)) // import_from_as_name
17631 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017632 (seq = _loop0_34_rule(p)) // _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017633 )
17634 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017635 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 +010017636 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17637 goto done;
17638 }
17639 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017640 D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ',
17641 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017642 }
17643 _res = NULL;
17644 done:
17645 D(p->level--);
17646 return _res;
17647}
17648
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017649// _tmp_35: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017650static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017651_tmp_35_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017652{
17653 D(p->level++);
17654 if (p->error_indicator) {
17655 D(p->level--);
17656 return NULL;
17657 }
17658 void * _res = NULL;
17659 int _mark = p->mark;
17660 { // 'as' NAME
17661 if (p->error_indicator) {
17662 D(p->level--);
17663 return NULL;
17664 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017665 D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017666 Token * _keyword;
17667 expr_ty z;
17668 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017669 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017670 &&
17671 (z = _PyPegen_name_token(p)) // NAME
17672 )
17673 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017674 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 +010017675 _res = z;
17676 if (_res == NULL && PyErr_Occurred()) {
17677 p->error_indicator = 1;
17678 D(p->level--);
17679 return NULL;
17680 }
17681 goto done;
17682 }
17683 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017684 D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017685 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17686 }
17687 _res = NULL;
17688 done:
17689 D(p->level--);
17690 return _res;
17691}
17692
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017693// _loop0_37: ',' dotted_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017694static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017695_loop0_37_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017696{
17697 D(p->level++);
17698 if (p->error_indicator) {
17699 D(p->level--);
17700 return NULL;
17701 }
17702 void *_res = NULL;
17703 int _mark = p->mark;
17704 int _start_mark = p->mark;
17705 void **_children = PyMem_Malloc(sizeof(void *));
17706 if (!_children) {
17707 p->error_indicator = 1;
17708 PyErr_NoMemory();
17709 D(p->level--);
17710 return NULL;
17711 }
17712 ssize_t _children_capacity = 1;
17713 ssize_t _n = 0;
17714 { // ',' dotted_as_name
17715 if (p->error_indicator) {
17716 D(p->level--);
17717 return NULL;
17718 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017719 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 +010017720 Token * _literal;
17721 alias_ty elem;
17722 while (
17723 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17724 &&
17725 (elem = dotted_as_name_rule(p)) // dotted_as_name
17726 )
17727 {
17728 _res = elem;
17729 if (_res == NULL && PyErr_Occurred()) {
17730 p->error_indicator = 1;
17731 PyMem_Free(_children);
17732 D(p->level--);
17733 return NULL;
17734 }
17735 if (_n == _children_capacity) {
17736 _children_capacity *= 2;
17737 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17738 if (!_new_children) {
17739 p->error_indicator = 1;
17740 PyErr_NoMemory();
17741 D(p->level--);
17742 return NULL;
17743 }
17744 _children = _new_children;
17745 }
17746 _children[_n++] = _res;
17747 _mark = p->mark;
17748 }
17749 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017750 D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017751 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
17752 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017753 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017754 if (!_seq) {
17755 PyMem_Free(_children);
17756 p->error_indicator = 1;
17757 PyErr_NoMemory();
17758 D(p->level--);
17759 return NULL;
17760 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017761 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017762 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017763 _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017764 D(p->level--);
17765 return _seq;
17766}
17767
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017768// _gather_36: dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017769static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017770_gather_36_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017771{
17772 D(p->level++);
17773 if (p->error_indicator) {
17774 D(p->level--);
17775 return NULL;
17776 }
17777 asdl_seq * _res = NULL;
17778 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017779 { // dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017780 if (p->error_indicator) {
17781 D(p->level--);
17782 return NULL;
17783 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017784 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 +010017785 alias_ty elem;
17786 asdl_seq * seq;
17787 if (
17788 (elem = dotted_as_name_rule(p)) // dotted_as_name
17789 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017790 (seq = _loop0_37_rule(p)) // _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017791 )
17792 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017793 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 +010017794 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17795 goto done;
17796 }
17797 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017798 D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ',
17799 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017800 }
17801 _res = NULL;
17802 done:
17803 D(p->level--);
17804 return _res;
17805}
17806
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017807// _tmp_38: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017808static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017809_tmp_38_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017810{
17811 D(p->level++);
17812 if (p->error_indicator) {
17813 D(p->level--);
17814 return NULL;
17815 }
17816 void * _res = NULL;
17817 int _mark = p->mark;
17818 { // 'as' NAME
17819 if (p->error_indicator) {
17820 D(p->level--);
17821 return NULL;
17822 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017823 D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017824 Token * _keyword;
17825 expr_ty z;
17826 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017827 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017828 &&
17829 (z = _PyPegen_name_token(p)) // NAME
17830 )
17831 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017832 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 +010017833 _res = z;
17834 if (_res == NULL && PyErr_Occurred()) {
17835 p->error_indicator = 1;
17836 D(p->level--);
17837 return NULL;
17838 }
17839 goto done;
17840 }
17841 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017842 D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017843 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17844 }
17845 _res = NULL;
17846 done:
17847 D(p->level--);
17848 return _res;
17849}
17850
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017851// _loop0_40: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017852static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017853_loop0_40_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017854{
17855 D(p->level++);
17856 if (p->error_indicator) {
17857 D(p->level--);
17858 return NULL;
17859 }
17860 void *_res = NULL;
17861 int _mark = p->mark;
17862 int _start_mark = p->mark;
17863 void **_children = PyMem_Malloc(sizeof(void *));
17864 if (!_children) {
17865 p->error_indicator = 1;
17866 PyErr_NoMemory();
17867 D(p->level--);
17868 return NULL;
17869 }
17870 ssize_t _children_capacity = 1;
17871 ssize_t _n = 0;
17872 { // ',' with_item
17873 if (p->error_indicator) {
17874 D(p->level--);
17875 return NULL;
17876 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017877 D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017878 Token * _literal;
17879 withitem_ty elem;
17880 while (
17881 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17882 &&
17883 (elem = with_item_rule(p)) // with_item
17884 )
17885 {
17886 _res = elem;
17887 if (_res == NULL && PyErr_Occurred()) {
17888 p->error_indicator = 1;
17889 PyMem_Free(_children);
17890 D(p->level--);
17891 return NULL;
17892 }
17893 if (_n == _children_capacity) {
17894 _children_capacity *= 2;
17895 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17896 if (!_new_children) {
17897 p->error_indicator = 1;
17898 PyErr_NoMemory();
17899 D(p->level--);
17900 return NULL;
17901 }
17902 _children = _new_children;
17903 }
17904 _children[_n++] = _res;
17905 _mark = p->mark;
17906 }
17907 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017908 D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017909 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17910 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017911 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017912 if (!_seq) {
17913 PyMem_Free(_children);
17914 p->error_indicator = 1;
17915 PyErr_NoMemory();
17916 D(p->level--);
17917 return NULL;
17918 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017919 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017920 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017921 _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017922 D(p->level--);
17923 return _seq;
17924}
17925
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017926// _gather_39: with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017927static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017928_gather_39_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017929{
17930 D(p->level++);
17931 if (p->error_indicator) {
17932 D(p->level--);
17933 return NULL;
17934 }
17935 asdl_seq * _res = NULL;
17936 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017937 { // with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017938 if (p->error_indicator) {
17939 D(p->level--);
17940 return NULL;
17941 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017942 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 +010017943 withitem_ty elem;
17944 asdl_seq * seq;
17945 if (
17946 (elem = with_item_rule(p)) // with_item
17947 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017948 (seq = _loop0_40_rule(p)) // _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017949 )
17950 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017951 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 +010017952 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17953 goto done;
17954 }
17955 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017956 D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ',
17957 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017958 }
17959 _res = NULL;
17960 done:
17961 D(p->level--);
17962 return _res;
17963}
17964
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017965// _loop0_42: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017966static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017967_loop0_42_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017968{
17969 D(p->level++);
17970 if (p->error_indicator) {
17971 D(p->level--);
17972 return NULL;
17973 }
17974 void *_res = NULL;
17975 int _mark = p->mark;
17976 int _start_mark = p->mark;
17977 void **_children = PyMem_Malloc(sizeof(void *));
17978 if (!_children) {
17979 p->error_indicator = 1;
17980 PyErr_NoMemory();
17981 D(p->level--);
17982 return NULL;
17983 }
17984 ssize_t _children_capacity = 1;
17985 ssize_t _n = 0;
17986 { // ',' with_item
17987 if (p->error_indicator) {
17988 D(p->level--);
17989 return NULL;
17990 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017991 D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017992 Token * _literal;
17993 withitem_ty elem;
17994 while (
17995 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17996 &&
17997 (elem = with_item_rule(p)) // with_item
17998 )
17999 {
18000 _res = elem;
18001 if (_res == NULL && PyErr_Occurred()) {
18002 p->error_indicator = 1;
18003 PyMem_Free(_children);
18004 D(p->level--);
18005 return NULL;
18006 }
18007 if (_n == _children_capacity) {
18008 _children_capacity *= 2;
18009 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18010 if (!_new_children) {
18011 p->error_indicator = 1;
18012 PyErr_NoMemory();
18013 D(p->level--);
18014 return NULL;
18015 }
18016 _children = _new_children;
18017 }
18018 _children[_n++] = _res;
18019 _mark = p->mark;
18020 }
18021 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018022 D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018023 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18024 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018025 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018026 if (!_seq) {
18027 PyMem_Free(_children);
18028 p->error_indicator = 1;
18029 PyErr_NoMemory();
18030 D(p->level--);
18031 return NULL;
18032 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018033 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018034 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018035 _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018036 D(p->level--);
18037 return _seq;
18038}
18039
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018040// _gather_41: with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018041static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018042_gather_41_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018043{
18044 D(p->level++);
18045 if (p->error_indicator) {
18046 D(p->level--);
18047 return NULL;
18048 }
18049 asdl_seq * _res = NULL;
18050 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018051 { // with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018052 if (p->error_indicator) {
18053 D(p->level--);
18054 return NULL;
18055 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018056 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 +010018057 withitem_ty elem;
18058 asdl_seq * seq;
18059 if (
18060 (elem = with_item_rule(p)) // with_item
18061 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018062 (seq = _loop0_42_rule(p)) // _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018063 )
18064 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018065 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 +010018066 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18067 goto done;
18068 }
18069 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018070 D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
18071 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018072 }
18073 _res = NULL;
18074 done:
18075 D(p->level--);
18076 return _res;
18077}
18078
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018079// _loop0_44: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018080static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018081_loop0_44_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018082{
18083 D(p->level++);
18084 if (p->error_indicator) {
18085 D(p->level--);
18086 return NULL;
18087 }
18088 void *_res = NULL;
18089 int _mark = p->mark;
18090 int _start_mark = p->mark;
18091 void **_children = PyMem_Malloc(sizeof(void *));
18092 if (!_children) {
18093 p->error_indicator = 1;
18094 PyErr_NoMemory();
18095 D(p->level--);
18096 return NULL;
18097 }
18098 ssize_t _children_capacity = 1;
18099 ssize_t _n = 0;
18100 { // ',' with_item
18101 if (p->error_indicator) {
18102 D(p->level--);
18103 return NULL;
18104 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018105 D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018106 Token * _literal;
18107 withitem_ty elem;
18108 while (
18109 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18110 &&
18111 (elem = with_item_rule(p)) // with_item
18112 )
18113 {
18114 _res = elem;
18115 if (_res == NULL && PyErr_Occurred()) {
18116 p->error_indicator = 1;
18117 PyMem_Free(_children);
18118 D(p->level--);
18119 return NULL;
18120 }
18121 if (_n == _children_capacity) {
18122 _children_capacity *= 2;
18123 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18124 if (!_new_children) {
18125 p->error_indicator = 1;
18126 PyErr_NoMemory();
18127 D(p->level--);
18128 return NULL;
18129 }
18130 _children = _new_children;
18131 }
18132 _children[_n++] = _res;
18133 _mark = p->mark;
18134 }
18135 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018136 D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018137 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18138 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018139 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018140 if (!_seq) {
18141 PyMem_Free(_children);
18142 p->error_indicator = 1;
18143 PyErr_NoMemory();
18144 D(p->level--);
18145 return NULL;
18146 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018147 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018148 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018149 _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018150 D(p->level--);
18151 return _seq;
18152}
18153
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018154// _gather_43: with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018155static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018156_gather_43_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018157{
18158 D(p->level++);
18159 if (p->error_indicator) {
18160 D(p->level--);
18161 return NULL;
18162 }
18163 asdl_seq * _res = NULL;
18164 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018165 { // with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018166 if (p->error_indicator) {
18167 D(p->level--);
18168 return NULL;
18169 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018170 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 +010018171 withitem_ty elem;
18172 asdl_seq * seq;
18173 if (
18174 (elem = with_item_rule(p)) // with_item
18175 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018176 (seq = _loop0_44_rule(p)) // _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018177 )
18178 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018179 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 +010018180 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18181 goto done;
18182 }
18183 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018184 D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ',
18185 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018186 }
18187 _res = NULL;
18188 done:
18189 D(p->level--);
18190 return _res;
18191}
18192
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018193// _loop0_46: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018194static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018195_loop0_46_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018196{
18197 D(p->level++);
18198 if (p->error_indicator) {
18199 D(p->level--);
18200 return NULL;
18201 }
18202 void *_res = NULL;
18203 int _mark = p->mark;
18204 int _start_mark = p->mark;
18205 void **_children = PyMem_Malloc(sizeof(void *));
18206 if (!_children) {
18207 p->error_indicator = 1;
18208 PyErr_NoMemory();
18209 D(p->level--);
18210 return NULL;
18211 }
18212 ssize_t _children_capacity = 1;
18213 ssize_t _n = 0;
18214 { // ',' with_item
18215 if (p->error_indicator) {
18216 D(p->level--);
18217 return NULL;
18218 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018219 D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018220 Token * _literal;
18221 withitem_ty elem;
18222 while (
18223 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18224 &&
18225 (elem = with_item_rule(p)) // with_item
18226 )
18227 {
18228 _res = elem;
18229 if (_res == NULL && PyErr_Occurred()) {
18230 p->error_indicator = 1;
18231 PyMem_Free(_children);
18232 D(p->level--);
18233 return NULL;
18234 }
18235 if (_n == _children_capacity) {
18236 _children_capacity *= 2;
18237 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18238 if (!_new_children) {
18239 p->error_indicator = 1;
18240 PyErr_NoMemory();
18241 D(p->level--);
18242 return NULL;
18243 }
18244 _children = _new_children;
18245 }
18246 _children[_n++] = _res;
18247 _mark = p->mark;
18248 }
18249 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018250 D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018251 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18252 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018253 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018254 if (!_seq) {
18255 PyMem_Free(_children);
18256 p->error_indicator = 1;
18257 PyErr_NoMemory();
18258 D(p->level--);
18259 return NULL;
18260 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018261 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018262 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018263 _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018264 D(p->level--);
18265 return _seq;
18266}
18267
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018268// _gather_45: with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018269static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018270_gather_45_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018271{
18272 D(p->level++);
18273 if (p->error_indicator) {
18274 D(p->level--);
18275 return NULL;
18276 }
18277 asdl_seq * _res = NULL;
18278 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018279 { // with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018280 if (p->error_indicator) {
18281 D(p->level--);
18282 return NULL;
18283 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018284 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 +010018285 withitem_ty elem;
18286 asdl_seq * seq;
18287 if (
18288 (elem = with_item_rule(p)) // with_item
18289 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018290 (seq = _loop0_46_rule(p)) // _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018291 )
18292 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018293 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 +010018294 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18295 goto done;
18296 }
18297 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018298 D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
18299 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018300 }
18301 _res = NULL;
18302 done:
18303 D(p->level--);
18304 return _res;
18305}
18306
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018307// _tmp_47: ',' | ')' | ':'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018308static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018309_tmp_47_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018310{
18311 D(p->level++);
18312 if (p->error_indicator) {
18313 D(p->level--);
18314 return NULL;
18315 }
18316 void * _res = NULL;
18317 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018318 { // ','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018319 if (p->error_indicator) {
18320 D(p->level--);
18321 return NULL;
18322 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018323 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
18324 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018325 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018326 (_literal = _PyPegen_expect_token(p, 12)) // token=','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018327 )
18328 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018329 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
18330 _res = _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018331 goto done;
18332 }
18333 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018334 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18335 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
18336 }
18337 { // ')'
18338 if (p->error_indicator) {
18339 D(p->level--);
18340 return NULL;
18341 }
18342 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
18343 Token * _literal;
18344 if (
18345 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
18346 )
18347 {
18348 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
18349 _res = _literal;
18350 goto done;
18351 }
18352 p->mark = _mark;
18353 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18354 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
18355 }
18356 { // ':'
18357 if (p->error_indicator) {
18358 D(p->level--);
18359 return NULL;
18360 }
18361 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
18362 Token * _literal;
18363 if (
18364 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
18365 )
18366 {
18367 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
18368 _res = _literal;
18369 goto done;
18370 }
18371 p->mark = _mark;
18372 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18373 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018374 }
18375 _res = NULL;
18376 done:
18377 D(p->level--);
18378 return _res;
18379}
18380
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018381// _loop1_48: except_block
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018382static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018383_loop1_48_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018384{
18385 D(p->level++);
18386 if (p->error_indicator) {
18387 D(p->level--);
18388 return NULL;
18389 }
18390 void *_res = NULL;
18391 int _mark = p->mark;
18392 int _start_mark = p->mark;
18393 void **_children = PyMem_Malloc(sizeof(void *));
18394 if (!_children) {
18395 p->error_indicator = 1;
18396 PyErr_NoMemory();
18397 D(p->level--);
18398 return NULL;
18399 }
18400 ssize_t _children_capacity = 1;
18401 ssize_t _n = 0;
18402 { // except_block
18403 if (p->error_indicator) {
18404 D(p->level--);
18405 return NULL;
18406 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018407 D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018408 excepthandler_ty except_block_var;
18409 while (
18410 (except_block_var = except_block_rule(p)) // except_block
18411 )
18412 {
18413 _res = except_block_var;
18414 if (_n == _children_capacity) {
18415 _children_capacity *= 2;
18416 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18417 if (!_new_children) {
18418 p->error_indicator = 1;
18419 PyErr_NoMemory();
18420 D(p->level--);
18421 return NULL;
18422 }
18423 _children = _new_children;
18424 }
18425 _children[_n++] = _res;
18426 _mark = p->mark;
18427 }
18428 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018429 D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018430 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
18431 }
18432 if (_n == 0 || p->error_indicator) {
18433 PyMem_Free(_children);
18434 D(p->level--);
18435 return NULL;
18436 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018437 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018438 if (!_seq) {
18439 PyMem_Free(_children);
18440 p->error_indicator = 1;
18441 PyErr_NoMemory();
18442 D(p->level--);
18443 return NULL;
18444 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018445 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018446 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018447 _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018448 D(p->level--);
18449 return _seq;
18450}
18451
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018452// _tmp_49: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018453static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018454_tmp_49_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018455{
18456 D(p->level++);
18457 if (p->error_indicator) {
18458 D(p->level--);
18459 return NULL;
18460 }
18461 void * _res = NULL;
18462 int _mark = p->mark;
18463 { // 'as' NAME
18464 if (p->error_indicator) {
18465 D(p->level--);
18466 return NULL;
18467 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018468 D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018469 Token * _keyword;
18470 expr_ty z;
18471 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018472 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018473 &&
18474 (z = _PyPegen_name_token(p)) // NAME
18475 )
18476 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018477 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 +010018478 _res = z;
18479 if (_res == NULL && PyErr_Occurred()) {
18480 p->error_indicator = 1;
18481 D(p->level--);
18482 return NULL;
18483 }
18484 goto done;
18485 }
18486 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018487 D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018488 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
18489 }
18490 _res = NULL;
18491 done:
18492 D(p->level--);
18493 return _res;
18494}
18495
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018496// _tmp_50: 'from' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018497static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018498_tmp_50_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018499{
18500 D(p->level++);
18501 if (p->error_indicator) {
18502 D(p->level--);
18503 return NULL;
18504 }
18505 void * _res = NULL;
18506 int _mark = p->mark;
18507 { // 'from' expression
18508 if (p->error_indicator) {
18509 D(p->level--);
18510 return NULL;
18511 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018512 D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018513 Token * _keyword;
18514 expr_ty z;
18515 if (
18516 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
18517 &&
18518 (z = expression_rule(p)) // expression
18519 )
18520 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018521 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 +010018522 _res = z;
18523 if (_res == NULL && PyErr_Occurred()) {
18524 p->error_indicator = 1;
18525 D(p->level--);
18526 return NULL;
18527 }
18528 goto done;
18529 }
18530 p->mark = _mark;
18531 D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018532 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018533 }
18534 _res = NULL;
18535 done:
18536 D(p->level--);
18537 return _res;
18538}
18539
18540// _tmp_51: '->' expression
18541static void *
18542_tmp_51_rule(Parser *p)
18543{
18544 D(p->level++);
18545 if (p->error_indicator) {
18546 D(p->level--);
18547 return NULL;
18548 }
18549 void * _res = NULL;
18550 int _mark = p->mark;
18551 { // '->' expression
18552 if (p->error_indicator) {
18553 D(p->level--);
18554 return NULL;
18555 }
18556 D(fprintf(stderr, "%*c> _tmp_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18557 Token * _literal;
18558 expr_ty z;
18559 if (
18560 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18561 &&
18562 (z = expression_rule(p)) // expression
18563 )
18564 {
18565 D(fprintf(stderr, "%*c+ _tmp_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18566 _res = z;
18567 if (_res == NULL && PyErr_Occurred()) {
18568 p->error_indicator = 1;
18569 D(p->level--);
18570 return NULL;
18571 }
18572 goto done;
18573 }
18574 p->mark = _mark;
18575 D(fprintf(stderr, "%*c%s _tmp_51[%d-%d]: %s failed!\n", p->level, ' ',
18576 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18577 }
18578 _res = NULL;
18579 done:
18580 D(p->level--);
18581 return _res;
18582}
18583
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018584// _tmp_52: '->' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018585static void *
18586_tmp_52_rule(Parser *p)
18587{
18588 D(p->level++);
18589 if (p->error_indicator) {
18590 D(p->level--);
18591 return NULL;
18592 }
18593 void * _res = NULL;
18594 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018595 { // '->' expression
18596 if (p->error_indicator) {
18597 D(p->level--);
18598 return NULL;
18599 }
18600 D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18601 Token * _literal;
18602 expr_ty z;
18603 if (
18604 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18605 &&
18606 (z = expression_rule(p)) // expression
18607 )
18608 {
18609 D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18610 _res = z;
18611 if (_res == NULL && PyErr_Occurred()) {
18612 p->error_indicator = 1;
18613 D(p->level--);
18614 return NULL;
18615 }
18616 goto done;
18617 }
18618 p->mark = _mark;
18619 D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ',
18620 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18621 }
18622 _res = NULL;
18623 done:
18624 D(p->level--);
18625 return _res;
18626}
18627
18628// _tmp_53: NEWLINE INDENT
18629static void *
18630_tmp_53_rule(Parser *p)
18631{
18632 D(p->level++);
18633 if (p->error_indicator) {
18634 D(p->level--);
18635 return NULL;
18636 }
18637 void * _res = NULL;
18638 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018639 { // NEWLINE INDENT
18640 if (p->error_indicator) {
18641 D(p->level--);
18642 return NULL;
18643 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018644 D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018645 Token * indent_var;
18646 Token * newline_var;
18647 if (
18648 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
18649 &&
18650 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
18651 )
18652 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018653 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 +010018654 _res = _PyPegen_dummy_name(p, newline_var, indent_var);
18655 goto done;
18656 }
18657 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018658 D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018659 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
18660 }
18661 _res = NULL;
18662 done:
18663 D(p->level--);
18664 return _res;
18665}
18666
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018667// _loop0_54: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018668static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018669_loop0_54_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018670{
18671 D(p->level++);
18672 if (p->error_indicator) {
18673 D(p->level--);
18674 return NULL;
18675 }
18676 void *_res = NULL;
18677 int _mark = p->mark;
18678 int _start_mark = p->mark;
18679 void **_children = PyMem_Malloc(sizeof(void *));
18680 if (!_children) {
18681 p->error_indicator = 1;
18682 PyErr_NoMemory();
18683 D(p->level--);
18684 return NULL;
18685 }
18686 ssize_t _children_capacity = 1;
18687 ssize_t _n = 0;
18688 { // param_no_default
18689 if (p->error_indicator) {
18690 D(p->level--);
18691 return NULL;
18692 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018693 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 +010018694 arg_ty param_no_default_var;
18695 while (
18696 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18697 )
18698 {
18699 _res = param_no_default_var;
18700 if (_n == _children_capacity) {
18701 _children_capacity *= 2;
18702 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18703 if (!_new_children) {
18704 p->error_indicator = 1;
18705 PyErr_NoMemory();
18706 D(p->level--);
18707 return NULL;
18708 }
18709 _children = _new_children;
18710 }
18711 _children[_n++] = _res;
18712 _mark = p->mark;
18713 }
18714 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018715 D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018716 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018717 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018718 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018719 if (!_seq) {
18720 PyMem_Free(_children);
18721 p->error_indicator = 1;
18722 PyErr_NoMemory();
18723 D(p->level--);
18724 return NULL;
18725 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018726 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018727 PyMem_Free(_children);
18728 _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq);
18729 D(p->level--);
18730 return _seq;
18731}
18732
18733// _loop0_55: param_with_default
18734static asdl_seq *
18735_loop0_55_rule(Parser *p)
18736{
18737 D(p->level++);
18738 if (p->error_indicator) {
18739 D(p->level--);
18740 return NULL;
18741 }
18742 void *_res = NULL;
18743 int _mark = p->mark;
18744 int _start_mark = p->mark;
18745 void **_children = PyMem_Malloc(sizeof(void *));
18746 if (!_children) {
18747 p->error_indicator = 1;
18748 PyErr_NoMemory();
18749 D(p->level--);
18750 return NULL;
18751 }
18752 ssize_t _children_capacity = 1;
18753 ssize_t _n = 0;
18754 { // param_with_default
18755 if (p->error_indicator) {
18756 D(p->level--);
18757 return NULL;
18758 }
18759 D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18760 NameDefaultPair* param_with_default_var;
18761 while (
18762 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18763 )
18764 {
18765 _res = param_with_default_var;
18766 if (_n == _children_capacity) {
18767 _children_capacity *= 2;
18768 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18769 if (!_new_children) {
18770 p->error_indicator = 1;
18771 PyErr_NoMemory();
18772 D(p->level--);
18773 return NULL;
18774 }
18775 _children = _new_children;
18776 }
18777 _children[_n++] = _res;
18778 _mark = p->mark;
18779 }
18780 p->mark = _mark;
18781 D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ',
18782 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18783 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018784 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018785 if (!_seq) {
18786 PyMem_Free(_children);
18787 p->error_indicator = 1;
18788 PyErr_NoMemory();
18789 D(p->level--);
18790 return NULL;
18791 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018792 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018793 PyMem_Free(_children);
18794 _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq);
18795 D(p->level--);
18796 return _seq;
18797}
18798
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018799// _loop0_56: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018800static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018801_loop0_56_rule(Parser *p)
18802{
18803 D(p->level++);
18804 if (p->error_indicator) {
18805 D(p->level--);
18806 return NULL;
18807 }
18808 void *_res = NULL;
18809 int _mark = p->mark;
18810 int _start_mark = p->mark;
18811 void **_children = PyMem_Malloc(sizeof(void *));
18812 if (!_children) {
18813 p->error_indicator = 1;
18814 PyErr_NoMemory();
18815 D(p->level--);
18816 return NULL;
18817 }
18818 ssize_t _children_capacity = 1;
18819 ssize_t _n = 0;
18820 { // param_with_default
18821 if (p->error_indicator) {
18822 D(p->level--);
18823 return NULL;
18824 }
18825 D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18826 NameDefaultPair* param_with_default_var;
18827 while (
18828 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18829 )
18830 {
18831 _res = param_with_default_var;
18832 if (_n == _children_capacity) {
18833 _children_capacity *= 2;
18834 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18835 if (!_new_children) {
18836 p->error_indicator = 1;
18837 PyErr_NoMemory();
18838 D(p->level--);
18839 return NULL;
18840 }
18841 _children = _new_children;
18842 }
18843 _children[_n++] = _res;
18844 _mark = p->mark;
18845 }
18846 p->mark = _mark;
18847 D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ',
18848 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18849 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018850 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018851 if (!_seq) {
18852 PyMem_Free(_children);
18853 p->error_indicator = 1;
18854 PyErr_NoMemory();
18855 D(p->level--);
18856 return NULL;
18857 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018858 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018859 PyMem_Free(_children);
18860 _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq);
18861 D(p->level--);
18862 return _seq;
18863}
18864
18865// _loop1_57: param_no_default
18866static asdl_seq *
18867_loop1_57_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018868{
18869 D(p->level++);
18870 if (p->error_indicator) {
18871 D(p->level--);
18872 return NULL;
18873 }
18874 void *_res = NULL;
18875 int _mark = p->mark;
18876 int _start_mark = p->mark;
18877 void **_children = PyMem_Malloc(sizeof(void *));
18878 if (!_children) {
18879 p->error_indicator = 1;
18880 PyErr_NoMemory();
18881 D(p->level--);
18882 return NULL;
18883 }
18884 ssize_t _children_capacity = 1;
18885 ssize_t _n = 0;
18886 { // param_no_default
18887 if (p->error_indicator) {
18888 D(p->level--);
18889 return NULL;
18890 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018891 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 +010018892 arg_ty param_no_default_var;
18893 while (
18894 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18895 )
18896 {
18897 _res = param_no_default_var;
18898 if (_n == _children_capacity) {
18899 _children_capacity *= 2;
18900 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18901 if (!_new_children) {
18902 p->error_indicator = 1;
18903 PyErr_NoMemory();
18904 D(p->level--);
18905 return NULL;
18906 }
18907 _children = _new_children;
18908 }
18909 _children[_n++] = _res;
18910 _mark = p->mark;
18911 }
18912 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018913 D(fprintf(stderr, "%*c%s _loop1_57[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018914 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
18915 }
18916 if (_n == 0 || p->error_indicator) {
18917 PyMem_Free(_children);
18918 D(p->level--);
18919 return NULL;
18920 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018921 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018922 if (!_seq) {
18923 PyMem_Free(_children);
18924 p->error_indicator = 1;
18925 PyErr_NoMemory();
18926 D(p->level--);
18927 return NULL;
18928 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018929 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018930 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018931 _PyPegen_insert_memo(p, _start_mark, _loop1_57_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018932 D(p->level--);
18933 return _seq;
18934}
18935
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018936// _loop0_58: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018937static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018938_loop0_58_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018939{
18940 D(p->level++);
18941 if (p->error_indicator) {
18942 D(p->level--);
18943 return NULL;
18944 }
18945 void *_res = NULL;
18946 int _mark = p->mark;
18947 int _start_mark = p->mark;
18948 void **_children = PyMem_Malloc(sizeof(void *));
18949 if (!_children) {
18950 p->error_indicator = 1;
18951 PyErr_NoMemory();
18952 D(p->level--);
18953 return NULL;
18954 }
18955 ssize_t _children_capacity = 1;
18956 ssize_t _n = 0;
18957 { // param_with_default
18958 if (p->error_indicator) {
18959 D(p->level--);
18960 return NULL;
18961 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018962 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 +010018963 NameDefaultPair* param_with_default_var;
18964 while (
18965 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18966 )
18967 {
18968 _res = param_with_default_var;
18969 if (_n == _children_capacity) {
18970 _children_capacity *= 2;
18971 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18972 if (!_new_children) {
18973 p->error_indicator = 1;
18974 PyErr_NoMemory();
18975 D(p->level--);
18976 return NULL;
18977 }
18978 _children = _new_children;
18979 }
18980 _children[_n++] = _res;
18981 _mark = p->mark;
18982 }
18983 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018984 D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018985 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18986 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018987 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018988 if (!_seq) {
18989 PyMem_Free(_children);
18990 p->error_indicator = 1;
18991 PyErr_NoMemory();
18992 D(p->level--);
18993 return NULL;
18994 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018995 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018996 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018997 _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018998 D(p->level--);
18999 return _seq;
19000}
19001
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019002// _loop1_59: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019003static asdl_seq *
19004_loop1_59_rule(Parser *p)
19005{
19006 D(p->level++);
19007 if (p->error_indicator) {
19008 D(p->level--);
19009 return NULL;
19010 }
19011 void *_res = NULL;
19012 int _mark = p->mark;
19013 int _start_mark = p->mark;
19014 void **_children = PyMem_Malloc(sizeof(void *));
19015 if (!_children) {
19016 p->error_indicator = 1;
19017 PyErr_NoMemory();
19018 D(p->level--);
19019 return NULL;
19020 }
19021 ssize_t _children_capacity = 1;
19022 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019023 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019024 if (p->error_indicator) {
19025 D(p->level--);
19026 return NULL;
19027 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019028 D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
19029 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019030 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019031 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019032 )
19033 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019034 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019035 if (_n == _children_capacity) {
19036 _children_capacity *= 2;
19037 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19038 if (!_new_children) {
19039 p->error_indicator = 1;
19040 PyErr_NoMemory();
19041 D(p->level--);
19042 return NULL;
19043 }
19044 _children = _new_children;
19045 }
19046 _children[_n++] = _res;
19047 _mark = p->mark;
19048 }
19049 p->mark = _mark;
19050 D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019051 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019052 }
19053 if (_n == 0 || p->error_indicator) {
19054 PyMem_Free(_children);
19055 D(p->level--);
19056 return NULL;
19057 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019058 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019059 if (!_seq) {
19060 PyMem_Free(_children);
19061 p->error_indicator = 1;
19062 PyErr_NoMemory();
19063 D(p->level--);
19064 return NULL;
19065 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019066 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019067 PyMem_Free(_children);
19068 _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq);
19069 D(p->level--);
19070 return _seq;
19071}
19072
19073// _loop1_60: param_no_default
19074static asdl_seq *
19075_loop1_60_rule(Parser *p)
19076{
19077 D(p->level++);
19078 if (p->error_indicator) {
19079 D(p->level--);
19080 return NULL;
19081 }
19082 void *_res = NULL;
19083 int _mark = p->mark;
19084 int _start_mark = p->mark;
19085 void **_children = PyMem_Malloc(sizeof(void *));
19086 if (!_children) {
19087 p->error_indicator = 1;
19088 PyErr_NoMemory();
19089 D(p->level--);
19090 return NULL;
19091 }
19092 ssize_t _children_capacity = 1;
19093 ssize_t _n = 0;
19094 { // param_no_default
19095 if (p->error_indicator) {
19096 D(p->level--);
19097 return NULL;
19098 }
19099 D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19100 arg_ty param_no_default_var;
19101 while (
19102 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19103 )
19104 {
19105 _res = param_no_default_var;
19106 if (_n == _children_capacity) {
19107 _children_capacity *= 2;
19108 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19109 if (!_new_children) {
19110 p->error_indicator = 1;
19111 PyErr_NoMemory();
19112 D(p->level--);
19113 return NULL;
19114 }
19115 _children = _new_children;
19116 }
19117 _children[_n++] = _res;
19118 _mark = p->mark;
19119 }
19120 p->mark = _mark;
19121 D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ',
19122 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19123 }
19124 if (_n == 0 || p->error_indicator) {
19125 PyMem_Free(_children);
19126 D(p->level--);
19127 return NULL;
19128 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019129 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019130 if (!_seq) {
19131 PyMem_Free(_children);
19132 p->error_indicator = 1;
19133 PyErr_NoMemory();
19134 D(p->level--);
19135 return NULL;
19136 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019137 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019138 PyMem_Free(_children);
19139 _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq);
19140 D(p->level--);
19141 return _seq;
19142}
19143
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019144// _loop1_61: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019145static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019146_loop1_61_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019147{
19148 D(p->level++);
19149 if (p->error_indicator) {
19150 D(p->level--);
19151 return NULL;
19152 }
19153 void *_res = NULL;
19154 int _mark = p->mark;
19155 int _start_mark = p->mark;
19156 void **_children = PyMem_Malloc(sizeof(void *));
19157 if (!_children) {
19158 p->error_indicator = 1;
19159 PyErr_NoMemory();
19160 D(p->level--);
19161 return NULL;
19162 }
19163 ssize_t _children_capacity = 1;
19164 ssize_t _n = 0;
19165 { // param_no_default
19166 if (p->error_indicator) {
19167 D(p->level--);
19168 return NULL;
19169 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019170 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 +010019171 arg_ty param_no_default_var;
19172 while (
19173 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19174 )
19175 {
19176 _res = param_no_default_var;
19177 if (_n == _children_capacity) {
19178 _children_capacity *= 2;
19179 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19180 if (!_new_children) {
19181 p->error_indicator = 1;
19182 PyErr_NoMemory();
19183 D(p->level--);
19184 return NULL;
19185 }
19186 _children = _new_children;
19187 }
19188 _children[_n++] = _res;
19189 _mark = p->mark;
19190 }
19191 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019192 D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019193 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19194 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019195 if (_n == 0 || p->error_indicator) {
19196 PyMem_Free(_children);
19197 D(p->level--);
19198 return NULL;
19199 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019200 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019201 if (!_seq) {
19202 PyMem_Free(_children);
19203 p->error_indicator = 1;
19204 PyErr_NoMemory();
19205 D(p->level--);
19206 return NULL;
19207 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019208 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019209 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019210 _PyPegen_insert_memo(p, _start_mark, _loop1_61_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019211 D(p->level--);
19212 return _seq;
19213}
19214
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019215// _loop0_62: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019216static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019217_loop0_62_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019218{
19219 D(p->level++);
19220 if (p->error_indicator) {
19221 D(p->level--);
19222 return NULL;
19223 }
19224 void *_res = NULL;
19225 int _mark = p->mark;
19226 int _start_mark = p->mark;
19227 void **_children = PyMem_Malloc(sizeof(void *));
19228 if (!_children) {
19229 p->error_indicator = 1;
19230 PyErr_NoMemory();
19231 D(p->level--);
19232 return NULL;
19233 }
19234 ssize_t _children_capacity = 1;
19235 ssize_t _n = 0;
19236 { // param_no_default
19237 if (p->error_indicator) {
19238 D(p->level--);
19239 return NULL;
19240 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019241 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 +010019242 arg_ty param_no_default_var;
19243 while (
19244 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19245 )
19246 {
19247 _res = param_no_default_var;
19248 if (_n == _children_capacity) {
19249 _children_capacity *= 2;
19250 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19251 if (!_new_children) {
19252 p->error_indicator = 1;
19253 PyErr_NoMemory();
19254 D(p->level--);
19255 return NULL;
19256 }
19257 _children = _new_children;
19258 }
19259 _children[_n++] = _res;
19260 _mark = p->mark;
19261 }
19262 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019263 D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019264 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19265 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019266 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019267 if (!_seq) {
19268 PyMem_Free(_children);
19269 p->error_indicator = 1;
19270 PyErr_NoMemory();
19271 D(p->level--);
19272 return NULL;
19273 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019274 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019275 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019276 _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019277 D(p->level--);
19278 return _seq;
19279}
19280
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019281// _loop1_63: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019282static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019283_loop1_63_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019284{
19285 D(p->level++);
19286 if (p->error_indicator) {
19287 D(p->level--);
19288 return NULL;
19289 }
19290 void *_res = NULL;
19291 int _mark = p->mark;
19292 int _start_mark = p->mark;
19293 void **_children = PyMem_Malloc(sizeof(void *));
19294 if (!_children) {
19295 p->error_indicator = 1;
19296 PyErr_NoMemory();
19297 D(p->level--);
19298 return NULL;
19299 }
19300 ssize_t _children_capacity = 1;
19301 ssize_t _n = 0;
19302 { // param_with_default
19303 if (p->error_indicator) {
19304 D(p->level--);
19305 return NULL;
19306 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019307 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 +010019308 NameDefaultPair* param_with_default_var;
19309 while (
19310 (param_with_default_var = param_with_default_rule(p)) // param_with_default
19311 )
19312 {
19313 _res = param_with_default_var;
19314 if (_n == _children_capacity) {
19315 _children_capacity *= 2;
19316 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19317 if (!_new_children) {
19318 p->error_indicator = 1;
19319 PyErr_NoMemory();
19320 D(p->level--);
19321 return NULL;
19322 }
19323 _children = _new_children;
19324 }
19325 _children[_n++] = _res;
19326 _mark = p->mark;
19327 }
19328 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019329 D(fprintf(stderr, "%*c%s _loop1_63[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019330 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
19331 }
19332 if (_n == 0 || p->error_indicator) {
19333 PyMem_Free(_children);
19334 D(p->level--);
19335 return NULL;
19336 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019337 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019338 if (!_seq) {
19339 PyMem_Free(_children);
19340 p->error_indicator = 1;
19341 PyErr_NoMemory();
19342 D(p->level--);
19343 return NULL;
19344 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019345 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019346 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019347 _PyPegen_insert_memo(p, _start_mark, _loop1_63_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019348 D(p->level--);
19349 return _seq;
19350}
19351
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019352// _loop0_64: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019353static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019354_loop0_64_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019355{
19356 D(p->level++);
19357 if (p->error_indicator) {
19358 D(p->level--);
19359 return NULL;
19360 }
19361 void *_res = NULL;
19362 int _mark = p->mark;
19363 int _start_mark = p->mark;
19364 void **_children = PyMem_Malloc(sizeof(void *));
19365 if (!_children) {
19366 p->error_indicator = 1;
19367 PyErr_NoMemory();
19368 D(p->level--);
19369 return NULL;
19370 }
19371 ssize_t _children_capacity = 1;
19372 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019373 { // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019374 if (p->error_indicator) {
19375 D(p->level--);
19376 return NULL;
19377 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019378 D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19379 arg_ty param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019380 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019381 (param_no_default_var = param_no_default_rule(p)) // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019382 )
19383 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019384 _res = param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019385 if (_n == _children_capacity) {
19386 _children_capacity *= 2;
19387 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19388 if (!_new_children) {
19389 p->error_indicator = 1;
19390 PyErr_NoMemory();
19391 D(p->level--);
19392 return NULL;
19393 }
19394 _children = _new_children;
19395 }
19396 _children[_n++] = _res;
19397 _mark = p->mark;
19398 }
19399 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019400 D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ',
19401 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019402 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019403 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019404 if (!_seq) {
19405 PyMem_Free(_children);
19406 p->error_indicator = 1;
19407 PyErr_NoMemory();
19408 D(p->level--);
19409 return NULL;
19410 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019411 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019412 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019413 _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019414 D(p->level--);
19415 return _seq;
19416}
19417
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019418// _loop1_65: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019419static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019420_loop1_65_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019421{
19422 D(p->level++);
19423 if (p->error_indicator) {
19424 D(p->level--);
19425 return NULL;
19426 }
19427 void *_res = NULL;
19428 int _mark = p->mark;
19429 int _start_mark = p->mark;
19430 void **_children = PyMem_Malloc(sizeof(void *));
19431 if (!_children) {
19432 p->error_indicator = 1;
19433 PyErr_NoMemory();
19434 D(p->level--);
19435 return NULL;
19436 }
19437 ssize_t _children_capacity = 1;
19438 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019439 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019440 if (p->error_indicator) {
19441 D(p->level--);
19442 return NULL;
19443 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019444 D(fprintf(stderr, "%*c> _loop1_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
19445 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019446 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019447 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019448 )
19449 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019450 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019451 if (_n == _children_capacity) {
19452 _children_capacity *= 2;
19453 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19454 if (!_new_children) {
19455 p->error_indicator = 1;
19456 PyErr_NoMemory();
19457 D(p->level--);
19458 return NULL;
19459 }
19460 _children = _new_children;
19461 }
19462 _children[_n++] = _res;
19463 _mark = p->mark;
19464 }
19465 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019466 D(fprintf(stderr, "%*c%s _loop1_65[%d-%d]: %s failed!\n", p->level, ' ',
19467 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019468 }
19469 if (_n == 0 || p->error_indicator) {
19470 PyMem_Free(_children);
19471 D(p->level--);
19472 return NULL;
19473 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019474 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019475 if (!_seq) {
19476 PyMem_Free(_children);
19477 p->error_indicator = 1;
19478 PyErr_NoMemory();
19479 D(p->level--);
19480 return NULL;
19481 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019482 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019483 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019484 _PyPegen_insert_memo(p, _start_mark, _loop1_65_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019485 D(p->level--);
19486 return _seq;
19487}
19488
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019489// _loop0_66: param_maybe_default
19490static asdl_seq *
19491_loop0_66_rule(Parser *p)
19492{
19493 D(p->level++);
19494 if (p->error_indicator) {
19495 D(p->level--);
19496 return NULL;
19497 }
19498 void *_res = NULL;
19499 int _mark = p->mark;
19500 int _start_mark = p->mark;
19501 void **_children = PyMem_Malloc(sizeof(void *));
19502 if (!_children) {
19503 p->error_indicator = 1;
19504 PyErr_NoMemory();
19505 D(p->level--);
19506 return NULL;
19507 }
19508 ssize_t _children_capacity = 1;
19509 ssize_t _n = 0;
19510 { // param_maybe_default
19511 if (p->error_indicator) {
19512 D(p->level--);
19513 return NULL;
19514 }
19515 D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19516 NameDefaultPair* param_maybe_default_var;
19517 while (
19518 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19519 )
19520 {
19521 _res = param_maybe_default_var;
19522 if (_n == _children_capacity) {
19523 _children_capacity *= 2;
19524 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19525 if (!_new_children) {
19526 p->error_indicator = 1;
19527 PyErr_NoMemory();
19528 D(p->level--);
19529 return NULL;
19530 }
19531 _children = _new_children;
19532 }
19533 _children[_n++] = _res;
19534 _mark = p->mark;
19535 }
19536 p->mark = _mark;
19537 D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ',
19538 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19539 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019540 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019541 if (!_seq) {
19542 PyMem_Free(_children);
19543 p->error_indicator = 1;
19544 PyErr_NoMemory();
19545 D(p->level--);
19546 return NULL;
19547 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019548 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019549 PyMem_Free(_children);
19550 _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq);
19551 D(p->level--);
19552 return _seq;
19553}
19554
19555// _loop1_67: param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019556static asdl_seq *
19557_loop1_67_rule(Parser *p)
19558{
19559 D(p->level++);
19560 if (p->error_indicator) {
19561 D(p->level--);
19562 return NULL;
19563 }
19564 void *_res = NULL;
19565 int _mark = p->mark;
19566 int _start_mark = p->mark;
19567 void **_children = PyMem_Malloc(sizeof(void *));
19568 if (!_children) {
19569 p->error_indicator = 1;
19570 PyErr_NoMemory();
19571 D(p->level--);
19572 return NULL;
19573 }
19574 ssize_t _children_capacity = 1;
19575 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019576 { // param_maybe_default
19577 if (p->error_indicator) {
19578 D(p->level--);
19579 return NULL;
19580 }
19581 D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19582 NameDefaultPair* param_maybe_default_var;
19583 while (
19584 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19585 )
19586 {
19587 _res = param_maybe_default_var;
19588 if (_n == _children_capacity) {
19589 _children_capacity *= 2;
19590 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19591 if (!_new_children) {
19592 p->error_indicator = 1;
19593 PyErr_NoMemory();
19594 D(p->level--);
19595 return NULL;
19596 }
19597 _children = _new_children;
19598 }
19599 _children[_n++] = _res;
19600 _mark = p->mark;
19601 }
19602 p->mark = _mark;
19603 D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ',
19604 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19605 }
19606 if (_n == 0 || p->error_indicator) {
19607 PyMem_Free(_children);
19608 D(p->level--);
19609 return NULL;
19610 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019611 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019612 if (!_seq) {
19613 PyMem_Free(_children);
19614 p->error_indicator = 1;
19615 PyErr_NoMemory();
19616 D(p->level--);
19617 return NULL;
19618 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019619 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019620 PyMem_Free(_children);
19621 _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq);
19622 D(p->level--);
19623 return _seq;
19624}
19625
19626// _loop1_68: ('@' named_expression NEWLINE)
19627static asdl_seq *
19628_loop1_68_rule(Parser *p)
19629{
19630 D(p->level++);
19631 if (p->error_indicator) {
19632 D(p->level--);
19633 return NULL;
19634 }
19635 void *_res = NULL;
19636 int _mark = p->mark;
19637 int _start_mark = p->mark;
19638 void **_children = PyMem_Malloc(sizeof(void *));
19639 if (!_children) {
19640 p->error_indicator = 1;
19641 PyErr_NoMemory();
19642 D(p->level--);
19643 return NULL;
19644 }
19645 ssize_t _children_capacity = 1;
19646 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019647 { // ('@' named_expression NEWLINE)
19648 if (p->error_indicator) {
19649 D(p->level--);
19650 return NULL;
19651 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019652 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 +010019653 void *_tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019654 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019655 (_tmp_142_var = _tmp_142_rule(p)) // '@' named_expression NEWLINE
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019656 )
19657 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019658 _res = _tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019659 if (_n == _children_capacity) {
19660 _children_capacity *= 2;
19661 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19662 if (!_new_children) {
19663 p->error_indicator = 1;
19664 PyErr_NoMemory();
19665 D(p->level--);
19666 return NULL;
19667 }
19668 _children = _new_children;
19669 }
19670 _children[_n++] = _res;
19671 _mark = p->mark;
19672 }
19673 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019674 D(fprintf(stderr, "%*c%s _loop1_68[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019675 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
19676 }
19677 if (_n == 0 || p->error_indicator) {
19678 PyMem_Free(_children);
19679 D(p->level--);
19680 return NULL;
19681 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019682 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019683 if (!_seq) {
19684 PyMem_Free(_children);
19685 p->error_indicator = 1;
19686 PyErr_NoMemory();
19687 D(p->level--);
19688 return NULL;
19689 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019690 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019691 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019692 _PyPegen_insert_memo(p, _start_mark, _loop1_68_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019693 D(p->level--);
19694 return _seq;
19695}
19696
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019697// _tmp_69: '(' arguments? ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019698static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019699_tmp_69_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019700{
19701 D(p->level++);
19702 if (p->error_indicator) {
19703 D(p->level--);
19704 return NULL;
19705 }
19706 void * _res = NULL;
19707 int _mark = p->mark;
19708 { // '(' arguments? ')'
19709 if (p->error_indicator) {
19710 D(p->level--);
19711 return NULL;
19712 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019713 D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019714 Token * _literal;
19715 Token * _literal_1;
19716 void *z;
19717 if (
19718 (_literal = _PyPegen_expect_token(p, 7)) // token='('
19719 &&
19720 (z = arguments_rule(p), 1) // arguments?
19721 &&
19722 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
19723 )
19724 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019725 D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019726 _res = z;
19727 if (_res == NULL && PyErr_Occurred()) {
19728 p->error_indicator = 1;
19729 D(p->level--);
19730 return NULL;
19731 }
19732 goto done;
19733 }
19734 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019735 D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019736 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
19737 }
19738 _res = NULL;
19739 done:
19740 D(p->level--);
19741 return _res;
19742}
19743
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019744// _loop0_71: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019745static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019746_loop0_71_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019747{
19748 D(p->level++);
19749 if (p->error_indicator) {
19750 D(p->level--);
19751 return NULL;
19752 }
19753 void *_res = NULL;
19754 int _mark = p->mark;
19755 int _start_mark = p->mark;
19756 void **_children = PyMem_Malloc(sizeof(void *));
19757 if (!_children) {
19758 p->error_indicator = 1;
19759 PyErr_NoMemory();
19760 D(p->level--);
19761 return NULL;
19762 }
19763 ssize_t _children_capacity = 1;
19764 ssize_t _n = 0;
19765 { // ',' star_expression
19766 if (p->error_indicator) {
19767 D(p->level--);
19768 return NULL;
19769 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019770 D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019771 Token * _literal;
19772 expr_ty elem;
19773 while (
19774 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19775 &&
19776 (elem = star_expression_rule(p)) // star_expression
19777 )
19778 {
19779 _res = elem;
19780 if (_res == NULL && PyErr_Occurred()) {
19781 p->error_indicator = 1;
19782 PyMem_Free(_children);
19783 D(p->level--);
19784 return NULL;
19785 }
19786 if (_n == _children_capacity) {
19787 _children_capacity *= 2;
19788 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19789 if (!_new_children) {
19790 p->error_indicator = 1;
19791 PyErr_NoMemory();
19792 D(p->level--);
19793 return NULL;
19794 }
19795 _children = _new_children;
19796 }
19797 _children[_n++] = _res;
19798 _mark = p->mark;
19799 }
19800 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019801 D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019802 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
19803 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019804 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019805 if (!_seq) {
19806 PyMem_Free(_children);
19807 p->error_indicator = 1;
19808 PyErr_NoMemory();
19809 D(p->level--);
19810 return NULL;
19811 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019812 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019813 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019814 _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019815 D(p->level--);
19816 return _seq;
19817}
19818
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019819// _gather_70: star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019820static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019821_gather_70_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019822{
19823 D(p->level++);
19824 if (p->error_indicator) {
19825 D(p->level--);
19826 return NULL;
19827 }
19828 asdl_seq * _res = NULL;
19829 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019830 { // star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019831 if (p->error_indicator) {
19832 D(p->level--);
19833 return NULL;
19834 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019835 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 +010019836 expr_ty elem;
19837 asdl_seq * seq;
19838 if (
19839 (elem = star_expression_rule(p)) // star_expression
19840 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019841 (seq = _loop0_71_rule(p)) // _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019842 )
19843 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019844 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 +010019845 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19846 goto done;
19847 }
19848 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019849 D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ',
19850 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_71"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019851 }
19852 _res = NULL;
19853 done:
19854 D(p->level--);
19855 return _res;
19856}
19857
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019858// _loop1_72: (',' star_expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019859static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019860_loop1_72_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019861{
19862 D(p->level++);
19863 if (p->error_indicator) {
19864 D(p->level--);
19865 return NULL;
19866 }
19867 void *_res = NULL;
19868 int _mark = p->mark;
19869 int _start_mark = p->mark;
19870 void **_children = PyMem_Malloc(sizeof(void *));
19871 if (!_children) {
19872 p->error_indicator = 1;
19873 PyErr_NoMemory();
19874 D(p->level--);
19875 return NULL;
19876 }
19877 ssize_t _children_capacity = 1;
19878 ssize_t _n = 0;
19879 { // (',' star_expression)
19880 if (p->error_indicator) {
19881 D(p->level--);
19882 return NULL;
19883 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019884 D(fprintf(stderr, "%*c> _loop1_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019885 void *_tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019886 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019887 (_tmp_143_var = _tmp_143_rule(p)) // ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019888 )
19889 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019890 _res = _tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019891 if (_n == _children_capacity) {
19892 _children_capacity *= 2;
19893 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19894 if (!_new_children) {
19895 p->error_indicator = 1;
19896 PyErr_NoMemory();
19897 D(p->level--);
19898 return NULL;
19899 }
19900 _children = _new_children;
19901 }
19902 _children[_n++] = _res;
19903 _mark = p->mark;
19904 }
19905 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019906 D(fprintf(stderr, "%*c%s _loop1_72[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019907 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
19908 }
19909 if (_n == 0 || p->error_indicator) {
19910 PyMem_Free(_children);
19911 D(p->level--);
19912 return NULL;
19913 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019914 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019915 if (!_seq) {
19916 PyMem_Free(_children);
19917 p->error_indicator = 1;
19918 PyErr_NoMemory();
19919 D(p->level--);
19920 return NULL;
19921 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019922 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019923 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019924 _PyPegen_insert_memo(p, _start_mark, _loop1_72_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019925 D(p->level--);
19926 return _seq;
19927}
19928
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019929// _loop0_74: ',' star_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019930static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019931_loop0_74_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019932{
19933 D(p->level++);
19934 if (p->error_indicator) {
19935 D(p->level--);
19936 return NULL;
19937 }
19938 void *_res = NULL;
19939 int _mark = p->mark;
19940 int _start_mark = p->mark;
19941 void **_children = PyMem_Malloc(sizeof(void *));
19942 if (!_children) {
19943 p->error_indicator = 1;
19944 PyErr_NoMemory();
19945 D(p->level--);
19946 return NULL;
19947 }
19948 ssize_t _children_capacity = 1;
19949 ssize_t _n = 0;
19950 { // ',' star_named_expression
19951 if (p->error_indicator) {
19952 D(p->level--);
19953 return NULL;
19954 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019955 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 +010019956 Token * _literal;
19957 expr_ty elem;
19958 while (
19959 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19960 &&
19961 (elem = star_named_expression_rule(p)) // star_named_expression
19962 )
19963 {
19964 _res = elem;
19965 if (_res == NULL && PyErr_Occurred()) {
19966 p->error_indicator = 1;
19967 PyMem_Free(_children);
19968 D(p->level--);
19969 return NULL;
19970 }
19971 if (_n == _children_capacity) {
19972 _children_capacity *= 2;
19973 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19974 if (!_new_children) {
19975 p->error_indicator = 1;
19976 PyErr_NoMemory();
19977 D(p->level--);
19978 return NULL;
19979 }
19980 _children = _new_children;
19981 }
19982 _children[_n++] = _res;
19983 _mark = p->mark;
19984 }
19985 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019986 D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019987 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
19988 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019989 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019990 if (!_seq) {
19991 PyMem_Free(_children);
19992 p->error_indicator = 1;
19993 PyErr_NoMemory();
19994 D(p->level--);
19995 return NULL;
19996 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019997 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019998 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019999 _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020000 D(p->level--);
20001 return _seq;
20002}
20003
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020004// _gather_73: star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020005static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020006_gather_73_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020007{
20008 D(p->level++);
20009 if (p->error_indicator) {
20010 D(p->level--);
20011 return NULL;
20012 }
20013 asdl_seq * _res = NULL;
20014 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020015 { // star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020016 if (p->error_indicator) {
20017 D(p->level--);
20018 return NULL;
20019 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020020 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 +010020021 expr_ty elem;
20022 asdl_seq * seq;
20023 if (
20024 (elem = star_named_expression_rule(p)) // star_named_expression
20025 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020026 (seq = _loop0_74_rule(p)) // _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020027 )
20028 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020029 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 +010020030 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
20031 goto done;
20032 }
20033 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020034 D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ',
20035 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_74"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020036 }
20037 _res = NULL;
20038 done:
20039 D(p->level--);
20040 return _res;
20041}
20042
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020043// _loop1_75: (',' expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020044static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020045_loop1_75_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020046{
20047 D(p->level++);
20048 if (p->error_indicator) {
20049 D(p->level--);
20050 return NULL;
20051 }
20052 void *_res = NULL;
20053 int _mark = p->mark;
20054 int _start_mark = p->mark;
20055 void **_children = PyMem_Malloc(sizeof(void *));
20056 if (!_children) {
20057 p->error_indicator = 1;
20058 PyErr_NoMemory();
20059 D(p->level--);
20060 return NULL;
20061 }
20062 ssize_t _children_capacity = 1;
20063 ssize_t _n = 0;
20064 { // (',' expression)
20065 if (p->error_indicator) {
20066 D(p->level--);
20067 return NULL;
20068 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020069 D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010020070 void *_tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020071 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010020072 (_tmp_144_var = _tmp_144_rule(p)) // ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020073 )
20074 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010020075 _res = _tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020076 if (_n == _children_capacity) {
20077 _children_capacity *= 2;
20078 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20079 if (!_new_children) {
20080 p->error_indicator = 1;
20081 PyErr_NoMemory();
20082 D(p->level--);
20083 return NULL;
20084 }
20085 _children = _new_children;
20086 }
20087 _children[_n++] = _res;
20088 _mark = p->mark;
20089 }
20090 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020091 D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020092 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
20093 }
20094 if (_n == 0 || p->error_indicator) {
20095 PyMem_Free(_children);
20096 D(p->level--);
20097 return NULL;
20098 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020099 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020100 if (!_seq) {
20101 PyMem_Free(_children);
20102 p->error_indicator = 1;
20103 PyErr_NoMemory();
20104 D(p->level--);
20105 return NULL;
20106 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020107 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020108 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020109 _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020110 D(p->level--);
20111 return _seq;
20112}
20113
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020114// _loop0_76: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020115static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020116_loop0_76_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020117{
20118 D(p->level++);
20119 if (p->error_indicator) {
20120 D(p->level--);
20121 return NULL;
20122 }
20123 void *_res = NULL;
20124 int _mark = p->mark;
20125 int _start_mark = p->mark;
20126 void **_children = PyMem_Malloc(sizeof(void *));
20127 if (!_children) {
20128 p->error_indicator = 1;
20129 PyErr_NoMemory();
20130 D(p->level--);
20131 return NULL;
20132 }
20133 ssize_t _children_capacity = 1;
20134 ssize_t _n = 0;
20135 { // lambda_param_no_default
20136 if (p->error_indicator) {
20137 D(p->level--);
20138 return NULL;
20139 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020140 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 +010020141 arg_ty lambda_param_no_default_var;
20142 while (
20143 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20144 )
20145 {
20146 _res = lambda_param_no_default_var;
20147 if (_n == _children_capacity) {
20148 _children_capacity *= 2;
20149 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20150 if (!_new_children) {
20151 p->error_indicator = 1;
20152 PyErr_NoMemory();
20153 D(p->level--);
20154 return NULL;
20155 }
20156 _children = _new_children;
20157 }
20158 _children[_n++] = _res;
20159 _mark = p->mark;
20160 }
20161 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020162 D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020163 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020164 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020165 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020166 if (!_seq) {
20167 PyMem_Free(_children);
20168 p->error_indicator = 1;
20169 PyErr_NoMemory();
20170 D(p->level--);
20171 return NULL;
20172 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020173 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020174 PyMem_Free(_children);
20175 _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq);
20176 D(p->level--);
20177 return _seq;
20178}
20179
20180// _loop0_77: lambda_param_with_default
20181static asdl_seq *
20182_loop0_77_rule(Parser *p)
20183{
20184 D(p->level++);
20185 if (p->error_indicator) {
20186 D(p->level--);
20187 return NULL;
20188 }
20189 void *_res = NULL;
20190 int _mark = p->mark;
20191 int _start_mark = p->mark;
20192 void **_children = PyMem_Malloc(sizeof(void *));
20193 if (!_children) {
20194 p->error_indicator = 1;
20195 PyErr_NoMemory();
20196 D(p->level--);
20197 return NULL;
20198 }
20199 ssize_t _children_capacity = 1;
20200 ssize_t _n = 0;
20201 { // lambda_param_with_default
20202 if (p->error_indicator) {
20203 D(p->level--);
20204 return NULL;
20205 }
20206 D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20207 NameDefaultPair* lambda_param_with_default_var;
20208 while (
20209 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20210 )
20211 {
20212 _res = lambda_param_with_default_var;
20213 if (_n == _children_capacity) {
20214 _children_capacity *= 2;
20215 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20216 if (!_new_children) {
20217 p->error_indicator = 1;
20218 PyErr_NoMemory();
20219 D(p->level--);
20220 return NULL;
20221 }
20222 _children = _new_children;
20223 }
20224 _children[_n++] = _res;
20225 _mark = p->mark;
20226 }
20227 p->mark = _mark;
20228 D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ',
20229 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20230 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020231 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020232 if (!_seq) {
20233 PyMem_Free(_children);
20234 p->error_indicator = 1;
20235 PyErr_NoMemory();
20236 D(p->level--);
20237 return NULL;
20238 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020239 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020240 PyMem_Free(_children);
20241 _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq);
20242 D(p->level--);
20243 return _seq;
20244}
20245
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020246// _loop0_78: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020247static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020248_loop0_78_rule(Parser *p)
20249{
20250 D(p->level++);
20251 if (p->error_indicator) {
20252 D(p->level--);
20253 return NULL;
20254 }
20255 void *_res = NULL;
20256 int _mark = p->mark;
20257 int _start_mark = p->mark;
20258 void **_children = PyMem_Malloc(sizeof(void *));
20259 if (!_children) {
20260 p->error_indicator = 1;
20261 PyErr_NoMemory();
20262 D(p->level--);
20263 return NULL;
20264 }
20265 ssize_t _children_capacity = 1;
20266 ssize_t _n = 0;
20267 { // lambda_param_with_default
20268 if (p->error_indicator) {
20269 D(p->level--);
20270 return NULL;
20271 }
20272 D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20273 NameDefaultPair* lambda_param_with_default_var;
20274 while (
20275 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20276 )
20277 {
20278 _res = lambda_param_with_default_var;
20279 if (_n == _children_capacity) {
20280 _children_capacity *= 2;
20281 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20282 if (!_new_children) {
20283 p->error_indicator = 1;
20284 PyErr_NoMemory();
20285 D(p->level--);
20286 return NULL;
20287 }
20288 _children = _new_children;
20289 }
20290 _children[_n++] = _res;
20291 _mark = p->mark;
20292 }
20293 p->mark = _mark;
20294 D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
20295 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20296 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020297 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020298 if (!_seq) {
20299 PyMem_Free(_children);
20300 p->error_indicator = 1;
20301 PyErr_NoMemory();
20302 D(p->level--);
20303 return NULL;
20304 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020305 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020306 PyMem_Free(_children);
20307 _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
20308 D(p->level--);
20309 return _seq;
20310}
20311
20312// _loop1_79: lambda_param_no_default
20313static asdl_seq *
20314_loop1_79_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020315{
20316 D(p->level++);
20317 if (p->error_indicator) {
20318 D(p->level--);
20319 return NULL;
20320 }
20321 void *_res = NULL;
20322 int _mark = p->mark;
20323 int _start_mark = p->mark;
20324 void **_children = PyMem_Malloc(sizeof(void *));
20325 if (!_children) {
20326 p->error_indicator = 1;
20327 PyErr_NoMemory();
20328 D(p->level--);
20329 return NULL;
20330 }
20331 ssize_t _children_capacity = 1;
20332 ssize_t _n = 0;
20333 { // lambda_param_no_default
20334 if (p->error_indicator) {
20335 D(p->level--);
20336 return NULL;
20337 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020338 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 +010020339 arg_ty lambda_param_no_default_var;
20340 while (
20341 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20342 )
20343 {
20344 _res = lambda_param_no_default_var;
20345 if (_n == _children_capacity) {
20346 _children_capacity *= 2;
20347 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20348 if (!_new_children) {
20349 p->error_indicator = 1;
20350 PyErr_NoMemory();
20351 D(p->level--);
20352 return NULL;
20353 }
20354 _children = _new_children;
20355 }
20356 _children[_n++] = _res;
20357 _mark = p->mark;
20358 }
20359 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020360 D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020361 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20362 }
20363 if (_n == 0 || p->error_indicator) {
20364 PyMem_Free(_children);
20365 D(p->level--);
20366 return NULL;
20367 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020368 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020369 if (!_seq) {
20370 PyMem_Free(_children);
20371 p->error_indicator = 1;
20372 PyErr_NoMemory();
20373 D(p->level--);
20374 return NULL;
20375 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020376 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020377 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020378 _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020379 D(p->level--);
20380 return _seq;
20381}
20382
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020383// _loop0_80: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020384static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020385_loop0_80_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020386{
20387 D(p->level++);
20388 if (p->error_indicator) {
20389 D(p->level--);
20390 return NULL;
20391 }
20392 void *_res = NULL;
20393 int _mark = p->mark;
20394 int _start_mark = p->mark;
20395 void **_children = PyMem_Malloc(sizeof(void *));
20396 if (!_children) {
20397 p->error_indicator = 1;
20398 PyErr_NoMemory();
20399 D(p->level--);
20400 return NULL;
20401 }
20402 ssize_t _children_capacity = 1;
20403 ssize_t _n = 0;
20404 { // lambda_param_with_default
20405 if (p->error_indicator) {
20406 D(p->level--);
20407 return NULL;
20408 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020409 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 +010020410 NameDefaultPair* lambda_param_with_default_var;
20411 while (
20412 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20413 )
20414 {
20415 _res = lambda_param_with_default_var;
20416 if (_n == _children_capacity) {
20417 _children_capacity *= 2;
20418 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20419 if (!_new_children) {
20420 p->error_indicator = 1;
20421 PyErr_NoMemory();
20422 D(p->level--);
20423 return NULL;
20424 }
20425 _children = _new_children;
20426 }
20427 _children[_n++] = _res;
20428 _mark = p->mark;
20429 }
20430 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020431 D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020432 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20433 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020434 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020435 if (!_seq) {
20436 PyMem_Free(_children);
20437 p->error_indicator = 1;
20438 PyErr_NoMemory();
20439 D(p->level--);
20440 return NULL;
20441 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020442 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020443 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020444 _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020445 D(p->level--);
20446 return _seq;
20447}
20448
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020449// _loop1_81: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020450static asdl_seq *
20451_loop1_81_rule(Parser *p)
20452{
20453 D(p->level++);
20454 if (p->error_indicator) {
20455 D(p->level--);
20456 return NULL;
20457 }
20458 void *_res = NULL;
20459 int _mark = p->mark;
20460 int _start_mark = p->mark;
20461 void **_children = PyMem_Malloc(sizeof(void *));
20462 if (!_children) {
20463 p->error_indicator = 1;
20464 PyErr_NoMemory();
20465 D(p->level--);
20466 return NULL;
20467 }
20468 ssize_t _children_capacity = 1;
20469 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020470 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020471 if (p->error_indicator) {
20472 D(p->level--);
20473 return NULL;
20474 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020475 D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20476 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020477 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020478 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020479 )
20480 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020481 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020482 if (_n == _children_capacity) {
20483 _children_capacity *= 2;
20484 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20485 if (!_new_children) {
20486 p->error_indicator = 1;
20487 PyErr_NoMemory();
20488 D(p->level--);
20489 return NULL;
20490 }
20491 _children = _new_children;
20492 }
20493 _children[_n++] = _res;
20494 _mark = p->mark;
20495 }
20496 p->mark = _mark;
20497 D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020499 }
20500 if (_n == 0 || p->error_indicator) {
20501 PyMem_Free(_children);
20502 D(p->level--);
20503 return NULL;
20504 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020505 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020506 if (!_seq) {
20507 PyMem_Free(_children);
20508 p->error_indicator = 1;
20509 PyErr_NoMemory();
20510 D(p->level--);
20511 return NULL;
20512 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020513 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020514 PyMem_Free(_children);
20515 _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
20516 D(p->level--);
20517 return _seq;
20518}
20519
20520// _loop1_82: lambda_param_no_default
20521static asdl_seq *
20522_loop1_82_rule(Parser *p)
20523{
20524 D(p->level++);
20525 if (p->error_indicator) {
20526 D(p->level--);
20527 return NULL;
20528 }
20529 void *_res = NULL;
20530 int _mark = p->mark;
20531 int _start_mark = p->mark;
20532 void **_children = PyMem_Malloc(sizeof(void *));
20533 if (!_children) {
20534 p->error_indicator = 1;
20535 PyErr_NoMemory();
20536 D(p->level--);
20537 return NULL;
20538 }
20539 ssize_t _children_capacity = 1;
20540 ssize_t _n = 0;
20541 { // lambda_param_no_default
20542 if (p->error_indicator) {
20543 D(p->level--);
20544 return NULL;
20545 }
20546 D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20547 arg_ty lambda_param_no_default_var;
20548 while (
20549 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20550 )
20551 {
20552 _res = lambda_param_no_default_var;
20553 if (_n == _children_capacity) {
20554 _children_capacity *= 2;
20555 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20556 if (!_new_children) {
20557 p->error_indicator = 1;
20558 PyErr_NoMemory();
20559 D(p->level--);
20560 return NULL;
20561 }
20562 _children = _new_children;
20563 }
20564 _children[_n++] = _res;
20565 _mark = p->mark;
20566 }
20567 p->mark = _mark;
20568 D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ',
20569 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20570 }
20571 if (_n == 0 || p->error_indicator) {
20572 PyMem_Free(_children);
20573 D(p->level--);
20574 return NULL;
20575 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020576 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020577 if (!_seq) {
20578 PyMem_Free(_children);
20579 p->error_indicator = 1;
20580 PyErr_NoMemory();
20581 D(p->level--);
20582 return NULL;
20583 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020584 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020585 PyMem_Free(_children);
20586 _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq);
20587 D(p->level--);
20588 return _seq;
20589}
20590
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020591// _loop1_83: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020592static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020593_loop1_83_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020594{
20595 D(p->level++);
20596 if (p->error_indicator) {
20597 D(p->level--);
20598 return NULL;
20599 }
20600 void *_res = NULL;
20601 int _mark = p->mark;
20602 int _start_mark = p->mark;
20603 void **_children = PyMem_Malloc(sizeof(void *));
20604 if (!_children) {
20605 p->error_indicator = 1;
20606 PyErr_NoMemory();
20607 D(p->level--);
20608 return NULL;
20609 }
20610 ssize_t _children_capacity = 1;
20611 ssize_t _n = 0;
20612 { // lambda_param_no_default
20613 if (p->error_indicator) {
20614 D(p->level--);
20615 return NULL;
20616 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020617 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 +010020618 arg_ty lambda_param_no_default_var;
20619 while (
20620 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20621 )
20622 {
20623 _res = lambda_param_no_default_var;
20624 if (_n == _children_capacity) {
20625 _children_capacity *= 2;
20626 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20627 if (!_new_children) {
20628 p->error_indicator = 1;
20629 PyErr_NoMemory();
20630 D(p->level--);
20631 return NULL;
20632 }
20633 _children = _new_children;
20634 }
20635 _children[_n++] = _res;
20636 _mark = p->mark;
20637 }
20638 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020639 D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020640 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20641 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020642 if (_n == 0 || p->error_indicator) {
20643 PyMem_Free(_children);
20644 D(p->level--);
20645 return NULL;
20646 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020647 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020648 if (!_seq) {
20649 PyMem_Free(_children);
20650 p->error_indicator = 1;
20651 PyErr_NoMemory();
20652 D(p->level--);
20653 return NULL;
20654 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020655 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020656 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020657 _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020658 D(p->level--);
20659 return _seq;
20660}
20661
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020662// _loop0_84: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020663static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020664_loop0_84_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020665{
20666 D(p->level++);
20667 if (p->error_indicator) {
20668 D(p->level--);
20669 return NULL;
20670 }
20671 void *_res = NULL;
20672 int _mark = p->mark;
20673 int _start_mark = p->mark;
20674 void **_children = PyMem_Malloc(sizeof(void *));
20675 if (!_children) {
20676 p->error_indicator = 1;
20677 PyErr_NoMemory();
20678 D(p->level--);
20679 return NULL;
20680 }
20681 ssize_t _children_capacity = 1;
20682 ssize_t _n = 0;
20683 { // lambda_param_no_default
20684 if (p->error_indicator) {
20685 D(p->level--);
20686 return NULL;
20687 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020688 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 +010020689 arg_ty lambda_param_no_default_var;
20690 while (
20691 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20692 )
20693 {
20694 _res = lambda_param_no_default_var;
20695 if (_n == _children_capacity) {
20696 _children_capacity *= 2;
20697 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20698 if (!_new_children) {
20699 p->error_indicator = 1;
20700 PyErr_NoMemory();
20701 D(p->level--);
20702 return NULL;
20703 }
20704 _children = _new_children;
20705 }
20706 _children[_n++] = _res;
20707 _mark = p->mark;
20708 }
20709 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020710 D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020711 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20712 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020713 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020714 if (!_seq) {
20715 PyMem_Free(_children);
20716 p->error_indicator = 1;
20717 PyErr_NoMemory();
20718 D(p->level--);
20719 return NULL;
20720 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020721 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020722 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020723 _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020724 D(p->level--);
20725 return _seq;
20726}
20727
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020728// _loop1_85: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020729static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020730_loop1_85_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020731{
20732 D(p->level++);
20733 if (p->error_indicator) {
20734 D(p->level--);
20735 return NULL;
20736 }
20737 void *_res = NULL;
20738 int _mark = p->mark;
20739 int _start_mark = p->mark;
20740 void **_children = PyMem_Malloc(sizeof(void *));
20741 if (!_children) {
20742 p->error_indicator = 1;
20743 PyErr_NoMemory();
20744 D(p->level--);
20745 return NULL;
20746 }
20747 ssize_t _children_capacity = 1;
20748 ssize_t _n = 0;
20749 { // lambda_param_with_default
20750 if (p->error_indicator) {
20751 D(p->level--);
20752 return NULL;
20753 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020754 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 +010020755 NameDefaultPair* lambda_param_with_default_var;
20756 while (
20757 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20758 )
20759 {
20760 _res = lambda_param_with_default_var;
20761 if (_n == _children_capacity) {
20762 _children_capacity *= 2;
20763 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20764 if (!_new_children) {
20765 p->error_indicator = 1;
20766 PyErr_NoMemory();
20767 D(p->level--);
20768 return NULL;
20769 }
20770 _children = _new_children;
20771 }
20772 _children[_n++] = _res;
20773 _mark = p->mark;
20774 }
20775 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020776 D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020777 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20778 }
20779 if (_n == 0 || p->error_indicator) {
20780 PyMem_Free(_children);
20781 D(p->level--);
20782 return NULL;
20783 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020784 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020785 if (!_seq) {
20786 PyMem_Free(_children);
20787 p->error_indicator = 1;
20788 PyErr_NoMemory();
20789 D(p->level--);
20790 return NULL;
20791 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020792 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020793 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020794 _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020795 D(p->level--);
20796 return _seq;
20797}
20798
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020799// _loop0_86: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020800static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020801_loop0_86_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020802{
20803 D(p->level++);
20804 if (p->error_indicator) {
20805 D(p->level--);
20806 return NULL;
20807 }
20808 void *_res = NULL;
20809 int _mark = p->mark;
20810 int _start_mark = p->mark;
20811 void **_children = PyMem_Malloc(sizeof(void *));
20812 if (!_children) {
20813 p->error_indicator = 1;
20814 PyErr_NoMemory();
20815 D(p->level--);
20816 return NULL;
20817 }
20818 ssize_t _children_capacity = 1;
20819 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020820 { // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020821 if (p->error_indicator) {
20822 D(p->level--);
20823 return NULL;
20824 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020825 D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20826 arg_ty lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020827 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020828 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020829 )
20830 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020831 _res = lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020832 if (_n == _children_capacity) {
20833 _children_capacity *= 2;
20834 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20835 if (!_new_children) {
20836 p->error_indicator = 1;
20837 PyErr_NoMemory();
20838 D(p->level--);
20839 return NULL;
20840 }
20841 _children = _new_children;
20842 }
20843 _children[_n++] = _res;
20844 _mark = p->mark;
20845 }
20846 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020847 D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
20848 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020849 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020850 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020851 if (!_seq) {
20852 PyMem_Free(_children);
20853 p->error_indicator = 1;
20854 PyErr_NoMemory();
20855 D(p->level--);
20856 return NULL;
20857 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020858 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020859 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020860 _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020861 D(p->level--);
20862 return _seq;
20863}
20864
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020865// _loop1_87: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020866static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020867_loop1_87_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020868{
20869 D(p->level++);
20870 if (p->error_indicator) {
20871 D(p->level--);
20872 return NULL;
20873 }
20874 void *_res = NULL;
20875 int _mark = p->mark;
20876 int _start_mark = p->mark;
20877 void **_children = PyMem_Malloc(sizeof(void *));
20878 if (!_children) {
20879 p->error_indicator = 1;
20880 PyErr_NoMemory();
20881 D(p->level--);
20882 return NULL;
20883 }
20884 ssize_t _children_capacity = 1;
20885 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020886 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020887 if (p->error_indicator) {
20888 D(p->level--);
20889 return NULL;
20890 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020891 D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20892 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020893 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020894 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020895 )
20896 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020897 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020898 if (_n == _children_capacity) {
20899 _children_capacity *= 2;
20900 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20901 if (!_new_children) {
20902 p->error_indicator = 1;
20903 PyErr_NoMemory();
20904 D(p->level--);
20905 return NULL;
20906 }
20907 _children = _new_children;
20908 }
20909 _children[_n++] = _res;
20910 _mark = p->mark;
20911 }
20912 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020913 D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ',
20914 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020915 }
20916 if (_n == 0 || p->error_indicator) {
20917 PyMem_Free(_children);
20918 D(p->level--);
20919 return NULL;
20920 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020921 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020922 if (!_seq) {
20923 PyMem_Free(_children);
20924 p->error_indicator = 1;
20925 PyErr_NoMemory();
20926 D(p->level--);
20927 return NULL;
20928 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020929 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020930 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020931 _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020932 D(p->level--);
20933 return _seq;
20934}
20935
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020936// _loop0_88: lambda_param_maybe_default
20937static asdl_seq *
20938_loop0_88_rule(Parser *p)
20939{
20940 D(p->level++);
20941 if (p->error_indicator) {
20942 D(p->level--);
20943 return NULL;
20944 }
20945 void *_res = NULL;
20946 int _mark = p->mark;
20947 int _start_mark = p->mark;
20948 void **_children = PyMem_Malloc(sizeof(void *));
20949 if (!_children) {
20950 p->error_indicator = 1;
20951 PyErr_NoMemory();
20952 D(p->level--);
20953 return NULL;
20954 }
20955 ssize_t _children_capacity = 1;
20956 ssize_t _n = 0;
20957 { // lambda_param_maybe_default
20958 if (p->error_indicator) {
20959 D(p->level--);
20960 return NULL;
20961 }
20962 D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20963 NameDefaultPair* lambda_param_maybe_default_var;
20964 while (
20965 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20966 )
20967 {
20968 _res = lambda_param_maybe_default_var;
20969 if (_n == _children_capacity) {
20970 _children_capacity *= 2;
20971 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20972 if (!_new_children) {
20973 p->error_indicator = 1;
20974 PyErr_NoMemory();
20975 D(p->level--);
20976 return NULL;
20977 }
20978 _children = _new_children;
20979 }
20980 _children[_n++] = _res;
20981 _mark = p->mark;
20982 }
20983 p->mark = _mark;
20984 D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ',
20985 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20986 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020987 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020988 if (!_seq) {
20989 PyMem_Free(_children);
20990 p->error_indicator = 1;
20991 PyErr_NoMemory();
20992 D(p->level--);
20993 return NULL;
20994 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020995 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020996 PyMem_Free(_children);
20997 _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq);
20998 D(p->level--);
20999 return _seq;
21000}
21001
21002// _loop1_89: lambda_param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021003static asdl_seq *
21004_loop1_89_rule(Parser *p)
21005{
21006 D(p->level++);
21007 if (p->error_indicator) {
21008 D(p->level--);
21009 return NULL;
21010 }
21011 void *_res = NULL;
21012 int _mark = p->mark;
21013 int _start_mark = p->mark;
21014 void **_children = PyMem_Malloc(sizeof(void *));
21015 if (!_children) {
21016 p->error_indicator = 1;
21017 PyErr_NoMemory();
21018 D(p->level--);
21019 return NULL;
21020 }
21021 ssize_t _children_capacity = 1;
21022 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021023 { // lambda_param_maybe_default
21024 if (p->error_indicator) {
21025 D(p->level--);
21026 return NULL;
21027 }
21028 D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
21029 NameDefaultPair* lambda_param_maybe_default_var;
21030 while (
21031 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
21032 )
21033 {
21034 _res = lambda_param_maybe_default_var;
21035 if (_n == _children_capacity) {
21036 _children_capacity *= 2;
21037 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21038 if (!_new_children) {
21039 p->error_indicator = 1;
21040 PyErr_NoMemory();
21041 D(p->level--);
21042 return NULL;
21043 }
21044 _children = _new_children;
21045 }
21046 _children[_n++] = _res;
21047 _mark = p->mark;
21048 }
21049 p->mark = _mark;
21050 D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ',
21051 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
21052 }
21053 if (_n == 0 || p->error_indicator) {
21054 PyMem_Free(_children);
21055 D(p->level--);
21056 return NULL;
21057 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021058 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021059 if (!_seq) {
21060 PyMem_Free(_children);
21061 p->error_indicator = 1;
21062 PyErr_NoMemory();
21063 D(p->level--);
21064 return NULL;
21065 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021066 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021067 PyMem_Free(_children);
21068 _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
21069 D(p->level--);
21070 return _seq;
21071}
21072
21073// _loop1_90: ('or' conjunction)
21074static asdl_seq *
21075_loop1_90_rule(Parser *p)
21076{
21077 D(p->level++);
21078 if (p->error_indicator) {
21079 D(p->level--);
21080 return NULL;
21081 }
21082 void *_res = NULL;
21083 int _mark = p->mark;
21084 int _start_mark = p->mark;
21085 void **_children = PyMem_Malloc(sizeof(void *));
21086 if (!_children) {
21087 p->error_indicator = 1;
21088 PyErr_NoMemory();
21089 D(p->level--);
21090 return NULL;
21091 }
21092 ssize_t _children_capacity = 1;
21093 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021094 { // ('or' conjunction)
21095 if (p->error_indicator) {
21096 D(p->level--);
21097 return NULL;
21098 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021099 D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021100 void *_tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021101 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021102 (_tmp_145_var = _tmp_145_rule(p)) // 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021103 )
21104 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021105 _res = _tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021106 if (_n == _children_capacity) {
21107 _children_capacity *= 2;
21108 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21109 if (!_new_children) {
21110 p->error_indicator = 1;
21111 PyErr_NoMemory();
21112 D(p->level--);
21113 return NULL;
21114 }
21115 _children = _new_children;
21116 }
21117 _children[_n++] = _res;
21118 _mark = p->mark;
21119 }
21120 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021121 D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021122 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
21123 }
21124 if (_n == 0 || p->error_indicator) {
21125 PyMem_Free(_children);
21126 D(p->level--);
21127 return NULL;
21128 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021129 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021130 if (!_seq) {
21131 PyMem_Free(_children);
21132 p->error_indicator = 1;
21133 PyErr_NoMemory();
21134 D(p->level--);
21135 return NULL;
21136 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021137 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021138 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021139 _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021140 D(p->level--);
21141 return _seq;
21142}
21143
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021144// _loop1_91: ('and' inversion)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021145static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021146_loop1_91_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021147{
21148 D(p->level++);
21149 if (p->error_indicator) {
21150 D(p->level--);
21151 return NULL;
21152 }
21153 void *_res = NULL;
21154 int _mark = p->mark;
21155 int _start_mark = p->mark;
21156 void **_children = PyMem_Malloc(sizeof(void *));
21157 if (!_children) {
21158 p->error_indicator = 1;
21159 PyErr_NoMemory();
21160 D(p->level--);
21161 return NULL;
21162 }
21163 ssize_t _children_capacity = 1;
21164 ssize_t _n = 0;
21165 { // ('and' inversion)
21166 if (p->error_indicator) {
21167 D(p->level--);
21168 return NULL;
21169 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021170 D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021171 void *_tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021172 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021173 (_tmp_146_var = _tmp_146_rule(p)) // 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021174 )
21175 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021176 _res = _tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021177 if (_n == _children_capacity) {
21178 _children_capacity *= 2;
21179 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21180 if (!_new_children) {
21181 p->error_indicator = 1;
21182 PyErr_NoMemory();
21183 D(p->level--);
21184 return NULL;
21185 }
21186 _children = _new_children;
21187 }
21188 _children[_n++] = _res;
21189 _mark = p->mark;
21190 }
21191 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021192 D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021193 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
21194 }
21195 if (_n == 0 || p->error_indicator) {
21196 PyMem_Free(_children);
21197 D(p->level--);
21198 return NULL;
21199 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021200 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021201 if (!_seq) {
21202 PyMem_Free(_children);
21203 p->error_indicator = 1;
21204 PyErr_NoMemory();
21205 D(p->level--);
21206 return NULL;
21207 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021208 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021209 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021210 _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021211 D(p->level--);
21212 return _seq;
21213}
21214
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021215// _loop1_92: compare_op_bitwise_or_pair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021216static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021217_loop1_92_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021218{
21219 D(p->level++);
21220 if (p->error_indicator) {
21221 D(p->level--);
21222 return NULL;
21223 }
21224 void *_res = NULL;
21225 int _mark = p->mark;
21226 int _start_mark = p->mark;
21227 void **_children = PyMem_Malloc(sizeof(void *));
21228 if (!_children) {
21229 p->error_indicator = 1;
21230 PyErr_NoMemory();
21231 D(p->level--);
21232 return NULL;
21233 }
21234 ssize_t _children_capacity = 1;
21235 ssize_t _n = 0;
21236 { // compare_op_bitwise_or_pair
21237 if (p->error_indicator) {
21238 D(p->level--);
21239 return NULL;
21240 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021241 D(fprintf(stderr, "%*c> _loop1_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021242 CmpopExprPair* compare_op_bitwise_or_pair_var;
21243 while (
21244 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
21245 )
21246 {
21247 _res = compare_op_bitwise_or_pair_var;
21248 if (_n == _children_capacity) {
21249 _children_capacity *= 2;
21250 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21251 if (!_new_children) {
21252 p->error_indicator = 1;
21253 PyErr_NoMemory();
21254 D(p->level--);
21255 return NULL;
21256 }
21257 _children = _new_children;
21258 }
21259 _children[_n++] = _res;
21260 _mark = p->mark;
21261 }
21262 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021263 D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021264 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
21265 }
21266 if (_n == 0 || p->error_indicator) {
21267 PyMem_Free(_children);
21268 D(p->level--);
21269 return NULL;
21270 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021271 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021272 if (!_seq) {
21273 PyMem_Free(_children);
21274 p->error_indicator = 1;
21275 PyErr_NoMemory();
21276 D(p->level--);
21277 return NULL;
21278 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021279 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021280 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021281 _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021282 D(p->level--);
21283 return _seq;
21284}
21285
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021286// _tmp_93: '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021287static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021288_tmp_93_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021289{
21290 D(p->level++);
21291 if (p->error_indicator) {
21292 D(p->level--);
21293 return NULL;
21294 }
21295 void * _res = NULL;
21296 int _mark = p->mark;
21297 { // '!='
21298 if (p->error_indicator) {
21299 D(p->level--);
21300 return NULL;
21301 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021302 D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021303 Token * tok;
21304 if (
21305 (tok = _PyPegen_expect_token(p, 28)) // token='!='
21306 )
21307 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021308 D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo06f8c332020-10-30 23:48:42 +000021309 _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021310 if (_res == NULL && PyErr_Occurred()) {
21311 p->error_indicator = 1;
21312 D(p->level--);
21313 return NULL;
21314 }
21315 goto done;
21316 }
21317 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021318 D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021319 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
21320 }
21321 _res = NULL;
21322 done:
21323 D(p->level--);
21324 return _res;
21325}
21326
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021327// _loop0_95: ',' slice
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021328static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021329_loop0_95_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021330{
21331 D(p->level++);
21332 if (p->error_indicator) {
21333 D(p->level--);
21334 return NULL;
21335 }
21336 void *_res = NULL;
21337 int _mark = p->mark;
21338 int _start_mark = p->mark;
21339 void **_children = PyMem_Malloc(sizeof(void *));
21340 if (!_children) {
21341 p->error_indicator = 1;
21342 PyErr_NoMemory();
21343 D(p->level--);
21344 return NULL;
21345 }
21346 ssize_t _children_capacity = 1;
21347 ssize_t _n = 0;
21348 { // ',' slice
21349 if (p->error_indicator) {
21350 D(p->level--);
21351 return NULL;
21352 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021353 D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021354 Token * _literal;
21355 expr_ty elem;
21356 while (
21357 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21358 &&
21359 (elem = slice_rule(p)) // slice
21360 )
21361 {
21362 _res = elem;
21363 if (_res == NULL && PyErr_Occurred()) {
21364 p->error_indicator = 1;
21365 PyMem_Free(_children);
21366 D(p->level--);
21367 return NULL;
21368 }
21369 if (_n == _children_capacity) {
21370 _children_capacity *= 2;
21371 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21372 if (!_new_children) {
21373 p->error_indicator = 1;
21374 PyErr_NoMemory();
21375 D(p->level--);
21376 return NULL;
21377 }
21378 _children = _new_children;
21379 }
21380 _children[_n++] = _res;
21381 _mark = p->mark;
21382 }
21383 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021384 D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021385 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
21386 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021387 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021388 if (!_seq) {
21389 PyMem_Free(_children);
21390 p->error_indicator = 1;
21391 PyErr_NoMemory();
21392 D(p->level--);
21393 return NULL;
21394 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021395 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021396 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021397 _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021398 D(p->level--);
21399 return _seq;
21400}
21401
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021402// _gather_94: slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021403static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021404_gather_94_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021405{
21406 D(p->level++);
21407 if (p->error_indicator) {
21408 D(p->level--);
21409 return NULL;
21410 }
21411 asdl_seq * _res = NULL;
21412 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021413 { // slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021414 if (p->error_indicator) {
21415 D(p->level--);
21416 return NULL;
21417 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021418 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 +010021419 expr_ty elem;
21420 asdl_seq * seq;
21421 if (
21422 (elem = slice_rule(p)) // slice
21423 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021424 (seq = _loop0_95_rule(p)) // _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021425 )
21426 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021427 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 +010021428 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21429 goto done;
21430 }
21431 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021432 D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ',
21433 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_95"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021434 }
21435 _res = NULL;
21436 done:
21437 D(p->level--);
21438 return _res;
21439}
21440
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021441// _tmp_96: ':' expression?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021442static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021443_tmp_96_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021444{
21445 D(p->level++);
21446 if (p->error_indicator) {
21447 D(p->level--);
21448 return NULL;
21449 }
21450 void * _res = NULL;
21451 int _mark = p->mark;
21452 { // ':' expression?
21453 if (p->error_indicator) {
21454 D(p->level--);
21455 return NULL;
21456 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021457 D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021458 Token * _literal;
21459 void *d;
21460 if (
21461 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
21462 &&
21463 (d = expression_rule(p), 1) // expression?
21464 )
21465 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021466 D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021467 _res = d;
21468 if (_res == NULL && PyErr_Occurred()) {
21469 p->error_indicator = 1;
21470 D(p->level--);
21471 return NULL;
21472 }
21473 goto done;
21474 }
21475 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021476 D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021477 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
21478 }
21479 _res = NULL;
21480 done:
21481 D(p->level--);
21482 return _res;
21483}
21484
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021485// _tmp_97: tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021486static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021487_tmp_97_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021488{
21489 D(p->level++);
21490 if (p->error_indicator) {
21491 D(p->level--);
21492 return NULL;
21493 }
21494 void * _res = NULL;
21495 int _mark = p->mark;
21496 { // tuple
21497 if (p->error_indicator) {
21498 D(p->level--);
21499 return NULL;
21500 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021501 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021502 expr_ty tuple_var;
21503 if (
21504 (tuple_var = tuple_rule(p)) // tuple
21505 )
21506 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021507 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021508 _res = tuple_var;
21509 goto done;
21510 }
21511 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021512 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021513 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
21514 }
21515 { // group
21516 if (p->error_indicator) {
21517 D(p->level--);
21518 return NULL;
21519 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021520 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021521 expr_ty group_var;
21522 if (
21523 (group_var = group_rule(p)) // group
21524 )
21525 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021526 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021527 _res = group_var;
21528 goto done;
21529 }
21530 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021531 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021532 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
21533 }
21534 { // genexp
21535 if (p->error_indicator) {
21536 D(p->level--);
21537 return NULL;
21538 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021539 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021540 expr_ty genexp_var;
21541 if (
21542 (genexp_var = genexp_rule(p)) // genexp
21543 )
21544 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021545 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021546 _res = genexp_var;
21547 goto done;
21548 }
21549 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021550 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021551 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
21552 }
21553 _res = NULL;
21554 done:
21555 D(p->level--);
21556 return _res;
21557}
21558
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021559// _tmp_98: list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021560static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021561_tmp_98_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021562{
21563 D(p->level++);
21564 if (p->error_indicator) {
21565 D(p->level--);
21566 return NULL;
21567 }
21568 void * _res = NULL;
21569 int _mark = p->mark;
21570 { // list
21571 if (p->error_indicator) {
21572 D(p->level--);
21573 return NULL;
21574 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021575 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021576 expr_ty list_var;
21577 if (
21578 (list_var = list_rule(p)) // list
21579 )
21580 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021581 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021582 _res = list_var;
21583 goto done;
21584 }
21585 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021586 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021587 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
21588 }
21589 { // listcomp
21590 if (p->error_indicator) {
21591 D(p->level--);
21592 return NULL;
21593 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021594 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021595 expr_ty listcomp_var;
21596 if (
21597 (listcomp_var = listcomp_rule(p)) // listcomp
21598 )
21599 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021600 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021601 _res = listcomp_var;
21602 goto done;
21603 }
21604 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021605 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021606 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
21607 }
21608 _res = NULL;
21609 done:
21610 D(p->level--);
21611 return _res;
21612}
21613
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021614// _tmp_99: dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021615static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021616_tmp_99_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021617{
21618 D(p->level++);
21619 if (p->error_indicator) {
21620 D(p->level--);
21621 return NULL;
21622 }
21623 void * _res = NULL;
21624 int _mark = p->mark;
21625 { // dict
21626 if (p->error_indicator) {
21627 D(p->level--);
21628 return NULL;
21629 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021630 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021631 expr_ty dict_var;
21632 if (
21633 (dict_var = dict_rule(p)) // dict
21634 )
21635 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021636 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021637 _res = dict_var;
21638 goto done;
21639 }
21640 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021641 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021642 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
21643 }
21644 { // set
21645 if (p->error_indicator) {
21646 D(p->level--);
21647 return NULL;
21648 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021649 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021650 expr_ty set_var;
21651 if (
21652 (set_var = set_rule(p)) // set
21653 )
21654 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021655 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021656 _res = set_var;
21657 goto done;
21658 }
21659 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021660 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021661 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
21662 }
21663 { // dictcomp
21664 if (p->error_indicator) {
21665 D(p->level--);
21666 return NULL;
21667 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021668 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021669 expr_ty dictcomp_var;
21670 if (
21671 (dictcomp_var = dictcomp_rule(p)) // dictcomp
21672 )
21673 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021674 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021675 _res = dictcomp_var;
21676 goto done;
21677 }
21678 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021679 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021680 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
21681 }
21682 { // setcomp
21683 if (p->error_indicator) {
21684 D(p->level--);
21685 return NULL;
21686 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021687 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021688 expr_ty setcomp_var;
21689 if (
21690 (setcomp_var = setcomp_rule(p)) // setcomp
21691 )
21692 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021693 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021694 _res = setcomp_var;
21695 goto done;
21696 }
21697 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021698 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021699 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
21700 }
21701 _res = NULL;
21702 done:
21703 D(p->level--);
21704 return _res;
21705}
21706
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021707// _loop1_100: STRING
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021708static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021709_loop1_100_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021710{
21711 D(p->level++);
21712 if (p->error_indicator) {
21713 D(p->level--);
21714 return NULL;
21715 }
21716 void *_res = NULL;
21717 int _mark = p->mark;
21718 int _start_mark = p->mark;
21719 void **_children = PyMem_Malloc(sizeof(void *));
21720 if (!_children) {
21721 p->error_indicator = 1;
21722 PyErr_NoMemory();
21723 D(p->level--);
21724 return NULL;
21725 }
21726 ssize_t _children_capacity = 1;
21727 ssize_t _n = 0;
21728 { // STRING
21729 if (p->error_indicator) {
21730 D(p->level--);
21731 return NULL;
21732 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021733 D(fprintf(stderr, "%*c> _loop1_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021734 expr_ty string_var;
21735 while (
21736 (string_var = _PyPegen_string_token(p)) // STRING
21737 )
21738 {
21739 _res = string_var;
21740 if (_n == _children_capacity) {
21741 _children_capacity *= 2;
21742 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21743 if (!_new_children) {
21744 p->error_indicator = 1;
21745 PyErr_NoMemory();
21746 D(p->level--);
21747 return NULL;
21748 }
21749 _children = _new_children;
21750 }
21751 _children[_n++] = _res;
21752 _mark = p->mark;
21753 }
21754 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021755 D(fprintf(stderr, "%*c%s _loop1_100[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021756 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
21757 }
21758 if (_n == 0 || p->error_indicator) {
21759 PyMem_Free(_children);
21760 D(p->level--);
21761 return NULL;
21762 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021763 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021764 if (!_seq) {
21765 PyMem_Free(_children);
21766 p->error_indicator = 1;
21767 PyErr_NoMemory();
21768 D(p->level--);
21769 return NULL;
21770 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021771 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021772 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021773 _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021774 D(p->level--);
21775 return _seq;
21776}
21777
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021778// _tmp_101: star_named_expression ',' star_named_expressions?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021779static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021780_tmp_101_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021781{
21782 D(p->level++);
21783 if (p->error_indicator) {
21784 D(p->level--);
21785 return NULL;
21786 }
21787 void * _res = NULL;
21788 int _mark = p->mark;
21789 { // star_named_expression ',' star_named_expressions?
21790 if (p->error_indicator) {
21791 D(p->level--);
21792 return NULL;
21793 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021794 D(fprintf(stderr, "%*c> _tmp_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021795 Token * _literal;
21796 expr_ty y;
21797 void *z;
21798 if (
21799 (y = star_named_expression_rule(p)) // star_named_expression
21800 &&
21801 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21802 &&
21803 (z = star_named_expressions_rule(p), 1) // star_named_expressions?
21804 )
21805 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021806 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 +010021807 _res = _PyPegen_seq_insert_in_front ( p , y , z );
21808 if (_res == NULL && PyErr_Occurred()) {
21809 p->error_indicator = 1;
21810 D(p->level--);
21811 return NULL;
21812 }
21813 goto done;
21814 }
21815 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021816 D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021817 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
21818 }
21819 _res = NULL;
21820 done:
21821 D(p->level--);
21822 return _res;
21823}
21824
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021825// _tmp_102: yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021826static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021827_tmp_102_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021828{
21829 D(p->level++);
21830 if (p->error_indicator) {
21831 D(p->level--);
21832 return NULL;
21833 }
21834 void * _res = NULL;
21835 int _mark = p->mark;
21836 { // yield_expr
21837 if (p->error_indicator) {
21838 D(p->level--);
21839 return NULL;
21840 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021841 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021842 expr_ty yield_expr_var;
21843 if (
21844 (yield_expr_var = yield_expr_rule(p)) // yield_expr
21845 )
21846 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021847 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 +010021848 _res = yield_expr_var;
21849 goto done;
21850 }
21851 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021852 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021853 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
21854 }
21855 { // named_expression
21856 if (p->error_indicator) {
21857 D(p->level--);
21858 return NULL;
21859 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021860 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021861 expr_ty named_expression_var;
21862 if (
21863 (named_expression_var = named_expression_rule(p)) // named_expression
21864 )
21865 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021866 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 +010021867 _res = named_expression_var;
21868 goto done;
21869 }
21870 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021871 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021872 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
21873 }
21874 _res = NULL;
21875 done:
21876 D(p->level--);
21877 return _res;
21878}
21879
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021880// _loop0_104: ',' double_starred_kvpair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021881static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021882_loop0_104_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021883{
21884 D(p->level++);
21885 if (p->error_indicator) {
21886 D(p->level--);
21887 return NULL;
21888 }
21889 void *_res = NULL;
21890 int _mark = p->mark;
21891 int _start_mark = p->mark;
21892 void **_children = PyMem_Malloc(sizeof(void *));
21893 if (!_children) {
21894 p->error_indicator = 1;
21895 PyErr_NoMemory();
21896 D(p->level--);
21897 return NULL;
21898 }
21899 ssize_t _children_capacity = 1;
21900 ssize_t _n = 0;
21901 { // ',' double_starred_kvpair
21902 if (p->error_indicator) {
21903 D(p->level--);
21904 return NULL;
21905 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021906 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 +010021907 Token * _literal;
21908 KeyValuePair* elem;
21909 while (
21910 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21911 &&
21912 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21913 )
21914 {
21915 _res = elem;
21916 if (_res == NULL && PyErr_Occurred()) {
21917 p->error_indicator = 1;
21918 PyMem_Free(_children);
21919 D(p->level--);
21920 return NULL;
21921 }
21922 if (_n == _children_capacity) {
21923 _children_capacity *= 2;
21924 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21925 if (!_new_children) {
21926 p->error_indicator = 1;
21927 PyErr_NoMemory();
21928 D(p->level--);
21929 return NULL;
21930 }
21931 _children = _new_children;
21932 }
21933 _children[_n++] = _res;
21934 _mark = p->mark;
21935 }
21936 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021937 D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021938 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
21939 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021940 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021941 if (!_seq) {
21942 PyMem_Free(_children);
21943 p->error_indicator = 1;
21944 PyErr_NoMemory();
21945 D(p->level--);
21946 return NULL;
21947 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021948 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021949 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021950 _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021951 D(p->level--);
21952 return _seq;
21953}
21954
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021955// _gather_103: double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021956static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021957_gather_103_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021958{
21959 D(p->level++);
21960 if (p->error_indicator) {
21961 D(p->level--);
21962 return NULL;
21963 }
21964 asdl_seq * _res = NULL;
21965 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021966 { // double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021967 if (p->error_indicator) {
21968 D(p->level--);
21969 return NULL;
21970 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021971 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 +010021972 KeyValuePair* elem;
21973 asdl_seq * seq;
21974 if (
21975 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21976 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021977 (seq = _loop0_104_rule(p)) // _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021978 )
21979 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021980 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 +010021981 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21982 goto done;
21983 }
21984 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021985 D(fprintf(stderr, "%*c%s _gather_103[%d-%d]: %s failed!\n", p->level, ' ',
21986 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_104"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021987 }
21988 _res = NULL;
21989 done:
21990 D(p->level--);
21991 return _res;
21992}
21993
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021994// _loop1_105: for_if_clause
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021995static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021996_loop1_105_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021997{
21998 D(p->level++);
21999 if (p->error_indicator) {
22000 D(p->level--);
22001 return NULL;
22002 }
22003 void *_res = NULL;
22004 int _mark = p->mark;
22005 int _start_mark = p->mark;
22006 void **_children = PyMem_Malloc(sizeof(void *));
22007 if (!_children) {
22008 p->error_indicator = 1;
22009 PyErr_NoMemory();
22010 D(p->level--);
22011 return NULL;
22012 }
22013 ssize_t _children_capacity = 1;
22014 ssize_t _n = 0;
22015 { // for_if_clause
22016 if (p->error_indicator) {
22017 D(p->level--);
22018 return NULL;
22019 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022020 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 +010022021 comprehension_ty for_if_clause_var;
22022 while (
22023 (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
22024 )
22025 {
22026 _res = for_if_clause_var;
22027 if (_n == _children_capacity) {
22028 _children_capacity *= 2;
22029 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22030 if (!_new_children) {
22031 p->error_indicator = 1;
22032 PyErr_NoMemory();
22033 D(p->level--);
22034 return NULL;
22035 }
22036 _children = _new_children;
22037 }
22038 _children[_n++] = _res;
22039 _mark = p->mark;
22040 }
22041 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022042 D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022043 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
22044 }
22045 if (_n == 0 || p->error_indicator) {
22046 PyMem_Free(_children);
22047 D(p->level--);
22048 return NULL;
22049 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022050 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022051 if (!_seq) {
22052 PyMem_Free(_children);
22053 p->error_indicator = 1;
22054 PyErr_NoMemory();
22055 D(p->level--);
22056 return NULL;
22057 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022058 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022059 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022060 _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022061 D(p->level--);
22062 return _seq;
22063}
22064
22065// _loop0_106: ('if' disjunction)
22066static asdl_seq *
22067_loop0_106_rule(Parser *p)
22068{
22069 D(p->level++);
22070 if (p->error_indicator) {
22071 D(p->level--);
22072 return NULL;
22073 }
22074 void *_res = NULL;
22075 int _mark = p->mark;
22076 int _start_mark = p->mark;
22077 void **_children = PyMem_Malloc(sizeof(void *));
22078 if (!_children) {
22079 p->error_indicator = 1;
22080 PyErr_NoMemory();
22081 D(p->level--);
22082 return NULL;
22083 }
22084 ssize_t _children_capacity = 1;
22085 ssize_t _n = 0;
22086 { // ('if' disjunction)
22087 if (p->error_indicator) {
22088 D(p->level--);
22089 return NULL;
22090 }
22091 D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010022092 void *_tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022093 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022094 (_tmp_147_var = _tmp_147_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022095 )
22096 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022097 _res = _tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022098 if (_n == _children_capacity) {
22099 _children_capacity *= 2;
22100 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22101 if (!_new_children) {
22102 p->error_indicator = 1;
22103 PyErr_NoMemory();
22104 D(p->level--);
22105 return NULL;
22106 }
22107 _children = _new_children;
22108 }
22109 _children[_n++] = _res;
22110 _mark = p->mark;
22111 }
22112 p->mark = _mark;
22113 D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ',
22114 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
22115 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022116 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022117 if (!_seq) {
22118 PyMem_Free(_children);
22119 p->error_indicator = 1;
22120 PyErr_NoMemory();
22121 D(p->level--);
22122 return NULL;
22123 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022124 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022125 PyMem_Free(_children);
22126 _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq);
22127 D(p->level--);
22128 return _seq;
22129}
22130
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022131// _loop0_107: ('if' disjunction)
22132static asdl_seq *
22133_loop0_107_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022134{
22135 D(p->level++);
22136 if (p->error_indicator) {
22137 D(p->level--);
22138 return NULL;
22139 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022140 void *_res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022141 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022142 int _start_mark = p->mark;
22143 void **_children = PyMem_Malloc(sizeof(void *));
22144 if (!_children) {
22145 p->error_indicator = 1;
22146 PyErr_NoMemory();
22147 D(p->level--);
22148 return NULL;
22149 }
22150 ssize_t _children_capacity = 1;
22151 ssize_t _n = 0;
22152 { // ('if' disjunction)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022153 if (p->error_indicator) {
22154 D(p->level--);
22155 return NULL;
22156 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022157 D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010022158 void *_tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022159 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022160 (_tmp_148_var = _tmp_148_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022161 )
22162 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022163 _res = _tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022164 if (_n == _children_capacity) {
22165 _children_capacity *= 2;
22166 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22167 if (!_new_children) {
22168 p->error_indicator = 1;
22169 PyErr_NoMemory();
22170 D(p->level--);
22171 return NULL;
22172 }
22173 _children = _new_children;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022174 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022175 _children[_n++] = _res;
22176 _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022177 }
22178 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022179 D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ',
22180 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022181 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022182 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022183 if (!_seq) {
22184 PyMem_Free(_children);
22185 p->error_indicator = 1;
22186 PyErr_NoMemory();
22187 D(p->level--);
22188 return NULL;
22189 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022190 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022191 PyMem_Free(_children);
22192 _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022193 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022194 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022195}
22196
Pablo Galindo4a97b152020-09-02 17:44:19 +010022197// _loop0_109: ',' (starred_expression | named_expression !'=')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022198static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022199_loop0_109_rule(Parser *p)
22200{
22201 D(p->level++);
22202 if (p->error_indicator) {
22203 D(p->level--);
22204 return NULL;
22205 }
22206 void *_res = NULL;
22207 int _mark = p->mark;
22208 int _start_mark = p->mark;
22209 void **_children = PyMem_Malloc(sizeof(void *));
22210 if (!_children) {
22211 p->error_indicator = 1;
22212 PyErr_NoMemory();
22213 D(p->level--);
22214 return NULL;
22215 }
22216 ssize_t _children_capacity = 1;
22217 ssize_t _n = 0;
22218 { // ',' (starred_expression | named_expression !'=')
22219 if (p->error_indicator) {
22220 D(p->level--);
22221 return NULL;
22222 }
22223 D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22224 Token * _literal;
22225 void *elem;
22226 while (
22227 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22228 &&
22229 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22230 )
22231 {
22232 _res = elem;
22233 if (_res == NULL && PyErr_Occurred()) {
22234 p->error_indicator = 1;
22235 PyMem_Free(_children);
22236 D(p->level--);
22237 return NULL;
22238 }
22239 if (_n == _children_capacity) {
22240 _children_capacity *= 2;
22241 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22242 if (!_new_children) {
22243 p->error_indicator = 1;
22244 PyErr_NoMemory();
22245 D(p->level--);
22246 return NULL;
22247 }
22248 _children = _new_children;
22249 }
22250 _children[_n++] = _res;
22251 _mark = p->mark;
22252 }
22253 p->mark = _mark;
22254 D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ',
22255 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22256 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022257 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022258 if (!_seq) {
22259 PyMem_Free(_children);
22260 p->error_indicator = 1;
22261 PyErr_NoMemory();
22262 D(p->level--);
22263 return NULL;
22264 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022265 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022266 PyMem_Free(_children);
22267 _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq);
22268 D(p->level--);
22269 return _seq;
22270}
22271
22272// _gather_108: (starred_expression | named_expression !'=') _loop0_109
22273static asdl_seq *
22274_gather_108_rule(Parser *p)
22275{
22276 D(p->level++);
22277 if (p->error_indicator) {
22278 D(p->level--);
22279 return NULL;
22280 }
22281 asdl_seq * _res = NULL;
22282 int _mark = p->mark;
22283 { // (starred_expression | named_expression !'=') _loop0_109
22284 if (p->error_indicator) {
22285 D(p->level--);
22286 return NULL;
22287 }
22288 D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22289 void *elem;
22290 asdl_seq * seq;
22291 if (
22292 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22293 &&
22294 (seq = _loop0_109_rule(p)) // _loop0_109
22295 )
22296 {
22297 D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22298 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22299 goto done;
22300 }
22301 p->mark = _mark;
22302 D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n", p->level, ' ',
22303 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22304 }
22305 _res = NULL;
22306 done:
22307 D(p->level--);
22308 return _res;
22309}
22310
22311// _tmp_110: ',' kwargs
22312static void *
22313_tmp_110_rule(Parser *p)
22314{
22315 D(p->level++);
22316 if (p->error_indicator) {
22317 D(p->level--);
22318 return NULL;
22319 }
22320 void * _res = NULL;
22321 int _mark = p->mark;
22322 { // ',' kwargs
22323 if (p->error_indicator) {
22324 D(p->level--);
22325 return NULL;
22326 }
22327 D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22328 Token * _literal;
22329 asdl_seq* k;
22330 if (
22331 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22332 &&
22333 (k = kwargs_rule(p)) // kwargs
22334 )
22335 {
22336 D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22337 _res = k;
22338 if (_res == NULL && PyErr_Occurred()) {
22339 p->error_indicator = 1;
22340 D(p->level--);
22341 return NULL;
22342 }
22343 goto done;
22344 }
22345 p->mark = _mark;
22346 D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ',
22347 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
22348 }
22349 _res = NULL;
22350 done:
22351 D(p->level--);
22352 return _res;
22353}
22354
22355// _loop0_112: ',' kwarg_or_starred
22356static asdl_seq *
22357_loop0_112_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022358{
22359 D(p->level++);
22360 if (p->error_indicator) {
22361 D(p->level--);
22362 return NULL;
22363 }
22364 void *_res = NULL;
22365 int _mark = p->mark;
22366 int _start_mark = p->mark;
22367 void **_children = PyMem_Malloc(sizeof(void *));
22368 if (!_children) {
22369 p->error_indicator = 1;
22370 PyErr_NoMemory();
22371 D(p->level--);
22372 return NULL;
22373 }
22374 ssize_t _children_capacity = 1;
22375 ssize_t _n = 0;
22376 { // ',' kwarg_or_starred
22377 if (p->error_indicator) {
22378 D(p->level--);
22379 return NULL;
22380 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022381 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 +010022382 Token * _literal;
22383 KeywordOrStarred* elem;
22384 while (
22385 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22386 &&
22387 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22388 )
22389 {
22390 _res = elem;
22391 if (_res == NULL && PyErr_Occurred()) {
22392 p->error_indicator = 1;
22393 PyMem_Free(_children);
22394 D(p->level--);
22395 return NULL;
22396 }
22397 if (_n == _children_capacity) {
22398 _children_capacity *= 2;
22399 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22400 if (!_new_children) {
22401 p->error_indicator = 1;
22402 PyErr_NoMemory();
22403 D(p->level--);
22404 return NULL;
22405 }
22406 _children = _new_children;
22407 }
22408 _children[_n++] = _res;
22409 _mark = p->mark;
22410 }
22411 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022412 D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022413 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22414 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022415 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022416 if (!_seq) {
22417 PyMem_Free(_children);
22418 p->error_indicator = 1;
22419 PyErr_NoMemory();
22420 D(p->level--);
22421 return NULL;
22422 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022423 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022424 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022425 _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022426 D(p->level--);
22427 return _seq;
22428}
22429
Pablo Galindo4a97b152020-09-02 17:44:19 +010022430// _gather_111: kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022431static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022432_gather_111_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022433{
22434 D(p->level++);
22435 if (p->error_indicator) {
22436 D(p->level--);
22437 return NULL;
22438 }
22439 asdl_seq * _res = NULL;
22440 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022441 { // kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022442 if (p->error_indicator) {
22443 D(p->level--);
22444 return NULL;
22445 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022446 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 +010022447 KeywordOrStarred* elem;
22448 asdl_seq * seq;
22449 if (
22450 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22451 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022452 (seq = _loop0_112_rule(p)) // _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022453 )
22454 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022455 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 +010022456 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22457 goto done;
22458 }
22459 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022460 D(fprintf(stderr, "%*c%s _gather_111[%d-%d]: %s failed!\n", p->level, ' ',
22461 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_112"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022462 }
22463 _res = NULL;
22464 done:
22465 D(p->level--);
22466 return _res;
22467}
22468
Pablo Galindo4a97b152020-09-02 17:44:19 +010022469// _loop0_114: ',' kwarg_or_double_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022470static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022471_loop0_114_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022472{
22473 D(p->level++);
22474 if (p->error_indicator) {
22475 D(p->level--);
22476 return NULL;
22477 }
22478 void *_res = NULL;
22479 int _mark = p->mark;
22480 int _start_mark = p->mark;
22481 void **_children = PyMem_Malloc(sizeof(void *));
22482 if (!_children) {
22483 p->error_indicator = 1;
22484 PyErr_NoMemory();
22485 D(p->level--);
22486 return NULL;
22487 }
22488 ssize_t _children_capacity = 1;
22489 ssize_t _n = 0;
22490 { // ',' kwarg_or_double_starred
22491 if (p->error_indicator) {
22492 D(p->level--);
22493 return NULL;
22494 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022495 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 +010022496 Token * _literal;
22497 KeywordOrStarred* elem;
22498 while (
22499 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22500 &&
22501 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22502 )
22503 {
22504 _res = elem;
22505 if (_res == NULL && PyErr_Occurred()) {
22506 p->error_indicator = 1;
22507 PyMem_Free(_children);
22508 D(p->level--);
22509 return NULL;
22510 }
22511 if (_n == _children_capacity) {
22512 _children_capacity *= 2;
22513 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22514 if (!_new_children) {
22515 p->error_indicator = 1;
22516 PyErr_NoMemory();
22517 D(p->level--);
22518 return NULL;
22519 }
22520 _children = _new_children;
22521 }
22522 _children[_n++] = _res;
22523 _mark = p->mark;
22524 }
22525 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022526 D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022527 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22528 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022529 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022530 if (!_seq) {
22531 PyMem_Free(_children);
22532 p->error_indicator = 1;
22533 PyErr_NoMemory();
22534 D(p->level--);
22535 return NULL;
22536 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022537 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022538 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022539 _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022540 D(p->level--);
22541 return _seq;
22542}
22543
Pablo Galindo4a97b152020-09-02 17:44:19 +010022544// _gather_113: kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022545static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022546_gather_113_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022547{
22548 D(p->level++);
22549 if (p->error_indicator) {
22550 D(p->level--);
22551 return NULL;
22552 }
22553 asdl_seq * _res = NULL;
22554 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022555 { // kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022556 if (p->error_indicator) {
22557 D(p->level--);
22558 return NULL;
22559 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022560 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 +010022561 KeywordOrStarred* elem;
22562 asdl_seq * seq;
22563 if (
22564 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22565 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022566 (seq = _loop0_114_rule(p)) // _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022567 )
22568 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022569 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 +010022570 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22571 goto done;
22572 }
22573 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022574 D(fprintf(stderr, "%*c%s _gather_113[%d-%d]: %s failed!\n", p->level, ' ',
22575 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_114"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022576 }
22577 _res = NULL;
22578 done:
22579 D(p->level--);
22580 return _res;
22581}
22582
Pablo Galindo4a97b152020-09-02 17:44:19 +010022583// _loop0_116: ',' kwarg_or_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022584static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022585_loop0_116_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022586{
22587 D(p->level++);
22588 if (p->error_indicator) {
22589 D(p->level--);
22590 return NULL;
22591 }
22592 void *_res = NULL;
22593 int _mark = p->mark;
22594 int _start_mark = p->mark;
22595 void **_children = PyMem_Malloc(sizeof(void *));
22596 if (!_children) {
22597 p->error_indicator = 1;
22598 PyErr_NoMemory();
22599 D(p->level--);
22600 return NULL;
22601 }
22602 ssize_t _children_capacity = 1;
22603 ssize_t _n = 0;
22604 { // ',' kwarg_or_starred
22605 if (p->error_indicator) {
22606 D(p->level--);
22607 return NULL;
22608 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022609 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 +010022610 Token * _literal;
22611 KeywordOrStarred* elem;
22612 while (
22613 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22614 &&
22615 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22616 )
22617 {
22618 _res = elem;
22619 if (_res == NULL && PyErr_Occurred()) {
22620 p->error_indicator = 1;
22621 PyMem_Free(_children);
22622 D(p->level--);
22623 return NULL;
22624 }
22625 if (_n == _children_capacity) {
22626 _children_capacity *= 2;
22627 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22628 if (!_new_children) {
22629 p->error_indicator = 1;
22630 PyErr_NoMemory();
22631 D(p->level--);
22632 return NULL;
22633 }
22634 _children = _new_children;
22635 }
22636 _children[_n++] = _res;
22637 _mark = p->mark;
22638 }
22639 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022640 D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022641 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22642 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022643 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022644 if (!_seq) {
22645 PyMem_Free(_children);
22646 p->error_indicator = 1;
22647 PyErr_NoMemory();
22648 D(p->level--);
22649 return NULL;
22650 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022651 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022652 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022653 _PyPegen_insert_memo(p, _start_mark, _loop0_116_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022654 D(p->level--);
22655 return _seq;
22656}
22657
Pablo Galindo4a97b152020-09-02 17:44:19 +010022658// _gather_115: kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022659static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022660_gather_115_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022661{
22662 D(p->level++);
22663 if (p->error_indicator) {
22664 D(p->level--);
22665 return NULL;
22666 }
22667 asdl_seq * _res = NULL;
22668 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022669 { // kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022670 if (p->error_indicator) {
22671 D(p->level--);
22672 return NULL;
22673 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022674 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 +010022675 KeywordOrStarred* elem;
22676 asdl_seq * seq;
22677 if (
22678 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22679 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022680 (seq = _loop0_116_rule(p)) // _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022681 )
22682 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022683 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 +010022684 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22685 goto done;
22686 }
22687 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022688 D(fprintf(stderr, "%*c%s _gather_115[%d-%d]: %s failed!\n", p->level, ' ',
22689 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_116"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022690 }
22691 _res = NULL;
22692 done:
22693 D(p->level--);
22694 return _res;
22695}
22696
Pablo Galindo4a97b152020-09-02 17:44:19 +010022697// _loop0_118: ',' kwarg_or_double_starred
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022698static asdl_seq *
22699_loop0_118_rule(Parser *p)
22700{
22701 D(p->level++);
22702 if (p->error_indicator) {
22703 D(p->level--);
22704 return NULL;
22705 }
22706 void *_res = NULL;
22707 int _mark = p->mark;
22708 int _start_mark = p->mark;
22709 void **_children = PyMem_Malloc(sizeof(void *));
22710 if (!_children) {
22711 p->error_indicator = 1;
22712 PyErr_NoMemory();
22713 D(p->level--);
22714 return NULL;
22715 }
22716 ssize_t _children_capacity = 1;
22717 ssize_t _n = 0;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022718 { // ',' kwarg_or_double_starred
22719 if (p->error_indicator) {
22720 D(p->level--);
22721 return NULL;
22722 }
22723 D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
22724 Token * _literal;
22725 KeywordOrStarred* elem;
22726 while (
22727 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22728 &&
22729 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22730 )
22731 {
22732 _res = elem;
22733 if (_res == NULL && PyErr_Occurred()) {
22734 p->error_indicator = 1;
22735 PyMem_Free(_children);
22736 D(p->level--);
22737 return NULL;
22738 }
22739 if (_n == _children_capacity) {
22740 _children_capacity *= 2;
22741 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22742 if (!_new_children) {
22743 p->error_indicator = 1;
22744 PyErr_NoMemory();
22745 D(p->level--);
22746 return NULL;
22747 }
22748 _children = _new_children;
22749 }
22750 _children[_n++] = _res;
22751 _mark = p->mark;
22752 }
22753 p->mark = _mark;
22754 D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ',
22755 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22756 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022757 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022758 if (!_seq) {
22759 PyMem_Free(_children);
22760 p->error_indicator = 1;
22761 PyErr_NoMemory();
22762 D(p->level--);
22763 return NULL;
22764 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022765 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022766 PyMem_Free(_children);
22767 _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq);
22768 D(p->level--);
22769 return _seq;
22770}
22771
22772// _gather_117: kwarg_or_double_starred _loop0_118
22773static asdl_seq *
22774_gather_117_rule(Parser *p)
22775{
22776 D(p->level++);
22777 if (p->error_indicator) {
22778 D(p->level--);
22779 return NULL;
22780 }
22781 asdl_seq * _res = NULL;
22782 int _mark = p->mark;
22783 { // kwarg_or_double_starred _loop0_118
22784 if (p->error_indicator) {
22785 D(p->level--);
22786 return NULL;
22787 }
22788 D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22789 KeywordOrStarred* elem;
22790 asdl_seq * seq;
22791 if (
22792 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22793 &&
22794 (seq = _loop0_118_rule(p)) // _loop0_118
22795 )
22796 {
22797 D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22798 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22799 goto done;
22800 }
22801 p->mark = _mark;
22802 D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ',
22803 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22804 }
22805 _res = NULL;
22806 done:
22807 D(p->level--);
22808 return _res;
22809}
22810
22811// _loop0_119: (',' star_target)
22812static asdl_seq *
22813_loop0_119_rule(Parser *p)
22814{
22815 D(p->level++);
22816 if (p->error_indicator) {
22817 D(p->level--);
22818 return NULL;
22819 }
22820 void *_res = NULL;
22821 int _mark = p->mark;
22822 int _start_mark = p->mark;
22823 void **_children = PyMem_Malloc(sizeof(void *));
22824 if (!_children) {
22825 p->error_indicator = 1;
22826 PyErr_NoMemory();
22827 D(p->level--);
22828 return NULL;
22829 }
22830 ssize_t _children_capacity = 1;
22831 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022832 { // (',' star_target)
22833 if (p->error_indicator) {
22834 D(p->level--);
22835 return NULL;
22836 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022837 D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
22838 void *_tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022839 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022840 (_tmp_150_var = _tmp_150_rule(p)) // ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022841 )
22842 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022843 _res = _tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022844 if (_n == _children_capacity) {
22845 _children_capacity *= 2;
22846 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22847 if (!_new_children) {
22848 p->error_indicator = 1;
22849 PyErr_NoMemory();
22850 D(p->level--);
22851 return NULL;
22852 }
22853 _children = _new_children;
22854 }
22855 _children[_n++] = _res;
22856 _mark = p->mark;
22857 }
22858 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022859 D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022860 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
22861 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022862 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022863 if (!_seq) {
22864 PyMem_Free(_children);
22865 p->error_indicator = 1;
22866 PyErr_NoMemory();
22867 D(p->level--);
22868 return NULL;
22869 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022870 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022871 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022872 _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022873 D(p->level--);
22874 return _seq;
22875}
22876
Pablo Galindo4a97b152020-09-02 17:44:19 +010022877// _loop0_121: ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022878static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022879_loop0_121_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022880{
22881 D(p->level++);
22882 if (p->error_indicator) {
22883 D(p->level--);
22884 return NULL;
22885 }
22886 void *_res = NULL;
22887 int _mark = p->mark;
22888 int _start_mark = p->mark;
22889 void **_children = PyMem_Malloc(sizeof(void *));
22890 if (!_children) {
22891 p->error_indicator = 1;
22892 PyErr_NoMemory();
22893 D(p->level--);
22894 return NULL;
22895 }
22896 ssize_t _children_capacity = 1;
22897 ssize_t _n = 0;
22898 { // ',' star_target
22899 if (p->error_indicator) {
22900 D(p->level--);
22901 return NULL;
22902 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022903 D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022904 Token * _literal;
22905 expr_ty elem;
22906 while (
22907 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22908 &&
22909 (elem = star_target_rule(p)) // star_target
22910 )
22911 {
22912 _res = elem;
22913 if (_res == NULL && PyErr_Occurred()) {
22914 p->error_indicator = 1;
22915 PyMem_Free(_children);
22916 D(p->level--);
22917 return NULL;
22918 }
22919 if (_n == _children_capacity) {
22920 _children_capacity *= 2;
22921 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22922 if (!_new_children) {
22923 p->error_indicator = 1;
22924 PyErr_NoMemory();
22925 D(p->level--);
22926 return NULL;
22927 }
22928 _children = _new_children;
22929 }
22930 _children[_n++] = _res;
22931 _mark = p->mark;
22932 }
22933 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022934 D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022935 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
22936 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022937 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022938 if (!_seq) {
22939 PyMem_Free(_children);
22940 p->error_indicator = 1;
22941 PyErr_NoMemory();
22942 D(p->level--);
22943 return NULL;
22944 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022945 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022946 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022947 _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022948 D(p->level--);
22949 return _seq;
22950}
22951
Pablo Galindo4a97b152020-09-02 17:44:19 +010022952// _gather_120: star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022953static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022954_gather_120_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022955{
22956 D(p->level++);
22957 if (p->error_indicator) {
22958 D(p->level--);
22959 return NULL;
22960 }
22961 asdl_seq * _res = NULL;
22962 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022963 { // star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022964 if (p->error_indicator) {
22965 D(p->level--);
22966 return NULL;
22967 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022968 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 +010022969 expr_ty elem;
22970 asdl_seq * seq;
22971 if (
22972 (elem = star_target_rule(p)) // star_target
22973 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022974 (seq = _loop0_121_rule(p)) // _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022975 )
22976 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022977 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 +010022978 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22979 goto done;
22980 }
22981 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022982 D(fprintf(stderr, "%*c%s _gather_120[%d-%d]: %s failed!\n", p->level, ' ',
22983 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_121"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022984 }
22985 _res = NULL;
22986 done:
22987 D(p->level--);
22988 return _res;
22989}
22990
Pablo Galindo4a97b152020-09-02 17:44:19 +010022991// _tmp_122: !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022992static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022993_tmp_122_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022994{
22995 D(p->level++);
22996 if (p->error_indicator) {
22997 D(p->level--);
22998 return NULL;
22999 }
23000 void * _res = NULL;
23001 int _mark = p->mark;
23002 { // !'*' star_target
23003 if (p->error_indicator) {
23004 D(p->level--);
23005 return NULL;
23006 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023007 D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023008 expr_ty star_target_var;
23009 if (
23010 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
23011 &&
23012 (star_target_var = star_target_rule(p)) // star_target
23013 )
23014 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023015 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 +010023016 _res = star_target_var;
23017 goto done;
23018 }
23019 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023020 D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023021 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
23022 }
23023 _res = NULL;
23024 done:
23025 D(p->level--);
23026 return _res;
23027}
23028
Pablo Galindo4a97b152020-09-02 17:44:19 +010023029// _loop0_124: ',' del_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023030static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023031_loop0_124_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023032{
23033 D(p->level++);
23034 if (p->error_indicator) {
23035 D(p->level--);
23036 return NULL;
23037 }
23038 void *_res = NULL;
23039 int _mark = p->mark;
23040 int _start_mark = p->mark;
23041 void **_children = PyMem_Malloc(sizeof(void *));
23042 if (!_children) {
23043 p->error_indicator = 1;
23044 PyErr_NoMemory();
23045 D(p->level--);
23046 return NULL;
23047 }
23048 ssize_t _children_capacity = 1;
23049 ssize_t _n = 0;
23050 { // ',' del_target
23051 if (p->error_indicator) {
23052 D(p->level--);
23053 return NULL;
23054 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023055 D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023056 Token * _literal;
23057 expr_ty elem;
23058 while (
23059 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23060 &&
23061 (elem = del_target_rule(p)) // del_target
23062 )
23063 {
23064 _res = elem;
23065 if (_res == NULL && PyErr_Occurred()) {
23066 p->error_indicator = 1;
23067 PyMem_Free(_children);
23068 D(p->level--);
23069 return NULL;
23070 }
23071 if (_n == _children_capacity) {
23072 _children_capacity *= 2;
23073 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23074 if (!_new_children) {
23075 p->error_indicator = 1;
23076 PyErr_NoMemory();
23077 D(p->level--);
23078 return NULL;
23079 }
23080 _children = _new_children;
23081 }
23082 _children[_n++] = _res;
23083 _mark = p->mark;
23084 }
23085 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023086 D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023087 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
23088 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023089 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023090 if (!_seq) {
23091 PyMem_Free(_children);
23092 p->error_indicator = 1;
23093 PyErr_NoMemory();
23094 D(p->level--);
23095 return NULL;
23096 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023097 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023098 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023099 _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023100 D(p->level--);
23101 return _seq;
23102}
23103
Pablo Galindo4a97b152020-09-02 17:44:19 +010023104// _gather_123: del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023105static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023106_gather_123_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023107{
23108 D(p->level++);
23109 if (p->error_indicator) {
23110 D(p->level--);
23111 return NULL;
23112 }
23113 asdl_seq * _res = NULL;
23114 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023115 { // del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023116 if (p->error_indicator) {
23117 D(p->level--);
23118 return NULL;
23119 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023120 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 +010023121 expr_ty elem;
23122 asdl_seq * seq;
23123 if (
23124 (elem = del_target_rule(p)) // del_target
23125 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023126 (seq = _loop0_124_rule(p)) // _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023127 )
23128 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023129 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 +010023130 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23131 goto done;
23132 }
23133 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023134 D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ',
23135 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_124"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023136 }
23137 _res = NULL;
23138 done:
23139 D(p->level--);
23140 return _res;
23141}
23142
Pablo Galindo4a97b152020-09-02 17:44:19 +010023143// _loop0_126: ',' target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023144static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023145_loop0_126_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023146{
23147 D(p->level++);
23148 if (p->error_indicator) {
23149 D(p->level--);
23150 return NULL;
23151 }
23152 void *_res = NULL;
23153 int _mark = p->mark;
23154 int _start_mark = p->mark;
23155 void **_children = PyMem_Malloc(sizeof(void *));
23156 if (!_children) {
23157 p->error_indicator = 1;
23158 PyErr_NoMemory();
23159 D(p->level--);
23160 return NULL;
23161 }
23162 ssize_t _children_capacity = 1;
23163 ssize_t _n = 0;
23164 { // ',' target
23165 if (p->error_indicator) {
23166 D(p->level--);
23167 return NULL;
23168 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023169 D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023170 Token * _literal;
23171 expr_ty elem;
23172 while (
23173 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23174 &&
23175 (elem = target_rule(p)) // target
23176 )
23177 {
23178 _res = elem;
23179 if (_res == NULL && PyErr_Occurred()) {
23180 p->error_indicator = 1;
23181 PyMem_Free(_children);
23182 D(p->level--);
23183 return NULL;
23184 }
23185 if (_n == _children_capacity) {
23186 _children_capacity *= 2;
23187 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23188 if (!_new_children) {
23189 p->error_indicator = 1;
23190 PyErr_NoMemory();
23191 D(p->level--);
23192 return NULL;
23193 }
23194 _children = _new_children;
23195 }
23196 _children[_n++] = _res;
23197 _mark = p->mark;
23198 }
23199 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023200 D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023201 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target"));
23202 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023203 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023204 if (!_seq) {
23205 PyMem_Free(_children);
23206 p->error_indicator = 1;
23207 PyErr_NoMemory();
23208 D(p->level--);
23209 return NULL;
23210 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023211 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023212 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023213 _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023214 D(p->level--);
23215 return _seq;
23216}
23217
Pablo Galindo4a97b152020-09-02 17:44:19 +010023218// _gather_125: target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023219static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023220_gather_125_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023221{
23222 D(p->level++);
23223 if (p->error_indicator) {
23224 D(p->level--);
23225 return NULL;
23226 }
23227 asdl_seq * _res = NULL;
23228 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023229 { // target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023230 if (p->error_indicator) {
23231 D(p->level--);
23232 return NULL;
23233 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023234 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 +010023235 expr_ty elem;
23236 asdl_seq * seq;
23237 if (
23238 (elem = target_rule(p)) // target
23239 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023240 (seq = _loop0_126_rule(p)) // _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023241 )
23242 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023243 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 +010023244 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23245 goto done;
23246 }
23247 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023248 D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ',
23249 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_126"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023250 }
23251 _res = NULL;
23252 done:
23253 D(p->level--);
23254 return _res;
23255}
23256
Pablo Galindo4a97b152020-09-02 17:44:19 +010023257// _tmp_127: args | expression for_if_clauses
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023258static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023259_tmp_127_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023260{
23261 D(p->level++);
23262 if (p->error_indicator) {
23263 D(p->level--);
23264 return NULL;
23265 }
23266 void * _res = NULL;
23267 int _mark = p->mark;
23268 { // args
23269 if (p->error_indicator) {
23270 D(p->level--);
23271 return NULL;
23272 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023273 D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023274 expr_ty args_var;
23275 if (
23276 (args_var = args_rule(p)) // args
23277 )
23278 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023279 D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023280 _res = args_var;
23281 goto done;
23282 }
23283 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023284 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023285 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
23286 }
23287 { // expression for_if_clauses
23288 if (p->error_indicator) {
23289 D(p->level--);
23290 return NULL;
23291 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023292 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 +010023293 expr_ty expression_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010023294 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023295 if (
23296 (expression_var = expression_rule(p)) // expression
23297 &&
23298 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
23299 )
23300 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023301 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 +010023302 _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
23303 goto done;
23304 }
23305 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023306 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023307 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
23308 }
23309 _res = NULL;
23310 done:
23311 D(p->level--);
23312 return _res;
23313}
23314
Pablo Galindo4a97b152020-09-02 17:44:19 +010023315// _loop0_128: star_named_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023316static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023317_loop0_128_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023318{
23319 D(p->level++);
23320 if (p->error_indicator) {
23321 D(p->level--);
23322 return NULL;
23323 }
23324 void *_res = NULL;
23325 int _mark = p->mark;
23326 int _start_mark = p->mark;
23327 void **_children = PyMem_Malloc(sizeof(void *));
23328 if (!_children) {
23329 p->error_indicator = 1;
23330 PyErr_NoMemory();
23331 D(p->level--);
23332 return NULL;
23333 }
23334 ssize_t _children_capacity = 1;
23335 ssize_t _n = 0;
23336 { // star_named_expressions
23337 if (p->error_indicator) {
23338 D(p->level--);
23339 return NULL;
23340 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023341 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 +010023342 asdl_expr_seq* star_named_expressions_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023343 while (
23344 (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions
23345 )
23346 {
23347 _res = star_named_expressions_var;
23348 if (_n == _children_capacity) {
23349 _children_capacity *= 2;
23350 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23351 if (!_new_children) {
23352 p->error_indicator = 1;
23353 PyErr_NoMemory();
23354 D(p->level--);
23355 return NULL;
23356 }
23357 _children = _new_children;
23358 }
23359 _children[_n++] = _res;
23360 _mark = p->mark;
23361 }
23362 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023363 D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010023364 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023365 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023366 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023367 if (!_seq) {
23368 PyMem_Free(_children);
23369 p->error_indicator = 1;
23370 PyErr_NoMemory();
23371 D(p->level--);
23372 return NULL;
23373 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023374 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023375 PyMem_Free(_children);
23376 _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023377 D(p->level--);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023378 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023379}
23380
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023381// _loop0_129: (star_targets '=')
23382static asdl_seq *
23383_loop0_129_rule(Parser *p)
23384{
23385 D(p->level++);
23386 if (p->error_indicator) {
23387 D(p->level--);
23388 return NULL;
23389 }
23390 void *_res = NULL;
23391 int _mark = p->mark;
23392 int _start_mark = p->mark;
23393 void **_children = PyMem_Malloc(sizeof(void *));
23394 if (!_children) {
23395 p->error_indicator = 1;
23396 PyErr_NoMemory();
23397 D(p->level--);
23398 return NULL;
23399 }
23400 ssize_t _children_capacity = 1;
23401 ssize_t _n = 0;
23402 { // (star_targets '=')
23403 if (p->error_indicator) {
23404 D(p->level--);
23405 return NULL;
23406 }
23407 D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010023408 void *_tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023409 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023410 (_tmp_151_var = _tmp_151_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023411 )
23412 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023413 _res = _tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023414 if (_n == _children_capacity) {
23415 _children_capacity *= 2;
23416 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23417 if (!_new_children) {
23418 p->error_indicator = 1;
23419 PyErr_NoMemory();
23420 D(p->level--);
23421 return NULL;
23422 }
23423 _children = _new_children;
23424 }
23425 _children[_n++] = _res;
23426 _mark = p->mark;
23427 }
23428 p->mark = _mark;
23429 D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
23430 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23431 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023432 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023433 if (!_seq) {
23434 PyMem_Free(_children);
23435 p->error_indicator = 1;
23436 PyErr_NoMemory();
23437 D(p->level--);
23438 return NULL;
23439 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023440 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023441 PyMem_Free(_children);
23442 _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq);
23443 D(p->level--);
23444 return _seq;
23445}
23446
Pablo Galindo4a97b152020-09-02 17:44:19 +010023447// _loop0_130: (star_targets '=')
23448static asdl_seq *
23449_loop0_130_rule(Parser *p)
23450{
23451 D(p->level++);
23452 if (p->error_indicator) {
23453 D(p->level--);
23454 return NULL;
23455 }
23456 void *_res = NULL;
23457 int _mark = p->mark;
23458 int _start_mark = p->mark;
23459 void **_children = PyMem_Malloc(sizeof(void *));
23460 if (!_children) {
23461 p->error_indicator = 1;
23462 PyErr_NoMemory();
23463 D(p->level--);
23464 return NULL;
23465 }
23466 ssize_t _children_capacity = 1;
23467 ssize_t _n = 0;
23468 { // (star_targets '=')
23469 if (p->error_indicator) {
23470 D(p->level--);
23471 return NULL;
23472 }
23473 D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
23474 void *_tmp_152_var;
23475 while (
23476 (_tmp_152_var = _tmp_152_rule(p)) // star_targets '='
23477 )
23478 {
23479 _res = _tmp_152_var;
23480 if (_n == _children_capacity) {
23481 _children_capacity *= 2;
23482 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23483 if (!_new_children) {
23484 p->error_indicator = 1;
23485 PyErr_NoMemory();
23486 D(p->level--);
23487 return NULL;
23488 }
23489 _children = _new_children;
23490 }
23491 _children[_n++] = _res;
23492 _mark = p->mark;
23493 }
23494 p->mark = _mark;
23495 D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ',
23496 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23497 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023498 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023499 if (!_seq) {
23500 PyMem_Free(_children);
23501 p->error_indicator = 1;
23502 PyErr_NoMemory();
23503 D(p->level--);
23504 return NULL;
23505 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023506 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023507 PyMem_Free(_children);
23508 _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq);
23509 D(p->level--);
23510 return _seq;
23511}
23512
23513// _tmp_131: yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023514static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023515_tmp_131_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023516{
23517 D(p->level++);
23518 if (p->error_indicator) {
23519 D(p->level--);
23520 return NULL;
23521 }
23522 void * _res = NULL;
23523 int _mark = p->mark;
23524 { // yield_expr
23525 if (p->error_indicator) {
23526 D(p->level--);
23527 return NULL;
23528 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023529 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023530 expr_ty yield_expr_var;
23531 if (
23532 (yield_expr_var = yield_expr_rule(p)) // yield_expr
23533 )
23534 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023535 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 +010023536 _res = yield_expr_var;
23537 goto done;
23538 }
23539 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023540 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023541 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
23542 }
23543 { // star_expressions
23544 if (p->error_indicator) {
23545 D(p->level--);
23546 return NULL;
23547 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023548 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023549 expr_ty star_expressions_var;
23550 if (
23551 (star_expressions_var = star_expressions_rule(p)) // star_expressions
23552 )
23553 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023554 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 +010023555 _res = star_expressions_var;
23556 goto done;
23557 }
23558 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023559 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023560 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
23561 }
23562 _res = NULL;
23563 done:
23564 D(p->level--);
23565 return _res;
23566}
23567
Pablo Galindo4a97b152020-09-02 17:44:19 +010023568// _tmp_132: '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023569static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023570_tmp_132_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023571{
23572 D(p->level++);
23573 if (p->error_indicator) {
23574 D(p->level--);
23575 return NULL;
23576 }
23577 void * _res = NULL;
23578 int _mark = p->mark;
23579 { // '['
23580 if (p->error_indicator) {
23581 D(p->level--);
23582 return NULL;
23583 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023584 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023585 Token * _literal;
23586 if (
23587 (_literal = _PyPegen_expect_token(p, 9)) // token='['
23588 )
23589 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023590 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023591 _res = _literal;
23592 goto done;
23593 }
23594 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023595 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023596 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
23597 }
23598 { // '('
23599 if (p->error_indicator) {
23600 D(p->level--);
23601 return NULL;
23602 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023603 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023604 Token * _literal;
23605 if (
23606 (_literal = _PyPegen_expect_token(p, 7)) // token='('
23607 )
23608 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023609 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023610 _res = _literal;
23611 goto done;
23612 }
23613 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023614 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023615 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
23616 }
23617 { // '{'
23618 if (p->error_indicator) {
23619 D(p->level--);
23620 return NULL;
23621 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023622 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023623 Token * _literal;
23624 if (
23625 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
23626 )
23627 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023628 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023629 _res = _literal;
23630 goto done;
23631 }
23632 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023633 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023634 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
23635 }
23636 _res = NULL;
23637 done:
23638 D(p->level--);
23639 return _res;
23640}
23641
Pablo Galindo4a97b152020-09-02 17:44:19 +010023642// _loop0_133: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023643static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023644_loop0_133_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023645{
23646 D(p->level++);
23647 if (p->error_indicator) {
23648 D(p->level--);
23649 return NULL;
23650 }
23651 void *_res = NULL;
23652 int _mark = p->mark;
23653 int _start_mark = p->mark;
23654 void **_children = PyMem_Malloc(sizeof(void *));
23655 if (!_children) {
23656 p->error_indicator = 1;
23657 PyErr_NoMemory();
23658 D(p->level--);
23659 return NULL;
23660 }
23661 ssize_t _children_capacity = 1;
23662 ssize_t _n = 0;
23663 { // param_no_default
23664 if (p->error_indicator) {
23665 D(p->level--);
23666 return NULL;
23667 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023668 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 +010023669 arg_ty param_no_default_var;
23670 while (
23671 (param_no_default_var = param_no_default_rule(p)) // param_no_default
23672 )
23673 {
23674 _res = param_no_default_var;
23675 if (_n == _children_capacity) {
23676 _children_capacity *= 2;
23677 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23678 if (!_new_children) {
23679 p->error_indicator = 1;
23680 PyErr_NoMemory();
23681 D(p->level--);
23682 return NULL;
23683 }
23684 _children = _new_children;
23685 }
23686 _children[_n++] = _res;
23687 _mark = p->mark;
23688 }
23689 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023690 D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023691 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
23692 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023693 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023694 if (!_seq) {
23695 PyMem_Free(_children);
23696 p->error_indicator = 1;
23697 PyErr_NoMemory();
23698 D(p->level--);
23699 return NULL;
23700 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023701 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023702 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023703 _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023704 D(p->level--);
23705 return _seq;
23706}
23707
Pablo Galindo4a97b152020-09-02 17:44:19 +010023708// _tmp_134: slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023709static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023710_tmp_134_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023711{
23712 D(p->level++);
23713 if (p->error_indicator) {
23714 D(p->level--);
23715 return NULL;
23716 }
23717 void * _res = NULL;
23718 int _mark = p->mark;
23719 { // slash_with_default
23720 if (p->error_indicator) {
23721 D(p->level--);
23722 return NULL;
23723 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023724 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 +010023725 SlashWithDefault* slash_with_default_var;
23726 if (
23727 (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default
23728 )
23729 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023730 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 +010023731 _res = slash_with_default_var;
23732 goto done;
23733 }
23734 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023735 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023736 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
23737 }
23738 { // param_with_default+
23739 if (p->error_indicator) {
23740 D(p->level--);
23741 return NULL;
23742 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023743 D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23744 asdl_seq * _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023745 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023746 (_loop1_153_var = _loop1_153_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023747 )
23748 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023749 D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23750 _res = _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023751 goto done;
23752 }
23753 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023754 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023755 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
23756 }
23757 _res = NULL;
23758 done:
23759 D(p->level--);
23760 return _res;
23761}
23762
Pablo Galindo4a97b152020-09-02 17:44:19 +010023763// _loop0_135: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023764static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023765_loop0_135_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023766{
23767 D(p->level++);
23768 if (p->error_indicator) {
23769 D(p->level--);
23770 return NULL;
23771 }
23772 void *_res = NULL;
23773 int _mark = p->mark;
23774 int _start_mark = p->mark;
23775 void **_children = PyMem_Malloc(sizeof(void *));
23776 if (!_children) {
23777 p->error_indicator = 1;
23778 PyErr_NoMemory();
23779 D(p->level--);
23780 return NULL;
23781 }
23782 ssize_t _children_capacity = 1;
23783 ssize_t _n = 0;
23784 { // lambda_param_no_default
23785 if (p->error_indicator) {
23786 D(p->level--);
23787 return NULL;
23788 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023789 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 +010023790 arg_ty lambda_param_no_default_var;
23791 while (
23792 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
23793 )
23794 {
23795 _res = lambda_param_no_default_var;
23796 if (_n == _children_capacity) {
23797 _children_capacity *= 2;
23798 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23799 if (!_new_children) {
23800 p->error_indicator = 1;
23801 PyErr_NoMemory();
23802 D(p->level--);
23803 return NULL;
23804 }
23805 _children = _new_children;
23806 }
23807 _children[_n++] = _res;
23808 _mark = p->mark;
23809 }
23810 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023811 D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023812 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
23813 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023814 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023815 if (!_seq) {
23816 PyMem_Free(_children);
23817 p->error_indicator = 1;
23818 PyErr_NoMemory();
23819 D(p->level--);
23820 return NULL;
23821 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023822 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023823 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023824 _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023825 D(p->level--);
23826 return _seq;
23827}
23828
Pablo Galindo4a97b152020-09-02 17:44:19 +010023829// _tmp_136: lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023830static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023831_tmp_136_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023832{
23833 D(p->level++);
23834 if (p->error_indicator) {
23835 D(p->level--);
23836 return NULL;
23837 }
23838 void * _res = NULL;
23839 int _mark = p->mark;
23840 { // lambda_slash_with_default
23841 if (p->error_indicator) {
23842 D(p->level--);
23843 return NULL;
23844 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023845 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 +010023846 SlashWithDefault* lambda_slash_with_default_var;
23847 if (
23848 (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
23849 )
23850 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023851 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 +010023852 _res = lambda_slash_with_default_var;
23853 goto done;
23854 }
23855 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023856 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023857 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
23858 }
23859 { // lambda_param_with_default+
23860 if (p->error_indicator) {
23861 D(p->level--);
23862 return NULL;
23863 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023864 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23865 asdl_seq * _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023866 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023867 (_loop1_154_var = _loop1_154_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023868 )
23869 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023870 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23871 _res = _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023872 goto done;
23873 }
23874 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023875 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023876 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
23877 }
23878 _res = NULL;
23879 done:
23880 D(p->level--);
23881 return _res;
23882}
23883
Pablo Galindo4a97b152020-09-02 17:44:19 +010023884// _tmp_137: ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023885static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023886_tmp_137_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023887{
23888 D(p->level++);
23889 if (p->error_indicator) {
23890 D(p->level--);
23891 return NULL;
23892 }
23893 void * _res = NULL;
23894 int _mark = p->mark;
23895 { // ')'
23896 if (p->error_indicator) {
23897 D(p->level--);
23898 return NULL;
23899 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023900 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023901 Token * _literal;
23902 if (
23903 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
23904 )
23905 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023906 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023907 _res = _literal;
23908 goto done;
23909 }
23910 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023911 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023912 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
23913 }
23914 { // ',' (')' | '**')
23915 if (p->error_indicator) {
23916 D(p->level--);
23917 return NULL;
23918 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023919 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023920 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023921 void *_tmp_155_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023922 if (
23923 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23924 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023925 (_tmp_155_var = _tmp_155_rule(p)) // ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023926 )
23927 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023928 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
23929 _res = _PyPegen_dummy_name(p, _literal, _tmp_155_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023930 goto done;
23931 }
23932 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023933 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023934 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
23935 }
23936 _res = NULL;
23937 done:
23938 D(p->level--);
23939 return _res;
23940}
23941
Pablo Galindo4a97b152020-09-02 17:44:19 +010023942// _tmp_138: ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023943static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023944_tmp_138_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023945{
23946 D(p->level++);
23947 if (p->error_indicator) {
23948 D(p->level--);
23949 return NULL;
23950 }
23951 void * _res = NULL;
23952 int _mark = p->mark;
23953 { // ':'
23954 if (p->error_indicator) {
23955 D(p->level--);
23956 return NULL;
23957 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023958 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023959 Token * _literal;
23960 if (
23961 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
23962 )
23963 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023964 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023965 _res = _literal;
23966 goto done;
23967 }
23968 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023969 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023970 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
23971 }
23972 { // ',' (':' | '**')
23973 if (p->error_indicator) {
23974 D(p->level--);
23975 return NULL;
23976 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023977 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023978 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023979 void *_tmp_156_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023980 if (
23981 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23982 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023983 (_tmp_156_var = _tmp_156_rule(p)) // ':' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023984 )
23985 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023986 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
23987 _res = _PyPegen_dummy_name(p, _literal, _tmp_156_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023988 goto done;
23989 }
23990 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023991 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023992 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
23993 }
23994 _res = NULL;
23995 done:
23996 D(p->level--);
23997 return _res;
23998}
23999
Pablo Galindo4a97b152020-09-02 17:44:19 +010024000// _tmp_139: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024001static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024002_tmp_139_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024003{
24004 D(p->level++);
24005 if (p->error_indicator) {
24006 D(p->level--);
24007 return NULL;
24008 }
24009 void * _res = NULL;
24010 int _mark = p->mark;
24011 { // star_targets '='
24012 if (p->error_indicator) {
24013 D(p->level--);
24014 return NULL;
24015 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024016 D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024017 Token * _literal;
24018 expr_ty z;
24019 if (
24020 (z = star_targets_rule(p)) // star_targets
24021 &&
24022 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24023 )
24024 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024025 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 +010024026 _res = z;
24027 if (_res == NULL && PyErr_Occurred()) {
24028 p->error_indicator = 1;
24029 D(p->level--);
24030 return NULL;
24031 }
24032 goto done;
24033 }
24034 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024035 D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024036 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24037 }
24038 _res = NULL;
24039 done:
24040 D(p->level--);
24041 return _res;
24042}
24043
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024044// _tmp_140: '.' | '...'
24045static void *
24046_tmp_140_rule(Parser *p)
24047{
24048 D(p->level++);
24049 if (p->error_indicator) {
24050 D(p->level--);
24051 return NULL;
24052 }
24053 void * _res = NULL;
24054 int _mark = p->mark;
24055 { // '.'
24056 if (p->error_indicator) {
24057 D(p->level--);
24058 return NULL;
24059 }
24060 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
24061 Token * _literal;
24062 if (
24063 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
24064 )
24065 {
24066 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
24067 _res = _literal;
24068 goto done;
24069 }
24070 p->mark = _mark;
24071 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
24072 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
24073 }
24074 { // '...'
24075 if (p->error_indicator) {
24076 D(p->level--);
24077 return NULL;
24078 }
24079 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
24080 Token * _literal;
24081 if (
24082 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
24083 )
24084 {
24085 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
24086 _res = _literal;
24087 goto done;
24088 }
24089 p->mark = _mark;
24090 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
24091 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
24092 }
24093 _res = NULL;
24094 done:
24095 D(p->level--);
24096 return _res;
24097}
24098
Pablo Galindo4a97b152020-09-02 17:44:19 +010024099// _tmp_141: '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024100static void *
24101_tmp_141_rule(Parser *p)
24102{
24103 D(p->level++);
24104 if (p->error_indicator) {
24105 D(p->level--);
24106 return NULL;
24107 }
24108 void * _res = NULL;
24109 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024110 { // '.'
24111 if (p->error_indicator) {
24112 D(p->level--);
24113 return NULL;
24114 }
24115 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
24116 Token * _literal;
24117 if (
24118 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
24119 )
24120 {
24121 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
24122 _res = _literal;
24123 goto done;
24124 }
24125 p->mark = _mark;
24126 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24127 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
24128 }
24129 { // '...'
24130 if (p->error_indicator) {
24131 D(p->level--);
24132 return NULL;
24133 }
24134 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
24135 Token * _literal;
24136 if (
24137 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
24138 )
24139 {
24140 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
24141 _res = _literal;
24142 goto done;
24143 }
24144 p->mark = _mark;
24145 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24146 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
24147 }
24148 _res = NULL;
24149 done:
24150 D(p->level--);
24151 return _res;
24152}
24153
24154// _tmp_142: '@' named_expression NEWLINE
24155static void *
24156_tmp_142_rule(Parser *p)
24157{
24158 D(p->level++);
24159 if (p->error_indicator) {
24160 D(p->level--);
24161 return NULL;
24162 }
24163 void * _res = NULL;
24164 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024165 { // '@' named_expression NEWLINE
24166 if (p->error_indicator) {
24167 D(p->level--);
24168 return NULL;
24169 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024170 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 +010024171 Token * _literal;
24172 expr_ty f;
24173 Token * newline_var;
24174 if (
24175 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
24176 &&
24177 (f = named_expression_rule(p)) // named_expression
24178 &&
24179 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
24180 )
24181 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024182 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 +010024183 _res = f;
24184 if (_res == NULL && PyErr_Occurred()) {
24185 p->error_indicator = 1;
24186 D(p->level--);
24187 return NULL;
24188 }
24189 goto done;
24190 }
24191 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024192 D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024193 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
24194 }
24195 _res = NULL;
24196 done:
24197 D(p->level--);
24198 return _res;
24199}
24200
Pablo Galindo4a97b152020-09-02 17:44:19 +010024201// _tmp_143: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024202static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024203_tmp_143_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024204{
24205 D(p->level++);
24206 if (p->error_indicator) {
24207 D(p->level--);
24208 return NULL;
24209 }
24210 void * _res = NULL;
24211 int _mark = p->mark;
24212 { // ',' star_expression
24213 if (p->error_indicator) {
24214 D(p->level--);
24215 return NULL;
24216 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024217 D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024218 Token * _literal;
24219 expr_ty c;
24220 if (
24221 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24222 &&
24223 (c = star_expression_rule(p)) // star_expression
24224 )
24225 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024226 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 +010024227 _res = c;
24228 if (_res == NULL && PyErr_Occurred()) {
24229 p->error_indicator = 1;
24230 D(p->level--);
24231 return NULL;
24232 }
24233 goto done;
24234 }
24235 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024236 D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024237 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
24238 }
24239 _res = NULL;
24240 done:
24241 D(p->level--);
24242 return _res;
24243}
24244
Pablo Galindo4a97b152020-09-02 17:44:19 +010024245// _tmp_144: ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024246static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024247_tmp_144_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024248{
24249 D(p->level++);
24250 if (p->error_indicator) {
24251 D(p->level--);
24252 return NULL;
24253 }
24254 void * _res = NULL;
24255 int _mark = p->mark;
24256 { // ',' expression
24257 if (p->error_indicator) {
24258 D(p->level--);
24259 return NULL;
24260 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024261 D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024262 Token * _literal;
24263 expr_ty c;
24264 if (
24265 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24266 &&
24267 (c = expression_rule(p)) // expression
24268 )
24269 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024270 D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024271 _res = c;
24272 if (_res == NULL && PyErr_Occurred()) {
24273 p->error_indicator = 1;
24274 D(p->level--);
24275 return NULL;
24276 }
24277 goto done;
24278 }
24279 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024280 D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024281 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
24282 }
24283 _res = NULL;
24284 done:
24285 D(p->level--);
24286 return _res;
24287}
24288
Pablo Galindo4a97b152020-09-02 17:44:19 +010024289// _tmp_145: 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024290static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024291_tmp_145_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024292{
24293 D(p->level++);
24294 if (p->error_indicator) {
24295 D(p->level--);
24296 return NULL;
24297 }
24298 void * _res = NULL;
24299 int _mark = p->mark;
24300 { // 'or' conjunction
24301 if (p->error_indicator) {
24302 D(p->level--);
24303 return NULL;
24304 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024305 D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024306 Token * _keyword;
24307 expr_ty c;
24308 if (
24309 (_keyword = _PyPegen_expect_token(p, 531)) // token='or'
24310 &&
24311 (c = conjunction_rule(p)) // conjunction
24312 )
24313 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024314 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 +010024315 _res = c;
24316 if (_res == NULL && PyErr_Occurred()) {
24317 p->error_indicator = 1;
24318 D(p->level--);
24319 return NULL;
24320 }
24321 goto done;
24322 }
24323 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024324 D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024325 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
24326 }
24327 _res = NULL;
24328 done:
24329 D(p->level--);
24330 return _res;
24331}
24332
Pablo Galindo4a97b152020-09-02 17:44:19 +010024333// _tmp_146: 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024334static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024335_tmp_146_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024336{
24337 D(p->level++);
24338 if (p->error_indicator) {
24339 D(p->level--);
24340 return NULL;
24341 }
24342 void * _res = NULL;
24343 int _mark = p->mark;
24344 { // 'and' inversion
24345 if (p->error_indicator) {
24346 D(p->level--);
24347 return NULL;
24348 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024349 D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024350 Token * _keyword;
24351 expr_ty c;
24352 if (
24353 (_keyword = _PyPegen_expect_token(p, 532)) // token='and'
24354 &&
24355 (c = inversion_rule(p)) // inversion
24356 )
24357 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024358 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 +010024359 _res = c;
24360 if (_res == NULL && PyErr_Occurred()) {
24361 p->error_indicator = 1;
24362 D(p->level--);
24363 return NULL;
24364 }
24365 goto done;
24366 }
24367 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024368 D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010024369 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024370 }
24371 _res = NULL;
24372 done:
24373 D(p->level--);
24374 return _res;
24375}
24376
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024377// _tmp_147: 'if' disjunction
24378static void *
24379_tmp_147_rule(Parser *p)
24380{
24381 D(p->level++);
24382 if (p->error_indicator) {
24383 D(p->level--);
24384 return NULL;
24385 }
24386 void * _res = NULL;
24387 int _mark = p->mark;
24388 { // 'if' disjunction
24389 if (p->error_indicator) {
24390 D(p->level--);
24391 return NULL;
24392 }
24393 D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24394 Token * _keyword;
24395 expr_ty z;
24396 if (
24397 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24398 &&
24399 (z = disjunction_rule(p)) // disjunction
24400 )
24401 {
24402 D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24403 _res = z;
24404 if (_res == NULL && PyErr_Occurred()) {
24405 p->error_indicator = 1;
24406 D(p->level--);
24407 return NULL;
24408 }
24409 goto done;
24410 }
24411 p->mark = _mark;
24412 D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
24413 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24414 }
24415 _res = NULL;
24416 done:
24417 D(p->level--);
24418 return _res;
24419}
24420
Pablo Galindo4a97b152020-09-02 17:44:19 +010024421// _tmp_148: 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024422static void *
24423_tmp_148_rule(Parser *p)
24424{
24425 D(p->level++);
24426 if (p->error_indicator) {
24427 D(p->level--);
24428 return NULL;
24429 }
24430 void * _res = NULL;
24431 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024432 { // 'if' disjunction
24433 if (p->error_indicator) {
24434 D(p->level--);
24435 return NULL;
24436 }
24437 D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24438 Token * _keyword;
24439 expr_ty z;
24440 if (
24441 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24442 &&
24443 (z = disjunction_rule(p)) // disjunction
24444 )
24445 {
24446 D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24447 _res = z;
24448 if (_res == NULL && PyErr_Occurred()) {
24449 p->error_indicator = 1;
24450 D(p->level--);
24451 return NULL;
24452 }
24453 goto done;
24454 }
24455 p->mark = _mark;
24456 D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
24457 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24458 }
24459 _res = NULL;
24460 done:
24461 D(p->level--);
24462 return _res;
24463}
24464
24465// _tmp_149: starred_expression | named_expression !'='
24466static void *
24467_tmp_149_rule(Parser *p)
24468{
24469 D(p->level++);
24470 if (p->error_indicator) {
24471 D(p->level--);
24472 return NULL;
24473 }
24474 void * _res = NULL;
24475 int _mark = p->mark;
24476 { // starred_expression
24477 if (p->error_indicator) {
24478 D(p->level--);
24479 return NULL;
24480 }
24481 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24482 expr_ty starred_expression_var;
24483 if (
24484 (starred_expression_var = starred_expression_rule(p)) // starred_expression
24485 )
24486 {
24487 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24488 _res = starred_expression_var;
24489 goto done;
24490 }
24491 p->mark = _mark;
24492 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24493 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
24494 }
24495 { // named_expression !'='
24496 if (p->error_indicator) {
24497 D(p->level--);
24498 return NULL;
24499 }
24500 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24501 expr_ty named_expression_var;
24502 if (
24503 (named_expression_var = named_expression_rule(p)) // named_expression
24504 &&
24505 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
24506 )
24507 {
24508 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24509 _res = named_expression_var;
24510 goto done;
24511 }
24512 p->mark = _mark;
24513 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24514 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='"));
24515 }
24516 _res = NULL;
24517 done:
24518 D(p->level--);
24519 return _res;
24520}
24521
24522// _tmp_150: ',' star_target
24523static void *
24524_tmp_150_rule(Parser *p)
24525{
24526 D(p->level++);
24527 if (p->error_indicator) {
24528 D(p->level--);
24529 return NULL;
24530 }
24531 void * _res = NULL;
24532 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024533 { // ',' star_target
24534 if (p->error_indicator) {
24535 D(p->level--);
24536 return NULL;
24537 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024538 D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024539 Token * _literal;
24540 expr_ty c;
24541 if (
24542 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24543 &&
24544 (c = star_target_rule(p)) // star_target
24545 )
24546 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024547 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 +010024548 _res = c;
24549 if (_res == NULL && PyErr_Occurred()) {
24550 p->error_indicator = 1;
24551 D(p->level--);
24552 return NULL;
24553 }
24554 goto done;
24555 }
24556 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024557 D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030024558 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024559 }
24560 _res = NULL;
24561 done:
24562 D(p->level--);
24563 return _res;
24564}
24565
Pablo Galindo4a97b152020-09-02 17:44:19 +010024566// _tmp_151: star_targets '='
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024567static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024568_tmp_151_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024569{
24570 D(p->level++);
24571 if (p->error_indicator) {
24572 D(p->level--);
24573 return NULL;
24574 }
24575 void * _res = NULL;
24576 int _mark = p->mark;
24577 { // star_targets '='
24578 if (p->error_indicator) {
24579 D(p->level--);
24580 return NULL;
24581 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024582 D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024583 Token * _literal;
24584 expr_ty star_targets_var;
24585 if (
24586 (star_targets_var = star_targets_rule(p)) // star_targets
24587 &&
24588 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24589 )
24590 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024591 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 +030024592 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24593 goto done;
24594 }
24595 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024596 D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024597 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24598 }
24599 _res = NULL;
24600 done:
24601 D(p->level--);
24602 return _res;
24603}
24604
Pablo Galindo4a97b152020-09-02 17:44:19 +010024605// _tmp_152: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024606static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024607_tmp_152_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024608{
24609 D(p->level++);
24610 if (p->error_indicator) {
24611 D(p->level--);
24612 return NULL;
24613 }
24614 void * _res = NULL;
24615 int _mark = p->mark;
24616 { // star_targets '='
24617 if (p->error_indicator) {
24618 D(p->level--);
24619 return NULL;
24620 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024621 D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024622 Token * _literal;
24623 expr_ty star_targets_var;
24624 if (
24625 (star_targets_var = star_targets_rule(p)) // star_targets
24626 &&
24627 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24628 )
24629 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024630 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 +010024631 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24632 goto done;
24633 }
24634 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024635 D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024636 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24637 }
24638 _res = NULL;
24639 done:
24640 D(p->level--);
24641 return _res;
24642}
24643
Pablo Galindo4a97b152020-09-02 17:44:19 +010024644// _loop1_153: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024645static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024646_loop1_153_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024647{
24648 D(p->level++);
24649 if (p->error_indicator) {
24650 D(p->level--);
24651 return NULL;
24652 }
24653 void *_res = NULL;
24654 int _mark = p->mark;
24655 int _start_mark = p->mark;
24656 void **_children = PyMem_Malloc(sizeof(void *));
24657 if (!_children) {
24658 p->error_indicator = 1;
24659 PyErr_NoMemory();
24660 D(p->level--);
24661 return NULL;
24662 }
24663 ssize_t _children_capacity = 1;
24664 ssize_t _n = 0;
24665 { // param_with_default
24666 if (p->error_indicator) {
24667 D(p->level--);
24668 return NULL;
24669 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024670 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 +010024671 NameDefaultPair* param_with_default_var;
24672 while (
24673 (param_with_default_var = param_with_default_rule(p)) // param_with_default
24674 )
24675 {
24676 _res = param_with_default_var;
24677 if (_n == _children_capacity) {
24678 _children_capacity *= 2;
24679 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24680 if (!_new_children) {
24681 p->error_indicator = 1;
24682 PyErr_NoMemory();
24683 D(p->level--);
24684 return NULL;
24685 }
24686 _children = _new_children;
24687 }
24688 _children[_n++] = _res;
24689 _mark = p->mark;
24690 }
24691 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024692 D(fprintf(stderr, "%*c%s _loop1_153[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024693 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
24694 }
24695 if (_n == 0 || p->error_indicator) {
24696 PyMem_Free(_children);
24697 D(p->level--);
24698 return NULL;
24699 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024700 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024701 if (!_seq) {
24702 PyMem_Free(_children);
24703 p->error_indicator = 1;
24704 PyErr_NoMemory();
24705 D(p->level--);
24706 return NULL;
24707 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024708 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024709 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024710 _PyPegen_insert_memo(p, _start_mark, _loop1_153_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024711 D(p->level--);
24712 return _seq;
24713}
24714
Pablo Galindo4a97b152020-09-02 17:44:19 +010024715// _loop1_154: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024716static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024717_loop1_154_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024718{
24719 D(p->level++);
24720 if (p->error_indicator) {
24721 D(p->level--);
24722 return NULL;
24723 }
24724 void *_res = NULL;
24725 int _mark = p->mark;
24726 int _start_mark = p->mark;
24727 void **_children = PyMem_Malloc(sizeof(void *));
24728 if (!_children) {
24729 p->error_indicator = 1;
24730 PyErr_NoMemory();
24731 D(p->level--);
24732 return NULL;
24733 }
24734 ssize_t _children_capacity = 1;
24735 ssize_t _n = 0;
24736 { // lambda_param_with_default
24737 if (p->error_indicator) {
24738 D(p->level--);
24739 return NULL;
24740 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024741 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 +010024742 NameDefaultPair* lambda_param_with_default_var;
24743 while (
24744 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
24745 )
24746 {
24747 _res = lambda_param_with_default_var;
24748 if (_n == _children_capacity) {
24749 _children_capacity *= 2;
24750 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24751 if (!_new_children) {
24752 p->error_indicator = 1;
24753 PyErr_NoMemory();
24754 D(p->level--);
24755 return NULL;
24756 }
24757 _children = _new_children;
24758 }
24759 _children[_n++] = _res;
24760 _mark = p->mark;
24761 }
24762 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024763 D(fprintf(stderr, "%*c%s _loop1_154[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024764 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
24765 }
24766 if (_n == 0 || p->error_indicator) {
24767 PyMem_Free(_children);
24768 D(p->level--);
24769 return NULL;
24770 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024771 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024772 if (!_seq) {
24773 PyMem_Free(_children);
24774 p->error_indicator = 1;
24775 PyErr_NoMemory();
24776 D(p->level--);
24777 return NULL;
24778 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024779 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024780 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024781 _PyPegen_insert_memo(p, _start_mark, _loop1_154_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024782 D(p->level--);
24783 return _seq;
24784}
24785
Pablo Galindo4a97b152020-09-02 17:44:19 +010024786// _tmp_155: ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024787static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024788_tmp_155_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024789{
24790 D(p->level++);
24791 if (p->error_indicator) {
24792 D(p->level--);
24793 return NULL;
24794 }
24795 void * _res = NULL;
24796 int _mark = p->mark;
24797 { // ')'
24798 if (p->error_indicator) {
24799 D(p->level--);
24800 return NULL;
24801 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024802 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024803 Token * _literal;
24804 if (
24805 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
24806 )
24807 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024808 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024809 _res = _literal;
24810 goto done;
24811 }
24812 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024813 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024814 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
24815 }
24816 { // '**'
24817 if (p->error_indicator) {
24818 D(p->level--);
24819 return NULL;
24820 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024821 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024822 Token * _literal;
24823 if (
24824 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24825 )
24826 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024827 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024828 _res = _literal;
24829 goto done;
24830 }
24831 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024832 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024833 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24834 }
24835 _res = NULL;
24836 done:
24837 D(p->level--);
24838 return _res;
24839}
24840
Pablo Galindo4a97b152020-09-02 17:44:19 +010024841// _tmp_156: ':' | '**'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024842static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024843_tmp_156_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024844{
24845 D(p->level++);
24846 if (p->error_indicator) {
24847 D(p->level--);
24848 return NULL;
24849 }
24850 void * _res = NULL;
24851 int _mark = p->mark;
24852 { // ':'
24853 if (p->error_indicator) {
24854 D(p->level--);
24855 return NULL;
24856 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024857 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024858 Token * _literal;
24859 if (
24860 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
24861 )
24862 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024863 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024864 _res = _literal;
24865 goto done;
24866 }
24867 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024868 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024869 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024870 }
24871 { // '**'
24872 if (p->error_indicator) {
24873 D(p->level--);
24874 return NULL;
24875 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024876 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024877 Token * _literal;
24878 if (
24879 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24880 )
24881 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024882 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024883 _res = _literal;
24884 goto done;
24885 }
24886 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024887 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024888 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24889 }
24890 _res = NULL;
24891 done:
24892 D(p->level--);
24893 return _res;
24894}
24895
24896void *
24897_PyPegen_parse(Parser *p)
24898{
24899 // Initialize keywords
24900 p->keywords = reserved_keywords;
24901 p->n_keyword_lists = n_keyword_lists;
24902
24903 // Run parser
24904 void *result = NULL;
24905 if (p->start_rule == Py_file_input) {
24906 result = file_rule(p);
24907 } else if (p->start_rule == Py_single_input) {
24908 result = interactive_rule(p);
24909 } else if (p->start_rule == Py_eval_input) {
24910 result = eval_rule(p);
24911 } else if (p->start_rule == Py_func_type_input) {
24912 result = func_type_rule(p);
24913 } else if (p->start_rule == Py_fstring_input) {
24914 result = fstring_rule(p);
24915 }
24916
24917 return result;
24918}
24919
24920// The end