blob: 8a7cb62fd7cf8dd9893958f3a8433a555918d81b [file] [log] [blame]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001// @generated by pegen.py from ./Grammar/python.gram
2#include "pegen.h"
Guido van Rossumf70e43a1991-02-19 12:39:46 +00003
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004#if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
Guido van Rossum86bea461997-04-29 21:03:06 +00005extern int Py_DebugFlag;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006#define D(x) if (Py_DebugFlag) x;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00007#else
8#define D(x)
9#endif
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010static const int n_keyword_lists = 9;
11static KeywordToken *reserved_keywords[] = {
Pablo Galindo1ac0cbc2020-07-06 20:31:16 +010012 (KeywordToken[]) {{NULL, -1}},
13 (KeywordToken[]) {{NULL, -1}},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014 (KeywordToken[]) {
15 {"if", 510},
16 {"in", 518},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017 {"as", 520},
18 {"is", 527},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019 {"or", 531},
20 {NULL, -1},
21 },
22 (KeywordToken[]) {
23 {"del", 503},
24 {"try", 511},
25 {"for", 517},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030026 {"def", 523},
27 {"not", 526},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010028 {"and", 532},
29 {NULL, -1},
30 },
31 (KeywordToken[]) {
32 {"pass", 502},
33 {"from", 514},
34 {"elif", 515},
35 {"else", 516},
36 {"with", 519},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030037 {"True", 528},
38 {"None", 530},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010039 {NULL, -1},
40 },
41 (KeywordToken[]) {
42 {"raise", 501},
43 {"yield", 504},
44 {"break", 506},
45 {"while", 512},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030046 {"class", 524},
47 {"False", 529},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010048 {NULL, -1},
49 },
50 (KeywordToken[]) {
51 {"return", 500},
52 {"assert", 505},
53 {"global", 508},
54 {"import", 513},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030055 {"except", 521},
56 {"lambda", 525},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010057 {NULL, -1},
58 },
59 (KeywordToken[]) {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030060 {"finally", 522},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010061 {NULL, -1},
62 },
63 (KeywordToken[]) {
64 {"continue", 507},
65 {"nonlocal", 509},
66 {NULL, -1},
67 },
68};
69#define file_type 1000
70#define interactive_type 1001
71#define eval_type 1002
72#define func_type_type 1003
73#define fstring_type 1004
74#define type_expressions_type 1005
75#define statements_type 1006
76#define statement_type 1007
77#define statement_newline_type 1008
78#define simple_stmt_type 1009
79#define small_stmt_type 1010
80#define compound_stmt_type 1011
81#define assignment_type 1012
82#define augassign_type 1013
83#define global_stmt_type 1014
84#define nonlocal_stmt_type 1015
85#define yield_stmt_type 1016
86#define assert_stmt_type 1017
87#define del_stmt_type 1018
88#define import_stmt_type 1019
89#define import_name_type 1020
90#define import_from_type 1021
91#define import_from_targets_type 1022
92#define import_from_as_names_type 1023
93#define import_from_as_name_type 1024
94#define dotted_as_names_type 1025
95#define dotted_as_name_type 1026
96#define dotted_name_type 1027 // Left-recursive
97#define if_stmt_type 1028
98#define elif_stmt_type 1029
99#define else_block_type 1030
100#define while_stmt_type 1031
101#define for_stmt_type 1032
102#define with_stmt_type 1033
103#define with_item_type 1034
104#define try_stmt_type 1035
105#define except_block_type 1036
106#define finally_block_type 1037
107#define return_stmt_type 1038
108#define raise_stmt_type 1039
109#define function_def_type 1040
110#define function_def_raw_type 1041
111#define func_type_comment_type 1042
112#define params_type 1043
113#define parameters_type 1044
114#define slash_no_default_type 1045
115#define slash_with_default_type 1046
116#define star_etc_type 1047
117#define kwds_type 1048
118#define param_no_default_type 1049
119#define param_with_default_type 1050
120#define param_maybe_default_type 1051
121#define param_type 1052
122#define annotation_type 1053
123#define default_type 1054
124#define decorators_type 1055
125#define class_def_type 1056
126#define class_def_raw_type 1057
127#define block_type 1058
128#define expressions_list_type 1059
129#define star_expressions_type 1060
130#define star_expression_type 1061
131#define star_named_expressions_type 1062
132#define star_named_expression_type 1063
133#define named_expression_type 1064
134#define annotated_rhs_type 1065
135#define expressions_type 1066
136#define expression_type 1067
137#define lambdef_type 1068
138#define lambda_params_type 1069
139#define lambda_parameters_type 1070
140#define lambda_slash_no_default_type 1071
141#define lambda_slash_with_default_type 1072
142#define lambda_star_etc_type 1073
143#define lambda_kwds_type 1074
144#define lambda_param_no_default_type 1075
145#define lambda_param_with_default_type 1076
146#define lambda_param_maybe_default_type 1077
147#define lambda_param_type 1078
148#define disjunction_type 1079
149#define conjunction_type 1080
150#define inversion_type 1081
151#define comparison_type 1082
152#define compare_op_bitwise_or_pair_type 1083
153#define eq_bitwise_or_type 1084
154#define noteq_bitwise_or_type 1085
155#define lte_bitwise_or_type 1086
156#define lt_bitwise_or_type 1087
157#define gte_bitwise_or_type 1088
158#define gt_bitwise_or_type 1089
159#define notin_bitwise_or_type 1090
160#define in_bitwise_or_type 1091
161#define isnot_bitwise_or_type 1092
162#define is_bitwise_or_type 1093
163#define bitwise_or_type 1094 // Left-recursive
164#define bitwise_xor_type 1095 // Left-recursive
165#define bitwise_and_type 1096 // Left-recursive
166#define shift_expr_type 1097 // Left-recursive
167#define sum_type 1098 // Left-recursive
168#define term_type 1099 // Left-recursive
169#define factor_type 1100
170#define power_type 1101
171#define await_primary_type 1102
172#define primary_type 1103 // Left-recursive
173#define slices_type 1104
174#define slice_type 1105
175#define atom_type 1106
176#define strings_type 1107
177#define list_type 1108
178#define listcomp_type 1109
179#define tuple_type 1110
180#define group_type 1111
181#define genexp_type 1112
182#define set_type 1113
183#define setcomp_type 1114
184#define dict_type 1115
185#define dictcomp_type 1116
186#define double_starred_kvpairs_type 1117
187#define double_starred_kvpair_type 1118
188#define kvpair_type 1119
189#define for_if_clauses_type 1120
190#define for_if_clause_type 1121
191#define yield_expr_type 1122
192#define arguments_type 1123
193#define args_type 1124
194#define kwargs_type 1125
195#define starred_expression_type 1126
196#define kwarg_or_starred_type 1127
197#define kwarg_or_double_starred_type 1128
198#define star_targets_type 1129
199#define star_targets_seq_type 1130
200#define star_target_type 1131
201#define star_atom_type 1132
202#define single_target_type 1133
203#define single_subscript_attribute_target_type 1134
204#define del_targets_type 1135
205#define del_target_type 1136
206#define del_t_atom_type 1137
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300207#define targets_type 1138
208#define target_type 1139
209#define t_primary_type 1140 // Left-recursive
210#define t_lookahead_type 1141
211#define t_atom_type 1142
212#define incorrect_arguments_type 1143
213#define invalid_kwarg_type 1144
214#define invalid_named_expression_type 1145
215#define invalid_assignment_type 1146
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300216#define invalid_ann_assign_target_type 1147
217#define invalid_del_stmt_type 1148
218#define invalid_block_type 1149
219#define invalid_comprehension_type 1150
220#define invalid_dict_comprehension_type 1151
221#define invalid_parameters_type 1152
222#define invalid_lambda_parameters_type 1153
223#define invalid_star_etc_type 1154
224#define invalid_lambda_star_etc_type 1155
225#define invalid_double_type_comments_type 1156
226#define invalid_with_item_type 1157
227#define invalid_for_target_type 1158
228#define invalid_group_type 1159
229#define invalid_import_from_targets_type 1160
230#define _loop0_1_type 1161
231#define _loop0_2_type 1162
232#define _loop0_4_type 1163
233#define _gather_3_type 1164
234#define _loop0_6_type 1165
235#define _gather_5_type 1166
236#define _loop0_8_type 1167
237#define _gather_7_type 1168
238#define _loop0_10_type 1169
239#define _gather_9_type 1170
240#define _loop1_11_type 1171
241#define _loop0_13_type 1172
242#define _gather_12_type 1173
243#define _tmp_14_type 1174
244#define _tmp_15_type 1175
245#define _tmp_16_type 1176
246#define _tmp_17_type 1177
247#define _tmp_18_type 1178
248#define _tmp_19_type 1179
249#define _tmp_20_type 1180
250#define _tmp_21_type 1181
251#define _loop1_22_type 1182
252#define _tmp_23_type 1183
253#define _tmp_24_type 1184
254#define _loop0_26_type 1185
255#define _gather_25_type 1186
256#define _loop0_28_type 1187
257#define _gather_27_type 1188
258#define _tmp_29_type 1189
259#define _tmp_30_type 1190
260#define _loop0_31_type 1191
261#define _loop1_32_type 1192
262#define _loop0_34_type 1193
263#define _gather_33_type 1194
264#define _tmp_35_type 1195
265#define _loop0_37_type 1196
266#define _gather_36_type 1197
267#define _tmp_38_type 1198
268#define _loop0_40_type 1199
269#define _gather_39_type 1200
270#define _loop0_42_type 1201
271#define _gather_41_type 1202
272#define _loop0_44_type 1203
273#define _gather_43_type 1204
274#define _loop0_46_type 1205
275#define _gather_45_type 1206
276#define _tmp_47_type 1207
277#define _loop1_48_type 1208
278#define _tmp_49_type 1209
279#define _tmp_50_type 1210
280#define _tmp_51_type 1211
281#define _tmp_52_type 1212
282#define _tmp_53_type 1213
283#define _loop0_54_type 1214
284#define _loop0_55_type 1215
285#define _loop0_56_type 1216
286#define _loop1_57_type 1217
287#define _loop0_58_type 1218
288#define _loop1_59_type 1219
289#define _loop1_60_type 1220
290#define _loop1_61_type 1221
291#define _loop0_62_type 1222
292#define _loop1_63_type 1223
293#define _loop0_64_type 1224
294#define _loop1_65_type 1225
295#define _loop0_66_type 1226
296#define _loop1_67_type 1227
297#define _loop1_68_type 1228
298#define _tmp_69_type 1229
299#define _loop0_71_type 1230
300#define _gather_70_type 1231
301#define _loop1_72_type 1232
302#define _loop0_74_type 1233
303#define _gather_73_type 1234
304#define _loop1_75_type 1235
305#define _loop0_76_type 1236
306#define _loop0_77_type 1237
307#define _loop0_78_type 1238
308#define _loop1_79_type 1239
309#define _loop0_80_type 1240
310#define _loop1_81_type 1241
311#define _loop1_82_type 1242
312#define _loop1_83_type 1243
313#define _loop0_84_type 1244
314#define _loop1_85_type 1245
315#define _loop0_86_type 1246
316#define _loop1_87_type 1247
317#define _loop0_88_type 1248
318#define _loop1_89_type 1249
319#define _loop1_90_type 1250
320#define _loop1_91_type 1251
321#define _loop1_92_type 1252
322#define _tmp_93_type 1253
323#define _loop0_95_type 1254
324#define _gather_94_type 1255
325#define _tmp_96_type 1256
326#define _tmp_97_type 1257
327#define _tmp_98_type 1258
328#define _tmp_99_type 1259
329#define _loop1_100_type 1260
330#define _tmp_101_type 1261
331#define _tmp_102_type 1262
332#define _loop0_104_type 1263
333#define _gather_103_type 1264
334#define _loop1_105_type 1265
335#define _loop0_106_type 1266
336#define _loop0_107_type 1267
Pablo Galindo4a97b152020-09-02 17:44:19 +0100337#define _loop0_109_type 1268
338#define _gather_108_type 1269
339#define _tmp_110_type 1270
340#define _loop0_112_type 1271
341#define _gather_111_type 1272
342#define _loop0_114_type 1273
343#define _gather_113_type 1274
344#define _loop0_116_type 1275
345#define _gather_115_type 1276
346#define _loop0_118_type 1277
347#define _gather_117_type 1278
348#define _loop0_119_type 1279
349#define _loop0_121_type 1280
350#define _gather_120_type 1281
351#define _tmp_122_type 1282
352#define _loop0_124_type 1283
353#define _gather_123_type 1284
354#define _loop0_126_type 1285
355#define _gather_125_type 1286
356#define _tmp_127_type 1287
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300357#define _loop0_128_type 1288
358#define _loop0_129_type 1289
Pablo Galindo4a97b152020-09-02 17:44:19 +0100359#define _loop0_130_type 1290
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300360#define _tmp_131_type 1291
Pablo Galindo4a97b152020-09-02 17:44:19 +0100361#define _tmp_132_type 1292
362#define _loop0_133_type 1293
363#define _tmp_134_type 1294
364#define _loop0_135_type 1295
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300365#define _tmp_136_type 1296
366#define _tmp_137_type 1297
367#define _tmp_138_type 1298
368#define _tmp_139_type 1299
369#define _tmp_140_type 1300
370#define _tmp_141_type 1301
371#define _tmp_142_type 1302
372#define _tmp_143_type 1303
373#define _tmp_144_type 1304
374#define _tmp_145_type 1305
375#define _tmp_146_type 1306
376#define _tmp_147_type 1307
377#define _tmp_148_type 1308
378#define _tmp_149_type 1309
379#define _tmp_150_type 1310
Pablo Galindo4a97b152020-09-02 17:44:19 +0100380#define _tmp_151_type 1311
381#define _tmp_152_type 1312
382#define _loop1_153_type 1313
383#define _loop1_154_type 1314
384#define _tmp_155_type 1315
385#define _tmp_156_type 1316
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100386
387static mod_ty file_rule(Parser *p);
388static mod_ty interactive_rule(Parser *p);
389static mod_ty eval_rule(Parser *p);
390static mod_ty func_type_rule(Parser *p);
391static expr_ty fstring_rule(Parser *p);
392static asdl_seq* type_expressions_rule(Parser *p);
393static asdl_seq* statements_rule(Parser *p);
394static asdl_seq* statement_rule(Parser *p);
395static asdl_seq* statement_newline_rule(Parser *p);
396static asdl_seq* simple_stmt_rule(Parser *p);
397static stmt_ty small_stmt_rule(Parser *p);
398static stmt_ty compound_stmt_rule(Parser *p);
399static stmt_ty assignment_rule(Parser *p);
400static AugOperator* augassign_rule(Parser *p);
401static stmt_ty global_stmt_rule(Parser *p);
402static stmt_ty nonlocal_stmt_rule(Parser *p);
403static stmt_ty yield_stmt_rule(Parser *p);
404static stmt_ty assert_stmt_rule(Parser *p);
405static stmt_ty del_stmt_rule(Parser *p);
406static stmt_ty import_stmt_rule(Parser *p);
407static stmt_ty import_name_rule(Parser *p);
408static stmt_ty import_from_rule(Parser *p);
409static asdl_seq* import_from_targets_rule(Parser *p);
410static asdl_seq* import_from_as_names_rule(Parser *p);
411static alias_ty import_from_as_name_rule(Parser *p);
412static asdl_seq* dotted_as_names_rule(Parser *p);
413static alias_ty dotted_as_name_rule(Parser *p);
414static expr_ty dotted_name_rule(Parser *p);
415static stmt_ty if_stmt_rule(Parser *p);
416static stmt_ty elif_stmt_rule(Parser *p);
417static asdl_seq* else_block_rule(Parser *p);
418static stmt_ty while_stmt_rule(Parser *p);
419static stmt_ty for_stmt_rule(Parser *p);
420static stmt_ty with_stmt_rule(Parser *p);
421static withitem_ty with_item_rule(Parser *p);
422static stmt_ty try_stmt_rule(Parser *p);
423static excepthandler_ty except_block_rule(Parser *p);
424static asdl_seq* finally_block_rule(Parser *p);
425static stmt_ty return_stmt_rule(Parser *p);
426static stmt_ty raise_stmt_rule(Parser *p);
427static stmt_ty function_def_rule(Parser *p);
428static stmt_ty function_def_raw_rule(Parser *p);
429static Token* func_type_comment_rule(Parser *p);
430static arguments_ty params_rule(Parser *p);
431static arguments_ty parameters_rule(Parser *p);
432static asdl_seq* slash_no_default_rule(Parser *p);
433static SlashWithDefault* slash_with_default_rule(Parser *p);
434static StarEtc* star_etc_rule(Parser *p);
435static arg_ty kwds_rule(Parser *p);
436static arg_ty param_no_default_rule(Parser *p);
437static NameDefaultPair* param_with_default_rule(Parser *p);
438static NameDefaultPair* param_maybe_default_rule(Parser *p);
439static arg_ty param_rule(Parser *p);
440static expr_ty annotation_rule(Parser *p);
441static expr_ty default_rule(Parser *p);
442static asdl_seq* decorators_rule(Parser *p);
443static stmt_ty class_def_rule(Parser *p);
444static stmt_ty class_def_raw_rule(Parser *p);
445static asdl_seq* block_rule(Parser *p);
446static asdl_seq* expressions_list_rule(Parser *p);
447static expr_ty star_expressions_rule(Parser *p);
448static expr_ty star_expression_rule(Parser *p);
449static asdl_seq* star_named_expressions_rule(Parser *p);
450static expr_ty star_named_expression_rule(Parser *p);
451static expr_ty named_expression_rule(Parser *p);
452static expr_ty annotated_rhs_rule(Parser *p);
453static expr_ty expressions_rule(Parser *p);
454static expr_ty expression_rule(Parser *p);
455static expr_ty lambdef_rule(Parser *p);
456static arguments_ty lambda_params_rule(Parser *p);
457static arguments_ty lambda_parameters_rule(Parser *p);
458static asdl_seq* lambda_slash_no_default_rule(Parser *p);
459static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
460static StarEtc* lambda_star_etc_rule(Parser *p);
461static arg_ty lambda_kwds_rule(Parser *p);
462static arg_ty lambda_param_no_default_rule(Parser *p);
463static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
464static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
465static arg_ty lambda_param_rule(Parser *p);
466static expr_ty disjunction_rule(Parser *p);
467static expr_ty conjunction_rule(Parser *p);
468static expr_ty inversion_rule(Parser *p);
469static expr_ty comparison_rule(Parser *p);
470static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
471static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
472static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
473static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
474static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
475static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
476static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
477static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
478static CmpopExprPair* in_bitwise_or_rule(Parser *p);
479static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
480static CmpopExprPair* is_bitwise_or_rule(Parser *p);
481static expr_ty bitwise_or_rule(Parser *p);
482static expr_ty bitwise_xor_rule(Parser *p);
483static expr_ty bitwise_and_rule(Parser *p);
484static expr_ty shift_expr_rule(Parser *p);
485static expr_ty sum_rule(Parser *p);
486static expr_ty term_rule(Parser *p);
487static expr_ty factor_rule(Parser *p);
488static expr_ty power_rule(Parser *p);
489static expr_ty await_primary_rule(Parser *p);
490static expr_ty primary_rule(Parser *p);
491static expr_ty slices_rule(Parser *p);
492static expr_ty slice_rule(Parser *p);
493static expr_ty atom_rule(Parser *p);
494static expr_ty strings_rule(Parser *p);
495static expr_ty list_rule(Parser *p);
496static expr_ty listcomp_rule(Parser *p);
497static expr_ty tuple_rule(Parser *p);
498static expr_ty group_rule(Parser *p);
499static expr_ty genexp_rule(Parser *p);
500static expr_ty set_rule(Parser *p);
501static expr_ty setcomp_rule(Parser *p);
502static expr_ty dict_rule(Parser *p);
503static expr_ty dictcomp_rule(Parser *p);
504static asdl_seq* double_starred_kvpairs_rule(Parser *p);
505static KeyValuePair* double_starred_kvpair_rule(Parser *p);
506static KeyValuePair* kvpair_rule(Parser *p);
507static asdl_seq* for_if_clauses_rule(Parser *p);
508static comprehension_ty for_if_clause_rule(Parser *p);
509static expr_ty yield_expr_rule(Parser *p);
510static expr_ty arguments_rule(Parser *p);
511static expr_ty args_rule(Parser *p);
512static asdl_seq* kwargs_rule(Parser *p);
513static expr_ty starred_expression_rule(Parser *p);
514static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
515static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
516static expr_ty star_targets_rule(Parser *p);
517static asdl_seq* star_targets_seq_rule(Parser *p);
518static expr_ty star_target_rule(Parser *p);
519static expr_ty star_atom_rule(Parser *p);
520static expr_ty single_target_rule(Parser *p);
521static expr_ty single_subscript_attribute_target_rule(Parser *p);
522static asdl_seq* del_targets_rule(Parser *p);
523static expr_ty del_target_rule(Parser *p);
524static expr_ty del_t_atom_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100525static asdl_seq* targets_rule(Parser *p);
526static expr_ty target_rule(Parser *p);
527static expr_ty t_primary_rule(Parser *p);
528static void *t_lookahead_rule(Parser *p);
529static expr_ty t_atom_rule(Parser *p);
530static void *incorrect_arguments_rule(Parser *p);
531static void *invalid_kwarg_rule(Parser *p);
532static void *invalid_named_expression_rule(Parser *p);
533static void *invalid_assignment_rule(Parser *p);
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300534static expr_ty invalid_ann_assign_target_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300535static void *invalid_del_stmt_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100536static void *invalid_block_rule(Parser *p);
537static void *invalid_comprehension_rule(Parser *p);
538static void *invalid_dict_comprehension_rule(Parser *p);
539static void *invalid_parameters_rule(Parser *p);
540static void *invalid_lambda_parameters_rule(Parser *p);
541static void *invalid_star_etc_rule(Parser *p);
542static void *invalid_lambda_star_etc_rule(Parser *p);
543static void *invalid_double_type_comments_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300544static void *invalid_with_item_rule(Parser *p);
545static void *invalid_for_target_rule(Parser *p);
546static void *invalid_group_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100547static void *invalid_import_from_targets_rule(Parser *p);
548static asdl_seq *_loop0_1_rule(Parser *p);
549static asdl_seq *_loop0_2_rule(Parser *p);
550static asdl_seq *_loop0_4_rule(Parser *p);
551static asdl_seq *_gather_3_rule(Parser *p);
552static asdl_seq *_loop0_6_rule(Parser *p);
553static asdl_seq *_gather_5_rule(Parser *p);
554static asdl_seq *_loop0_8_rule(Parser *p);
555static asdl_seq *_gather_7_rule(Parser *p);
556static asdl_seq *_loop0_10_rule(Parser *p);
557static asdl_seq *_gather_9_rule(Parser *p);
558static asdl_seq *_loop1_11_rule(Parser *p);
559static asdl_seq *_loop0_13_rule(Parser *p);
560static asdl_seq *_gather_12_rule(Parser *p);
561static void *_tmp_14_rule(Parser *p);
562static void *_tmp_15_rule(Parser *p);
563static void *_tmp_16_rule(Parser *p);
564static void *_tmp_17_rule(Parser *p);
565static void *_tmp_18_rule(Parser *p);
566static void *_tmp_19_rule(Parser *p);
567static void *_tmp_20_rule(Parser *p);
568static void *_tmp_21_rule(Parser *p);
569static asdl_seq *_loop1_22_rule(Parser *p);
570static void *_tmp_23_rule(Parser *p);
571static void *_tmp_24_rule(Parser *p);
572static asdl_seq *_loop0_26_rule(Parser *p);
573static asdl_seq *_gather_25_rule(Parser *p);
574static asdl_seq *_loop0_28_rule(Parser *p);
575static asdl_seq *_gather_27_rule(Parser *p);
576static void *_tmp_29_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300577static void *_tmp_30_rule(Parser *p);
578static asdl_seq *_loop0_31_rule(Parser *p);
579static asdl_seq *_loop1_32_rule(Parser *p);
580static asdl_seq *_loop0_34_rule(Parser *p);
581static asdl_seq *_gather_33_rule(Parser *p);
582static void *_tmp_35_rule(Parser *p);
583static asdl_seq *_loop0_37_rule(Parser *p);
584static asdl_seq *_gather_36_rule(Parser *p);
585static void *_tmp_38_rule(Parser *p);
586static asdl_seq *_loop0_40_rule(Parser *p);
587static asdl_seq *_gather_39_rule(Parser *p);
588static asdl_seq *_loop0_42_rule(Parser *p);
589static asdl_seq *_gather_41_rule(Parser *p);
590static asdl_seq *_loop0_44_rule(Parser *p);
591static asdl_seq *_gather_43_rule(Parser *p);
592static asdl_seq *_loop0_46_rule(Parser *p);
593static asdl_seq *_gather_45_rule(Parser *p);
594static void *_tmp_47_rule(Parser *p);
595static asdl_seq *_loop1_48_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100596static void *_tmp_49_rule(Parser *p);
597static void *_tmp_50_rule(Parser *p);
598static void *_tmp_51_rule(Parser *p);
599static void *_tmp_52_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300600static void *_tmp_53_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100601static asdl_seq *_loop0_54_rule(Parser *p);
602static asdl_seq *_loop0_55_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300603static asdl_seq *_loop0_56_rule(Parser *p);
604static asdl_seq *_loop1_57_rule(Parser *p);
605static asdl_seq *_loop0_58_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100606static asdl_seq *_loop1_59_rule(Parser *p);
607static asdl_seq *_loop1_60_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300608static asdl_seq *_loop1_61_rule(Parser *p);
609static asdl_seq *_loop0_62_rule(Parser *p);
610static asdl_seq *_loop1_63_rule(Parser *p);
611static asdl_seq *_loop0_64_rule(Parser *p);
612static asdl_seq *_loop1_65_rule(Parser *p);
613static asdl_seq *_loop0_66_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100614static asdl_seq *_loop1_67_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300615static asdl_seq *_loop1_68_rule(Parser *p);
616static void *_tmp_69_rule(Parser *p);
617static asdl_seq *_loop0_71_rule(Parser *p);
618static asdl_seq *_gather_70_rule(Parser *p);
619static asdl_seq *_loop1_72_rule(Parser *p);
620static asdl_seq *_loop0_74_rule(Parser *p);
621static asdl_seq *_gather_73_rule(Parser *p);
622static asdl_seq *_loop1_75_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100623static asdl_seq *_loop0_76_rule(Parser *p);
624static asdl_seq *_loop0_77_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300625static asdl_seq *_loop0_78_rule(Parser *p);
626static asdl_seq *_loop1_79_rule(Parser *p);
627static asdl_seq *_loop0_80_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100628static asdl_seq *_loop1_81_rule(Parser *p);
629static asdl_seq *_loop1_82_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300630static asdl_seq *_loop1_83_rule(Parser *p);
631static asdl_seq *_loop0_84_rule(Parser *p);
632static asdl_seq *_loop1_85_rule(Parser *p);
633static asdl_seq *_loop0_86_rule(Parser *p);
634static asdl_seq *_loop1_87_rule(Parser *p);
635static asdl_seq *_loop0_88_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100636static asdl_seq *_loop1_89_rule(Parser *p);
637static asdl_seq *_loop1_90_rule(Parser *p);
638static asdl_seq *_loop1_91_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300639static asdl_seq *_loop1_92_rule(Parser *p);
640static void *_tmp_93_rule(Parser *p);
641static asdl_seq *_loop0_95_rule(Parser *p);
642static asdl_seq *_gather_94_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100643static void *_tmp_96_rule(Parser *p);
644static void *_tmp_97_rule(Parser *p);
645static void *_tmp_98_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300646static void *_tmp_99_rule(Parser *p);
647static asdl_seq *_loop1_100_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100648static void *_tmp_101_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300649static void *_tmp_102_rule(Parser *p);
650static asdl_seq *_loop0_104_rule(Parser *p);
651static asdl_seq *_gather_103_rule(Parser *p);
652static asdl_seq *_loop1_105_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100653static asdl_seq *_loop0_106_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300654static asdl_seq *_loop0_107_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100655static asdl_seq *_loop0_109_rule(Parser *p);
656static asdl_seq *_gather_108_rule(Parser *p);
657static void *_tmp_110_rule(Parser *p);
658static asdl_seq *_loop0_112_rule(Parser *p);
659static asdl_seq *_gather_111_rule(Parser *p);
660static asdl_seq *_loop0_114_rule(Parser *p);
661static asdl_seq *_gather_113_rule(Parser *p);
662static asdl_seq *_loop0_116_rule(Parser *p);
663static asdl_seq *_gather_115_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300664static asdl_seq *_loop0_118_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100665static asdl_seq *_gather_117_rule(Parser *p);
666static asdl_seq *_loop0_119_rule(Parser *p);
667static asdl_seq *_loop0_121_rule(Parser *p);
668static asdl_seq *_gather_120_rule(Parser *p);
669static void *_tmp_122_rule(Parser *p);
670static asdl_seq *_loop0_124_rule(Parser *p);
671static asdl_seq *_gather_123_rule(Parser *p);
672static asdl_seq *_loop0_126_rule(Parser *p);
673static asdl_seq *_gather_125_rule(Parser *p);
674static void *_tmp_127_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300675static asdl_seq *_loop0_128_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100676static asdl_seq *_loop0_129_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100677static asdl_seq *_loop0_130_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100678static void *_tmp_131_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100679static void *_tmp_132_rule(Parser *p);
680static asdl_seq *_loop0_133_rule(Parser *p);
681static void *_tmp_134_rule(Parser *p);
682static asdl_seq *_loop0_135_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100683static void *_tmp_136_rule(Parser *p);
684static void *_tmp_137_rule(Parser *p);
685static void *_tmp_138_rule(Parser *p);
686static void *_tmp_139_rule(Parser *p);
687static void *_tmp_140_rule(Parser *p);
688static void *_tmp_141_rule(Parser *p);
689static void *_tmp_142_rule(Parser *p);
690static void *_tmp_143_rule(Parser *p);
691static void *_tmp_144_rule(Parser *p);
692static void *_tmp_145_rule(Parser *p);
693static void *_tmp_146_rule(Parser *p);
694static void *_tmp_147_rule(Parser *p);
695static void *_tmp_148_rule(Parser *p);
696static void *_tmp_149_rule(Parser *p);
697static void *_tmp_150_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100698static void *_tmp_151_rule(Parser *p);
699static void *_tmp_152_rule(Parser *p);
700static asdl_seq *_loop1_153_rule(Parser *p);
701static asdl_seq *_loop1_154_rule(Parser *p);
702static void *_tmp_155_rule(Parser *p);
703static void *_tmp_156_rule(Parser *p);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000704
705
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100706// file: statements? $
707static mod_ty
708file_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000709{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100710 D(p->level++);
711 if (p->error_indicator) {
712 D(p->level--);
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000713 return NULL;
714 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100715 mod_ty _res = NULL;
716 int _mark = p->mark;
717 { // statements? $
718 if (p->error_indicator) {
719 D(p->level--);
720 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000721 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100722 D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $"));
723 void *a;
724 Token * endmarker_var;
725 if (
726 (a = statements_rule(p), 1) // statements?
727 &&
728 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
729 )
730 {
731 D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $"));
732 _res = _PyPegen_make_module ( p , a );
733 if (_res == NULL && PyErr_Occurred()) {
734 p->error_indicator = 1;
735 D(p->level--);
736 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000737 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100738 goto done;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000739 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100740 p->mark = _mark;
741 D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ',
742 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000743 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100744 _res = NULL;
745 done:
746 D(p->level--);
747 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000748}
749
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100750// interactive: statement_newline
751static mod_ty
752interactive_rule(Parser *p)
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000753{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100754 D(p->level++);
755 if (p->error_indicator) {
756 D(p->level--);
757 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000758 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100759 mod_ty _res = NULL;
760 int _mark = p->mark;
761 { // statement_newline
762 if (p->error_indicator) {
763 D(p->level--);
764 return NULL;
765 }
766 D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline"));
767 asdl_seq* a;
768 if (
769 (a = statement_newline_rule(p)) // statement_newline
770 )
771 {
772 D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline"));
773 _res = Interactive ( a , p -> arena );
774 if (_res == NULL && PyErr_Occurred()) {
775 p->error_indicator = 1;
776 D(p->level--);
777 return NULL;
778 }
779 goto done;
780 }
781 p->mark = _mark;
782 D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ',
783 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline"));
784 }
785 _res = NULL;
786 done:
787 D(p->level--);
788 return _res;
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000789}
790
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100791// eval: expressions NEWLINE* $
792static mod_ty
793eval_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000794{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100795 D(p->level++);
796 if (p->error_indicator) {
797 D(p->level--);
798 return NULL;
799 }
800 mod_ty _res = NULL;
801 int _mark = p->mark;
802 { // expressions NEWLINE* $
803 if (p->error_indicator) {
804 D(p->level--);
805 return NULL;
806 }
807 D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
808 asdl_seq * _loop0_1_var;
809 expr_ty a;
810 Token * endmarker_var;
811 if (
812 (a = expressions_rule(p)) // expressions
813 &&
814 (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE*
815 &&
816 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
817 )
818 {
819 D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
820 _res = Expression ( a , p -> arena );
821 if (_res == NULL && PyErr_Occurred()) {
822 p->error_indicator = 1;
823 D(p->level--);
824 return NULL;
825 }
826 goto done;
827 }
828 p->mark = _mark;
829 D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ',
830 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $"));
831 }
832 _res = NULL;
833 done:
834 D(p->level--);
835 return _res;
836}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000837
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100838// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
839static mod_ty
840func_type_rule(Parser *p)
841{
842 D(p->level++);
843 if (p->error_indicator) {
844 D(p->level--);
845 return NULL;
846 }
847 mod_ty _res = NULL;
848 int _mark = p->mark;
849 { // '(' type_expressions? ')' '->' expression NEWLINE* $
850 if (p->error_indicator) {
851 D(p->level--);
852 return NULL;
853 }
854 D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
855 Token * _literal;
856 Token * _literal_1;
857 Token * _literal_2;
858 asdl_seq * _loop0_2_var;
859 void *a;
860 expr_ty b;
861 Token * endmarker_var;
862 if (
863 (_literal = _PyPegen_expect_token(p, 7)) // token='('
864 &&
865 (a = type_expressions_rule(p), 1) // type_expressions?
866 &&
867 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
868 &&
869 (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->'
870 &&
871 (b = expression_rule(p)) // expression
872 &&
873 (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE*
874 &&
875 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
876 )
877 {
878 D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
879 _res = FunctionType ( a , b , p -> arena );
880 if (_res == NULL && PyErr_Occurred()) {
881 p->error_indicator = 1;
882 D(p->level--);
883 return NULL;
884 }
885 goto done;
886 }
887 p->mark = _mark;
888 D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ',
889 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
890 }
891 _res = NULL;
892 done:
893 D(p->level--);
894 return _res;
895}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000896
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100897// fstring: star_expressions
898static expr_ty
899fstring_rule(Parser *p)
900{
901 D(p->level++);
902 if (p->error_indicator) {
903 D(p->level--);
904 return NULL;
905 }
906 expr_ty _res = NULL;
907 int _mark = p->mark;
908 { // star_expressions
909 if (p->error_indicator) {
910 D(p->level--);
911 return NULL;
912 }
913 D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
914 expr_ty star_expressions_var;
915 if (
916 (star_expressions_var = star_expressions_rule(p)) // star_expressions
917 )
918 {
919 D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
920 _res = star_expressions_var;
921 goto done;
922 }
923 p->mark = _mark;
924 D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ',
925 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
926 }
927 _res = NULL;
928 done:
929 D(p->level--);
930 return _res;
931}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000932
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100933// type_expressions:
934// | ','.expression+ ',' '*' expression ',' '**' expression
935// | ','.expression+ ',' '*' expression
936// | ','.expression+ ',' '**' expression
937// | '*' expression ',' '**' expression
938// | '*' expression
939// | '**' expression
940// | ','.expression+
941static asdl_seq*
942type_expressions_rule(Parser *p)
943{
944 D(p->level++);
945 if (p->error_indicator) {
946 D(p->level--);
947 return NULL;
948 }
949 asdl_seq* _res = NULL;
950 int _mark = p->mark;
951 { // ','.expression+ ',' '*' expression ',' '**' expression
952 if (p->error_indicator) {
953 D(p->level--);
954 return NULL;
955 }
956 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
957 Token * _literal;
958 Token * _literal_1;
959 Token * _literal_2;
960 Token * _literal_3;
961 asdl_seq * a;
962 expr_ty b;
963 expr_ty c;
964 if (
965 (a = _gather_3_rule(p)) // ','.expression+
966 &&
967 (_literal = _PyPegen_expect_token(p, 12)) // token=','
968 &&
969 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
970 &&
971 (b = expression_rule(p)) // expression
972 &&
973 (_literal_2 = _PyPegen_expect_token(p, 12)) // token=','
974 &&
975 (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**'
976 &&
977 (c = expression_rule(p)) // expression
978 )
979 {
980 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
981 _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
982 if (_res == NULL && PyErr_Occurred()) {
983 p->error_indicator = 1;
984 D(p->level--);
985 return NULL;
986 }
987 goto done;
988 }
989 p->mark = _mark;
990 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
991 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
992 }
993 { // ','.expression+ ',' '*' expression
994 if (p->error_indicator) {
995 D(p->level--);
996 return NULL;
997 }
998 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
999 Token * _literal;
1000 Token * _literal_1;
1001 asdl_seq * a;
1002 expr_ty b;
1003 if (
1004 (a = _gather_5_rule(p)) // ','.expression+
1005 &&
1006 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1007 &&
1008 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
1009 &&
1010 (b = expression_rule(p)) // expression
1011 )
1012 {
1013 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
1014 _res = _PyPegen_seq_append_to_end ( p , a , b );
1015 if (_res == NULL && PyErr_Occurred()) {
1016 p->error_indicator = 1;
1017 D(p->level--);
1018 return NULL;
1019 }
1020 goto done;
1021 }
1022 p->mark = _mark;
1023 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1024 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
1025 }
1026 { // ','.expression+ ',' '**' expression
1027 if (p->error_indicator) {
1028 D(p->level--);
1029 return NULL;
1030 }
1031 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
1032 Token * _literal;
1033 Token * _literal_1;
1034 asdl_seq * a;
1035 expr_ty b;
1036 if (
1037 (a = _gather_7_rule(p)) // ','.expression+
1038 &&
1039 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1040 &&
1041 (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**'
1042 &&
1043 (b = expression_rule(p)) // expression
1044 )
1045 {
1046 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
1047 _res = _PyPegen_seq_append_to_end ( p , a , b );
1048 if (_res == NULL && PyErr_Occurred()) {
1049 p->error_indicator = 1;
1050 D(p->level--);
1051 return NULL;
1052 }
1053 goto done;
1054 }
1055 p->mark = _mark;
1056 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1057 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
1058 }
1059 { // '*' expression ',' '**' expression
1060 if (p->error_indicator) {
1061 D(p->level--);
1062 return NULL;
1063 }
1064 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
1065 Token * _literal;
1066 Token * _literal_1;
1067 Token * _literal_2;
1068 expr_ty a;
1069 expr_ty b;
1070 if (
1071 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1072 &&
1073 (a = expression_rule(p)) // expression
1074 &&
1075 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
1076 &&
1077 (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**'
1078 &&
1079 (b = expression_rule(p)) // expression
1080 )
1081 {
1082 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
1083 _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b );
1084 if (_res == NULL && PyErr_Occurred()) {
1085 p->error_indicator = 1;
1086 D(p->level--);
1087 return NULL;
1088 }
1089 goto done;
1090 }
1091 p->mark = _mark;
1092 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1093 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
1094 }
1095 { // '*' expression
1096 if (p->error_indicator) {
1097 D(p->level--);
1098 return NULL;
1099 }
1100 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
1101 Token * _literal;
1102 expr_ty a;
1103 if (
1104 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1105 &&
1106 (a = expression_rule(p)) // expression
1107 )
1108 {
1109 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
1110 _res = _PyPegen_singleton_seq ( p , a );
1111 if (_res == NULL && PyErr_Occurred()) {
1112 p->error_indicator = 1;
1113 D(p->level--);
1114 return NULL;
1115 }
1116 goto done;
1117 }
1118 p->mark = _mark;
1119 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1120 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
1121 }
1122 { // '**' expression
1123 if (p->error_indicator) {
1124 D(p->level--);
1125 return NULL;
1126 }
1127 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
1128 Token * _literal;
1129 expr_ty a;
1130 if (
1131 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
1132 &&
1133 (a = expression_rule(p)) // expression
1134 )
1135 {
1136 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
1137 _res = _PyPegen_singleton_seq ( p , a );
1138 if (_res == NULL && PyErr_Occurred()) {
1139 p->error_indicator = 1;
1140 D(p->level--);
1141 return NULL;
1142 }
1143 goto done;
1144 }
1145 p->mark = _mark;
1146 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1147 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
1148 }
1149 { // ','.expression+
1150 if (p->error_indicator) {
1151 D(p->level--);
1152 return NULL;
1153 }
1154 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
1155 asdl_seq * _gather_9_var;
1156 if (
1157 (_gather_9_var = _gather_9_rule(p)) // ','.expression+
1158 )
1159 {
1160 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
1161 _res = _gather_9_var;
1162 goto done;
1163 }
1164 p->mark = _mark;
1165 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1166 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
1167 }
1168 _res = NULL;
1169 done:
1170 D(p->level--);
1171 return _res;
1172}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001173
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001174// statements: statement+
1175static asdl_seq*
1176statements_rule(Parser *p)
1177{
1178 D(p->level++);
1179 if (p->error_indicator) {
1180 D(p->level--);
1181 return NULL;
1182 }
1183 asdl_seq* _res = NULL;
1184 int _mark = p->mark;
1185 { // statement+
1186 if (p->error_indicator) {
1187 D(p->level--);
1188 return NULL;
1189 }
1190 D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
1191 asdl_seq * a;
1192 if (
1193 (a = _loop1_11_rule(p)) // statement+
1194 )
1195 {
1196 D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
1197 _res = _PyPegen_seq_flatten ( p , a );
1198 if (_res == NULL && PyErr_Occurred()) {
1199 p->error_indicator = 1;
1200 D(p->level--);
1201 return NULL;
1202 }
1203 goto done;
1204 }
1205 p->mark = _mark;
1206 D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ',
1207 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+"));
1208 }
1209 _res = NULL;
1210 done:
1211 D(p->level--);
1212 return _res;
1213}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001214
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001215// statement: compound_stmt | simple_stmt
1216static asdl_seq*
1217statement_rule(Parser *p)
1218{
1219 D(p->level++);
1220 if (p->error_indicator) {
1221 D(p->level--);
1222 return NULL;
1223 }
1224 asdl_seq* _res = NULL;
1225 int _mark = p->mark;
1226 { // compound_stmt
1227 if (p->error_indicator) {
1228 D(p->level--);
1229 return NULL;
1230 }
1231 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
1232 stmt_ty a;
1233 if (
1234 (a = compound_stmt_rule(p)) // compound_stmt
1235 )
1236 {
1237 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
1238 _res = _PyPegen_singleton_seq ( p , a );
1239 if (_res == NULL && PyErr_Occurred()) {
1240 p->error_indicator = 1;
1241 D(p->level--);
1242 return NULL;
1243 }
1244 goto done;
1245 }
1246 p->mark = _mark;
1247 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1248 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt"));
1249 }
1250 { // simple_stmt
1251 if (p->error_indicator) {
1252 D(p->level--);
1253 return NULL;
1254 }
1255 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1256 asdl_seq* simple_stmt_var;
1257 if (
1258 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
1259 )
1260 {
1261 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1262 _res = simple_stmt_var;
1263 goto done;
1264 }
1265 p->mark = _mark;
1266 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1267 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1268 }
1269 _res = NULL;
1270 done:
1271 D(p->level--);
1272 return _res;
1273}
1274
1275// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
1276static asdl_seq*
1277statement_newline_rule(Parser *p)
1278{
1279 D(p->level++);
1280 if (p->error_indicator) {
1281 D(p->level--);
1282 return NULL;
1283 }
1284 asdl_seq* _res = NULL;
1285 int _mark = p->mark;
1286 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1287 p->error_indicator = 1;
1288 D(p->level--);
1289 return NULL;
1290 }
1291 int _start_lineno = p->tokens[_mark]->lineno;
1292 UNUSED(_start_lineno); // Only used by EXTRA macro
1293 int _start_col_offset = p->tokens[_mark]->col_offset;
1294 UNUSED(_start_col_offset); // Only used by EXTRA macro
1295 { // compound_stmt NEWLINE
1296 if (p->error_indicator) {
1297 D(p->level--);
1298 return NULL;
1299 }
1300 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
1301 stmt_ty a;
1302 Token * newline_var;
1303 if (
1304 (a = compound_stmt_rule(p)) // compound_stmt
1305 &&
1306 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1307 )
1308 {
1309 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
1310 _res = _PyPegen_singleton_seq ( p , a );
1311 if (_res == NULL && PyErr_Occurred()) {
1312 p->error_indicator = 1;
1313 D(p->level--);
1314 return NULL;
1315 }
1316 goto done;
1317 }
1318 p->mark = _mark;
1319 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1320 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE"));
1321 }
1322 { // simple_stmt
1323 if (p->error_indicator) {
1324 D(p->level--);
1325 return NULL;
1326 }
1327 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1328 asdl_seq* simple_stmt_var;
1329 if (
1330 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
1331 )
1332 {
1333 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1334 _res = simple_stmt_var;
1335 goto done;
1336 }
1337 p->mark = _mark;
1338 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1339 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1340 }
1341 { // NEWLINE
1342 if (p->error_indicator) {
1343 D(p->level--);
1344 return NULL;
1345 }
1346 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1347 Token * newline_var;
1348 if (
1349 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1350 )
1351 {
1352 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1353 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1354 if (_token == NULL) {
1355 D(p->level--);
1356 return NULL;
1357 }
1358 int _end_lineno = _token->end_lineno;
1359 UNUSED(_end_lineno); // Only used by EXTRA macro
1360 int _end_col_offset = _token->end_col_offset;
1361 UNUSED(_end_col_offset); // Only used by EXTRA macro
1362 _res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
1363 if (_res == NULL && PyErr_Occurred()) {
1364 p->error_indicator = 1;
1365 D(p->level--);
1366 return NULL;
1367 }
1368 goto done;
1369 }
1370 p->mark = _mark;
1371 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
1373 }
1374 { // $
1375 if (p->error_indicator) {
1376 D(p->level--);
1377 return NULL;
1378 }
1379 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$"));
1380 Token * endmarker_var;
1381 if (
1382 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
1383 )
1384 {
1385 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
1386 _res = _PyPegen_interactive_exit ( p );
1387 if (_res == NULL && PyErr_Occurred()) {
1388 p->error_indicator = 1;
1389 D(p->level--);
1390 return NULL;
1391 }
1392 goto done;
1393 }
1394 p->mark = _mark;
1395 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1396 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$"));
1397 }
1398 _res = NULL;
1399 done:
1400 D(p->level--);
1401 return _res;
1402}
1403
1404// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
1405static asdl_seq*
1406simple_stmt_rule(Parser *p)
1407{
1408 D(p->level++);
1409 if (p->error_indicator) {
1410 D(p->level--);
1411 return NULL;
1412 }
1413 asdl_seq* _res = NULL;
1414 int _mark = p->mark;
1415 { // small_stmt !';' NEWLINE
1416 if (p->error_indicator) {
1417 D(p->level--);
1418 return NULL;
1419 }
1420 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
1421 stmt_ty a;
1422 Token * newline_var;
1423 if (
1424 (a = small_stmt_rule(p)) // small_stmt
1425 &&
1426 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';'
1427 &&
1428 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1429 )
1430 {
1431 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
1432 _res = _PyPegen_singleton_seq ( p , a );
1433 if (_res == NULL && PyErr_Occurred()) {
1434 p->error_indicator = 1;
1435 D(p->level--);
1436 return NULL;
1437 }
1438 goto done;
1439 }
1440 p->mark = _mark;
1441 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1442 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt !';' NEWLINE"));
1443 }
1444 { // ';'.small_stmt+ ';'? NEWLINE
1445 if (p->error_indicator) {
1446 D(p->level--);
1447 return NULL;
1448 }
1449 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1450 void *_opt_var;
1451 UNUSED(_opt_var); // Silence compiler warnings
1452 asdl_seq * a;
1453 Token * newline_var;
1454 if (
1455 (a = _gather_12_rule(p)) // ';'.small_stmt+
1456 &&
1457 (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'?
1458 &&
1459 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1460 )
1461 {
1462 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1463 _res = a;
1464 if (_res == NULL && PyErr_Occurred()) {
1465 p->error_indicator = 1;
1466 D(p->level--);
1467 return NULL;
1468 }
1469 goto done;
1470 }
1471 p->mark = _mark;
1472 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1473 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1474 }
1475 _res = NULL;
1476 done:
1477 D(p->level--);
1478 return _res;
1479}
1480
1481// small_stmt:
1482// | assignment
1483// | star_expressions
1484// | &'return' return_stmt
1485// | &('import' | 'from') import_stmt
1486// | &'raise' raise_stmt
1487// | 'pass'
1488// | &'del' del_stmt
1489// | &'yield' yield_stmt
1490// | &'assert' assert_stmt
1491// | 'break'
1492// | 'continue'
1493// | &'global' global_stmt
1494// | &'nonlocal' nonlocal_stmt
1495static stmt_ty
1496small_stmt_rule(Parser *p)
1497{
1498 D(p->level++);
1499 if (p->error_indicator) {
1500 D(p->level--);
1501 return NULL;
1502 }
1503 stmt_ty _res = NULL;
1504 if (_PyPegen_is_memoized(p, small_stmt_type, &_res)) {
1505 D(p->level--);
1506 return _res;
1507 }
1508 int _mark = p->mark;
1509 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1510 p->error_indicator = 1;
1511 D(p->level--);
1512 return NULL;
1513 }
1514 int _start_lineno = p->tokens[_mark]->lineno;
1515 UNUSED(_start_lineno); // Only used by EXTRA macro
1516 int _start_col_offset = p->tokens[_mark]->col_offset;
1517 UNUSED(_start_col_offset); // Only used by EXTRA macro
1518 { // assignment
1519 if (p->error_indicator) {
1520 D(p->level--);
1521 return NULL;
1522 }
1523 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment"));
1524 stmt_ty assignment_var;
1525 if (
1526 (assignment_var = assignment_rule(p)) // assignment
1527 )
1528 {
1529 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment"));
1530 _res = assignment_var;
1531 goto done;
1532 }
1533 p->mark = _mark;
1534 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1535 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment"));
1536 }
1537 { // star_expressions
1538 if (p->error_indicator) {
1539 D(p->level--);
1540 return NULL;
1541 }
1542 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1543 expr_ty e;
1544 if (
1545 (e = star_expressions_rule(p)) // star_expressions
1546 )
1547 {
1548 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1549 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1550 if (_token == NULL) {
1551 D(p->level--);
1552 return NULL;
1553 }
1554 int _end_lineno = _token->end_lineno;
1555 UNUSED(_end_lineno); // Only used by EXTRA macro
1556 int _end_col_offset = _token->end_col_offset;
1557 UNUSED(_end_col_offset); // Only used by EXTRA macro
1558 _res = _Py_Expr ( e , EXTRA );
1559 if (_res == NULL && PyErr_Occurred()) {
1560 p->error_indicator = 1;
1561 D(p->level--);
1562 return NULL;
1563 }
1564 goto done;
1565 }
1566 p->mark = _mark;
1567 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1568 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
1569 }
1570 { // &'return' return_stmt
1571 if (p->error_indicator) {
1572 D(p->level--);
1573 return NULL;
1574 }
1575 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1576 stmt_ty return_stmt_var;
1577 if (
1578 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return'
1579 &&
1580 (return_stmt_var = return_stmt_rule(p)) // return_stmt
1581 )
1582 {
1583 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1584 _res = return_stmt_var;
1585 goto done;
1586 }
1587 p->mark = _mark;
1588 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1589 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt"));
1590 }
1591 { // &('import' | 'from') import_stmt
1592 if (p->error_indicator) {
1593 D(p->level--);
1594 return NULL;
1595 }
1596 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1597 stmt_ty import_stmt_var;
1598 if (
1599 _PyPegen_lookahead(1, _tmp_14_rule, p)
1600 &&
1601 (import_stmt_var = import_stmt_rule(p)) // import_stmt
1602 )
1603 {
1604 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1605 _res = import_stmt_var;
1606 goto done;
1607 }
1608 p->mark = _mark;
1609 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1610 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt"));
1611 }
1612 { // &'raise' raise_stmt
1613 if (p->error_indicator) {
1614 D(p->level--);
1615 return NULL;
1616 }
1617 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1618 stmt_ty raise_stmt_var;
1619 if (
1620 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise'
1621 &&
1622 (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt
1623 )
1624 {
1625 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1626 _res = raise_stmt_var;
1627 goto done;
1628 }
1629 p->mark = _mark;
1630 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1631 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt"));
1632 }
1633 { // 'pass'
1634 if (p->error_indicator) {
1635 D(p->level--);
1636 return NULL;
1637 }
1638 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'"));
1639 Token * _keyword;
1640 if (
1641 (_keyword = _PyPegen_expect_token(p, 502)) // token='pass'
1642 )
1643 {
1644 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'"));
1645 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1646 if (_token == NULL) {
1647 D(p->level--);
1648 return NULL;
1649 }
1650 int _end_lineno = _token->end_lineno;
1651 UNUSED(_end_lineno); // Only used by EXTRA macro
1652 int _end_col_offset = _token->end_col_offset;
1653 UNUSED(_end_col_offset); // Only used by EXTRA macro
1654 _res = _Py_Pass ( EXTRA );
1655 if (_res == NULL && PyErr_Occurred()) {
1656 p->error_indicator = 1;
1657 D(p->level--);
1658 return NULL;
1659 }
1660 goto done;
1661 }
1662 p->mark = _mark;
1663 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1664 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'"));
1665 }
1666 { // &'del' del_stmt
1667 if (p->error_indicator) {
1668 D(p->level--);
1669 return NULL;
1670 }
1671 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1672 stmt_ty del_stmt_var;
1673 if (
1674 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del'
1675 &&
1676 (del_stmt_var = del_stmt_rule(p)) // del_stmt
1677 )
1678 {
1679 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1680 _res = del_stmt_var;
1681 goto done;
1682 }
1683 p->mark = _mark;
1684 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1685 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt"));
1686 }
1687 { // &'yield' yield_stmt
1688 if (p->error_indicator) {
1689 D(p->level--);
1690 return NULL;
1691 }
1692 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1693 stmt_ty yield_stmt_var;
1694 if (
1695 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield'
1696 &&
1697 (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt
1698 )
1699 {
1700 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1701 _res = yield_stmt_var;
1702 goto done;
1703 }
1704 p->mark = _mark;
1705 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1706 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt"));
1707 }
1708 { // &'assert' assert_stmt
1709 if (p->error_indicator) {
1710 D(p->level--);
1711 return NULL;
1712 }
1713 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1714 stmt_ty assert_stmt_var;
1715 if (
1716 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert'
1717 &&
1718 (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt
1719 )
1720 {
1721 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1722 _res = assert_stmt_var;
1723 goto done;
1724 }
1725 p->mark = _mark;
1726 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1727 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt"));
1728 }
1729 { // 'break'
1730 if (p->error_indicator) {
1731 D(p->level--);
1732 return NULL;
1733 }
1734 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'"));
1735 Token * _keyword;
1736 if (
1737 (_keyword = _PyPegen_expect_token(p, 506)) // token='break'
1738 )
1739 {
1740 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'"));
1741 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1742 if (_token == NULL) {
1743 D(p->level--);
1744 return NULL;
1745 }
1746 int _end_lineno = _token->end_lineno;
1747 UNUSED(_end_lineno); // Only used by EXTRA macro
1748 int _end_col_offset = _token->end_col_offset;
1749 UNUSED(_end_col_offset); // Only used by EXTRA macro
1750 _res = _Py_Break ( EXTRA );
1751 if (_res == NULL && PyErr_Occurred()) {
1752 p->error_indicator = 1;
1753 D(p->level--);
1754 return NULL;
1755 }
1756 goto done;
1757 }
1758 p->mark = _mark;
1759 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1760 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'"));
1761 }
1762 { // 'continue'
1763 if (p->error_indicator) {
1764 D(p->level--);
1765 return NULL;
1766 }
1767 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'"));
1768 Token * _keyword;
1769 if (
1770 (_keyword = _PyPegen_expect_token(p, 507)) // token='continue'
1771 )
1772 {
1773 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'"));
1774 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1775 if (_token == NULL) {
1776 D(p->level--);
1777 return NULL;
1778 }
1779 int _end_lineno = _token->end_lineno;
1780 UNUSED(_end_lineno); // Only used by EXTRA macro
1781 int _end_col_offset = _token->end_col_offset;
1782 UNUSED(_end_col_offset); // Only used by EXTRA macro
1783 _res = _Py_Continue ( EXTRA );
1784 if (_res == NULL && PyErr_Occurred()) {
1785 p->error_indicator = 1;
1786 D(p->level--);
1787 return NULL;
1788 }
1789 goto done;
1790 }
1791 p->mark = _mark;
1792 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1793 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'"));
1794 }
1795 { // &'global' global_stmt
1796 if (p->error_indicator) {
1797 D(p->level--);
1798 return NULL;
1799 }
1800 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1801 stmt_ty global_stmt_var;
1802 if (
1803 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global'
1804 &&
1805 (global_stmt_var = global_stmt_rule(p)) // global_stmt
1806 )
1807 {
1808 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1809 _res = global_stmt_var;
1810 goto done;
1811 }
1812 p->mark = _mark;
1813 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1814 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt"));
1815 }
1816 { // &'nonlocal' nonlocal_stmt
1817 if (p->error_indicator) {
1818 D(p->level--);
1819 return NULL;
1820 }
1821 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1822 stmt_ty nonlocal_stmt_var;
1823 if (
1824 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal'
1825 &&
1826 (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt
1827 )
1828 {
1829 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1830 _res = nonlocal_stmt_var;
1831 goto done;
1832 }
1833 p->mark = _mark;
1834 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1835 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1836 }
1837 _res = NULL;
1838 done:
1839 _PyPegen_insert_memo(p, _mark, small_stmt_type, _res);
1840 D(p->level--);
1841 return _res;
1842}
1843
1844// compound_stmt:
1845// | &('def' | '@' | ASYNC) function_def
1846// | &'if' if_stmt
1847// | &('class' | '@') class_def
1848// | &('with' | ASYNC) with_stmt
1849// | &('for' | ASYNC) for_stmt
1850// | &'try' try_stmt
1851// | &'while' while_stmt
1852static stmt_ty
1853compound_stmt_rule(Parser *p)
1854{
1855 D(p->level++);
1856 if (p->error_indicator) {
1857 D(p->level--);
1858 return NULL;
1859 }
1860 stmt_ty _res = NULL;
1861 int _mark = p->mark;
1862 { // &('def' | '@' | ASYNC) function_def
1863 if (p->error_indicator) {
1864 D(p->level--);
1865 return NULL;
1866 }
1867 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1868 stmt_ty function_def_var;
1869 if (
1870 _PyPegen_lookahead(1, _tmp_15_rule, p)
1871 &&
1872 (function_def_var = function_def_rule(p)) // function_def
1873 )
1874 {
1875 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1876 _res = function_def_var;
1877 goto done;
1878 }
1879 p->mark = _mark;
1880 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1881 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1882 }
1883 { // &'if' if_stmt
1884 if (p->error_indicator) {
1885 D(p->level--);
1886 return NULL;
1887 }
1888 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1889 stmt_ty if_stmt_var;
1890 if (
1891 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if'
1892 &&
1893 (if_stmt_var = if_stmt_rule(p)) // if_stmt
1894 )
1895 {
1896 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1897 _res = if_stmt_var;
1898 goto done;
1899 }
1900 p->mark = _mark;
1901 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1902 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt"));
1903 }
1904 { // &('class' | '@') class_def
1905 if (p->error_indicator) {
1906 D(p->level--);
1907 return NULL;
1908 }
1909 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1910 stmt_ty class_def_var;
1911 if (
1912 _PyPegen_lookahead(1, _tmp_16_rule, p)
1913 &&
1914 (class_def_var = class_def_rule(p)) // class_def
1915 )
1916 {
1917 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1918 _res = class_def_var;
1919 goto done;
1920 }
1921 p->mark = _mark;
1922 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1923 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def"));
1924 }
1925 { // &('with' | ASYNC) with_stmt
1926 if (p->error_indicator) {
1927 D(p->level--);
1928 return NULL;
1929 }
1930 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1931 stmt_ty with_stmt_var;
1932 if (
1933 _PyPegen_lookahead(1, _tmp_17_rule, p)
1934 &&
1935 (with_stmt_var = with_stmt_rule(p)) // with_stmt
1936 )
1937 {
1938 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1939 _res = with_stmt_var;
1940 goto done;
1941 }
1942 p->mark = _mark;
1943 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1944 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1945 }
1946 { // &('for' | ASYNC) for_stmt
1947 if (p->error_indicator) {
1948 D(p->level--);
1949 return NULL;
1950 }
1951 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1952 stmt_ty for_stmt_var;
1953 if (
1954 _PyPegen_lookahead(1, _tmp_18_rule, p)
1955 &&
1956 (for_stmt_var = for_stmt_rule(p)) // for_stmt
1957 )
1958 {
1959 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1960 _res = for_stmt_var;
1961 goto done;
1962 }
1963 p->mark = _mark;
1964 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1965 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1966 }
1967 { // &'try' try_stmt
1968 if (p->error_indicator) {
1969 D(p->level--);
1970 return NULL;
1971 }
1972 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1973 stmt_ty try_stmt_var;
1974 if (
1975 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try'
1976 &&
1977 (try_stmt_var = try_stmt_rule(p)) // try_stmt
1978 )
1979 {
1980 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1981 _res = try_stmt_var;
1982 goto done;
1983 }
1984 p->mark = _mark;
1985 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1986 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt"));
1987 }
1988 { // &'while' while_stmt
1989 if (p->error_indicator) {
1990 D(p->level--);
1991 return NULL;
1992 }
1993 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
1994 stmt_ty while_stmt_var;
1995 if (
1996 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while'
1997 &&
1998 (while_stmt_var = while_stmt_rule(p)) // while_stmt
1999 )
2000 {
2001 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
2002 _res = while_stmt_var;
2003 goto done;
2004 }
2005 p->mark = _mark;
2006 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2007 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt"));
2008 }
2009 _res = NULL;
2010 done:
2011 D(p->level--);
2012 return _res;
2013}
2014
2015// assignment:
2016// | NAME ':' expression ['=' annotated_rhs]
2017// | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2018// | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002019// | single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002020// | invalid_assignment
2021static stmt_ty
2022assignment_rule(Parser *p)
2023{
2024 D(p->level++);
2025 if (p->error_indicator) {
2026 D(p->level--);
2027 return NULL;
2028 }
2029 stmt_ty _res = NULL;
2030 int _mark = p->mark;
2031 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2032 p->error_indicator = 1;
2033 D(p->level--);
2034 return NULL;
2035 }
2036 int _start_lineno = p->tokens[_mark]->lineno;
2037 UNUSED(_start_lineno); // Only used by EXTRA macro
2038 int _start_col_offset = p->tokens[_mark]->col_offset;
2039 UNUSED(_start_col_offset); // Only used by EXTRA macro
2040 { // NAME ':' expression ['=' annotated_rhs]
2041 if (p->error_indicator) {
2042 D(p->level--);
2043 return NULL;
2044 }
2045 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2046 Token * _literal;
2047 expr_ty a;
2048 expr_ty b;
2049 void *c;
2050 if (
2051 (a = _PyPegen_name_token(p)) // NAME
2052 &&
2053 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2054 &&
2055 (b = expression_rule(p)) // expression
2056 &&
2057 (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs]
2058 )
2059 {
2060 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2061 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2062 if (_token == NULL) {
2063 D(p->level--);
2064 return NULL;
2065 }
2066 int _end_lineno = _token->end_lineno;
2067 UNUSED(_end_lineno); // Only used by EXTRA macro
2068 int _end_col_offset = _token->end_col_offset;
2069 UNUSED(_end_col_offset); // Only used by EXTRA macro
2070 _res = CHECK_VERSION ( 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
2071 if (_res == NULL && PyErr_Occurred()) {
2072 p->error_indicator = 1;
2073 D(p->level--);
2074 return NULL;
2075 }
2076 goto done;
2077 }
2078 p->mark = _mark;
2079 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2080 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2081 }
2082 { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2083 if (p->error_indicator) {
2084 D(p->level--);
2085 return NULL;
2086 }
2087 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2088 Token * _literal;
2089 void *a;
2090 expr_ty b;
2091 void *c;
2092 if (
2093 (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
2094 &&
2095 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2096 &&
2097 (b = expression_rule(p)) // expression
2098 &&
2099 (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs]
2100 )
2101 {
2102 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2103 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2104 if (_token == NULL) {
2105 D(p->level--);
2106 return NULL;
2107 }
2108 int _end_lineno = _token->end_lineno;
2109 UNUSED(_end_lineno); // Only used by EXTRA macro
2110 int _end_col_offset = _token->end_col_offset;
2111 UNUSED(_end_col_offset); // Only used by EXTRA macro
2112 _res = CHECK_VERSION ( 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) );
2113 if (_res == NULL && PyErr_Occurred()) {
2114 p->error_indicator = 1;
2115 D(p->level--);
2116 return NULL;
2117 }
2118 goto done;
2119 }
2120 p->mark = _mark;
2121 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2122 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2123 }
2124 { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
2125 if (p->error_indicator) {
2126 D(p->level--);
2127 return NULL;
2128 }
2129 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2130 asdl_seq * a;
2131 void *b;
2132 void *tc;
2133 if (
2134 (a = _loop1_22_rule(p)) // ((star_targets '='))+
2135 &&
2136 (b = _tmp_23_rule(p)) // yield_expr | star_expressions
2137 &&
2138 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
2139 &&
2140 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
2141 )
2142 {
2143 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2144 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2145 if (_token == NULL) {
2146 D(p->level--);
2147 return NULL;
2148 }
2149 int _end_lineno = _token->end_lineno;
2150 UNUSED(_end_lineno); // Only used by EXTRA macro
2151 int _end_col_offset = _token->end_col_offset;
2152 UNUSED(_end_col_offset); // Only used by EXTRA macro
2153 _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
2154 if (_res == NULL && PyErr_Occurred()) {
2155 p->error_indicator = 1;
2156 D(p->level--);
2157 return NULL;
2158 }
2159 goto done;
2160 }
2161 p->mark = _mark;
2162 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2163 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2164 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002165 { // single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002166 if (p->error_indicator) {
2167 D(p->level--);
2168 return NULL;
2169 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002170 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2171 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002172 expr_ty a;
2173 AugOperator* b;
2174 void *c;
2175 if (
2176 (a = single_target_rule(p)) // single_target
2177 &&
2178 (b = augassign_rule(p)) // augassign
2179 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002180 (_cut_var = 1)
2181 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002182 (c = _tmp_24_rule(p)) // yield_expr | star_expressions
2183 )
2184 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002185 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002186 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2187 if (_token == NULL) {
2188 D(p->level--);
2189 return NULL;
2190 }
2191 int _end_lineno = _token->end_lineno;
2192 UNUSED(_end_lineno); // Only used by EXTRA macro
2193 int _end_col_offset = _token->end_col_offset;
2194 UNUSED(_end_col_offset); // Only used by EXTRA macro
2195 _res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
2196 if (_res == NULL && PyErr_Occurred()) {
2197 p->error_indicator = 1;
2198 D(p->level--);
2199 return NULL;
2200 }
2201 goto done;
2202 }
2203 p->mark = _mark;
2204 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002205 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2206 if (_cut_var) {
2207 D(p->level--);
2208 return NULL;
2209 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002210 }
2211 { // invalid_assignment
2212 if (p->error_indicator) {
2213 D(p->level--);
2214 return NULL;
2215 }
2216 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2217 void *invalid_assignment_var;
2218 if (
2219 (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment
2220 )
2221 {
2222 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2223 _res = invalid_assignment_var;
2224 goto done;
2225 }
2226 p->mark = _mark;
2227 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2228 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment"));
2229 }
2230 _res = NULL;
2231 done:
2232 D(p->level--);
2233 return _res;
2234}
2235
2236// augassign:
2237// | '+='
2238// | '-='
2239// | '*='
2240// | '@='
2241// | '/='
2242// | '%='
2243// | '&='
2244// | '|='
2245// | '^='
2246// | '<<='
2247// | '>>='
2248// | '**='
2249// | '//='
2250static AugOperator*
2251augassign_rule(Parser *p)
2252{
2253 D(p->level++);
2254 if (p->error_indicator) {
2255 D(p->level--);
2256 return NULL;
2257 }
2258 AugOperator* _res = NULL;
2259 int _mark = p->mark;
2260 { // '+='
2261 if (p->error_indicator) {
2262 D(p->level--);
2263 return NULL;
2264 }
2265 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='"));
2266 Token * _literal;
2267 if (
2268 (_literal = _PyPegen_expect_token(p, 36)) // token='+='
2269 )
2270 {
2271 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
2272 _res = _PyPegen_augoperator ( p , Add );
2273 if (_res == NULL && PyErr_Occurred()) {
2274 p->error_indicator = 1;
2275 D(p->level--);
2276 return NULL;
2277 }
2278 goto done;
2279 }
2280 p->mark = _mark;
2281 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2282 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='"));
2283 }
2284 { // '-='
2285 if (p->error_indicator) {
2286 D(p->level--);
2287 return NULL;
2288 }
2289 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='"));
2290 Token * _literal;
2291 if (
2292 (_literal = _PyPegen_expect_token(p, 37)) // token='-='
2293 )
2294 {
2295 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
2296 _res = _PyPegen_augoperator ( p , Sub );
2297 if (_res == NULL && PyErr_Occurred()) {
2298 p->error_indicator = 1;
2299 D(p->level--);
2300 return NULL;
2301 }
2302 goto done;
2303 }
2304 p->mark = _mark;
2305 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2306 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='"));
2307 }
2308 { // '*='
2309 if (p->error_indicator) {
2310 D(p->level--);
2311 return NULL;
2312 }
2313 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='"));
2314 Token * _literal;
2315 if (
2316 (_literal = _PyPegen_expect_token(p, 38)) // token='*='
2317 )
2318 {
2319 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
2320 _res = _PyPegen_augoperator ( p , Mult );
2321 if (_res == NULL && PyErr_Occurred()) {
2322 p->error_indicator = 1;
2323 D(p->level--);
2324 return NULL;
2325 }
2326 goto done;
2327 }
2328 p->mark = _mark;
2329 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2330 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='"));
2331 }
2332 { // '@='
2333 if (p->error_indicator) {
2334 D(p->level--);
2335 return NULL;
2336 }
2337 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='"));
2338 Token * _literal;
2339 if (
2340 (_literal = _PyPegen_expect_token(p, 50)) // token='@='
2341 )
2342 {
2343 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
2344 _res = CHECK_VERSION ( 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
2345 if (_res == NULL && PyErr_Occurred()) {
2346 p->error_indicator = 1;
2347 D(p->level--);
2348 return NULL;
2349 }
2350 goto done;
2351 }
2352 p->mark = _mark;
2353 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2354 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='"));
2355 }
2356 { // '/='
2357 if (p->error_indicator) {
2358 D(p->level--);
2359 return NULL;
2360 }
2361 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='"));
2362 Token * _literal;
2363 if (
2364 (_literal = _PyPegen_expect_token(p, 39)) // token='/='
2365 )
2366 {
2367 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
2368 _res = _PyPegen_augoperator ( p , Div );
2369 if (_res == NULL && PyErr_Occurred()) {
2370 p->error_indicator = 1;
2371 D(p->level--);
2372 return NULL;
2373 }
2374 goto done;
2375 }
2376 p->mark = _mark;
2377 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2378 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='"));
2379 }
2380 { // '%='
2381 if (p->error_indicator) {
2382 D(p->level--);
2383 return NULL;
2384 }
2385 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='"));
2386 Token * _literal;
2387 if (
2388 (_literal = _PyPegen_expect_token(p, 40)) // token='%='
2389 )
2390 {
2391 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
2392 _res = _PyPegen_augoperator ( p , Mod );
2393 if (_res == NULL && PyErr_Occurred()) {
2394 p->error_indicator = 1;
2395 D(p->level--);
2396 return NULL;
2397 }
2398 goto done;
2399 }
2400 p->mark = _mark;
2401 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2402 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='"));
2403 }
2404 { // '&='
2405 if (p->error_indicator) {
2406 D(p->level--);
2407 return NULL;
2408 }
2409 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='"));
2410 Token * _literal;
2411 if (
2412 (_literal = _PyPegen_expect_token(p, 41)) // token='&='
2413 )
2414 {
2415 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
2416 _res = _PyPegen_augoperator ( p , BitAnd );
2417 if (_res == NULL && PyErr_Occurred()) {
2418 p->error_indicator = 1;
2419 D(p->level--);
2420 return NULL;
2421 }
2422 goto done;
2423 }
2424 p->mark = _mark;
2425 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2426 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='"));
2427 }
2428 { // '|='
2429 if (p->error_indicator) {
2430 D(p->level--);
2431 return NULL;
2432 }
2433 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='"));
2434 Token * _literal;
2435 if (
2436 (_literal = _PyPegen_expect_token(p, 42)) // token='|='
2437 )
2438 {
2439 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
2440 _res = _PyPegen_augoperator ( p , BitOr );
2441 if (_res == NULL && PyErr_Occurred()) {
2442 p->error_indicator = 1;
2443 D(p->level--);
2444 return NULL;
2445 }
2446 goto done;
2447 }
2448 p->mark = _mark;
2449 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2450 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='"));
2451 }
2452 { // '^='
2453 if (p->error_indicator) {
2454 D(p->level--);
2455 return NULL;
2456 }
2457 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='"));
2458 Token * _literal;
2459 if (
2460 (_literal = _PyPegen_expect_token(p, 43)) // token='^='
2461 )
2462 {
2463 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
2464 _res = _PyPegen_augoperator ( p , BitXor );
2465 if (_res == NULL && PyErr_Occurred()) {
2466 p->error_indicator = 1;
2467 D(p->level--);
2468 return NULL;
2469 }
2470 goto done;
2471 }
2472 p->mark = _mark;
2473 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2474 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='"));
2475 }
2476 { // '<<='
2477 if (p->error_indicator) {
2478 D(p->level--);
2479 return NULL;
2480 }
2481 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='"));
2482 Token * _literal;
2483 if (
2484 (_literal = _PyPegen_expect_token(p, 44)) // token='<<='
2485 )
2486 {
2487 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
2488 _res = _PyPegen_augoperator ( p , LShift );
2489 if (_res == NULL && PyErr_Occurred()) {
2490 p->error_indicator = 1;
2491 D(p->level--);
2492 return NULL;
2493 }
2494 goto done;
2495 }
2496 p->mark = _mark;
2497 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='"));
2499 }
2500 { // '>>='
2501 if (p->error_indicator) {
2502 D(p->level--);
2503 return NULL;
2504 }
2505 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='"));
2506 Token * _literal;
2507 if (
2508 (_literal = _PyPegen_expect_token(p, 45)) // token='>>='
2509 )
2510 {
2511 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
2512 _res = _PyPegen_augoperator ( p , RShift );
2513 if (_res == NULL && PyErr_Occurred()) {
2514 p->error_indicator = 1;
2515 D(p->level--);
2516 return NULL;
2517 }
2518 goto done;
2519 }
2520 p->mark = _mark;
2521 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2522 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='"));
2523 }
2524 { // '**='
2525 if (p->error_indicator) {
2526 D(p->level--);
2527 return NULL;
2528 }
2529 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='"));
2530 Token * _literal;
2531 if (
2532 (_literal = _PyPegen_expect_token(p, 46)) // token='**='
2533 )
2534 {
2535 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
2536 _res = _PyPegen_augoperator ( p , Pow );
2537 if (_res == NULL && PyErr_Occurred()) {
2538 p->error_indicator = 1;
2539 D(p->level--);
2540 return NULL;
2541 }
2542 goto done;
2543 }
2544 p->mark = _mark;
2545 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2546 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='"));
2547 }
2548 { // '//='
2549 if (p->error_indicator) {
2550 D(p->level--);
2551 return NULL;
2552 }
2553 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='"));
2554 Token * _literal;
2555 if (
2556 (_literal = _PyPegen_expect_token(p, 48)) // token='//='
2557 )
2558 {
2559 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
2560 _res = _PyPegen_augoperator ( p , FloorDiv );
2561 if (_res == NULL && PyErr_Occurred()) {
2562 p->error_indicator = 1;
2563 D(p->level--);
2564 return NULL;
2565 }
2566 goto done;
2567 }
2568 p->mark = _mark;
2569 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2570 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='"));
2571 }
2572 _res = NULL;
2573 done:
2574 D(p->level--);
2575 return _res;
2576}
2577
2578// global_stmt: 'global' ','.NAME+
2579static stmt_ty
2580global_stmt_rule(Parser *p)
2581{
2582 D(p->level++);
2583 if (p->error_indicator) {
2584 D(p->level--);
2585 return NULL;
2586 }
2587 stmt_ty _res = NULL;
2588 int _mark = p->mark;
2589 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2590 p->error_indicator = 1;
2591 D(p->level--);
2592 return NULL;
2593 }
2594 int _start_lineno = p->tokens[_mark]->lineno;
2595 UNUSED(_start_lineno); // Only used by EXTRA macro
2596 int _start_col_offset = p->tokens[_mark]->col_offset;
2597 UNUSED(_start_col_offset); // Only used by EXTRA macro
2598 { // 'global' ','.NAME+
2599 if (p->error_indicator) {
2600 D(p->level--);
2601 return NULL;
2602 }
2603 D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2604 Token * _keyword;
2605 asdl_seq * a;
2606 if (
2607 (_keyword = _PyPegen_expect_token(p, 508)) // token='global'
2608 &&
2609 (a = _gather_25_rule(p)) // ','.NAME+
2610 )
2611 {
2612 D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2613 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2614 if (_token == NULL) {
2615 D(p->level--);
2616 return NULL;
2617 }
2618 int _end_lineno = _token->end_lineno;
2619 UNUSED(_end_lineno); // Only used by EXTRA macro
2620 int _end_col_offset = _token->end_col_offset;
2621 UNUSED(_end_col_offset); // Only used by EXTRA macro
2622 _res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2623 if (_res == NULL && PyErr_Occurred()) {
2624 p->error_indicator = 1;
2625 D(p->level--);
2626 return NULL;
2627 }
2628 goto done;
2629 }
2630 p->mark = _mark;
2631 D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2632 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
2633 }
2634 _res = NULL;
2635 done:
2636 D(p->level--);
2637 return _res;
2638}
2639
2640// nonlocal_stmt: 'nonlocal' ','.NAME+
2641static stmt_ty
2642nonlocal_stmt_rule(Parser *p)
2643{
2644 D(p->level++);
2645 if (p->error_indicator) {
2646 D(p->level--);
2647 return NULL;
2648 }
2649 stmt_ty _res = NULL;
2650 int _mark = p->mark;
2651 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2652 p->error_indicator = 1;
2653 D(p->level--);
2654 return NULL;
2655 }
2656 int _start_lineno = p->tokens[_mark]->lineno;
2657 UNUSED(_start_lineno); // Only used by EXTRA macro
2658 int _start_col_offset = p->tokens[_mark]->col_offset;
2659 UNUSED(_start_col_offset); // Only used by EXTRA macro
2660 { // 'nonlocal' ','.NAME+
2661 if (p->error_indicator) {
2662 D(p->level--);
2663 return NULL;
2664 }
2665 D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2666 Token * _keyword;
2667 asdl_seq * a;
2668 if (
2669 (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal'
2670 &&
2671 (a = _gather_27_rule(p)) // ','.NAME+
2672 )
2673 {
2674 D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2675 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2676 if (_token == NULL) {
2677 D(p->level--);
2678 return NULL;
2679 }
2680 int _end_lineno = _token->end_lineno;
2681 UNUSED(_end_lineno); // Only used by EXTRA macro
2682 int _end_col_offset = _token->end_col_offset;
2683 UNUSED(_end_col_offset); // Only used by EXTRA macro
2684 _res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2685 if (_res == NULL && PyErr_Occurred()) {
2686 p->error_indicator = 1;
2687 D(p->level--);
2688 return NULL;
2689 }
2690 goto done;
2691 }
2692 p->mark = _mark;
2693 D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2694 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
2695 }
2696 _res = NULL;
2697 done:
2698 D(p->level--);
2699 return _res;
2700}
2701
2702// yield_stmt: yield_expr
2703static stmt_ty
2704yield_stmt_rule(Parser *p)
2705{
2706 D(p->level++);
2707 if (p->error_indicator) {
2708 D(p->level--);
2709 return NULL;
2710 }
2711 stmt_ty _res = NULL;
2712 int _mark = p->mark;
2713 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2714 p->error_indicator = 1;
2715 D(p->level--);
2716 return NULL;
2717 }
2718 int _start_lineno = p->tokens[_mark]->lineno;
2719 UNUSED(_start_lineno); // Only used by EXTRA macro
2720 int _start_col_offset = p->tokens[_mark]->col_offset;
2721 UNUSED(_start_col_offset); // Only used by EXTRA macro
2722 { // yield_expr
2723 if (p->error_indicator) {
2724 D(p->level--);
2725 return NULL;
2726 }
2727 D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2728 expr_ty y;
2729 if (
2730 (y = yield_expr_rule(p)) // yield_expr
2731 )
2732 {
2733 D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2734 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2735 if (_token == NULL) {
2736 D(p->level--);
2737 return NULL;
2738 }
2739 int _end_lineno = _token->end_lineno;
2740 UNUSED(_end_lineno); // Only used by EXTRA macro
2741 int _end_col_offset = _token->end_col_offset;
2742 UNUSED(_end_col_offset); // Only used by EXTRA macro
2743 _res = _Py_Expr ( y , EXTRA );
2744 if (_res == NULL && PyErr_Occurred()) {
2745 p->error_indicator = 1;
2746 D(p->level--);
2747 return NULL;
2748 }
2749 goto done;
2750 }
2751 p->mark = _mark;
2752 D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2753 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
2754 }
2755 _res = NULL;
2756 done:
2757 D(p->level--);
2758 return _res;
2759}
2760
2761// assert_stmt: 'assert' expression [',' expression]
2762static stmt_ty
2763assert_stmt_rule(Parser *p)
2764{
2765 D(p->level++);
2766 if (p->error_indicator) {
2767 D(p->level--);
2768 return NULL;
2769 }
2770 stmt_ty _res = NULL;
2771 int _mark = p->mark;
2772 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2773 p->error_indicator = 1;
2774 D(p->level--);
2775 return NULL;
2776 }
2777 int _start_lineno = p->tokens[_mark]->lineno;
2778 UNUSED(_start_lineno); // Only used by EXTRA macro
2779 int _start_col_offset = p->tokens[_mark]->col_offset;
2780 UNUSED(_start_col_offset); // Only used by EXTRA macro
2781 { // 'assert' expression [',' expression]
2782 if (p->error_indicator) {
2783 D(p->level--);
2784 return NULL;
2785 }
2786 D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2787 Token * _keyword;
2788 expr_ty a;
2789 void *b;
2790 if (
2791 (_keyword = _PyPegen_expect_token(p, 505)) // token='assert'
2792 &&
2793 (a = expression_rule(p)) // expression
2794 &&
2795 (b = _tmp_29_rule(p), 1) // [',' expression]
2796 )
2797 {
2798 D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2799 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2800 if (_token == NULL) {
2801 D(p->level--);
2802 return NULL;
2803 }
2804 int _end_lineno = _token->end_lineno;
2805 UNUSED(_end_lineno); // Only used by EXTRA macro
2806 int _end_col_offset = _token->end_col_offset;
2807 UNUSED(_end_col_offset); // Only used by EXTRA macro
2808 _res = _Py_Assert ( a , b , EXTRA );
2809 if (_res == NULL && PyErr_Occurred()) {
2810 p->error_indicator = 1;
2811 D(p->level--);
2812 return NULL;
2813 }
2814 goto done;
2815 }
2816 p->mark = _mark;
2817 D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2818 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
2819 }
2820 _res = NULL;
2821 done:
2822 D(p->level--);
2823 return _res;
2824}
2825
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002826// del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002827static stmt_ty
2828del_stmt_rule(Parser *p)
2829{
2830 D(p->level++);
2831 if (p->error_indicator) {
2832 D(p->level--);
2833 return NULL;
2834 }
2835 stmt_ty _res = NULL;
2836 int _mark = p->mark;
2837 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2838 p->error_indicator = 1;
2839 D(p->level--);
2840 return NULL;
2841 }
2842 int _start_lineno = p->tokens[_mark]->lineno;
2843 UNUSED(_start_lineno); // Only used by EXTRA macro
2844 int _start_col_offset = p->tokens[_mark]->col_offset;
2845 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002846 { // 'del' del_targets &(';' | NEWLINE)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002847 if (p->error_indicator) {
2848 D(p->level--);
2849 return NULL;
2850 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002851 D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002852 Token * _keyword;
2853 asdl_seq* a;
2854 if (
2855 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
2856 &&
2857 (a = del_targets_rule(p)) // del_targets
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002858 &&
2859 _PyPegen_lookahead(1, _tmp_30_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002860 )
2861 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002862 D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002863 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2864 if (_token == NULL) {
2865 D(p->level--);
2866 return NULL;
2867 }
2868 int _end_lineno = _token->end_lineno;
2869 UNUSED(_end_lineno); // Only used by EXTRA macro
2870 int _end_col_offset = _token->end_col_offset;
2871 UNUSED(_end_col_offset); // Only used by EXTRA macro
2872 _res = _Py_Delete ( a , EXTRA );
2873 if (_res == NULL && PyErr_Occurred()) {
2874 p->error_indicator = 1;
2875 D(p->level--);
2876 return NULL;
2877 }
2878 goto done;
2879 }
2880 p->mark = _mark;
2881 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002882 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
2883 }
2884 { // invalid_del_stmt
2885 if (p->error_indicator) {
2886 D(p->level--);
2887 return NULL;
2888 }
2889 D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2890 void *invalid_del_stmt_var;
2891 if (
2892 (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt
2893 )
2894 {
2895 D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2896 _res = invalid_del_stmt_var;
2897 goto done;
2898 }
2899 p->mark = _mark;
2900 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2901 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002902 }
2903 _res = NULL;
2904 done:
2905 D(p->level--);
2906 return _res;
2907}
2908
2909// import_stmt: import_name | import_from
2910static stmt_ty
2911import_stmt_rule(Parser *p)
2912{
2913 D(p->level++);
2914 if (p->error_indicator) {
2915 D(p->level--);
2916 return NULL;
2917 }
2918 stmt_ty _res = NULL;
2919 int _mark = p->mark;
2920 { // import_name
2921 if (p->error_indicator) {
2922 D(p->level--);
2923 return NULL;
2924 }
2925 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name"));
2926 stmt_ty import_name_var;
2927 if (
2928 (import_name_var = import_name_rule(p)) // import_name
2929 )
2930 {
2931 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name"));
2932 _res = import_name_var;
2933 goto done;
2934 }
2935 p->mark = _mark;
2936 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2937 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name"));
2938 }
2939 { // import_from
2940 if (p->error_indicator) {
2941 D(p->level--);
2942 return NULL;
2943 }
2944 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from"));
2945 stmt_ty import_from_var;
2946 if (
2947 (import_from_var = import_from_rule(p)) // import_from
2948 )
2949 {
2950 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from"));
2951 _res = import_from_var;
2952 goto done;
2953 }
2954 p->mark = _mark;
2955 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2956 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from"));
2957 }
2958 _res = NULL;
2959 done:
2960 D(p->level--);
2961 return _res;
2962}
2963
2964// import_name: 'import' dotted_as_names
2965static stmt_ty
2966import_name_rule(Parser *p)
2967{
2968 D(p->level++);
2969 if (p->error_indicator) {
2970 D(p->level--);
2971 return NULL;
2972 }
2973 stmt_ty _res = NULL;
2974 int _mark = p->mark;
2975 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2976 p->error_indicator = 1;
2977 D(p->level--);
2978 return NULL;
2979 }
2980 int _start_lineno = p->tokens[_mark]->lineno;
2981 UNUSED(_start_lineno); // Only used by EXTRA macro
2982 int _start_col_offset = p->tokens[_mark]->col_offset;
2983 UNUSED(_start_col_offset); // Only used by EXTRA macro
2984 { // 'import' dotted_as_names
2985 if (p->error_indicator) {
2986 D(p->level--);
2987 return NULL;
2988 }
2989 D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
2990 Token * _keyword;
2991 asdl_seq* a;
2992 if (
2993 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
2994 &&
2995 (a = dotted_as_names_rule(p)) // dotted_as_names
2996 )
2997 {
2998 D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
2999 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3000 if (_token == NULL) {
3001 D(p->level--);
3002 return NULL;
3003 }
3004 int _end_lineno = _token->end_lineno;
3005 UNUSED(_end_lineno); // Only used by EXTRA macro
3006 int _end_col_offset = _token->end_col_offset;
3007 UNUSED(_end_col_offset); // Only used by EXTRA macro
3008 _res = _Py_Import ( a , EXTRA );
3009 if (_res == NULL && PyErr_Occurred()) {
3010 p->error_indicator = 1;
3011 D(p->level--);
3012 return NULL;
3013 }
3014 goto done;
3015 }
3016 p->mark = _mark;
3017 D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ',
3018 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names"));
3019 }
3020 _res = NULL;
3021 done:
3022 D(p->level--);
3023 return _res;
3024}
3025
3026// import_from:
3027// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3028// | 'from' (('.' | '...'))+ 'import' import_from_targets
3029static stmt_ty
3030import_from_rule(Parser *p)
3031{
3032 D(p->level++);
3033 if (p->error_indicator) {
3034 D(p->level--);
3035 return NULL;
3036 }
3037 stmt_ty _res = NULL;
3038 int _mark = p->mark;
3039 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3040 p->error_indicator = 1;
3041 D(p->level--);
3042 return NULL;
3043 }
3044 int _start_lineno = p->tokens[_mark]->lineno;
3045 UNUSED(_start_lineno); // Only used by EXTRA macro
3046 int _start_col_offset = p->tokens[_mark]->col_offset;
3047 UNUSED(_start_col_offset); // Only used by EXTRA macro
3048 { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3049 if (p->error_indicator) {
3050 D(p->level--);
3051 return NULL;
3052 }
3053 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3054 Token * _keyword;
3055 Token * _keyword_1;
3056 asdl_seq * a;
3057 expr_ty b;
3058 asdl_seq* c;
3059 if (
3060 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3061 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003062 (a = _loop0_31_rule(p)) // (('.' | '...'))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003063 &&
3064 (b = dotted_name_rule(p)) // dotted_name
3065 &&
3066 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3067 &&
3068 (c = import_from_targets_rule(p)) // import_from_targets
3069 )
3070 {
3071 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3072 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3073 if (_token == NULL) {
3074 D(p->level--);
3075 return NULL;
3076 }
3077 int _end_lineno = _token->end_lineno;
3078 UNUSED(_end_lineno); // Only used by EXTRA macro
3079 int _end_col_offset = _token->end_col_offset;
3080 UNUSED(_end_col_offset); // Only used by EXTRA macro
3081 _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
3082 if (_res == NULL && PyErr_Occurred()) {
3083 p->error_indicator = 1;
3084 D(p->level--);
3085 return NULL;
3086 }
3087 goto done;
3088 }
3089 p->mark = _mark;
3090 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3091 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3092 }
3093 { // 'from' (('.' | '...'))+ 'import' import_from_targets
3094 if (p->error_indicator) {
3095 D(p->level--);
3096 return NULL;
3097 }
3098 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3099 Token * _keyword;
3100 Token * _keyword_1;
3101 asdl_seq * a;
3102 asdl_seq* b;
3103 if (
3104 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3105 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003106 (a = _loop1_32_rule(p)) // (('.' | '...'))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003107 &&
3108 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3109 &&
3110 (b = import_from_targets_rule(p)) // import_from_targets
3111 )
3112 {
3113 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3114 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3115 if (_token == NULL) {
3116 D(p->level--);
3117 return NULL;
3118 }
3119 int _end_lineno = _token->end_lineno;
3120 UNUSED(_end_lineno); // Only used by EXTRA macro
3121 int _end_col_offset = _token->end_col_offset;
3122 UNUSED(_end_col_offset); // Only used by EXTRA macro
3123 _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
3124 if (_res == NULL && PyErr_Occurred()) {
3125 p->error_indicator = 1;
3126 D(p->level--);
3127 return NULL;
3128 }
3129 goto done;
3130 }
3131 p->mark = _mark;
3132 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3133 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3134 }
3135 _res = NULL;
3136 done:
3137 D(p->level--);
3138 return _res;
3139}
3140
3141// import_from_targets:
3142// | '(' import_from_as_names ','? ')'
3143// | import_from_as_names !','
3144// | '*'
3145// | invalid_import_from_targets
3146static asdl_seq*
3147import_from_targets_rule(Parser *p)
3148{
3149 D(p->level++);
3150 if (p->error_indicator) {
3151 D(p->level--);
3152 return NULL;
3153 }
3154 asdl_seq* _res = NULL;
3155 int _mark = p->mark;
3156 { // '(' import_from_as_names ','? ')'
3157 if (p->error_indicator) {
3158 D(p->level--);
3159 return NULL;
3160 }
3161 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3162 Token * _literal;
3163 Token * _literal_1;
3164 void *_opt_var;
3165 UNUSED(_opt_var); // Silence compiler warnings
3166 asdl_seq* a;
3167 if (
3168 (_literal = _PyPegen_expect_token(p, 7)) // token='('
3169 &&
3170 (a = import_from_as_names_rule(p)) // import_from_as_names
3171 &&
3172 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
3173 &&
3174 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
3175 )
3176 {
3177 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3178 _res = a;
3179 if (_res == NULL && PyErr_Occurred()) {
3180 p->error_indicator = 1;
3181 D(p->level--);
3182 return NULL;
3183 }
3184 goto done;
3185 }
3186 p->mark = _mark;
3187 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3188 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3189 }
3190 { // import_from_as_names !','
3191 if (p->error_indicator) {
3192 D(p->level--);
3193 return NULL;
3194 }
3195 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
3196 asdl_seq* import_from_as_names_var;
3197 if (
3198 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
3199 &&
3200 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
3201 )
3202 {
3203 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
3204 _res = import_from_as_names_var;
3205 goto done;
3206 }
3207 p->mark = _mark;
3208 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3209 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','"));
3210 }
3211 { // '*'
3212 if (p->error_indicator) {
3213 D(p->level--);
3214 return NULL;
3215 }
3216 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
3217 Token * _literal;
3218 if (
3219 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
3220 )
3221 {
3222 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
3223 _res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
3224 if (_res == NULL && PyErr_Occurred()) {
3225 p->error_indicator = 1;
3226 D(p->level--);
3227 return NULL;
3228 }
3229 goto done;
3230 }
3231 p->mark = _mark;
3232 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3233 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
3234 }
3235 { // invalid_import_from_targets
3236 if (p->error_indicator) {
3237 D(p->level--);
3238 return NULL;
3239 }
3240 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3241 void *invalid_import_from_targets_var;
3242 if (
3243 (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets
3244 )
3245 {
3246 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3247 _res = invalid_import_from_targets_var;
3248 goto done;
3249 }
3250 p->mark = _mark;
3251 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3252 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets"));
3253 }
3254 _res = NULL;
3255 done:
3256 D(p->level--);
3257 return _res;
3258}
3259
3260// import_from_as_names: ','.import_from_as_name+
3261static asdl_seq*
3262import_from_as_names_rule(Parser *p)
3263{
3264 D(p->level++);
3265 if (p->error_indicator) {
3266 D(p->level--);
3267 return NULL;
3268 }
3269 asdl_seq* _res = NULL;
3270 int _mark = p->mark;
3271 { // ','.import_from_as_name+
3272 if (p->error_indicator) {
3273 D(p->level--);
3274 return NULL;
3275 }
3276 D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
3277 asdl_seq * a;
3278 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003279 (a = _gather_33_rule(p)) // ','.import_from_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003280 )
3281 {
3282 D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
3283 _res = a;
3284 if (_res == NULL && PyErr_Occurred()) {
3285 p->error_indicator = 1;
3286 D(p->level--);
3287 return NULL;
3288 }
3289 goto done;
3290 }
3291 p->mark = _mark;
3292 D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3293 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+"));
3294 }
3295 _res = NULL;
3296 done:
3297 D(p->level--);
3298 return _res;
3299}
3300
3301// import_from_as_name: NAME ['as' NAME]
3302static alias_ty
3303import_from_as_name_rule(Parser *p)
3304{
3305 D(p->level++);
3306 if (p->error_indicator) {
3307 D(p->level--);
3308 return NULL;
3309 }
3310 alias_ty _res = NULL;
3311 int _mark = p->mark;
3312 { // NAME ['as' NAME]
3313 if (p->error_indicator) {
3314 D(p->level--);
3315 return NULL;
3316 }
3317 D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3318 expr_ty a;
3319 void *b;
3320 if (
3321 (a = _PyPegen_name_token(p)) // NAME
3322 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003323 (b = _tmp_35_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003324 )
3325 {
3326 D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3327 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3328 if (_res == NULL && PyErr_Occurred()) {
3329 p->error_indicator = 1;
3330 D(p->level--);
3331 return NULL;
3332 }
3333 goto done;
3334 }
3335 p->mark = _mark;
3336 D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3337 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]"));
3338 }
3339 _res = NULL;
3340 done:
3341 D(p->level--);
3342 return _res;
3343}
3344
3345// dotted_as_names: ','.dotted_as_name+
3346static asdl_seq*
3347dotted_as_names_rule(Parser *p)
3348{
3349 D(p->level++);
3350 if (p->error_indicator) {
3351 D(p->level--);
3352 return NULL;
3353 }
3354 asdl_seq* _res = NULL;
3355 int _mark = p->mark;
3356 { // ','.dotted_as_name+
3357 if (p->error_indicator) {
3358 D(p->level--);
3359 return NULL;
3360 }
3361 D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
3362 asdl_seq * a;
3363 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003364 (a = _gather_36_rule(p)) // ','.dotted_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003365 )
3366 {
3367 D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
3368 _res = a;
3369 if (_res == NULL && PyErr_Occurred()) {
3370 p->error_indicator = 1;
3371 D(p->level--);
3372 return NULL;
3373 }
3374 goto done;
3375 }
3376 p->mark = _mark;
3377 D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3378 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+"));
3379 }
3380 _res = NULL;
3381 done:
3382 D(p->level--);
3383 return _res;
3384}
3385
3386// dotted_as_name: dotted_name ['as' NAME]
3387static alias_ty
3388dotted_as_name_rule(Parser *p)
3389{
3390 D(p->level++);
3391 if (p->error_indicator) {
3392 D(p->level--);
3393 return NULL;
3394 }
3395 alias_ty _res = NULL;
3396 int _mark = p->mark;
3397 { // dotted_name ['as' NAME]
3398 if (p->error_indicator) {
3399 D(p->level--);
3400 return NULL;
3401 }
3402 D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3403 expr_ty a;
3404 void *b;
3405 if (
3406 (a = dotted_name_rule(p)) // dotted_name
3407 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003408 (b = _tmp_38_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003409 )
3410 {
3411 D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3412 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3413 if (_res == NULL && PyErr_Occurred()) {
3414 p->error_indicator = 1;
3415 D(p->level--);
3416 return NULL;
3417 }
3418 goto done;
3419 }
3420 p->mark = _mark;
3421 D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3422 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]"));
3423 }
3424 _res = NULL;
3425 done:
3426 D(p->level--);
3427 return _res;
3428}
3429
3430// Left-recursive
3431// dotted_name: dotted_name '.' NAME | NAME
3432static expr_ty dotted_name_raw(Parser *);
3433static expr_ty
3434dotted_name_rule(Parser *p)
3435{
3436 D(p->level++);
3437 expr_ty _res = NULL;
3438 if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) {
3439 D(p->level--);
3440 return _res;
3441 }
3442 int _mark = p->mark;
3443 int _resmark = p->mark;
3444 while (1) {
3445 int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res);
3446 if (tmpvar_0) {
3447 D(p->level--);
3448 return _res;
3449 }
3450 p->mark = _mark;
3451 void *_raw = dotted_name_raw(p);
3452 if (_raw == NULL || p->mark <= _resmark)
3453 break;
3454 _resmark = p->mark;
3455 _res = _raw;
3456 }
3457 p->mark = _resmark;
3458 D(p->level--);
3459 return _res;
3460}
3461static expr_ty
3462dotted_name_raw(Parser *p)
3463{
3464 D(p->level++);
3465 if (p->error_indicator) {
3466 D(p->level--);
3467 return NULL;
3468 }
3469 expr_ty _res = NULL;
3470 int _mark = p->mark;
3471 { // dotted_name '.' NAME
3472 if (p->error_indicator) {
3473 D(p->level--);
3474 return NULL;
3475 }
3476 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3477 Token * _literal;
3478 expr_ty a;
3479 expr_ty b;
3480 if (
3481 (a = dotted_name_rule(p)) // dotted_name
3482 &&
3483 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
3484 &&
3485 (b = _PyPegen_name_token(p)) // NAME
3486 )
3487 {
3488 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3489 _res = _PyPegen_join_names_with_dot ( p , a , b );
3490 if (_res == NULL && PyErr_Occurred()) {
3491 p->error_indicator = 1;
3492 D(p->level--);
3493 return NULL;
3494 }
3495 goto done;
3496 }
3497 p->mark = _mark;
3498 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3499 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME"));
3500 }
3501 { // NAME
3502 if (p->error_indicator) {
3503 D(p->level--);
3504 return NULL;
3505 }
3506 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
3507 expr_ty name_var;
3508 if (
3509 (name_var = _PyPegen_name_token(p)) // NAME
3510 )
3511 {
3512 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
3513 _res = name_var;
3514 goto done;
3515 }
3516 p->mark = _mark;
3517 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3518 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
3519 }
3520 _res = NULL;
3521 done:
3522 D(p->level--);
3523 return _res;
3524}
3525
3526// if_stmt:
3527// | 'if' named_expression ':' block elif_stmt
3528// | 'if' named_expression ':' block else_block?
3529static stmt_ty
3530if_stmt_rule(Parser *p)
3531{
3532 D(p->level++);
3533 if (p->error_indicator) {
3534 D(p->level--);
3535 return NULL;
3536 }
3537 stmt_ty _res = NULL;
3538 int _mark = p->mark;
3539 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3540 p->error_indicator = 1;
3541 D(p->level--);
3542 return NULL;
3543 }
3544 int _start_lineno = p->tokens[_mark]->lineno;
3545 UNUSED(_start_lineno); // Only used by EXTRA macro
3546 int _start_col_offset = p->tokens[_mark]->col_offset;
3547 UNUSED(_start_col_offset); // Only used by EXTRA macro
3548 { // 'if' named_expression ':' block elif_stmt
3549 if (p->error_indicator) {
3550 D(p->level--);
3551 return NULL;
3552 }
3553 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3554 Token * _keyword;
3555 Token * _literal;
3556 expr_ty a;
3557 asdl_seq* b;
3558 stmt_ty c;
3559 if (
3560 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3561 &&
3562 (a = named_expression_rule(p)) // named_expression
3563 &&
3564 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3565 &&
3566 (b = block_rule(p)) // block
3567 &&
3568 (c = elif_stmt_rule(p)) // elif_stmt
3569 )
3570 {
3571 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3572 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3573 if (_token == NULL) {
3574 D(p->level--);
3575 return NULL;
3576 }
3577 int _end_lineno = _token->end_lineno;
3578 UNUSED(_end_lineno); // Only used by EXTRA macro
3579 int _end_col_offset = _token->end_col_offset;
3580 UNUSED(_end_col_offset); // Only used by EXTRA macro
3581 _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
3582 if (_res == NULL && PyErr_Occurred()) {
3583 p->error_indicator = 1;
3584 D(p->level--);
3585 return NULL;
3586 }
3587 goto done;
3588 }
3589 p->mark = _mark;
3590 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3591 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3592 }
3593 { // 'if' named_expression ':' block else_block?
3594 if (p->error_indicator) {
3595 D(p->level--);
3596 return NULL;
3597 }
3598 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3599 Token * _keyword;
3600 Token * _literal;
3601 expr_ty a;
3602 asdl_seq* b;
3603 void *c;
3604 if (
3605 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3606 &&
3607 (a = named_expression_rule(p)) // named_expression
3608 &&
3609 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3610 &&
3611 (b = block_rule(p)) // block
3612 &&
3613 (c = else_block_rule(p), 1) // else_block?
3614 )
3615 {
3616 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3617 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3618 if (_token == NULL) {
3619 D(p->level--);
3620 return NULL;
3621 }
3622 int _end_lineno = _token->end_lineno;
3623 UNUSED(_end_lineno); // Only used by EXTRA macro
3624 int _end_col_offset = _token->end_col_offset;
3625 UNUSED(_end_col_offset); // Only used by EXTRA macro
3626 _res = _Py_If ( a , b , c , EXTRA );
3627 if (_res == NULL && PyErr_Occurred()) {
3628 p->error_indicator = 1;
3629 D(p->level--);
3630 return NULL;
3631 }
3632 goto done;
3633 }
3634 p->mark = _mark;
3635 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3636 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?"));
3637 }
3638 _res = NULL;
3639 done:
3640 D(p->level--);
3641 return _res;
3642}
3643
3644// elif_stmt:
3645// | 'elif' named_expression ':' block elif_stmt
3646// | 'elif' named_expression ':' block else_block?
3647static stmt_ty
3648elif_stmt_rule(Parser *p)
3649{
3650 D(p->level++);
3651 if (p->error_indicator) {
3652 D(p->level--);
3653 return NULL;
3654 }
3655 stmt_ty _res = NULL;
3656 int _mark = p->mark;
3657 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3658 p->error_indicator = 1;
3659 D(p->level--);
3660 return NULL;
3661 }
3662 int _start_lineno = p->tokens[_mark]->lineno;
3663 UNUSED(_start_lineno); // Only used by EXTRA macro
3664 int _start_col_offset = p->tokens[_mark]->col_offset;
3665 UNUSED(_start_col_offset); // Only used by EXTRA macro
3666 { // 'elif' named_expression ':' block elif_stmt
3667 if (p->error_indicator) {
3668 D(p->level--);
3669 return NULL;
3670 }
3671 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3672 Token * _keyword;
3673 Token * _literal;
3674 expr_ty a;
3675 asdl_seq* b;
3676 stmt_ty c;
3677 if (
3678 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3679 &&
3680 (a = named_expression_rule(p)) // named_expression
3681 &&
3682 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3683 &&
3684 (b = block_rule(p)) // block
3685 &&
3686 (c = elif_stmt_rule(p)) // elif_stmt
3687 )
3688 {
3689 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3690 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3691 if (_token == NULL) {
3692 D(p->level--);
3693 return NULL;
3694 }
3695 int _end_lineno = _token->end_lineno;
3696 UNUSED(_end_lineno); // Only used by EXTRA macro
3697 int _end_col_offset = _token->end_col_offset;
3698 UNUSED(_end_col_offset); // Only used by EXTRA macro
3699 _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
3700 if (_res == NULL && PyErr_Occurred()) {
3701 p->error_indicator = 1;
3702 D(p->level--);
3703 return NULL;
3704 }
3705 goto done;
3706 }
3707 p->mark = _mark;
3708 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3709 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3710 }
3711 { // 'elif' named_expression ':' block else_block?
3712 if (p->error_indicator) {
3713 D(p->level--);
3714 return NULL;
3715 }
3716 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3717 Token * _keyword;
3718 Token * _literal;
3719 expr_ty a;
3720 asdl_seq* b;
3721 void *c;
3722 if (
3723 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3724 &&
3725 (a = named_expression_rule(p)) // named_expression
3726 &&
3727 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3728 &&
3729 (b = block_rule(p)) // block
3730 &&
3731 (c = else_block_rule(p), 1) // else_block?
3732 )
3733 {
3734 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3735 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3736 if (_token == NULL) {
3737 D(p->level--);
3738 return NULL;
3739 }
3740 int _end_lineno = _token->end_lineno;
3741 UNUSED(_end_lineno); // Only used by EXTRA macro
3742 int _end_col_offset = _token->end_col_offset;
3743 UNUSED(_end_col_offset); // Only used by EXTRA macro
3744 _res = _Py_If ( a , b , c , EXTRA );
3745 if (_res == NULL && PyErr_Occurred()) {
3746 p->error_indicator = 1;
3747 D(p->level--);
3748 return NULL;
3749 }
3750 goto done;
3751 }
3752 p->mark = _mark;
3753 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3754 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3755 }
3756 _res = NULL;
3757 done:
3758 D(p->level--);
3759 return _res;
3760}
3761
3762// else_block: 'else' ':' block
3763static asdl_seq*
3764else_block_rule(Parser *p)
3765{
3766 D(p->level++);
3767 if (p->error_indicator) {
3768 D(p->level--);
3769 return NULL;
3770 }
3771 asdl_seq* _res = NULL;
3772 int _mark = p->mark;
3773 { // 'else' ':' block
3774 if (p->error_indicator) {
3775 D(p->level--);
3776 return NULL;
3777 }
3778 D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3779 Token * _keyword;
3780 Token * _literal;
3781 asdl_seq* b;
3782 if (
3783 (_keyword = _PyPegen_expect_token(p, 516)) // token='else'
3784 &&
3785 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3786 &&
3787 (b = block_rule(p)) // block
3788 )
3789 {
3790 D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3791 _res = b;
3792 if (_res == NULL && PyErr_Occurred()) {
3793 p->error_indicator = 1;
3794 D(p->level--);
3795 return NULL;
3796 }
3797 goto done;
3798 }
3799 p->mark = _mark;
3800 D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
3801 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block"));
3802 }
3803 _res = NULL;
3804 done:
3805 D(p->level--);
3806 return _res;
3807}
3808
3809// while_stmt: 'while' named_expression ':' block else_block?
3810static stmt_ty
3811while_stmt_rule(Parser *p)
3812{
3813 D(p->level++);
3814 if (p->error_indicator) {
3815 D(p->level--);
3816 return NULL;
3817 }
3818 stmt_ty _res = NULL;
3819 int _mark = p->mark;
3820 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3821 p->error_indicator = 1;
3822 D(p->level--);
3823 return NULL;
3824 }
3825 int _start_lineno = p->tokens[_mark]->lineno;
3826 UNUSED(_start_lineno); // Only used by EXTRA macro
3827 int _start_col_offset = p->tokens[_mark]->col_offset;
3828 UNUSED(_start_col_offset); // Only used by EXTRA macro
3829 { // 'while' named_expression ':' block else_block?
3830 if (p->error_indicator) {
3831 D(p->level--);
3832 return NULL;
3833 }
3834 D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3835 Token * _keyword;
3836 Token * _literal;
3837 expr_ty a;
3838 asdl_seq* b;
3839 void *c;
3840 if (
3841 (_keyword = _PyPegen_expect_token(p, 512)) // token='while'
3842 &&
3843 (a = named_expression_rule(p)) // named_expression
3844 &&
3845 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3846 &&
3847 (b = block_rule(p)) // block
3848 &&
3849 (c = else_block_rule(p), 1) // else_block?
3850 )
3851 {
3852 D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3853 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3854 if (_token == NULL) {
3855 D(p->level--);
3856 return NULL;
3857 }
3858 int _end_lineno = _token->end_lineno;
3859 UNUSED(_end_lineno); // Only used by EXTRA macro
3860 int _end_col_offset = _token->end_col_offset;
3861 UNUSED(_end_col_offset); // Only used by EXTRA macro
3862 _res = _Py_While ( a , b , c , EXTRA );
3863 if (_res == NULL && PyErr_Occurred()) {
3864 p->error_indicator = 1;
3865 D(p->level--);
3866 return NULL;
3867 }
3868 goto done;
3869 }
3870 p->mark = _mark;
3871 D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3872 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?"));
3873 }
3874 _res = NULL;
3875 done:
3876 D(p->level--);
3877 return _res;
3878}
3879
3880// for_stmt:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003881// | 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3882// | ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3883// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003884static stmt_ty
3885for_stmt_rule(Parser *p)
3886{
3887 D(p->level++);
3888 if (p->error_indicator) {
3889 D(p->level--);
3890 return NULL;
3891 }
3892 stmt_ty _res = NULL;
3893 int _mark = p->mark;
3894 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3895 p->error_indicator = 1;
3896 D(p->level--);
3897 return NULL;
3898 }
3899 int _start_lineno = p->tokens[_mark]->lineno;
3900 UNUSED(_start_lineno); // Only used by EXTRA macro
3901 int _start_col_offset = p->tokens[_mark]->col_offset;
3902 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003903 { // 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003904 if (p->error_indicator) {
3905 D(p->level--);
3906 return NULL;
3907 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003908 D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
3909 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003910 Token * _keyword;
3911 Token * _keyword_1;
3912 Token * _literal;
3913 asdl_seq* b;
3914 void *el;
3915 expr_ty ex;
3916 expr_ty t;
3917 void *tc;
3918 if (
3919 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3920 &&
3921 (t = star_targets_rule(p)) // star_targets
3922 &&
3923 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3924 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003925 (_cut_var = 1)
3926 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003927 (ex = star_expressions_rule(p)) // star_expressions
3928 &&
3929 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3930 &&
3931 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
3932 &&
3933 (b = block_rule(p)) // block
3934 &&
3935 (el = else_block_rule(p), 1) // else_block?
3936 )
3937 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003938 D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003939 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3940 if (_token == NULL) {
3941 D(p->level--);
3942 return NULL;
3943 }
3944 int _end_lineno = _token->end_lineno;
3945 UNUSED(_end_lineno); // Only used by EXTRA macro
3946 int _end_col_offset = _token->end_col_offset;
3947 UNUSED(_end_col_offset); // Only used by EXTRA macro
3948 _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
3949 if (_res == NULL && PyErr_Occurred()) {
3950 p->error_indicator = 1;
3951 D(p->level--);
3952 return NULL;
3953 }
3954 goto done;
3955 }
3956 p->mark = _mark;
3957 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003958 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
3959 if (_cut_var) {
3960 D(p->level--);
3961 return NULL;
3962 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003963 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003964 { // ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003965 if (p->error_indicator) {
3966 D(p->level--);
3967 return NULL;
3968 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003969 D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
3970 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003971 Token * _keyword;
3972 Token * _keyword_1;
3973 Token * _literal;
3974 Token * async_var;
3975 asdl_seq* b;
3976 void *el;
3977 expr_ty ex;
3978 expr_ty t;
3979 void *tc;
3980 if (
3981 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
3982 &&
3983 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3984 &&
3985 (t = star_targets_rule(p)) // star_targets
3986 &&
3987 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3988 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003989 (_cut_var = 1)
3990 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003991 (ex = star_expressions_rule(p)) // star_expressions
3992 &&
3993 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3994 &&
3995 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
3996 &&
3997 (b = block_rule(p)) // block
3998 &&
3999 (el = else_block_rule(p), 1) // else_block?
4000 )
4001 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004002 D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004003 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4004 if (_token == NULL) {
4005 D(p->level--);
4006 return NULL;
4007 }
4008 int _end_lineno = _token->end_lineno;
4009 UNUSED(_end_lineno); // Only used by EXTRA macro
4010 int _end_col_offset = _token->end_col_offset;
4011 UNUSED(_end_col_offset); // Only used by EXTRA macro
4012 _res = CHECK_VERSION ( 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
4013 if (_res == NULL && PyErr_Occurred()) {
4014 p->error_indicator = 1;
4015 D(p->level--);
4016 return NULL;
4017 }
4018 goto done;
4019 }
4020 p->mark = _mark;
4021 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004022 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
4023 if (_cut_var) {
4024 D(p->level--);
4025 return NULL;
4026 }
4027 }
4028 { // invalid_for_target
4029 if (p->error_indicator) {
4030 D(p->level--);
4031 return NULL;
4032 }
4033 D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4034 void *invalid_for_target_var;
4035 if (
4036 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
4037 )
4038 {
4039 D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4040 _res = invalid_for_target_var;
4041 goto done;
4042 }
4043 p->mark = _mark;
4044 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4045 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004046 }
4047 _res = NULL;
4048 done:
4049 D(p->level--);
4050 return _res;
4051}
4052
4053// with_stmt:
4054// | 'with' '(' ','.with_item+ ','? ')' ':' block
4055// | 'with' ','.with_item+ ':' TYPE_COMMENT? block
4056// | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4057// | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4058static stmt_ty
4059with_stmt_rule(Parser *p)
4060{
4061 D(p->level++);
4062 if (p->error_indicator) {
4063 D(p->level--);
4064 return NULL;
4065 }
4066 stmt_ty _res = NULL;
4067 int _mark = p->mark;
4068 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4069 p->error_indicator = 1;
4070 D(p->level--);
4071 return NULL;
4072 }
4073 int _start_lineno = p->tokens[_mark]->lineno;
4074 UNUSED(_start_lineno); // Only used by EXTRA macro
4075 int _start_col_offset = p->tokens[_mark]->col_offset;
4076 UNUSED(_start_col_offset); // Only used by EXTRA macro
4077 { // 'with' '(' ','.with_item+ ','? ')' ':' block
4078 if (p->error_indicator) {
4079 D(p->level--);
4080 return NULL;
4081 }
4082 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4083 Token * _keyword;
4084 Token * _literal;
4085 Token * _literal_1;
4086 Token * _literal_2;
4087 void *_opt_var;
4088 UNUSED(_opt_var); // Silence compiler warnings
4089 asdl_seq * a;
4090 asdl_seq* b;
4091 if (
4092 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4093 &&
4094 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4095 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004096 (a = _gather_39_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004097 &&
4098 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4099 &&
4100 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4101 &&
4102 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4103 &&
4104 (b = block_rule(p)) // block
4105 )
4106 {
4107 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4108 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4109 if (_token == NULL) {
4110 D(p->level--);
4111 return NULL;
4112 }
4113 int _end_lineno = _token->end_lineno;
4114 UNUSED(_end_lineno); // Only used by EXTRA macro
4115 int _end_col_offset = _token->end_col_offset;
4116 UNUSED(_end_col_offset); // Only used by EXTRA macro
4117 _res = _Py_With ( a , b , NULL , EXTRA );
4118 if (_res == NULL && PyErr_Occurred()) {
4119 p->error_indicator = 1;
4120 D(p->level--);
4121 return NULL;
4122 }
4123 goto done;
4124 }
4125 p->mark = _mark;
4126 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4127 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4128 }
4129 { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
4130 if (p->error_indicator) {
4131 D(p->level--);
4132 return NULL;
4133 }
4134 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4135 Token * _keyword;
4136 Token * _literal;
4137 asdl_seq * a;
4138 asdl_seq* b;
4139 void *tc;
4140 if (
4141 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4142 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004143 (a = _gather_41_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004144 &&
4145 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4146 &&
4147 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4148 &&
4149 (b = block_rule(p)) // block
4150 )
4151 {
4152 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4153 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4154 if (_token == NULL) {
4155 D(p->level--);
4156 return NULL;
4157 }
4158 int _end_lineno = _token->end_lineno;
4159 UNUSED(_end_lineno); // Only used by EXTRA macro
4160 int _end_col_offset = _token->end_col_offset;
4161 UNUSED(_end_col_offset); // Only used by EXTRA macro
4162 _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4163 if (_res == NULL && PyErr_Occurred()) {
4164 p->error_indicator = 1;
4165 D(p->level--);
4166 return NULL;
4167 }
4168 goto done;
4169 }
4170 p->mark = _mark;
4171 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4172 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4173 }
4174 { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4175 if (p->error_indicator) {
4176 D(p->level--);
4177 return NULL;
4178 }
4179 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4180 Token * _keyword;
4181 Token * _literal;
4182 Token * _literal_1;
4183 Token * _literal_2;
4184 void *_opt_var;
4185 UNUSED(_opt_var); // Silence compiler warnings
4186 asdl_seq * a;
4187 Token * async_var;
4188 asdl_seq* b;
4189 if (
4190 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4191 &&
4192 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4193 &&
4194 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4195 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004196 (a = _gather_43_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004197 &&
4198 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4199 &&
4200 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4201 &&
4202 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4203 &&
4204 (b = block_rule(p)) // block
4205 )
4206 {
4207 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4208 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4209 if (_token == NULL) {
4210 D(p->level--);
4211 return NULL;
4212 }
4213 int _end_lineno = _token->end_lineno;
4214 UNUSED(_end_lineno); // Only used by EXTRA macro
4215 int _end_col_offset = _token->end_col_offset;
4216 UNUSED(_end_col_offset); // Only used by EXTRA macro
4217 _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) );
4218 if (_res == NULL && PyErr_Occurred()) {
4219 p->error_indicator = 1;
4220 D(p->level--);
4221 return NULL;
4222 }
4223 goto done;
4224 }
4225 p->mark = _mark;
4226 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4227 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4228 }
4229 { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4230 if (p->error_indicator) {
4231 D(p->level--);
4232 return NULL;
4233 }
4234 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4235 Token * _keyword;
4236 Token * _literal;
4237 asdl_seq * a;
4238 Token * async_var;
4239 asdl_seq* b;
4240 void *tc;
4241 if (
4242 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4243 &&
4244 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4245 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004246 (a = _gather_45_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004247 &&
4248 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4249 &&
4250 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4251 &&
4252 (b = block_rule(p)) // block
4253 )
4254 {
4255 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4256 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4257 if (_token == NULL) {
4258 D(p->level--);
4259 return NULL;
4260 }
4261 int _end_lineno = _token->end_lineno;
4262 UNUSED(_end_lineno); // Only used by EXTRA macro
4263 int _end_col_offset = _token->end_col_offset;
4264 UNUSED(_end_col_offset); // Only used by EXTRA macro
4265 _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
4266 if (_res == NULL && PyErr_Occurred()) {
4267 p->error_indicator = 1;
4268 D(p->level--);
4269 return NULL;
4270 }
4271 goto done;
4272 }
4273 p->mark = _mark;
4274 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4275 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4276 }
4277 _res = NULL;
4278 done:
4279 D(p->level--);
4280 return _res;
4281}
4282
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004283// with_item: expression 'as' target &(',' | ')' | ':') | invalid_with_item | expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004284static withitem_ty
4285with_item_rule(Parser *p)
4286{
4287 D(p->level++);
4288 if (p->error_indicator) {
4289 D(p->level--);
4290 return NULL;
4291 }
4292 withitem_ty _res = NULL;
4293 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004294 { // expression 'as' target &(',' | ')' | ':')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004295 if (p->error_indicator) {
4296 D(p->level--);
4297 return NULL;
4298 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004299 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4300 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004301 expr_ty e;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004302 expr_ty t;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004303 if (
4304 (e = expression_rule(p)) // expression
4305 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004306 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
4307 &&
4308 (t = target_rule(p)) // target
4309 &&
4310 _PyPegen_lookahead(1, _tmp_47_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004311 )
4312 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004313 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4314 _res = _Py_withitem ( e , t , p -> arena );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004315 if (_res == NULL && PyErr_Occurred()) {
4316 p->error_indicator = 1;
4317 D(p->level--);
4318 return NULL;
4319 }
4320 goto done;
4321 }
4322 p->mark = _mark;
4323 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004324 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4325 }
4326 { // invalid_with_item
4327 if (p->error_indicator) {
4328 D(p->level--);
4329 return NULL;
4330 }
4331 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4332 void *invalid_with_item_var;
4333 if (
4334 (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item
4335 )
4336 {
4337 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4338 _res = invalid_with_item_var;
4339 goto done;
4340 }
4341 p->mark = _mark;
4342 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4343 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
4344 }
4345 { // expression
4346 if (p->error_indicator) {
4347 D(p->level--);
4348 return NULL;
4349 }
4350 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
4351 expr_ty e;
4352 if (
4353 (e = expression_rule(p)) // expression
4354 )
4355 {
4356 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
4357 _res = _Py_withitem ( e , NULL , p -> arena );
4358 if (_res == NULL && PyErr_Occurred()) {
4359 p->error_indicator = 1;
4360 D(p->level--);
4361 return NULL;
4362 }
4363 goto done;
4364 }
4365 p->mark = _mark;
4366 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4367 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004368 }
4369 _res = NULL;
4370 done:
4371 D(p->level--);
4372 return _res;
4373}
4374
4375// try_stmt:
4376// | 'try' ':' block finally_block
4377// | 'try' ':' block except_block+ else_block? finally_block?
4378static stmt_ty
4379try_stmt_rule(Parser *p)
4380{
4381 D(p->level++);
4382 if (p->error_indicator) {
4383 D(p->level--);
4384 return NULL;
4385 }
4386 stmt_ty _res = NULL;
4387 int _mark = p->mark;
4388 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4389 p->error_indicator = 1;
4390 D(p->level--);
4391 return NULL;
4392 }
4393 int _start_lineno = p->tokens[_mark]->lineno;
4394 UNUSED(_start_lineno); // Only used by EXTRA macro
4395 int _start_col_offset = p->tokens[_mark]->col_offset;
4396 UNUSED(_start_col_offset); // Only used by EXTRA macro
4397 { // 'try' ':' block finally_block
4398 if (p->error_indicator) {
4399 D(p->level--);
4400 return NULL;
4401 }
4402 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4403 Token * _keyword;
4404 Token * _literal;
4405 asdl_seq* b;
4406 asdl_seq* f;
4407 if (
4408 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4409 &&
4410 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4411 &&
4412 (b = block_rule(p)) // block
4413 &&
4414 (f = finally_block_rule(p)) // finally_block
4415 )
4416 {
4417 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4418 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4419 if (_token == NULL) {
4420 D(p->level--);
4421 return NULL;
4422 }
4423 int _end_lineno = _token->end_lineno;
4424 UNUSED(_end_lineno); // Only used by EXTRA macro
4425 int _end_col_offset = _token->end_col_offset;
4426 UNUSED(_end_col_offset); // Only used by EXTRA macro
4427 _res = _Py_Try ( b , NULL , NULL , f , EXTRA );
4428 if (_res == NULL && PyErr_Occurred()) {
4429 p->error_indicator = 1;
4430 D(p->level--);
4431 return NULL;
4432 }
4433 goto done;
4434 }
4435 p->mark = _mark;
4436 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4437 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block finally_block"));
4438 }
4439 { // 'try' ':' block except_block+ else_block? finally_block?
4440 if (p->error_indicator) {
4441 D(p->level--);
4442 return NULL;
4443 }
4444 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4445 Token * _keyword;
4446 Token * _literal;
4447 asdl_seq* b;
4448 void *el;
4449 asdl_seq * ex;
4450 void *f;
4451 if (
4452 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4453 &&
4454 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4455 &&
4456 (b = block_rule(p)) // block
4457 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004458 (ex = _loop1_48_rule(p)) // except_block+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004459 &&
4460 (el = else_block_rule(p), 1) // else_block?
4461 &&
4462 (f = finally_block_rule(p), 1) // finally_block?
4463 )
4464 {
4465 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4466 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4467 if (_token == NULL) {
4468 D(p->level--);
4469 return NULL;
4470 }
4471 int _end_lineno = _token->end_lineno;
4472 UNUSED(_end_lineno); // Only used by EXTRA macro
4473 int _end_col_offset = _token->end_col_offset;
4474 UNUSED(_end_col_offset); // Only used by EXTRA macro
4475 _res = _Py_Try ( b , ex , el , f , EXTRA );
4476 if (_res == NULL && PyErr_Occurred()) {
4477 p->error_indicator = 1;
4478 D(p->level--);
4479 return NULL;
4480 }
4481 goto done;
4482 }
4483 p->mark = _mark;
4484 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4485 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4486 }
4487 _res = NULL;
4488 done:
4489 D(p->level--);
4490 return _res;
4491}
4492
4493// except_block: 'except' expression ['as' NAME] ':' block | 'except' ':' block
4494static excepthandler_ty
4495except_block_rule(Parser *p)
4496{
4497 D(p->level++);
4498 if (p->error_indicator) {
4499 D(p->level--);
4500 return NULL;
4501 }
4502 excepthandler_ty _res = NULL;
4503 int _mark = p->mark;
4504 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4505 p->error_indicator = 1;
4506 D(p->level--);
4507 return NULL;
4508 }
4509 int _start_lineno = p->tokens[_mark]->lineno;
4510 UNUSED(_start_lineno); // Only used by EXTRA macro
4511 int _start_col_offset = p->tokens[_mark]->col_offset;
4512 UNUSED(_start_col_offset); // Only used by EXTRA macro
4513 { // 'except' expression ['as' NAME] ':' block
4514 if (p->error_indicator) {
4515 D(p->level--);
4516 return NULL;
4517 }
4518 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4519 Token * _keyword;
4520 Token * _literal;
4521 asdl_seq* b;
4522 expr_ty e;
4523 void *t;
4524 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004525 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004526 &&
4527 (e = expression_rule(p)) // expression
4528 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004529 (t = _tmp_49_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004530 &&
4531 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4532 &&
4533 (b = block_rule(p)) // block
4534 )
4535 {
4536 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4537 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4538 if (_token == NULL) {
4539 D(p->level--);
4540 return NULL;
4541 }
4542 int _end_lineno = _token->end_lineno;
4543 UNUSED(_end_lineno); // Only used by EXTRA macro
4544 int _end_col_offset = _token->end_col_offset;
4545 UNUSED(_end_col_offset); // Only used by EXTRA macro
4546 _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
4547 if (_res == NULL && PyErr_Occurred()) {
4548 p->error_indicator = 1;
4549 D(p->level--);
4550 return NULL;
4551 }
4552 goto done;
4553 }
4554 p->mark = _mark;
4555 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4556 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4557 }
4558 { // 'except' ':' block
4559 if (p->error_indicator) {
4560 D(p->level--);
4561 return NULL;
4562 }
4563 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4564 Token * _keyword;
4565 Token * _literal;
4566 asdl_seq* b;
4567 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004568 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004569 &&
4570 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4571 &&
4572 (b = block_rule(p)) // block
4573 )
4574 {
4575 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4576 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4577 if (_token == NULL) {
4578 D(p->level--);
4579 return NULL;
4580 }
4581 int _end_lineno = _token->end_lineno;
4582 UNUSED(_end_lineno); // Only used by EXTRA macro
4583 int _end_col_offset = _token->end_col_offset;
4584 UNUSED(_end_col_offset); // Only used by EXTRA macro
4585 _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
4586 if (_res == NULL && PyErr_Occurred()) {
4587 p->error_indicator = 1;
4588 D(p->level--);
4589 return NULL;
4590 }
4591 goto done;
4592 }
4593 p->mark = _mark;
4594 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4595 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
4596 }
4597 _res = NULL;
4598 done:
4599 D(p->level--);
4600 return _res;
4601}
4602
4603// finally_block: 'finally' ':' block
4604static asdl_seq*
4605finally_block_rule(Parser *p)
4606{
4607 D(p->level++);
4608 if (p->error_indicator) {
4609 D(p->level--);
4610 return NULL;
4611 }
4612 asdl_seq* _res = NULL;
4613 int _mark = p->mark;
4614 { // 'finally' ':' block
4615 if (p->error_indicator) {
4616 D(p->level--);
4617 return NULL;
4618 }
4619 D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4620 Token * _keyword;
4621 Token * _literal;
4622 asdl_seq* a;
4623 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004624 (_keyword = _PyPegen_expect_token(p, 522)) // token='finally'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004625 &&
4626 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4627 &&
4628 (a = block_rule(p)) // block
4629 )
4630 {
4631 D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4632 _res = a;
4633 if (_res == NULL && PyErr_Occurred()) {
4634 p->error_indicator = 1;
4635 D(p->level--);
4636 return NULL;
4637 }
4638 goto done;
4639 }
4640 p->mark = _mark;
4641 D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
4642 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block"));
4643 }
4644 _res = NULL;
4645 done:
4646 D(p->level--);
4647 return _res;
4648}
4649
4650// return_stmt: 'return' star_expressions?
4651static stmt_ty
4652return_stmt_rule(Parser *p)
4653{
4654 D(p->level++);
4655 if (p->error_indicator) {
4656 D(p->level--);
4657 return NULL;
4658 }
4659 stmt_ty _res = NULL;
4660 int _mark = p->mark;
4661 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4662 p->error_indicator = 1;
4663 D(p->level--);
4664 return NULL;
4665 }
4666 int _start_lineno = p->tokens[_mark]->lineno;
4667 UNUSED(_start_lineno); // Only used by EXTRA macro
4668 int _start_col_offset = p->tokens[_mark]->col_offset;
4669 UNUSED(_start_col_offset); // Only used by EXTRA macro
4670 { // 'return' star_expressions?
4671 if (p->error_indicator) {
4672 D(p->level--);
4673 return NULL;
4674 }
4675 D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4676 Token * _keyword;
4677 void *a;
4678 if (
4679 (_keyword = _PyPegen_expect_token(p, 500)) // token='return'
4680 &&
4681 (a = star_expressions_rule(p), 1) // star_expressions?
4682 )
4683 {
4684 D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4685 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4686 if (_token == NULL) {
4687 D(p->level--);
4688 return NULL;
4689 }
4690 int _end_lineno = _token->end_lineno;
4691 UNUSED(_end_lineno); // Only used by EXTRA macro
4692 int _end_col_offset = _token->end_col_offset;
4693 UNUSED(_end_col_offset); // Only used by EXTRA macro
4694 _res = _Py_Return ( a , EXTRA );
4695 if (_res == NULL && PyErr_Occurred()) {
4696 p->error_indicator = 1;
4697 D(p->level--);
4698 return NULL;
4699 }
4700 goto done;
4701 }
4702 p->mark = _mark;
4703 D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4704 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
4705 }
4706 _res = NULL;
4707 done:
4708 D(p->level--);
4709 return _res;
4710}
4711
4712// raise_stmt: 'raise' expression ['from' expression] | 'raise'
4713static stmt_ty
4714raise_stmt_rule(Parser *p)
4715{
4716 D(p->level++);
4717 if (p->error_indicator) {
4718 D(p->level--);
4719 return NULL;
4720 }
4721 stmt_ty _res = NULL;
4722 int _mark = p->mark;
4723 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4724 p->error_indicator = 1;
4725 D(p->level--);
4726 return NULL;
4727 }
4728 int _start_lineno = p->tokens[_mark]->lineno;
4729 UNUSED(_start_lineno); // Only used by EXTRA macro
4730 int _start_col_offset = p->tokens[_mark]->col_offset;
4731 UNUSED(_start_col_offset); // Only used by EXTRA macro
4732 { // 'raise' expression ['from' expression]
4733 if (p->error_indicator) {
4734 D(p->level--);
4735 return NULL;
4736 }
4737 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4738 Token * _keyword;
4739 expr_ty a;
4740 void *b;
4741 if (
4742 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4743 &&
4744 (a = expression_rule(p)) // expression
4745 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004746 (b = _tmp_50_rule(p), 1) // ['from' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004747 )
4748 {
4749 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4750 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4751 if (_token == NULL) {
4752 D(p->level--);
4753 return NULL;
4754 }
4755 int _end_lineno = _token->end_lineno;
4756 UNUSED(_end_lineno); // Only used by EXTRA macro
4757 int _end_col_offset = _token->end_col_offset;
4758 UNUSED(_end_col_offset); // Only used by EXTRA macro
4759 _res = _Py_Raise ( a , b , EXTRA );
4760 if (_res == NULL && PyErr_Occurred()) {
4761 p->error_indicator = 1;
4762 D(p->level--);
4763 return NULL;
4764 }
4765 goto done;
4766 }
4767 p->mark = _mark;
4768 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4769 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
4770 }
4771 { // 'raise'
4772 if (p->error_indicator) {
4773 D(p->level--);
4774 return NULL;
4775 }
4776 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
4777 Token * _keyword;
4778 if (
4779 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4780 )
4781 {
4782 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
4783 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4784 if (_token == NULL) {
4785 D(p->level--);
4786 return NULL;
4787 }
4788 int _end_lineno = _token->end_lineno;
4789 UNUSED(_end_lineno); // Only used by EXTRA macro
4790 int _end_col_offset = _token->end_col_offset;
4791 UNUSED(_end_col_offset); // Only used by EXTRA macro
4792 _res = _Py_Raise ( NULL , NULL , EXTRA );
4793 if (_res == NULL && PyErr_Occurred()) {
4794 p->error_indicator = 1;
4795 D(p->level--);
4796 return NULL;
4797 }
4798 goto done;
4799 }
4800 p->mark = _mark;
4801 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4802 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
4803 }
4804 _res = NULL;
4805 done:
4806 D(p->level--);
4807 return _res;
4808}
4809
4810// function_def: decorators function_def_raw | function_def_raw
4811static stmt_ty
4812function_def_rule(Parser *p)
4813{
4814 D(p->level++);
4815 if (p->error_indicator) {
4816 D(p->level--);
4817 return NULL;
4818 }
4819 stmt_ty _res = NULL;
4820 int _mark = p->mark;
4821 { // decorators function_def_raw
4822 if (p->error_indicator) {
4823 D(p->level--);
4824 return NULL;
4825 }
4826 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4827 asdl_seq* d;
4828 stmt_ty f;
4829 if (
4830 (d = decorators_rule(p)) // decorators
4831 &&
4832 (f = function_def_raw_rule(p)) // function_def_raw
4833 )
4834 {
4835 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4836 _res = _PyPegen_function_def_decorators ( p , d , f );
4837 if (_res == NULL && PyErr_Occurred()) {
4838 p->error_indicator = 1;
4839 D(p->level--);
4840 return NULL;
4841 }
4842 goto done;
4843 }
4844 p->mark = _mark;
4845 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4846 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
4847 }
4848 { // function_def_raw
4849 if (p->error_indicator) {
4850 D(p->level--);
4851 return NULL;
4852 }
4853 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4854 stmt_ty function_def_raw_var;
4855 if (
4856 (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
4857 )
4858 {
4859 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4860 _res = function_def_raw_var;
4861 goto done;
4862 }
4863 p->mark = _mark;
4864 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4865 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
4866 }
4867 _res = NULL;
4868 done:
4869 D(p->level--);
4870 return _res;
4871}
4872
4873// function_def_raw:
4874// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4875// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4876static stmt_ty
4877function_def_raw_rule(Parser *p)
4878{
4879 D(p->level++);
4880 if (p->error_indicator) {
4881 D(p->level--);
4882 return NULL;
4883 }
4884 stmt_ty _res = NULL;
4885 int _mark = p->mark;
4886 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4887 p->error_indicator = 1;
4888 D(p->level--);
4889 return NULL;
4890 }
4891 int _start_lineno = p->tokens[_mark]->lineno;
4892 UNUSED(_start_lineno); // Only used by EXTRA macro
4893 int _start_col_offset = p->tokens[_mark]->col_offset;
4894 UNUSED(_start_col_offset); // Only used by EXTRA macro
4895 { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4896 if (p->error_indicator) {
4897 D(p->level--);
4898 return NULL;
4899 }
4900 D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4901 Token * _keyword;
4902 Token * _literal;
4903 Token * _literal_1;
4904 Token * _literal_2;
4905 void *a;
4906 asdl_seq* b;
4907 expr_ty n;
4908 void *params;
4909 void *tc;
4910 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004911 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004912 &&
4913 (n = _PyPegen_name_token(p)) // NAME
4914 &&
4915 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4916 &&
4917 (params = params_rule(p), 1) // params?
4918 &&
4919 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4920 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004921 (a = _tmp_51_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004922 &&
4923 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4924 &&
4925 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4926 &&
4927 (b = block_rule(p)) // block
4928 )
4929 {
4930 D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4931 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4932 if (_token == NULL) {
4933 D(p->level--);
4934 return NULL;
4935 }
4936 int _end_lineno = _token->end_lineno;
4937 UNUSED(_end_lineno); // Only used by EXTRA macro
4938 int _end_col_offset = _token->end_col_offset;
4939 UNUSED(_end_col_offset); // Only used by EXTRA macro
4940 _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4941 if (_res == NULL && PyErr_Occurred()) {
4942 p->error_indicator = 1;
4943 D(p->level--);
4944 return NULL;
4945 }
4946 goto done;
4947 }
4948 p->mark = _mark;
4949 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
4950 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4951 }
4952 { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4953 if (p->error_indicator) {
4954 D(p->level--);
4955 return NULL;
4956 }
4957 D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4958 Token * _keyword;
4959 Token * _literal;
4960 Token * _literal_1;
4961 Token * _literal_2;
4962 void *a;
4963 Token * async_var;
4964 asdl_seq* b;
4965 expr_ty n;
4966 void *params;
4967 void *tc;
4968 if (
4969 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4970 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004971 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004972 &&
4973 (n = _PyPegen_name_token(p)) // NAME
4974 &&
4975 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4976 &&
4977 (params = params_rule(p), 1) // params?
4978 &&
4979 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4980 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004981 (a = _tmp_52_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004982 &&
4983 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4984 &&
4985 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4986 &&
4987 (b = block_rule(p)) // block
4988 )
4989 {
4990 D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4991 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4992 if (_token == NULL) {
4993 D(p->level--);
4994 return NULL;
4995 }
4996 int _end_lineno = _token->end_lineno;
4997 UNUSED(_end_lineno); // Only used by EXTRA macro
4998 int _end_col_offset = _token->end_col_offset;
4999 UNUSED(_end_col_offset); // Only used by EXTRA macro
5000 _res = CHECK_VERSION ( 5 , "Async functions are" , _Py_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
5001 if (_res == NULL && PyErr_Occurred()) {
5002 p->error_indicator = 1;
5003 D(p->level--);
5004 return NULL;
5005 }
5006 goto done;
5007 }
5008 p->mark = _mark;
5009 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
5010 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
5011 }
5012 _res = NULL;
5013 done:
5014 D(p->level--);
5015 return _res;
5016}
5017
5018// func_type_comment:
5019// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5020// | invalid_double_type_comments
5021// | TYPE_COMMENT
5022static Token*
5023func_type_comment_rule(Parser *p)
5024{
5025 D(p->level++);
5026 if (p->error_indicator) {
5027 D(p->level--);
5028 return NULL;
5029 }
5030 Token* _res = NULL;
5031 int _mark = p->mark;
5032 { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5033 if (p->error_indicator) {
5034 D(p->level--);
5035 return NULL;
5036 }
5037 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5038 Token * newline_var;
5039 Token * t;
5040 if (
5041 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
5042 &&
5043 (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5044 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005045 _PyPegen_lookahead(1, _tmp_53_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005046 )
5047 {
5048 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5049 _res = t;
5050 if (_res == NULL && PyErr_Occurred()) {
5051 p->error_indicator = 1;
5052 D(p->level--);
5053 return NULL;
5054 }
5055 goto done;
5056 }
5057 p->mark = _mark;
5058 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5059 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5060 }
5061 { // invalid_double_type_comments
5062 if (p->error_indicator) {
5063 D(p->level--);
5064 return NULL;
5065 }
5066 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5067 void *invalid_double_type_comments_var;
5068 if (
5069 (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
5070 )
5071 {
5072 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5073 _res = invalid_double_type_comments_var;
5074 goto done;
5075 }
5076 p->mark = _mark;
5077 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5078 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
5079 }
5080 { // TYPE_COMMENT
5081 if (p->error_indicator) {
5082 D(p->level--);
5083 return NULL;
5084 }
5085 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5086 Token * type_comment_var;
5087 if (
5088 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5089 )
5090 {
5091 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5092 _res = type_comment_var;
5093 goto done;
5094 }
5095 p->mark = _mark;
5096 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5097 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
5098 }
5099 _res = NULL;
5100 done:
5101 D(p->level--);
5102 return _res;
5103}
5104
5105// params: invalid_parameters | parameters
5106static arguments_ty
5107params_rule(Parser *p)
5108{
5109 D(p->level++);
5110 if (p->error_indicator) {
5111 D(p->level--);
5112 return NULL;
5113 }
5114 arguments_ty _res = NULL;
5115 int _mark = p->mark;
5116 { // invalid_parameters
5117 if (p->error_indicator) {
5118 D(p->level--);
5119 return NULL;
5120 }
5121 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5122 void *invalid_parameters_var;
5123 if (
5124 (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
5125 )
5126 {
5127 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5128 _res = invalid_parameters_var;
5129 goto done;
5130 }
5131 p->mark = _mark;
5132 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5133 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
5134 }
5135 { // parameters
5136 if (p->error_indicator) {
5137 D(p->level--);
5138 return NULL;
5139 }
5140 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
5141 arguments_ty parameters_var;
5142 if (
5143 (parameters_var = parameters_rule(p)) // parameters
5144 )
5145 {
5146 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
5147 _res = parameters_var;
5148 goto done;
5149 }
5150 p->mark = _mark;
5151 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5152 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
5153 }
5154 _res = NULL;
5155 done:
5156 D(p->level--);
5157 return _res;
5158}
5159
5160// parameters:
5161// | slash_no_default param_no_default* param_with_default* star_etc?
5162// | slash_with_default param_with_default* star_etc?
5163// | param_no_default+ param_with_default* star_etc?
5164// | param_with_default+ star_etc?
5165// | star_etc
5166static arguments_ty
5167parameters_rule(Parser *p)
5168{
5169 D(p->level++);
5170 if (p->error_indicator) {
5171 D(p->level--);
5172 return NULL;
5173 }
5174 arguments_ty _res = NULL;
5175 int _mark = p->mark;
5176 { // slash_no_default param_no_default* param_with_default* star_etc?
5177 if (p->error_indicator) {
5178 D(p->level--);
5179 return NULL;
5180 }
5181 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
5182 asdl_seq* a;
5183 asdl_seq * b;
5184 asdl_seq * c;
5185 void *d;
5186 if (
5187 (a = slash_no_default_rule(p)) // slash_no_default
5188 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005189 (b = _loop0_54_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005190 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005191 (c = _loop0_55_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005192 &&
5193 (d = star_etc_rule(p), 1) // star_etc?
5194 )
5195 {
5196 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
5197 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
5198 if (_res == NULL && PyErr_Occurred()) {
5199 p->error_indicator = 1;
5200 D(p->level--);
5201 return NULL;
5202 }
5203 goto done;
5204 }
5205 p->mark = _mark;
5206 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5207 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
5208 }
5209 { // slash_with_default param_with_default* star_etc?
5210 if (p->error_indicator) {
5211 D(p->level--);
5212 return NULL;
5213 }
5214 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5215 SlashWithDefault* a;
5216 asdl_seq * b;
5217 void *c;
5218 if (
5219 (a = slash_with_default_rule(p)) // slash_with_default
5220 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005221 (b = _loop0_56_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005222 &&
5223 (c = star_etc_rule(p), 1) // star_etc?
5224 )
5225 {
5226 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5227 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
5228 if (_res == NULL && PyErr_Occurred()) {
5229 p->error_indicator = 1;
5230 D(p->level--);
5231 return NULL;
5232 }
5233 goto done;
5234 }
5235 p->mark = _mark;
5236 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5237 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5238 }
5239 { // param_no_default+ param_with_default* star_etc?
5240 if (p->error_indicator) {
5241 D(p->level--);
5242 return NULL;
5243 }
5244 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5245 asdl_seq * a;
5246 asdl_seq * b;
5247 void *c;
5248 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005249 (a = _loop1_57_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005250 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005251 (b = _loop0_58_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005252 &&
5253 (c = star_etc_rule(p), 1) // star_etc?
5254 )
5255 {
5256 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5257 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
5258 if (_res == NULL && PyErr_Occurred()) {
5259 p->error_indicator = 1;
5260 D(p->level--);
5261 return NULL;
5262 }
5263 goto done;
5264 }
5265 p->mark = _mark;
5266 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5267 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5268 }
5269 { // param_with_default+ star_etc?
5270 if (p->error_indicator) {
5271 D(p->level--);
5272 return NULL;
5273 }
5274 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5275 asdl_seq * a;
5276 void *b;
5277 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005278 (a = _loop1_59_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005279 &&
5280 (b = star_etc_rule(p), 1) // star_etc?
5281 )
5282 {
5283 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5284 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
5285 if (_res == NULL && PyErr_Occurred()) {
5286 p->error_indicator = 1;
5287 D(p->level--);
5288 return NULL;
5289 }
5290 goto done;
5291 }
5292 p->mark = _mark;
5293 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5294 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
5295 }
5296 { // star_etc
5297 if (p->error_indicator) {
5298 D(p->level--);
5299 return NULL;
5300 }
5301 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
5302 StarEtc* a;
5303 if (
5304 (a = star_etc_rule(p)) // star_etc
5305 )
5306 {
5307 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
5308 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
5309 if (_res == NULL && PyErr_Occurred()) {
5310 p->error_indicator = 1;
5311 D(p->level--);
5312 return NULL;
5313 }
5314 goto done;
5315 }
5316 p->mark = _mark;
5317 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5318 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
5319 }
5320 _res = NULL;
5321 done:
5322 D(p->level--);
5323 return _res;
5324}
5325
5326// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
5327static asdl_seq*
5328slash_no_default_rule(Parser *p)
5329{
5330 D(p->level++);
5331 if (p->error_indicator) {
5332 D(p->level--);
5333 return NULL;
5334 }
5335 asdl_seq* _res = NULL;
5336 int _mark = p->mark;
5337 { // param_no_default+ '/' ','
5338 if (p->error_indicator) {
5339 D(p->level--);
5340 return NULL;
5341 }
5342 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5343 Token * _literal;
5344 Token * _literal_1;
5345 asdl_seq * a;
5346 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005347 (a = _loop1_60_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005348 &&
5349 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5350 &&
5351 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5352 )
5353 {
5354 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5355 _res = a;
5356 if (_res == NULL && PyErr_Occurred()) {
5357 p->error_indicator = 1;
5358 D(p->level--);
5359 return NULL;
5360 }
5361 goto done;
5362 }
5363 p->mark = _mark;
5364 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5365 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
5366 }
5367 { // param_no_default+ '/' &')'
5368 if (p->error_indicator) {
5369 D(p->level--);
5370 return NULL;
5371 }
5372 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5373 Token * _literal;
5374 asdl_seq * a;
5375 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005376 (a = _loop1_61_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005377 &&
5378 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5379 &&
5380 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5381 )
5382 {
5383 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5384 _res = a;
5385 if (_res == NULL && PyErr_Occurred()) {
5386 p->error_indicator = 1;
5387 D(p->level--);
5388 return NULL;
5389 }
5390 goto done;
5391 }
5392 p->mark = _mark;
5393 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5394 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
5395 }
5396 _res = NULL;
5397 done:
5398 D(p->level--);
5399 return _res;
5400}
5401
5402// slash_with_default:
5403// | param_no_default* param_with_default+ '/' ','
5404// | param_no_default* param_with_default+ '/' &')'
5405static SlashWithDefault*
5406slash_with_default_rule(Parser *p)
5407{
5408 D(p->level++);
5409 if (p->error_indicator) {
5410 D(p->level--);
5411 return NULL;
5412 }
5413 SlashWithDefault* _res = NULL;
5414 int _mark = p->mark;
5415 { // param_no_default* param_with_default+ '/' ','
5416 if (p->error_indicator) {
5417 D(p->level--);
5418 return NULL;
5419 }
5420 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5421 Token * _literal;
5422 Token * _literal_1;
5423 asdl_seq * a;
5424 asdl_seq * b;
5425 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005426 (a = _loop0_62_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005427 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005428 (b = _loop1_63_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005429 &&
5430 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5431 &&
5432 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5433 )
5434 {
5435 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5436 _res = _PyPegen_slash_with_default ( p , a , b );
5437 if (_res == NULL && PyErr_Occurred()) {
5438 p->error_indicator = 1;
5439 D(p->level--);
5440 return NULL;
5441 }
5442 goto done;
5443 }
5444 p->mark = _mark;
5445 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5446 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5447 }
5448 { // param_no_default* param_with_default+ '/' &')'
5449 if (p->error_indicator) {
5450 D(p->level--);
5451 return NULL;
5452 }
5453 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5454 Token * _literal;
5455 asdl_seq * a;
5456 asdl_seq * b;
5457 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005458 (a = _loop0_64_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005459 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005460 (b = _loop1_65_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005461 &&
5462 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5463 &&
5464 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5465 )
5466 {
5467 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5468 _res = _PyPegen_slash_with_default ( p , a , b );
5469 if (_res == NULL && PyErr_Occurred()) {
5470 p->error_indicator = 1;
5471 D(p->level--);
5472 return NULL;
5473 }
5474 goto done;
5475 }
5476 p->mark = _mark;
5477 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5478 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5479 }
5480 _res = NULL;
5481 done:
5482 D(p->level--);
5483 return _res;
5484}
5485
5486// star_etc:
5487// | '*' param_no_default param_maybe_default* kwds?
5488// | '*' ',' param_maybe_default+ kwds?
5489// | kwds
5490// | invalid_star_etc
5491static StarEtc*
5492star_etc_rule(Parser *p)
5493{
5494 D(p->level++);
5495 if (p->error_indicator) {
5496 D(p->level--);
5497 return NULL;
5498 }
5499 StarEtc* _res = NULL;
5500 int _mark = p->mark;
5501 { // '*' param_no_default param_maybe_default* kwds?
5502 if (p->error_indicator) {
5503 D(p->level--);
5504 return NULL;
5505 }
5506 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5507 Token * _literal;
5508 arg_ty a;
5509 asdl_seq * b;
5510 void *c;
5511 if (
5512 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5513 &&
5514 (a = param_no_default_rule(p)) // param_no_default
5515 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005516 (b = _loop0_66_rule(p)) // param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005517 &&
5518 (c = kwds_rule(p), 1) // kwds?
5519 )
5520 {
5521 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5522 _res = _PyPegen_star_etc ( p , a , b , c );
5523 if (_res == NULL && PyErr_Occurred()) {
5524 p->error_indicator = 1;
5525 D(p->level--);
5526 return NULL;
5527 }
5528 goto done;
5529 }
5530 p->mark = _mark;
5531 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5532 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5533 }
5534 { // '*' ',' param_maybe_default+ kwds?
5535 if (p->error_indicator) {
5536 D(p->level--);
5537 return NULL;
5538 }
5539 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5540 Token * _literal;
5541 Token * _literal_1;
5542 asdl_seq * b;
5543 void *c;
5544 if (
5545 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5546 &&
5547 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5548 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005549 (b = _loop1_67_rule(p)) // param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005550 &&
5551 (c = kwds_rule(p), 1) // kwds?
5552 )
5553 {
5554 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5555 _res = _PyPegen_star_etc ( p , NULL , b , c );
5556 if (_res == NULL && PyErr_Occurred()) {
5557 p->error_indicator = 1;
5558 D(p->level--);
5559 return NULL;
5560 }
5561 goto done;
5562 }
5563 p->mark = _mark;
5564 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5565 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5566 }
5567 { // kwds
5568 if (p->error_indicator) {
5569 D(p->level--);
5570 return NULL;
5571 }
5572 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
5573 arg_ty a;
5574 if (
5575 (a = kwds_rule(p)) // kwds
5576 )
5577 {
5578 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
5579 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
5580 if (_res == NULL && PyErr_Occurred()) {
5581 p->error_indicator = 1;
5582 D(p->level--);
5583 return NULL;
5584 }
5585 goto done;
5586 }
5587 p->mark = _mark;
5588 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5589 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
5590 }
5591 { // invalid_star_etc
5592 if (p->error_indicator) {
5593 D(p->level--);
5594 return NULL;
5595 }
5596 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5597 void *invalid_star_etc_var;
5598 if (
5599 (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
5600 )
5601 {
5602 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5603 _res = invalid_star_etc_var;
5604 goto done;
5605 }
5606 p->mark = _mark;
5607 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5608 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
5609 }
5610 _res = NULL;
5611 done:
5612 D(p->level--);
5613 return _res;
5614}
5615
5616// kwds: '**' param_no_default
5617static arg_ty
5618kwds_rule(Parser *p)
5619{
5620 D(p->level++);
5621 if (p->error_indicator) {
5622 D(p->level--);
5623 return NULL;
5624 }
5625 arg_ty _res = NULL;
5626 int _mark = p->mark;
5627 { // '**' param_no_default
5628 if (p->error_indicator) {
5629 D(p->level--);
5630 return NULL;
5631 }
5632 D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5633 Token * _literal;
5634 arg_ty a;
5635 if (
5636 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
5637 &&
5638 (a = param_no_default_rule(p)) // param_no_default
5639 )
5640 {
5641 D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5642 _res = a;
5643 if (_res == NULL && PyErr_Occurred()) {
5644 p->error_indicator = 1;
5645 D(p->level--);
5646 return NULL;
5647 }
5648 goto done;
5649 }
5650 p->mark = _mark;
5651 D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
5652 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
5653 }
5654 _res = NULL;
5655 done:
5656 D(p->level--);
5657 return _res;
5658}
5659
5660// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
5661static arg_ty
5662param_no_default_rule(Parser *p)
5663{
5664 D(p->level++);
5665 if (p->error_indicator) {
5666 D(p->level--);
5667 return NULL;
5668 }
5669 arg_ty _res = NULL;
5670 int _mark = p->mark;
5671 { // param ',' TYPE_COMMENT?
5672 if (p->error_indicator) {
5673 D(p->level--);
5674 return NULL;
5675 }
5676 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5677 Token * _literal;
5678 arg_ty a;
5679 void *tc;
5680 if (
5681 (a = param_rule(p)) // param
5682 &&
5683 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5684 &&
5685 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5686 )
5687 {
5688 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5689 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5690 if (_res == NULL && PyErr_Occurred()) {
5691 p->error_indicator = 1;
5692 D(p->level--);
5693 return NULL;
5694 }
5695 goto done;
5696 }
5697 p->mark = _mark;
5698 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5699 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
5700 }
5701 { // param TYPE_COMMENT? &')'
5702 if (p->error_indicator) {
5703 D(p->level--);
5704 return NULL;
5705 }
5706 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5707 arg_ty a;
5708 void *tc;
5709 if (
5710 (a = param_rule(p)) // param
5711 &&
5712 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5713 &&
5714 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5715 )
5716 {
5717 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5718 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5719 if (_res == NULL && PyErr_Occurred()) {
5720 p->error_indicator = 1;
5721 D(p->level--);
5722 return NULL;
5723 }
5724 goto done;
5725 }
5726 p->mark = _mark;
5727 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5728 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
5729 }
5730 _res = NULL;
5731 done:
5732 D(p->level--);
5733 return _res;
5734}
5735
5736// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
5737static NameDefaultPair*
5738param_with_default_rule(Parser *p)
5739{
5740 D(p->level++);
5741 if (p->error_indicator) {
5742 D(p->level--);
5743 return NULL;
5744 }
5745 NameDefaultPair* _res = NULL;
5746 int _mark = p->mark;
5747 { // param default ',' TYPE_COMMENT?
5748 if (p->error_indicator) {
5749 D(p->level--);
5750 return NULL;
5751 }
5752 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5753 Token * _literal;
5754 arg_ty a;
5755 expr_ty c;
5756 void *tc;
5757 if (
5758 (a = param_rule(p)) // param
5759 &&
5760 (c = default_rule(p)) // default
5761 &&
5762 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5763 &&
5764 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5765 )
5766 {
5767 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5768 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5769 if (_res == NULL && PyErr_Occurred()) {
5770 p->error_indicator = 1;
5771 D(p->level--);
5772 return NULL;
5773 }
5774 goto done;
5775 }
5776 p->mark = _mark;
5777 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5778 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5779 }
5780 { // param default TYPE_COMMENT? &')'
5781 if (p->error_indicator) {
5782 D(p->level--);
5783 return NULL;
5784 }
5785 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5786 arg_ty a;
5787 expr_ty c;
5788 void *tc;
5789 if (
5790 (a = param_rule(p)) // param
5791 &&
5792 (c = default_rule(p)) // default
5793 &&
5794 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5795 &&
5796 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5797 )
5798 {
5799 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5800 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5801 if (_res == NULL && PyErr_Occurred()) {
5802 p->error_indicator = 1;
5803 D(p->level--);
5804 return NULL;
5805 }
5806 goto done;
5807 }
5808 p->mark = _mark;
5809 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5810 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5811 }
5812 _res = NULL;
5813 done:
5814 D(p->level--);
5815 return _res;
5816}
5817
5818// param_maybe_default:
5819// | param default? ',' TYPE_COMMENT?
5820// | param default? TYPE_COMMENT? &')'
5821static NameDefaultPair*
5822param_maybe_default_rule(Parser *p)
5823{
5824 D(p->level++);
5825 if (p->error_indicator) {
5826 D(p->level--);
5827 return NULL;
5828 }
5829 NameDefaultPair* _res = NULL;
5830 int _mark = p->mark;
5831 { // param default? ',' TYPE_COMMENT?
5832 if (p->error_indicator) {
5833 D(p->level--);
5834 return NULL;
5835 }
5836 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5837 Token * _literal;
5838 arg_ty a;
5839 void *c;
5840 void *tc;
5841 if (
5842 (a = param_rule(p)) // param
5843 &&
5844 (c = default_rule(p), 1) // default?
5845 &&
5846 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5847 &&
5848 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5849 )
5850 {
5851 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5852 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5853 if (_res == NULL && PyErr_Occurred()) {
5854 p->error_indicator = 1;
5855 D(p->level--);
5856 return NULL;
5857 }
5858 goto done;
5859 }
5860 p->mark = _mark;
5861 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5862 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5863 }
5864 { // param default? TYPE_COMMENT? &')'
5865 if (p->error_indicator) {
5866 D(p->level--);
5867 return NULL;
5868 }
5869 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5870 arg_ty a;
5871 void *c;
5872 void *tc;
5873 if (
5874 (a = param_rule(p)) // param
5875 &&
5876 (c = default_rule(p), 1) // default?
5877 &&
5878 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5879 &&
5880 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5881 )
5882 {
5883 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5884 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5885 if (_res == NULL && PyErr_Occurred()) {
5886 p->error_indicator = 1;
5887 D(p->level--);
5888 return NULL;
5889 }
5890 goto done;
5891 }
5892 p->mark = _mark;
5893 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5894 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5895 }
5896 _res = NULL;
5897 done:
5898 D(p->level--);
5899 return _res;
5900}
5901
5902// param: NAME annotation?
5903static arg_ty
5904param_rule(Parser *p)
5905{
5906 D(p->level++);
5907 if (p->error_indicator) {
5908 D(p->level--);
5909 return NULL;
5910 }
5911 arg_ty _res = NULL;
5912 int _mark = p->mark;
5913 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5914 p->error_indicator = 1;
5915 D(p->level--);
5916 return NULL;
5917 }
5918 int _start_lineno = p->tokens[_mark]->lineno;
5919 UNUSED(_start_lineno); // Only used by EXTRA macro
5920 int _start_col_offset = p->tokens[_mark]->col_offset;
5921 UNUSED(_start_col_offset); // Only used by EXTRA macro
5922 { // NAME annotation?
5923 if (p->error_indicator) {
5924 D(p->level--);
5925 return NULL;
5926 }
5927 D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5928 expr_ty a;
5929 void *b;
5930 if (
5931 (a = _PyPegen_name_token(p)) // NAME
5932 &&
5933 (b = annotation_rule(p), 1) // annotation?
5934 )
5935 {
5936 D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5937 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5938 if (_token == NULL) {
5939 D(p->level--);
5940 return NULL;
5941 }
5942 int _end_lineno = _token->end_lineno;
5943 UNUSED(_end_lineno); // Only used by EXTRA macro
5944 int _end_col_offset = _token->end_col_offset;
5945 UNUSED(_end_col_offset); // Only used by EXTRA macro
5946 _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
5947 if (_res == NULL && PyErr_Occurred()) {
5948 p->error_indicator = 1;
5949 D(p->level--);
5950 return NULL;
5951 }
5952 goto done;
5953 }
5954 p->mark = _mark;
5955 D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
5956 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
5957 }
5958 _res = NULL;
5959 done:
5960 D(p->level--);
5961 return _res;
5962}
5963
5964// annotation: ':' expression
5965static expr_ty
5966annotation_rule(Parser *p)
5967{
5968 D(p->level++);
5969 if (p->error_indicator) {
5970 D(p->level--);
5971 return NULL;
5972 }
5973 expr_ty _res = NULL;
5974 int _mark = p->mark;
5975 { // ':' expression
5976 if (p->error_indicator) {
5977 D(p->level--);
5978 return NULL;
5979 }
5980 D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
5981 Token * _literal;
5982 expr_ty a;
5983 if (
5984 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
5985 &&
5986 (a = expression_rule(p)) // expression
5987 )
5988 {
5989 D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
5990 _res = a;
5991 if (_res == NULL && PyErr_Occurred()) {
5992 p->error_indicator = 1;
5993 D(p->level--);
5994 return NULL;
5995 }
5996 goto done;
5997 }
5998 p->mark = _mark;
5999 D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
6000 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
6001 }
6002 _res = NULL;
6003 done:
6004 D(p->level--);
6005 return _res;
6006}
6007
6008// default: '=' expression
6009static expr_ty
6010default_rule(Parser *p)
6011{
6012 D(p->level++);
6013 if (p->error_indicator) {
6014 D(p->level--);
6015 return NULL;
6016 }
6017 expr_ty _res = NULL;
6018 int _mark = p->mark;
6019 { // '=' expression
6020 if (p->error_indicator) {
6021 D(p->level--);
6022 return NULL;
6023 }
6024 D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6025 Token * _literal;
6026 expr_ty a;
6027 if (
6028 (_literal = _PyPegen_expect_token(p, 22)) // token='='
6029 &&
6030 (a = expression_rule(p)) // expression
6031 )
6032 {
6033 D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6034 _res = a;
6035 if (_res == NULL && PyErr_Occurred()) {
6036 p->error_indicator = 1;
6037 D(p->level--);
6038 return NULL;
6039 }
6040 goto done;
6041 }
6042 p->mark = _mark;
6043 D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
6044 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
6045 }
6046 _res = NULL;
6047 done:
6048 D(p->level--);
6049 return _res;
6050}
6051
6052// decorators: (('@' named_expression NEWLINE))+
6053static asdl_seq*
6054decorators_rule(Parser *p)
6055{
6056 D(p->level++);
6057 if (p->error_indicator) {
6058 D(p->level--);
6059 return NULL;
6060 }
6061 asdl_seq* _res = NULL;
6062 int _mark = p->mark;
6063 { // (('@' named_expression NEWLINE))+
6064 if (p->error_indicator) {
6065 D(p->level--);
6066 return NULL;
6067 }
6068 D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6069 asdl_seq * a;
6070 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006071 (a = _loop1_68_rule(p)) // (('@' named_expression NEWLINE))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006072 )
6073 {
6074 D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6075 _res = a;
6076 if (_res == NULL && PyErr_Occurred()) {
6077 p->error_indicator = 1;
6078 D(p->level--);
6079 return NULL;
6080 }
6081 goto done;
6082 }
6083 p->mark = _mark;
6084 D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
6085 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6086 }
6087 _res = NULL;
6088 done:
6089 D(p->level--);
6090 return _res;
6091}
6092
6093// class_def: decorators class_def_raw | class_def_raw
6094static stmt_ty
6095class_def_rule(Parser *p)
6096{
6097 D(p->level++);
6098 if (p->error_indicator) {
6099 D(p->level--);
6100 return NULL;
6101 }
6102 stmt_ty _res = NULL;
6103 int _mark = p->mark;
6104 { // decorators class_def_raw
6105 if (p->error_indicator) {
6106 D(p->level--);
6107 return NULL;
6108 }
6109 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6110 asdl_seq* a;
6111 stmt_ty b;
6112 if (
6113 (a = decorators_rule(p)) // decorators
6114 &&
6115 (b = class_def_raw_rule(p)) // class_def_raw
6116 )
6117 {
6118 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6119 _res = _PyPegen_class_def_decorators ( p , a , b );
6120 if (_res == NULL && PyErr_Occurred()) {
6121 p->error_indicator = 1;
6122 D(p->level--);
6123 return NULL;
6124 }
6125 goto done;
6126 }
6127 p->mark = _mark;
6128 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6129 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
6130 }
6131 { // class_def_raw
6132 if (p->error_indicator) {
6133 D(p->level--);
6134 return NULL;
6135 }
6136 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6137 stmt_ty class_def_raw_var;
6138 if (
6139 (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
6140 )
6141 {
6142 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6143 _res = class_def_raw_var;
6144 goto done;
6145 }
6146 p->mark = _mark;
6147 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6148 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
6149 }
6150 _res = NULL;
6151 done:
6152 D(p->level--);
6153 return _res;
6154}
6155
6156// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
6157static stmt_ty
6158class_def_raw_rule(Parser *p)
6159{
6160 D(p->level++);
6161 if (p->error_indicator) {
6162 D(p->level--);
6163 return NULL;
6164 }
6165 stmt_ty _res = NULL;
6166 int _mark = p->mark;
6167 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6168 p->error_indicator = 1;
6169 D(p->level--);
6170 return NULL;
6171 }
6172 int _start_lineno = p->tokens[_mark]->lineno;
6173 UNUSED(_start_lineno); // Only used by EXTRA macro
6174 int _start_col_offset = p->tokens[_mark]->col_offset;
6175 UNUSED(_start_col_offset); // Only used by EXTRA macro
6176 { // 'class' NAME ['(' arguments? ')'] ':' block
6177 if (p->error_indicator) {
6178 D(p->level--);
6179 return NULL;
6180 }
6181 D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6182 Token * _keyword;
6183 Token * _literal;
6184 expr_ty a;
6185 void *b;
6186 asdl_seq* c;
6187 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006188 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006189 &&
6190 (a = _PyPegen_name_token(p)) // NAME
6191 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006192 (b = _tmp_69_rule(p), 1) // ['(' arguments? ')']
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006193 &&
6194 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
6195 &&
6196 (c = block_rule(p)) // block
6197 )
6198 {
6199 D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6200 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6201 if (_token == NULL) {
6202 D(p->level--);
6203 return NULL;
6204 }
6205 int _end_lineno = _token->end_lineno;
6206 UNUSED(_end_lineno); // Only used by EXTRA macro
6207 int _end_col_offset = _token->end_col_offset;
6208 UNUSED(_end_col_offset); // Only used by EXTRA macro
6209 _res = _Py_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , EXTRA );
6210 if (_res == NULL && PyErr_Occurred()) {
6211 p->error_indicator = 1;
6212 D(p->level--);
6213 return NULL;
6214 }
6215 goto done;
6216 }
6217 p->mark = _mark;
6218 D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
6219 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6220 }
6221 _res = NULL;
6222 done:
6223 D(p->level--);
6224 return _res;
6225}
6226
6227// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
6228static asdl_seq*
6229block_rule(Parser *p)
6230{
6231 D(p->level++);
6232 if (p->error_indicator) {
6233 D(p->level--);
6234 return NULL;
6235 }
6236 asdl_seq* _res = NULL;
6237 if (_PyPegen_is_memoized(p, block_type, &_res)) {
6238 D(p->level--);
6239 return _res;
6240 }
6241 int _mark = p->mark;
6242 { // NEWLINE INDENT statements DEDENT
6243 if (p->error_indicator) {
6244 D(p->level--);
6245 return NULL;
6246 }
6247 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6248 asdl_seq* a;
6249 Token * dedent_var;
6250 Token * indent_var;
6251 Token * newline_var;
6252 if (
6253 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
6254 &&
6255 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
6256 &&
6257 (a = statements_rule(p)) // statements
6258 &&
6259 (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
6260 )
6261 {
6262 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6263 _res = a;
6264 if (_res == NULL && PyErr_Occurred()) {
6265 p->error_indicator = 1;
6266 D(p->level--);
6267 return NULL;
6268 }
6269 goto done;
6270 }
6271 p->mark = _mark;
6272 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6273 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6274 }
6275 { // simple_stmt
6276 if (p->error_indicator) {
6277 D(p->level--);
6278 return NULL;
6279 }
6280 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6281 asdl_seq* simple_stmt_var;
6282 if (
6283 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
6284 )
6285 {
6286 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6287 _res = simple_stmt_var;
6288 goto done;
6289 }
6290 p->mark = _mark;
6291 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6292 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
6293 }
6294 { // invalid_block
6295 if (p->error_indicator) {
6296 D(p->level--);
6297 return NULL;
6298 }
6299 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6300 void *invalid_block_var;
6301 if (
6302 (invalid_block_var = invalid_block_rule(p)) // invalid_block
6303 )
6304 {
6305 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6306 _res = invalid_block_var;
6307 goto done;
6308 }
6309 p->mark = _mark;
6310 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6311 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
6312 }
6313 _res = NULL;
6314 done:
6315 _PyPegen_insert_memo(p, _mark, block_type, _res);
6316 D(p->level--);
6317 return _res;
6318}
6319
6320// expressions_list: ','.star_expression+ ','?
6321static asdl_seq*
6322expressions_list_rule(Parser *p)
6323{
6324 D(p->level++);
6325 if (p->error_indicator) {
6326 D(p->level--);
6327 return NULL;
6328 }
6329 asdl_seq* _res = NULL;
6330 int _mark = p->mark;
6331 { // ','.star_expression+ ','?
6332 if (p->error_indicator) {
6333 D(p->level--);
6334 return NULL;
6335 }
6336 D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6337 void *_opt_var;
6338 UNUSED(_opt_var); // Silence compiler warnings
6339 asdl_seq * a;
6340 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006341 (a = _gather_70_rule(p)) // ','.star_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006342 &&
6343 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6344 )
6345 {
6346 D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6347 _res = a;
6348 if (_res == NULL && PyErr_Occurred()) {
6349 p->error_indicator = 1;
6350 D(p->level--);
6351 return NULL;
6352 }
6353 goto done;
6354 }
6355 p->mark = _mark;
6356 D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ',
6357 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?"));
6358 }
6359 _res = NULL;
6360 done:
6361 D(p->level--);
6362 return _res;
6363}
6364
6365// star_expressions:
6366// | star_expression ((',' star_expression))+ ','?
6367// | star_expression ','
6368// | star_expression
6369static expr_ty
6370star_expressions_rule(Parser *p)
6371{
6372 D(p->level++);
6373 if (p->error_indicator) {
6374 D(p->level--);
6375 return NULL;
6376 }
6377 expr_ty _res = NULL;
6378 int _mark = p->mark;
6379 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6380 p->error_indicator = 1;
6381 D(p->level--);
6382 return NULL;
6383 }
6384 int _start_lineno = p->tokens[_mark]->lineno;
6385 UNUSED(_start_lineno); // Only used by EXTRA macro
6386 int _start_col_offset = p->tokens[_mark]->col_offset;
6387 UNUSED(_start_col_offset); // Only used by EXTRA macro
6388 { // star_expression ((',' star_expression))+ ','?
6389 if (p->error_indicator) {
6390 D(p->level--);
6391 return NULL;
6392 }
6393 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6394 void *_opt_var;
6395 UNUSED(_opt_var); // Silence compiler warnings
6396 expr_ty a;
6397 asdl_seq * b;
6398 if (
6399 (a = star_expression_rule(p)) // star_expression
6400 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006401 (b = _loop1_72_rule(p)) // ((',' star_expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006402 &&
6403 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6404 )
6405 {
6406 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6407 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6408 if (_token == NULL) {
6409 D(p->level--);
6410 return NULL;
6411 }
6412 int _end_lineno = _token->end_lineno;
6413 UNUSED(_end_lineno); // Only used by EXTRA macro
6414 int _end_col_offset = _token->end_col_offset;
6415 UNUSED(_end_col_offset); // Only used by EXTRA macro
6416 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
6417 if (_res == NULL && PyErr_Occurred()) {
6418 p->error_indicator = 1;
6419 D(p->level--);
6420 return NULL;
6421 }
6422 goto done;
6423 }
6424 p->mark = _mark;
6425 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6426 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6427 }
6428 { // star_expression ','
6429 if (p->error_indicator) {
6430 D(p->level--);
6431 return NULL;
6432 }
6433 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6434 Token * _literal;
6435 expr_ty a;
6436 if (
6437 (a = star_expression_rule(p)) // star_expression
6438 &&
6439 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6440 )
6441 {
6442 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6443 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6444 if (_token == NULL) {
6445 D(p->level--);
6446 return NULL;
6447 }
6448 int _end_lineno = _token->end_lineno;
6449 UNUSED(_end_lineno); // Only used by EXTRA macro
6450 int _end_col_offset = _token->end_col_offset;
6451 UNUSED(_end_col_offset); // Only used by EXTRA macro
6452 _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
6453 if (_res == NULL && PyErr_Occurred()) {
6454 p->error_indicator = 1;
6455 D(p->level--);
6456 return NULL;
6457 }
6458 goto done;
6459 }
6460 p->mark = _mark;
6461 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6462 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','"));
6463 }
6464 { // star_expression
6465 if (p->error_indicator) {
6466 D(p->level--);
6467 return NULL;
6468 }
6469 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
6470 expr_ty star_expression_var;
6471 if (
6472 (star_expression_var = star_expression_rule(p)) // star_expression
6473 )
6474 {
6475 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
6476 _res = star_expression_var;
6477 goto done;
6478 }
6479 p->mark = _mark;
6480 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6481 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
6482 }
6483 _res = NULL;
6484 done:
6485 D(p->level--);
6486 return _res;
6487}
6488
6489// star_expression: '*' bitwise_or | expression
6490static expr_ty
6491star_expression_rule(Parser *p)
6492{
6493 D(p->level++);
6494 if (p->error_indicator) {
6495 D(p->level--);
6496 return NULL;
6497 }
6498 expr_ty _res = NULL;
6499 if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
6500 D(p->level--);
6501 return _res;
6502 }
6503 int _mark = p->mark;
6504 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6505 p->error_indicator = 1;
6506 D(p->level--);
6507 return NULL;
6508 }
6509 int _start_lineno = p->tokens[_mark]->lineno;
6510 UNUSED(_start_lineno); // Only used by EXTRA macro
6511 int _start_col_offset = p->tokens[_mark]->col_offset;
6512 UNUSED(_start_col_offset); // Only used by EXTRA macro
6513 { // '*' bitwise_or
6514 if (p->error_indicator) {
6515 D(p->level--);
6516 return NULL;
6517 }
6518 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6519 Token * _literal;
6520 expr_ty a;
6521 if (
6522 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6523 &&
6524 (a = bitwise_or_rule(p)) // bitwise_or
6525 )
6526 {
6527 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6528 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6529 if (_token == NULL) {
6530 D(p->level--);
6531 return NULL;
6532 }
6533 int _end_lineno = _token->end_lineno;
6534 UNUSED(_end_lineno); // Only used by EXTRA macro
6535 int _end_col_offset = _token->end_col_offset;
6536 UNUSED(_end_col_offset); // Only used by EXTRA macro
6537 _res = _Py_Starred ( a , Load , EXTRA );
6538 if (_res == NULL && PyErr_Occurred()) {
6539 p->error_indicator = 1;
6540 D(p->level--);
6541 return NULL;
6542 }
6543 goto done;
6544 }
6545 p->mark = _mark;
6546 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6547 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6548 }
6549 { // expression
6550 if (p->error_indicator) {
6551 D(p->level--);
6552 return NULL;
6553 }
6554 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6555 expr_ty expression_var;
6556 if (
6557 (expression_var = expression_rule(p)) // expression
6558 )
6559 {
6560 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6561 _res = expression_var;
6562 goto done;
6563 }
6564 p->mark = _mark;
6565 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6566 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6567 }
6568 _res = NULL;
6569 done:
6570 _PyPegen_insert_memo(p, _mark, star_expression_type, _res);
6571 D(p->level--);
6572 return _res;
6573}
6574
6575// star_named_expressions: ','.star_named_expression+ ','?
6576static asdl_seq*
6577star_named_expressions_rule(Parser *p)
6578{
6579 D(p->level++);
6580 if (p->error_indicator) {
6581 D(p->level--);
6582 return NULL;
6583 }
6584 asdl_seq* _res = NULL;
6585 int _mark = p->mark;
6586 { // ','.star_named_expression+ ','?
6587 if (p->error_indicator) {
6588 D(p->level--);
6589 return NULL;
6590 }
6591 D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6592 void *_opt_var;
6593 UNUSED(_opt_var); // Silence compiler warnings
6594 asdl_seq * a;
6595 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006596 (a = _gather_73_rule(p)) // ','.star_named_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006597 &&
6598 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6599 )
6600 {
6601 D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6602 _res = a;
6603 if (_res == NULL && PyErr_Occurred()) {
6604 p->error_indicator = 1;
6605 D(p->level--);
6606 return NULL;
6607 }
6608 goto done;
6609 }
6610 p->mark = _mark;
6611 D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6612 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
6613 }
6614 _res = NULL;
6615 done:
6616 D(p->level--);
6617 return _res;
6618}
6619
6620// star_named_expression: '*' bitwise_or | named_expression
6621static expr_ty
6622star_named_expression_rule(Parser *p)
6623{
6624 D(p->level++);
6625 if (p->error_indicator) {
6626 D(p->level--);
6627 return NULL;
6628 }
6629 expr_ty _res = NULL;
6630 int _mark = p->mark;
6631 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6632 p->error_indicator = 1;
6633 D(p->level--);
6634 return NULL;
6635 }
6636 int _start_lineno = p->tokens[_mark]->lineno;
6637 UNUSED(_start_lineno); // Only used by EXTRA macro
6638 int _start_col_offset = p->tokens[_mark]->col_offset;
6639 UNUSED(_start_col_offset); // Only used by EXTRA macro
6640 { // '*' bitwise_or
6641 if (p->error_indicator) {
6642 D(p->level--);
6643 return NULL;
6644 }
6645 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6646 Token * _literal;
6647 expr_ty a;
6648 if (
6649 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6650 &&
6651 (a = bitwise_or_rule(p)) // bitwise_or
6652 )
6653 {
6654 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6655 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6656 if (_token == NULL) {
6657 D(p->level--);
6658 return NULL;
6659 }
6660 int _end_lineno = _token->end_lineno;
6661 UNUSED(_end_lineno); // Only used by EXTRA macro
6662 int _end_col_offset = _token->end_col_offset;
6663 UNUSED(_end_col_offset); // Only used by EXTRA macro
6664 _res = _Py_Starred ( a , Load , EXTRA );
6665 if (_res == NULL && PyErr_Occurred()) {
6666 p->error_indicator = 1;
6667 D(p->level--);
6668 return NULL;
6669 }
6670 goto done;
6671 }
6672 p->mark = _mark;
6673 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6674 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6675 }
6676 { // named_expression
6677 if (p->error_indicator) {
6678 D(p->level--);
6679 return NULL;
6680 }
6681 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
6682 expr_ty named_expression_var;
6683 if (
6684 (named_expression_var = named_expression_rule(p)) // named_expression
6685 )
6686 {
6687 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
6688 _res = named_expression_var;
6689 goto done;
6690 }
6691 p->mark = _mark;
6692 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6693 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
6694 }
6695 _res = NULL;
6696 done:
6697 D(p->level--);
6698 return _res;
6699}
6700
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006701// named_expression: NAME ':=' ~ expression | expression !':=' | invalid_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006702static expr_ty
6703named_expression_rule(Parser *p)
6704{
6705 D(p->level++);
6706 if (p->error_indicator) {
6707 D(p->level--);
6708 return NULL;
6709 }
6710 expr_ty _res = NULL;
6711 int _mark = p->mark;
6712 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6713 p->error_indicator = 1;
6714 D(p->level--);
6715 return NULL;
6716 }
6717 int _start_lineno = p->tokens[_mark]->lineno;
6718 UNUSED(_start_lineno); // Only used by EXTRA macro
6719 int _start_col_offset = p->tokens[_mark]->col_offset;
6720 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006721 { // NAME ':=' ~ expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006722 if (p->error_indicator) {
6723 D(p->level--);
6724 return NULL;
6725 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006726 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
6727 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006728 Token * _literal;
6729 expr_ty a;
6730 expr_ty b;
6731 if (
6732 (a = _PyPegen_name_token(p)) // NAME
6733 &&
6734 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
6735 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006736 (_cut_var = 1)
6737 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006738 (b = expression_rule(p)) // expression
6739 )
6740 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006741 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006742 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6743 if (_token == NULL) {
6744 D(p->level--);
6745 return NULL;
6746 }
6747 int _end_lineno = _token->end_lineno;
6748 UNUSED(_end_lineno); // Only used by EXTRA macro
6749 int _end_col_offset = _token->end_col_offset;
6750 UNUSED(_end_col_offset); // Only used by EXTRA macro
6751 _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
6752 if (_res == NULL && PyErr_Occurred()) {
6753 p->error_indicator = 1;
6754 D(p->level--);
6755 return NULL;
6756 }
6757 goto done;
6758 }
6759 p->mark = _mark;
6760 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006761 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
6762 if (_cut_var) {
6763 D(p->level--);
6764 return NULL;
6765 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006766 }
6767 { // expression !':='
6768 if (p->error_indicator) {
6769 D(p->level--);
6770 return NULL;
6771 }
6772 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6773 expr_ty expression_var;
6774 if (
6775 (expression_var = expression_rule(p)) // expression
6776 &&
6777 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
6778 )
6779 {
6780 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6781 _res = expression_var;
6782 goto done;
6783 }
6784 p->mark = _mark;
6785 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6786 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
6787 }
6788 { // invalid_named_expression
6789 if (p->error_indicator) {
6790 D(p->level--);
6791 return NULL;
6792 }
6793 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6794 void *invalid_named_expression_var;
6795 if (
6796 (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression
6797 )
6798 {
6799 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6800 _res = invalid_named_expression_var;
6801 goto done;
6802 }
6803 p->mark = _mark;
6804 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6805 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
6806 }
6807 _res = NULL;
6808 done:
6809 D(p->level--);
6810 return _res;
6811}
6812
6813// annotated_rhs: yield_expr | star_expressions
6814static expr_ty
6815annotated_rhs_rule(Parser *p)
6816{
6817 D(p->level++);
6818 if (p->error_indicator) {
6819 D(p->level--);
6820 return NULL;
6821 }
6822 expr_ty _res = NULL;
6823 int _mark = p->mark;
6824 { // yield_expr
6825 if (p->error_indicator) {
6826 D(p->level--);
6827 return NULL;
6828 }
6829 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6830 expr_ty yield_expr_var;
6831 if (
6832 (yield_expr_var = yield_expr_rule(p)) // yield_expr
6833 )
6834 {
6835 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6836 _res = yield_expr_var;
6837 goto done;
6838 }
6839 p->mark = _mark;
6840 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6841 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
6842 }
6843 { // star_expressions
6844 if (p->error_indicator) {
6845 D(p->level--);
6846 return NULL;
6847 }
6848 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6849 expr_ty star_expressions_var;
6850 if (
6851 (star_expressions_var = star_expressions_rule(p)) // star_expressions
6852 )
6853 {
6854 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6855 _res = star_expressions_var;
6856 goto done;
6857 }
6858 p->mark = _mark;
6859 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6860 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
6861 }
6862 _res = NULL;
6863 done:
6864 D(p->level--);
6865 return _res;
6866}
6867
6868// expressions: expression ((',' expression))+ ','? | expression ',' | expression
6869static expr_ty
6870expressions_rule(Parser *p)
6871{
6872 D(p->level++);
6873 if (p->error_indicator) {
6874 D(p->level--);
6875 return NULL;
6876 }
6877 expr_ty _res = NULL;
6878 int _mark = p->mark;
6879 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6880 p->error_indicator = 1;
6881 D(p->level--);
6882 return NULL;
6883 }
6884 int _start_lineno = p->tokens[_mark]->lineno;
6885 UNUSED(_start_lineno); // Only used by EXTRA macro
6886 int _start_col_offset = p->tokens[_mark]->col_offset;
6887 UNUSED(_start_col_offset); // Only used by EXTRA macro
6888 { // expression ((',' expression))+ ','?
6889 if (p->error_indicator) {
6890 D(p->level--);
6891 return NULL;
6892 }
6893 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6894 void *_opt_var;
6895 UNUSED(_opt_var); // Silence compiler warnings
6896 expr_ty a;
6897 asdl_seq * b;
6898 if (
6899 (a = expression_rule(p)) // expression
6900 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006901 (b = _loop1_75_rule(p)) // ((',' expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006902 &&
6903 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6904 )
6905 {
6906 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6907 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6908 if (_token == NULL) {
6909 D(p->level--);
6910 return NULL;
6911 }
6912 int _end_lineno = _token->end_lineno;
6913 UNUSED(_end_lineno); // Only used by EXTRA macro
6914 int _end_col_offset = _token->end_col_offset;
6915 UNUSED(_end_col_offset); // Only used by EXTRA macro
6916 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
6917 if (_res == NULL && PyErr_Occurred()) {
6918 p->error_indicator = 1;
6919 D(p->level--);
6920 return NULL;
6921 }
6922 goto done;
6923 }
6924 p->mark = _mark;
6925 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6926 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
6927 }
6928 { // expression ','
6929 if (p->error_indicator) {
6930 D(p->level--);
6931 return NULL;
6932 }
6933 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
6934 Token * _literal;
6935 expr_ty a;
6936 if (
6937 (a = expression_rule(p)) // expression
6938 &&
6939 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6940 )
6941 {
6942 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
6943 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6944 if (_token == NULL) {
6945 D(p->level--);
6946 return NULL;
6947 }
6948 int _end_lineno = _token->end_lineno;
6949 UNUSED(_end_lineno); // Only used by EXTRA macro
6950 int _end_col_offset = _token->end_col_offset;
6951 UNUSED(_end_col_offset); // Only used by EXTRA macro
6952 _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
6953 if (_res == NULL && PyErr_Occurred()) {
6954 p->error_indicator = 1;
6955 D(p->level--);
6956 return NULL;
6957 }
6958 goto done;
6959 }
6960 p->mark = _mark;
6961 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6962 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
6963 }
6964 { // expression
6965 if (p->error_indicator) {
6966 D(p->level--);
6967 return NULL;
6968 }
6969 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6970 expr_ty expression_var;
6971 if (
6972 (expression_var = expression_rule(p)) // expression
6973 )
6974 {
6975 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6976 _res = expression_var;
6977 goto done;
6978 }
6979 p->mark = _mark;
6980 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6981 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6982 }
6983 _res = NULL;
6984 done:
6985 D(p->level--);
6986 return _res;
6987}
6988
6989// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
6990static expr_ty
6991expression_rule(Parser *p)
6992{
6993 D(p->level++);
6994 if (p->error_indicator) {
6995 D(p->level--);
6996 return NULL;
6997 }
6998 expr_ty _res = NULL;
6999 if (_PyPegen_is_memoized(p, expression_type, &_res)) {
7000 D(p->level--);
7001 return _res;
7002 }
7003 int _mark = p->mark;
7004 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7005 p->error_indicator = 1;
7006 D(p->level--);
7007 return NULL;
7008 }
7009 int _start_lineno = p->tokens[_mark]->lineno;
7010 UNUSED(_start_lineno); // Only used by EXTRA macro
7011 int _start_col_offset = p->tokens[_mark]->col_offset;
7012 UNUSED(_start_col_offset); // Only used by EXTRA macro
7013 { // disjunction 'if' disjunction 'else' expression
7014 if (p->error_indicator) {
7015 D(p->level--);
7016 return NULL;
7017 }
7018 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7019 Token * _keyword;
7020 Token * _keyword_1;
7021 expr_ty a;
7022 expr_ty b;
7023 expr_ty c;
7024 if (
7025 (a = disjunction_rule(p)) // disjunction
7026 &&
7027 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
7028 &&
7029 (b = disjunction_rule(p)) // disjunction
7030 &&
7031 (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else'
7032 &&
7033 (c = expression_rule(p)) // expression
7034 )
7035 {
7036 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7037 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7038 if (_token == NULL) {
7039 D(p->level--);
7040 return NULL;
7041 }
7042 int _end_lineno = _token->end_lineno;
7043 UNUSED(_end_lineno); // Only used by EXTRA macro
7044 int _end_col_offset = _token->end_col_offset;
7045 UNUSED(_end_col_offset); // Only used by EXTRA macro
7046 _res = _Py_IfExp ( b , a , c , EXTRA );
7047 if (_res == NULL && PyErr_Occurred()) {
7048 p->error_indicator = 1;
7049 D(p->level--);
7050 return NULL;
7051 }
7052 goto done;
7053 }
7054 p->mark = _mark;
7055 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7056 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7057 }
7058 { // disjunction
7059 if (p->error_indicator) {
7060 D(p->level--);
7061 return NULL;
7062 }
7063 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
7064 expr_ty disjunction_var;
7065 if (
7066 (disjunction_var = disjunction_rule(p)) // disjunction
7067 )
7068 {
7069 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
7070 _res = disjunction_var;
7071 goto done;
7072 }
7073 p->mark = _mark;
7074 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7075 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
7076 }
7077 { // lambdef
7078 if (p->error_indicator) {
7079 D(p->level--);
7080 return NULL;
7081 }
7082 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
7083 expr_ty lambdef_var;
7084 if (
7085 (lambdef_var = lambdef_rule(p)) // lambdef
7086 )
7087 {
7088 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
7089 _res = lambdef_var;
7090 goto done;
7091 }
7092 p->mark = _mark;
7093 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7094 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
7095 }
7096 _res = NULL;
7097 done:
7098 _PyPegen_insert_memo(p, _mark, expression_type, _res);
7099 D(p->level--);
7100 return _res;
7101}
7102
7103// lambdef: 'lambda' lambda_params? ':' expression
7104static expr_ty
7105lambdef_rule(Parser *p)
7106{
7107 D(p->level++);
7108 if (p->error_indicator) {
7109 D(p->level--);
7110 return NULL;
7111 }
7112 expr_ty _res = NULL;
7113 int _mark = p->mark;
7114 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7115 p->error_indicator = 1;
7116 D(p->level--);
7117 return NULL;
7118 }
7119 int _start_lineno = p->tokens[_mark]->lineno;
7120 UNUSED(_start_lineno); // Only used by EXTRA macro
7121 int _start_col_offset = p->tokens[_mark]->col_offset;
7122 UNUSED(_start_col_offset); // Only used by EXTRA macro
7123 { // 'lambda' lambda_params? ':' expression
7124 if (p->error_indicator) {
7125 D(p->level--);
7126 return NULL;
7127 }
7128 D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7129 Token * _keyword;
7130 Token * _literal;
7131 void *a;
7132 expr_ty b;
7133 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007134 (_keyword = _PyPegen_expect_token(p, 525)) // token='lambda'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007135 &&
7136 (a = lambda_params_rule(p), 1) // lambda_params?
7137 &&
7138 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
7139 &&
7140 (b = expression_rule(p)) // expression
7141 )
7142 {
7143 D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7144 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7145 if (_token == NULL) {
7146 D(p->level--);
7147 return NULL;
7148 }
7149 int _end_lineno = _token->end_lineno;
7150 UNUSED(_end_lineno); // Only used by EXTRA macro
7151 int _end_col_offset = _token->end_col_offset;
7152 UNUSED(_end_col_offset); // Only used by EXTRA macro
7153 _res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
7154 if (_res == NULL && PyErr_Occurred()) {
7155 p->error_indicator = 1;
7156 D(p->level--);
7157 return NULL;
7158 }
7159 goto done;
7160 }
7161 p->mark = _mark;
7162 D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
7163 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7164 }
7165 _res = NULL;
7166 done:
7167 D(p->level--);
7168 return _res;
7169}
7170
7171// lambda_params: invalid_lambda_parameters | lambda_parameters
7172static arguments_ty
7173lambda_params_rule(Parser *p)
7174{
7175 D(p->level++);
7176 if (p->error_indicator) {
7177 D(p->level--);
7178 return NULL;
7179 }
7180 arguments_ty _res = NULL;
7181 int _mark = p->mark;
7182 { // invalid_lambda_parameters
7183 if (p->error_indicator) {
7184 D(p->level--);
7185 return NULL;
7186 }
7187 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7188 void *invalid_lambda_parameters_var;
7189 if (
7190 (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
7191 )
7192 {
7193 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7194 _res = invalid_lambda_parameters_var;
7195 goto done;
7196 }
7197 p->mark = _mark;
7198 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7199 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
7200 }
7201 { // lambda_parameters
7202 if (p->error_indicator) {
7203 D(p->level--);
7204 return NULL;
7205 }
7206 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7207 arguments_ty lambda_parameters_var;
7208 if (
7209 (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
7210 )
7211 {
7212 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7213 _res = lambda_parameters_var;
7214 goto done;
7215 }
7216 p->mark = _mark;
7217 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7218 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
7219 }
7220 _res = NULL;
7221 done:
7222 D(p->level--);
7223 return _res;
7224}
7225
7226// lambda_parameters:
7227// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7228// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7229// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7230// | lambda_param_with_default+ lambda_star_etc?
7231// | lambda_star_etc
7232static arguments_ty
7233lambda_parameters_rule(Parser *p)
7234{
7235 D(p->level++);
7236 if (p->error_indicator) {
7237 D(p->level--);
7238 return NULL;
7239 }
7240 arguments_ty _res = NULL;
7241 int _mark = p->mark;
7242 { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7243 if (p->error_indicator) {
7244 D(p->level--);
7245 return NULL;
7246 }
7247 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
7248 asdl_seq* a;
7249 asdl_seq * b;
7250 asdl_seq * c;
7251 void *d;
7252 if (
7253 (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
7254 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007255 (b = _loop0_76_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007256 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007257 (c = _loop0_77_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007258 &&
7259 (d = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7260 )
7261 {
7262 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
7263 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
7264 if (_res == NULL && PyErr_Occurred()) {
7265 p->error_indicator = 1;
7266 D(p->level--);
7267 return NULL;
7268 }
7269 goto done;
7270 }
7271 p->mark = _mark;
7272 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7273 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
7274 }
7275 { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7276 if (p->error_indicator) {
7277 D(p->level--);
7278 return NULL;
7279 }
7280 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
7281 SlashWithDefault* a;
7282 asdl_seq * b;
7283 void *c;
7284 if (
7285 (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
7286 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007287 (b = _loop0_78_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007288 &&
7289 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7290 )
7291 {
7292 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
7293 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
7294 if (_res == NULL && PyErr_Occurred()) {
7295 p->error_indicator = 1;
7296 D(p->level--);
7297 return NULL;
7298 }
7299 goto done;
7300 }
7301 p->mark = _mark;
7302 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7303 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
7304 }
7305 { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7306 if (p->error_indicator) {
7307 D(p->level--);
7308 return NULL;
7309 }
7310 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
7311 asdl_seq * a;
7312 asdl_seq * b;
7313 void *c;
7314 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007315 (a = _loop1_79_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007316 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007317 (b = _loop0_80_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007318 &&
7319 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7320 )
7321 {
7322 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
7323 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
7324 if (_res == NULL && PyErr_Occurred()) {
7325 p->error_indicator = 1;
7326 D(p->level--);
7327 return NULL;
7328 }
7329 goto done;
7330 }
7331 p->mark = _mark;
7332 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7333 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
7334 }
7335 { // lambda_param_with_default+ lambda_star_etc?
7336 if (p->error_indicator) {
7337 D(p->level--);
7338 return NULL;
7339 }
7340 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7341 asdl_seq * a;
7342 void *b;
7343 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007344 (a = _loop1_81_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007345 &&
7346 (b = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7347 )
7348 {
7349 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7350 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
7351 if (_res == NULL && PyErr_Occurred()) {
7352 p->error_indicator = 1;
7353 D(p->level--);
7354 return NULL;
7355 }
7356 goto done;
7357 }
7358 p->mark = _mark;
7359 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7360 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7361 }
7362 { // lambda_star_etc
7363 if (p->error_indicator) {
7364 D(p->level--);
7365 return NULL;
7366 }
7367 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7368 StarEtc* a;
7369 if (
7370 (a = lambda_star_etc_rule(p)) // lambda_star_etc
7371 )
7372 {
7373 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7374 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
7375 if (_res == NULL && PyErr_Occurred()) {
7376 p->error_indicator = 1;
7377 D(p->level--);
7378 return NULL;
7379 }
7380 goto done;
7381 }
7382 p->mark = _mark;
7383 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7384 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
7385 }
7386 _res = NULL;
7387 done:
7388 D(p->level--);
7389 return _res;
7390}
7391
7392// lambda_slash_no_default:
7393// | lambda_param_no_default+ '/' ','
7394// | lambda_param_no_default+ '/' &':'
7395static asdl_seq*
7396lambda_slash_no_default_rule(Parser *p)
7397{
7398 D(p->level++);
7399 if (p->error_indicator) {
7400 D(p->level--);
7401 return NULL;
7402 }
7403 asdl_seq* _res = NULL;
7404 int _mark = p->mark;
7405 { // lambda_param_no_default+ '/' ','
7406 if (p->error_indicator) {
7407 D(p->level--);
7408 return NULL;
7409 }
7410 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7411 Token * _literal;
7412 Token * _literal_1;
7413 asdl_seq * a;
7414 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007415 (a = _loop1_82_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007416 &&
7417 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7418 &&
7419 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7420 )
7421 {
7422 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7423 _res = a;
7424 if (_res == NULL && PyErr_Occurred()) {
7425 p->error_indicator = 1;
7426 D(p->level--);
7427 return NULL;
7428 }
7429 goto done;
7430 }
7431 p->mark = _mark;
7432 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7433 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7434 }
7435 { // lambda_param_no_default+ '/' &':'
7436 if (p->error_indicator) {
7437 D(p->level--);
7438 return NULL;
7439 }
7440 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7441 Token * _literal;
7442 asdl_seq * a;
7443 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007444 (a = _loop1_83_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007445 &&
7446 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7447 &&
7448 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7449 )
7450 {
7451 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7452 _res = a;
7453 if (_res == NULL && PyErr_Occurred()) {
7454 p->error_indicator = 1;
7455 D(p->level--);
7456 return NULL;
7457 }
7458 goto done;
7459 }
7460 p->mark = _mark;
7461 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7462 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7463 }
7464 _res = NULL;
7465 done:
7466 D(p->level--);
7467 return _res;
7468}
7469
7470// lambda_slash_with_default:
7471// | lambda_param_no_default* lambda_param_with_default+ '/' ','
7472// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
7473static SlashWithDefault*
7474lambda_slash_with_default_rule(Parser *p)
7475{
7476 D(p->level++);
7477 if (p->error_indicator) {
7478 D(p->level--);
7479 return NULL;
7480 }
7481 SlashWithDefault* _res = NULL;
7482 int _mark = p->mark;
7483 { // lambda_param_no_default* lambda_param_with_default+ '/' ','
7484 if (p->error_indicator) {
7485 D(p->level--);
7486 return NULL;
7487 }
7488 D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
7489 Token * _literal;
7490 Token * _literal_1;
7491 asdl_seq * a;
7492 asdl_seq * b;
7493 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007494 (a = _loop0_84_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007495 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007496 (b = _loop1_85_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007497 &&
7498 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7499 &&
7500 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7501 )
7502 {
7503 D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
7504 _res = _PyPegen_slash_with_default ( p , a , b );
7505 if (_res == NULL && PyErr_Occurred()) {
7506 p->error_indicator = 1;
7507 D(p->level--);
7508 return NULL;
7509 }
7510 goto done;
7511 }
7512 p->mark = _mark;
7513 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7514 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
7515 }
7516 { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
7517 if (p->error_indicator) {
7518 D(p->level--);
7519 return NULL;
7520 }
7521 D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
7522 Token * _literal;
7523 asdl_seq * a;
7524 asdl_seq * b;
7525 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007526 (a = _loop0_86_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007527 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007528 (b = _loop1_87_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007529 &&
7530 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7531 &&
7532 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7533 )
7534 {
7535 D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
7536 _res = _PyPegen_slash_with_default ( p , a , b );
7537 if (_res == NULL && PyErr_Occurred()) {
7538 p->error_indicator = 1;
7539 D(p->level--);
7540 return NULL;
7541 }
7542 goto done;
7543 }
7544 p->mark = _mark;
7545 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7546 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
7547 }
7548 _res = NULL;
7549 done:
7550 D(p->level--);
7551 return _res;
7552}
7553
7554// lambda_star_etc:
7555// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7556// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
7557// | lambda_kwds
7558// | invalid_lambda_star_etc
7559static StarEtc*
7560lambda_star_etc_rule(Parser *p)
7561{
7562 D(p->level++);
7563 if (p->error_indicator) {
7564 D(p->level--);
7565 return NULL;
7566 }
7567 StarEtc* _res = NULL;
7568 int _mark = p->mark;
7569 { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7570 if (p->error_indicator) {
7571 D(p->level--);
7572 return NULL;
7573 }
7574 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
7575 Token * _literal;
7576 arg_ty a;
7577 asdl_seq * b;
7578 void *c;
7579 if (
7580 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7581 &&
7582 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7583 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007584 (b = _loop0_88_rule(p)) // lambda_param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007585 &&
7586 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7587 )
7588 {
7589 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
7590 _res = _PyPegen_star_etc ( p , a , b , c );
7591 if (_res == NULL && PyErr_Occurred()) {
7592 p->error_indicator = 1;
7593 D(p->level--);
7594 return NULL;
7595 }
7596 goto done;
7597 }
7598 p->mark = _mark;
7599 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7600 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
7601 }
7602 { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
7603 if (p->error_indicator) {
7604 D(p->level--);
7605 return NULL;
7606 }
7607 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7608 Token * _literal;
7609 Token * _literal_1;
7610 asdl_seq * b;
7611 void *c;
7612 if (
7613 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7614 &&
7615 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7616 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007617 (b = _loop1_89_rule(p)) // lambda_param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007618 &&
7619 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7620 )
7621 {
7622 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7623 _res = _PyPegen_star_etc ( p , NULL , b , c );
7624 if (_res == NULL && PyErr_Occurred()) {
7625 p->error_indicator = 1;
7626 D(p->level--);
7627 return NULL;
7628 }
7629 goto done;
7630 }
7631 p->mark = _mark;
7632 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7633 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7634 }
7635 { // lambda_kwds
7636 if (p->error_indicator) {
7637 D(p->level--);
7638 return NULL;
7639 }
7640 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7641 arg_ty a;
7642 if (
7643 (a = lambda_kwds_rule(p)) // lambda_kwds
7644 )
7645 {
7646 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7647 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
7648 if (_res == NULL && PyErr_Occurred()) {
7649 p->error_indicator = 1;
7650 D(p->level--);
7651 return NULL;
7652 }
7653 goto done;
7654 }
7655 p->mark = _mark;
7656 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7657 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
7658 }
7659 { // invalid_lambda_star_etc
7660 if (p->error_indicator) {
7661 D(p->level--);
7662 return NULL;
7663 }
7664 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7665 void *invalid_lambda_star_etc_var;
7666 if (
7667 (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
7668 )
7669 {
7670 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7671 _res = invalid_lambda_star_etc_var;
7672 goto done;
7673 }
7674 p->mark = _mark;
7675 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7676 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
7677 }
7678 _res = NULL;
7679 done:
7680 D(p->level--);
7681 return _res;
7682}
7683
7684// lambda_kwds: '**' lambda_param_no_default
7685static arg_ty
7686lambda_kwds_rule(Parser *p)
7687{
7688 D(p->level++);
7689 if (p->error_indicator) {
7690 D(p->level--);
7691 return NULL;
7692 }
7693 arg_ty _res = NULL;
7694 int _mark = p->mark;
7695 { // '**' lambda_param_no_default
7696 if (p->error_indicator) {
7697 D(p->level--);
7698 return NULL;
7699 }
7700 D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7701 Token * _literal;
7702 arg_ty a;
7703 if (
7704 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
7705 &&
7706 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7707 )
7708 {
7709 D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7710 _res = a;
7711 if (_res == NULL && PyErr_Occurred()) {
7712 p->error_indicator = 1;
7713 D(p->level--);
7714 return NULL;
7715 }
7716 goto done;
7717 }
7718 p->mark = _mark;
7719 D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
7720 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
7721 }
7722 _res = NULL;
7723 done:
7724 D(p->level--);
7725 return _res;
7726}
7727
7728// lambda_param_no_default: lambda_param ',' | lambda_param &':'
7729static arg_ty
7730lambda_param_no_default_rule(Parser *p)
7731{
7732 D(p->level++);
7733 if (p->error_indicator) {
7734 D(p->level--);
7735 return NULL;
7736 }
7737 arg_ty _res = NULL;
7738 int _mark = p->mark;
7739 { // lambda_param ','
7740 if (p->error_indicator) {
7741 D(p->level--);
7742 return NULL;
7743 }
7744 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7745 Token * _literal;
7746 arg_ty a;
7747 if (
7748 (a = lambda_param_rule(p)) // lambda_param
7749 &&
7750 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7751 )
7752 {
7753 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7754 _res = a;
7755 if (_res == NULL && PyErr_Occurred()) {
7756 p->error_indicator = 1;
7757 D(p->level--);
7758 return NULL;
7759 }
7760 goto done;
7761 }
7762 p->mark = _mark;
7763 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7764 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
7765 }
7766 { // lambda_param &':'
7767 if (p->error_indicator) {
7768 D(p->level--);
7769 return NULL;
7770 }
7771 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7772 arg_ty a;
7773 if (
7774 (a = lambda_param_rule(p)) // lambda_param
7775 &&
7776 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7777 )
7778 {
7779 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7780 _res = a;
7781 if (_res == NULL && PyErr_Occurred()) {
7782 p->error_indicator = 1;
7783 D(p->level--);
7784 return NULL;
7785 }
7786 goto done;
7787 }
7788 p->mark = _mark;
7789 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7790 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
7791 }
7792 _res = NULL;
7793 done:
7794 D(p->level--);
7795 return _res;
7796}
7797
7798// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
7799static NameDefaultPair*
7800lambda_param_with_default_rule(Parser *p)
7801{
7802 D(p->level++);
7803 if (p->error_indicator) {
7804 D(p->level--);
7805 return NULL;
7806 }
7807 NameDefaultPair* _res = NULL;
7808 int _mark = p->mark;
7809 { // lambda_param default ','
7810 if (p->error_indicator) {
7811 D(p->level--);
7812 return NULL;
7813 }
7814 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7815 Token * _literal;
7816 arg_ty a;
7817 expr_ty c;
7818 if (
7819 (a = lambda_param_rule(p)) // lambda_param
7820 &&
7821 (c = default_rule(p)) // default
7822 &&
7823 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7824 )
7825 {
7826 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7827 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7828 if (_res == NULL && PyErr_Occurred()) {
7829 p->error_indicator = 1;
7830 D(p->level--);
7831 return NULL;
7832 }
7833 goto done;
7834 }
7835 p->mark = _mark;
7836 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7837 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
7838 }
7839 { // lambda_param default &':'
7840 if (p->error_indicator) {
7841 D(p->level--);
7842 return NULL;
7843 }
7844 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7845 arg_ty a;
7846 expr_ty c;
7847 if (
7848 (a = lambda_param_rule(p)) // lambda_param
7849 &&
7850 (c = default_rule(p)) // default
7851 &&
7852 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7853 )
7854 {
7855 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7856 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7857 if (_res == NULL && PyErr_Occurred()) {
7858 p->error_indicator = 1;
7859 D(p->level--);
7860 return NULL;
7861 }
7862 goto done;
7863 }
7864 p->mark = _mark;
7865 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7866 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
7867 }
7868 _res = NULL;
7869 done:
7870 D(p->level--);
7871 return _res;
7872}
7873
7874// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
7875static NameDefaultPair*
7876lambda_param_maybe_default_rule(Parser *p)
7877{
7878 D(p->level++);
7879 if (p->error_indicator) {
7880 D(p->level--);
7881 return NULL;
7882 }
7883 NameDefaultPair* _res = NULL;
7884 int _mark = p->mark;
7885 { // lambda_param default? ','
7886 if (p->error_indicator) {
7887 D(p->level--);
7888 return NULL;
7889 }
7890 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7891 Token * _literal;
7892 arg_ty a;
7893 void *c;
7894 if (
7895 (a = lambda_param_rule(p)) // lambda_param
7896 &&
7897 (c = default_rule(p), 1) // default?
7898 &&
7899 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7900 )
7901 {
7902 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7903 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7904 if (_res == NULL && PyErr_Occurred()) {
7905 p->error_indicator = 1;
7906 D(p->level--);
7907 return NULL;
7908 }
7909 goto done;
7910 }
7911 p->mark = _mark;
7912 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7913 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
7914 }
7915 { // lambda_param default? &':'
7916 if (p->error_indicator) {
7917 D(p->level--);
7918 return NULL;
7919 }
7920 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7921 arg_ty a;
7922 void *c;
7923 if (
7924 (a = lambda_param_rule(p)) // lambda_param
7925 &&
7926 (c = default_rule(p), 1) // default?
7927 &&
7928 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7929 )
7930 {
7931 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7932 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7933 if (_res == NULL && PyErr_Occurred()) {
7934 p->error_indicator = 1;
7935 D(p->level--);
7936 return NULL;
7937 }
7938 goto done;
7939 }
7940 p->mark = _mark;
7941 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7942 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
7943 }
7944 _res = NULL;
7945 done:
7946 D(p->level--);
7947 return _res;
7948}
7949
7950// lambda_param: NAME
7951static arg_ty
7952lambda_param_rule(Parser *p)
7953{
7954 D(p->level++);
7955 if (p->error_indicator) {
7956 D(p->level--);
7957 return NULL;
7958 }
7959 arg_ty _res = NULL;
7960 int _mark = p->mark;
7961 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7962 p->error_indicator = 1;
7963 D(p->level--);
7964 return NULL;
7965 }
7966 int _start_lineno = p->tokens[_mark]->lineno;
7967 UNUSED(_start_lineno); // Only used by EXTRA macro
7968 int _start_col_offset = p->tokens[_mark]->col_offset;
7969 UNUSED(_start_col_offset); // Only used by EXTRA macro
7970 { // NAME
7971 if (p->error_indicator) {
7972 D(p->level--);
7973 return NULL;
7974 }
7975 D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
7976 expr_ty a;
7977 if (
7978 (a = _PyPegen_name_token(p)) // NAME
7979 )
7980 {
7981 D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
7982 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7983 if (_token == NULL) {
7984 D(p->level--);
7985 return NULL;
7986 }
7987 int _end_lineno = _token->end_lineno;
7988 UNUSED(_end_lineno); // Only used by EXTRA macro
7989 int _end_col_offset = _token->end_col_offset;
7990 UNUSED(_end_col_offset); // Only used by EXTRA macro
7991 _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
7992 if (_res == NULL && PyErr_Occurred()) {
7993 p->error_indicator = 1;
7994 D(p->level--);
7995 return NULL;
7996 }
7997 goto done;
7998 }
7999 p->mark = _mark;
8000 D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
8001 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
8002 }
8003 _res = NULL;
8004 done:
8005 D(p->level--);
8006 return _res;
8007}
8008
8009// disjunction: conjunction (('or' conjunction))+ | conjunction
8010static expr_ty
8011disjunction_rule(Parser *p)
8012{
8013 D(p->level++);
8014 if (p->error_indicator) {
8015 D(p->level--);
8016 return NULL;
8017 }
8018 expr_ty _res = NULL;
8019 if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
8020 D(p->level--);
8021 return _res;
8022 }
8023 int _mark = p->mark;
8024 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8025 p->error_indicator = 1;
8026 D(p->level--);
8027 return NULL;
8028 }
8029 int _start_lineno = p->tokens[_mark]->lineno;
8030 UNUSED(_start_lineno); // Only used by EXTRA macro
8031 int _start_col_offset = p->tokens[_mark]->col_offset;
8032 UNUSED(_start_col_offset); // Only used by EXTRA macro
8033 { // conjunction (('or' conjunction))+
8034 if (p->error_indicator) {
8035 D(p->level--);
8036 return NULL;
8037 }
8038 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8039 expr_ty a;
8040 asdl_seq * b;
8041 if (
8042 (a = conjunction_rule(p)) // conjunction
8043 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008044 (b = _loop1_90_rule(p)) // (('or' conjunction))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008045 )
8046 {
8047 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8048 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8049 if (_token == NULL) {
8050 D(p->level--);
8051 return NULL;
8052 }
8053 int _end_lineno = _token->end_lineno;
8054 UNUSED(_end_lineno); // Only used by EXTRA macro
8055 int _end_col_offset = _token->end_col_offset;
8056 UNUSED(_end_col_offset); // Only used by EXTRA macro
8057 _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
8058 if (_res == NULL && PyErr_Occurred()) {
8059 p->error_indicator = 1;
8060 D(p->level--);
8061 return NULL;
8062 }
8063 goto done;
8064 }
8065 p->mark = _mark;
8066 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8067 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+"));
8068 }
8069 { // conjunction
8070 if (p->error_indicator) {
8071 D(p->level--);
8072 return NULL;
8073 }
8074 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
8075 expr_ty conjunction_var;
8076 if (
8077 (conjunction_var = conjunction_rule(p)) // conjunction
8078 )
8079 {
8080 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
8081 _res = conjunction_var;
8082 goto done;
8083 }
8084 p->mark = _mark;
8085 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8086 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
8087 }
8088 _res = NULL;
8089 done:
8090 _PyPegen_insert_memo(p, _mark, disjunction_type, _res);
8091 D(p->level--);
8092 return _res;
8093}
8094
8095// conjunction: inversion (('and' inversion))+ | inversion
8096static expr_ty
8097conjunction_rule(Parser *p)
8098{
8099 D(p->level++);
8100 if (p->error_indicator) {
8101 D(p->level--);
8102 return NULL;
8103 }
8104 expr_ty _res = NULL;
8105 if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
8106 D(p->level--);
8107 return _res;
8108 }
8109 int _mark = p->mark;
8110 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8111 p->error_indicator = 1;
8112 D(p->level--);
8113 return NULL;
8114 }
8115 int _start_lineno = p->tokens[_mark]->lineno;
8116 UNUSED(_start_lineno); // Only used by EXTRA macro
8117 int _start_col_offset = p->tokens[_mark]->col_offset;
8118 UNUSED(_start_col_offset); // Only used by EXTRA macro
8119 { // inversion (('and' inversion))+
8120 if (p->error_indicator) {
8121 D(p->level--);
8122 return NULL;
8123 }
8124 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8125 expr_ty a;
8126 asdl_seq * b;
8127 if (
8128 (a = inversion_rule(p)) // inversion
8129 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008130 (b = _loop1_91_rule(p)) // (('and' inversion))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008131 )
8132 {
8133 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8134 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8135 if (_token == NULL) {
8136 D(p->level--);
8137 return NULL;
8138 }
8139 int _end_lineno = _token->end_lineno;
8140 UNUSED(_end_lineno); // Only used by EXTRA macro
8141 int _end_col_offset = _token->end_col_offset;
8142 UNUSED(_end_col_offset); // Only used by EXTRA macro
8143 _res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
8144 if (_res == NULL && PyErr_Occurred()) {
8145 p->error_indicator = 1;
8146 D(p->level--);
8147 return NULL;
8148 }
8149 goto done;
8150 }
8151 p->mark = _mark;
8152 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8153 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+"));
8154 }
8155 { // inversion
8156 if (p->error_indicator) {
8157 D(p->level--);
8158 return NULL;
8159 }
8160 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
8161 expr_ty inversion_var;
8162 if (
8163 (inversion_var = inversion_rule(p)) // inversion
8164 )
8165 {
8166 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
8167 _res = inversion_var;
8168 goto done;
8169 }
8170 p->mark = _mark;
8171 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8172 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
8173 }
8174 _res = NULL;
8175 done:
8176 _PyPegen_insert_memo(p, _mark, conjunction_type, _res);
8177 D(p->level--);
8178 return _res;
8179}
8180
8181// inversion: 'not' inversion | comparison
8182static expr_ty
8183inversion_rule(Parser *p)
8184{
8185 D(p->level++);
8186 if (p->error_indicator) {
8187 D(p->level--);
8188 return NULL;
8189 }
8190 expr_ty _res = NULL;
8191 if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
8192 D(p->level--);
8193 return _res;
8194 }
8195 int _mark = p->mark;
8196 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8197 p->error_indicator = 1;
8198 D(p->level--);
8199 return NULL;
8200 }
8201 int _start_lineno = p->tokens[_mark]->lineno;
8202 UNUSED(_start_lineno); // Only used by EXTRA macro
8203 int _start_col_offset = p->tokens[_mark]->col_offset;
8204 UNUSED(_start_col_offset); // Only used by EXTRA macro
8205 { // 'not' inversion
8206 if (p->error_indicator) {
8207 D(p->level--);
8208 return NULL;
8209 }
8210 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8211 Token * _keyword;
8212 expr_ty a;
8213 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008214 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008215 &&
8216 (a = inversion_rule(p)) // inversion
8217 )
8218 {
8219 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8220 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8221 if (_token == NULL) {
8222 D(p->level--);
8223 return NULL;
8224 }
8225 int _end_lineno = _token->end_lineno;
8226 UNUSED(_end_lineno); // Only used by EXTRA macro
8227 int _end_col_offset = _token->end_col_offset;
8228 UNUSED(_end_col_offset); // Only used by EXTRA macro
8229 _res = _Py_UnaryOp ( Not , a , EXTRA );
8230 if (_res == NULL && PyErr_Occurred()) {
8231 p->error_indicator = 1;
8232 D(p->level--);
8233 return NULL;
8234 }
8235 goto done;
8236 }
8237 p->mark = _mark;
8238 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8239 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion"));
8240 }
8241 { // comparison
8242 if (p->error_indicator) {
8243 D(p->level--);
8244 return NULL;
8245 }
8246 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
8247 expr_ty comparison_var;
8248 if (
8249 (comparison_var = comparison_rule(p)) // comparison
8250 )
8251 {
8252 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
8253 _res = comparison_var;
8254 goto done;
8255 }
8256 p->mark = _mark;
8257 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8258 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
8259 }
8260 _res = NULL;
8261 done:
8262 _PyPegen_insert_memo(p, _mark, inversion_type, _res);
8263 D(p->level--);
8264 return _res;
8265}
8266
8267// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
8268static expr_ty
8269comparison_rule(Parser *p)
8270{
8271 D(p->level++);
8272 if (p->error_indicator) {
8273 D(p->level--);
8274 return NULL;
8275 }
8276 expr_ty _res = NULL;
8277 int _mark = p->mark;
8278 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8279 p->error_indicator = 1;
8280 D(p->level--);
8281 return NULL;
8282 }
8283 int _start_lineno = p->tokens[_mark]->lineno;
8284 UNUSED(_start_lineno); // Only used by EXTRA macro
8285 int _start_col_offset = p->tokens[_mark]->col_offset;
8286 UNUSED(_start_col_offset); // Only used by EXTRA macro
8287 { // bitwise_or compare_op_bitwise_or_pair+
8288 if (p->error_indicator) {
8289 D(p->level--);
8290 return NULL;
8291 }
8292 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8293 expr_ty a;
8294 asdl_seq * b;
8295 if (
8296 (a = bitwise_or_rule(p)) // bitwise_or
8297 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008298 (b = _loop1_92_rule(p)) // compare_op_bitwise_or_pair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008299 )
8300 {
8301 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8302 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8303 if (_token == NULL) {
8304 D(p->level--);
8305 return NULL;
8306 }
8307 int _end_lineno = _token->end_lineno;
8308 UNUSED(_end_lineno); // Only used by EXTRA macro
8309 int _end_col_offset = _token->end_col_offset;
8310 UNUSED(_end_col_offset); // Only used by EXTRA macro
8311 _res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA );
8312 if (_res == NULL && PyErr_Occurred()) {
8313 p->error_indicator = 1;
8314 D(p->level--);
8315 return NULL;
8316 }
8317 goto done;
8318 }
8319 p->mark = _mark;
8320 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8321 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8322 }
8323 { // bitwise_or
8324 if (p->error_indicator) {
8325 D(p->level--);
8326 return NULL;
8327 }
8328 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8329 expr_ty bitwise_or_var;
8330 if (
8331 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
8332 )
8333 {
8334 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8335 _res = bitwise_or_var;
8336 goto done;
8337 }
8338 p->mark = _mark;
8339 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8340 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
8341 }
8342 _res = NULL;
8343 done:
8344 D(p->level--);
8345 return _res;
8346}
8347
8348// compare_op_bitwise_or_pair:
8349// | eq_bitwise_or
8350// | noteq_bitwise_or
8351// | lte_bitwise_or
8352// | lt_bitwise_or
8353// | gte_bitwise_or
8354// | gt_bitwise_or
8355// | notin_bitwise_or
8356// | in_bitwise_or
8357// | isnot_bitwise_or
8358// | is_bitwise_or
8359static CmpopExprPair*
8360compare_op_bitwise_or_pair_rule(Parser *p)
8361{
8362 D(p->level++);
8363 if (p->error_indicator) {
8364 D(p->level--);
8365 return NULL;
8366 }
8367 CmpopExprPair* _res = NULL;
8368 int _mark = p->mark;
8369 { // eq_bitwise_or
8370 if (p->error_indicator) {
8371 D(p->level--);
8372 return NULL;
8373 }
8374 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8375 CmpopExprPair* eq_bitwise_or_var;
8376 if (
8377 (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or
8378 )
8379 {
8380 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8381 _res = eq_bitwise_or_var;
8382 goto done;
8383 }
8384 p->mark = _mark;
8385 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8386 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or"));
8387 }
8388 { // noteq_bitwise_or
8389 if (p->error_indicator) {
8390 D(p->level--);
8391 return NULL;
8392 }
8393 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8394 CmpopExprPair* noteq_bitwise_or_var;
8395 if (
8396 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or
8397 )
8398 {
8399 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8400 _res = noteq_bitwise_or_var;
8401 goto done;
8402 }
8403 p->mark = _mark;
8404 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8405 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or"));
8406 }
8407 { // lte_bitwise_or
8408 if (p->error_indicator) {
8409 D(p->level--);
8410 return NULL;
8411 }
8412 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8413 CmpopExprPair* lte_bitwise_or_var;
8414 if (
8415 (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or
8416 )
8417 {
8418 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8419 _res = lte_bitwise_or_var;
8420 goto done;
8421 }
8422 p->mark = _mark;
8423 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8424 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or"));
8425 }
8426 { // lt_bitwise_or
8427 if (p->error_indicator) {
8428 D(p->level--);
8429 return NULL;
8430 }
8431 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8432 CmpopExprPair* lt_bitwise_or_var;
8433 if (
8434 (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or
8435 )
8436 {
8437 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8438 _res = lt_bitwise_or_var;
8439 goto done;
8440 }
8441 p->mark = _mark;
8442 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8443 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or"));
8444 }
8445 { // gte_bitwise_or
8446 if (p->error_indicator) {
8447 D(p->level--);
8448 return NULL;
8449 }
8450 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8451 CmpopExprPair* gte_bitwise_or_var;
8452 if (
8453 (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or
8454 )
8455 {
8456 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8457 _res = gte_bitwise_or_var;
8458 goto done;
8459 }
8460 p->mark = _mark;
8461 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8462 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or"));
8463 }
8464 { // gt_bitwise_or
8465 if (p->error_indicator) {
8466 D(p->level--);
8467 return NULL;
8468 }
8469 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8470 CmpopExprPair* gt_bitwise_or_var;
8471 if (
8472 (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or
8473 )
8474 {
8475 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8476 _res = gt_bitwise_or_var;
8477 goto done;
8478 }
8479 p->mark = _mark;
8480 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8481 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or"));
8482 }
8483 { // notin_bitwise_or
8484 if (p->error_indicator) {
8485 D(p->level--);
8486 return NULL;
8487 }
8488 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8489 CmpopExprPair* notin_bitwise_or_var;
8490 if (
8491 (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or
8492 )
8493 {
8494 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8495 _res = notin_bitwise_or_var;
8496 goto done;
8497 }
8498 p->mark = _mark;
8499 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8500 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or"));
8501 }
8502 { // in_bitwise_or
8503 if (p->error_indicator) {
8504 D(p->level--);
8505 return NULL;
8506 }
8507 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8508 CmpopExprPair* in_bitwise_or_var;
8509 if (
8510 (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or
8511 )
8512 {
8513 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8514 _res = in_bitwise_or_var;
8515 goto done;
8516 }
8517 p->mark = _mark;
8518 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8519 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or"));
8520 }
8521 { // isnot_bitwise_or
8522 if (p->error_indicator) {
8523 D(p->level--);
8524 return NULL;
8525 }
8526 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8527 CmpopExprPair* isnot_bitwise_or_var;
8528 if (
8529 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or
8530 )
8531 {
8532 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8533 _res = isnot_bitwise_or_var;
8534 goto done;
8535 }
8536 p->mark = _mark;
8537 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8538 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or"));
8539 }
8540 { // is_bitwise_or
8541 if (p->error_indicator) {
8542 D(p->level--);
8543 return NULL;
8544 }
8545 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8546 CmpopExprPair* is_bitwise_or_var;
8547 if (
8548 (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or
8549 )
8550 {
8551 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8552 _res = is_bitwise_or_var;
8553 goto done;
8554 }
8555 p->mark = _mark;
8556 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8557 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
8558 }
8559 _res = NULL;
8560 done:
8561 D(p->level--);
8562 return _res;
8563}
8564
8565// eq_bitwise_or: '==' bitwise_or
8566static CmpopExprPair*
8567eq_bitwise_or_rule(Parser *p)
8568{
8569 D(p->level++);
8570 if (p->error_indicator) {
8571 D(p->level--);
8572 return NULL;
8573 }
8574 CmpopExprPair* _res = NULL;
8575 int _mark = p->mark;
8576 { // '==' bitwise_or
8577 if (p->error_indicator) {
8578 D(p->level--);
8579 return NULL;
8580 }
8581 D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8582 Token * _literal;
8583 expr_ty a;
8584 if (
8585 (_literal = _PyPegen_expect_token(p, 27)) // token='=='
8586 &&
8587 (a = bitwise_or_rule(p)) // bitwise_or
8588 )
8589 {
8590 D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8591 _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
8592 if (_res == NULL && PyErr_Occurred()) {
8593 p->error_indicator = 1;
8594 D(p->level--);
8595 return NULL;
8596 }
8597 goto done;
8598 }
8599 p->mark = _mark;
8600 D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8601 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
8602 }
8603 _res = NULL;
8604 done:
8605 D(p->level--);
8606 return _res;
8607}
8608
8609// noteq_bitwise_or: ('!=') bitwise_or
8610static CmpopExprPair*
8611noteq_bitwise_or_rule(Parser *p)
8612{
8613 D(p->level++);
8614 if (p->error_indicator) {
8615 D(p->level--);
8616 return NULL;
8617 }
8618 CmpopExprPair* _res = NULL;
8619 int _mark = p->mark;
8620 { // ('!=') bitwise_or
8621 if (p->error_indicator) {
8622 D(p->level--);
8623 return NULL;
8624 }
8625 D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008626 void *_tmp_93_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008627 expr_ty a;
8628 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008629 (_tmp_93_var = _tmp_93_rule(p)) // '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008630 &&
8631 (a = bitwise_or_rule(p)) // bitwise_or
8632 )
8633 {
8634 D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
8635 _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
8636 if (_res == NULL && PyErr_Occurred()) {
8637 p->error_indicator = 1;
8638 D(p->level--);
8639 return NULL;
8640 }
8641 goto done;
8642 }
8643 p->mark = _mark;
8644 D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8645 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
8646 }
8647 _res = NULL;
8648 done:
8649 D(p->level--);
8650 return _res;
8651}
8652
8653// lte_bitwise_or: '<=' bitwise_or
8654static CmpopExprPair*
8655lte_bitwise_or_rule(Parser *p)
8656{
8657 D(p->level++);
8658 if (p->error_indicator) {
8659 D(p->level--);
8660 return NULL;
8661 }
8662 CmpopExprPair* _res = NULL;
8663 int _mark = p->mark;
8664 { // '<=' bitwise_or
8665 if (p->error_indicator) {
8666 D(p->level--);
8667 return NULL;
8668 }
8669 D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8670 Token * _literal;
8671 expr_ty a;
8672 if (
8673 (_literal = _PyPegen_expect_token(p, 29)) // token='<='
8674 &&
8675 (a = bitwise_or_rule(p)) // bitwise_or
8676 )
8677 {
8678 D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8679 _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
8680 if (_res == NULL && PyErr_Occurred()) {
8681 p->error_indicator = 1;
8682 D(p->level--);
8683 return NULL;
8684 }
8685 goto done;
8686 }
8687 p->mark = _mark;
8688 D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8689 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
8690 }
8691 _res = NULL;
8692 done:
8693 D(p->level--);
8694 return _res;
8695}
8696
8697// lt_bitwise_or: '<' bitwise_or
8698static CmpopExprPair*
8699lt_bitwise_or_rule(Parser *p)
8700{
8701 D(p->level++);
8702 if (p->error_indicator) {
8703 D(p->level--);
8704 return NULL;
8705 }
8706 CmpopExprPair* _res = NULL;
8707 int _mark = p->mark;
8708 { // '<' bitwise_or
8709 if (p->error_indicator) {
8710 D(p->level--);
8711 return NULL;
8712 }
8713 D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8714 Token * _literal;
8715 expr_ty a;
8716 if (
8717 (_literal = _PyPegen_expect_token(p, 20)) // token='<'
8718 &&
8719 (a = bitwise_or_rule(p)) // bitwise_or
8720 )
8721 {
8722 D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8723 _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
8724 if (_res == NULL && PyErr_Occurred()) {
8725 p->error_indicator = 1;
8726 D(p->level--);
8727 return NULL;
8728 }
8729 goto done;
8730 }
8731 p->mark = _mark;
8732 D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8733 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
8734 }
8735 _res = NULL;
8736 done:
8737 D(p->level--);
8738 return _res;
8739}
8740
8741// gte_bitwise_or: '>=' bitwise_or
8742static CmpopExprPair*
8743gte_bitwise_or_rule(Parser *p)
8744{
8745 D(p->level++);
8746 if (p->error_indicator) {
8747 D(p->level--);
8748 return NULL;
8749 }
8750 CmpopExprPair* _res = NULL;
8751 int _mark = p->mark;
8752 { // '>=' bitwise_or
8753 if (p->error_indicator) {
8754 D(p->level--);
8755 return NULL;
8756 }
8757 D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8758 Token * _literal;
8759 expr_ty a;
8760 if (
8761 (_literal = _PyPegen_expect_token(p, 30)) // token='>='
8762 &&
8763 (a = bitwise_or_rule(p)) // bitwise_or
8764 )
8765 {
8766 D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8767 _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
8768 if (_res == NULL && PyErr_Occurred()) {
8769 p->error_indicator = 1;
8770 D(p->level--);
8771 return NULL;
8772 }
8773 goto done;
8774 }
8775 p->mark = _mark;
8776 D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8777 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
8778 }
8779 _res = NULL;
8780 done:
8781 D(p->level--);
8782 return _res;
8783}
8784
8785// gt_bitwise_or: '>' bitwise_or
8786static CmpopExprPair*
8787gt_bitwise_or_rule(Parser *p)
8788{
8789 D(p->level++);
8790 if (p->error_indicator) {
8791 D(p->level--);
8792 return NULL;
8793 }
8794 CmpopExprPair* _res = NULL;
8795 int _mark = p->mark;
8796 { // '>' bitwise_or
8797 if (p->error_indicator) {
8798 D(p->level--);
8799 return NULL;
8800 }
8801 D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8802 Token * _literal;
8803 expr_ty a;
8804 if (
8805 (_literal = _PyPegen_expect_token(p, 21)) // token='>'
8806 &&
8807 (a = bitwise_or_rule(p)) // bitwise_or
8808 )
8809 {
8810 D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8811 _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
8812 if (_res == NULL && PyErr_Occurred()) {
8813 p->error_indicator = 1;
8814 D(p->level--);
8815 return NULL;
8816 }
8817 goto done;
8818 }
8819 p->mark = _mark;
8820 D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8821 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
8822 }
8823 _res = NULL;
8824 done:
8825 D(p->level--);
8826 return _res;
8827}
8828
8829// notin_bitwise_or: 'not' 'in' bitwise_or
8830static CmpopExprPair*
8831notin_bitwise_or_rule(Parser *p)
8832{
8833 D(p->level++);
8834 if (p->error_indicator) {
8835 D(p->level--);
8836 return NULL;
8837 }
8838 CmpopExprPair* _res = NULL;
8839 int _mark = p->mark;
8840 { // 'not' 'in' bitwise_or
8841 if (p->error_indicator) {
8842 D(p->level--);
8843 return NULL;
8844 }
8845 D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8846 Token * _keyword;
8847 Token * _keyword_1;
8848 expr_ty a;
8849 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008850 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008851 &&
8852 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
8853 &&
8854 (a = bitwise_or_rule(p)) // bitwise_or
8855 )
8856 {
8857 D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8858 _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
8859 if (_res == NULL && PyErr_Occurred()) {
8860 p->error_indicator = 1;
8861 D(p->level--);
8862 return NULL;
8863 }
8864 goto done;
8865 }
8866 p->mark = _mark;
8867 D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8868 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
8869 }
8870 _res = NULL;
8871 done:
8872 D(p->level--);
8873 return _res;
8874}
8875
8876// in_bitwise_or: 'in' bitwise_or
8877static CmpopExprPair*
8878in_bitwise_or_rule(Parser *p)
8879{
8880 D(p->level++);
8881 if (p->error_indicator) {
8882 D(p->level--);
8883 return NULL;
8884 }
8885 CmpopExprPair* _res = NULL;
8886 int _mark = p->mark;
8887 { // 'in' bitwise_or
8888 if (p->error_indicator) {
8889 D(p->level--);
8890 return NULL;
8891 }
8892 D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8893 Token * _keyword;
8894 expr_ty a;
8895 if (
8896 (_keyword = _PyPegen_expect_token(p, 518)) // token='in'
8897 &&
8898 (a = bitwise_or_rule(p)) // bitwise_or
8899 )
8900 {
8901 D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8902 _res = _PyPegen_cmpop_expr_pair ( p , In , a );
8903 if (_res == NULL && PyErr_Occurred()) {
8904 p->error_indicator = 1;
8905 D(p->level--);
8906 return NULL;
8907 }
8908 goto done;
8909 }
8910 p->mark = _mark;
8911 D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8912 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
8913 }
8914 _res = NULL;
8915 done:
8916 D(p->level--);
8917 return _res;
8918}
8919
8920// isnot_bitwise_or: 'is' 'not' bitwise_or
8921static CmpopExprPair*
8922isnot_bitwise_or_rule(Parser *p)
8923{
8924 D(p->level++);
8925 if (p->error_indicator) {
8926 D(p->level--);
8927 return NULL;
8928 }
8929 CmpopExprPair* _res = NULL;
8930 int _mark = p->mark;
8931 { // 'is' 'not' bitwise_or
8932 if (p->error_indicator) {
8933 D(p->level--);
8934 return NULL;
8935 }
8936 D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8937 Token * _keyword;
8938 Token * _keyword_1;
8939 expr_ty a;
8940 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008941 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008942 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008943 (_keyword_1 = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008944 &&
8945 (a = bitwise_or_rule(p)) // bitwise_or
8946 )
8947 {
8948 D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8949 _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
8950 if (_res == NULL && PyErr_Occurred()) {
8951 p->error_indicator = 1;
8952 D(p->level--);
8953 return NULL;
8954 }
8955 goto done;
8956 }
8957 p->mark = _mark;
8958 D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8959 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
8960 }
8961 _res = NULL;
8962 done:
8963 D(p->level--);
8964 return _res;
8965}
8966
8967// is_bitwise_or: 'is' bitwise_or
8968static CmpopExprPair*
8969is_bitwise_or_rule(Parser *p)
8970{
8971 D(p->level++);
8972 if (p->error_indicator) {
8973 D(p->level--);
8974 return NULL;
8975 }
8976 CmpopExprPair* _res = NULL;
8977 int _mark = p->mark;
8978 { // 'is' bitwise_or
8979 if (p->error_indicator) {
8980 D(p->level--);
8981 return NULL;
8982 }
8983 D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
8984 Token * _keyword;
8985 expr_ty a;
8986 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008987 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008988 &&
8989 (a = bitwise_or_rule(p)) // bitwise_or
8990 )
8991 {
8992 D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
8993 _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
8994 if (_res == NULL && PyErr_Occurred()) {
8995 p->error_indicator = 1;
8996 D(p->level--);
8997 return NULL;
8998 }
8999 goto done;
9000 }
9001 p->mark = _mark;
9002 D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9003 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
9004 }
9005 _res = NULL;
9006 done:
9007 D(p->level--);
9008 return _res;
9009}
9010
9011// Left-recursive
9012// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
9013static expr_ty bitwise_or_raw(Parser *);
9014static expr_ty
9015bitwise_or_rule(Parser *p)
9016{
9017 D(p->level++);
9018 expr_ty _res = NULL;
9019 if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
9020 D(p->level--);
9021 return _res;
9022 }
9023 int _mark = p->mark;
9024 int _resmark = p->mark;
9025 while (1) {
9026 int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
9027 if (tmpvar_1) {
9028 D(p->level--);
9029 return _res;
9030 }
9031 p->mark = _mark;
9032 void *_raw = bitwise_or_raw(p);
9033 if (_raw == NULL || p->mark <= _resmark)
9034 break;
9035 _resmark = p->mark;
9036 _res = _raw;
9037 }
9038 p->mark = _resmark;
9039 D(p->level--);
9040 return _res;
9041}
9042static expr_ty
9043bitwise_or_raw(Parser *p)
9044{
9045 D(p->level++);
9046 if (p->error_indicator) {
9047 D(p->level--);
9048 return NULL;
9049 }
9050 expr_ty _res = NULL;
9051 int _mark = p->mark;
9052 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9053 p->error_indicator = 1;
9054 D(p->level--);
9055 return NULL;
9056 }
9057 int _start_lineno = p->tokens[_mark]->lineno;
9058 UNUSED(_start_lineno); // Only used by EXTRA macro
9059 int _start_col_offset = p->tokens[_mark]->col_offset;
9060 UNUSED(_start_col_offset); // Only used by EXTRA macro
9061 { // bitwise_or '|' bitwise_xor
9062 if (p->error_indicator) {
9063 D(p->level--);
9064 return NULL;
9065 }
9066 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9067 Token * _literal;
9068 expr_ty a;
9069 expr_ty b;
9070 if (
9071 (a = bitwise_or_rule(p)) // bitwise_or
9072 &&
9073 (_literal = _PyPegen_expect_token(p, 18)) // token='|'
9074 &&
9075 (b = bitwise_xor_rule(p)) // bitwise_xor
9076 )
9077 {
9078 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9079 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9080 if (_token == NULL) {
9081 D(p->level--);
9082 return NULL;
9083 }
9084 int _end_lineno = _token->end_lineno;
9085 UNUSED(_end_lineno); // Only used by EXTRA macro
9086 int _end_col_offset = _token->end_col_offset;
9087 UNUSED(_end_col_offset); // Only used by EXTRA macro
9088 _res = _Py_BinOp ( a , BitOr , b , EXTRA );
9089 if (_res == NULL && PyErr_Occurred()) {
9090 p->error_indicator = 1;
9091 D(p->level--);
9092 return NULL;
9093 }
9094 goto done;
9095 }
9096 p->mark = _mark;
9097 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9098 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9099 }
9100 { // bitwise_xor
9101 if (p->error_indicator) {
9102 D(p->level--);
9103 return NULL;
9104 }
9105 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9106 expr_ty bitwise_xor_var;
9107 if (
9108 (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor
9109 )
9110 {
9111 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9112 _res = bitwise_xor_var;
9113 goto done;
9114 }
9115 p->mark = _mark;
9116 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9117 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
9118 }
9119 _res = NULL;
9120 done:
9121 D(p->level--);
9122 return _res;
9123}
9124
9125// Left-recursive
9126// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
9127static expr_ty bitwise_xor_raw(Parser *);
9128static expr_ty
9129bitwise_xor_rule(Parser *p)
9130{
9131 D(p->level++);
9132 expr_ty _res = NULL;
9133 if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
9134 D(p->level--);
9135 return _res;
9136 }
9137 int _mark = p->mark;
9138 int _resmark = p->mark;
9139 while (1) {
9140 int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
9141 if (tmpvar_2) {
9142 D(p->level--);
9143 return _res;
9144 }
9145 p->mark = _mark;
9146 void *_raw = bitwise_xor_raw(p);
9147 if (_raw == NULL || p->mark <= _resmark)
9148 break;
9149 _resmark = p->mark;
9150 _res = _raw;
9151 }
9152 p->mark = _resmark;
9153 D(p->level--);
9154 return _res;
9155}
9156static expr_ty
9157bitwise_xor_raw(Parser *p)
9158{
9159 D(p->level++);
9160 if (p->error_indicator) {
9161 D(p->level--);
9162 return NULL;
9163 }
9164 expr_ty _res = NULL;
9165 int _mark = p->mark;
9166 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9167 p->error_indicator = 1;
9168 D(p->level--);
9169 return NULL;
9170 }
9171 int _start_lineno = p->tokens[_mark]->lineno;
9172 UNUSED(_start_lineno); // Only used by EXTRA macro
9173 int _start_col_offset = p->tokens[_mark]->col_offset;
9174 UNUSED(_start_col_offset); // Only used by EXTRA macro
9175 { // bitwise_xor '^' bitwise_and
9176 if (p->error_indicator) {
9177 D(p->level--);
9178 return NULL;
9179 }
9180 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9181 Token * _literal;
9182 expr_ty a;
9183 expr_ty b;
9184 if (
9185 (a = bitwise_xor_rule(p)) // bitwise_xor
9186 &&
9187 (_literal = _PyPegen_expect_token(p, 32)) // token='^'
9188 &&
9189 (b = bitwise_and_rule(p)) // bitwise_and
9190 )
9191 {
9192 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9193 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9194 if (_token == NULL) {
9195 D(p->level--);
9196 return NULL;
9197 }
9198 int _end_lineno = _token->end_lineno;
9199 UNUSED(_end_lineno); // Only used by EXTRA macro
9200 int _end_col_offset = _token->end_col_offset;
9201 UNUSED(_end_col_offset); // Only used by EXTRA macro
9202 _res = _Py_BinOp ( a , BitXor , b , EXTRA );
9203 if (_res == NULL && PyErr_Occurred()) {
9204 p->error_indicator = 1;
9205 D(p->level--);
9206 return NULL;
9207 }
9208 goto done;
9209 }
9210 p->mark = _mark;
9211 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9212 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9213 }
9214 { // bitwise_and
9215 if (p->error_indicator) {
9216 D(p->level--);
9217 return NULL;
9218 }
9219 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9220 expr_ty bitwise_and_var;
9221 if (
9222 (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and
9223 )
9224 {
9225 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9226 _res = bitwise_and_var;
9227 goto done;
9228 }
9229 p->mark = _mark;
9230 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9231 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
9232 }
9233 _res = NULL;
9234 done:
9235 D(p->level--);
9236 return _res;
9237}
9238
9239// Left-recursive
9240// bitwise_and: bitwise_and '&' shift_expr | shift_expr
9241static expr_ty bitwise_and_raw(Parser *);
9242static expr_ty
9243bitwise_and_rule(Parser *p)
9244{
9245 D(p->level++);
9246 expr_ty _res = NULL;
9247 if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
9248 D(p->level--);
9249 return _res;
9250 }
9251 int _mark = p->mark;
9252 int _resmark = p->mark;
9253 while (1) {
9254 int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
9255 if (tmpvar_3) {
9256 D(p->level--);
9257 return _res;
9258 }
9259 p->mark = _mark;
9260 void *_raw = bitwise_and_raw(p);
9261 if (_raw == NULL || p->mark <= _resmark)
9262 break;
9263 _resmark = p->mark;
9264 _res = _raw;
9265 }
9266 p->mark = _resmark;
9267 D(p->level--);
9268 return _res;
9269}
9270static expr_ty
9271bitwise_and_raw(Parser *p)
9272{
9273 D(p->level++);
9274 if (p->error_indicator) {
9275 D(p->level--);
9276 return NULL;
9277 }
9278 expr_ty _res = NULL;
9279 int _mark = p->mark;
9280 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9281 p->error_indicator = 1;
9282 D(p->level--);
9283 return NULL;
9284 }
9285 int _start_lineno = p->tokens[_mark]->lineno;
9286 UNUSED(_start_lineno); // Only used by EXTRA macro
9287 int _start_col_offset = p->tokens[_mark]->col_offset;
9288 UNUSED(_start_col_offset); // Only used by EXTRA macro
9289 { // bitwise_and '&' shift_expr
9290 if (p->error_indicator) {
9291 D(p->level--);
9292 return NULL;
9293 }
9294 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9295 Token * _literal;
9296 expr_ty a;
9297 expr_ty b;
9298 if (
9299 (a = bitwise_and_rule(p)) // bitwise_and
9300 &&
9301 (_literal = _PyPegen_expect_token(p, 19)) // token='&'
9302 &&
9303 (b = shift_expr_rule(p)) // shift_expr
9304 )
9305 {
9306 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9307 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9308 if (_token == NULL) {
9309 D(p->level--);
9310 return NULL;
9311 }
9312 int _end_lineno = _token->end_lineno;
9313 UNUSED(_end_lineno); // Only used by EXTRA macro
9314 int _end_col_offset = _token->end_col_offset;
9315 UNUSED(_end_col_offset); // Only used by EXTRA macro
9316 _res = _Py_BinOp ( a , BitAnd , b , EXTRA );
9317 if (_res == NULL && PyErr_Occurred()) {
9318 p->error_indicator = 1;
9319 D(p->level--);
9320 return NULL;
9321 }
9322 goto done;
9323 }
9324 p->mark = _mark;
9325 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9326 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr"));
9327 }
9328 { // shift_expr
9329 if (p->error_indicator) {
9330 D(p->level--);
9331 return NULL;
9332 }
9333 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9334 expr_ty shift_expr_var;
9335 if (
9336 (shift_expr_var = shift_expr_rule(p)) // shift_expr
9337 )
9338 {
9339 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9340 _res = shift_expr_var;
9341 goto done;
9342 }
9343 p->mark = _mark;
9344 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9345 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
9346 }
9347 _res = NULL;
9348 done:
9349 D(p->level--);
9350 return _res;
9351}
9352
9353// Left-recursive
9354// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
9355static expr_ty shift_expr_raw(Parser *);
9356static expr_ty
9357shift_expr_rule(Parser *p)
9358{
9359 D(p->level++);
9360 expr_ty _res = NULL;
9361 if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
9362 D(p->level--);
9363 return _res;
9364 }
9365 int _mark = p->mark;
9366 int _resmark = p->mark;
9367 while (1) {
9368 int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
9369 if (tmpvar_4) {
9370 D(p->level--);
9371 return _res;
9372 }
9373 p->mark = _mark;
9374 void *_raw = shift_expr_raw(p);
9375 if (_raw == NULL || p->mark <= _resmark)
9376 break;
9377 _resmark = p->mark;
9378 _res = _raw;
9379 }
9380 p->mark = _resmark;
9381 D(p->level--);
9382 return _res;
9383}
9384static expr_ty
9385shift_expr_raw(Parser *p)
9386{
9387 D(p->level++);
9388 if (p->error_indicator) {
9389 D(p->level--);
9390 return NULL;
9391 }
9392 expr_ty _res = NULL;
9393 int _mark = p->mark;
9394 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9395 p->error_indicator = 1;
9396 D(p->level--);
9397 return NULL;
9398 }
9399 int _start_lineno = p->tokens[_mark]->lineno;
9400 UNUSED(_start_lineno); // Only used by EXTRA macro
9401 int _start_col_offset = p->tokens[_mark]->col_offset;
9402 UNUSED(_start_col_offset); // Only used by EXTRA macro
9403 { // shift_expr '<<' sum
9404 if (p->error_indicator) {
9405 D(p->level--);
9406 return NULL;
9407 }
9408 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9409 Token * _literal;
9410 expr_ty a;
9411 expr_ty b;
9412 if (
9413 (a = shift_expr_rule(p)) // shift_expr
9414 &&
9415 (_literal = _PyPegen_expect_token(p, 33)) // token='<<'
9416 &&
9417 (b = sum_rule(p)) // sum
9418 )
9419 {
9420 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9421 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9422 if (_token == NULL) {
9423 D(p->level--);
9424 return NULL;
9425 }
9426 int _end_lineno = _token->end_lineno;
9427 UNUSED(_end_lineno); // Only used by EXTRA macro
9428 int _end_col_offset = _token->end_col_offset;
9429 UNUSED(_end_col_offset); // Only used by EXTRA macro
9430 _res = _Py_BinOp ( a , LShift , b , EXTRA );
9431 if (_res == NULL && PyErr_Occurred()) {
9432 p->error_indicator = 1;
9433 D(p->level--);
9434 return NULL;
9435 }
9436 goto done;
9437 }
9438 p->mark = _mark;
9439 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9440 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
9441 }
9442 { // shift_expr '>>' sum
9443 if (p->error_indicator) {
9444 D(p->level--);
9445 return NULL;
9446 }
9447 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9448 Token * _literal;
9449 expr_ty a;
9450 expr_ty b;
9451 if (
9452 (a = shift_expr_rule(p)) // shift_expr
9453 &&
9454 (_literal = _PyPegen_expect_token(p, 34)) // token='>>'
9455 &&
9456 (b = sum_rule(p)) // sum
9457 )
9458 {
9459 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9460 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9461 if (_token == NULL) {
9462 D(p->level--);
9463 return NULL;
9464 }
9465 int _end_lineno = _token->end_lineno;
9466 UNUSED(_end_lineno); // Only used by EXTRA macro
9467 int _end_col_offset = _token->end_col_offset;
9468 UNUSED(_end_col_offset); // Only used by EXTRA macro
9469 _res = _Py_BinOp ( a , RShift , b , EXTRA );
9470 if (_res == NULL && PyErr_Occurred()) {
9471 p->error_indicator = 1;
9472 D(p->level--);
9473 return NULL;
9474 }
9475 goto done;
9476 }
9477 p->mark = _mark;
9478 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9479 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum"));
9480 }
9481 { // sum
9482 if (p->error_indicator) {
9483 D(p->level--);
9484 return NULL;
9485 }
9486 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
9487 expr_ty sum_var;
9488 if (
9489 (sum_var = sum_rule(p)) // sum
9490 )
9491 {
9492 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
9493 _res = sum_var;
9494 goto done;
9495 }
9496 p->mark = _mark;
9497 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
9499 }
9500 _res = NULL;
9501 done:
9502 D(p->level--);
9503 return _res;
9504}
9505
9506// Left-recursive
9507// sum: sum '+' term | sum '-' term | term
9508static expr_ty sum_raw(Parser *);
9509static expr_ty
9510sum_rule(Parser *p)
9511{
9512 D(p->level++);
9513 expr_ty _res = NULL;
9514 if (_PyPegen_is_memoized(p, sum_type, &_res)) {
9515 D(p->level--);
9516 return _res;
9517 }
9518 int _mark = p->mark;
9519 int _resmark = p->mark;
9520 while (1) {
9521 int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res);
9522 if (tmpvar_5) {
9523 D(p->level--);
9524 return _res;
9525 }
9526 p->mark = _mark;
9527 void *_raw = sum_raw(p);
9528 if (_raw == NULL || p->mark <= _resmark)
9529 break;
9530 _resmark = p->mark;
9531 _res = _raw;
9532 }
9533 p->mark = _resmark;
9534 D(p->level--);
9535 return _res;
9536}
9537static expr_ty
9538sum_raw(Parser *p)
9539{
9540 D(p->level++);
9541 if (p->error_indicator) {
9542 D(p->level--);
9543 return NULL;
9544 }
9545 expr_ty _res = NULL;
9546 int _mark = p->mark;
9547 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9548 p->error_indicator = 1;
9549 D(p->level--);
9550 return NULL;
9551 }
9552 int _start_lineno = p->tokens[_mark]->lineno;
9553 UNUSED(_start_lineno); // Only used by EXTRA macro
9554 int _start_col_offset = p->tokens[_mark]->col_offset;
9555 UNUSED(_start_col_offset); // Only used by EXTRA macro
9556 { // sum '+' term
9557 if (p->error_indicator) {
9558 D(p->level--);
9559 return NULL;
9560 }
9561 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9562 Token * _literal;
9563 expr_ty a;
9564 expr_ty b;
9565 if (
9566 (a = sum_rule(p)) // sum
9567 &&
9568 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9569 &&
9570 (b = term_rule(p)) // term
9571 )
9572 {
9573 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9574 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9575 if (_token == NULL) {
9576 D(p->level--);
9577 return NULL;
9578 }
9579 int _end_lineno = _token->end_lineno;
9580 UNUSED(_end_lineno); // Only used by EXTRA macro
9581 int _end_col_offset = _token->end_col_offset;
9582 UNUSED(_end_col_offset); // Only used by EXTRA macro
9583 _res = _Py_BinOp ( a , Add , b , EXTRA );
9584 if (_res == NULL && PyErr_Occurred()) {
9585 p->error_indicator = 1;
9586 D(p->level--);
9587 return NULL;
9588 }
9589 goto done;
9590 }
9591 p->mark = _mark;
9592 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9593 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
9594 }
9595 { // sum '-' term
9596 if (p->error_indicator) {
9597 D(p->level--);
9598 return NULL;
9599 }
9600 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9601 Token * _literal;
9602 expr_ty a;
9603 expr_ty b;
9604 if (
9605 (a = sum_rule(p)) // sum
9606 &&
9607 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
9608 &&
9609 (b = term_rule(p)) // term
9610 )
9611 {
9612 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9613 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9614 if (_token == NULL) {
9615 D(p->level--);
9616 return NULL;
9617 }
9618 int _end_lineno = _token->end_lineno;
9619 UNUSED(_end_lineno); // Only used by EXTRA macro
9620 int _end_col_offset = _token->end_col_offset;
9621 UNUSED(_end_col_offset); // Only used by EXTRA macro
9622 _res = _Py_BinOp ( a , Sub , b , EXTRA );
9623 if (_res == NULL && PyErr_Occurred()) {
9624 p->error_indicator = 1;
9625 D(p->level--);
9626 return NULL;
9627 }
9628 goto done;
9629 }
9630 p->mark = _mark;
9631 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9632 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term"));
9633 }
9634 { // term
9635 if (p->error_indicator) {
9636 D(p->level--);
9637 return NULL;
9638 }
9639 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
9640 expr_ty term_var;
9641 if (
9642 (term_var = term_rule(p)) // term
9643 )
9644 {
9645 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
9646 _res = term_var;
9647 goto done;
9648 }
9649 p->mark = _mark;
9650 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9651 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
9652 }
9653 _res = NULL;
9654 done:
9655 D(p->level--);
9656 return _res;
9657}
9658
9659// Left-recursive
9660// term:
9661// | term '*' factor
9662// | term '/' factor
9663// | term '//' factor
9664// | term '%' factor
9665// | term '@' factor
9666// | factor
9667static expr_ty term_raw(Parser *);
9668static expr_ty
9669term_rule(Parser *p)
9670{
9671 D(p->level++);
9672 expr_ty _res = NULL;
9673 if (_PyPegen_is_memoized(p, term_type, &_res)) {
9674 D(p->level--);
9675 return _res;
9676 }
9677 int _mark = p->mark;
9678 int _resmark = p->mark;
9679 while (1) {
9680 int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res);
9681 if (tmpvar_6) {
9682 D(p->level--);
9683 return _res;
9684 }
9685 p->mark = _mark;
9686 void *_raw = term_raw(p);
9687 if (_raw == NULL || p->mark <= _resmark)
9688 break;
9689 _resmark = p->mark;
9690 _res = _raw;
9691 }
9692 p->mark = _resmark;
9693 D(p->level--);
9694 return _res;
9695}
9696static expr_ty
9697term_raw(Parser *p)
9698{
9699 D(p->level++);
9700 if (p->error_indicator) {
9701 D(p->level--);
9702 return NULL;
9703 }
9704 expr_ty _res = NULL;
9705 int _mark = p->mark;
9706 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9707 p->error_indicator = 1;
9708 D(p->level--);
9709 return NULL;
9710 }
9711 int _start_lineno = p->tokens[_mark]->lineno;
9712 UNUSED(_start_lineno); // Only used by EXTRA macro
9713 int _start_col_offset = p->tokens[_mark]->col_offset;
9714 UNUSED(_start_col_offset); // Only used by EXTRA macro
9715 { // term '*' factor
9716 if (p->error_indicator) {
9717 D(p->level--);
9718 return NULL;
9719 }
9720 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9721 Token * _literal;
9722 expr_ty a;
9723 expr_ty b;
9724 if (
9725 (a = term_rule(p)) // term
9726 &&
9727 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
9728 &&
9729 (b = factor_rule(p)) // factor
9730 )
9731 {
9732 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9733 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9734 if (_token == NULL) {
9735 D(p->level--);
9736 return NULL;
9737 }
9738 int _end_lineno = _token->end_lineno;
9739 UNUSED(_end_lineno); // Only used by EXTRA macro
9740 int _end_col_offset = _token->end_col_offset;
9741 UNUSED(_end_col_offset); // Only used by EXTRA macro
9742 _res = _Py_BinOp ( a , Mult , b , EXTRA );
9743 if (_res == NULL && PyErr_Occurred()) {
9744 p->error_indicator = 1;
9745 D(p->level--);
9746 return NULL;
9747 }
9748 goto done;
9749 }
9750 p->mark = _mark;
9751 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9752 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
9753 }
9754 { // term '/' factor
9755 if (p->error_indicator) {
9756 D(p->level--);
9757 return NULL;
9758 }
9759 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9760 Token * _literal;
9761 expr_ty a;
9762 expr_ty b;
9763 if (
9764 (a = term_rule(p)) // term
9765 &&
9766 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
9767 &&
9768 (b = factor_rule(p)) // factor
9769 )
9770 {
9771 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9772 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9773 if (_token == NULL) {
9774 D(p->level--);
9775 return NULL;
9776 }
9777 int _end_lineno = _token->end_lineno;
9778 UNUSED(_end_lineno); // Only used by EXTRA macro
9779 int _end_col_offset = _token->end_col_offset;
9780 UNUSED(_end_col_offset); // Only used by EXTRA macro
9781 _res = _Py_BinOp ( a , Div , b , EXTRA );
9782 if (_res == NULL && PyErr_Occurred()) {
9783 p->error_indicator = 1;
9784 D(p->level--);
9785 return NULL;
9786 }
9787 goto done;
9788 }
9789 p->mark = _mark;
9790 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9791 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
9792 }
9793 { // term '//' factor
9794 if (p->error_indicator) {
9795 D(p->level--);
9796 return NULL;
9797 }
9798 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9799 Token * _literal;
9800 expr_ty a;
9801 expr_ty b;
9802 if (
9803 (a = term_rule(p)) // term
9804 &&
9805 (_literal = _PyPegen_expect_token(p, 47)) // token='//'
9806 &&
9807 (b = factor_rule(p)) // factor
9808 )
9809 {
9810 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9811 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9812 if (_token == NULL) {
9813 D(p->level--);
9814 return NULL;
9815 }
9816 int _end_lineno = _token->end_lineno;
9817 UNUSED(_end_lineno); // Only used by EXTRA macro
9818 int _end_col_offset = _token->end_col_offset;
9819 UNUSED(_end_col_offset); // Only used by EXTRA macro
9820 _res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
9821 if (_res == NULL && PyErr_Occurred()) {
9822 p->error_indicator = 1;
9823 D(p->level--);
9824 return NULL;
9825 }
9826 goto done;
9827 }
9828 p->mark = _mark;
9829 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9830 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
9831 }
9832 { // term '%' factor
9833 if (p->error_indicator) {
9834 D(p->level--);
9835 return NULL;
9836 }
9837 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9838 Token * _literal;
9839 expr_ty a;
9840 expr_ty b;
9841 if (
9842 (a = term_rule(p)) // term
9843 &&
9844 (_literal = _PyPegen_expect_token(p, 24)) // token='%'
9845 &&
9846 (b = factor_rule(p)) // factor
9847 )
9848 {
9849 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9850 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9851 if (_token == NULL) {
9852 D(p->level--);
9853 return NULL;
9854 }
9855 int _end_lineno = _token->end_lineno;
9856 UNUSED(_end_lineno); // Only used by EXTRA macro
9857 int _end_col_offset = _token->end_col_offset;
9858 UNUSED(_end_col_offset); // Only used by EXTRA macro
9859 _res = _Py_BinOp ( a , Mod , b , EXTRA );
9860 if (_res == NULL && PyErr_Occurred()) {
9861 p->error_indicator = 1;
9862 D(p->level--);
9863 return NULL;
9864 }
9865 goto done;
9866 }
9867 p->mark = _mark;
9868 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9869 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
9870 }
9871 { // term '@' factor
9872 if (p->error_indicator) {
9873 D(p->level--);
9874 return NULL;
9875 }
9876 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9877 Token * _literal;
9878 expr_ty a;
9879 expr_ty b;
9880 if (
9881 (a = term_rule(p)) // term
9882 &&
9883 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
9884 &&
9885 (b = factor_rule(p)) // factor
9886 )
9887 {
9888 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9889 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9890 if (_token == NULL) {
9891 D(p->level--);
9892 return NULL;
9893 }
9894 int _end_lineno = _token->end_lineno;
9895 UNUSED(_end_lineno); // Only used by EXTRA macro
9896 int _end_col_offset = _token->end_col_offset;
9897 UNUSED(_end_col_offset); // Only used by EXTRA macro
9898 _res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) );
9899 if (_res == NULL && PyErr_Occurred()) {
9900 p->error_indicator = 1;
9901 D(p->level--);
9902 return NULL;
9903 }
9904 goto done;
9905 }
9906 p->mark = _mark;
9907 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9908 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor"));
9909 }
9910 { // factor
9911 if (p->error_indicator) {
9912 D(p->level--);
9913 return NULL;
9914 }
9915 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
9916 expr_ty factor_var;
9917 if (
9918 (factor_var = factor_rule(p)) // factor
9919 )
9920 {
9921 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
9922 _res = factor_var;
9923 goto done;
9924 }
9925 p->mark = _mark;
9926 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9927 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
9928 }
9929 _res = NULL;
9930 done:
9931 D(p->level--);
9932 return _res;
9933}
9934
9935// factor: '+' factor | '-' factor | '~' factor | power
9936static expr_ty
9937factor_rule(Parser *p)
9938{
9939 D(p->level++);
9940 if (p->error_indicator) {
9941 D(p->level--);
9942 return NULL;
9943 }
9944 expr_ty _res = NULL;
9945 if (_PyPegen_is_memoized(p, factor_type, &_res)) {
9946 D(p->level--);
9947 return _res;
9948 }
9949 int _mark = p->mark;
9950 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9951 p->error_indicator = 1;
9952 D(p->level--);
9953 return NULL;
9954 }
9955 int _start_lineno = p->tokens[_mark]->lineno;
9956 UNUSED(_start_lineno); // Only used by EXTRA macro
9957 int _start_col_offset = p->tokens[_mark]->col_offset;
9958 UNUSED(_start_col_offset); // Only used by EXTRA macro
9959 { // '+' factor
9960 if (p->error_indicator) {
9961 D(p->level--);
9962 return NULL;
9963 }
9964 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9965 Token * _literal;
9966 expr_ty a;
9967 if (
9968 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9969 &&
9970 (a = factor_rule(p)) // factor
9971 )
9972 {
9973 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9974 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9975 if (_token == NULL) {
9976 D(p->level--);
9977 return NULL;
9978 }
9979 int _end_lineno = _token->end_lineno;
9980 UNUSED(_end_lineno); // Only used by EXTRA macro
9981 int _end_col_offset = _token->end_col_offset;
9982 UNUSED(_end_col_offset); // Only used by EXTRA macro
9983 _res = _Py_UnaryOp ( UAdd , a , EXTRA );
9984 if (_res == NULL && PyErr_Occurred()) {
9985 p->error_indicator = 1;
9986 D(p->level--);
9987 return NULL;
9988 }
9989 goto done;
9990 }
9991 p->mark = _mark;
9992 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
9993 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
9994 }
9995 { // '-' factor
9996 if (p->error_indicator) {
9997 D(p->level--);
9998 return NULL;
9999 }
10000 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10001 Token * _literal;
10002 expr_ty a;
10003 if (
10004 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
10005 &&
10006 (a = factor_rule(p)) // factor
10007 )
10008 {
10009 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10010 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10011 if (_token == NULL) {
10012 D(p->level--);
10013 return NULL;
10014 }
10015 int _end_lineno = _token->end_lineno;
10016 UNUSED(_end_lineno); // Only used by EXTRA macro
10017 int _end_col_offset = _token->end_col_offset;
10018 UNUSED(_end_col_offset); // Only used by EXTRA macro
10019 _res = _Py_UnaryOp ( USub , a , EXTRA );
10020 if (_res == NULL && PyErr_Occurred()) {
10021 p->error_indicator = 1;
10022 D(p->level--);
10023 return NULL;
10024 }
10025 goto done;
10026 }
10027 p->mark = _mark;
10028 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10029 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
10030 }
10031 { // '~' factor
10032 if (p->error_indicator) {
10033 D(p->level--);
10034 return NULL;
10035 }
10036 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10037 Token * _literal;
10038 expr_ty a;
10039 if (
10040 (_literal = _PyPegen_expect_token(p, 31)) // token='~'
10041 &&
10042 (a = factor_rule(p)) // factor
10043 )
10044 {
10045 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10046 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10047 if (_token == NULL) {
10048 D(p->level--);
10049 return NULL;
10050 }
10051 int _end_lineno = _token->end_lineno;
10052 UNUSED(_end_lineno); // Only used by EXTRA macro
10053 int _end_col_offset = _token->end_col_offset;
10054 UNUSED(_end_col_offset); // Only used by EXTRA macro
10055 _res = _Py_UnaryOp ( Invert , a , EXTRA );
10056 if (_res == NULL && PyErr_Occurred()) {
10057 p->error_indicator = 1;
10058 D(p->level--);
10059 return NULL;
10060 }
10061 goto done;
10062 }
10063 p->mark = _mark;
10064 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10065 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor"));
10066 }
10067 { // power
10068 if (p->error_indicator) {
10069 D(p->level--);
10070 return NULL;
10071 }
10072 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
10073 expr_ty power_var;
10074 if (
10075 (power_var = power_rule(p)) // power
10076 )
10077 {
10078 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
10079 _res = power_var;
10080 goto done;
10081 }
10082 p->mark = _mark;
10083 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10084 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
10085 }
10086 _res = NULL;
10087 done:
10088 _PyPegen_insert_memo(p, _mark, factor_type, _res);
10089 D(p->level--);
10090 return _res;
10091}
10092
10093// power: await_primary '**' factor | await_primary
10094static expr_ty
10095power_rule(Parser *p)
10096{
10097 D(p->level++);
10098 if (p->error_indicator) {
10099 D(p->level--);
10100 return NULL;
10101 }
10102 expr_ty _res = NULL;
10103 int _mark = p->mark;
10104 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10105 p->error_indicator = 1;
10106 D(p->level--);
10107 return NULL;
10108 }
10109 int _start_lineno = p->tokens[_mark]->lineno;
10110 UNUSED(_start_lineno); // Only used by EXTRA macro
10111 int _start_col_offset = p->tokens[_mark]->col_offset;
10112 UNUSED(_start_col_offset); // Only used by EXTRA macro
10113 { // await_primary '**' factor
10114 if (p->error_indicator) {
10115 D(p->level--);
10116 return NULL;
10117 }
10118 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10119 Token * _literal;
10120 expr_ty a;
10121 expr_ty b;
10122 if (
10123 (a = await_primary_rule(p)) // await_primary
10124 &&
10125 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
10126 &&
10127 (b = factor_rule(p)) // factor
10128 )
10129 {
10130 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10131 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10132 if (_token == NULL) {
10133 D(p->level--);
10134 return NULL;
10135 }
10136 int _end_lineno = _token->end_lineno;
10137 UNUSED(_end_lineno); // Only used by EXTRA macro
10138 int _end_col_offset = _token->end_col_offset;
10139 UNUSED(_end_col_offset); // Only used by EXTRA macro
10140 _res = _Py_BinOp ( a , Pow , b , EXTRA );
10141 if (_res == NULL && PyErr_Occurred()) {
10142 p->error_indicator = 1;
10143 D(p->level--);
10144 return NULL;
10145 }
10146 goto done;
10147 }
10148 p->mark = _mark;
10149 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10150 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor"));
10151 }
10152 { // await_primary
10153 if (p->error_indicator) {
10154 D(p->level--);
10155 return NULL;
10156 }
10157 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
10158 expr_ty await_primary_var;
10159 if (
10160 (await_primary_var = await_primary_rule(p)) // await_primary
10161 )
10162 {
10163 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
10164 _res = await_primary_var;
10165 goto done;
10166 }
10167 p->mark = _mark;
10168 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10169 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
10170 }
10171 _res = NULL;
10172 done:
10173 D(p->level--);
10174 return _res;
10175}
10176
10177// await_primary: AWAIT primary | primary
10178static expr_ty
10179await_primary_rule(Parser *p)
10180{
10181 D(p->level++);
10182 if (p->error_indicator) {
10183 D(p->level--);
10184 return NULL;
10185 }
10186 expr_ty _res = NULL;
10187 if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
10188 D(p->level--);
10189 return _res;
10190 }
10191 int _mark = p->mark;
10192 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10193 p->error_indicator = 1;
10194 D(p->level--);
10195 return NULL;
10196 }
10197 int _start_lineno = p->tokens[_mark]->lineno;
10198 UNUSED(_start_lineno); // Only used by EXTRA macro
10199 int _start_col_offset = p->tokens[_mark]->col_offset;
10200 UNUSED(_start_col_offset); // Only used by EXTRA macro
10201 { // AWAIT primary
10202 if (p->error_indicator) {
10203 D(p->level--);
10204 return NULL;
10205 }
10206 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10207 expr_ty a;
10208 Token * await_var;
10209 if (
10210 (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT'
10211 &&
10212 (a = primary_rule(p)) // primary
10213 )
10214 {
10215 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10216 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10217 if (_token == NULL) {
10218 D(p->level--);
10219 return NULL;
10220 }
10221 int _end_lineno = _token->end_lineno;
10222 UNUSED(_end_lineno); // Only used by EXTRA macro
10223 int _end_col_offset = _token->end_col_offset;
10224 UNUSED(_end_col_offset); // Only used by EXTRA macro
10225 _res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) );
10226 if (_res == NULL && PyErr_Occurred()) {
10227 p->error_indicator = 1;
10228 D(p->level--);
10229 return NULL;
10230 }
10231 goto done;
10232 }
10233 p->mark = _mark;
10234 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10235 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary"));
10236 }
10237 { // primary
10238 if (p->error_indicator) {
10239 D(p->level--);
10240 return NULL;
10241 }
10242 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
10243 expr_ty primary_var;
10244 if (
10245 (primary_var = primary_rule(p)) // primary
10246 )
10247 {
10248 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
10249 _res = primary_var;
10250 goto done;
10251 }
10252 p->mark = _mark;
10253 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10254 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
10255 }
10256 _res = NULL;
10257 done:
10258 _PyPegen_insert_memo(p, _mark, await_primary_type, _res);
10259 D(p->level--);
10260 return _res;
10261}
10262
10263// Left-recursive
10264// primary:
10265// | primary '.' NAME
10266// | primary genexp
10267// | primary '(' arguments? ')'
10268// | primary '[' slices ']'
10269// | atom
10270static expr_ty primary_raw(Parser *);
10271static expr_ty
10272primary_rule(Parser *p)
10273{
10274 D(p->level++);
10275 expr_ty _res = NULL;
10276 if (_PyPegen_is_memoized(p, primary_type, &_res)) {
10277 D(p->level--);
10278 return _res;
10279 }
10280 int _mark = p->mark;
10281 int _resmark = p->mark;
10282 while (1) {
10283 int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res);
10284 if (tmpvar_7) {
10285 D(p->level--);
10286 return _res;
10287 }
10288 p->mark = _mark;
10289 void *_raw = primary_raw(p);
10290 if (_raw == NULL || p->mark <= _resmark)
10291 break;
10292 _resmark = p->mark;
10293 _res = _raw;
10294 }
10295 p->mark = _resmark;
10296 D(p->level--);
10297 return _res;
10298}
10299static expr_ty
10300primary_raw(Parser *p)
10301{
10302 D(p->level++);
10303 if (p->error_indicator) {
10304 D(p->level--);
10305 return NULL;
10306 }
10307 expr_ty _res = NULL;
10308 int _mark = p->mark;
10309 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10310 p->error_indicator = 1;
10311 D(p->level--);
10312 return NULL;
10313 }
10314 int _start_lineno = p->tokens[_mark]->lineno;
10315 UNUSED(_start_lineno); // Only used by EXTRA macro
10316 int _start_col_offset = p->tokens[_mark]->col_offset;
10317 UNUSED(_start_col_offset); // Only used by EXTRA macro
10318 { // primary '.' NAME
10319 if (p->error_indicator) {
10320 D(p->level--);
10321 return NULL;
10322 }
10323 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10324 Token * _literal;
10325 expr_ty a;
10326 expr_ty b;
10327 if (
10328 (a = primary_rule(p)) // primary
10329 &&
10330 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
10331 &&
10332 (b = _PyPegen_name_token(p)) // NAME
10333 )
10334 {
10335 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10336 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10337 if (_token == NULL) {
10338 D(p->level--);
10339 return NULL;
10340 }
10341 int _end_lineno = _token->end_lineno;
10342 UNUSED(_end_lineno); // Only used by EXTRA macro
10343 int _end_col_offset = _token->end_col_offset;
10344 UNUSED(_end_col_offset); // Only used by EXTRA macro
10345 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
10346 if (_res == NULL && PyErr_Occurred()) {
10347 p->error_indicator = 1;
10348 D(p->level--);
10349 return NULL;
10350 }
10351 goto done;
10352 }
10353 p->mark = _mark;
10354 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10355 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
10356 }
10357 { // primary genexp
10358 if (p->error_indicator) {
10359 D(p->level--);
10360 return NULL;
10361 }
10362 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10363 expr_ty a;
10364 expr_ty b;
10365 if (
10366 (a = primary_rule(p)) // primary
10367 &&
10368 (b = genexp_rule(p)) // genexp
10369 )
10370 {
10371 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10372 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10373 if (_token == NULL) {
10374 D(p->level--);
10375 return NULL;
10376 }
10377 int _end_lineno = _token->end_lineno;
10378 UNUSED(_end_lineno); // Only used by EXTRA macro
10379 int _end_col_offset = _token->end_col_offset;
10380 UNUSED(_end_col_offset); // Only used by EXTRA macro
10381 _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
10382 if (_res == NULL && PyErr_Occurred()) {
10383 p->error_indicator = 1;
10384 D(p->level--);
10385 return NULL;
10386 }
10387 goto done;
10388 }
10389 p->mark = _mark;
10390 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10391 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
10392 }
10393 { // primary '(' arguments? ')'
10394 if (p->error_indicator) {
10395 D(p->level--);
10396 return NULL;
10397 }
10398 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10399 Token * _literal;
10400 Token * _literal_1;
10401 expr_ty a;
10402 void *b;
10403 if (
10404 (a = primary_rule(p)) // primary
10405 &&
10406 (_literal = _PyPegen_expect_token(p, 7)) // token='('
10407 &&
10408 (b = arguments_rule(p), 1) // arguments?
10409 &&
10410 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
10411 )
10412 {
10413 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10414 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10415 if (_token == NULL) {
10416 D(p->level--);
10417 return NULL;
10418 }
10419 int _end_lineno = _token->end_lineno;
10420 UNUSED(_end_lineno); // Only used by EXTRA macro
10421 int _end_col_offset = _token->end_col_offset;
10422 UNUSED(_end_col_offset); // Only used by EXTRA macro
10423 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
10424 if (_res == NULL && PyErr_Occurred()) {
10425 p->error_indicator = 1;
10426 D(p->level--);
10427 return NULL;
10428 }
10429 goto done;
10430 }
10431 p->mark = _mark;
10432 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10433 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
10434 }
10435 { // primary '[' slices ']'
10436 if (p->error_indicator) {
10437 D(p->level--);
10438 return NULL;
10439 }
10440 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10441 Token * _literal;
10442 Token * _literal_1;
10443 expr_ty a;
10444 expr_ty b;
10445 if (
10446 (a = primary_rule(p)) // primary
10447 &&
10448 (_literal = _PyPegen_expect_token(p, 9)) // token='['
10449 &&
10450 (b = slices_rule(p)) // slices
10451 &&
10452 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
10453 )
10454 {
10455 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10456 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10457 if (_token == NULL) {
10458 D(p->level--);
10459 return NULL;
10460 }
10461 int _end_lineno = _token->end_lineno;
10462 UNUSED(_end_lineno); // Only used by EXTRA macro
10463 int _end_col_offset = _token->end_col_offset;
10464 UNUSED(_end_col_offset); // Only used by EXTRA macro
10465 _res = _Py_Subscript ( a , b , Load , EXTRA );
10466 if (_res == NULL && PyErr_Occurred()) {
10467 p->error_indicator = 1;
10468 D(p->level--);
10469 return NULL;
10470 }
10471 goto done;
10472 }
10473 p->mark = _mark;
10474 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
10476 }
10477 { // atom
10478 if (p->error_indicator) {
10479 D(p->level--);
10480 return NULL;
10481 }
10482 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
10483 expr_ty atom_var;
10484 if (
10485 (atom_var = atom_rule(p)) // atom
10486 )
10487 {
10488 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
10489 _res = atom_var;
10490 goto done;
10491 }
10492 p->mark = _mark;
10493 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10494 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
10495 }
10496 _res = NULL;
10497 done:
10498 D(p->level--);
10499 return _res;
10500}
10501
10502// slices: slice !',' | ','.slice+ ','?
10503static expr_ty
10504slices_rule(Parser *p)
10505{
10506 D(p->level++);
10507 if (p->error_indicator) {
10508 D(p->level--);
10509 return NULL;
10510 }
10511 expr_ty _res = NULL;
10512 int _mark = p->mark;
10513 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10514 p->error_indicator = 1;
10515 D(p->level--);
10516 return NULL;
10517 }
10518 int _start_lineno = p->tokens[_mark]->lineno;
10519 UNUSED(_start_lineno); // Only used by EXTRA macro
10520 int _start_col_offset = p->tokens[_mark]->col_offset;
10521 UNUSED(_start_col_offset); // Only used by EXTRA macro
10522 { // slice !','
10523 if (p->error_indicator) {
10524 D(p->level--);
10525 return NULL;
10526 }
10527 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
10528 expr_ty a;
10529 if (
10530 (a = slice_rule(p)) // slice
10531 &&
10532 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
10533 )
10534 {
10535 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
10536 _res = a;
10537 if (_res == NULL && PyErr_Occurred()) {
10538 p->error_indicator = 1;
10539 D(p->level--);
10540 return NULL;
10541 }
10542 goto done;
10543 }
10544 p->mark = _mark;
10545 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10546 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
10547 }
10548 { // ','.slice+ ','?
10549 if (p->error_indicator) {
10550 D(p->level--);
10551 return NULL;
10552 }
10553 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10554 void *_opt_var;
10555 UNUSED(_opt_var); // Silence compiler warnings
10556 asdl_seq * a;
10557 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010558 (a = _gather_94_rule(p)) // ','.slice+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010559 &&
10560 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
10561 )
10562 {
10563 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10564 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10565 if (_token == NULL) {
10566 D(p->level--);
10567 return NULL;
10568 }
10569 int _end_lineno = _token->end_lineno;
10570 UNUSED(_end_lineno); // Only used by EXTRA macro
10571 int _end_col_offset = _token->end_col_offset;
10572 UNUSED(_end_col_offset); // Only used by EXTRA macro
10573 _res = _Py_Tuple ( a , Load , EXTRA );
10574 if (_res == NULL && PyErr_Occurred()) {
10575 p->error_indicator = 1;
10576 D(p->level--);
10577 return NULL;
10578 }
10579 goto done;
10580 }
10581 p->mark = _mark;
10582 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10583 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?"));
10584 }
10585 _res = NULL;
10586 done:
10587 D(p->level--);
10588 return _res;
10589}
10590
10591// slice: expression? ':' expression? [':' expression?] | expression
10592static expr_ty
10593slice_rule(Parser *p)
10594{
10595 D(p->level++);
10596 if (p->error_indicator) {
10597 D(p->level--);
10598 return NULL;
10599 }
10600 expr_ty _res = NULL;
10601 int _mark = p->mark;
10602 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10603 p->error_indicator = 1;
10604 D(p->level--);
10605 return NULL;
10606 }
10607 int _start_lineno = p->tokens[_mark]->lineno;
10608 UNUSED(_start_lineno); // Only used by EXTRA macro
10609 int _start_col_offset = p->tokens[_mark]->col_offset;
10610 UNUSED(_start_col_offset); // Only used by EXTRA macro
10611 { // expression? ':' expression? [':' expression?]
10612 if (p->error_indicator) {
10613 D(p->level--);
10614 return NULL;
10615 }
10616 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10617 Token * _literal;
10618 void *a;
10619 void *b;
10620 void *c;
10621 if (
10622 (a = expression_rule(p), 1) // expression?
10623 &&
10624 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
10625 &&
10626 (b = expression_rule(p), 1) // expression?
10627 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010628 (c = _tmp_96_rule(p), 1) // [':' expression?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010629 )
10630 {
10631 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10632 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10633 if (_token == NULL) {
10634 D(p->level--);
10635 return NULL;
10636 }
10637 int _end_lineno = _token->end_lineno;
10638 UNUSED(_end_lineno); // Only used by EXTRA macro
10639 int _end_col_offset = _token->end_col_offset;
10640 UNUSED(_end_col_offset); // Only used by EXTRA macro
10641 _res = _Py_Slice ( a , b , c , EXTRA );
10642 if (_res == NULL && PyErr_Occurred()) {
10643 p->error_indicator = 1;
10644 D(p->level--);
10645 return NULL;
10646 }
10647 goto done;
10648 }
10649 p->mark = _mark;
10650 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10651 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10652 }
10653 { // expression
10654 if (p->error_indicator) {
10655 D(p->level--);
10656 return NULL;
10657 }
10658 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
10659 expr_ty a;
10660 if (
10661 (a = expression_rule(p)) // expression
10662 )
10663 {
10664 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
10665 _res = a;
10666 if (_res == NULL && PyErr_Occurred()) {
10667 p->error_indicator = 1;
10668 D(p->level--);
10669 return NULL;
10670 }
10671 goto done;
10672 }
10673 p->mark = _mark;
10674 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10675 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
10676 }
10677 _res = NULL;
10678 done:
10679 D(p->level--);
10680 return _res;
10681}
10682
10683// atom:
10684// | NAME
10685// | 'True'
10686// | 'False'
10687// | 'None'
10688// | &STRING strings
10689// | NUMBER
10690// | &'(' (tuple | group | genexp)
10691// | &'[' (list | listcomp)
10692// | &'{' (dict | set | dictcomp | setcomp)
10693// | '...'
10694static expr_ty
10695atom_rule(Parser *p)
10696{
10697 D(p->level++);
10698 if (p->error_indicator) {
10699 D(p->level--);
10700 return NULL;
10701 }
10702 expr_ty _res = NULL;
10703 int _mark = p->mark;
10704 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10705 p->error_indicator = 1;
10706 D(p->level--);
10707 return NULL;
10708 }
10709 int _start_lineno = p->tokens[_mark]->lineno;
10710 UNUSED(_start_lineno); // Only used by EXTRA macro
10711 int _start_col_offset = p->tokens[_mark]->col_offset;
10712 UNUSED(_start_col_offset); // Only used by EXTRA macro
10713 { // NAME
10714 if (p->error_indicator) {
10715 D(p->level--);
10716 return NULL;
10717 }
10718 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
10719 expr_ty name_var;
10720 if (
10721 (name_var = _PyPegen_name_token(p)) // NAME
10722 )
10723 {
10724 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
10725 _res = name_var;
10726 goto done;
10727 }
10728 p->mark = _mark;
10729 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10730 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
10731 }
10732 { // 'True'
10733 if (p->error_indicator) {
10734 D(p->level--);
10735 return NULL;
10736 }
10737 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
10738 Token * _keyword;
10739 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010740 (_keyword = _PyPegen_expect_token(p, 528)) // token='True'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010741 )
10742 {
10743 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
10744 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10745 if (_token == NULL) {
10746 D(p->level--);
10747 return NULL;
10748 }
10749 int _end_lineno = _token->end_lineno;
10750 UNUSED(_end_lineno); // Only used by EXTRA macro
10751 int _end_col_offset = _token->end_col_offset;
10752 UNUSED(_end_col_offset); // Only used by EXTRA macro
10753 _res = _Py_Constant ( Py_True , NULL , EXTRA );
10754 if (_res == NULL && PyErr_Occurred()) {
10755 p->error_indicator = 1;
10756 D(p->level--);
10757 return NULL;
10758 }
10759 goto done;
10760 }
10761 p->mark = _mark;
10762 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10763 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
10764 }
10765 { // 'False'
10766 if (p->error_indicator) {
10767 D(p->level--);
10768 return NULL;
10769 }
10770 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
10771 Token * _keyword;
10772 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010773 (_keyword = _PyPegen_expect_token(p, 529)) // token='False'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010774 )
10775 {
10776 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
10777 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10778 if (_token == NULL) {
10779 D(p->level--);
10780 return NULL;
10781 }
10782 int _end_lineno = _token->end_lineno;
10783 UNUSED(_end_lineno); // Only used by EXTRA macro
10784 int _end_col_offset = _token->end_col_offset;
10785 UNUSED(_end_col_offset); // Only used by EXTRA macro
10786 _res = _Py_Constant ( Py_False , NULL , EXTRA );
10787 if (_res == NULL && PyErr_Occurred()) {
10788 p->error_indicator = 1;
10789 D(p->level--);
10790 return NULL;
10791 }
10792 goto done;
10793 }
10794 p->mark = _mark;
10795 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10796 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
10797 }
10798 { // 'None'
10799 if (p->error_indicator) {
10800 D(p->level--);
10801 return NULL;
10802 }
10803 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
10804 Token * _keyword;
10805 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010806 (_keyword = _PyPegen_expect_token(p, 530)) // token='None'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010807 )
10808 {
10809 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
10810 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10811 if (_token == NULL) {
10812 D(p->level--);
10813 return NULL;
10814 }
10815 int _end_lineno = _token->end_lineno;
10816 UNUSED(_end_lineno); // Only used by EXTRA macro
10817 int _end_col_offset = _token->end_col_offset;
10818 UNUSED(_end_col_offset); // Only used by EXTRA macro
10819 _res = _Py_Constant ( Py_None , NULL , EXTRA );
10820 if (_res == NULL && PyErr_Occurred()) {
10821 p->error_indicator = 1;
10822 D(p->level--);
10823 return NULL;
10824 }
10825 goto done;
10826 }
10827 p->mark = _mark;
10828 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10829 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
10830 }
10831 { // &STRING strings
10832 if (p->error_indicator) {
10833 D(p->level--);
10834 return NULL;
10835 }
10836 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10837 expr_ty strings_var;
10838 if (
10839 _PyPegen_lookahead(1, _PyPegen_string_token, p)
10840 &&
10841 (strings_var = strings_rule(p)) // strings
10842 )
10843 {
10844 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10845 _res = strings_var;
10846 goto done;
10847 }
10848 p->mark = _mark;
10849 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10850 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings"));
10851 }
10852 { // NUMBER
10853 if (p->error_indicator) {
10854 D(p->level--);
10855 return NULL;
10856 }
10857 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10858 expr_ty number_var;
10859 if (
10860 (number_var = _PyPegen_number_token(p)) // NUMBER
10861 )
10862 {
10863 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10864 _res = number_var;
10865 goto done;
10866 }
10867 p->mark = _mark;
10868 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10869 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
10870 }
10871 { // &'(' (tuple | group | genexp)
10872 if (p->error_indicator) {
10873 D(p->level--);
10874 return NULL;
10875 }
10876 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010877 void *_tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010878 if (
10879 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='('
10880 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010881 (_tmp_97_var = _tmp_97_rule(p)) // tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010882 )
10883 {
10884 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010885 _res = _tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010886 goto done;
10887 }
10888 p->mark = _mark;
10889 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10890 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
10891 }
10892 { // &'[' (list | listcomp)
10893 if (p->error_indicator) {
10894 D(p->level--);
10895 return NULL;
10896 }
10897 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010898 void *_tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010899 if (
10900 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='['
10901 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010902 (_tmp_98_var = _tmp_98_rule(p)) // list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010903 )
10904 {
10905 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010906 _res = _tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010907 goto done;
10908 }
10909 p->mark = _mark;
10910 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10911 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
10912 }
10913 { // &'{' (dict | set | dictcomp | setcomp)
10914 if (p->error_indicator) {
10915 D(p->level--);
10916 return NULL;
10917 }
10918 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010919 void *_tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010920 if (
10921 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{'
10922 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010923 (_tmp_99_var = _tmp_99_rule(p)) // dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010924 )
10925 {
10926 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010927 _res = _tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010928 goto done;
10929 }
10930 p->mark = _mark;
10931 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10932 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
10933 }
10934 { // '...'
10935 if (p->error_indicator) {
10936 D(p->level--);
10937 return NULL;
10938 }
10939 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
10940 Token * _literal;
10941 if (
10942 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
10943 )
10944 {
10945 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
10946 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10947 if (_token == NULL) {
10948 D(p->level--);
10949 return NULL;
10950 }
10951 int _end_lineno = _token->end_lineno;
10952 UNUSED(_end_lineno); // Only used by EXTRA macro
10953 int _end_col_offset = _token->end_col_offset;
10954 UNUSED(_end_col_offset); // Only used by EXTRA macro
10955 _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
10956 if (_res == NULL && PyErr_Occurred()) {
10957 p->error_indicator = 1;
10958 D(p->level--);
10959 return NULL;
10960 }
10961 goto done;
10962 }
10963 p->mark = _mark;
10964 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10965 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
10966 }
10967 _res = NULL;
10968 done:
10969 D(p->level--);
10970 return _res;
10971}
10972
10973// strings: STRING+
10974static expr_ty
10975strings_rule(Parser *p)
10976{
10977 D(p->level++);
10978 if (p->error_indicator) {
10979 D(p->level--);
10980 return NULL;
10981 }
10982 expr_ty _res = NULL;
10983 if (_PyPegen_is_memoized(p, strings_type, &_res)) {
10984 D(p->level--);
10985 return _res;
10986 }
10987 int _mark = p->mark;
10988 { // STRING+
10989 if (p->error_indicator) {
10990 D(p->level--);
10991 return NULL;
10992 }
10993 D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
10994 asdl_seq * a;
10995 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010996 (a = _loop1_100_rule(p)) // STRING+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010997 )
10998 {
10999 D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
11000 _res = _PyPegen_concatenate_strings ( p , a );
11001 if (_res == NULL && PyErr_Occurred()) {
11002 p->error_indicator = 1;
11003 D(p->level--);
11004 return NULL;
11005 }
11006 goto done;
11007 }
11008 p->mark = _mark;
11009 D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
11010 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
11011 }
11012 _res = NULL;
11013 done:
11014 _PyPegen_insert_memo(p, _mark, strings_type, _res);
11015 D(p->level--);
11016 return _res;
11017}
11018
11019// list: '[' star_named_expressions? ']'
11020static expr_ty
11021list_rule(Parser *p)
11022{
11023 D(p->level++);
11024 if (p->error_indicator) {
11025 D(p->level--);
11026 return NULL;
11027 }
11028 expr_ty _res = NULL;
11029 int _mark = p->mark;
11030 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11031 p->error_indicator = 1;
11032 D(p->level--);
11033 return NULL;
11034 }
11035 int _start_lineno = p->tokens[_mark]->lineno;
11036 UNUSED(_start_lineno); // Only used by EXTRA macro
11037 int _start_col_offset = p->tokens[_mark]->col_offset;
11038 UNUSED(_start_col_offset); // Only used by EXTRA macro
11039 { // '[' star_named_expressions? ']'
11040 if (p->error_indicator) {
11041 D(p->level--);
11042 return NULL;
11043 }
11044 D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11045 Token * _literal;
11046 Token * _literal_1;
11047 void *a;
11048 if (
11049 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11050 &&
11051 (a = star_named_expressions_rule(p), 1) // star_named_expressions?
11052 &&
11053 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11054 )
11055 {
11056 D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11057 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11058 if (_token == NULL) {
11059 D(p->level--);
11060 return NULL;
11061 }
11062 int _end_lineno = _token->end_lineno;
11063 UNUSED(_end_lineno); // Only used by EXTRA macro
11064 int _end_col_offset = _token->end_col_offset;
11065 UNUSED(_end_col_offset); // Only used by EXTRA macro
11066 _res = _Py_List ( a , Load , EXTRA );
11067 if (_res == NULL && PyErr_Occurred()) {
11068 p->error_indicator = 1;
11069 D(p->level--);
11070 return NULL;
11071 }
11072 goto done;
11073 }
11074 p->mark = _mark;
11075 D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
11076 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
11077 }
11078 _res = NULL;
11079 done:
11080 D(p->level--);
11081 return _res;
11082}
11083
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011084// listcomp: '[' named_expression ~ for_if_clauses ']' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011085static expr_ty
11086listcomp_rule(Parser *p)
11087{
11088 D(p->level++);
11089 if (p->error_indicator) {
11090 D(p->level--);
11091 return NULL;
11092 }
11093 expr_ty _res = NULL;
11094 int _mark = p->mark;
11095 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11096 p->error_indicator = 1;
11097 D(p->level--);
11098 return NULL;
11099 }
11100 int _start_lineno = p->tokens[_mark]->lineno;
11101 UNUSED(_start_lineno); // Only used by EXTRA macro
11102 int _start_col_offset = p->tokens[_mark]->col_offset;
11103 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011104 { // '[' named_expression ~ for_if_clauses ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011105 if (p->error_indicator) {
11106 D(p->level--);
11107 return NULL;
11108 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011109 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11110 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011111 Token * _literal;
11112 Token * _literal_1;
11113 expr_ty a;
11114 asdl_seq* b;
11115 if (
11116 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11117 &&
11118 (a = named_expression_rule(p)) // named_expression
11119 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011120 (_cut_var = 1)
11121 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011122 (b = for_if_clauses_rule(p)) // for_if_clauses
11123 &&
11124 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11125 )
11126 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011127 D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011128 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11129 if (_token == NULL) {
11130 D(p->level--);
11131 return NULL;
11132 }
11133 int _end_lineno = _token->end_lineno;
11134 UNUSED(_end_lineno); // Only used by EXTRA macro
11135 int _end_col_offset = _token->end_col_offset;
11136 UNUSED(_end_col_offset); // Only used by EXTRA macro
11137 _res = _Py_ListComp ( a , b , EXTRA );
11138 if (_res == NULL && PyErr_Occurred()) {
11139 p->error_indicator = 1;
11140 D(p->level--);
11141 return NULL;
11142 }
11143 goto done;
11144 }
11145 p->mark = _mark;
11146 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011147 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11148 if (_cut_var) {
11149 D(p->level--);
11150 return NULL;
11151 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011152 }
11153 { // invalid_comprehension
11154 if (p->error_indicator) {
11155 D(p->level--);
11156 return NULL;
11157 }
11158 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11159 void *invalid_comprehension_var;
11160 if (
11161 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11162 )
11163 {
11164 D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11165 _res = invalid_comprehension_var;
11166 goto done;
11167 }
11168 p->mark = _mark;
11169 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
11170 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11171 }
11172 _res = NULL;
11173 done:
11174 D(p->level--);
11175 return _res;
11176}
11177
11178// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
11179static expr_ty
11180tuple_rule(Parser *p)
11181{
11182 D(p->level++);
11183 if (p->error_indicator) {
11184 D(p->level--);
11185 return NULL;
11186 }
11187 expr_ty _res = NULL;
11188 int _mark = p->mark;
11189 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11190 p->error_indicator = 1;
11191 D(p->level--);
11192 return NULL;
11193 }
11194 int _start_lineno = p->tokens[_mark]->lineno;
11195 UNUSED(_start_lineno); // Only used by EXTRA macro
11196 int _start_col_offset = p->tokens[_mark]->col_offset;
11197 UNUSED(_start_col_offset); // Only used by EXTRA macro
11198 { // '(' [star_named_expression ',' star_named_expressions?] ')'
11199 if (p->error_indicator) {
11200 D(p->level--);
11201 return NULL;
11202 }
11203 D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11204 Token * _literal;
11205 Token * _literal_1;
11206 void *a;
11207 if (
11208 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11209 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011210 (a = _tmp_101_rule(p), 1) // [star_named_expression ',' star_named_expressions?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011211 &&
11212 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11213 )
11214 {
11215 D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11216 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11217 if (_token == NULL) {
11218 D(p->level--);
11219 return NULL;
11220 }
11221 int _end_lineno = _token->end_lineno;
11222 UNUSED(_end_lineno); // Only used by EXTRA macro
11223 int _end_col_offset = _token->end_col_offset;
11224 UNUSED(_end_col_offset); // Only used by EXTRA macro
11225 _res = _Py_Tuple ( a , Load , EXTRA );
11226 if (_res == NULL && PyErr_Occurred()) {
11227 p->error_indicator = 1;
11228 D(p->level--);
11229 return NULL;
11230 }
11231 goto done;
11232 }
11233 p->mark = _mark;
11234 D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
11235 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11236 }
11237 _res = NULL;
11238 done:
11239 D(p->level--);
11240 return _res;
11241}
11242
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011243// group: '(' (yield_expr | named_expression) ')' | invalid_group
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011244static expr_ty
11245group_rule(Parser *p)
11246{
11247 D(p->level++);
11248 if (p->error_indicator) {
11249 D(p->level--);
11250 return NULL;
11251 }
11252 expr_ty _res = NULL;
11253 int _mark = p->mark;
11254 { // '(' (yield_expr | named_expression) ')'
11255 if (p->error_indicator) {
11256 D(p->level--);
11257 return NULL;
11258 }
11259 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11260 Token * _literal;
11261 Token * _literal_1;
11262 void *a;
11263 if (
11264 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11265 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011266 (a = _tmp_102_rule(p)) // yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011267 &&
11268 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11269 )
11270 {
11271 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11272 _res = a;
11273 if (_res == NULL && PyErr_Occurred()) {
11274 p->error_indicator = 1;
11275 D(p->level--);
11276 return NULL;
11277 }
11278 goto done;
11279 }
11280 p->mark = _mark;
11281 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11282 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11283 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011284 { // invalid_group
11285 if (p->error_indicator) {
11286 D(p->level--);
11287 return NULL;
11288 }
11289 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11290 void *invalid_group_var;
11291 if (
11292 (invalid_group_var = invalid_group_rule(p)) // invalid_group
11293 )
11294 {
11295 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11296 _res = invalid_group_var;
11297 goto done;
11298 }
11299 p->mark = _mark;
11300 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11301 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
11302 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011303 _res = NULL;
11304 done:
11305 D(p->level--);
11306 return _res;
11307}
11308
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011309// genexp: '(' expression ~ for_if_clauses ')' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011310static expr_ty
11311genexp_rule(Parser *p)
11312{
11313 D(p->level++);
11314 if (p->error_indicator) {
11315 D(p->level--);
11316 return NULL;
11317 }
11318 expr_ty _res = NULL;
11319 int _mark = p->mark;
11320 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11321 p->error_indicator = 1;
11322 D(p->level--);
11323 return NULL;
11324 }
11325 int _start_lineno = p->tokens[_mark]->lineno;
11326 UNUSED(_start_lineno); // Only used by EXTRA macro
11327 int _start_col_offset = p->tokens[_mark]->col_offset;
11328 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011329 { // '(' expression ~ for_if_clauses ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011330 if (p->error_indicator) {
11331 D(p->level--);
11332 return NULL;
11333 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011334 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11335 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011336 Token * _literal;
11337 Token * _literal_1;
11338 expr_ty a;
11339 asdl_seq* b;
11340 if (
11341 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11342 &&
11343 (a = expression_rule(p)) // expression
11344 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011345 (_cut_var = 1)
11346 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011347 (b = for_if_clauses_rule(p)) // for_if_clauses
11348 &&
11349 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11350 )
11351 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011352 D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011353 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11354 if (_token == NULL) {
11355 D(p->level--);
11356 return NULL;
11357 }
11358 int _end_lineno = _token->end_lineno;
11359 UNUSED(_end_lineno); // Only used by EXTRA macro
11360 int _end_col_offset = _token->end_col_offset;
11361 UNUSED(_end_col_offset); // Only used by EXTRA macro
11362 _res = _Py_GeneratorExp ( a , b , EXTRA );
11363 if (_res == NULL && PyErr_Occurred()) {
11364 p->error_indicator = 1;
11365 D(p->level--);
11366 return NULL;
11367 }
11368 goto done;
11369 }
11370 p->mark = _mark;
11371 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11373 if (_cut_var) {
11374 D(p->level--);
11375 return NULL;
11376 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011377 }
11378 { // invalid_comprehension
11379 if (p->error_indicator) {
11380 D(p->level--);
11381 return NULL;
11382 }
11383 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11384 void *invalid_comprehension_var;
11385 if (
11386 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11387 )
11388 {
11389 D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11390 _res = invalid_comprehension_var;
11391 goto done;
11392 }
11393 p->mark = _mark;
11394 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
11395 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11396 }
11397 _res = NULL;
11398 done:
11399 D(p->level--);
11400 return _res;
11401}
11402
11403// set: '{' expressions_list '}'
11404static expr_ty
11405set_rule(Parser *p)
11406{
11407 D(p->level++);
11408 if (p->error_indicator) {
11409 D(p->level--);
11410 return NULL;
11411 }
11412 expr_ty _res = NULL;
11413 int _mark = p->mark;
11414 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11415 p->error_indicator = 1;
11416 D(p->level--);
11417 return NULL;
11418 }
11419 int _start_lineno = p->tokens[_mark]->lineno;
11420 UNUSED(_start_lineno); // Only used by EXTRA macro
11421 int _start_col_offset = p->tokens[_mark]->col_offset;
11422 UNUSED(_start_col_offset); // Only used by EXTRA macro
11423 { // '{' expressions_list '}'
11424 if (p->error_indicator) {
11425 D(p->level--);
11426 return NULL;
11427 }
11428 D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11429 Token * _literal;
11430 Token * _literal_1;
11431 asdl_seq* a;
11432 if (
11433 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11434 &&
11435 (a = expressions_list_rule(p)) // expressions_list
11436 &&
11437 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11438 )
11439 {
11440 D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11441 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11442 if (_token == NULL) {
11443 D(p->level--);
11444 return NULL;
11445 }
11446 int _end_lineno = _token->end_lineno;
11447 UNUSED(_end_lineno); // Only used by EXTRA macro
11448 int _end_col_offset = _token->end_col_offset;
11449 UNUSED(_end_col_offset); // Only used by EXTRA macro
11450 _res = _Py_Set ( a , EXTRA );
11451 if (_res == NULL && PyErr_Occurred()) {
11452 p->error_indicator = 1;
11453 D(p->level--);
11454 return NULL;
11455 }
11456 goto done;
11457 }
11458 p->mark = _mark;
11459 D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
11460 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'"));
11461 }
11462 _res = NULL;
11463 done:
11464 D(p->level--);
11465 return _res;
11466}
11467
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011468// setcomp: '{' expression ~ for_if_clauses '}' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011469static expr_ty
11470setcomp_rule(Parser *p)
11471{
11472 D(p->level++);
11473 if (p->error_indicator) {
11474 D(p->level--);
11475 return NULL;
11476 }
11477 expr_ty _res = NULL;
11478 int _mark = p->mark;
11479 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11480 p->error_indicator = 1;
11481 D(p->level--);
11482 return NULL;
11483 }
11484 int _start_lineno = p->tokens[_mark]->lineno;
11485 UNUSED(_start_lineno); // Only used by EXTRA macro
11486 int _start_col_offset = p->tokens[_mark]->col_offset;
11487 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011488 { // '{' expression ~ for_if_clauses '}'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011489 if (p->error_indicator) {
11490 D(p->level--);
11491 return NULL;
11492 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011493 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11494 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011495 Token * _literal;
11496 Token * _literal_1;
11497 expr_ty a;
11498 asdl_seq* b;
11499 if (
11500 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11501 &&
11502 (a = expression_rule(p)) // expression
11503 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011504 (_cut_var = 1)
11505 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011506 (b = for_if_clauses_rule(p)) // for_if_clauses
11507 &&
11508 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11509 )
11510 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011511 D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011512 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11513 if (_token == NULL) {
11514 D(p->level--);
11515 return NULL;
11516 }
11517 int _end_lineno = _token->end_lineno;
11518 UNUSED(_end_lineno); // Only used by EXTRA macro
11519 int _end_col_offset = _token->end_col_offset;
11520 UNUSED(_end_col_offset); // Only used by EXTRA macro
11521 _res = _Py_SetComp ( a , b , EXTRA );
11522 if (_res == NULL && PyErr_Occurred()) {
11523 p->error_indicator = 1;
11524 D(p->level--);
11525 return NULL;
11526 }
11527 goto done;
11528 }
11529 p->mark = _mark;
11530 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011531 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11532 if (_cut_var) {
11533 D(p->level--);
11534 return NULL;
11535 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011536 }
11537 { // invalid_comprehension
11538 if (p->error_indicator) {
11539 D(p->level--);
11540 return NULL;
11541 }
11542 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11543 void *invalid_comprehension_var;
11544 if (
11545 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11546 )
11547 {
11548 D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11549 _res = invalid_comprehension_var;
11550 goto done;
11551 }
11552 p->mark = _mark;
11553 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
11554 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11555 }
11556 _res = NULL;
11557 done:
11558 D(p->level--);
11559 return _res;
11560}
11561
11562// dict: '{' double_starred_kvpairs? '}'
11563static expr_ty
11564dict_rule(Parser *p)
11565{
11566 D(p->level++);
11567 if (p->error_indicator) {
11568 D(p->level--);
11569 return NULL;
11570 }
11571 expr_ty _res = NULL;
11572 int _mark = p->mark;
11573 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11574 p->error_indicator = 1;
11575 D(p->level--);
11576 return NULL;
11577 }
11578 int _start_lineno = p->tokens[_mark]->lineno;
11579 UNUSED(_start_lineno); // Only used by EXTRA macro
11580 int _start_col_offset = p->tokens[_mark]->col_offset;
11581 UNUSED(_start_col_offset); // Only used by EXTRA macro
11582 { // '{' double_starred_kvpairs? '}'
11583 if (p->error_indicator) {
11584 D(p->level--);
11585 return NULL;
11586 }
11587 D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11588 Token * _literal;
11589 Token * _literal_1;
11590 void *a;
11591 if (
11592 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11593 &&
11594 (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs?
11595 &&
11596 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11597 )
11598 {
11599 D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11600 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11601 if (_token == NULL) {
11602 D(p->level--);
11603 return NULL;
11604 }
11605 int _end_lineno = _token->end_lineno;
11606 UNUSED(_end_lineno); // Only used by EXTRA macro
11607 int _end_col_offset = _token->end_col_offset;
11608 UNUSED(_end_col_offset); // Only used by EXTRA macro
11609 _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA );
11610 if (_res == NULL && PyErr_Occurred()) {
11611 p->error_indicator = 1;
11612 D(p->level--);
11613 return NULL;
11614 }
11615 goto done;
11616 }
11617 p->mark = _mark;
11618 D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
11619 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11620 }
11621 _res = NULL;
11622 done:
11623 D(p->level--);
11624 return _res;
11625}
11626
11627// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
11628static expr_ty
11629dictcomp_rule(Parser *p)
11630{
11631 D(p->level++);
11632 if (p->error_indicator) {
11633 D(p->level--);
11634 return NULL;
11635 }
11636 expr_ty _res = NULL;
11637 int _mark = p->mark;
11638 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11639 p->error_indicator = 1;
11640 D(p->level--);
11641 return NULL;
11642 }
11643 int _start_lineno = p->tokens[_mark]->lineno;
11644 UNUSED(_start_lineno); // Only used by EXTRA macro
11645 int _start_col_offset = p->tokens[_mark]->col_offset;
11646 UNUSED(_start_col_offset); // Only used by EXTRA macro
11647 { // '{' kvpair for_if_clauses '}'
11648 if (p->error_indicator) {
11649 D(p->level--);
11650 return NULL;
11651 }
11652 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11653 Token * _literal;
11654 Token * _literal_1;
11655 KeyValuePair* a;
11656 asdl_seq* b;
11657 if (
11658 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11659 &&
11660 (a = kvpair_rule(p)) // kvpair
11661 &&
11662 (b = for_if_clauses_rule(p)) // for_if_clauses
11663 &&
11664 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11665 )
11666 {
11667 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11668 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11669 if (_token == NULL) {
11670 D(p->level--);
11671 return NULL;
11672 }
11673 int _end_lineno = _token->end_lineno;
11674 UNUSED(_end_lineno); // Only used by EXTRA macro
11675 int _end_col_offset = _token->end_col_offset;
11676 UNUSED(_end_col_offset); // Only used by EXTRA macro
11677 _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
11678 if (_res == NULL && PyErr_Occurred()) {
11679 p->error_indicator = 1;
11680 D(p->level--);
11681 return NULL;
11682 }
11683 goto done;
11684 }
11685 p->mark = _mark;
11686 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11687 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11688 }
11689 { // invalid_dict_comprehension
11690 if (p->error_indicator) {
11691 D(p->level--);
11692 return NULL;
11693 }
11694 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11695 void *invalid_dict_comprehension_var;
11696 if (
11697 (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
11698 )
11699 {
11700 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11701 _res = invalid_dict_comprehension_var;
11702 goto done;
11703 }
11704 p->mark = _mark;
11705 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11706 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
11707 }
11708 _res = NULL;
11709 done:
11710 D(p->level--);
11711 return _res;
11712}
11713
11714// double_starred_kvpairs: ','.double_starred_kvpair+ ','?
11715static asdl_seq*
11716double_starred_kvpairs_rule(Parser *p)
11717{
11718 D(p->level++);
11719 if (p->error_indicator) {
11720 D(p->level--);
11721 return NULL;
11722 }
11723 asdl_seq* _res = NULL;
11724 int _mark = p->mark;
11725 { // ','.double_starred_kvpair+ ','?
11726 if (p->error_indicator) {
11727 D(p->level--);
11728 return NULL;
11729 }
11730 D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11731 void *_opt_var;
11732 UNUSED(_opt_var); // Silence compiler warnings
11733 asdl_seq * a;
11734 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011735 (a = _gather_103_rule(p)) // ','.double_starred_kvpair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011736 &&
11737 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
11738 )
11739 {
11740 D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11741 _res = a;
11742 if (_res == NULL && PyErr_Occurred()) {
11743 p->error_indicator = 1;
11744 D(p->level--);
11745 return NULL;
11746 }
11747 goto done;
11748 }
11749 p->mark = _mark;
11750 D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
11751 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11752 }
11753 _res = NULL;
11754 done:
11755 D(p->level--);
11756 return _res;
11757}
11758
11759// double_starred_kvpair: '**' bitwise_or | kvpair
11760static KeyValuePair*
11761double_starred_kvpair_rule(Parser *p)
11762{
11763 D(p->level++);
11764 if (p->error_indicator) {
11765 D(p->level--);
11766 return NULL;
11767 }
11768 KeyValuePair* _res = NULL;
11769 int _mark = p->mark;
11770 { // '**' bitwise_or
11771 if (p->error_indicator) {
11772 D(p->level--);
11773 return NULL;
11774 }
11775 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11776 Token * _literal;
11777 expr_ty a;
11778 if (
11779 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
11780 &&
11781 (a = bitwise_or_rule(p)) // bitwise_or
11782 )
11783 {
11784 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11785 _res = _PyPegen_key_value_pair ( p , NULL , a );
11786 if (_res == NULL && PyErr_Occurred()) {
11787 p->error_indicator = 1;
11788 D(p->level--);
11789 return NULL;
11790 }
11791 goto done;
11792 }
11793 p->mark = _mark;
11794 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11795 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
11796 }
11797 { // kvpair
11798 if (p->error_indicator) {
11799 D(p->level--);
11800 return NULL;
11801 }
11802 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
11803 KeyValuePair* kvpair_var;
11804 if (
11805 (kvpair_var = kvpair_rule(p)) // kvpair
11806 )
11807 {
11808 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
11809 _res = kvpair_var;
11810 goto done;
11811 }
11812 p->mark = _mark;
11813 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11814 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
11815 }
11816 _res = NULL;
11817 done:
11818 D(p->level--);
11819 return _res;
11820}
11821
11822// kvpair: expression ':' expression
11823static KeyValuePair*
11824kvpair_rule(Parser *p)
11825{
11826 D(p->level++);
11827 if (p->error_indicator) {
11828 D(p->level--);
11829 return NULL;
11830 }
11831 KeyValuePair* _res = NULL;
11832 int _mark = p->mark;
11833 { // expression ':' expression
11834 if (p->error_indicator) {
11835 D(p->level--);
11836 return NULL;
11837 }
11838 D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11839 Token * _literal;
11840 expr_ty a;
11841 expr_ty b;
11842 if (
11843 (a = expression_rule(p)) // expression
11844 &&
11845 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
11846 &&
11847 (b = expression_rule(p)) // expression
11848 )
11849 {
11850 D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11851 _res = _PyPegen_key_value_pair ( p , a , b );
11852 if (_res == NULL && PyErr_Occurred()) {
11853 p->error_indicator = 1;
11854 D(p->level--);
11855 return NULL;
11856 }
11857 goto done;
11858 }
11859 p->mark = _mark;
11860 D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11861 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
11862 }
11863 _res = NULL;
11864 done:
11865 D(p->level--);
11866 return _res;
11867}
11868
11869// for_if_clauses: for_if_clause+
11870static asdl_seq*
11871for_if_clauses_rule(Parser *p)
11872{
11873 D(p->level++);
11874 if (p->error_indicator) {
11875 D(p->level--);
11876 return NULL;
11877 }
11878 asdl_seq* _res = NULL;
11879 int _mark = p->mark;
11880 { // for_if_clause+
11881 if (p->error_indicator) {
11882 D(p->level--);
11883 return NULL;
11884 }
11885 D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011886 asdl_seq * _loop1_105_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011887 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011888 (_loop1_105_var = _loop1_105_rule(p)) // for_if_clause+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011889 )
11890 {
11891 D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011892 _res = _loop1_105_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011893 goto done;
11894 }
11895 p->mark = _mark;
11896 D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
11897 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
11898 }
11899 _res = NULL;
11900 done:
11901 D(p->level--);
11902 return _res;
11903}
11904
11905// for_if_clause:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011906// | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11907// | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11908// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011909static comprehension_ty
11910for_if_clause_rule(Parser *p)
11911{
11912 D(p->level++);
11913 if (p->error_indicator) {
11914 D(p->level--);
11915 return NULL;
11916 }
11917 comprehension_ty _res = NULL;
11918 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011919 { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011920 if (p->error_indicator) {
11921 D(p->level--);
11922 return NULL;
11923 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011924 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11925 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011926 Token * _keyword;
11927 Token * _keyword_1;
11928 expr_ty a;
11929 Token * async_var;
11930 expr_ty b;
11931 asdl_seq * c;
11932 if (
11933 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
11934 &&
11935 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11936 &&
11937 (a = star_targets_rule(p)) // star_targets
11938 &&
11939 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11940 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011941 (_cut_var = 1)
11942 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011943 (b = disjunction_rule(p)) // disjunction
11944 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011945 (c = _loop0_106_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011946 )
11947 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011948 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011949 _res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) );
11950 if (_res == NULL && PyErr_Occurred()) {
11951 p->error_indicator = 1;
11952 D(p->level--);
11953 return NULL;
11954 }
11955 goto done;
11956 }
11957 p->mark = _mark;
11958 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011959 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11960 if (_cut_var) {
11961 D(p->level--);
11962 return NULL;
11963 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011964 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011965 { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011966 if (p->error_indicator) {
11967 D(p->level--);
11968 return NULL;
11969 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011970 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11971 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011972 Token * _keyword;
11973 Token * _keyword_1;
11974 expr_ty a;
11975 expr_ty b;
11976 asdl_seq * c;
11977 if (
11978 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11979 &&
11980 (a = star_targets_rule(p)) // star_targets
11981 &&
11982 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11983 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011984 (_cut_var = 1)
11985 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011986 (b = disjunction_rule(p)) // disjunction
11987 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011988 (c = _loop0_107_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011989 )
11990 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011991 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011992 _res = _Py_comprehension ( a , b , c , 0 , p -> arena );
11993 if (_res == NULL && PyErr_Occurred()) {
11994 p->error_indicator = 1;
11995 D(p->level--);
11996 return NULL;
11997 }
11998 goto done;
11999 }
12000 p->mark = _mark;
12001 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012002 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
12003 if (_cut_var) {
12004 D(p->level--);
12005 return NULL;
12006 }
12007 }
12008 { // invalid_for_target
12009 if (p->error_indicator) {
12010 D(p->level--);
12011 return NULL;
12012 }
12013 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12014 void *invalid_for_target_var;
12015 if (
12016 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
12017 )
12018 {
12019 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12020 _res = invalid_for_target_var;
12021 goto done;
12022 }
12023 p->mark = _mark;
12024 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
12025 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012026 }
12027 _res = NULL;
12028 done:
12029 D(p->level--);
12030 return _res;
12031}
12032
12033// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
12034static expr_ty
12035yield_expr_rule(Parser *p)
12036{
12037 D(p->level++);
12038 if (p->error_indicator) {
12039 D(p->level--);
12040 return NULL;
12041 }
12042 expr_ty _res = NULL;
12043 int _mark = p->mark;
12044 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12045 p->error_indicator = 1;
12046 D(p->level--);
12047 return NULL;
12048 }
12049 int _start_lineno = p->tokens[_mark]->lineno;
12050 UNUSED(_start_lineno); // Only used by EXTRA macro
12051 int _start_col_offset = p->tokens[_mark]->col_offset;
12052 UNUSED(_start_col_offset); // Only used by EXTRA macro
12053 { // 'yield' 'from' expression
12054 if (p->error_indicator) {
12055 D(p->level--);
12056 return NULL;
12057 }
12058 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12059 Token * _keyword;
12060 Token * _keyword_1;
12061 expr_ty a;
12062 if (
12063 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12064 &&
12065 (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from'
12066 &&
12067 (a = expression_rule(p)) // expression
12068 )
12069 {
12070 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12071 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12072 if (_token == NULL) {
12073 D(p->level--);
12074 return NULL;
12075 }
12076 int _end_lineno = _token->end_lineno;
12077 UNUSED(_end_lineno); // Only used by EXTRA macro
12078 int _end_col_offset = _token->end_col_offset;
12079 UNUSED(_end_col_offset); // Only used by EXTRA macro
12080 _res = _Py_YieldFrom ( a , EXTRA );
12081 if (_res == NULL && PyErr_Occurred()) {
12082 p->error_indicator = 1;
12083 D(p->level--);
12084 return NULL;
12085 }
12086 goto done;
12087 }
12088 p->mark = _mark;
12089 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12090 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
12091 }
12092 { // 'yield' star_expressions?
12093 if (p->error_indicator) {
12094 D(p->level--);
12095 return NULL;
12096 }
12097 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12098 Token * _keyword;
12099 void *a;
12100 if (
12101 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12102 &&
12103 (a = star_expressions_rule(p), 1) // star_expressions?
12104 )
12105 {
12106 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12107 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12108 if (_token == NULL) {
12109 D(p->level--);
12110 return NULL;
12111 }
12112 int _end_lineno = _token->end_lineno;
12113 UNUSED(_end_lineno); // Only used by EXTRA macro
12114 int _end_col_offset = _token->end_col_offset;
12115 UNUSED(_end_col_offset); // Only used by EXTRA macro
12116 _res = _Py_Yield ( a , EXTRA );
12117 if (_res == NULL && PyErr_Occurred()) {
12118 p->error_indicator = 1;
12119 D(p->level--);
12120 return NULL;
12121 }
12122 goto done;
12123 }
12124 p->mark = _mark;
12125 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12126 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
12127 }
12128 _res = NULL;
12129 done:
12130 D(p->level--);
12131 return _res;
12132}
12133
12134// arguments: args ','? &')' | incorrect_arguments
12135static expr_ty
12136arguments_rule(Parser *p)
12137{
12138 D(p->level++);
12139 if (p->error_indicator) {
12140 D(p->level--);
12141 return NULL;
12142 }
12143 expr_ty _res = NULL;
12144 if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
12145 D(p->level--);
12146 return _res;
12147 }
12148 int _mark = p->mark;
12149 { // args ','? &')'
12150 if (p->error_indicator) {
12151 D(p->level--);
12152 return NULL;
12153 }
12154 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12155 void *_opt_var;
12156 UNUSED(_opt_var); // Silence compiler warnings
12157 expr_ty a;
12158 if (
12159 (a = args_rule(p)) // args
12160 &&
12161 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12162 &&
12163 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
12164 )
12165 {
12166 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12167 _res = a;
12168 if (_res == NULL && PyErr_Occurred()) {
12169 p->error_indicator = 1;
12170 D(p->level--);
12171 return NULL;
12172 }
12173 goto done;
12174 }
12175 p->mark = _mark;
12176 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12177 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
12178 }
12179 { // incorrect_arguments
12180 if (p->error_indicator) {
12181 D(p->level--);
12182 return NULL;
12183 }
12184 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "incorrect_arguments"));
12185 void *incorrect_arguments_var;
12186 if (
12187 (incorrect_arguments_var = incorrect_arguments_rule(p)) // incorrect_arguments
12188 )
12189 {
12190 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "incorrect_arguments"));
12191 _res = incorrect_arguments_var;
12192 goto done;
12193 }
12194 p->mark = _mark;
12195 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12196 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "incorrect_arguments"));
12197 }
12198 _res = NULL;
12199 done:
12200 _PyPegen_insert_memo(p, _mark, arguments_type, _res);
12201 D(p->level--);
12202 return _res;
12203}
12204
Pablo Galindo4a97b152020-09-02 17:44:19 +010012205// args: ','.(starred_expression | named_expression !'=')+ [',' kwargs] | kwargs
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012206static expr_ty
12207args_rule(Parser *p)
12208{
12209 D(p->level++);
12210 if (p->error_indicator) {
12211 D(p->level--);
12212 return NULL;
12213 }
12214 expr_ty _res = NULL;
12215 int _mark = p->mark;
12216 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12217 p->error_indicator = 1;
12218 D(p->level--);
12219 return NULL;
12220 }
12221 int _start_lineno = p->tokens[_mark]->lineno;
12222 UNUSED(_start_lineno); // Only used by EXTRA macro
12223 int _start_col_offset = p->tokens[_mark]->col_offset;
12224 UNUSED(_start_col_offset); // Only used by EXTRA macro
Pablo Galindo4a97b152020-09-02 17:44:19 +010012225 { // ','.(starred_expression | named_expression !'=')+ [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012226 if (p->error_indicator) {
12227 D(p->level--);
12228 return NULL;
12229 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010012230 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
12231 asdl_seq * a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012232 void *b;
12233 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012234 (a = _gather_108_rule(p)) // ','.(starred_expression | named_expression !'=')+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012235 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012236 (b = _tmp_110_rule(p), 1) // [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012237 )
12238 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010012239 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
Pablo Galindo315a61f2020-09-03 15:29:32 +010012240 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12241 if (_token == NULL) {
12242 D(p->level--);
12243 return NULL;
12244 }
12245 int _end_lineno = _token->end_lineno;
12246 UNUSED(_end_lineno); // Only used by EXTRA macro
12247 int _end_col_offset = _token->end_col_offset;
12248 UNUSED(_end_col_offset); // Only used by EXTRA macro
12249 _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012250 if (_res == NULL && PyErr_Occurred()) {
12251 p->error_indicator = 1;
12252 D(p->level--);
12253 return NULL;
12254 }
12255 goto done;
12256 }
12257 p->mark = _mark;
12258 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010012259 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012260 }
12261 { // kwargs
12262 if (p->error_indicator) {
12263 D(p->level--);
12264 return NULL;
12265 }
12266 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
12267 asdl_seq* a;
12268 if (
12269 (a = kwargs_rule(p)) // kwargs
12270 )
12271 {
12272 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
12273 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12274 if (_token == NULL) {
12275 D(p->level--);
12276 return NULL;
12277 }
12278 int _end_lineno = _token->end_lineno;
12279 UNUSED(_end_lineno); // Only used by EXTRA macro
12280 int _end_col_offset = _token->end_col_offset;
12281 UNUSED(_end_col_offset); // Only used by EXTRA macro
12282 _res = _Py_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA );
12283 if (_res == NULL && PyErr_Occurred()) {
12284 p->error_indicator = 1;
12285 D(p->level--);
12286 return NULL;
12287 }
12288 goto done;
12289 }
12290 p->mark = _mark;
12291 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12292 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
12293 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012294 _res = NULL;
12295 done:
12296 D(p->level--);
12297 return _res;
12298}
12299
12300// kwargs:
12301// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12302// | ','.kwarg_or_starred+
12303// | ','.kwarg_or_double_starred+
12304static asdl_seq*
12305kwargs_rule(Parser *p)
12306{
12307 D(p->level++);
12308 if (p->error_indicator) {
12309 D(p->level--);
12310 return NULL;
12311 }
12312 asdl_seq* _res = NULL;
12313 int _mark = p->mark;
12314 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12315 if (p->error_indicator) {
12316 D(p->level--);
12317 return NULL;
12318 }
12319 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12320 Token * _literal;
12321 asdl_seq * a;
12322 asdl_seq * b;
12323 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012324 (a = _gather_111_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012325 &&
12326 (_literal = _PyPegen_expect_token(p, 12)) // token=','
12327 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012328 (b = _gather_113_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012329 )
12330 {
12331 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12332 _res = _PyPegen_join_sequences ( p , a , b );
12333 if (_res == NULL && PyErr_Occurred()) {
12334 p->error_indicator = 1;
12335 D(p->level--);
12336 return NULL;
12337 }
12338 goto done;
12339 }
12340 p->mark = _mark;
12341 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12342 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12343 }
12344 { // ','.kwarg_or_starred+
12345 if (p->error_indicator) {
12346 D(p->level--);
12347 return NULL;
12348 }
12349 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012350 asdl_seq * _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012351 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012352 (_gather_115_var = _gather_115_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012353 )
12354 {
12355 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 +010012356 _res = _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012357 goto done;
12358 }
12359 p->mark = _mark;
12360 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12361 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
12362 }
12363 { // ','.kwarg_or_double_starred+
12364 if (p->error_indicator) {
12365 D(p->level--);
12366 return NULL;
12367 }
12368 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 +010012369 asdl_seq * _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012370 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012371 (_gather_117_var = _gather_117_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012372 )
12373 {
12374 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 +010012375 _res = _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012376 goto done;
12377 }
12378 p->mark = _mark;
12379 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12380 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
12381 }
12382 _res = NULL;
12383 done:
12384 D(p->level--);
12385 return _res;
12386}
12387
12388// starred_expression: '*' expression
12389static expr_ty
12390starred_expression_rule(Parser *p)
12391{
12392 D(p->level++);
12393 if (p->error_indicator) {
12394 D(p->level--);
12395 return NULL;
12396 }
12397 expr_ty _res = NULL;
12398 int _mark = p->mark;
12399 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12400 p->error_indicator = 1;
12401 D(p->level--);
12402 return NULL;
12403 }
12404 int _start_lineno = p->tokens[_mark]->lineno;
12405 UNUSED(_start_lineno); // Only used by EXTRA macro
12406 int _start_col_offset = p->tokens[_mark]->col_offset;
12407 UNUSED(_start_col_offset); // Only used by EXTRA macro
12408 { // '*' expression
12409 if (p->error_indicator) {
12410 D(p->level--);
12411 return NULL;
12412 }
12413 D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12414 Token * _literal;
12415 expr_ty a;
12416 if (
12417 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12418 &&
12419 (a = expression_rule(p)) // expression
12420 )
12421 {
12422 D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12423 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12424 if (_token == NULL) {
12425 D(p->level--);
12426 return NULL;
12427 }
12428 int _end_lineno = _token->end_lineno;
12429 UNUSED(_end_lineno); // Only used by EXTRA macro
12430 int _end_col_offset = _token->end_col_offset;
12431 UNUSED(_end_col_offset); // Only used by EXTRA macro
12432 _res = _Py_Starred ( a , Load , EXTRA );
12433 if (_res == NULL && PyErr_Occurred()) {
12434 p->error_indicator = 1;
12435 D(p->level--);
12436 return NULL;
12437 }
12438 goto done;
12439 }
12440 p->mark = _mark;
12441 D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
12442 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
12443 }
12444 _res = NULL;
12445 done:
12446 D(p->level--);
12447 return _res;
12448}
12449
12450// kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg
12451static KeywordOrStarred*
12452kwarg_or_starred_rule(Parser *p)
12453{
12454 D(p->level++);
12455 if (p->error_indicator) {
12456 D(p->level--);
12457 return NULL;
12458 }
12459 KeywordOrStarred* _res = NULL;
12460 int _mark = p->mark;
12461 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12462 p->error_indicator = 1;
12463 D(p->level--);
12464 return NULL;
12465 }
12466 int _start_lineno = p->tokens[_mark]->lineno;
12467 UNUSED(_start_lineno); // Only used by EXTRA macro
12468 int _start_col_offset = p->tokens[_mark]->col_offset;
12469 UNUSED(_start_col_offset); // Only used by EXTRA macro
12470 { // NAME '=' expression
12471 if (p->error_indicator) {
12472 D(p->level--);
12473 return NULL;
12474 }
12475 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12476 Token * _literal;
12477 expr_ty a;
12478 expr_ty b;
12479 if (
12480 (a = _PyPegen_name_token(p)) // NAME
12481 &&
12482 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12483 &&
12484 (b = expression_rule(p)) // expression
12485 )
12486 {
12487 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12488 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12489 if (_token == NULL) {
12490 D(p->level--);
12491 return NULL;
12492 }
12493 int _end_lineno = _token->end_lineno;
12494 UNUSED(_end_lineno); // Only used by EXTRA macro
12495 int _end_col_offset = _token->end_col_offset;
12496 UNUSED(_end_col_offset); // Only used by EXTRA macro
12497 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
12498 if (_res == NULL && PyErr_Occurred()) {
12499 p->error_indicator = 1;
12500 D(p->level--);
12501 return NULL;
12502 }
12503 goto done;
12504 }
12505 p->mark = _mark;
12506 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12507 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12508 }
12509 { // starred_expression
12510 if (p->error_indicator) {
12511 D(p->level--);
12512 return NULL;
12513 }
12514 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12515 expr_ty a;
12516 if (
12517 (a = starred_expression_rule(p)) // starred_expression
12518 )
12519 {
12520 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12521 _res = _PyPegen_keyword_or_starred ( p , a , 0 );
12522 if (_res == NULL && PyErr_Occurred()) {
12523 p->error_indicator = 1;
12524 D(p->level--);
12525 return NULL;
12526 }
12527 goto done;
12528 }
12529 p->mark = _mark;
12530 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12531 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
12532 }
12533 { // invalid_kwarg
12534 if (p->error_indicator) {
12535 D(p->level--);
12536 return NULL;
12537 }
12538 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12539 void *invalid_kwarg_var;
12540 if (
12541 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12542 )
12543 {
12544 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12545 _res = invalid_kwarg_var;
12546 goto done;
12547 }
12548 p->mark = _mark;
12549 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12550 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12551 }
12552 _res = NULL;
12553 done:
12554 D(p->level--);
12555 return _res;
12556}
12557
12558// kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg
12559static KeywordOrStarred*
12560kwarg_or_double_starred_rule(Parser *p)
12561{
12562 D(p->level++);
12563 if (p->error_indicator) {
12564 D(p->level--);
12565 return NULL;
12566 }
12567 KeywordOrStarred* _res = NULL;
12568 int _mark = p->mark;
12569 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12570 p->error_indicator = 1;
12571 D(p->level--);
12572 return NULL;
12573 }
12574 int _start_lineno = p->tokens[_mark]->lineno;
12575 UNUSED(_start_lineno); // Only used by EXTRA macro
12576 int _start_col_offset = p->tokens[_mark]->col_offset;
12577 UNUSED(_start_col_offset); // Only used by EXTRA macro
12578 { // NAME '=' expression
12579 if (p->error_indicator) {
12580 D(p->level--);
12581 return NULL;
12582 }
12583 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12584 Token * _literal;
12585 expr_ty a;
12586 expr_ty b;
12587 if (
12588 (a = _PyPegen_name_token(p)) // NAME
12589 &&
12590 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12591 &&
12592 (b = expression_rule(p)) // expression
12593 )
12594 {
12595 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12596 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12597 if (_token == NULL) {
12598 D(p->level--);
12599 return NULL;
12600 }
12601 int _end_lineno = _token->end_lineno;
12602 UNUSED(_end_lineno); // Only used by EXTRA macro
12603 int _end_col_offset = _token->end_col_offset;
12604 UNUSED(_end_col_offset); // Only used by EXTRA macro
12605 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
12606 if (_res == NULL && PyErr_Occurred()) {
12607 p->error_indicator = 1;
12608 D(p->level--);
12609 return NULL;
12610 }
12611 goto done;
12612 }
12613 p->mark = _mark;
12614 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12615 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12616 }
12617 { // '**' expression
12618 if (p->error_indicator) {
12619 D(p->level--);
12620 return NULL;
12621 }
12622 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12623 Token * _literal;
12624 expr_ty a;
12625 if (
12626 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
12627 &&
12628 (a = expression_rule(p)) // expression
12629 )
12630 {
12631 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12632 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12633 if (_token == NULL) {
12634 D(p->level--);
12635 return NULL;
12636 }
12637 int _end_lineno = _token->end_lineno;
12638 UNUSED(_end_lineno); // Only used by EXTRA macro
12639 int _end_col_offset = _token->end_col_offset;
12640 UNUSED(_end_col_offset); // Only used by EXTRA macro
12641 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
12642 if (_res == NULL && PyErr_Occurred()) {
12643 p->error_indicator = 1;
12644 D(p->level--);
12645 return NULL;
12646 }
12647 goto done;
12648 }
12649 p->mark = _mark;
12650 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12651 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
12652 }
12653 { // invalid_kwarg
12654 if (p->error_indicator) {
12655 D(p->level--);
12656 return NULL;
12657 }
12658 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12659 void *invalid_kwarg_var;
12660 if (
12661 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12662 )
12663 {
12664 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12665 _res = invalid_kwarg_var;
12666 goto done;
12667 }
12668 p->mark = _mark;
12669 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12670 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12671 }
12672 _res = NULL;
12673 done:
12674 D(p->level--);
12675 return _res;
12676}
12677
12678// star_targets: star_target !',' | star_target ((',' star_target))* ','?
12679static expr_ty
12680star_targets_rule(Parser *p)
12681{
12682 D(p->level++);
12683 if (p->error_indicator) {
12684 D(p->level--);
12685 return NULL;
12686 }
12687 expr_ty _res = NULL;
12688 int _mark = p->mark;
12689 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12690 p->error_indicator = 1;
12691 D(p->level--);
12692 return NULL;
12693 }
12694 int _start_lineno = p->tokens[_mark]->lineno;
12695 UNUSED(_start_lineno); // Only used by EXTRA macro
12696 int _start_col_offset = p->tokens[_mark]->col_offset;
12697 UNUSED(_start_col_offset); // Only used by EXTRA macro
12698 { // star_target !','
12699 if (p->error_indicator) {
12700 D(p->level--);
12701 return NULL;
12702 }
12703 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12704 expr_ty a;
12705 if (
12706 (a = star_target_rule(p)) // star_target
12707 &&
12708 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
12709 )
12710 {
12711 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12712 _res = a;
12713 if (_res == NULL && PyErr_Occurred()) {
12714 p->error_indicator = 1;
12715 D(p->level--);
12716 return NULL;
12717 }
12718 goto done;
12719 }
12720 p->mark = _mark;
12721 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12722 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
12723 }
12724 { // star_target ((',' star_target))* ','?
12725 if (p->error_indicator) {
12726 D(p->level--);
12727 return NULL;
12728 }
12729 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12730 void *_opt_var;
12731 UNUSED(_opt_var); // Silence compiler warnings
12732 expr_ty a;
12733 asdl_seq * b;
12734 if (
12735 (a = star_target_rule(p)) // star_target
12736 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012737 (b = _loop0_119_rule(p)) // ((',' star_target))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012738 &&
12739 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12740 )
12741 {
12742 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12743 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12744 if (_token == NULL) {
12745 D(p->level--);
12746 return NULL;
12747 }
12748 int _end_lineno = _token->end_lineno;
12749 UNUSED(_end_lineno); // Only used by EXTRA macro
12750 int _end_col_offset = _token->end_col_offset;
12751 UNUSED(_end_col_offset); // Only used by EXTRA macro
12752 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
12753 if (_res == NULL && PyErr_Occurred()) {
12754 p->error_indicator = 1;
12755 D(p->level--);
12756 return NULL;
12757 }
12758 goto done;
12759 }
12760 p->mark = _mark;
12761 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12762 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
12763 }
12764 _res = NULL;
12765 done:
12766 D(p->level--);
12767 return _res;
12768}
12769
12770// star_targets_seq: ','.star_target+ ','?
12771static asdl_seq*
12772star_targets_seq_rule(Parser *p)
12773{
12774 D(p->level++);
12775 if (p->error_indicator) {
12776 D(p->level--);
12777 return NULL;
12778 }
12779 asdl_seq* _res = NULL;
12780 int _mark = p->mark;
12781 { // ','.star_target+ ','?
12782 if (p->error_indicator) {
12783 D(p->level--);
12784 return NULL;
12785 }
12786 D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12787 void *_opt_var;
12788 UNUSED(_opt_var); // Silence compiler warnings
12789 asdl_seq * a;
12790 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012791 (a = _gather_120_rule(p)) // ','.star_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012792 &&
12793 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12794 )
12795 {
12796 D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12797 _res = a;
12798 if (_res == NULL && PyErr_Occurred()) {
12799 p->error_indicator = 1;
12800 D(p->level--);
12801 return NULL;
12802 }
12803 goto done;
12804 }
12805 p->mark = _mark;
12806 D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ',
12807 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
12808 }
12809 _res = NULL;
12810 done:
12811 D(p->level--);
12812 return _res;
12813}
12814
12815// star_target:
12816// | '*' (!'*' star_target)
12817// | t_primary '.' NAME !t_lookahead
12818// | t_primary '[' slices ']' !t_lookahead
12819// | star_atom
12820static expr_ty
12821star_target_rule(Parser *p)
12822{
12823 D(p->level++);
12824 if (p->error_indicator) {
12825 D(p->level--);
12826 return NULL;
12827 }
12828 expr_ty _res = NULL;
12829 if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
12830 D(p->level--);
12831 return _res;
12832 }
12833 int _mark = p->mark;
12834 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12835 p->error_indicator = 1;
12836 D(p->level--);
12837 return NULL;
12838 }
12839 int _start_lineno = p->tokens[_mark]->lineno;
12840 UNUSED(_start_lineno); // Only used by EXTRA macro
12841 int _start_col_offset = p->tokens[_mark]->col_offset;
12842 UNUSED(_start_col_offset); // Only used by EXTRA macro
12843 { // '*' (!'*' star_target)
12844 if (p->error_indicator) {
12845 D(p->level--);
12846 return NULL;
12847 }
12848 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12849 Token * _literal;
12850 void *a;
12851 if (
12852 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12853 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012854 (a = _tmp_122_rule(p)) // !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012855 )
12856 {
12857 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12858 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12859 if (_token == NULL) {
12860 D(p->level--);
12861 return NULL;
12862 }
12863 int _end_lineno = _token->end_lineno;
12864 UNUSED(_end_lineno); // Only used by EXTRA macro
12865 int _end_col_offset = _token->end_col_offset;
12866 UNUSED(_end_col_offset); // Only used by EXTRA macro
12867 _res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
12868 if (_res == NULL && PyErr_Occurred()) {
12869 p->error_indicator = 1;
12870 D(p->level--);
12871 return NULL;
12872 }
12873 goto done;
12874 }
12875 p->mark = _mark;
12876 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12877 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
12878 }
12879 { // t_primary '.' NAME !t_lookahead
12880 if (p->error_indicator) {
12881 D(p->level--);
12882 return NULL;
12883 }
12884 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12885 Token * _literal;
12886 expr_ty a;
12887 expr_ty b;
12888 if (
12889 (a = t_primary_rule(p)) // t_primary
12890 &&
12891 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
12892 &&
12893 (b = _PyPegen_name_token(p)) // NAME
12894 &&
12895 _PyPegen_lookahead(0, t_lookahead_rule, p)
12896 )
12897 {
12898 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12899 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12900 if (_token == NULL) {
12901 D(p->level--);
12902 return NULL;
12903 }
12904 int _end_lineno = _token->end_lineno;
12905 UNUSED(_end_lineno); // Only used by EXTRA macro
12906 int _end_col_offset = _token->end_col_offset;
12907 UNUSED(_end_col_offset); // Only used by EXTRA macro
12908 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
12909 if (_res == NULL && PyErr_Occurred()) {
12910 p->error_indicator = 1;
12911 D(p->level--);
12912 return NULL;
12913 }
12914 goto done;
12915 }
12916 p->mark = _mark;
12917 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12918 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12919 }
12920 { // t_primary '[' slices ']' !t_lookahead
12921 if (p->error_indicator) {
12922 D(p->level--);
12923 return NULL;
12924 }
12925 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12926 Token * _literal;
12927 Token * _literal_1;
12928 expr_ty a;
12929 expr_ty b;
12930 if (
12931 (a = t_primary_rule(p)) // t_primary
12932 &&
12933 (_literal = _PyPegen_expect_token(p, 9)) // token='['
12934 &&
12935 (b = slices_rule(p)) // slices
12936 &&
12937 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
12938 &&
12939 _PyPegen_lookahead(0, t_lookahead_rule, p)
12940 )
12941 {
12942 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12943 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12944 if (_token == NULL) {
12945 D(p->level--);
12946 return NULL;
12947 }
12948 int _end_lineno = _token->end_lineno;
12949 UNUSED(_end_lineno); // Only used by EXTRA macro
12950 int _end_col_offset = _token->end_col_offset;
12951 UNUSED(_end_col_offset); // Only used by EXTRA macro
12952 _res = _Py_Subscript ( a , b , Store , EXTRA );
12953 if (_res == NULL && PyErr_Occurred()) {
12954 p->error_indicator = 1;
12955 D(p->level--);
12956 return NULL;
12957 }
12958 goto done;
12959 }
12960 p->mark = _mark;
12961 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12962 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12963 }
12964 { // star_atom
12965 if (p->error_indicator) {
12966 D(p->level--);
12967 return NULL;
12968 }
12969 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
12970 expr_ty star_atom_var;
12971 if (
12972 (star_atom_var = star_atom_rule(p)) // star_atom
12973 )
12974 {
12975 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
12976 _res = star_atom_var;
12977 goto done;
12978 }
12979 p->mark = _mark;
12980 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12981 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
12982 }
12983 _res = NULL;
12984 done:
12985 _PyPegen_insert_memo(p, _mark, star_target_type, _res);
12986 D(p->level--);
12987 return _res;
12988}
12989
12990// star_atom:
12991// | NAME
12992// | '(' star_target ')'
12993// | '(' star_targets_seq? ')'
12994// | '[' star_targets_seq? ']'
12995static expr_ty
12996star_atom_rule(Parser *p)
12997{
12998 D(p->level++);
12999 if (p->error_indicator) {
13000 D(p->level--);
13001 return NULL;
13002 }
13003 expr_ty _res = NULL;
13004 int _mark = p->mark;
13005 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13006 p->error_indicator = 1;
13007 D(p->level--);
13008 return NULL;
13009 }
13010 int _start_lineno = p->tokens[_mark]->lineno;
13011 UNUSED(_start_lineno); // Only used by EXTRA macro
13012 int _start_col_offset = p->tokens[_mark]->col_offset;
13013 UNUSED(_start_col_offset); // Only used by EXTRA macro
13014 { // NAME
13015 if (p->error_indicator) {
13016 D(p->level--);
13017 return NULL;
13018 }
13019 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13020 expr_ty a;
13021 if (
13022 (a = _PyPegen_name_token(p)) // NAME
13023 )
13024 {
13025 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13026 _res = _PyPegen_set_expr_context ( p , a , Store );
13027 if (_res == NULL && PyErr_Occurred()) {
13028 p->error_indicator = 1;
13029 D(p->level--);
13030 return NULL;
13031 }
13032 goto done;
13033 }
13034 p->mark = _mark;
13035 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13036 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13037 }
13038 { // '(' star_target ')'
13039 if (p->error_indicator) {
13040 D(p->level--);
13041 return NULL;
13042 }
13043 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13044 Token * _literal;
13045 Token * _literal_1;
13046 expr_ty a;
13047 if (
13048 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13049 &&
13050 (a = star_target_rule(p)) // star_target
13051 &&
13052 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13053 )
13054 {
13055 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13056 _res = _PyPegen_set_expr_context ( p , a , Store );
13057 if (_res == NULL && PyErr_Occurred()) {
13058 p->error_indicator = 1;
13059 D(p->level--);
13060 return NULL;
13061 }
13062 goto done;
13063 }
13064 p->mark = _mark;
13065 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13066 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'"));
13067 }
13068 { // '(' star_targets_seq? ')'
13069 if (p->error_indicator) {
13070 D(p->level--);
13071 return NULL;
13072 }
13073 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13074 Token * _literal;
13075 Token * _literal_1;
13076 void *a;
13077 if (
13078 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13079 &&
13080 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13081 &&
13082 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13083 )
13084 {
13085 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13086 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13087 if (_token == NULL) {
13088 D(p->level--);
13089 return NULL;
13090 }
13091 int _end_lineno = _token->end_lineno;
13092 UNUSED(_end_lineno); // Only used by EXTRA macro
13093 int _end_col_offset = _token->end_col_offset;
13094 UNUSED(_end_col_offset); // Only used by EXTRA macro
13095 _res = _Py_Tuple ( a , Store , EXTRA );
13096 if (_res == NULL && PyErr_Occurred()) {
13097 p->error_indicator = 1;
13098 D(p->level--);
13099 return NULL;
13100 }
13101 goto done;
13102 }
13103 p->mark = _mark;
13104 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13105 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'"));
13106 }
13107 { // '[' star_targets_seq? ']'
13108 if (p->error_indicator) {
13109 D(p->level--);
13110 return NULL;
13111 }
13112 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13113 Token * _literal;
13114 Token * _literal_1;
13115 void *a;
13116 if (
13117 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13118 &&
13119 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13120 &&
13121 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13122 )
13123 {
13124 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13125 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13126 if (_token == NULL) {
13127 D(p->level--);
13128 return NULL;
13129 }
13130 int _end_lineno = _token->end_lineno;
13131 UNUSED(_end_lineno); // Only used by EXTRA macro
13132 int _end_col_offset = _token->end_col_offset;
13133 UNUSED(_end_col_offset); // Only used by EXTRA macro
13134 _res = _Py_List ( a , Store , EXTRA );
13135 if (_res == NULL && PyErr_Occurred()) {
13136 p->error_indicator = 1;
13137 D(p->level--);
13138 return NULL;
13139 }
13140 goto done;
13141 }
13142 p->mark = _mark;
13143 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13144 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'"));
13145 }
13146 _res = NULL;
13147 done:
13148 D(p->level--);
13149 return _res;
13150}
13151
13152// single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
13153static expr_ty
13154single_target_rule(Parser *p)
13155{
13156 D(p->level++);
13157 if (p->error_indicator) {
13158 D(p->level--);
13159 return NULL;
13160 }
13161 expr_ty _res = NULL;
13162 int _mark = p->mark;
13163 { // single_subscript_attribute_target
13164 if (p->error_indicator) {
13165 D(p->level--);
13166 return NULL;
13167 }
13168 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13169 expr_ty single_subscript_attribute_target_var;
13170 if (
13171 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
13172 )
13173 {
13174 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13175 _res = single_subscript_attribute_target_var;
13176 goto done;
13177 }
13178 p->mark = _mark;
13179 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13180 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
13181 }
13182 { // NAME
13183 if (p->error_indicator) {
13184 D(p->level--);
13185 return NULL;
13186 }
13187 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13188 expr_ty a;
13189 if (
13190 (a = _PyPegen_name_token(p)) // NAME
13191 )
13192 {
13193 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13194 _res = _PyPegen_set_expr_context ( p , a , Store );
13195 if (_res == NULL && PyErr_Occurred()) {
13196 p->error_indicator = 1;
13197 D(p->level--);
13198 return NULL;
13199 }
13200 goto done;
13201 }
13202 p->mark = _mark;
13203 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13204 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13205 }
13206 { // '(' single_target ')'
13207 if (p->error_indicator) {
13208 D(p->level--);
13209 return NULL;
13210 }
13211 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13212 Token * _literal;
13213 Token * _literal_1;
13214 expr_ty a;
13215 if (
13216 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13217 &&
13218 (a = single_target_rule(p)) // single_target
13219 &&
13220 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13221 )
13222 {
13223 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13224 _res = a;
13225 if (_res == NULL && PyErr_Occurred()) {
13226 p->error_indicator = 1;
13227 D(p->level--);
13228 return NULL;
13229 }
13230 goto done;
13231 }
13232 p->mark = _mark;
13233 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13234 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
13235 }
13236 _res = NULL;
13237 done:
13238 D(p->level--);
13239 return _res;
13240}
13241
13242// single_subscript_attribute_target:
13243// | t_primary '.' NAME !t_lookahead
13244// | t_primary '[' slices ']' !t_lookahead
13245static expr_ty
13246single_subscript_attribute_target_rule(Parser *p)
13247{
13248 D(p->level++);
13249 if (p->error_indicator) {
13250 D(p->level--);
13251 return NULL;
13252 }
13253 expr_ty _res = NULL;
13254 int _mark = p->mark;
13255 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13256 p->error_indicator = 1;
13257 D(p->level--);
13258 return NULL;
13259 }
13260 int _start_lineno = p->tokens[_mark]->lineno;
13261 UNUSED(_start_lineno); // Only used by EXTRA macro
13262 int _start_col_offset = p->tokens[_mark]->col_offset;
13263 UNUSED(_start_col_offset); // Only used by EXTRA macro
13264 { // t_primary '.' NAME !t_lookahead
13265 if (p->error_indicator) {
13266 D(p->level--);
13267 return NULL;
13268 }
13269 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13270 Token * _literal;
13271 expr_ty a;
13272 expr_ty b;
13273 if (
13274 (a = t_primary_rule(p)) // t_primary
13275 &&
13276 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13277 &&
13278 (b = _PyPegen_name_token(p)) // NAME
13279 &&
13280 _PyPegen_lookahead(0, t_lookahead_rule, p)
13281 )
13282 {
13283 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13284 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13285 if (_token == NULL) {
13286 D(p->level--);
13287 return NULL;
13288 }
13289 int _end_lineno = _token->end_lineno;
13290 UNUSED(_end_lineno); // Only used by EXTRA macro
13291 int _end_col_offset = _token->end_col_offset;
13292 UNUSED(_end_col_offset); // Only used by EXTRA macro
13293 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13294 if (_res == NULL && PyErr_Occurred()) {
13295 p->error_indicator = 1;
13296 D(p->level--);
13297 return NULL;
13298 }
13299 goto done;
13300 }
13301 p->mark = _mark;
13302 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13303 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13304 }
13305 { // t_primary '[' slices ']' !t_lookahead
13306 if (p->error_indicator) {
13307 D(p->level--);
13308 return NULL;
13309 }
13310 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13311 Token * _literal;
13312 Token * _literal_1;
13313 expr_ty a;
13314 expr_ty b;
13315 if (
13316 (a = t_primary_rule(p)) // t_primary
13317 &&
13318 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13319 &&
13320 (b = slices_rule(p)) // slices
13321 &&
13322 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13323 &&
13324 _PyPegen_lookahead(0, t_lookahead_rule, p)
13325 )
13326 {
13327 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13328 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13329 if (_token == NULL) {
13330 D(p->level--);
13331 return NULL;
13332 }
13333 int _end_lineno = _token->end_lineno;
13334 UNUSED(_end_lineno); // Only used by EXTRA macro
13335 int _end_col_offset = _token->end_col_offset;
13336 UNUSED(_end_col_offset); // Only used by EXTRA macro
13337 _res = _Py_Subscript ( a , b , Store , EXTRA );
13338 if (_res == NULL && PyErr_Occurred()) {
13339 p->error_indicator = 1;
13340 D(p->level--);
13341 return NULL;
13342 }
13343 goto done;
13344 }
13345 p->mark = _mark;
13346 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13347 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13348 }
13349 _res = NULL;
13350 done:
13351 D(p->level--);
13352 return _res;
13353}
13354
13355// del_targets: ','.del_target+ ','?
13356static asdl_seq*
13357del_targets_rule(Parser *p)
13358{
13359 D(p->level++);
13360 if (p->error_indicator) {
13361 D(p->level--);
13362 return NULL;
13363 }
13364 asdl_seq* _res = NULL;
13365 int _mark = p->mark;
13366 { // ','.del_target+ ','?
13367 if (p->error_indicator) {
13368 D(p->level--);
13369 return NULL;
13370 }
13371 D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13372 void *_opt_var;
13373 UNUSED(_opt_var); // Silence compiler warnings
13374 asdl_seq * a;
13375 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010013376 (a = _gather_123_rule(p)) // ','.del_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013377 &&
13378 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13379 )
13380 {
13381 D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13382 _res = a;
13383 if (_res == NULL && PyErr_Occurred()) {
13384 p->error_indicator = 1;
13385 D(p->level--);
13386 return NULL;
13387 }
13388 goto done;
13389 }
13390 p->mark = _mark;
13391 D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
13392 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
13393 }
13394 _res = NULL;
13395 done:
13396 D(p->level--);
13397 return _res;
13398}
13399
13400// del_target:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013401// | t_primary '.' NAME !t_lookahead
13402// | t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013403// | del_t_atom
13404static expr_ty
13405del_target_rule(Parser *p)
13406{
13407 D(p->level++);
13408 if (p->error_indicator) {
13409 D(p->level--);
13410 return NULL;
13411 }
13412 expr_ty _res = NULL;
13413 if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
13414 D(p->level--);
13415 return _res;
13416 }
13417 int _mark = p->mark;
13418 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13419 p->error_indicator = 1;
13420 D(p->level--);
13421 return NULL;
13422 }
13423 int _start_lineno = p->tokens[_mark]->lineno;
13424 UNUSED(_start_lineno); // Only used by EXTRA macro
13425 int _start_col_offset = p->tokens[_mark]->col_offset;
13426 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013427 { // t_primary '.' NAME !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013428 if (p->error_indicator) {
13429 D(p->level--);
13430 return NULL;
13431 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013432 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 +010013433 Token * _literal;
13434 expr_ty a;
13435 expr_ty b;
13436 if (
13437 (a = t_primary_rule(p)) // t_primary
13438 &&
13439 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13440 &&
13441 (b = _PyPegen_name_token(p)) // NAME
13442 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013443 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013444 )
13445 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013446 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 +010013447 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13448 if (_token == NULL) {
13449 D(p->level--);
13450 return NULL;
13451 }
13452 int _end_lineno = _token->end_lineno;
13453 UNUSED(_end_lineno); // Only used by EXTRA macro
13454 int _end_col_offset = _token->end_col_offset;
13455 UNUSED(_end_col_offset); // Only used by EXTRA macro
13456 _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
13457 if (_res == NULL && PyErr_Occurred()) {
13458 p->error_indicator = 1;
13459 D(p->level--);
13460 return NULL;
13461 }
13462 goto done;
13463 }
13464 p->mark = _mark;
13465 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013466 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013467 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013468 { // t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013469 if (p->error_indicator) {
13470 D(p->level--);
13471 return NULL;
13472 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013473 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 +010013474 Token * _literal;
13475 Token * _literal_1;
13476 expr_ty a;
13477 expr_ty b;
13478 if (
13479 (a = t_primary_rule(p)) // t_primary
13480 &&
13481 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13482 &&
13483 (b = slices_rule(p)) // slices
13484 &&
13485 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13486 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013487 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013488 )
13489 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013490 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 +010013491 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13492 if (_token == NULL) {
13493 D(p->level--);
13494 return NULL;
13495 }
13496 int _end_lineno = _token->end_lineno;
13497 UNUSED(_end_lineno); // Only used by EXTRA macro
13498 int _end_col_offset = _token->end_col_offset;
13499 UNUSED(_end_col_offset); // Only used by EXTRA macro
13500 _res = _Py_Subscript ( a , b , Del , EXTRA );
13501 if (_res == NULL && PyErr_Occurred()) {
13502 p->error_indicator = 1;
13503 D(p->level--);
13504 return NULL;
13505 }
13506 goto done;
13507 }
13508 p->mark = _mark;
13509 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013510 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013511 }
13512 { // del_t_atom
13513 if (p->error_indicator) {
13514 D(p->level--);
13515 return NULL;
13516 }
13517 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13518 expr_ty del_t_atom_var;
13519 if (
13520 (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom
13521 )
13522 {
13523 D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13524 _res = del_t_atom_var;
13525 goto done;
13526 }
13527 p->mark = _mark;
13528 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
13529 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
13530 }
13531 _res = NULL;
13532 done:
13533 _PyPegen_insert_memo(p, _mark, del_target_type, _res);
13534 D(p->level--);
13535 return _res;
13536}
13537
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013538// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013539static expr_ty
13540del_t_atom_rule(Parser *p)
13541{
13542 D(p->level++);
13543 if (p->error_indicator) {
13544 D(p->level--);
13545 return NULL;
13546 }
13547 expr_ty _res = NULL;
13548 int _mark = p->mark;
13549 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13550 p->error_indicator = 1;
13551 D(p->level--);
13552 return NULL;
13553 }
13554 int _start_lineno = p->tokens[_mark]->lineno;
13555 UNUSED(_start_lineno); // Only used by EXTRA macro
13556 int _start_col_offset = p->tokens[_mark]->col_offset;
13557 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013558 { // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013559 if (p->error_indicator) {
13560 D(p->level--);
13561 return NULL;
13562 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013563 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013564 expr_ty a;
13565 if (
13566 (a = _PyPegen_name_token(p)) // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013567 )
13568 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013569 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 +010013570 _res = _PyPegen_set_expr_context ( p , a , Del );
13571 if (_res == NULL && PyErr_Occurred()) {
13572 p->error_indicator = 1;
13573 D(p->level--);
13574 return NULL;
13575 }
13576 goto done;
13577 }
13578 p->mark = _mark;
13579 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013580 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013581 }
13582 { // '(' del_target ')'
13583 if (p->error_indicator) {
13584 D(p->level--);
13585 return NULL;
13586 }
13587 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13588 Token * _literal;
13589 Token * _literal_1;
13590 expr_ty a;
13591 if (
13592 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13593 &&
13594 (a = del_target_rule(p)) // del_target
13595 &&
13596 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13597 )
13598 {
13599 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13600 _res = _PyPegen_set_expr_context ( p , a , Del );
13601 if (_res == NULL && PyErr_Occurred()) {
13602 p->error_indicator = 1;
13603 D(p->level--);
13604 return NULL;
13605 }
13606 goto done;
13607 }
13608 p->mark = _mark;
13609 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13610 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
13611 }
13612 { // '(' del_targets? ')'
13613 if (p->error_indicator) {
13614 D(p->level--);
13615 return NULL;
13616 }
13617 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13618 Token * _literal;
13619 Token * _literal_1;
13620 void *a;
13621 if (
13622 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13623 &&
13624 (a = del_targets_rule(p), 1) // del_targets?
13625 &&
13626 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13627 )
13628 {
13629 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13630 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13631 if (_token == NULL) {
13632 D(p->level--);
13633 return NULL;
13634 }
13635 int _end_lineno = _token->end_lineno;
13636 UNUSED(_end_lineno); // Only used by EXTRA macro
13637 int _end_col_offset = _token->end_col_offset;
13638 UNUSED(_end_col_offset); // Only used by EXTRA macro
13639 _res = _Py_Tuple ( a , Del , EXTRA );
13640 if (_res == NULL && PyErr_Occurred()) {
13641 p->error_indicator = 1;
13642 D(p->level--);
13643 return NULL;
13644 }
13645 goto done;
13646 }
13647 p->mark = _mark;
13648 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13649 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
13650 }
13651 { // '[' del_targets? ']'
13652 if (p->error_indicator) {
13653 D(p->level--);
13654 return NULL;
13655 }
13656 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13657 Token * _literal;
13658 Token * _literal_1;
13659 void *a;
13660 if (
13661 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13662 &&
13663 (a = del_targets_rule(p), 1) // del_targets?
13664 &&
13665 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13666 )
13667 {
13668 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13669 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13670 if (_token == NULL) {
13671 D(p->level--);
13672 return NULL;
13673 }
13674 int _end_lineno = _token->end_lineno;
13675 UNUSED(_end_lineno); // Only used by EXTRA macro
13676 int _end_col_offset = _token->end_col_offset;
13677 UNUSED(_end_col_offset); // Only used by EXTRA macro
13678 _res = _Py_List ( a , Del , EXTRA );
13679 if (_res == NULL && PyErr_Occurred()) {
13680 p->error_indicator = 1;
13681 D(p->level--);
13682 return NULL;
13683 }
13684 goto done;
13685 }
13686 p->mark = _mark;
13687 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13688 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
13689 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013690 _res = NULL;
13691 done:
13692 D(p->level--);
13693 return _res;
13694}
13695
13696// targets: ','.target+ ','?
13697static asdl_seq*
13698targets_rule(Parser *p)
13699{
13700 D(p->level++);
13701 if (p->error_indicator) {
13702 D(p->level--);
13703 return NULL;
13704 }
13705 asdl_seq* _res = NULL;
13706 int _mark = p->mark;
13707 { // ','.target+ ','?
13708 if (p->error_indicator) {
13709 D(p->level--);
13710 return NULL;
13711 }
13712 D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13713 void *_opt_var;
13714 UNUSED(_opt_var); // Silence compiler warnings
13715 asdl_seq * a;
13716 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010013717 (a = _gather_125_rule(p)) // ','.target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013718 &&
13719 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13720 )
13721 {
13722 D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13723 _res = a;
13724 if (_res == NULL && PyErr_Occurred()) {
13725 p->error_indicator = 1;
13726 D(p->level--);
13727 return NULL;
13728 }
13729 goto done;
13730 }
13731 p->mark = _mark;
13732 D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ',
13733 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?"));
13734 }
13735 _res = NULL;
13736 done:
13737 D(p->level--);
13738 return _res;
13739}
13740
13741// target:
13742// | t_primary '.' NAME !t_lookahead
13743// | t_primary '[' slices ']' !t_lookahead
13744// | t_atom
13745static expr_ty
13746target_rule(Parser *p)
13747{
13748 D(p->level++);
13749 if (p->error_indicator) {
13750 D(p->level--);
13751 return NULL;
13752 }
13753 expr_ty _res = NULL;
13754 if (_PyPegen_is_memoized(p, target_type, &_res)) {
13755 D(p->level--);
13756 return _res;
13757 }
13758 int _mark = p->mark;
13759 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13760 p->error_indicator = 1;
13761 D(p->level--);
13762 return NULL;
13763 }
13764 int _start_lineno = p->tokens[_mark]->lineno;
13765 UNUSED(_start_lineno); // Only used by EXTRA macro
13766 int _start_col_offset = p->tokens[_mark]->col_offset;
13767 UNUSED(_start_col_offset); // Only used by EXTRA macro
13768 { // t_primary '.' NAME !t_lookahead
13769 if (p->error_indicator) {
13770 D(p->level--);
13771 return NULL;
13772 }
13773 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13774 Token * _literal;
13775 expr_ty a;
13776 expr_ty b;
13777 if (
13778 (a = t_primary_rule(p)) // t_primary
13779 &&
13780 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13781 &&
13782 (b = _PyPegen_name_token(p)) // NAME
13783 &&
13784 _PyPegen_lookahead(0, t_lookahead_rule, p)
13785 )
13786 {
13787 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13788 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13789 if (_token == NULL) {
13790 D(p->level--);
13791 return NULL;
13792 }
13793 int _end_lineno = _token->end_lineno;
13794 UNUSED(_end_lineno); // Only used by EXTRA macro
13795 int _end_col_offset = _token->end_col_offset;
13796 UNUSED(_end_col_offset); // Only used by EXTRA macro
13797 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13798 if (_res == NULL && PyErr_Occurred()) {
13799 p->error_indicator = 1;
13800 D(p->level--);
13801 return NULL;
13802 }
13803 goto done;
13804 }
13805 p->mark = _mark;
13806 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13807 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13808 }
13809 { // t_primary '[' slices ']' !t_lookahead
13810 if (p->error_indicator) {
13811 D(p->level--);
13812 return NULL;
13813 }
13814 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13815 Token * _literal;
13816 Token * _literal_1;
13817 expr_ty a;
13818 expr_ty b;
13819 if (
13820 (a = t_primary_rule(p)) // t_primary
13821 &&
13822 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13823 &&
13824 (b = slices_rule(p)) // slices
13825 &&
13826 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13827 &&
13828 _PyPegen_lookahead(0, t_lookahead_rule, p)
13829 )
13830 {
13831 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13832 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13833 if (_token == NULL) {
13834 D(p->level--);
13835 return NULL;
13836 }
13837 int _end_lineno = _token->end_lineno;
13838 UNUSED(_end_lineno); // Only used by EXTRA macro
13839 int _end_col_offset = _token->end_col_offset;
13840 UNUSED(_end_col_offset); // Only used by EXTRA macro
13841 _res = _Py_Subscript ( a , b , Store , EXTRA );
13842 if (_res == NULL && PyErr_Occurred()) {
13843 p->error_indicator = 1;
13844 D(p->level--);
13845 return NULL;
13846 }
13847 goto done;
13848 }
13849 p->mark = _mark;
13850 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13851 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13852 }
13853 { // t_atom
13854 if (p->error_indicator) {
13855 D(p->level--);
13856 return NULL;
13857 }
13858 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom"));
13859 expr_ty t_atom_var;
13860 if (
13861 (t_atom_var = t_atom_rule(p)) // t_atom
13862 )
13863 {
13864 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom"));
13865 _res = t_atom_var;
13866 goto done;
13867 }
13868 p->mark = _mark;
13869 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13870 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom"));
13871 }
13872 _res = NULL;
13873 done:
13874 _PyPegen_insert_memo(p, _mark, target_type, _res);
13875 D(p->level--);
13876 return _res;
13877}
13878
13879// Left-recursive
13880// t_primary:
13881// | t_primary '.' NAME &t_lookahead
13882// | t_primary '[' slices ']' &t_lookahead
13883// | t_primary genexp &t_lookahead
13884// | t_primary '(' arguments? ')' &t_lookahead
13885// | atom &t_lookahead
13886static expr_ty t_primary_raw(Parser *);
13887static expr_ty
13888t_primary_rule(Parser *p)
13889{
13890 D(p->level++);
13891 expr_ty _res = NULL;
13892 if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
13893 D(p->level--);
13894 return _res;
13895 }
13896 int _mark = p->mark;
13897 int _resmark = p->mark;
13898 while (1) {
13899 int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
13900 if (tmpvar_8) {
13901 D(p->level--);
13902 return _res;
13903 }
13904 p->mark = _mark;
13905 void *_raw = t_primary_raw(p);
13906 if (_raw == NULL || p->mark <= _resmark)
13907 break;
13908 _resmark = p->mark;
13909 _res = _raw;
13910 }
13911 p->mark = _resmark;
13912 D(p->level--);
13913 return _res;
13914}
13915static expr_ty
13916t_primary_raw(Parser *p)
13917{
13918 D(p->level++);
13919 if (p->error_indicator) {
13920 D(p->level--);
13921 return NULL;
13922 }
13923 expr_ty _res = NULL;
13924 int _mark = p->mark;
13925 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13926 p->error_indicator = 1;
13927 D(p->level--);
13928 return NULL;
13929 }
13930 int _start_lineno = p->tokens[_mark]->lineno;
13931 UNUSED(_start_lineno); // Only used by EXTRA macro
13932 int _start_col_offset = p->tokens[_mark]->col_offset;
13933 UNUSED(_start_col_offset); // Only used by EXTRA macro
13934 { // t_primary '.' NAME &t_lookahead
13935 if (p->error_indicator) {
13936 D(p->level--);
13937 return NULL;
13938 }
13939 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13940 Token * _literal;
13941 expr_ty a;
13942 expr_ty b;
13943 if (
13944 (a = t_primary_rule(p)) // t_primary
13945 &&
13946 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13947 &&
13948 (b = _PyPegen_name_token(p)) // NAME
13949 &&
13950 _PyPegen_lookahead(1, t_lookahead_rule, p)
13951 )
13952 {
13953 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13954 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13955 if (_token == NULL) {
13956 D(p->level--);
13957 return NULL;
13958 }
13959 int _end_lineno = _token->end_lineno;
13960 UNUSED(_end_lineno); // Only used by EXTRA macro
13961 int _end_col_offset = _token->end_col_offset;
13962 UNUSED(_end_col_offset); // Only used by EXTRA macro
13963 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
13964 if (_res == NULL && PyErr_Occurred()) {
13965 p->error_indicator = 1;
13966 D(p->level--);
13967 return NULL;
13968 }
13969 goto done;
13970 }
13971 p->mark = _mark;
13972 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
13973 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13974 }
13975 { // t_primary '[' slices ']' &t_lookahead
13976 if (p->error_indicator) {
13977 D(p->level--);
13978 return NULL;
13979 }
13980 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
13981 Token * _literal;
13982 Token * _literal_1;
13983 expr_ty a;
13984 expr_ty b;
13985 if (
13986 (a = t_primary_rule(p)) // t_primary
13987 &&
13988 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13989 &&
13990 (b = slices_rule(p)) // slices
13991 &&
13992 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13993 &&
13994 _PyPegen_lookahead(1, t_lookahead_rule, p)
13995 )
13996 {
13997 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
13998 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13999 if (_token == NULL) {
14000 D(p->level--);
14001 return NULL;
14002 }
14003 int _end_lineno = _token->end_lineno;
14004 UNUSED(_end_lineno); // Only used by EXTRA macro
14005 int _end_col_offset = _token->end_col_offset;
14006 UNUSED(_end_col_offset); // Only used by EXTRA macro
14007 _res = _Py_Subscript ( a , b , Load , EXTRA );
14008 if (_res == NULL && PyErr_Occurred()) {
14009 p->error_indicator = 1;
14010 D(p->level--);
14011 return NULL;
14012 }
14013 goto done;
14014 }
14015 p->mark = _mark;
14016 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14017 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14018 }
14019 { // t_primary genexp &t_lookahead
14020 if (p->error_indicator) {
14021 D(p->level--);
14022 return NULL;
14023 }
14024 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14025 expr_ty a;
14026 expr_ty b;
14027 if (
14028 (a = t_primary_rule(p)) // t_primary
14029 &&
14030 (b = genexp_rule(p)) // genexp
14031 &&
14032 _PyPegen_lookahead(1, t_lookahead_rule, p)
14033 )
14034 {
14035 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14036 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14037 if (_token == NULL) {
14038 D(p->level--);
14039 return NULL;
14040 }
14041 int _end_lineno = _token->end_lineno;
14042 UNUSED(_end_lineno); // Only used by EXTRA macro
14043 int _end_col_offset = _token->end_col_offset;
14044 UNUSED(_end_col_offset); // Only used by EXTRA macro
14045 _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
14046 if (_res == NULL && PyErr_Occurred()) {
14047 p->error_indicator = 1;
14048 D(p->level--);
14049 return NULL;
14050 }
14051 goto done;
14052 }
14053 p->mark = _mark;
14054 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14055 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
14056 }
14057 { // t_primary '(' arguments? ')' &t_lookahead
14058 if (p->error_indicator) {
14059 D(p->level--);
14060 return NULL;
14061 }
14062 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14063 Token * _literal;
14064 Token * _literal_1;
14065 expr_ty a;
14066 void *b;
14067 if (
14068 (a = t_primary_rule(p)) // t_primary
14069 &&
14070 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14071 &&
14072 (b = arguments_rule(p), 1) // arguments?
14073 &&
14074 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14075 &&
14076 _PyPegen_lookahead(1, t_lookahead_rule, p)
14077 )
14078 {
14079 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14080 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14081 if (_token == NULL) {
14082 D(p->level--);
14083 return NULL;
14084 }
14085 int _end_lineno = _token->end_lineno;
14086 UNUSED(_end_lineno); // Only used by EXTRA macro
14087 int _end_col_offset = _token->end_col_offset;
14088 UNUSED(_end_col_offset); // Only used by EXTRA macro
14089 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
14090 if (_res == NULL && PyErr_Occurred()) {
14091 p->error_indicator = 1;
14092 D(p->level--);
14093 return NULL;
14094 }
14095 goto done;
14096 }
14097 p->mark = _mark;
14098 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14099 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14100 }
14101 { // atom &t_lookahead
14102 if (p->error_indicator) {
14103 D(p->level--);
14104 return NULL;
14105 }
14106 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14107 expr_ty a;
14108 if (
14109 (a = atom_rule(p)) // atom
14110 &&
14111 _PyPegen_lookahead(1, t_lookahead_rule, p)
14112 )
14113 {
14114 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14115 _res = a;
14116 if (_res == NULL && PyErr_Occurred()) {
14117 p->error_indicator = 1;
14118 D(p->level--);
14119 return NULL;
14120 }
14121 goto done;
14122 }
14123 p->mark = _mark;
14124 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14125 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
14126 }
14127 _res = NULL;
14128 done:
14129 D(p->level--);
14130 return _res;
14131}
14132
14133// t_lookahead: '(' | '[' | '.'
14134static void *
14135t_lookahead_rule(Parser *p)
14136{
14137 D(p->level++);
14138 if (p->error_indicator) {
14139 D(p->level--);
14140 return NULL;
14141 }
14142 void * _res = NULL;
14143 int _mark = p->mark;
14144 { // '('
14145 if (p->error_indicator) {
14146 D(p->level--);
14147 return NULL;
14148 }
14149 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
14150 Token * _literal;
14151 if (
14152 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14153 )
14154 {
14155 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
14156 _res = _literal;
14157 goto done;
14158 }
14159 p->mark = _mark;
14160 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14161 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
14162 }
14163 { // '['
14164 if (p->error_indicator) {
14165 D(p->level--);
14166 return NULL;
14167 }
14168 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
14169 Token * _literal;
14170 if (
14171 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14172 )
14173 {
14174 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
14175 _res = _literal;
14176 goto done;
14177 }
14178 p->mark = _mark;
14179 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14180 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
14181 }
14182 { // '.'
14183 if (p->error_indicator) {
14184 D(p->level--);
14185 return NULL;
14186 }
14187 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
14188 Token * _literal;
14189 if (
14190 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
14191 )
14192 {
14193 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
14194 _res = _literal;
14195 goto done;
14196 }
14197 p->mark = _mark;
14198 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14199 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
14200 }
14201 _res = NULL;
14202 done:
14203 D(p->level--);
14204 return _res;
14205}
14206
14207// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
14208static expr_ty
14209t_atom_rule(Parser *p)
14210{
14211 D(p->level++);
14212 if (p->error_indicator) {
14213 D(p->level--);
14214 return NULL;
14215 }
14216 expr_ty _res = NULL;
14217 int _mark = p->mark;
14218 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
14219 p->error_indicator = 1;
14220 D(p->level--);
14221 return NULL;
14222 }
14223 int _start_lineno = p->tokens[_mark]->lineno;
14224 UNUSED(_start_lineno); // Only used by EXTRA macro
14225 int _start_col_offset = p->tokens[_mark]->col_offset;
14226 UNUSED(_start_col_offset); // Only used by EXTRA macro
14227 { // NAME
14228 if (p->error_indicator) {
14229 D(p->level--);
14230 return NULL;
14231 }
14232 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
14233 expr_ty a;
14234 if (
14235 (a = _PyPegen_name_token(p)) // NAME
14236 )
14237 {
14238 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
14239 _res = _PyPegen_set_expr_context ( p , a , Store );
14240 if (_res == NULL && PyErr_Occurred()) {
14241 p->error_indicator = 1;
14242 D(p->level--);
14243 return NULL;
14244 }
14245 goto done;
14246 }
14247 p->mark = _mark;
14248 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14249 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
14250 }
14251 { // '(' target ')'
14252 if (p->error_indicator) {
14253 D(p->level--);
14254 return NULL;
14255 }
14256 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14257 Token * _literal;
14258 Token * _literal_1;
14259 expr_ty a;
14260 if (
14261 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14262 &&
14263 (a = target_rule(p)) // target
14264 &&
14265 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14266 )
14267 {
14268 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14269 _res = _PyPegen_set_expr_context ( p , a , Store );
14270 if (_res == NULL && PyErr_Occurred()) {
14271 p->error_indicator = 1;
14272 D(p->level--);
14273 return NULL;
14274 }
14275 goto done;
14276 }
14277 p->mark = _mark;
14278 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14279 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'"));
14280 }
14281 { // '(' targets? ')'
14282 if (p->error_indicator) {
14283 D(p->level--);
14284 return NULL;
14285 }
14286 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14287 Token * _literal;
14288 Token * _literal_1;
14289 void *b;
14290 if (
14291 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14292 &&
14293 (b = targets_rule(p), 1) // targets?
14294 &&
14295 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14296 )
14297 {
14298 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14299 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14300 if (_token == NULL) {
14301 D(p->level--);
14302 return NULL;
14303 }
14304 int _end_lineno = _token->end_lineno;
14305 UNUSED(_end_lineno); // Only used by EXTRA macro
14306 int _end_col_offset = _token->end_col_offset;
14307 UNUSED(_end_col_offset); // Only used by EXTRA macro
14308 _res = _Py_Tuple ( b , Store , EXTRA );
14309 if (_res == NULL && PyErr_Occurred()) {
14310 p->error_indicator = 1;
14311 D(p->level--);
14312 return NULL;
14313 }
14314 goto done;
14315 }
14316 p->mark = _mark;
14317 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14318 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'"));
14319 }
14320 { // '[' targets? ']'
14321 if (p->error_indicator) {
14322 D(p->level--);
14323 return NULL;
14324 }
14325 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14326 Token * _literal;
14327 Token * _literal_1;
14328 void *b;
14329 if (
14330 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14331 &&
14332 (b = targets_rule(p), 1) // targets?
14333 &&
14334 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14335 )
14336 {
14337 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14338 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14339 if (_token == NULL) {
14340 D(p->level--);
14341 return NULL;
14342 }
14343 int _end_lineno = _token->end_lineno;
14344 UNUSED(_end_lineno); // Only used by EXTRA macro
14345 int _end_col_offset = _token->end_col_offset;
14346 UNUSED(_end_col_offset); // Only used by EXTRA macro
14347 _res = _Py_List ( b , Store , EXTRA );
14348 if (_res == NULL && PyErr_Occurred()) {
14349 p->error_indicator = 1;
14350 D(p->level--);
14351 return NULL;
14352 }
14353 goto done;
14354 }
14355 p->mark = _mark;
14356 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14357 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'"));
14358 }
14359 _res = NULL;
14360 done:
14361 D(p->level--);
14362 return _res;
14363}
14364
14365// incorrect_arguments:
14366// | args ',' '*'
14367// | expression for_if_clauses ',' [args | expression for_if_clauses]
14368// | args for_if_clauses
14369// | args ',' expression for_if_clauses
14370// | args ',' args
14371static void *
14372incorrect_arguments_rule(Parser *p)
14373{
14374 D(p->level++);
14375 if (p->error_indicator) {
14376 D(p->level--);
14377 return NULL;
14378 }
14379 void * _res = NULL;
14380 int _mark = p->mark;
14381 { // args ',' '*'
14382 if (p->error_indicator) {
14383 D(p->level--);
14384 return NULL;
14385 }
14386 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
14387 Token * _literal;
14388 Token * _literal_1;
14389 expr_ty args_var;
14390 if (
14391 (args_var = args_rule(p)) // args
14392 &&
14393 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14394 &&
14395 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
14396 )
14397 {
14398 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
14399 _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
14400 if (_res == NULL && PyErr_Occurred()) {
14401 p->error_indicator = 1;
14402 D(p->level--);
14403 return NULL;
14404 }
14405 goto done;
14406 }
14407 p->mark = _mark;
14408 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14409 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'"));
14410 }
14411 { // expression for_if_clauses ',' [args | expression for_if_clauses]
14412 if (p->error_indicator) {
14413 D(p->level--);
14414 return NULL;
14415 }
14416 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14417 Token * _literal;
14418 void *_opt_var;
14419 UNUSED(_opt_var); // Silence compiler warnings
14420 expr_ty a;
14421 asdl_seq* for_if_clauses_var;
14422 if (
14423 (a = expression_rule(p)) // expression
14424 &&
14425 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14426 &&
14427 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14428 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014429 (_opt_var = _tmp_127_rule(p), 1) // [args | expression for_if_clauses]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014430 )
14431 {
14432 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14433 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14434 if (_res == NULL && PyErr_Occurred()) {
14435 p->error_indicator = 1;
14436 D(p->level--);
14437 return NULL;
14438 }
14439 goto done;
14440 }
14441 p->mark = _mark;
14442 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14443 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14444 }
14445 { // args for_if_clauses
14446 if (p->error_indicator) {
14447 D(p->level--);
14448 return NULL;
14449 }
14450 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
14451 expr_ty a;
14452 asdl_seq* for_if_clauses_var;
14453 if (
14454 (a = args_rule(p)) // args
14455 &&
14456 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14457 )
14458 {
14459 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
14460 _res = _PyPegen_nonparen_genexp_in_call ( p , a );
14461 if (_res == NULL && PyErr_Occurred()) {
14462 p->error_indicator = 1;
14463 D(p->level--);
14464 return NULL;
14465 }
14466 goto done;
14467 }
14468 p->mark = _mark;
14469 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14470 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
14471 }
14472 { // args ',' expression for_if_clauses
14473 if (p->error_indicator) {
14474 D(p->level--);
14475 return NULL;
14476 }
14477 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
14478 Token * _literal;
14479 expr_ty a;
14480 expr_ty args_var;
14481 asdl_seq* for_if_clauses_var;
14482 if (
14483 (args_var = args_rule(p)) // args
14484 &&
14485 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14486 &&
14487 (a = expression_rule(p)) // expression
14488 &&
14489 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14490 )
14491 {
14492 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
14493 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14494 if (_res == NULL && PyErr_Occurred()) {
14495 p->error_indicator = 1;
14496 D(p->level--);
14497 return NULL;
14498 }
14499 goto done;
14500 }
14501 p->mark = _mark;
14502 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14503 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
14504 }
14505 { // args ',' args
14506 if (p->error_indicator) {
14507 D(p->level--);
14508 return NULL;
14509 }
14510 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
14511 Token * _literal;
14512 expr_ty a;
14513 expr_ty args_var;
14514 if (
14515 (a = args_rule(p)) // args
14516 &&
14517 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14518 &&
14519 (args_var = args_rule(p)) // args
14520 )
14521 {
14522 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
14523 _res = _PyPegen_arguments_parsing_error ( p , a );
14524 if (_res == NULL && PyErr_Occurred()) {
14525 p->error_indicator = 1;
14526 D(p->level--);
14527 return NULL;
14528 }
14529 goto done;
14530 }
14531 p->mark = _mark;
14532 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14533 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
14534 }
14535 _res = NULL;
14536 done:
14537 D(p->level--);
14538 return _res;
14539}
14540
14541// invalid_kwarg: expression '='
14542static void *
14543invalid_kwarg_rule(Parser *p)
14544{
14545 D(p->level++);
14546 if (p->error_indicator) {
14547 D(p->level--);
14548 return NULL;
14549 }
14550 void * _res = NULL;
14551 int _mark = p->mark;
14552 { // expression '='
14553 if (p->error_indicator) {
14554 D(p->level--);
14555 return NULL;
14556 }
14557 D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='"));
14558 Token * _literal;
14559 expr_ty a;
14560 if (
14561 (a = expression_rule(p)) // expression
14562 &&
14563 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14564 )
14565 {
14566 D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='"));
14567 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" );
14568 if (_res == NULL && PyErr_Occurred()) {
14569 p->error_indicator = 1;
14570 D(p->level--);
14571 return NULL;
14572 }
14573 goto done;
14574 }
14575 p->mark = _mark;
14576 D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
14577 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='"));
14578 }
14579 _res = NULL;
14580 done:
14581 D(p->level--);
14582 return _res;
14583}
14584
14585// invalid_named_expression: expression ':=' expression
14586static void *
14587invalid_named_expression_rule(Parser *p)
14588{
14589 D(p->level++);
14590 if (p->error_indicator) {
14591 D(p->level--);
14592 return NULL;
14593 }
14594 void * _res = NULL;
14595 int _mark = p->mark;
14596 { // expression ':=' expression
14597 if (p->error_indicator) {
14598 D(p->level--);
14599 return NULL;
14600 }
14601 D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14602 Token * _literal;
14603 expr_ty a;
14604 expr_ty expression_var;
14605 if (
14606 (a = expression_rule(p)) // expression
14607 &&
14608 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
14609 &&
14610 (expression_var = expression_rule(p)) // expression
14611 )
14612 {
14613 D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14614 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
14615 if (_res == NULL && PyErr_Occurred()) {
14616 p->error_indicator = 1;
14617 D(p->level--);
14618 return NULL;
14619 }
14620 goto done;
14621 }
14622 p->mark = _mark;
14623 D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
14624 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
14625 }
14626 _res = NULL;
14627 done:
14628 D(p->level--);
14629 return _res;
14630}
14631
14632// invalid_assignment:
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014633// | invalid_ann_assign_target ':' expression
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014634// | star_named_expression ',' star_named_expressions* ':' expression
14635// | expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014636// | ((star_targets '='))* star_expressions '='
14637// | ((star_targets '='))* yield_expr '='
14638// | star_expressions augassign (yield_expr | star_expressions)
14639static void *
14640invalid_assignment_rule(Parser *p)
14641{
14642 D(p->level++);
14643 if (p->error_indicator) {
14644 D(p->level--);
14645 return NULL;
14646 }
14647 void * _res = NULL;
14648 int _mark = p->mark;
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014649 { // invalid_ann_assign_target ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014650 if (p->error_indicator) {
14651 D(p->level--);
14652 return NULL;
14653 }
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014654 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 +010014655 Token * _literal;
14656 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014657 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014658 if (
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014659 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014660 &&
14661 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014662 &&
14663 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014664 )
14665 {
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014666 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
14667 _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 +010014668 if (_res == NULL && PyErr_Occurred()) {
14669 p->error_indicator = 1;
14670 D(p->level--);
14671 return NULL;
14672 }
14673 goto done;
14674 }
14675 p->mark = _mark;
14676 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014677 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014678 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014679 { // star_named_expression ',' star_named_expressions* ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014680 if (p->error_indicator) {
14681 D(p->level--);
14682 return NULL;
14683 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014684 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 +010014685 Token * _literal;
14686 Token * _literal_1;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014687 asdl_seq * _loop0_128_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014688 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014689 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014690 if (
14691 (a = star_named_expression_rule(p)) // star_named_expression
14692 &&
14693 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14694 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014695 (_loop0_128_var = _loop0_128_rule(p)) // star_named_expressions*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014696 &&
14697 (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014698 &&
14699 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014700 )
14701 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014702 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 +010014703 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
14704 if (_res == NULL && PyErr_Occurred()) {
14705 p->error_indicator = 1;
14706 D(p->level--);
14707 return NULL;
14708 }
14709 goto done;
14710 }
14711 p->mark = _mark;
14712 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014713 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014714 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014715 { // expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014716 if (p->error_indicator) {
14717 D(p->level--);
14718 return NULL;
14719 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014720 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014721 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014722 expr_ty a;
14723 expr_ty expression_var;
14724 if (
14725 (a = expression_rule(p)) // expression
14726 &&
14727 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
14728 &&
14729 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014730 )
14731 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014732 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 +010014733 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
14734 if (_res == NULL && PyErr_Occurred()) {
14735 p->error_indicator = 1;
14736 D(p->level--);
14737 return NULL;
14738 }
14739 goto done;
14740 }
14741 p->mark = _mark;
14742 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014743 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014744 }
14745 { // ((star_targets '='))* star_expressions '='
14746 if (p->error_indicator) {
14747 D(p->level--);
14748 return NULL;
14749 }
14750 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14751 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014752 asdl_seq * _loop0_129_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014753 expr_ty a;
14754 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014755 (_loop0_129_var = _loop0_129_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014756 &&
14757 (a = star_expressions_rule(p)) // star_expressions
14758 &&
14759 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14760 )
14761 {
14762 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 +030014763 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014764 if (_res == NULL && PyErr_Occurred()) {
14765 p->error_indicator = 1;
14766 D(p->level--);
14767 return NULL;
14768 }
14769 goto done;
14770 }
14771 p->mark = _mark;
14772 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14773 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14774 }
14775 { // ((star_targets '='))* yield_expr '='
14776 if (p->error_indicator) {
14777 D(p->level--);
14778 return NULL;
14779 }
14780 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14781 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014782 asdl_seq * _loop0_130_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014783 expr_ty a;
14784 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014785 (_loop0_130_var = _loop0_130_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014786 &&
14787 (a = yield_expr_rule(p)) // yield_expr
14788 &&
14789 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14790 )
14791 {
14792 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14793 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
14794 if (_res == NULL && PyErr_Occurred()) {
14795 p->error_indicator = 1;
14796 D(p->level--);
14797 return NULL;
14798 }
14799 goto done;
14800 }
14801 p->mark = _mark;
14802 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14803 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14804 }
14805 { // star_expressions augassign (yield_expr | star_expressions)
14806 if (p->error_indicator) {
14807 D(p->level--);
14808 return NULL;
14809 }
14810 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 +010014811 void *_tmp_131_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014812 expr_ty a;
14813 AugOperator* augassign_var;
14814 if (
14815 (a = star_expressions_rule(p)) // star_expressions
14816 &&
14817 (augassign_var = augassign_rule(p)) // augassign
14818 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014819 (_tmp_131_var = _tmp_131_rule(p)) // yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014820 )
14821 {
14822 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14823 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
14824 if (_res == NULL && PyErr_Occurred()) {
14825 p->error_indicator = 1;
14826 D(p->level--);
14827 return NULL;
14828 }
14829 goto done;
14830 }
14831 p->mark = _mark;
14832 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14833 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14834 }
14835 _res = NULL;
14836 done:
14837 D(p->level--);
14838 return _res;
14839}
14840
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014841// invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
14842static expr_ty
14843invalid_ann_assign_target_rule(Parser *p)
14844{
14845 D(p->level++);
14846 if (p->error_indicator) {
14847 D(p->level--);
14848 return NULL;
14849 }
14850 expr_ty _res = NULL;
14851 int _mark = p->mark;
14852 { // list
14853 if (p->error_indicator) {
14854 D(p->level--);
14855 return NULL;
14856 }
14857 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
14858 expr_ty list_var;
14859 if (
14860 (list_var = list_rule(p)) // list
14861 )
14862 {
14863 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
14864 _res = list_var;
14865 goto done;
14866 }
14867 p->mark = _mark;
14868 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14869 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
14870 }
14871 { // tuple
14872 if (p->error_indicator) {
14873 D(p->level--);
14874 return NULL;
14875 }
14876 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
14877 expr_ty tuple_var;
14878 if (
14879 (tuple_var = tuple_rule(p)) // tuple
14880 )
14881 {
14882 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
14883 _res = tuple_var;
14884 goto done;
14885 }
14886 p->mark = _mark;
14887 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14888 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
14889 }
14890 { // '(' invalid_ann_assign_target ')'
14891 if (p->error_indicator) {
14892 D(p->level--);
14893 return NULL;
14894 }
14895 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14896 Token * _literal;
14897 Token * _literal_1;
14898 expr_ty a;
14899 if (
14900 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14901 &&
14902 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
14903 &&
14904 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14905 )
14906 {
14907 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14908 _res = a;
14909 if (_res == NULL && PyErr_Occurred()) {
14910 p->error_indicator = 1;
14911 D(p->level--);
14912 return NULL;
14913 }
14914 goto done;
14915 }
14916 p->mark = _mark;
14917 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14918 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14919 }
14920 _res = NULL;
14921 done:
14922 D(p->level--);
14923 return _res;
14924}
14925
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014926// invalid_del_stmt: 'del' star_expressions
14927static void *
14928invalid_del_stmt_rule(Parser *p)
14929{
14930 D(p->level++);
14931 if (p->error_indicator) {
14932 D(p->level--);
14933 return NULL;
14934 }
14935 void * _res = NULL;
14936 int _mark = p->mark;
14937 { // 'del' star_expressions
14938 if (p->error_indicator) {
14939 D(p->level--);
14940 return NULL;
14941 }
14942 D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
14943 Token * _keyword;
14944 expr_ty a;
14945 if (
14946 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
14947 &&
14948 (a = star_expressions_rule(p)) // star_expressions
14949 )
14950 {
14951 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 +030014952 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014953 if (_res == NULL && PyErr_Occurred()) {
14954 p->error_indicator = 1;
14955 D(p->level--);
14956 return NULL;
14957 }
14958 goto done;
14959 }
14960 p->mark = _mark;
14961 D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
14962 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
14963 }
14964 _res = NULL;
14965 done:
14966 D(p->level--);
14967 return _res;
14968}
14969
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014970// invalid_block: NEWLINE !INDENT
14971static void *
14972invalid_block_rule(Parser *p)
14973{
14974 D(p->level++);
14975 if (p->error_indicator) {
14976 D(p->level--);
14977 return NULL;
14978 }
14979 void * _res = NULL;
14980 int _mark = p->mark;
14981 { // NEWLINE !INDENT
14982 if (p->error_indicator) {
14983 D(p->level--);
14984 return NULL;
14985 }
14986 D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
14987 Token * newline_var;
14988 if (
14989 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
14990 &&
14991 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
14992 )
14993 {
14994 D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
14995 _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
14996 if (_res == NULL && PyErr_Occurred()) {
14997 p->error_indicator = 1;
14998 D(p->level--);
14999 return NULL;
15000 }
15001 goto done;
15002 }
15003 p->mark = _mark;
15004 D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
15005 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
15006 }
15007 _res = NULL;
15008 done:
15009 D(p->level--);
15010 return _res;
15011}
15012
15013// invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses
15014static void *
15015invalid_comprehension_rule(Parser *p)
15016{
15017 D(p->level++);
15018 if (p->error_indicator) {
15019 D(p->level--);
15020 return NULL;
15021 }
15022 void * _res = NULL;
15023 int _mark = p->mark;
15024 { // ('[' | '(' | '{') starred_expression for_if_clauses
15025 if (p->error_indicator) {
15026 D(p->level--);
15027 return NULL;
15028 }
15029 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 +010015030 void *_tmp_132_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015031 expr_ty a;
15032 asdl_seq* for_if_clauses_var;
15033 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015034 (_tmp_132_var = _tmp_132_rule(p)) // '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015035 &&
15036 (a = starred_expression_rule(p)) // starred_expression
15037 &&
15038 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15039 )
15040 {
15041 D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15042 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
15043 if (_res == NULL && PyErr_Occurred()) {
15044 p->error_indicator = 1;
15045 D(p->level--);
15046 return NULL;
15047 }
15048 goto done;
15049 }
15050 p->mark = _mark;
15051 D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15052 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15053 }
15054 _res = NULL;
15055 done:
15056 D(p->level--);
15057 return _res;
15058}
15059
15060// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
15061static void *
15062invalid_dict_comprehension_rule(Parser *p)
15063{
15064 D(p->level++);
15065 if (p->error_indicator) {
15066 D(p->level--);
15067 return NULL;
15068 }
15069 void * _res = NULL;
15070 int _mark = p->mark;
15071 { // '{' '**' bitwise_or for_if_clauses '}'
15072 if (p->error_indicator) {
15073 D(p->level--);
15074 return NULL;
15075 }
15076 D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15077 Token * _literal;
15078 Token * _literal_1;
15079 Token * a;
15080 expr_ty bitwise_or_var;
15081 asdl_seq* for_if_clauses_var;
15082 if (
15083 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
15084 &&
15085 (a = _PyPegen_expect_token(p, 35)) // token='**'
15086 &&
15087 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
15088 &&
15089 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15090 &&
15091 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
15092 )
15093 {
15094 D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15095 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
15096 if (_res == NULL && PyErr_Occurred()) {
15097 p->error_indicator = 1;
15098 D(p->level--);
15099 return NULL;
15100 }
15101 goto done;
15102 }
15103 p->mark = _mark;
15104 D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15105 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15106 }
15107 _res = NULL;
15108 done:
15109 D(p->level--);
15110 return _res;
15111}
15112
15113// invalid_parameters:
15114// | param_no_default* (slash_with_default | param_with_default+) param_no_default
15115static void *
15116invalid_parameters_rule(Parser *p)
15117{
15118 D(p->level++);
15119 if (p->error_indicator) {
15120 D(p->level--);
15121 return NULL;
15122 }
15123 void * _res = NULL;
15124 int _mark = p->mark;
15125 { // param_no_default* (slash_with_default | param_with_default+) param_no_default
15126 if (p->error_indicator) {
15127 D(p->level--);
15128 return NULL;
15129 }
15130 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 +010015131 asdl_seq * _loop0_133_var;
15132 void *_tmp_134_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015133 arg_ty param_no_default_var;
15134 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015135 (_loop0_133_var = _loop0_133_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015136 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015137 (_tmp_134_var = _tmp_134_rule(p)) // slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015138 &&
15139 (param_no_default_var = param_no_default_rule(p)) // param_no_default
15140 )
15141 {
15142 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"));
15143 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15144 if (_res == NULL && PyErr_Occurred()) {
15145 p->error_indicator = 1;
15146 D(p->level--);
15147 return NULL;
15148 }
15149 goto done;
15150 }
15151 p->mark = _mark;
15152 D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15153 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
15154 }
15155 _res = NULL;
15156 done:
15157 D(p->level--);
15158 return _res;
15159}
15160
15161// invalid_lambda_parameters:
15162// | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15163static void *
15164invalid_lambda_parameters_rule(Parser *p)
15165{
15166 D(p->level++);
15167 if (p->error_indicator) {
15168 D(p->level--);
15169 return NULL;
15170 }
15171 void * _res = NULL;
15172 int _mark = p->mark;
15173 { // lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15174 if (p->error_indicator) {
15175 D(p->level--);
15176 return NULL;
15177 }
15178 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 +010015179 asdl_seq * _loop0_135_var;
15180 void *_tmp_136_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015181 arg_ty lambda_param_no_default_var;
15182 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015183 (_loop0_135_var = _loop0_135_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015184 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015185 (_tmp_136_var = _tmp_136_rule(p)) // lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015186 &&
15187 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
15188 )
15189 {
15190 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"));
15191 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15192 if (_res == NULL && PyErr_Occurred()) {
15193 p->error_indicator = 1;
15194 D(p->level--);
15195 return NULL;
15196 }
15197 goto done;
15198 }
15199 p->mark = _mark;
15200 D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15201 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
15202 }
15203 _res = NULL;
15204 done:
15205 D(p->level--);
15206 return _res;
15207}
15208
15209// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT
15210static void *
15211invalid_star_etc_rule(Parser *p)
15212{
15213 D(p->level++);
15214 if (p->error_indicator) {
15215 D(p->level--);
15216 return NULL;
15217 }
15218 void * _res = NULL;
15219 int _mark = p->mark;
15220 { // '*' (')' | ',' (')' | '**'))
15221 if (p->error_indicator) {
15222 D(p->level--);
15223 return NULL;
15224 }
15225 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15226 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015227 void *_tmp_137_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015228 if (
15229 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15230 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015231 (_tmp_137_var = _tmp_137_rule(p)) // ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015232 )
15233 {
15234 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15235 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15236 if (_res == NULL && PyErr_Occurred()) {
15237 p->error_indicator = 1;
15238 D(p->level--);
15239 return NULL;
15240 }
15241 goto done;
15242 }
15243 p->mark = _mark;
15244 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15245 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15246 }
15247 { // '*' ',' TYPE_COMMENT
15248 if (p->error_indicator) {
15249 D(p->level--);
15250 return NULL;
15251 }
15252 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15253 Token * _literal;
15254 Token * _literal_1;
15255 Token * type_comment_var;
15256 if (
15257 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15258 &&
15259 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
15260 &&
15261 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15262 )
15263 {
15264 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15265 _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
15266 if (_res == NULL && PyErr_Occurred()) {
15267 p->error_indicator = 1;
15268 D(p->level--);
15269 return NULL;
15270 }
15271 goto done;
15272 }
15273 p->mark = _mark;
15274 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15275 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15276 }
15277 _res = NULL;
15278 done:
15279 D(p->level--);
15280 return _res;
15281}
15282
15283// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**'))
15284static void *
15285invalid_lambda_star_etc_rule(Parser *p)
15286{
15287 D(p->level++);
15288 if (p->error_indicator) {
15289 D(p->level--);
15290 return NULL;
15291 }
15292 void * _res = NULL;
15293 int _mark = p->mark;
15294 { // '*' (':' | ',' (':' | '**'))
15295 if (p->error_indicator) {
15296 D(p->level--);
15297 return NULL;
15298 }
15299 D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15300 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015301 void *_tmp_138_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015302 if (
15303 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15304 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015305 (_tmp_138_var = _tmp_138_rule(p)) // ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015306 )
15307 {
15308 D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15309 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15310 if (_res == NULL && PyErr_Occurred()) {
15311 p->error_indicator = 1;
15312 D(p->level--);
15313 return NULL;
15314 }
15315 goto done;
15316 }
15317 p->mark = _mark;
15318 D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15319 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15320 }
15321 _res = NULL;
15322 done:
15323 D(p->level--);
15324 return _res;
15325}
15326
15327// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15328static void *
15329invalid_double_type_comments_rule(Parser *p)
15330{
15331 D(p->level++);
15332 if (p->error_indicator) {
15333 D(p->level--);
15334 return NULL;
15335 }
15336 void * _res = NULL;
15337 int _mark = p->mark;
15338 { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15339 if (p->error_indicator) {
15340 D(p->level--);
15341 return NULL;
15342 }
15343 D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15344 Token * indent_var;
15345 Token * newline_var;
15346 Token * newline_var_1;
15347 Token * type_comment_var;
15348 Token * type_comment_var_1;
15349 if (
15350 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15351 &&
15352 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15353 &&
15354 (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15355 &&
15356 (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15357 &&
15358 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
15359 )
15360 {
15361 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"));
15362 _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
15363 if (_res == NULL && PyErr_Occurred()) {
15364 p->error_indicator = 1;
15365 D(p->level--);
15366 return NULL;
15367 }
15368 goto done;
15369 }
15370 p->mark = _mark;
15371 D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
15372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15373 }
15374 _res = NULL;
15375 done:
15376 D(p->level--);
15377 return _res;
15378}
15379
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015380// invalid_with_item: expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015381static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015382invalid_with_item_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015383{
15384 D(p->level++);
15385 if (p->error_indicator) {
15386 D(p->level--);
15387 return NULL;
15388 }
15389 void * _res = NULL;
15390 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015391 { // expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015392 if (p->error_indicator) {
15393 D(p->level--);
15394 return NULL;
15395 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015396 D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression"));
15397 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015398 expr_ty a;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015399 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015400 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015401 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015402 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015403 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
15404 &&
15405 (a = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015406 )
15407 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015408 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 +030015409 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015410 if (_res == NULL && PyErr_Occurred()) {
15411 p->error_indicator = 1;
15412 D(p->level--);
15413 return NULL;
15414 }
15415 goto done;
15416 }
15417 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015418 D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
15419 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression"));
15420 }
15421 _res = NULL;
15422 done:
15423 D(p->level--);
15424 return _res;
15425}
15426
15427// invalid_for_target: ASYNC? 'for' star_expressions
15428static void *
15429invalid_for_target_rule(Parser *p)
15430{
15431 D(p->level++);
15432 if (p->error_indicator) {
15433 D(p->level--);
15434 return NULL;
15435 }
15436 void * _res = NULL;
15437 int _mark = p->mark;
15438 { // ASYNC? 'for' star_expressions
15439 if (p->error_indicator) {
15440 D(p->level--);
15441 return NULL;
15442 }
15443 D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
15444 Token * _keyword;
15445 void *_opt_var;
15446 UNUSED(_opt_var); // Silence compiler warnings
15447 expr_ty a;
15448 if (
15449 (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
15450 &&
15451 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
15452 &&
15453 (a = star_expressions_rule(p)) // star_expressions
15454 )
15455 {
15456 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 +030015457 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015458 if (_res == NULL && PyErr_Occurred()) {
15459 p->error_indicator = 1;
15460 D(p->level--);
15461 return NULL;
15462 }
15463 goto done;
15464 }
15465 p->mark = _mark;
15466 D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
15467 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions"));
15468 }
15469 _res = NULL;
15470 done:
15471 D(p->level--);
15472 return _res;
15473}
15474
15475// invalid_group: '(' starred_expression ')'
15476static void *
15477invalid_group_rule(Parser *p)
15478{
15479 D(p->level++);
15480 if (p->error_indicator) {
15481 D(p->level--);
15482 return NULL;
15483 }
15484 void * _res = NULL;
15485 int _mark = p->mark;
15486 { // '(' starred_expression ')'
15487 if (p->error_indicator) {
15488 D(p->level--);
15489 return NULL;
15490 }
15491 D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15492 Token * _literal;
15493 Token * _literal_1;
15494 expr_ty a;
15495 if (
15496 (_literal = _PyPegen_expect_token(p, 7)) // token='('
15497 &&
15498 (a = starred_expression_rule(p)) // starred_expression
15499 &&
15500 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
15501 )
15502 {
15503 D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15504 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "can't use starred expression here" );
15505 if (_res == NULL && PyErr_Occurred()) {
15506 p->error_indicator = 1;
15507 D(p->level--);
15508 return NULL;
15509 }
15510 goto done;
15511 }
15512 p->mark = _mark;
15513 D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
15514 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015515 }
15516 _res = NULL;
15517 done:
15518 D(p->level--);
15519 return _res;
15520}
15521
15522// invalid_import_from_targets: import_from_as_names ','
15523static void *
15524invalid_import_from_targets_rule(Parser *p)
15525{
15526 D(p->level++);
15527 if (p->error_indicator) {
15528 D(p->level--);
15529 return NULL;
15530 }
15531 void * _res = NULL;
15532 int _mark = p->mark;
15533 { // import_from_as_names ','
15534 if (p->error_indicator) {
15535 D(p->level--);
15536 return NULL;
15537 }
15538 D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15539 Token * _literal;
15540 asdl_seq* import_from_as_names_var;
15541 if (
15542 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
15543 &&
15544 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15545 )
15546 {
15547 D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15548 _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
15549 if (_res == NULL && PyErr_Occurred()) {
15550 p->error_indicator = 1;
15551 D(p->level--);
15552 return NULL;
15553 }
15554 goto done;
15555 }
15556 p->mark = _mark;
15557 D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
15558 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','"));
15559 }
15560 _res = NULL;
15561 done:
15562 D(p->level--);
15563 return _res;
15564}
15565
15566// _loop0_1: NEWLINE
15567static asdl_seq *
15568_loop0_1_rule(Parser *p)
15569{
15570 D(p->level++);
15571 if (p->error_indicator) {
15572 D(p->level--);
15573 return NULL;
15574 }
15575 void *_res = NULL;
15576 int _mark = p->mark;
15577 int _start_mark = p->mark;
15578 void **_children = PyMem_Malloc(sizeof(void *));
15579 if (!_children) {
15580 p->error_indicator = 1;
15581 PyErr_NoMemory();
15582 D(p->level--);
15583 return NULL;
15584 }
15585 ssize_t _children_capacity = 1;
15586 ssize_t _n = 0;
15587 { // NEWLINE
15588 if (p->error_indicator) {
15589 D(p->level--);
15590 return NULL;
15591 }
15592 D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15593 Token * newline_var;
15594 while (
15595 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15596 )
15597 {
15598 _res = newline_var;
15599 if (_n == _children_capacity) {
15600 _children_capacity *= 2;
15601 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15602 if (!_new_children) {
15603 p->error_indicator = 1;
15604 PyErr_NoMemory();
15605 D(p->level--);
15606 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015607 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015608 _children = _new_children;
15609 }
15610 _children[_n++] = _res;
15611 _mark = p->mark;
15612 }
15613 p->mark = _mark;
15614 D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
15615 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15616 }
15617 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15618 if (!_seq) {
15619 PyMem_Free(_children);
15620 p->error_indicator = 1;
15621 PyErr_NoMemory();
15622 D(p->level--);
15623 return NULL;
15624 }
15625 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15626 PyMem_Free(_children);
15627 _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq);
15628 D(p->level--);
15629 return _seq;
15630}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015631
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015632// _loop0_2: NEWLINE
15633static asdl_seq *
15634_loop0_2_rule(Parser *p)
15635{
15636 D(p->level++);
15637 if (p->error_indicator) {
15638 D(p->level--);
15639 return NULL;
15640 }
15641 void *_res = NULL;
15642 int _mark = p->mark;
15643 int _start_mark = p->mark;
15644 void **_children = PyMem_Malloc(sizeof(void *));
15645 if (!_children) {
15646 p->error_indicator = 1;
15647 PyErr_NoMemory();
15648 D(p->level--);
15649 return NULL;
15650 }
15651 ssize_t _children_capacity = 1;
15652 ssize_t _n = 0;
15653 { // NEWLINE
15654 if (p->error_indicator) {
15655 D(p->level--);
15656 return NULL;
15657 }
15658 D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15659 Token * newline_var;
15660 while (
15661 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15662 )
15663 {
15664 _res = newline_var;
15665 if (_n == _children_capacity) {
15666 _children_capacity *= 2;
15667 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15668 if (!_new_children) {
15669 p->error_indicator = 1;
15670 PyErr_NoMemory();
15671 D(p->level--);
15672 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015673 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015674 _children = _new_children;
15675 }
15676 _children[_n++] = _res;
15677 _mark = p->mark;
15678 }
15679 p->mark = _mark;
15680 D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
15681 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15682 }
15683 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15684 if (!_seq) {
15685 PyMem_Free(_children);
15686 p->error_indicator = 1;
15687 PyErr_NoMemory();
15688 D(p->level--);
15689 return NULL;
15690 }
15691 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15692 PyMem_Free(_children);
15693 _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq);
15694 D(p->level--);
15695 return _seq;
15696}
15697
15698// _loop0_4: ',' expression
15699static asdl_seq *
15700_loop0_4_rule(Parser *p)
15701{
15702 D(p->level++);
15703 if (p->error_indicator) {
15704 D(p->level--);
15705 return NULL;
15706 }
15707 void *_res = NULL;
15708 int _mark = p->mark;
15709 int _start_mark = p->mark;
15710 void **_children = PyMem_Malloc(sizeof(void *));
15711 if (!_children) {
15712 p->error_indicator = 1;
15713 PyErr_NoMemory();
15714 D(p->level--);
15715 return NULL;
15716 }
15717 ssize_t _children_capacity = 1;
15718 ssize_t _n = 0;
15719 { // ',' expression
15720 if (p->error_indicator) {
15721 D(p->level--);
15722 return NULL;
15723 }
15724 D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15725 Token * _literal;
15726 expr_ty elem;
15727 while (
15728 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15729 &&
15730 (elem = expression_rule(p)) // expression
15731 )
15732 {
15733 _res = elem;
15734 if (_res == NULL && PyErr_Occurred()) {
15735 p->error_indicator = 1;
15736 PyMem_Free(_children);
15737 D(p->level--);
15738 return NULL;
15739 }
15740 if (_n == _children_capacity) {
15741 _children_capacity *= 2;
15742 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15743 if (!_new_children) {
15744 p->error_indicator = 1;
15745 PyErr_NoMemory();
15746 D(p->level--);
15747 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015748 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015749 _children = _new_children;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015750 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015751 _children[_n++] = _res;
15752 _mark = p->mark;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015753 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015754 p->mark = _mark;
15755 D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
15756 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015757 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015758 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15759 if (!_seq) {
15760 PyMem_Free(_children);
15761 p->error_indicator = 1;
15762 PyErr_NoMemory();
15763 D(p->level--);
15764 return NULL;
15765 }
15766 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15767 PyMem_Free(_children);
15768 _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
15769 D(p->level--);
15770 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015771}
15772
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015773// _gather_3: expression _loop0_4
15774static asdl_seq *
15775_gather_3_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015776{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015777 D(p->level++);
15778 if (p->error_indicator) {
15779 D(p->level--);
15780 return NULL;
15781 }
15782 asdl_seq * _res = NULL;
15783 int _mark = p->mark;
15784 { // expression _loop0_4
15785 if (p->error_indicator) {
15786 D(p->level--);
15787 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015788 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015789 D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15790 expr_ty elem;
15791 asdl_seq * seq;
15792 if (
15793 (elem = expression_rule(p)) // expression
15794 &&
15795 (seq = _loop0_4_rule(p)) // _loop0_4
15796 )
15797 {
15798 D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15799 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15800 goto done;
15801 }
15802 p->mark = _mark;
15803 D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ',
15804 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015805 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015806 _res = NULL;
15807 done:
15808 D(p->level--);
15809 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015810}
15811
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015812// _loop0_6: ',' expression
15813static asdl_seq *
15814_loop0_6_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015815{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015816 D(p->level++);
15817 if (p->error_indicator) {
15818 D(p->level--);
15819 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015820 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015821 void *_res = NULL;
15822 int _mark = p->mark;
15823 int _start_mark = p->mark;
15824 void **_children = PyMem_Malloc(sizeof(void *));
15825 if (!_children) {
15826 p->error_indicator = 1;
15827 PyErr_NoMemory();
15828 D(p->level--);
15829 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015830 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015831 ssize_t _children_capacity = 1;
15832 ssize_t _n = 0;
15833 { // ',' expression
15834 if (p->error_indicator) {
15835 D(p->level--);
15836 return NULL;
15837 }
15838 D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15839 Token * _literal;
15840 expr_ty elem;
15841 while (
15842 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15843 &&
15844 (elem = expression_rule(p)) // expression
15845 )
15846 {
15847 _res = elem;
15848 if (_res == NULL && PyErr_Occurred()) {
15849 p->error_indicator = 1;
15850 PyMem_Free(_children);
15851 D(p->level--);
15852 return NULL;
15853 }
15854 if (_n == _children_capacity) {
15855 _children_capacity *= 2;
15856 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15857 if (!_new_children) {
15858 p->error_indicator = 1;
15859 PyErr_NoMemory();
15860 D(p->level--);
15861 return NULL;
15862 }
15863 _children = _new_children;
15864 }
15865 _children[_n++] = _res;
15866 _mark = p->mark;
15867 }
15868 p->mark = _mark;
15869 D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
15870 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
15871 }
15872 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15873 if (!_seq) {
15874 PyMem_Free(_children);
15875 p->error_indicator = 1;
15876 PyErr_NoMemory();
15877 D(p->level--);
15878 return NULL;
15879 }
15880 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15881 PyMem_Free(_children);
15882 _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
15883 D(p->level--);
15884 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015885}
15886
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015887// _gather_5: expression _loop0_6
15888static asdl_seq *
15889_gather_5_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015890{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015891 D(p->level++);
15892 if (p->error_indicator) {
15893 D(p->level--);
15894 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015895 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015896 asdl_seq * _res = NULL;
15897 int _mark = p->mark;
15898 { // expression _loop0_6
15899 if (p->error_indicator) {
15900 D(p->level--);
15901 return NULL;
15902 }
15903 D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15904 expr_ty elem;
15905 asdl_seq * seq;
15906 if (
15907 (elem = expression_rule(p)) // expression
15908 &&
15909 (seq = _loop0_6_rule(p)) // _loop0_6
15910 )
15911 {
15912 D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15913 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15914 goto done;
15915 }
15916 p->mark = _mark;
15917 D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ',
15918 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6"));
15919 }
15920 _res = NULL;
15921 done:
15922 D(p->level--);
15923 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015924}
15925
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015926// _loop0_8: ',' expression
15927static asdl_seq *
15928_loop0_8_rule(Parser *p)
15929{
15930 D(p->level++);
15931 if (p->error_indicator) {
15932 D(p->level--);
15933 return NULL;
15934 }
15935 void *_res = NULL;
15936 int _mark = p->mark;
15937 int _start_mark = p->mark;
15938 void **_children = PyMem_Malloc(sizeof(void *));
15939 if (!_children) {
15940 p->error_indicator = 1;
15941 PyErr_NoMemory();
15942 D(p->level--);
15943 return NULL;
15944 }
15945 ssize_t _children_capacity = 1;
15946 ssize_t _n = 0;
15947 { // ',' expression
15948 if (p->error_indicator) {
15949 D(p->level--);
15950 return NULL;
15951 }
15952 D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15953 Token * _literal;
15954 expr_ty elem;
15955 while (
15956 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15957 &&
15958 (elem = expression_rule(p)) // expression
15959 )
15960 {
15961 _res = elem;
15962 if (_res == NULL && PyErr_Occurred()) {
15963 p->error_indicator = 1;
15964 PyMem_Free(_children);
15965 D(p->level--);
15966 return NULL;
15967 }
15968 if (_n == _children_capacity) {
15969 _children_capacity *= 2;
15970 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15971 if (!_new_children) {
15972 p->error_indicator = 1;
15973 PyErr_NoMemory();
15974 D(p->level--);
15975 return NULL;
15976 }
15977 _children = _new_children;
15978 }
15979 _children[_n++] = _res;
15980 _mark = p->mark;
15981 }
15982 p->mark = _mark;
15983 D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
15984 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
15985 }
15986 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15987 if (!_seq) {
15988 PyMem_Free(_children);
15989 p->error_indicator = 1;
15990 PyErr_NoMemory();
15991 D(p->level--);
15992 return NULL;
15993 }
15994 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15995 PyMem_Free(_children);
15996 _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
15997 D(p->level--);
15998 return _seq;
15999}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016000
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016001// _gather_7: expression _loop0_8
16002static asdl_seq *
16003_gather_7_rule(Parser *p)
16004{
16005 D(p->level++);
16006 if (p->error_indicator) {
16007 D(p->level--);
16008 return NULL;
16009 }
16010 asdl_seq * _res = NULL;
16011 int _mark = p->mark;
16012 { // expression _loop0_8
16013 if (p->error_indicator) {
16014 D(p->level--);
16015 return NULL;
16016 }
16017 D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16018 expr_ty elem;
16019 asdl_seq * seq;
16020 if (
16021 (elem = expression_rule(p)) // expression
16022 &&
16023 (seq = _loop0_8_rule(p)) // _loop0_8
16024 )
16025 {
16026 D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16027 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16028 goto done;
16029 }
16030 p->mark = _mark;
16031 D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ',
16032 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8"));
16033 }
16034 _res = NULL;
16035 done:
16036 D(p->level--);
16037 return _res;
16038}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016039
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016040// _loop0_10: ',' expression
16041static asdl_seq *
16042_loop0_10_rule(Parser *p)
16043{
16044 D(p->level++);
16045 if (p->error_indicator) {
16046 D(p->level--);
16047 return NULL;
16048 }
16049 void *_res = NULL;
16050 int _mark = p->mark;
16051 int _start_mark = p->mark;
16052 void **_children = PyMem_Malloc(sizeof(void *));
16053 if (!_children) {
16054 p->error_indicator = 1;
16055 PyErr_NoMemory();
16056 D(p->level--);
16057 return NULL;
16058 }
16059 ssize_t _children_capacity = 1;
16060 ssize_t _n = 0;
16061 { // ',' expression
16062 if (p->error_indicator) {
16063 D(p->level--);
16064 return NULL;
16065 }
16066 D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
16067 Token * _literal;
16068 expr_ty elem;
16069 while (
16070 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16071 &&
16072 (elem = expression_rule(p)) // expression
16073 )
16074 {
16075 _res = elem;
16076 if (_res == NULL && PyErr_Occurred()) {
16077 p->error_indicator = 1;
16078 PyMem_Free(_children);
16079 D(p->level--);
16080 return NULL;
16081 }
16082 if (_n == _children_capacity) {
16083 _children_capacity *= 2;
16084 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16085 if (!_new_children) {
16086 p->error_indicator = 1;
16087 PyErr_NoMemory();
16088 D(p->level--);
16089 return NULL;
16090 }
16091 _children = _new_children;
16092 }
16093 _children[_n++] = _res;
16094 _mark = p->mark;
16095 }
16096 p->mark = _mark;
16097 D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
16098 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16099 }
16100 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16101 if (!_seq) {
16102 PyMem_Free(_children);
16103 p->error_indicator = 1;
16104 PyErr_NoMemory();
16105 D(p->level--);
16106 return NULL;
16107 }
16108 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16109 PyMem_Free(_children);
16110 _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
16111 D(p->level--);
16112 return _seq;
16113}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016115// _gather_9: expression _loop0_10
16116static asdl_seq *
16117_gather_9_rule(Parser *p)
16118{
16119 D(p->level++);
16120 if (p->error_indicator) {
16121 D(p->level--);
16122 return NULL;
16123 }
16124 asdl_seq * _res = NULL;
16125 int _mark = p->mark;
16126 { // expression _loop0_10
16127 if (p->error_indicator) {
16128 D(p->level--);
16129 return NULL;
16130 }
16131 D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16132 expr_ty elem;
16133 asdl_seq * seq;
16134 if (
16135 (elem = expression_rule(p)) // expression
16136 &&
16137 (seq = _loop0_10_rule(p)) // _loop0_10
16138 )
16139 {
16140 D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16141 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16142 goto done;
16143 }
16144 p->mark = _mark;
16145 D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ',
16146 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10"));
16147 }
16148 _res = NULL;
16149 done:
16150 D(p->level--);
16151 return _res;
16152}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016153
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016154// _loop1_11: statement
16155static asdl_seq *
16156_loop1_11_rule(Parser *p)
16157{
16158 D(p->level++);
16159 if (p->error_indicator) {
16160 D(p->level--);
16161 return NULL;
16162 }
16163 void *_res = NULL;
16164 int _mark = p->mark;
16165 int _start_mark = p->mark;
16166 void **_children = PyMem_Malloc(sizeof(void *));
16167 if (!_children) {
16168 p->error_indicator = 1;
16169 PyErr_NoMemory();
16170 D(p->level--);
16171 return NULL;
16172 }
16173 ssize_t _children_capacity = 1;
16174 ssize_t _n = 0;
16175 { // statement
16176 if (p->error_indicator) {
16177 D(p->level--);
16178 return NULL;
16179 }
16180 D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
16181 asdl_seq* statement_var;
16182 while (
16183 (statement_var = statement_rule(p)) // statement
16184 )
16185 {
16186 _res = statement_var;
16187 if (_n == _children_capacity) {
16188 _children_capacity *= 2;
16189 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16190 if (!_new_children) {
16191 p->error_indicator = 1;
16192 PyErr_NoMemory();
16193 D(p->level--);
16194 return NULL;
16195 }
16196 _children = _new_children;
16197 }
16198 _children[_n++] = _res;
16199 _mark = p->mark;
16200 }
16201 p->mark = _mark;
16202 D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ',
16203 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
16204 }
16205 if (_n == 0 || p->error_indicator) {
16206 PyMem_Free(_children);
16207 D(p->level--);
16208 return NULL;
16209 }
16210 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16211 if (!_seq) {
16212 PyMem_Free(_children);
16213 p->error_indicator = 1;
16214 PyErr_NoMemory();
16215 D(p->level--);
16216 return NULL;
16217 }
16218 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16219 PyMem_Free(_children);
16220 _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
16221 D(p->level--);
16222 return _seq;
16223}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016224
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016225// _loop0_13: ';' small_stmt
16226static asdl_seq *
16227_loop0_13_rule(Parser *p)
16228{
16229 D(p->level++);
16230 if (p->error_indicator) {
16231 D(p->level--);
16232 return NULL;
16233 }
16234 void *_res = NULL;
16235 int _mark = p->mark;
16236 int _start_mark = p->mark;
16237 void **_children = PyMem_Malloc(sizeof(void *));
16238 if (!_children) {
16239 p->error_indicator = 1;
16240 PyErr_NoMemory();
16241 D(p->level--);
16242 return NULL;
16243 }
16244 ssize_t _children_capacity = 1;
16245 ssize_t _n = 0;
16246 { // ';' small_stmt
16247 if (p->error_indicator) {
16248 D(p->level--);
16249 return NULL;
16250 }
16251 D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt"));
16252 Token * _literal;
16253 stmt_ty elem;
16254 while (
16255 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
16256 &&
16257 (elem = small_stmt_rule(p)) // small_stmt
16258 )
16259 {
16260 _res = elem;
16261 if (_res == NULL && PyErr_Occurred()) {
16262 p->error_indicator = 1;
16263 PyMem_Free(_children);
16264 D(p->level--);
16265 return NULL;
16266 }
16267 if (_n == _children_capacity) {
16268 _children_capacity *= 2;
16269 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16270 if (!_new_children) {
16271 p->error_indicator = 1;
16272 PyErr_NoMemory();
16273 D(p->level--);
16274 return NULL;
16275 }
16276 _children = _new_children;
16277 }
16278 _children[_n++] = _res;
16279 _mark = p->mark;
16280 }
16281 p->mark = _mark;
16282 D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
16283 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt"));
16284 }
16285 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16286 if (!_seq) {
16287 PyMem_Free(_children);
16288 p->error_indicator = 1;
16289 PyErr_NoMemory();
16290 D(p->level--);
16291 return NULL;
16292 }
16293 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16294 PyMem_Free(_children);
16295 _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
16296 D(p->level--);
16297 return _seq;
16298}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016299
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016300// _gather_12: small_stmt _loop0_13
16301static asdl_seq *
16302_gather_12_rule(Parser *p)
16303{
16304 D(p->level++);
16305 if (p->error_indicator) {
16306 D(p->level--);
16307 return NULL;
16308 }
16309 asdl_seq * _res = NULL;
16310 int _mark = p->mark;
16311 { // small_stmt _loop0_13
16312 if (p->error_indicator) {
16313 D(p->level--);
16314 return NULL;
16315 }
16316 D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16317 stmt_ty elem;
16318 asdl_seq * seq;
16319 if (
16320 (elem = small_stmt_rule(p)) // small_stmt
16321 &&
16322 (seq = _loop0_13_rule(p)) // _loop0_13
16323 )
16324 {
16325 D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16326 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16327 goto done;
16328 }
16329 p->mark = _mark;
16330 D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ',
16331 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13"));
16332 }
16333 _res = NULL;
16334 done:
16335 D(p->level--);
16336 return _res;
16337}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016338
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016339// _tmp_14: 'import' | 'from'
16340static void *
16341_tmp_14_rule(Parser *p)
16342{
16343 D(p->level++);
16344 if (p->error_indicator) {
16345 D(p->level--);
16346 return NULL;
16347 }
16348 void * _res = NULL;
16349 int _mark = p->mark;
16350 { // 'import'
16351 if (p->error_indicator) {
16352 D(p->level--);
16353 return NULL;
16354 }
16355 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
16356 Token * _keyword;
16357 if (
16358 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
16359 )
16360 {
16361 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
16362 _res = _keyword;
16363 goto done;
16364 }
16365 p->mark = _mark;
16366 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16367 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
16368 }
16369 { // 'from'
16370 if (p->error_indicator) {
16371 D(p->level--);
16372 return NULL;
16373 }
16374 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
16375 Token * _keyword;
16376 if (
16377 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
16378 )
16379 {
16380 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
16381 _res = _keyword;
16382 goto done;
16383 }
16384 p->mark = _mark;
16385 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16386 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
16387 }
16388 _res = NULL;
16389 done:
16390 D(p->level--);
16391 return _res;
16392}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016393
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016394// _tmp_15: 'def' | '@' | ASYNC
16395static void *
16396_tmp_15_rule(Parser *p)
16397{
16398 D(p->level++);
16399 if (p->error_indicator) {
16400 D(p->level--);
16401 return NULL;
16402 }
16403 void * _res = NULL;
16404 int _mark = p->mark;
16405 { // 'def'
16406 if (p->error_indicator) {
16407 D(p->level--);
16408 return NULL;
16409 }
16410 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
16411 Token * _keyword;
16412 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016413 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016414 )
16415 {
16416 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
16417 _res = _keyword;
16418 goto done;
16419 }
16420 p->mark = _mark;
16421 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16422 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
16423 }
16424 { // '@'
16425 if (p->error_indicator) {
16426 D(p->level--);
16427 return NULL;
16428 }
16429 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16430 Token * _literal;
16431 if (
16432 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16433 )
16434 {
16435 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16436 _res = _literal;
16437 goto done;
16438 }
16439 p->mark = _mark;
16440 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16441 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16442 }
16443 { // ASYNC
16444 if (p->error_indicator) {
16445 D(p->level--);
16446 return NULL;
16447 }
16448 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16449 Token * async_var;
16450 if (
16451 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16452 )
16453 {
16454 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16455 _res = async_var;
16456 goto done;
16457 }
16458 p->mark = _mark;
16459 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16460 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16461 }
16462 _res = NULL;
16463 done:
16464 D(p->level--);
16465 return _res;
16466}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016467
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016468// _tmp_16: 'class' | '@'
16469static void *
16470_tmp_16_rule(Parser *p)
16471{
16472 D(p->level++);
16473 if (p->error_indicator) {
16474 D(p->level--);
16475 return NULL;
16476 }
16477 void * _res = NULL;
16478 int _mark = p->mark;
16479 { // 'class'
16480 if (p->error_indicator) {
16481 D(p->level--);
16482 return NULL;
16483 }
16484 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
16485 Token * _keyword;
16486 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016487 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016488 )
16489 {
16490 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
16491 _res = _keyword;
16492 goto done;
16493 }
16494 p->mark = _mark;
16495 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16496 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
16497 }
16498 { // '@'
16499 if (p->error_indicator) {
16500 D(p->level--);
16501 return NULL;
16502 }
16503 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16504 Token * _literal;
16505 if (
16506 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16507 )
16508 {
16509 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16510 _res = _literal;
16511 goto done;
16512 }
16513 p->mark = _mark;
16514 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16515 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16516 }
16517 _res = NULL;
16518 done:
16519 D(p->level--);
16520 return _res;
16521}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016522
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016523// _tmp_17: 'with' | ASYNC
16524static void *
16525_tmp_17_rule(Parser *p)
16526{
16527 D(p->level++);
16528 if (p->error_indicator) {
16529 D(p->level--);
16530 return NULL;
16531 }
16532 void * _res = NULL;
16533 int _mark = p->mark;
16534 { // 'with'
16535 if (p->error_indicator) {
16536 D(p->level--);
16537 return NULL;
16538 }
16539 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
16540 Token * _keyword;
16541 if (
16542 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
16543 )
16544 {
16545 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
16546 _res = _keyword;
16547 goto done;
16548 }
16549 p->mark = _mark;
16550 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16551 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
16552 }
16553 { // ASYNC
16554 if (p->error_indicator) {
16555 D(p->level--);
16556 return NULL;
16557 }
16558 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16559 Token * async_var;
16560 if (
16561 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16562 )
16563 {
16564 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16565 _res = async_var;
16566 goto done;
16567 }
16568 p->mark = _mark;
16569 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16570 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16571 }
16572 _res = NULL;
16573 done:
16574 D(p->level--);
16575 return _res;
16576}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016577
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016578// _tmp_18: 'for' | ASYNC
16579static void *
16580_tmp_18_rule(Parser *p)
16581{
16582 D(p->level++);
16583 if (p->error_indicator) {
16584 D(p->level--);
16585 return NULL;
16586 }
16587 void * _res = NULL;
16588 int _mark = p->mark;
16589 { // 'for'
16590 if (p->error_indicator) {
16591 D(p->level--);
16592 return NULL;
16593 }
16594 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
16595 Token * _keyword;
16596 if (
16597 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
16598 )
16599 {
16600 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
16601 _res = _keyword;
16602 goto done;
16603 }
16604 p->mark = _mark;
16605 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16606 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
16607 }
16608 { // ASYNC
16609 if (p->error_indicator) {
16610 D(p->level--);
16611 return NULL;
16612 }
16613 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16614 Token * async_var;
16615 if (
16616 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16617 )
16618 {
16619 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16620 _res = async_var;
16621 goto done;
16622 }
16623 p->mark = _mark;
16624 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16625 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16626 }
16627 _res = NULL;
16628 done:
16629 D(p->level--);
16630 return _res;
16631}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016632
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016633// _tmp_19: '=' annotated_rhs
16634static void *
16635_tmp_19_rule(Parser *p)
16636{
16637 D(p->level++);
16638 if (p->error_indicator) {
16639 D(p->level--);
16640 return NULL;
16641 }
16642 void * _res = NULL;
16643 int _mark = p->mark;
16644 { // '=' annotated_rhs
16645 if (p->error_indicator) {
16646 D(p->level--);
16647 return NULL;
16648 }
16649 D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16650 Token * _literal;
16651 expr_ty d;
16652 if (
16653 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16654 &&
16655 (d = annotated_rhs_rule(p)) // annotated_rhs
16656 )
16657 {
16658 D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16659 _res = d;
16660 if (_res == NULL && PyErr_Occurred()) {
16661 p->error_indicator = 1;
16662 D(p->level--);
16663 return NULL;
16664 }
16665 goto done;
16666 }
16667 p->mark = _mark;
16668 D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ',
16669 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16670 }
16671 _res = NULL;
16672 done:
16673 D(p->level--);
16674 return _res;
16675}
16676
16677// _tmp_20: '(' single_target ')' | single_subscript_attribute_target
16678static void *
16679_tmp_20_rule(Parser *p)
16680{
16681 D(p->level++);
16682 if (p->error_indicator) {
16683 D(p->level--);
16684 return NULL;
16685 }
16686 void * _res = NULL;
16687 int _mark = p->mark;
16688 { // '(' single_target ')'
16689 if (p->error_indicator) {
16690 D(p->level--);
16691 return NULL;
16692 }
16693 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16694 Token * _literal;
16695 Token * _literal_1;
16696 expr_ty b;
16697 if (
16698 (_literal = _PyPegen_expect_token(p, 7)) // token='('
16699 &&
16700 (b = single_target_rule(p)) // single_target
16701 &&
16702 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
16703 )
16704 {
16705 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16706 _res = b;
16707 if (_res == NULL && PyErr_Occurred()) {
16708 p->error_indicator = 1;
16709 D(p->level--);
16710 return NULL;
16711 }
16712 goto done;
16713 }
16714 p->mark = _mark;
16715 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16716 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
16717 }
16718 { // single_subscript_attribute_target
16719 if (p->error_indicator) {
16720 D(p->level--);
16721 return NULL;
16722 }
16723 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16724 expr_ty single_subscript_attribute_target_var;
16725 if (
16726 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
16727 )
16728 {
16729 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16730 _res = single_subscript_attribute_target_var;
16731 goto done;
16732 }
16733 p->mark = _mark;
16734 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16735 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
16736 }
16737 _res = NULL;
16738 done:
16739 D(p->level--);
16740 return _res;
16741}
16742
16743// _tmp_21: '=' annotated_rhs
16744static void *
16745_tmp_21_rule(Parser *p)
16746{
16747 D(p->level++);
16748 if (p->error_indicator) {
16749 D(p->level--);
16750 return NULL;
16751 }
16752 void * _res = NULL;
16753 int _mark = p->mark;
16754 { // '=' annotated_rhs
16755 if (p->error_indicator) {
16756 D(p->level--);
16757 return NULL;
16758 }
16759 D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16760 Token * _literal;
16761 expr_ty d;
16762 if (
16763 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16764 &&
16765 (d = annotated_rhs_rule(p)) // annotated_rhs
16766 )
16767 {
16768 D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16769 _res = d;
16770 if (_res == NULL && PyErr_Occurred()) {
16771 p->error_indicator = 1;
16772 D(p->level--);
16773 return NULL;
16774 }
16775 goto done;
16776 }
16777 p->mark = _mark;
16778 D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ',
16779 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16780 }
16781 _res = NULL;
16782 done:
16783 D(p->level--);
16784 return _res;
16785}
16786
16787// _loop1_22: (star_targets '=')
16788static asdl_seq *
16789_loop1_22_rule(Parser *p)
16790{
16791 D(p->level++);
16792 if (p->error_indicator) {
16793 D(p->level--);
16794 return NULL;
16795 }
16796 void *_res = NULL;
16797 int _mark = p->mark;
16798 int _start_mark = p->mark;
16799 void **_children = PyMem_Malloc(sizeof(void *));
16800 if (!_children) {
16801 p->error_indicator = 1;
16802 PyErr_NoMemory();
16803 D(p->level--);
16804 return NULL;
16805 }
16806 ssize_t _children_capacity = 1;
16807 ssize_t _n = 0;
16808 { // (star_targets '=')
16809 if (p->error_indicator) {
16810 D(p->level--);
16811 return NULL;
16812 }
16813 D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010016814 void *_tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016815 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010016816 (_tmp_139_var = _tmp_139_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016817 )
16818 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010016819 _res = _tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016820 if (_n == _children_capacity) {
16821 _children_capacity *= 2;
16822 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16823 if (!_new_children) {
16824 p->error_indicator = 1;
16825 PyErr_NoMemory();
16826 D(p->level--);
16827 return NULL;
16828 }
16829 _children = _new_children;
16830 }
16831 _children[_n++] = _res;
16832 _mark = p->mark;
16833 }
16834 p->mark = _mark;
16835 D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ',
16836 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
16837 }
16838 if (_n == 0 || p->error_indicator) {
16839 PyMem_Free(_children);
16840 D(p->level--);
16841 return NULL;
16842 }
16843 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16844 if (!_seq) {
16845 PyMem_Free(_children);
16846 p->error_indicator = 1;
16847 PyErr_NoMemory();
16848 D(p->level--);
16849 return NULL;
16850 }
16851 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16852 PyMem_Free(_children);
16853 _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
16854 D(p->level--);
16855 return _seq;
16856}
16857
16858// _tmp_23: yield_expr | star_expressions
16859static void *
16860_tmp_23_rule(Parser *p)
16861{
16862 D(p->level++);
16863 if (p->error_indicator) {
16864 D(p->level--);
16865 return NULL;
16866 }
16867 void * _res = NULL;
16868 int _mark = p->mark;
16869 { // yield_expr
16870 if (p->error_indicator) {
16871 D(p->level--);
16872 return NULL;
16873 }
16874 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16875 expr_ty yield_expr_var;
16876 if (
16877 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16878 )
16879 {
16880 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16881 _res = yield_expr_var;
16882 goto done;
16883 }
16884 p->mark = _mark;
16885 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16886 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16887 }
16888 { // star_expressions
16889 if (p->error_indicator) {
16890 D(p->level--);
16891 return NULL;
16892 }
16893 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16894 expr_ty star_expressions_var;
16895 if (
16896 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16897 )
16898 {
16899 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16900 _res = star_expressions_var;
16901 goto done;
16902 }
16903 p->mark = _mark;
16904 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16905 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16906 }
16907 _res = NULL;
16908 done:
16909 D(p->level--);
16910 return _res;
16911}
16912
16913// _tmp_24: yield_expr | star_expressions
16914static void *
16915_tmp_24_rule(Parser *p)
16916{
16917 D(p->level++);
16918 if (p->error_indicator) {
16919 D(p->level--);
16920 return NULL;
16921 }
16922 void * _res = NULL;
16923 int _mark = p->mark;
16924 { // yield_expr
16925 if (p->error_indicator) {
16926 D(p->level--);
16927 return NULL;
16928 }
16929 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16930 expr_ty yield_expr_var;
16931 if (
16932 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16933 )
16934 {
16935 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16936 _res = yield_expr_var;
16937 goto done;
16938 }
16939 p->mark = _mark;
16940 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16941 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16942 }
16943 { // star_expressions
16944 if (p->error_indicator) {
16945 D(p->level--);
16946 return NULL;
16947 }
16948 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16949 expr_ty star_expressions_var;
16950 if (
16951 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16952 )
16953 {
16954 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16955 _res = star_expressions_var;
16956 goto done;
16957 }
16958 p->mark = _mark;
16959 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16960 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16961 }
16962 _res = NULL;
16963 done:
16964 D(p->level--);
16965 return _res;
16966}
16967
16968// _loop0_26: ',' NAME
16969static asdl_seq *
16970_loop0_26_rule(Parser *p)
16971{
16972 D(p->level++);
16973 if (p->error_indicator) {
16974 D(p->level--);
16975 return NULL;
16976 }
16977 void *_res = NULL;
16978 int _mark = p->mark;
16979 int _start_mark = p->mark;
16980 void **_children = PyMem_Malloc(sizeof(void *));
16981 if (!_children) {
16982 p->error_indicator = 1;
16983 PyErr_NoMemory();
16984 D(p->level--);
16985 return NULL;
16986 }
16987 ssize_t _children_capacity = 1;
16988 ssize_t _n = 0;
16989 { // ',' NAME
16990 if (p->error_indicator) {
16991 D(p->level--);
16992 return NULL;
16993 }
16994 D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
16995 Token * _literal;
16996 expr_ty elem;
16997 while (
16998 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16999 &&
17000 (elem = _PyPegen_name_token(p)) // NAME
17001 )
17002 {
17003 _res = elem;
17004 if (_res == NULL && PyErr_Occurred()) {
17005 p->error_indicator = 1;
17006 PyMem_Free(_children);
17007 D(p->level--);
17008 return NULL;
17009 }
17010 if (_n == _children_capacity) {
17011 _children_capacity *= 2;
17012 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17013 if (!_new_children) {
17014 p->error_indicator = 1;
17015 PyErr_NoMemory();
17016 D(p->level--);
17017 return NULL;
17018 }
17019 _children = _new_children;
17020 }
17021 _children[_n++] = _res;
17022 _mark = p->mark;
17023 }
17024 p->mark = _mark;
17025 D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
17026 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17027 }
17028 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17029 if (!_seq) {
17030 PyMem_Free(_children);
17031 p->error_indicator = 1;
17032 PyErr_NoMemory();
17033 D(p->level--);
17034 return NULL;
17035 }
17036 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17037 PyMem_Free(_children);
17038 _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
17039 D(p->level--);
17040 return _seq;
17041}
17042
17043// _gather_25: NAME _loop0_26
17044static asdl_seq *
17045_gather_25_rule(Parser *p)
17046{
17047 D(p->level++);
17048 if (p->error_indicator) {
17049 D(p->level--);
17050 return NULL;
17051 }
17052 asdl_seq * _res = NULL;
17053 int _mark = p->mark;
17054 { // NAME _loop0_26
17055 if (p->error_indicator) {
17056 D(p->level--);
17057 return NULL;
17058 }
17059 D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17060 expr_ty elem;
17061 asdl_seq * seq;
17062 if (
17063 (elem = _PyPegen_name_token(p)) // NAME
17064 &&
17065 (seq = _loop0_26_rule(p)) // _loop0_26
17066 )
17067 {
17068 D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17069 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17070 goto done;
17071 }
17072 p->mark = _mark;
17073 D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ',
17074 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26"));
17075 }
17076 _res = NULL;
17077 done:
17078 D(p->level--);
17079 return _res;
17080}
17081
17082// _loop0_28: ',' NAME
17083static asdl_seq *
17084_loop0_28_rule(Parser *p)
17085{
17086 D(p->level++);
17087 if (p->error_indicator) {
17088 D(p->level--);
17089 return NULL;
17090 }
17091 void *_res = NULL;
17092 int _mark = p->mark;
17093 int _start_mark = p->mark;
17094 void **_children = PyMem_Malloc(sizeof(void *));
17095 if (!_children) {
17096 p->error_indicator = 1;
17097 PyErr_NoMemory();
17098 D(p->level--);
17099 return NULL;
17100 }
17101 ssize_t _children_capacity = 1;
17102 ssize_t _n = 0;
17103 { // ',' NAME
17104 if (p->error_indicator) {
17105 D(p->level--);
17106 return NULL;
17107 }
17108 D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17109 Token * _literal;
17110 expr_ty elem;
17111 while (
17112 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17113 &&
17114 (elem = _PyPegen_name_token(p)) // NAME
17115 )
17116 {
17117 _res = elem;
17118 if (_res == NULL && PyErr_Occurred()) {
17119 p->error_indicator = 1;
17120 PyMem_Free(_children);
17121 D(p->level--);
17122 return NULL;
17123 }
17124 if (_n == _children_capacity) {
17125 _children_capacity *= 2;
17126 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17127 if (!_new_children) {
17128 p->error_indicator = 1;
17129 PyErr_NoMemory();
17130 D(p->level--);
17131 return NULL;
17132 }
17133 _children = _new_children;
17134 }
17135 _children[_n++] = _res;
17136 _mark = p->mark;
17137 }
17138 p->mark = _mark;
17139 D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
17140 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17141 }
17142 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17143 if (!_seq) {
17144 PyMem_Free(_children);
17145 p->error_indicator = 1;
17146 PyErr_NoMemory();
17147 D(p->level--);
17148 return NULL;
17149 }
17150 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17151 PyMem_Free(_children);
17152 _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
17153 D(p->level--);
17154 return _seq;
17155}
17156
17157// _gather_27: NAME _loop0_28
17158static asdl_seq *
17159_gather_27_rule(Parser *p)
17160{
17161 D(p->level++);
17162 if (p->error_indicator) {
17163 D(p->level--);
17164 return NULL;
17165 }
17166 asdl_seq * _res = NULL;
17167 int _mark = p->mark;
17168 { // NAME _loop0_28
17169 if (p->error_indicator) {
17170 D(p->level--);
17171 return NULL;
17172 }
17173 D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17174 expr_ty elem;
17175 asdl_seq * seq;
17176 if (
17177 (elem = _PyPegen_name_token(p)) // NAME
17178 &&
17179 (seq = _loop0_28_rule(p)) // _loop0_28
17180 )
17181 {
17182 D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17183 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17184 goto done;
17185 }
17186 p->mark = _mark;
17187 D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ',
17188 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28"));
17189 }
17190 _res = NULL;
17191 done:
17192 D(p->level--);
17193 return _res;
17194}
17195
17196// _tmp_29: ',' expression
17197static void *
17198_tmp_29_rule(Parser *p)
17199{
17200 D(p->level++);
17201 if (p->error_indicator) {
17202 D(p->level--);
17203 return NULL;
17204 }
17205 void * _res = NULL;
17206 int _mark = p->mark;
17207 { // ',' expression
17208 if (p->error_indicator) {
17209 D(p->level--);
17210 return NULL;
17211 }
17212 D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
17213 Token * _literal;
17214 expr_ty z;
17215 if (
17216 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17217 &&
17218 (z = expression_rule(p)) // expression
17219 )
17220 {
17221 D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
17222 _res = z;
17223 if (_res == NULL && PyErr_Occurred()) {
17224 p->error_indicator = 1;
17225 D(p->level--);
17226 return NULL;
17227 }
17228 goto done;
17229 }
17230 p->mark = _mark;
17231 D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ',
17232 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
17233 }
17234 _res = NULL;
17235 done:
17236 D(p->level--);
17237 return _res;
17238}
17239
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017240// _tmp_30: ';' | NEWLINE
17241static void *
17242_tmp_30_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017243{
17244 D(p->level++);
17245 if (p->error_indicator) {
17246 D(p->level--);
17247 return NULL;
17248 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017249 void * _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017250 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017251 { // ';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017252 if (p->error_indicator) {
17253 D(p->level--);
17254 return NULL;
17255 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017256 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
17257 Token * _literal;
17258 if (
17259 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017260 )
17261 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017262 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
17263 _res = _literal;
17264 goto done;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017265 }
17266 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017267 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17268 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017269 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017270 { // NEWLINE
17271 if (p->error_indicator) {
17272 D(p->level--);
17273 return NULL;
17274 }
17275 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17276 Token * newline_var;
17277 if (
17278 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
17279 )
17280 {
17281 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17282 _res = newline_var;
17283 goto done;
17284 }
17285 p->mark = _mark;
17286 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17287 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017288 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017289 _res = NULL;
17290 done:
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017291 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017292 return _res;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017293}
17294
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017295// _loop0_31: ('.' | '...')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017296static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017297_loop0_31_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017298{
17299 D(p->level++);
17300 if (p->error_indicator) {
17301 D(p->level--);
17302 return NULL;
17303 }
17304 void *_res = NULL;
17305 int _mark = p->mark;
17306 int _start_mark = p->mark;
17307 void **_children = PyMem_Malloc(sizeof(void *));
17308 if (!_children) {
17309 p->error_indicator = 1;
17310 PyErr_NoMemory();
17311 D(p->level--);
17312 return NULL;
17313 }
17314 ssize_t _children_capacity = 1;
17315 ssize_t _n = 0;
17316 { // ('.' | '...')
17317 if (p->error_indicator) {
17318 D(p->level--);
17319 return NULL;
17320 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017321 D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017322 void *_tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017323 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017324 (_tmp_140_var = _tmp_140_rule(p)) // '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017325 )
17326 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017327 _res = _tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017328 if (_n == _children_capacity) {
17329 _children_capacity *= 2;
17330 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17331 if (!_new_children) {
17332 p->error_indicator = 1;
17333 PyErr_NoMemory();
17334 D(p->level--);
17335 return NULL;
17336 }
17337 _children = _new_children;
17338 }
17339 _children[_n++] = _res;
17340 _mark = p->mark;
17341 }
17342 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017343 D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
17344 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17345 }
17346 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17347 if (!_seq) {
17348 PyMem_Free(_children);
17349 p->error_indicator = 1;
17350 PyErr_NoMemory();
17351 D(p->level--);
17352 return NULL;
17353 }
17354 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17355 PyMem_Free(_children);
17356 _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
17357 D(p->level--);
17358 return _seq;
17359}
17360
17361// _loop1_32: ('.' | '...')
17362static asdl_seq *
17363_loop1_32_rule(Parser *p)
17364{
17365 D(p->level++);
17366 if (p->error_indicator) {
17367 D(p->level--);
17368 return NULL;
17369 }
17370 void *_res = NULL;
17371 int _mark = p->mark;
17372 int _start_mark = p->mark;
17373 void **_children = PyMem_Malloc(sizeof(void *));
17374 if (!_children) {
17375 p->error_indicator = 1;
17376 PyErr_NoMemory();
17377 D(p->level--);
17378 return NULL;
17379 }
17380 ssize_t _children_capacity = 1;
17381 ssize_t _n = 0;
17382 { // ('.' | '...')
17383 if (p->error_indicator) {
17384 D(p->level--);
17385 return NULL;
17386 }
17387 D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017388 void *_tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017389 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017390 (_tmp_141_var = _tmp_141_rule(p)) // '.' | '...'
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017391 )
17392 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017393 _res = _tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017394 if (_n == _children_capacity) {
17395 _children_capacity *= 2;
17396 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17397 if (!_new_children) {
17398 p->error_indicator = 1;
17399 PyErr_NoMemory();
17400 D(p->level--);
17401 return NULL;
17402 }
17403 _children = _new_children;
17404 }
17405 _children[_n++] = _res;
17406 _mark = p->mark;
17407 }
17408 p->mark = _mark;
17409 D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017410 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17411 }
17412 if (_n == 0 || p->error_indicator) {
17413 PyMem_Free(_children);
17414 D(p->level--);
17415 return NULL;
17416 }
17417 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17418 if (!_seq) {
17419 PyMem_Free(_children);
17420 p->error_indicator = 1;
17421 PyErr_NoMemory();
17422 D(p->level--);
17423 return NULL;
17424 }
17425 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17426 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017427 _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017428 D(p->level--);
17429 return _seq;
17430}
17431
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017432// _loop0_34: ',' import_from_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017433static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017434_loop0_34_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017435{
17436 D(p->level++);
17437 if (p->error_indicator) {
17438 D(p->level--);
17439 return NULL;
17440 }
17441 void *_res = NULL;
17442 int _mark = p->mark;
17443 int _start_mark = p->mark;
17444 void **_children = PyMem_Malloc(sizeof(void *));
17445 if (!_children) {
17446 p->error_indicator = 1;
17447 PyErr_NoMemory();
17448 D(p->level--);
17449 return NULL;
17450 }
17451 ssize_t _children_capacity = 1;
17452 ssize_t _n = 0;
17453 { // ',' import_from_as_name
17454 if (p->error_indicator) {
17455 D(p->level--);
17456 return NULL;
17457 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017458 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 +010017459 Token * _literal;
17460 alias_ty elem;
17461 while (
17462 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17463 &&
17464 (elem = import_from_as_name_rule(p)) // import_from_as_name
17465 )
17466 {
17467 _res = elem;
17468 if (_res == NULL && PyErr_Occurred()) {
17469 p->error_indicator = 1;
17470 PyMem_Free(_children);
17471 D(p->level--);
17472 return NULL;
17473 }
17474 if (_n == _children_capacity) {
17475 _children_capacity *= 2;
17476 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17477 if (!_new_children) {
17478 p->error_indicator = 1;
17479 PyErr_NoMemory();
17480 D(p->level--);
17481 return NULL;
17482 }
17483 _children = _new_children;
17484 }
17485 _children[_n++] = _res;
17486 _mark = p->mark;
17487 }
17488 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017489 D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017490 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
17491 }
17492 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17493 if (!_seq) {
17494 PyMem_Free(_children);
17495 p->error_indicator = 1;
17496 PyErr_NoMemory();
17497 D(p->level--);
17498 return NULL;
17499 }
17500 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17501 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017502 _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017503 D(p->level--);
17504 return _seq;
17505}
17506
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017507// _gather_33: import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017508static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017509_gather_33_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017510{
17511 D(p->level++);
17512 if (p->error_indicator) {
17513 D(p->level--);
17514 return NULL;
17515 }
17516 asdl_seq * _res = NULL;
17517 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017518 { // import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017519 if (p->error_indicator) {
17520 D(p->level--);
17521 return NULL;
17522 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017523 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 +010017524 alias_ty elem;
17525 asdl_seq * seq;
17526 if (
17527 (elem = import_from_as_name_rule(p)) // import_from_as_name
17528 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017529 (seq = _loop0_34_rule(p)) // _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017530 )
17531 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017532 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 +010017533 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17534 goto done;
17535 }
17536 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017537 D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ',
17538 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017539 }
17540 _res = NULL;
17541 done:
17542 D(p->level--);
17543 return _res;
17544}
17545
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017546// _tmp_35: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017547static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017548_tmp_35_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017549{
17550 D(p->level++);
17551 if (p->error_indicator) {
17552 D(p->level--);
17553 return NULL;
17554 }
17555 void * _res = NULL;
17556 int _mark = p->mark;
17557 { // 'as' NAME
17558 if (p->error_indicator) {
17559 D(p->level--);
17560 return NULL;
17561 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017562 D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017563 Token * _keyword;
17564 expr_ty z;
17565 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017566 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017567 &&
17568 (z = _PyPegen_name_token(p)) // NAME
17569 )
17570 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017571 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 +010017572 _res = z;
17573 if (_res == NULL && PyErr_Occurred()) {
17574 p->error_indicator = 1;
17575 D(p->level--);
17576 return NULL;
17577 }
17578 goto done;
17579 }
17580 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017581 D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017582 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17583 }
17584 _res = NULL;
17585 done:
17586 D(p->level--);
17587 return _res;
17588}
17589
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017590// _loop0_37: ',' dotted_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017591static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017592_loop0_37_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017593{
17594 D(p->level++);
17595 if (p->error_indicator) {
17596 D(p->level--);
17597 return NULL;
17598 }
17599 void *_res = NULL;
17600 int _mark = p->mark;
17601 int _start_mark = p->mark;
17602 void **_children = PyMem_Malloc(sizeof(void *));
17603 if (!_children) {
17604 p->error_indicator = 1;
17605 PyErr_NoMemory();
17606 D(p->level--);
17607 return NULL;
17608 }
17609 ssize_t _children_capacity = 1;
17610 ssize_t _n = 0;
17611 { // ',' dotted_as_name
17612 if (p->error_indicator) {
17613 D(p->level--);
17614 return NULL;
17615 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017616 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 +010017617 Token * _literal;
17618 alias_ty elem;
17619 while (
17620 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17621 &&
17622 (elem = dotted_as_name_rule(p)) // dotted_as_name
17623 )
17624 {
17625 _res = elem;
17626 if (_res == NULL && PyErr_Occurred()) {
17627 p->error_indicator = 1;
17628 PyMem_Free(_children);
17629 D(p->level--);
17630 return NULL;
17631 }
17632 if (_n == _children_capacity) {
17633 _children_capacity *= 2;
17634 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17635 if (!_new_children) {
17636 p->error_indicator = 1;
17637 PyErr_NoMemory();
17638 D(p->level--);
17639 return NULL;
17640 }
17641 _children = _new_children;
17642 }
17643 _children[_n++] = _res;
17644 _mark = p->mark;
17645 }
17646 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017647 D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017648 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
17649 }
17650 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17651 if (!_seq) {
17652 PyMem_Free(_children);
17653 p->error_indicator = 1;
17654 PyErr_NoMemory();
17655 D(p->level--);
17656 return NULL;
17657 }
17658 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17659 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017660 _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017661 D(p->level--);
17662 return _seq;
17663}
17664
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017665// _gather_36: dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017666static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017667_gather_36_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017668{
17669 D(p->level++);
17670 if (p->error_indicator) {
17671 D(p->level--);
17672 return NULL;
17673 }
17674 asdl_seq * _res = NULL;
17675 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017676 { // dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017677 if (p->error_indicator) {
17678 D(p->level--);
17679 return NULL;
17680 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017681 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 +010017682 alias_ty elem;
17683 asdl_seq * seq;
17684 if (
17685 (elem = dotted_as_name_rule(p)) // dotted_as_name
17686 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017687 (seq = _loop0_37_rule(p)) // _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017688 )
17689 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017690 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 +010017691 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17692 goto done;
17693 }
17694 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017695 D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ',
17696 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017697 }
17698 _res = NULL;
17699 done:
17700 D(p->level--);
17701 return _res;
17702}
17703
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017704// _tmp_38: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017705static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017706_tmp_38_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017707{
17708 D(p->level++);
17709 if (p->error_indicator) {
17710 D(p->level--);
17711 return NULL;
17712 }
17713 void * _res = NULL;
17714 int _mark = p->mark;
17715 { // 'as' NAME
17716 if (p->error_indicator) {
17717 D(p->level--);
17718 return NULL;
17719 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017720 D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017721 Token * _keyword;
17722 expr_ty z;
17723 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017724 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017725 &&
17726 (z = _PyPegen_name_token(p)) // NAME
17727 )
17728 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017729 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 +010017730 _res = z;
17731 if (_res == NULL && PyErr_Occurred()) {
17732 p->error_indicator = 1;
17733 D(p->level--);
17734 return NULL;
17735 }
17736 goto done;
17737 }
17738 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017739 D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017740 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17741 }
17742 _res = NULL;
17743 done:
17744 D(p->level--);
17745 return _res;
17746}
17747
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017748// _loop0_40: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017749static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017750_loop0_40_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017751{
17752 D(p->level++);
17753 if (p->error_indicator) {
17754 D(p->level--);
17755 return NULL;
17756 }
17757 void *_res = NULL;
17758 int _mark = p->mark;
17759 int _start_mark = p->mark;
17760 void **_children = PyMem_Malloc(sizeof(void *));
17761 if (!_children) {
17762 p->error_indicator = 1;
17763 PyErr_NoMemory();
17764 D(p->level--);
17765 return NULL;
17766 }
17767 ssize_t _children_capacity = 1;
17768 ssize_t _n = 0;
17769 { // ',' with_item
17770 if (p->error_indicator) {
17771 D(p->level--);
17772 return NULL;
17773 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017774 D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017775 Token * _literal;
17776 withitem_ty elem;
17777 while (
17778 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17779 &&
17780 (elem = with_item_rule(p)) // with_item
17781 )
17782 {
17783 _res = elem;
17784 if (_res == NULL && PyErr_Occurred()) {
17785 p->error_indicator = 1;
17786 PyMem_Free(_children);
17787 D(p->level--);
17788 return NULL;
17789 }
17790 if (_n == _children_capacity) {
17791 _children_capacity *= 2;
17792 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17793 if (!_new_children) {
17794 p->error_indicator = 1;
17795 PyErr_NoMemory();
17796 D(p->level--);
17797 return NULL;
17798 }
17799 _children = _new_children;
17800 }
17801 _children[_n++] = _res;
17802 _mark = p->mark;
17803 }
17804 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017805 D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017806 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17807 }
17808 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17809 if (!_seq) {
17810 PyMem_Free(_children);
17811 p->error_indicator = 1;
17812 PyErr_NoMemory();
17813 D(p->level--);
17814 return NULL;
17815 }
17816 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17817 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017818 _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017819 D(p->level--);
17820 return _seq;
17821}
17822
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017823// _gather_39: with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017824static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017825_gather_39_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017826{
17827 D(p->level++);
17828 if (p->error_indicator) {
17829 D(p->level--);
17830 return NULL;
17831 }
17832 asdl_seq * _res = NULL;
17833 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017834 { // with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017835 if (p->error_indicator) {
17836 D(p->level--);
17837 return NULL;
17838 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017839 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 +010017840 withitem_ty elem;
17841 asdl_seq * seq;
17842 if (
17843 (elem = with_item_rule(p)) // with_item
17844 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017845 (seq = _loop0_40_rule(p)) // _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017846 )
17847 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017848 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 +010017849 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17850 goto done;
17851 }
17852 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017853 D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ',
17854 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017855 }
17856 _res = NULL;
17857 done:
17858 D(p->level--);
17859 return _res;
17860}
17861
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017862// _loop0_42: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017863static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017864_loop0_42_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017865{
17866 D(p->level++);
17867 if (p->error_indicator) {
17868 D(p->level--);
17869 return NULL;
17870 }
17871 void *_res = NULL;
17872 int _mark = p->mark;
17873 int _start_mark = p->mark;
17874 void **_children = PyMem_Malloc(sizeof(void *));
17875 if (!_children) {
17876 p->error_indicator = 1;
17877 PyErr_NoMemory();
17878 D(p->level--);
17879 return NULL;
17880 }
17881 ssize_t _children_capacity = 1;
17882 ssize_t _n = 0;
17883 { // ',' with_item
17884 if (p->error_indicator) {
17885 D(p->level--);
17886 return NULL;
17887 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017888 D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017889 Token * _literal;
17890 withitem_ty elem;
17891 while (
17892 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17893 &&
17894 (elem = with_item_rule(p)) // with_item
17895 )
17896 {
17897 _res = elem;
17898 if (_res == NULL && PyErr_Occurred()) {
17899 p->error_indicator = 1;
17900 PyMem_Free(_children);
17901 D(p->level--);
17902 return NULL;
17903 }
17904 if (_n == _children_capacity) {
17905 _children_capacity *= 2;
17906 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17907 if (!_new_children) {
17908 p->error_indicator = 1;
17909 PyErr_NoMemory();
17910 D(p->level--);
17911 return NULL;
17912 }
17913 _children = _new_children;
17914 }
17915 _children[_n++] = _res;
17916 _mark = p->mark;
17917 }
17918 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017919 D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017920 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17921 }
17922 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17923 if (!_seq) {
17924 PyMem_Free(_children);
17925 p->error_indicator = 1;
17926 PyErr_NoMemory();
17927 D(p->level--);
17928 return NULL;
17929 }
17930 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17931 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017932 _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017933 D(p->level--);
17934 return _seq;
17935}
17936
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017937// _gather_41: with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017938static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017939_gather_41_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017940{
17941 D(p->level++);
17942 if (p->error_indicator) {
17943 D(p->level--);
17944 return NULL;
17945 }
17946 asdl_seq * _res = NULL;
17947 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017948 { // with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017949 if (p->error_indicator) {
17950 D(p->level--);
17951 return NULL;
17952 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017953 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 +010017954 withitem_ty elem;
17955 asdl_seq * seq;
17956 if (
17957 (elem = with_item_rule(p)) // with_item
17958 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017959 (seq = _loop0_42_rule(p)) // _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017960 )
17961 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017962 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 +010017963 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17964 goto done;
17965 }
17966 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017967 D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
17968 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017969 }
17970 _res = NULL;
17971 done:
17972 D(p->level--);
17973 return _res;
17974}
17975
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017976// _loop0_44: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017977static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017978_loop0_44_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017979{
17980 D(p->level++);
17981 if (p->error_indicator) {
17982 D(p->level--);
17983 return NULL;
17984 }
17985 void *_res = NULL;
17986 int _mark = p->mark;
17987 int _start_mark = p->mark;
17988 void **_children = PyMem_Malloc(sizeof(void *));
17989 if (!_children) {
17990 p->error_indicator = 1;
17991 PyErr_NoMemory();
17992 D(p->level--);
17993 return NULL;
17994 }
17995 ssize_t _children_capacity = 1;
17996 ssize_t _n = 0;
17997 { // ',' with_item
17998 if (p->error_indicator) {
17999 D(p->level--);
18000 return NULL;
18001 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018002 D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018003 Token * _literal;
18004 withitem_ty elem;
18005 while (
18006 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18007 &&
18008 (elem = with_item_rule(p)) // with_item
18009 )
18010 {
18011 _res = elem;
18012 if (_res == NULL && PyErr_Occurred()) {
18013 p->error_indicator = 1;
18014 PyMem_Free(_children);
18015 D(p->level--);
18016 return NULL;
18017 }
18018 if (_n == _children_capacity) {
18019 _children_capacity *= 2;
18020 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18021 if (!_new_children) {
18022 p->error_indicator = 1;
18023 PyErr_NoMemory();
18024 D(p->level--);
18025 return NULL;
18026 }
18027 _children = _new_children;
18028 }
18029 _children[_n++] = _res;
18030 _mark = p->mark;
18031 }
18032 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018033 D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018034 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18035 }
18036 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18037 if (!_seq) {
18038 PyMem_Free(_children);
18039 p->error_indicator = 1;
18040 PyErr_NoMemory();
18041 D(p->level--);
18042 return NULL;
18043 }
18044 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18045 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018046 _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018047 D(p->level--);
18048 return _seq;
18049}
18050
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018051// _gather_43: with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018052static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018053_gather_43_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018054{
18055 D(p->level++);
18056 if (p->error_indicator) {
18057 D(p->level--);
18058 return NULL;
18059 }
18060 asdl_seq * _res = NULL;
18061 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018062 { // with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018063 if (p->error_indicator) {
18064 D(p->level--);
18065 return NULL;
18066 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018067 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 +010018068 withitem_ty elem;
18069 asdl_seq * seq;
18070 if (
18071 (elem = with_item_rule(p)) // with_item
18072 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018073 (seq = _loop0_44_rule(p)) // _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018074 )
18075 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018076 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 +010018077 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18078 goto done;
18079 }
18080 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018081 D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ',
18082 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018083 }
18084 _res = NULL;
18085 done:
18086 D(p->level--);
18087 return _res;
18088}
18089
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018090// _loop0_46: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018091static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018092_loop0_46_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018093{
18094 D(p->level++);
18095 if (p->error_indicator) {
18096 D(p->level--);
18097 return NULL;
18098 }
18099 void *_res = NULL;
18100 int _mark = p->mark;
18101 int _start_mark = p->mark;
18102 void **_children = PyMem_Malloc(sizeof(void *));
18103 if (!_children) {
18104 p->error_indicator = 1;
18105 PyErr_NoMemory();
18106 D(p->level--);
18107 return NULL;
18108 }
18109 ssize_t _children_capacity = 1;
18110 ssize_t _n = 0;
18111 { // ',' with_item
18112 if (p->error_indicator) {
18113 D(p->level--);
18114 return NULL;
18115 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018116 D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018117 Token * _literal;
18118 withitem_ty elem;
18119 while (
18120 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18121 &&
18122 (elem = with_item_rule(p)) // with_item
18123 )
18124 {
18125 _res = elem;
18126 if (_res == NULL && PyErr_Occurred()) {
18127 p->error_indicator = 1;
18128 PyMem_Free(_children);
18129 D(p->level--);
18130 return NULL;
18131 }
18132 if (_n == _children_capacity) {
18133 _children_capacity *= 2;
18134 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18135 if (!_new_children) {
18136 p->error_indicator = 1;
18137 PyErr_NoMemory();
18138 D(p->level--);
18139 return NULL;
18140 }
18141 _children = _new_children;
18142 }
18143 _children[_n++] = _res;
18144 _mark = p->mark;
18145 }
18146 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018147 D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018148 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18149 }
18150 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18151 if (!_seq) {
18152 PyMem_Free(_children);
18153 p->error_indicator = 1;
18154 PyErr_NoMemory();
18155 D(p->level--);
18156 return NULL;
18157 }
18158 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18159 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018160 _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018161 D(p->level--);
18162 return _seq;
18163}
18164
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018165// _gather_45: with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018166static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018167_gather_45_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018168{
18169 D(p->level++);
18170 if (p->error_indicator) {
18171 D(p->level--);
18172 return NULL;
18173 }
18174 asdl_seq * _res = NULL;
18175 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018176 { // with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018177 if (p->error_indicator) {
18178 D(p->level--);
18179 return NULL;
18180 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018181 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 +010018182 withitem_ty elem;
18183 asdl_seq * seq;
18184 if (
18185 (elem = with_item_rule(p)) // with_item
18186 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018187 (seq = _loop0_46_rule(p)) // _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018188 )
18189 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018190 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 +010018191 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18192 goto done;
18193 }
18194 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018195 D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
18196 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018197 }
18198 _res = NULL;
18199 done:
18200 D(p->level--);
18201 return _res;
18202}
18203
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018204// _tmp_47: ',' | ')' | ':'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018205static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018206_tmp_47_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018207{
18208 D(p->level++);
18209 if (p->error_indicator) {
18210 D(p->level--);
18211 return NULL;
18212 }
18213 void * _res = NULL;
18214 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018215 { // ','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018216 if (p->error_indicator) {
18217 D(p->level--);
18218 return NULL;
18219 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018220 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
18221 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018222 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018223 (_literal = _PyPegen_expect_token(p, 12)) // token=','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018224 )
18225 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018226 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
18227 _res = _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018228 goto done;
18229 }
18230 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018231 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18232 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
18233 }
18234 { // ')'
18235 if (p->error_indicator) {
18236 D(p->level--);
18237 return NULL;
18238 }
18239 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
18240 Token * _literal;
18241 if (
18242 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
18243 )
18244 {
18245 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
18246 _res = _literal;
18247 goto done;
18248 }
18249 p->mark = _mark;
18250 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18251 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
18252 }
18253 { // ':'
18254 if (p->error_indicator) {
18255 D(p->level--);
18256 return NULL;
18257 }
18258 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
18259 Token * _literal;
18260 if (
18261 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
18262 )
18263 {
18264 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
18265 _res = _literal;
18266 goto done;
18267 }
18268 p->mark = _mark;
18269 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18270 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018271 }
18272 _res = NULL;
18273 done:
18274 D(p->level--);
18275 return _res;
18276}
18277
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018278// _loop1_48: except_block
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018279static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018280_loop1_48_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018281{
18282 D(p->level++);
18283 if (p->error_indicator) {
18284 D(p->level--);
18285 return NULL;
18286 }
18287 void *_res = NULL;
18288 int _mark = p->mark;
18289 int _start_mark = p->mark;
18290 void **_children = PyMem_Malloc(sizeof(void *));
18291 if (!_children) {
18292 p->error_indicator = 1;
18293 PyErr_NoMemory();
18294 D(p->level--);
18295 return NULL;
18296 }
18297 ssize_t _children_capacity = 1;
18298 ssize_t _n = 0;
18299 { // except_block
18300 if (p->error_indicator) {
18301 D(p->level--);
18302 return NULL;
18303 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018304 D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018305 excepthandler_ty except_block_var;
18306 while (
18307 (except_block_var = except_block_rule(p)) // except_block
18308 )
18309 {
18310 _res = except_block_var;
18311 if (_n == _children_capacity) {
18312 _children_capacity *= 2;
18313 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18314 if (!_new_children) {
18315 p->error_indicator = 1;
18316 PyErr_NoMemory();
18317 D(p->level--);
18318 return NULL;
18319 }
18320 _children = _new_children;
18321 }
18322 _children[_n++] = _res;
18323 _mark = p->mark;
18324 }
18325 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018326 D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018327 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
18328 }
18329 if (_n == 0 || p->error_indicator) {
18330 PyMem_Free(_children);
18331 D(p->level--);
18332 return NULL;
18333 }
18334 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18335 if (!_seq) {
18336 PyMem_Free(_children);
18337 p->error_indicator = 1;
18338 PyErr_NoMemory();
18339 D(p->level--);
18340 return NULL;
18341 }
18342 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18343 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018344 _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018345 D(p->level--);
18346 return _seq;
18347}
18348
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018349// _tmp_49: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018350static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018351_tmp_49_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018352{
18353 D(p->level++);
18354 if (p->error_indicator) {
18355 D(p->level--);
18356 return NULL;
18357 }
18358 void * _res = NULL;
18359 int _mark = p->mark;
18360 { // 'as' NAME
18361 if (p->error_indicator) {
18362 D(p->level--);
18363 return NULL;
18364 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018365 D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018366 Token * _keyword;
18367 expr_ty z;
18368 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018369 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018370 &&
18371 (z = _PyPegen_name_token(p)) // NAME
18372 )
18373 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018374 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 +010018375 _res = z;
18376 if (_res == NULL && PyErr_Occurred()) {
18377 p->error_indicator = 1;
18378 D(p->level--);
18379 return NULL;
18380 }
18381 goto done;
18382 }
18383 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018384 D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018385 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
18386 }
18387 _res = NULL;
18388 done:
18389 D(p->level--);
18390 return _res;
18391}
18392
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018393// _tmp_50: 'from' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018394static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018395_tmp_50_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018396{
18397 D(p->level++);
18398 if (p->error_indicator) {
18399 D(p->level--);
18400 return NULL;
18401 }
18402 void * _res = NULL;
18403 int _mark = p->mark;
18404 { // 'from' expression
18405 if (p->error_indicator) {
18406 D(p->level--);
18407 return NULL;
18408 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018409 D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018410 Token * _keyword;
18411 expr_ty z;
18412 if (
18413 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
18414 &&
18415 (z = expression_rule(p)) // expression
18416 )
18417 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018418 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 +010018419 _res = z;
18420 if (_res == NULL && PyErr_Occurred()) {
18421 p->error_indicator = 1;
18422 D(p->level--);
18423 return NULL;
18424 }
18425 goto done;
18426 }
18427 p->mark = _mark;
18428 D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018429 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018430 }
18431 _res = NULL;
18432 done:
18433 D(p->level--);
18434 return _res;
18435}
18436
18437// _tmp_51: '->' expression
18438static void *
18439_tmp_51_rule(Parser *p)
18440{
18441 D(p->level++);
18442 if (p->error_indicator) {
18443 D(p->level--);
18444 return NULL;
18445 }
18446 void * _res = NULL;
18447 int _mark = p->mark;
18448 { // '->' expression
18449 if (p->error_indicator) {
18450 D(p->level--);
18451 return NULL;
18452 }
18453 D(fprintf(stderr, "%*c> _tmp_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18454 Token * _literal;
18455 expr_ty z;
18456 if (
18457 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18458 &&
18459 (z = expression_rule(p)) // expression
18460 )
18461 {
18462 D(fprintf(stderr, "%*c+ _tmp_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18463 _res = z;
18464 if (_res == NULL && PyErr_Occurred()) {
18465 p->error_indicator = 1;
18466 D(p->level--);
18467 return NULL;
18468 }
18469 goto done;
18470 }
18471 p->mark = _mark;
18472 D(fprintf(stderr, "%*c%s _tmp_51[%d-%d]: %s failed!\n", p->level, ' ',
18473 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18474 }
18475 _res = NULL;
18476 done:
18477 D(p->level--);
18478 return _res;
18479}
18480
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018481// _tmp_52: '->' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018482static void *
18483_tmp_52_rule(Parser *p)
18484{
18485 D(p->level++);
18486 if (p->error_indicator) {
18487 D(p->level--);
18488 return NULL;
18489 }
18490 void * _res = NULL;
18491 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018492 { // '->' expression
18493 if (p->error_indicator) {
18494 D(p->level--);
18495 return NULL;
18496 }
18497 D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18498 Token * _literal;
18499 expr_ty z;
18500 if (
18501 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18502 &&
18503 (z = expression_rule(p)) // expression
18504 )
18505 {
18506 D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18507 _res = z;
18508 if (_res == NULL && PyErr_Occurred()) {
18509 p->error_indicator = 1;
18510 D(p->level--);
18511 return NULL;
18512 }
18513 goto done;
18514 }
18515 p->mark = _mark;
18516 D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ',
18517 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18518 }
18519 _res = NULL;
18520 done:
18521 D(p->level--);
18522 return _res;
18523}
18524
18525// _tmp_53: NEWLINE INDENT
18526static void *
18527_tmp_53_rule(Parser *p)
18528{
18529 D(p->level++);
18530 if (p->error_indicator) {
18531 D(p->level--);
18532 return NULL;
18533 }
18534 void * _res = NULL;
18535 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018536 { // NEWLINE INDENT
18537 if (p->error_indicator) {
18538 D(p->level--);
18539 return NULL;
18540 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018541 D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018542 Token * indent_var;
18543 Token * newline_var;
18544 if (
18545 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
18546 &&
18547 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
18548 )
18549 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018550 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 +010018551 _res = _PyPegen_dummy_name(p, newline_var, indent_var);
18552 goto done;
18553 }
18554 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018555 D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018556 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
18557 }
18558 _res = NULL;
18559 done:
18560 D(p->level--);
18561 return _res;
18562}
18563
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018564// _loop0_54: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018565static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018566_loop0_54_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018567{
18568 D(p->level++);
18569 if (p->error_indicator) {
18570 D(p->level--);
18571 return NULL;
18572 }
18573 void *_res = NULL;
18574 int _mark = p->mark;
18575 int _start_mark = p->mark;
18576 void **_children = PyMem_Malloc(sizeof(void *));
18577 if (!_children) {
18578 p->error_indicator = 1;
18579 PyErr_NoMemory();
18580 D(p->level--);
18581 return NULL;
18582 }
18583 ssize_t _children_capacity = 1;
18584 ssize_t _n = 0;
18585 { // param_no_default
18586 if (p->error_indicator) {
18587 D(p->level--);
18588 return NULL;
18589 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018590 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 +010018591 arg_ty param_no_default_var;
18592 while (
18593 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18594 )
18595 {
18596 _res = param_no_default_var;
18597 if (_n == _children_capacity) {
18598 _children_capacity *= 2;
18599 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18600 if (!_new_children) {
18601 p->error_indicator = 1;
18602 PyErr_NoMemory();
18603 D(p->level--);
18604 return NULL;
18605 }
18606 _children = _new_children;
18607 }
18608 _children[_n++] = _res;
18609 _mark = p->mark;
18610 }
18611 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018612 D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018613 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018614 }
18615 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18616 if (!_seq) {
18617 PyMem_Free(_children);
18618 p->error_indicator = 1;
18619 PyErr_NoMemory();
18620 D(p->level--);
18621 return NULL;
18622 }
18623 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18624 PyMem_Free(_children);
18625 _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq);
18626 D(p->level--);
18627 return _seq;
18628}
18629
18630// _loop0_55: param_with_default
18631static asdl_seq *
18632_loop0_55_rule(Parser *p)
18633{
18634 D(p->level++);
18635 if (p->error_indicator) {
18636 D(p->level--);
18637 return NULL;
18638 }
18639 void *_res = NULL;
18640 int _mark = p->mark;
18641 int _start_mark = p->mark;
18642 void **_children = PyMem_Malloc(sizeof(void *));
18643 if (!_children) {
18644 p->error_indicator = 1;
18645 PyErr_NoMemory();
18646 D(p->level--);
18647 return NULL;
18648 }
18649 ssize_t _children_capacity = 1;
18650 ssize_t _n = 0;
18651 { // param_with_default
18652 if (p->error_indicator) {
18653 D(p->level--);
18654 return NULL;
18655 }
18656 D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18657 NameDefaultPair* param_with_default_var;
18658 while (
18659 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18660 )
18661 {
18662 _res = param_with_default_var;
18663 if (_n == _children_capacity) {
18664 _children_capacity *= 2;
18665 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18666 if (!_new_children) {
18667 p->error_indicator = 1;
18668 PyErr_NoMemory();
18669 D(p->level--);
18670 return NULL;
18671 }
18672 _children = _new_children;
18673 }
18674 _children[_n++] = _res;
18675 _mark = p->mark;
18676 }
18677 p->mark = _mark;
18678 D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ',
18679 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18680 }
18681 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18682 if (!_seq) {
18683 PyMem_Free(_children);
18684 p->error_indicator = 1;
18685 PyErr_NoMemory();
18686 D(p->level--);
18687 return NULL;
18688 }
18689 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18690 PyMem_Free(_children);
18691 _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq);
18692 D(p->level--);
18693 return _seq;
18694}
18695
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018696// _loop0_56: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018697static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018698_loop0_56_rule(Parser *p)
18699{
18700 D(p->level++);
18701 if (p->error_indicator) {
18702 D(p->level--);
18703 return NULL;
18704 }
18705 void *_res = NULL;
18706 int _mark = p->mark;
18707 int _start_mark = p->mark;
18708 void **_children = PyMem_Malloc(sizeof(void *));
18709 if (!_children) {
18710 p->error_indicator = 1;
18711 PyErr_NoMemory();
18712 D(p->level--);
18713 return NULL;
18714 }
18715 ssize_t _children_capacity = 1;
18716 ssize_t _n = 0;
18717 { // param_with_default
18718 if (p->error_indicator) {
18719 D(p->level--);
18720 return NULL;
18721 }
18722 D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18723 NameDefaultPair* param_with_default_var;
18724 while (
18725 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18726 )
18727 {
18728 _res = param_with_default_var;
18729 if (_n == _children_capacity) {
18730 _children_capacity *= 2;
18731 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18732 if (!_new_children) {
18733 p->error_indicator = 1;
18734 PyErr_NoMemory();
18735 D(p->level--);
18736 return NULL;
18737 }
18738 _children = _new_children;
18739 }
18740 _children[_n++] = _res;
18741 _mark = p->mark;
18742 }
18743 p->mark = _mark;
18744 D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ',
18745 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18746 }
18747 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18748 if (!_seq) {
18749 PyMem_Free(_children);
18750 p->error_indicator = 1;
18751 PyErr_NoMemory();
18752 D(p->level--);
18753 return NULL;
18754 }
18755 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18756 PyMem_Free(_children);
18757 _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq);
18758 D(p->level--);
18759 return _seq;
18760}
18761
18762// _loop1_57: param_no_default
18763static asdl_seq *
18764_loop1_57_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018765{
18766 D(p->level++);
18767 if (p->error_indicator) {
18768 D(p->level--);
18769 return NULL;
18770 }
18771 void *_res = NULL;
18772 int _mark = p->mark;
18773 int _start_mark = p->mark;
18774 void **_children = PyMem_Malloc(sizeof(void *));
18775 if (!_children) {
18776 p->error_indicator = 1;
18777 PyErr_NoMemory();
18778 D(p->level--);
18779 return NULL;
18780 }
18781 ssize_t _children_capacity = 1;
18782 ssize_t _n = 0;
18783 { // param_no_default
18784 if (p->error_indicator) {
18785 D(p->level--);
18786 return NULL;
18787 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018788 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 +010018789 arg_ty param_no_default_var;
18790 while (
18791 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18792 )
18793 {
18794 _res = param_no_default_var;
18795 if (_n == _children_capacity) {
18796 _children_capacity *= 2;
18797 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18798 if (!_new_children) {
18799 p->error_indicator = 1;
18800 PyErr_NoMemory();
18801 D(p->level--);
18802 return NULL;
18803 }
18804 _children = _new_children;
18805 }
18806 _children[_n++] = _res;
18807 _mark = p->mark;
18808 }
18809 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018810 D(fprintf(stderr, "%*c%s _loop1_57[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018811 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
18812 }
18813 if (_n == 0 || p->error_indicator) {
18814 PyMem_Free(_children);
18815 D(p->level--);
18816 return NULL;
18817 }
18818 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18819 if (!_seq) {
18820 PyMem_Free(_children);
18821 p->error_indicator = 1;
18822 PyErr_NoMemory();
18823 D(p->level--);
18824 return NULL;
18825 }
18826 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18827 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018828 _PyPegen_insert_memo(p, _start_mark, _loop1_57_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018829 D(p->level--);
18830 return _seq;
18831}
18832
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018833// _loop0_58: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018834static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018835_loop0_58_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018836{
18837 D(p->level++);
18838 if (p->error_indicator) {
18839 D(p->level--);
18840 return NULL;
18841 }
18842 void *_res = NULL;
18843 int _mark = p->mark;
18844 int _start_mark = p->mark;
18845 void **_children = PyMem_Malloc(sizeof(void *));
18846 if (!_children) {
18847 p->error_indicator = 1;
18848 PyErr_NoMemory();
18849 D(p->level--);
18850 return NULL;
18851 }
18852 ssize_t _children_capacity = 1;
18853 ssize_t _n = 0;
18854 { // param_with_default
18855 if (p->error_indicator) {
18856 D(p->level--);
18857 return NULL;
18858 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018859 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 +010018860 NameDefaultPair* param_with_default_var;
18861 while (
18862 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18863 )
18864 {
18865 _res = param_with_default_var;
18866 if (_n == _children_capacity) {
18867 _children_capacity *= 2;
18868 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18869 if (!_new_children) {
18870 p->error_indicator = 1;
18871 PyErr_NoMemory();
18872 D(p->level--);
18873 return NULL;
18874 }
18875 _children = _new_children;
18876 }
18877 _children[_n++] = _res;
18878 _mark = p->mark;
18879 }
18880 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018881 D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018882 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18883 }
18884 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18885 if (!_seq) {
18886 PyMem_Free(_children);
18887 p->error_indicator = 1;
18888 PyErr_NoMemory();
18889 D(p->level--);
18890 return NULL;
18891 }
18892 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18893 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018894 _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018895 D(p->level--);
18896 return _seq;
18897}
18898
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018899// _loop1_59: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018900static asdl_seq *
18901_loop1_59_rule(Parser *p)
18902{
18903 D(p->level++);
18904 if (p->error_indicator) {
18905 D(p->level--);
18906 return NULL;
18907 }
18908 void *_res = NULL;
18909 int _mark = p->mark;
18910 int _start_mark = p->mark;
18911 void **_children = PyMem_Malloc(sizeof(void *));
18912 if (!_children) {
18913 p->error_indicator = 1;
18914 PyErr_NoMemory();
18915 D(p->level--);
18916 return NULL;
18917 }
18918 ssize_t _children_capacity = 1;
18919 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018920 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018921 if (p->error_indicator) {
18922 D(p->level--);
18923 return NULL;
18924 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018925 D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18926 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018927 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018928 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018929 )
18930 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018931 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018932 if (_n == _children_capacity) {
18933 _children_capacity *= 2;
18934 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18935 if (!_new_children) {
18936 p->error_indicator = 1;
18937 PyErr_NoMemory();
18938 D(p->level--);
18939 return NULL;
18940 }
18941 _children = _new_children;
18942 }
18943 _children[_n++] = _res;
18944 _mark = p->mark;
18945 }
18946 p->mark = _mark;
18947 D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018948 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018949 }
18950 if (_n == 0 || p->error_indicator) {
18951 PyMem_Free(_children);
18952 D(p->level--);
18953 return NULL;
18954 }
18955 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18956 if (!_seq) {
18957 PyMem_Free(_children);
18958 p->error_indicator = 1;
18959 PyErr_NoMemory();
18960 D(p->level--);
18961 return NULL;
18962 }
18963 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18964 PyMem_Free(_children);
18965 _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq);
18966 D(p->level--);
18967 return _seq;
18968}
18969
18970// _loop1_60: param_no_default
18971static asdl_seq *
18972_loop1_60_rule(Parser *p)
18973{
18974 D(p->level++);
18975 if (p->error_indicator) {
18976 D(p->level--);
18977 return NULL;
18978 }
18979 void *_res = NULL;
18980 int _mark = p->mark;
18981 int _start_mark = p->mark;
18982 void **_children = PyMem_Malloc(sizeof(void *));
18983 if (!_children) {
18984 p->error_indicator = 1;
18985 PyErr_NoMemory();
18986 D(p->level--);
18987 return NULL;
18988 }
18989 ssize_t _children_capacity = 1;
18990 ssize_t _n = 0;
18991 { // param_no_default
18992 if (p->error_indicator) {
18993 D(p->level--);
18994 return NULL;
18995 }
18996 D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
18997 arg_ty param_no_default_var;
18998 while (
18999 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19000 )
19001 {
19002 _res = param_no_default_var;
19003 if (_n == _children_capacity) {
19004 _children_capacity *= 2;
19005 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19006 if (!_new_children) {
19007 p->error_indicator = 1;
19008 PyErr_NoMemory();
19009 D(p->level--);
19010 return NULL;
19011 }
19012 _children = _new_children;
19013 }
19014 _children[_n++] = _res;
19015 _mark = p->mark;
19016 }
19017 p->mark = _mark;
19018 D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ',
19019 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19020 }
19021 if (_n == 0 || p->error_indicator) {
19022 PyMem_Free(_children);
19023 D(p->level--);
19024 return NULL;
19025 }
19026 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19027 if (!_seq) {
19028 PyMem_Free(_children);
19029 p->error_indicator = 1;
19030 PyErr_NoMemory();
19031 D(p->level--);
19032 return NULL;
19033 }
19034 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19035 PyMem_Free(_children);
19036 _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq);
19037 D(p->level--);
19038 return _seq;
19039}
19040
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019041// _loop1_61: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019042static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019043_loop1_61_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019044{
19045 D(p->level++);
19046 if (p->error_indicator) {
19047 D(p->level--);
19048 return NULL;
19049 }
19050 void *_res = NULL;
19051 int _mark = p->mark;
19052 int _start_mark = p->mark;
19053 void **_children = PyMem_Malloc(sizeof(void *));
19054 if (!_children) {
19055 p->error_indicator = 1;
19056 PyErr_NoMemory();
19057 D(p->level--);
19058 return NULL;
19059 }
19060 ssize_t _children_capacity = 1;
19061 ssize_t _n = 0;
19062 { // param_no_default
19063 if (p->error_indicator) {
19064 D(p->level--);
19065 return NULL;
19066 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019067 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 +010019068 arg_ty param_no_default_var;
19069 while (
19070 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19071 )
19072 {
19073 _res = param_no_default_var;
19074 if (_n == _children_capacity) {
19075 _children_capacity *= 2;
19076 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19077 if (!_new_children) {
19078 p->error_indicator = 1;
19079 PyErr_NoMemory();
19080 D(p->level--);
19081 return NULL;
19082 }
19083 _children = _new_children;
19084 }
19085 _children[_n++] = _res;
19086 _mark = p->mark;
19087 }
19088 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019089 D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019090 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19091 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019092 if (_n == 0 || p->error_indicator) {
19093 PyMem_Free(_children);
19094 D(p->level--);
19095 return NULL;
19096 }
19097 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19098 if (!_seq) {
19099 PyMem_Free(_children);
19100 p->error_indicator = 1;
19101 PyErr_NoMemory();
19102 D(p->level--);
19103 return NULL;
19104 }
19105 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19106 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019107 _PyPegen_insert_memo(p, _start_mark, _loop1_61_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019108 D(p->level--);
19109 return _seq;
19110}
19111
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019112// _loop0_62: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019113static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019114_loop0_62_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019115{
19116 D(p->level++);
19117 if (p->error_indicator) {
19118 D(p->level--);
19119 return NULL;
19120 }
19121 void *_res = NULL;
19122 int _mark = p->mark;
19123 int _start_mark = p->mark;
19124 void **_children = PyMem_Malloc(sizeof(void *));
19125 if (!_children) {
19126 p->error_indicator = 1;
19127 PyErr_NoMemory();
19128 D(p->level--);
19129 return NULL;
19130 }
19131 ssize_t _children_capacity = 1;
19132 ssize_t _n = 0;
19133 { // param_no_default
19134 if (p->error_indicator) {
19135 D(p->level--);
19136 return NULL;
19137 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019138 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 +010019139 arg_ty param_no_default_var;
19140 while (
19141 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19142 )
19143 {
19144 _res = param_no_default_var;
19145 if (_n == _children_capacity) {
19146 _children_capacity *= 2;
19147 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19148 if (!_new_children) {
19149 p->error_indicator = 1;
19150 PyErr_NoMemory();
19151 D(p->level--);
19152 return NULL;
19153 }
19154 _children = _new_children;
19155 }
19156 _children[_n++] = _res;
19157 _mark = p->mark;
19158 }
19159 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019160 D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019161 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19162 }
19163 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19164 if (!_seq) {
19165 PyMem_Free(_children);
19166 p->error_indicator = 1;
19167 PyErr_NoMemory();
19168 D(p->level--);
19169 return NULL;
19170 }
19171 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19172 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019173 _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019174 D(p->level--);
19175 return _seq;
19176}
19177
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019178// _loop1_63: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019179static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019180_loop1_63_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019181{
19182 D(p->level++);
19183 if (p->error_indicator) {
19184 D(p->level--);
19185 return NULL;
19186 }
19187 void *_res = NULL;
19188 int _mark = p->mark;
19189 int _start_mark = p->mark;
19190 void **_children = PyMem_Malloc(sizeof(void *));
19191 if (!_children) {
19192 p->error_indicator = 1;
19193 PyErr_NoMemory();
19194 D(p->level--);
19195 return NULL;
19196 }
19197 ssize_t _children_capacity = 1;
19198 ssize_t _n = 0;
19199 { // param_with_default
19200 if (p->error_indicator) {
19201 D(p->level--);
19202 return NULL;
19203 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019204 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 +010019205 NameDefaultPair* param_with_default_var;
19206 while (
19207 (param_with_default_var = param_with_default_rule(p)) // param_with_default
19208 )
19209 {
19210 _res = param_with_default_var;
19211 if (_n == _children_capacity) {
19212 _children_capacity *= 2;
19213 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19214 if (!_new_children) {
19215 p->error_indicator = 1;
19216 PyErr_NoMemory();
19217 D(p->level--);
19218 return NULL;
19219 }
19220 _children = _new_children;
19221 }
19222 _children[_n++] = _res;
19223 _mark = p->mark;
19224 }
19225 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019226 D(fprintf(stderr, "%*c%s _loop1_63[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019227 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
19228 }
19229 if (_n == 0 || p->error_indicator) {
19230 PyMem_Free(_children);
19231 D(p->level--);
19232 return NULL;
19233 }
19234 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19235 if (!_seq) {
19236 PyMem_Free(_children);
19237 p->error_indicator = 1;
19238 PyErr_NoMemory();
19239 D(p->level--);
19240 return NULL;
19241 }
19242 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19243 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019244 _PyPegen_insert_memo(p, _start_mark, _loop1_63_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019245 D(p->level--);
19246 return _seq;
19247}
19248
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019249// _loop0_64: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019250static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019251_loop0_64_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019252{
19253 D(p->level++);
19254 if (p->error_indicator) {
19255 D(p->level--);
19256 return NULL;
19257 }
19258 void *_res = NULL;
19259 int _mark = p->mark;
19260 int _start_mark = p->mark;
19261 void **_children = PyMem_Malloc(sizeof(void *));
19262 if (!_children) {
19263 p->error_indicator = 1;
19264 PyErr_NoMemory();
19265 D(p->level--);
19266 return NULL;
19267 }
19268 ssize_t _children_capacity = 1;
19269 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019270 { // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019271 if (p->error_indicator) {
19272 D(p->level--);
19273 return NULL;
19274 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019275 D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19276 arg_ty param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019277 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019278 (param_no_default_var = param_no_default_rule(p)) // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019279 )
19280 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019281 _res = param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019282 if (_n == _children_capacity) {
19283 _children_capacity *= 2;
19284 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19285 if (!_new_children) {
19286 p->error_indicator = 1;
19287 PyErr_NoMemory();
19288 D(p->level--);
19289 return NULL;
19290 }
19291 _children = _new_children;
19292 }
19293 _children[_n++] = _res;
19294 _mark = p->mark;
19295 }
19296 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019297 D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ',
19298 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019299 }
19300 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19301 if (!_seq) {
19302 PyMem_Free(_children);
19303 p->error_indicator = 1;
19304 PyErr_NoMemory();
19305 D(p->level--);
19306 return NULL;
19307 }
19308 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19309 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019310 _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019311 D(p->level--);
19312 return _seq;
19313}
19314
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019315// _loop1_65: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019316static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019317_loop1_65_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019318{
19319 D(p->level++);
19320 if (p->error_indicator) {
19321 D(p->level--);
19322 return NULL;
19323 }
19324 void *_res = NULL;
19325 int _mark = p->mark;
19326 int _start_mark = p->mark;
19327 void **_children = PyMem_Malloc(sizeof(void *));
19328 if (!_children) {
19329 p->error_indicator = 1;
19330 PyErr_NoMemory();
19331 D(p->level--);
19332 return NULL;
19333 }
19334 ssize_t _children_capacity = 1;
19335 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019336 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019337 if (p->error_indicator) {
19338 D(p->level--);
19339 return NULL;
19340 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019341 D(fprintf(stderr, "%*c> _loop1_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
19342 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019343 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019344 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019345 )
19346 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019347 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019348 if (_n == _children_capacity) {
19349 _children_capacity *= 2;
19350 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19351 if (!_new_children) {
19352 p->error_indicator = 1;
19353 PyErr_NoMemory();
19354 D(p->level--);
19355 return NULL;
19356 }
19357 _children = _new_children;
19358 }
19359 _children[_n++] = _res;
19360 _mark = p->mark;
19361 }
19362 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019363 D(fprintf(stderr, "%*c%s _loop1_65[%d-%d]: %s failed!\n", p->level, ' ',
19364 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019365 }
19366 if (_n == 0 || p->error_indicator) {
19367 PyMem_Free(_children);
19368 D(p->level--);
19369 return NULL;
19370 }
19371 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19372 if (!_seq) {
19373 PyMem_Free(_children);
19374 p->error_indicator = 1;
19375 PyErr_NoMemory();
19376 D(p->level--);
19377 return NULL;
19378 }
19379 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19380 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019381 _PyPegen_insert_memo(p, _start_mark, _loop1_65_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019382 D(p->level--);
19383 return _seq;
19384}
19385
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019386// _loop0_66: param_maybe_default
19387static asdl_seq *
19388_loop0_66_rule(Parser *p)
19389{
19390 D(p->level++);
19391 if (p->error_indicator) {
19392 D(p->level--);
19393 return NULL;
19394 }
19395 void *_res = NULL;
19396 int _mark = p->mark;
19397 int _start_mark = p->mark;
19398 void **_children = PyMem_Malloc(sizeof(void *));
19399 if (!_children) {
19400 p->error_indicator = 1;
19401 PyErr_NoMemory();
19402 D(p->level--);
19403 return NULL;
19404 }
19405 ssize_t _children_capacity = 1;
19406 ssize_t _n = 0;
19407 { // param_maybe_default
19408 if (p->error_indicator) {
19409 D(p->level--);
19410 return NULL;
19411 }
19412 D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19413 NameDefaultPair* param_maybe_default_var;
19414 while (
19415 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19416 )
19417 {
19418 _res = param_maybe_default_var;
19419 if (_n == _children_capacity) {
19420 _children_capacity *= 2;
19421 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19422 if (!_new_children) {
19423 p->error_indicator = 1;
19424 PyErr_NoMemory();
19425 D(p->level--);
19426 return NULL;
19427 }
19428 _children = _new_children;
19429 }
19430 _children[_n++] = _res;
19431 _mark = p->mark;
19432 }
19433 p->mark = _mark;
19434 D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ',
19435 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19436 }
19437 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19438 if (!_seq) {
19439 PyMem_Free(_children);
19440 p->error_indicator = 1;
19441 PyErr_NoMemory();
19442 D(p->level--);
19443 return NULL;
19444 }
19445 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19446 PyMem_Free(_children);
19447 _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq);
19448 D(p->level--);
19449 return _seq;
19450}
19451
19452// _loop1_67: param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019453static asdl_seq *
19454_loop1_67_rule(Parser *p)
19455{
19456 D(p->level++);
19457 if (p->error_indicator) {
19458 D(p->level--);
19459 return NULL;
19460 }
19461 void *_res = NULL;
19462 int _mark = p->mark;
19463 int _start_mark = p->mark;
19464 void **_children = PyMem_Malloc(sizeof(void *));
19465 if (!_children) {
19466 p->error_indicator = 1;
19467 PyErr_NoMemory();
19468 D(p->level--);
19469 return NULL;
19470 }
19471 ssize_t _children_capacity = 1;
19472 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019473 { // param_maybe_default
19474 if (p->error_indicator) {
19475 D(p->level--);
19476 return NULL;
19477 }
19478 D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19479 NameDefaultPair* param_maybe_default_var;
19480 while (
19481 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19482 )
19483 {
19484 _res = param_maybe_default_var;
19485 if (_n == _children_capacity) {
19486 _children_capacity *= 2;
19487 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19488 if (!_new_children) {
19489 p->error_indicator = 1;
19490 PyErr_NoMemory();
19491 D(p->level--);
19492 return NULL;
19493 }
19494 _children = _new_children;
19495 }
19496 _children[_n++] = _res;
19497 _mark = p->mark;
19498 }
19499 p->mark = _mark;
19500 D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ',
19501 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19502 }
19503 if (_n == 0 || p->error_indicator) {
19504 PyMem_Free(_children);
19505 D(p->level--);
19506 return NULL;
19507 }
19508 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19509 if (!_seq) {
19510 PyMem_Free(_children);
19511 p->error_indicator = 1;
19512 PyErr_NoMemory();
19513 D(p->level--);
19514 return NULL;
19515 }
19516 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19517 PyMem_Free(_children);
19518 _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq);
19519 D(p->level--);
19520 return _seq;
19521}
19522
19523// _loop1_68: ('@' named_expression NEWLINE)
19524static asdl_seq *
19525_loop1_68_rule(Parser *p)
19526{
19527 D(p->level++);
19528 if (p->error_indicator) {
19529 D(p->level--);
19530 return NULL;
19531 }
19532 void *_res = NULL;
19533 int _mark = p->mark;
19534 int _start_mark = p->mark;
19535 void **_children = PyMem_Malloc(sizeof(void *));
19536 if (!_children) {
19537 p->error_indicator = 1;
19538 PyErr_NoMemory();
19539 D(p->level--);
19540 return NULL;
19541 }
19542 ssize_t _children_capacity = 1;
19543 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019544 { // ('@' named_expression NEWLINE)
19545 if (p->error_indicator) {
19546 D(p->level--);
19547 return NULL;
19548 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019549 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 +010019550 void *_tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019551 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019552 (_tmp_142_var = _tmp_142_rule(p)) // '@' named_expression NEWLINE
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019553 )
19554 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019555 _res = _tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019556 if (_n == _children_capacity) {
19557 _children_capacity *= 2;
19558 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19559 if (!_new_children) {
19560 p->error_indicator = 1;
19561 PyErr_NoMemory();
19562 D(p->level--);
19563 return NULL;
19564 }
19565 _children = _new_children;
19566 }
19567 _children[_n++] = _res;
19568 _mark = p->mark;
19569 }
19570 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019571 D(fprintf(stderr, "%*c%s _loop1_68[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019572 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
19573 }
19574 if (_n == 0 || p->error_indicator) {
19575 PyMem_Free(_children);
19576 D(p->level--);
19577 return NULL;
19578 }
19579 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19580 if (!_seq) {
19581 PyMem_Free(_children);
19582 p->error_indicator = 1;
19583 PyErr_NoMemory();
19584 D(p->level--);
19585 return NULL;
19586 }
19587 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19588 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019589 _PyPegen_insert_memo(p, _start_mark, _loop1_68_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019590 D(p->level--);
19591 return _seq;
19592}
19593
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019594// _tmp_69: '(' arguments? ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019595static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019596_tmp_69_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019597{
19598 D(p->level++);
19599 if (p->error_indicator) {
19600 D(p->level--);
19601 return NULL;
19602 }
19603 void * _res = NULL;
19604 int _mark = p->mark;
19605 { // '(' arguments? ')'
19606 if (p->error_indicator) {
19607 D(p->level--);
19608 return NULL;
19609 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019610 D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019611 Token * _literal;
19612 Token * _literal_1;
19613 void *z;
19614 if (
19615 (_literal = _PyPegen_expect_token(p, 7)) // token='('
19616 &&
19617 (z = arguments_rule(p), 1) // arguments?
19618 &&
19619 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
19620 )
19621 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019622 D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019623 _res = z;
19624 if (_res == NULL && PyErr_Occurred()) {
19625 p->error_indicator = 1;
19626 D(p->level--);
19627 return NULL;
19628 }
19629 goto done;
19630 }
19631 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019632 D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019633 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
19634 }
19635 _res = NULL;
19636 done:
19637 D(p->level--);
19638 return _res;
19639}
19640
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019641// _loop0_71: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019642static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019643_loop0_71_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019644{
19645 D(p->level++);
19646 if (p->error_indicator) {
19647 D(p->level--);
19648 return NULL;
19649 }
19650 void *_res = NULL;
19651 int _mark = p->mark;
19652 int _start_mark = p->mark;
19653 void **_children = PyMem_Malloc(sizeof(void *));
19654 if (!_children) {
19655 p->error_indicator = 1;
19656 PyErr_NoMemory();
19657 D(p->level--);
19658 return NULL;
19659 }
19660 ssize_t _children_capacity = 1;
19661 ssize_t _n = 0;
19662 { // ',' star_expression
19663 if (p->error_indicator) {
19664 D(p->level--);
19665 return NULL;
19666 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019667 D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019668 Token * _literal;
19669 expr_ty elem;
19670 while (
19671 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19672 &&
19673 (elem = star_expression_rule(p)) // star_expression
19674 )
19675 {
19676 _res = elem;
19677 if (_res == NULL && PyErr_Occurred()) {
19678 p->error_indicator = 1;
19679 PyMem_Free(_children);
19680 D(p->level--);
19681 return NULL;
19682 }
19683 if (_n == _children_capacity) {
19684 _children_capacity *= 2;
19685 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19686 if (!_new_children) {
19687 p->error_indicator = 1;
19688 PyErr_NoMemory();
19689 D(p->level--);
19690 return NULL;
19691 }
19692 _children = _new_children;
19693 }
19694 _children[_n++] = _res;
19695 _mark = p->mark;
19696 }
19697 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019698 D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019699 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
19700 }
19701 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19702 if (!_seq) {
19703 PyMem_Free(_children);
19704 p->error_indicator = 1;
19705 PyErr_NoMemory();
19706 D(p->level--);
19707 return NULL;
19708 }
19709 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19710 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019711 _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019712 D(p->level--);
19713 return _seq;
19714}
19715
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019716// _gather_70: star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019717static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019718_gather_70_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019719{
19720 D(p->level++);
19721 if (p->error_indicator) {
19722 D(p->level--);
19723 return NULL;
19724 }
19725 asdl_seq * _res = NULL;
19726 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019727 { // star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019728 if (p->error_indicator) {
19729 D(p->level--);
19730 return NULL;
19731 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019732 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 +010019733 expr_ty elem;
19734 asdl_seq * seq;
19735 if (
19736 (elem = star_expression_rule(p)) // star_expression
19737 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019738 (seq = _loop0_71_rule(p)) // _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019739 )
19740 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019741 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 +010019742 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19743 goto done;
19744 }
19745 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019746 D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ',
19747 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_71"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019748 }
19749 _res = NULL;
19750 done:
19751 D(p->level--);
19752 return _res;
19753}
19754
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019755// _loop1_72: (',' star_expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019756static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019757_loop1_72_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019758{
19759 D(p->level++);
19760 if (p->error_indicator) {
19761 D(p->level--);
19762 return NULL;
19763 }
19764 void *_res = NULL;
19765 int _mark = p->mark;
19766 int _start_mark = p->mark;
19767 void **_children = PyMem_Malloc(sizeof(void *));
19768 if (!_children) {
19769 p->error_indicator = 1;
19770 PyErr_NoMemory();
19771 D(p->level--);
19772 return NULL;
19773 }
19774 ssize_t _children_capacity = 1;
19775 ssize_t _n = 0;
19776 { // (',' star_expression)
19777 if (p->error_indicator) {
19778 D(p->level--);
19779 return NULL;
19780 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019781 D(fprintf(stderr, "%*c> _loop1_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019782 void *_tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019783 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019784 (_tmp_143_var = _tmp_143_rule(p)) // ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019785 )
19786 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019787 _res = _tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019788 if (_n == _children_capacity) {
19789 _children_capacity *= 2;
19790 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19791 if (!_new_children) {
19792 p->error_indicator = 1;
19793 PyErr_NoMemory();
19794 D(p->level--);
19795 return NULL;
19796 }
19797 _children = _new_children;
19798 }
19799 _children[_n++] = _res;
19800 _mark = p->mark;
19801 }
19802 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019803 D(fprintf(stderr, "%*c%s _loop1_72[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019804 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
19805 }
19806 if (_n == 0 || p->error_indicator) {
19807 PyMem_Free(_children);
19808 D(p->level--);
19809 return NULL;
19810 }
19811 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19812 if (!_seq) {
19813 PyMem_Free(_children);
19814 p->error_indicator = 1;
19815 PyErr_NoMemory();
19816 D(p->level--);
19817 return NULL;
19818 }
19819 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19820 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019821 _PyPegen_insert_memo(p, _start_mark, _loop1_72_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019822 D(p->level--);
19823 return _seq;
19824}
19825
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019826// _loop0_74: ',' star_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019827static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019828_loop0_74_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019829{
19830 D(p->level++);
19831 if (p->error_indicator) {
19832 D(p->level--);
19833 return NULL;
19834 }
19835 void *_res = NULL;
19836 int _mark = p->mark;
19837 int _start_mark = p->mark;
19838 void **_children = PyMem_Malloc(sizeof(void *));
19839 if (!_children) {
19840 p->error_indicator = 1;
19841 PyErr_NoMemory();
19842 D(p->level--);
19843 return NULL;
19844 }
19845 ssize_t _children_capacity = 1;
19846 ssize_t _n = 0;
19847 { // ',' star_named_expression
19848 if (p->error_indicator) {
19849 D(p->level--);
19850 return NULL;
19851 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019852 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 +010019853 Token * _literal;
19854 expr_ty elem;
19855 while (
19856 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19857 &&
19858 (elem = star_named_expression_rule(p)) // star_named_expression
19859 )
19860 {
19861 _res = elem;
19862 if (_res == NULL && PyErr_Occurred()) {
19863 p->error_indicator = 1;
19864 PyMem_Free(_children);
19865 D(p->level--);
19866 return NULL;
19867 }
19868 if (_n == _children_capacity) {
19869 _children_capacity *= 2;
19870 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19871 if (!_new_children) {
19872 p->error_indicator = 1;
19873 PyErr_NoMemory();
19874 D(p->level--);
19875 return NULL;
19876 }
19877 _children = _new_children;
19878 }
19879 _children[_n++] = _res;
19880 _mark = p->mark;
19881 }
19882 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019883 D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019884 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
19885 }
19886 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19887 if (!_seq) {
19888 PyMem_Free(_children);
19889 p->error_indicator = 1;
19890 PyErr_NoMemory();
19891 D(p->level--);
19892 return NULL;
19893 }
19894 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19895 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019896 _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019897 D(p->level--);
19898 return _seq;
19899}
19900
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019901// _gather_73: star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019902static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019903_gather_73_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019904{
19905 D(p->level++);
19906 if (p->error_indicator) {
19907 D(p->level--);
19908 return NULL;
19909 }
19910 asdl_seq * _res = NULL;
19911 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019912 { // star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019913 if (p->error_indicator) {
19914 D(p->level--);
19915 return NULL;
19916 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019917 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 +010019918 expr_ty elem;
19919 asdl_seq * seq;
19920 if (
19921 (elem = star_named_expression_rule(p)) // star_named_expression
19922 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019923 (seq = _loop0_74_rule(p)) // _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019924 )
19925 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019926 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 +010019927 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19928 goto done;
19929 }
19930 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019931 D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ',
19932 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_74"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019933 }
19934 _res = NULL;
19935 done:
19936 D(p->level--);
19937 return _res;
19938}
19939
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019940// _loop1_75: (',' expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019941static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019942_loop1_75_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019943{
19944 D(p->level++);
19945 if (p->error_indicator) {
19946 D(p->level--);
19947 return NULL;
19948 }
19949 void *_res = NULL;
19950 int _mark = p->mark;
19951 int _start_mark = p->mark;
19952 void **_children = PyMem_Malloc(sizeof(void *));
19953 if (!_children) {
19954 p->error_indicator = 1;
19955 PyErr_NoMemory();
19956 D(p->level--);
19957 return NULL;
19958 }
19959 ssize_t _children_capacity = 1;
19960 ssize_t _n = 0;
19961 { // (',' expression)
19962 if (p->error_indicator) {
19963 D(p->level--);
19964 return NULL;
19965 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019966 D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019967 void *_tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019968 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019969 (_tmp_144_var = _tmp_144_rule(p)) // ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019970 )
19971 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019972 _res = _tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019973 if (_n == _children_capacity) {
19974 _children_capacity *= 2;
19975 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19976 if (!_new_children) {
19977 p->error_indicator = 1;
19978 PyErr_NoMemory();
19979 D(p->level--);
19980 return NULL;
19981 }
19982 _children = _new_children;
19983 }
19984 _children[_n++] = _res;
19985 _mark = p->mark;
19986 }
19987 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019988 D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019989 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
19990 }
19991 if (_n == 0 || p->error_indicator) {
19992 PyMem_Free(_children);
19993 D(p->level--);
19994 return NULL;
19995 }
19996 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19997 if (!_seq) {
19998 PyMem_Free(_children);
19999 p->error_indicator = 1;
20000 PyErr_NoMemory();
20001 D(p->level--);
20002 return NULL;
20003 }
20004 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20005 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020006 _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020007 D(p->level--);
20008 return _seq;
20009}
20010
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020011// _loop0_76: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020012static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020013_loop0_76_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020014{
20015 D(p->level++);
20016 if (p->error_indicator) {
20017 D(p->level--);
20018 return NULL;
20019 }
20020 void *_res = NULL;
20021 int _mark = p->mark;
20022 int _start_mark = p->mark;
20023 void **_children = PyMem_Malloc(sizeof(void *));
20024 if (!_children) {
20025 p->error_indicator = 1;
20026 PyErr_NoMemory();
20027 D(p->level--);
20028 return NULL;
20029 }
20030 ssize_t _children_capacity = 1;
20031 ssize_t _n = 0;
20032 { // lambda_param_no_default
20033 if (p->error_indicator) {
20034 D(p->level--);
20035 return NULL;
20036 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020037 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 +010020038 arg_ty lambda_param_no_default_var;
20039 while (
20040 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20041 )
20042 {
20043 _res = lambda_param_no_default_var;
20044 if (_n == _children_capacity) {
20045 _children_capacity *= 2;
20046 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20047 if (!_new_children) {
20048 p->error_indicator = 1;
20049 PyErr_NoMemory();
20050 D(p->level--);
20051 return NULL;
20052 }
20053 _children = _new_children;
20054 }
20055 _children[_n++] = _res;
20056 _mark = p->mark;
20057 }
20058 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020059 D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020060 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020061 }
20062 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20063 if (!_seq) {
20064 PyMem_Free(_children);
20065 p->error_indicator = 1;
20066 PyErr_NoMemory();
20067 D(p->level--);
20068 return NULL;
20069 }
20070 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20071 PyMem_Free(_children);
20072 _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq);
20073 D(p->level--);
20074 return _seq;
20075}
20076
20077// _loop0_77: lambda_param_with_default
20078static asdl_seq *
20079_loop0_77_rule(Parser *p)
20080{
20081 D(p->level++);
20082 if (p->error_indicator) {
20083 D(p->level--);
20084 return NULL;
20085 }
20086 void *_res = NULL;
20087 int _mark = p->mark;
20088 int _start_mark = p->mark;
20089 void **_children = PyMem_Malloc(sizeof(void *));
20090 if (!_children) {
20091 p->error_indicator = 1;
20092 PyErr_NoMemory();
20093 D(p->level--);
20094 return NULL;
20095 }
20096 ssize_t _children_capacity = 1;
20097 ssize_t _n = 0;
20098 { // lambda_param_with_default
20099 if (p->error_indicator) {
20100 D(p->level--);
20101 return NULL;
20102 }
20103 D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20104 NameDefaultPair* lambda_param_with_default_var;
20105 while (
20106 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20107 )
20108 {
20109 _res = lambda_param_with_default_var;
20110 if (_n == _children_capacity) {
20111 _children_capacity *= 2;
20112 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20113 if (!_new_children) {
20114 p->error_indicator = 1;
20115 PyErr_NoMemory();
20116 D(p->level--);
20117 return NULL;
20118 }
20119 _children = _new_children;
20120 }
20121 _children[_n++] = _res;
20122 _mark = p->mark;
20123 }
20124 p->mark = _mark;
20125 D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ',
20126 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20127 }
20128 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20129 if (!_seq) {
20130 PyMem_Free(_children);
20131 p->error_indicator = 1;
20132 PyErr_NoMemory();
20133 D(p->level--);
20134 return NULL;
20135 }
20136 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20137 PyMem_Free(_children);
20138 _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq);
20139 D(p->level--);
20140 return _seq;
20141}
20142
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020143// _loop0_78: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020144static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020145_loop0_78_rule(Parser *p)
20146{
20147 D(p->level++);
20148 if (p->error_indicator) {
20149 D(p->level--);
20150 return NULL;
20151 }
20152 void *_res = NULL;
20153 int _mark = p->mark;
20154 int _start_mark = p->mark;
20155 void **_children = PyMem_Malloc(sizeof(void *));
20156 if (!_children) {
20157 p->error_indicator = 1;
20158 PyErr_NoMemory();
20159 D(p->level--);
20160 return NULL;
20161 }
20162 ssize_t _children_capacity = 1;
20163 ssize_t _n = 0;
20164 { // lambda_param_with_default
20165 if (p->error_indicator) {
20166 D(p->level--);
20167 return NULL;
20168 }
20169 D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20170 NameDefaultPair* lambda_param_with_default_var;
20171 while (
20172 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20173 )
20174 {
20175 _res = lambda_param_with_default_var;
20176 if (_n == _children_capacity) {
20177 _children_capacity *= 2;
20178 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20179 if (!_new_children) {
20180 p->error_indicator = 1;
20181 PyErr_NoMemory();
20182 D(p->level--);
20183 return NULL;
20184 }
20185 _children = _new_children;
20186 }
20187 _children[_n++] = _res;
20188 _mark = p->mark;
20189 }
20190 p->mark = _mark;
20191 D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
20192 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20193 }
20194 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20195 if (!_seq) {
20196 PyMem_Free(_children);
20197 p->error_indicator = 1;
20198 PyErr_NoMemory();
20199 D(p->level--);
20200 return NULL;
20201 }
20202 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20203 PyMem_Free(_children);
20204 _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
20205 D(p->level--);
20206 return _seq;
20207}
20208
20209// _loop1_79: lambda_param_no_default
20210static asdl_seq *
20211_loop1_79_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020212{
20213 D(p->level++);
20214 if (p->error_indicator) {
20215 D(p->level--);
20216 return NULL;
20217 }
20218 void *_res = NULL;
20219 int _mark = p->mark;
20220 int _start_mark = p->mark;
20221 void **_children = PyMem_Malloc(sizeof(void *));
20222 if (!_children) {
20223 p->error_indicator = 1;
20224 PyErr_NoMemory();
20225 D(p->level--);
20226 return NULL;
20227 }
20228 ssize_t _children_capacity = 1;
20229 ssize_t _n = 0;
20230 { // lambda_param_no_default
20231 if (p->error_indicator) {
20232 D(p->level--);
20233 return NULL;
20234 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020235 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 +010020236 arg_ty lambda_param_no_default_var;
20237 while (
20238 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20239 )
20240 {
20241 _res = lambda_param_no_default_var;
20242 if (_n == _children_capacity) {
20243 _children_capacity *= 2;
20244 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20245 if (!_new_children) {
20246 p->error_indicator = 1;
20247 PyErr_NoMemory();
20248 D(p->level--);
20249 return NULL;
20250 }
20251 _children = _new_children;
20252 }
20253 _children[_n++] = _res;
20254 _mark = p->mark;
20255 }
20256 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020257 D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020258 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20259 }
20260 if (_n == 0 || p->error_indicator) {
20261 PyMem_Free(_children);
20262 D(p->level--);
20263 return NULL;
20264 }
20265 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20266 if (!_seq) {
20267 PyMem_Free(_children);
20268 p->error_indicator = 1;
20269 PyErr_NoMemory();
20270 D(p->level--);
20271 return NULL;
20272 }
20273 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20274 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020275 _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020276 D(p->level--);
20277 return _seq;
20278}
20279
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020280// _loop0_80: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020281static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020282_loop0_80_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020283{
20284 D(p->level++);
20285 if (p->error_indicator) {
20286 D(p->level--);
20287 return NULL;
20288 }
20289 void *_res = NULL;
20290 int _mark = p->mark;
20291 int _start_mark = p->mark;
20292 void **_children = PyMem_Malloc(sizeof(void *));
20293 if (!_children) {
20294 p->error_indicator = 1;
20295 PyErr_NoMemory();
20296 D(p->level--);
20297 return NULL;
20298 }
20299 ssize_t _children_capacity = 1;
20300 ssize_t _n = 0;
20301 { // lambda_param_with_default
20302 if (p->error_indicator) {
20303 D(p->level--);
20304 return NULL;
20305 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020306 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 +010020307 NameDefaultPair* lambda_param_with_default_var;
20308 while (
20309 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20310 )
20311 {
20312 _res = lambda_param_with_default_var;
20313 if (_n == _children_capacity) {
20314 _children_capacity *= 2;
20315 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20316 if (!_new_children) {
20317 p->error_indicator = 1;
20318 PyErr_NoMemory();
20319 D(p->level--);
20320 return NULL;
20321 }
20322 _children = _new_children;
20323 }
20324 _children[_n++] = _res;
20325 _mark = p->mark;
20326 }
20327 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020328 D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020329 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20330 }
20331 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20332 if (!_seq) {
20333 PyMem_Free(_children);
20334 p->error_indicator = 1;
20335 PyErr_NoMemory();
20336 D(p->level--);
20337 return NULL;
20338 }
20339 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20340 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020341 _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020342 D(p->level--);
20343 return _seq;
20344}
20345
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020346// _loop1_81: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020347static asdl_seq *
20348_loop1_81_rule(Parser *p)
20349{
20350 D(p->level++);
20351 if (p->error_indicator) {
20352 D(p->level--);
20353 return NULL;
20354 }
20355 void *_res = NULL;
20356 int _mark = p->mark;
20357 int _start_mark = p->mark;
20358 void **_children = PyMem_Malloc(sizeof(void *));
20359 if (!_children) {
20360 p->error_indicator = 1;
20361 PyErr_NoMemory();
20362 D(p->level--);
20363 return NULL;
20364 }
20365 ssize_t _children_capacity = 1;
20366 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020367 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020368 if (p->error_indicator) {
20369 D(p->level--);
20370 return NULL;
20371 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020372 D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20373 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020374 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020375 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020376 )
20377 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020378 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020379 if (_n == _children_capacity) {
20380 _children_capacity *= 2;
20381 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20382 if (!_new_children) {
20383 p->error_indicator = 1;
20384 PyErr_NoMemory();
20385 D(p->level--);
20386 return NULL;
20387 }
20388 _children = _new_children;
20389 }
20390 _children[_n++] = _res;
20391 _mark = p->mark;
20392 }
20393 p->mark = _mark;
20394 D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020395 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020396 }
20397 if (_n == 0 || p->error_indicator) {
20398 PyMem_Free(_children);
20399 D(p->level--);
20400 return NULL;
20401 }
20402 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20403 if (!_seq) {
20404 PyMem_Free(_children);
20405 p->error_indicator = 1;
20406 PyErr_NoMemory();
20407 D(p->level--);
20408 return NULL;
20409 }
20410 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20411 PyMem_Free(_children);
20412 _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
20413 D(p->level--);
20414 return _seq;
20415}
20416
20417// _loop1_82: lambda_param_no_default
20418static asdl_seq *
20419_loop1_82_rule(Parser *p)
20420{
20421 D(p->level++);
20422 if (p->error_indicator) {
20423 D(p->level--);
20424 return NULL;
20425 }
20426 void *_res = NULL;
20427 int _mark = p->mark;
20428 int _start_mark = p->mark;
20429 void **_children = PyMem_Malloc(sizeof(void *));
20430 if (!_children) {
20431 p->error_indicator = 1;
20432 PyErr_NoMemory();
20433 D(p->level--);
20434 return NULL;
20435 }
20436 ssize_t _children_capacity = 1;
20437 ssize_t _n = 0;
20438 { // lambda_param_no_default
20439 if (p->error_indicator) {
20440 D(p->level--);
20441 return NULL;
20442 }
20443 D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20444 arg_ty lambda_param_no_default_var;
20445 while (
20446 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20447 )
20448 {
20449 _res = lambda_param_no_default_var;
20450 if (_n == _children_capacity) {
20451 _children_capacity *= 2;
20452 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20453 if (!_new_children) {
20454 p->error_indicator = 1;
20455 PyErr_NoMemory();
20456 D(p->level--);
20457 return NULL;
20458 }
20459 _children = _new_children;
20460 }
20461 _children[_n++] = _res;
20462 _mark = p->mark;
20463 }
20464 p->mark = _mark;
20465 D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ',
20466 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20467 }
20468 if (_n == 0 || p->error_indicator) {
20469 PyMem_Free(_children);
20470 D(p->level--);
20471 return NULL;
20472 }
20473 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20474 if (!_seq) {
20475 PyMem_Free(_children);
20476 p->error_indicator = 1;
20477 PyErr_NoMemory();
20478 D(p->level--);
20479 return NULL;
20480 }
20481 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20482 PyMem_Free(_children);
20483 _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq);
20484 D(p->level--);
20485 return _seq;
20486}
20487
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020488// _loop1_83: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020489static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020490_loop1_83_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020491{
20492 D(p->level++);
20493 if (p->error_indicator) {
20494 D(p->level--);
20495 return NULL;
20496 }
20497 void *_res = NULL;
20498 int _mark = p->mark;
20499 int _start_mark = p->mark;
20500 void **_children = PyMem_Malloc(sizeof(void *));
20501 if (!_children) {
20502 p->error_indicator = 1;
20503 PyErr_NoMemory();
20504 D(p->level--);
20505 return NULL;
20506 }
20507 ssize_t _children_capacity = 1;
20508 ssize_t _n = 0;
20509 { // lambda_param_no_default
20510 if (p->error_indicator) {
20511 D(p->level--);
20512 return NULL;
20513 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020514 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 +010020515 arg_ty lambda_param_no_default_var;
20516 while (
20517 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20518 )
20519 {
20520 _res = lambda_param_no_default_var;
20521 if (_n == _children_capacity) {
20522 _children_capacity *= 2;
20523 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20524 if (!_new_children) {
20525 p->error_indicator = 1;
20526 PyErr_NoMemory();
20527 D(p->level--);
20528 return NULL;
20529 }
20530 _children = _new_children;
20531 }
20532 _children[_n++] = _res;
20533 _mark = p->mark;
20534 }
20535 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020536 D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020537 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20538 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020539 if (_n == 0 || p->error_indicator) {
20540 PyMem_Free(_children);
20541 D(p->level--);
20542 return NULL;
20543 }
20544 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20545 if (!_seq) {
20546 PyMem_Free(_children);
20547 p->error_indicator = 1;
20548 PyErr_NoMemory();
20549 D(p->level--);
20550 return NULL;
20551 }
20552 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20553 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020554 _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020555 D(p->level--);
20556 return _seq;
20557}
20558
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020559// _loop0_84: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020560static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020561_loop0_84_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020562{
20563 D(p->level++);
20564 if (p->error_indicator) {
20565 D(p->level--);
20566 return NULL;
20567 }
20568 void *_res = NULL;
20569 int _mark = p->mark;
20570 int _start_mark = p->mark;
20571 void **_children = PyMem_Malloc(sizeof(void *));
20572 if (!_children) {
20573 p->error_indicator = 1;
20574 PyErr_NoMemory();
20575 D(p->level--);
20576 return NULL;
20577 }
20578 ssize_t _children_capacity = 1;
20579 ssize_t _n = 0;
20580 { // lambda_param_no_default
20581 if (p->error_indicator) {
20582 D(p->level--);
20583 return NULL;
20584 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020585 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 +010020586 arg_ty lambda_param_no_default_var;
20587 while (
20588 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20589 )
20590 {
20591 _res = lambda_param_no_default_var;
20592 if (_n == _children_capacity) {
20593 _children_capacity *= 2;
20594 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20595 if (!_new_children) {
20596 p->error_indicator = 1;
20597 PyErr_NoMemory();
20598 D(p->level--);
20599 return NULL;
20600 }
20601 _children = _new_children;
20602 }
20603 _children[_n++] = _res;
20604 _mark = p->mark;
20605 }
20606 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020607 D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020608 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20609 }
20610 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20611 if (!_seq) {
20612 PyMem_Free(_children);
20613 p->error_indicator = 1;
20614 PyErr_NoMemory();
20615 D(p->level--);
20616 return NULL;
20617 }
20618 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20619 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020620 _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020621 D(p->level--);
20622 return _seq;
20623}
20624
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020625// _loop1_85: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020626static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020627_loop1_85_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020628{
20629 D(p->level++);
20630 if (p->error_indicator) {
20631 D(p->level--);
20632 return NULL;
20633 }
20634 void *_res = NULL;
20635 int _mark = p->mark;
20636 int _start_mark = p->mark;
20637 void **_children = PyMem_Malloc(sizeof(void *));
20638 if (!_children) {
20639 p->error_indicator = 1;
20640 PyErr_NoMemory();
20641 D(p->level--);
20642 return NULL;
20643 }
20644 ssize_t _children_capacity = 1;
20645 ssize_t _n = 0;
20646 { // lambda_param_with_default
20647 if (p->error_indicator) {
20648 D(p->level--);
20649 return NULL;
20650 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020651 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 +010020652 NameDefaultPair* lambda_param_with_default_var;
20653 while (
20654 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20655 )
20656 {
20657 _res = lambda_param_with_default_var;
20658 if (_n == _children_capacity) {
20659 _children_capacity *= 2;
20660 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20661 if (!_new_children) {
20662 p->error_indicator = 1;
20663 PyErr_NoMemory();
20664 D(p->level--);
20665 return NULL;
20666 }
20667 _children = _new_children;
20668 }
20669 _children[_n++] = _res;
20670 _mark = p->mark;
20671 }
20672 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020673 D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020674 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20675 }
20676 if (_n == 0 || p->error_indicator) {
20677 PyMem_Free(_children);
20678 D(p->level--);
20679 return NULL;
20680 }
20681 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20682 if (!_seq) {
20683 PyMem_Free(_children);
20684 p->error_indicator = 1;
20685 PyErr_NoMemory();
20686 D(p->level--);
20687 return NULL;
20688 }
20689 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20690 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020691 _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020692 D(p->level--);
20693 return _seq;
20694}
20695
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020696// _loop0_86: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020697static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020698_loop0_86_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020699{
20700 D(p->level++);
20701 if (p->error_indicator) {
20702 D(p->level--);
20703 return NULL;
20704 }
20705 void *_res = NULL;
20706 int _mark = p->mark;
20707 int _start_mark = p->mark;
20708 void **_children = PyMem_Malloc(sizeof(void *));
20709 if (!_children) {
20710 p->error_indicator = 1;
20711 PyErr_NoMemory();
20712 D(p->level--);
20713 return NULL;
20714 }
20715 ssize_t _children_capacity = 1;
20716 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020717 { // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020718 if (p->error_indicator) {
20719 D(p->level--);
20720 return NULL;
20721 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020722 D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20723 arg_ty lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020724 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020725 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020726 )
20727 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020728 _res = lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020729 if (_n == _children_capacity) {
20730 _children_capacity *= 2;
20731 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20732 if (!_new_children) {
20733 p->error_indicator = 1;
20734 PyErr_NoMemory();
20735 D(p->level--);
20736 return NULL;
20737 }
20738 _children = _new_children;
20739 }
20740 _children[_n++] = _res;
20741 _mark = p->mark;
20742 }
20743 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020744 D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
20745 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020746 }
20747 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20748 if (!_seq) {
20749 PyMem_Free(_children);
20750 p->error_indicator = 1;
20751 PyErr_NoMemory();
20752 D(p->level--);
20753 return NULL;
20754 }
20755 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20756 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020757 _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020758 D(p->level--);
20759 return _seq;
20760}
20761
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020762// _loop1_87: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020763static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020764_loop1_87_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020765{
20766 D(p->level++);
20767 if (p->error_indicator) {
20768 D(p->level--);
20769 return NULL;
20770 }
20771 void *_res = NULL;
20772 int _mark = p->mark;
20773 int _start_mark = p->mark;
20774 void **_children = PyMem_Malloc(sizeof(void *));
20775 if (!_children) {
20776 p->error_indicator = 1;
20777 PyErr_NoMemory();
20778 D(p->level--);
20779 return NULL;
20780 }
20781 ssize_t _children_capacity = 1;
20782 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020783 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020784 if (p->error_indicator) {
20785 D(p->level--);
20786 return NULL;
20787 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020788 D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20789 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020790 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020791 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020792 )
20793 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020794 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020795 if (_n == _children_capacity) {
20796 _children_capacity *= 2;
20797 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20798 if (!_new_children) {
20799 p->error_indicator = 1;
20800 PyErr_NoMemory();
20801 D(p->level--);
20802 return NULL;
20803 }
20804 _children = _new_children;
20805 }
20806 _children[_n++] = _res;
20807 _mark = p->mark;
20808 }
20809 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020810 D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ',
20811 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020812 }
20813 if (_n == 0 || p->error_indicator) {
20814 PyMem_Free(_children);
20815 D(p->level--);
20816 return NULL;
20817 }
20818 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20819 if (!_seq) {
20820 PyMem_Free(_children);
20821 p->error_indicator = 1;
20822 PyErr_NoMemory();
20823 D(p->level--);
20824 return NULL;
20825 }
20826 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20827 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020828 _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020829 D(p->level--);
20830 return _seq;
20831}
20832
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020833// _loop0_88: lambda_param_maybe_default
20834static asdl_seq *
20835_loop0_88_rule(Parser *p)
20836{
20837 D(p->level++);
20838 if (p->error_indicator) {
20839 D(p->level--);
20840 return NULL;
20841 }
20842 void *_res = NULL;
20843 int _mark = p->mark;
20844 int _start_mark = p->mark;
20845 void **_children = PyMem_Malloc(sizeof(void *));
20846 if (!_children) {
20847 p->error_indicator = 1;
20848 PyErr_NoMemory();
20849 D(p->level--);
20850 return NULL;
20851 }
20852 ssize_t _children_capacity = 1;
20853 ssize_t _n = 0;
20854 { // lambda_param_maybe_default
20855 if (p->error_indicator) {
20856 D(p->level--);
20857 return NULL;
20858 }
20859 D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20860 NameDefaultPair* lambda_param_maybe_default_var;
20861 while (
20862 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20863 )
20864 {
20865 _res = lambda_param_maybe_default_var;
20866 if (_n == _children_capacity) {
20867 _children_capacity *= 2;
20868 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20869 if (!_new_children) {
20870 p->error_indicator = 1;
20871 PyErr_NoMemory();
20872 D(p->level--);
20873 return NULL;
20874 }
20875 _children = _new_children;
20876 }
20877 _children[_n++] = _res;
20878 _mark = p->mark;
20879 }
20880 p->mark = _mark;
20881 D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ',
20882 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20883 }
20884 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20885 if (!_seq) {
20886 PyMem_Free(_children);
20887 p->error_indicator = 1;
20888 PyErr_NoMemory();
20889 D(p->level--);
20890 return NULL;
20891 }
20892 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20893 PyMem_Free(_children);
20894 _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq);
20895 D(p->level--);
20896 return _seq;
20897}
20898
20899// _loop1_89: lambda_param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020900static asdl_seq *
20901_loop1_89_rule(Parser *p)
20902{
20903 D(p->level++);
20904 if (p->error_indicator) {
20905 D(p->level--);
20906 return NULL;
20907 }
20908 void *_res = NULL;
20909 int _mark = p->mark;
20910 int _start_mark = p->mark;
20911 void **_children = PyMem_Malloc(sizeof(void *));
20912 if (!_children) {
20913 p->error_indicator = 1;
20914 PyErr_NoMemory();
20915 D(p->level--);
20916 return NULL;
20917 }
20918 ssize_t _children_capacity = 1;
20919 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020920 { // lambda_param_maybe_default
20921 if (p->error_indicator) {
20922 D(p->level--);
20923 return NULL;
20924 }
20925 D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20926 NameDefaultPair* lambda_param_maybe_default_var;
20927 while (
20928 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20929 )
20930 {
20931 _res = lambda_param_maybe_default_var;
20932 if (_n == _children_capacity) {
20933 _children_capacity *= 2;
20934 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20935 if (!_new_children) {
20936 p->error_indicator = 1;
20937 PyErr_NoMemory();
20938 D(p->level--);
20939 return NULL;
20940 }
20941 _children = _new_children;
20942 }
20943 _children[_n++] = _res;
20944 _mark = p->mark;
20945 }
20946 p->mark = _mark;
20947 D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ',
20948 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20949 }
20950 if (_n == 0 || p->error_indicator) {
20951 PyMem_Free(_children);
20952 D(p->level--);
20953 return NULL;
20954 }
20955 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20956 if (!_seq) {
20957 PyMem_Free(_children);
20958 p->error_indicator = 1;
20959 PyErr_NoMemory();
20960 D(p->level--);
20961 return NULL;
20962 }
20963 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20964 PyMem_Free(_children);
20965 _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
20966 D(p->level--);
20967 return _seq;
20968}
20969
20970// _loop1_90: ('or' conjunction)
20971static asdl_seq *
20972_loop1_90_rule(Parser *p)
20973{
20974 D(p->level++);
20975 if (p->error_indicator) {
20976 D(p->level--);
20977 return NULL;
20978 }
20979 void *_res = NULL;
20980 int _mark = p->mark;
20981 int _start_mark = p->mark;
20982 void **_children = PyMem_Malloc(sizeof(void *));
20983 if (!_children) {
20984 p->error_indicator = 1;
20985 PyErr_NoMemory();
20986 D(p->level--);
20987 return NULL;
20988 }
20989 ssize_t _children_capacity = 1;
20990 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020991 { // ('or' conjunction)
20992 if (p->error_indicator) {
20993 D(p->level--);
20994 return NULL;
20995 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020996 D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010020997 void *_tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020998 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010020999 (_tmp_145_var = _tmp_145_rule(p)) // 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021000 )
21001 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021002 _res = _tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021003 if (_n == _children_capacity) {
21004 _children_capacity *= 2;
21005 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21006 if (!_new_children) {
21007 p->error_indicator = 1;
21008 PyErr_NoMemory();
21009 D(p->level--);
21010 return NULL;
21011 }
21012 _children = _new_children;
21013 }
21014 _children[_n++] = _res;
21015 _mark = p->mark;
21016 }
21017 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021018 D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021019 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
21020 }
21021 if (_n == 0 || p->error_indicator) {
21022 PyMem_Free(_children);
21023 D(p->level--);
21024 return NULL;
21025 }
21026 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21027 if (!_seq) {
21028 PyMem_Free(_children);
21029 p->error_indicator = 1;
21030 PyErr_NoMemory();
21031 D(p->level--);
21032 return NULL;
21033 }
21034 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21035 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021036 _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021037 D(p->level--);
21038 return _seq;
21039}
21040
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021041// _loop1_91: ('and' inversion)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021042static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021043_loop1_91_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021044{
21045 D(p->level++);
21046 if (p->error_indicator) {
21047 D(p->level--);
21048 return NULL;
21049 }
21050 void *_res = NULL;
21051 int _mark = p->mark;
21052 int _start_mark = p->mark;
21053 void **_children = PyMem_Malloc(sizeof(void *));
21054 if (!_children) {
21055 p->error_indicator = 1;
21056 PyErr_NoMemory();
21057 D(p->level--);
21058 return NULL;
21059 }
21060 ssize_t _children_capacity = 1;
21061 ssize_t _n = 0;
21062 { // ('and' inversion)
21063 if (p->error_indicator) {
21064 D(p->level--);
21065 return NULL;
21066 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021067 D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021068 void *_tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021069 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021070 (_tmp_146_var = _tmp_146_rule(p)) // 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021071 )
21072 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021073 _res = _tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021074 if (_n == _children_capacity) {
21075 _children_capacity *= 2;
21076 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21077 if (!_new_children) {
21078 p->error_indicator = 1;
21079 PyErr_NoMemory();
21080 D(p->level--);
21081 return NULL;
21082 }
21083 _children = _new_children;
21084 }
21085 _children[_n++] = _res;
21086 _mark = p->mark;
21087 }
21088 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021089 D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021090 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
21091 }
21092 if (_n == 0 || p->error_indicator) {
21093 PyMem_Free(_children);
21094 D(p->level--);
21095 return NULL;
21096 }
21097 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21098 if (!_seq) {
21099 PyMem_Free(_children);
21100 p->error_indicator = 1;
21101 PyErr_NoMemory();
21102 D(p->level--);
21103 return NULL;
21104 }
21105 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21106 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021107 _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021108 D(p->level--);
21109 return _seq;
21110}
21111
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021112// _loop1_92: compare_op_bitwise_or_pair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021113static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021114_loop1_92_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021115{
21116 D(p->level++);
21117 if (p->error_indicator) {
21118 D(p->level--);
21119 return NULL;
21120 }
21121 void *_res = NULL;
21122 int _mark = p->mark;
21123 int _start_mark = p->mark;
21124 void **_children = PyMem_Malloc(sizeof(void *));
21125 if (!_children) {
21126 p->error_indicator = 1;
21127 PyErr_NoMemory();
21128 D(p->level--);
21129 return NULL;
21130 }
21131 ssize_t _children_capacity = 1;
21132 ssize_t _n = 0;
21133 { // compare_op_bitwise_or_pair
21134 if (p->error_indicator) {
21135 D(p->level--);
21136 return NULL;
21137 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021138 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 +010021139 CmpopExprPair* compare_op_bitwise_or_pair_var;
21140 while (
21141 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
21142 )
21143 {
21144 _res = compare_op_bitwise_or_pair_var;
21145 if (_n == _children_capacity) {
21146 _children_capacity *= 2;
21147 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21148 if (!_new_children) {
21149 p->error_indicator = 1;
21150 PyErr_NoMemory();
21151 D(p->level--);
21152 return NULL;
21153 }
21154 _children = _new_children;
21155 }
21156 _children[_n++] = _res;
21157 _mark = p->mark;
21158 }
21159 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021160 D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021161 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
21162 }
21163 if (_n == 0 || p->error_indicator) {
21164 PyMem_Free(_children);
21165 D(p->level--);
21166 return NULL;
21167 }
21168 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21169 if (!_seq) {
21170 PyMem_Free(_children);
21171 p->error_indicator = 1;
21172 PyErr_NoMemory();
21173 D(p->level--);
21174 return NULL;
21175 }
21176 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21177 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021178 _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021179 D(p->level--);
21180 return _seq;
21181}
21182
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021183// _tmp_93: '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021184static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021185_tmp_93_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021186{
21187 D(p->level++);
21188 if (p->error_indicator) {
21189 D(p->level--);
21190 return NULL;
21191 }
21192 void * _res = NULL;
21193 int _mark = p->mark;
21194 { // '!='
21195 if (p->error_indicator) {
21196 D(p->level--);
21197 return NULL;
21198 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021199 D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021200 Token * tok;
21201 if (
21202 (tok = _PyPegen_expect_token(p, 28)) // token='!='
21203 )
21204 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021205 D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021206 _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok;
21207 if (_res == NULL && PyErr_Occurred()) {
21208 p->error_indicator = 1;
21209 D(p->level--);
21210 return NULL;
21211 }
21212 goto done;
21213 }
21214 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021215 D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021216 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
21217 }
21218 _res = NULL;
21219 done:
21220 D(p->level--);
21221 return _res;
21222}
21223
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021224// _loop0_95: ',' slice
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021225static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021226_loop0_95_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021227{
21228 D(p->level++);
21229 if (p->error_indicator) {
21230 D(p->level--);
21231 return NULL;
21232 }
21233 void *_res = NULL;
21234 int _mark = p->mark;
21235 int _start_mark = p->mark;
21236 void **_children = PyMem_Malloc(sizeof(void *));
21237 if (!_children) {
21238 p->error_indicator = 1;
21239 PyErr_NoMemory();
21240 D(p->level--);
21241 return NULL;
21242 }
21243 ssize_t _children_capacity = 1;
21244 ssize_t _n = 0;
21245 { // ',' slice
21246 if (p->error_indicator) {
21247 D(p->level--);
21248 return NULL;
21249 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021250 D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021251 Token * _literal;
21252 expr_ty elem;
21253 while (
21254 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21255 &&
21256 (elem = slice_rule(p)) // slice
21257 )
21258 {
21259 _res = elem;
21260 if (_res == NULL && PyErr_Occurred()) {
21261 p->error_indicator = 1;
21262 PyMem_Free(_children);
21263 D(p->level--);
21264 return NULL;
21265 }
21266 if (_n == _children_capacity) {
21267 _children_capacity *= 2;
21268 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21269 if (!_new_children) {
21270 p->error_indicator = 1;
21271 PyErr_NoMemory();
21272 D(p->level--);
21273 return NULL;
21274 }
21275 _children = _new_children;
21276 }
21277 _children[_n++] = _res;
21278 _mark = p->mark;
21279 }
21280 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021281 D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021282 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
21283 }
21284 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21285 if (!_seq) {
21286 PyMem_Free(_children);
21287 p->error_indicator = 1;
21288 PyErr_NoMemory();
21289 D(p->level--);
21290 return NULL;
21291 }
21292 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21293 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021294 _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021295 D(p->level--);
21296 return _seq;
21297}
21298
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021299// _gather_94: slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021300static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021301_gather_94_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021302{
21303 D(p->level++);
21304 if (p->error_indicator) {
21305 D(p->level--);
21306 return NULL;
21307 }
21308 asdl_seq * _res = NULL;
21309 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021310 { // slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021311 if (p->error_indicator) {
21312 D(p->level--);
21313 return NULL;
21314 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021315 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 +010021316 expr_ty elem;
21317 asdl_seq * seq;
21318 if (
21319 (elem = slice_rule(p)) // slice
21320 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021321 (seq = _loop0_95_rule(p)) // _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021322 )
21323 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021324 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 +010021325 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21326 goto done;
21327 }
21328 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021329 D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ',
21330 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_95"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021331 }
21332 _res = NULL;
21333 done:
21334 D(p->level--);
21335 return _res;
21336}
21337
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021338// _tmp_96: ':' expression?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021339static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021340_tmp_96_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021341{
21342 D(p->level++);
21343 if (p->error_indicator) {
21344 D(p->level--);
21345 return NULL;
21346 }
21347 void * _res = NULL;
21348 int _mark = p->mark;
21349 { // ':' expression?
21350 if (p->error_indicator) {
21351 D(p->level--);
21352 return NULL;
21353 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021354 D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021355 Token * _literal;
21356 void *d;
21357 if (
21358 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
21359 &&
21360 (d = expression_rule(p), 1) // expression?
21361 )
21362 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021363 D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021364 _res = d;
21365 if (_res == NULL && PyErr_Occurred()) {
21366 p->error_indicator = 1;
21367 D(p->level--);
21368 return NULL;
21369 }
21370 goto done;
21371 }
21372 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021373 D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021374 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
21375 }
21376 _res = NULL;
21377 done:
21378 D(p->level--);
21379 return _res;
21380}
21381
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021382// _tmp_97: tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021383static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021384_tmp_97_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021385{
21386 D(p->level++);
21387 if (p->error_indicator) {
21388 D(p->level--);
21389 return NULL;
21390 }
21391 void * _res = NULL;
21392 int _mark = p->mark;
21393 { // tuple
21394 if (p->error_indicator) {
21395 D(p->level--);
21396 return NULL;
21397 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021398 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021399 expr_ty tuple_var;
21400 if (
21401 (tuple_var = tuple_rule(p)) // tuple
21402 )
21403 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021404 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021405 _res = tuple_var;
21406 goto done;
21407 }
21408 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021409 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021410 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
21411 }
21412 { // group
21413 if (p->error_indicator) {
21414 D(p->level--);
21415 return NULL;
21416 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021417 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021418 expr_ty group_var;
21419 if (
21420 (group_var = group_rule(p)) // group
21421 )
21422 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021423 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021424 _res = group_var;
21425 goto done;
21426 }
21427 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021428 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021429 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
21430 }
21431 { // genexp
21432 if (p->error_indicator) {
21433 D(p->level--);
21434 return NULL;
21435 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021436 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021437 expr_ty genexp_var;
21438 if (
21439 (genexp_var = genexp_rule(p)) // genexp
21440 )
21441 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021442 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021443 _res = genexp_var;
21444 goto done;
21445 }
21446 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021447 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021448 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
21449 }
21450 _res = NULL;
21451 done:
21452 D(p->level--);
21453 return _res;
21454}
21455
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021456// _tmp_98: list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021457static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021458_tmp_98_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021459{
21460 D(p->level++);
21461 if (p->error_indicator) {
21462 D(p->level--);
21463 return NULL;
21464 }
21465 void * _res = NULL;
21466 int _mark = p->mark;
21467 { // list
21468 if (p->error_indicator) {
21469 D(p->level--);
21470 return NULL;
21471 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021472 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021473 expr_ty list_var;
21474 if (
21475 (list_var = list_rule(p)) // list
21476 )
21477 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021478 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021479 _res = list_var;
21480 goto done;
21481 }
21482 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021483 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021484 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
21485 }
21486 { // listcomp
21487 if (p->error_indicator) {
21488 D(p->level--);
21489 return NULL;
21490 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021491 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021492 expr_ty listcomp_var;
21493 if (
21494 (listcomp_var = listcomp_rule(p)) // listcomp
21495 )
21496 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021497 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021498 _res = listcomp_var;
21499 goto done;
21500 }
21501 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021502 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021503 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
21504 }
21505 _res = NULL;
21506 done:
21507 D(p->level--);
21508 return _res;
21509}
21510
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021511// _tmp_99: dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021512static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021513_tmp_99_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021514{
21515 D(p->level++);
21516 if (p->error_indicator) {
21517 D(p->level--);
21518 return NULL;
21519 }
21520 void * _res = NULL;
21521 int _mark = p->mark;
21522 { // dict
21523 if (p->error_indicator) {
21524 D(p->level--);
21525 return NULL;
21526 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021527 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021528 expr_ty dict_var;
21529 if (
21530 (dict_var = dict_rule(p)) // dict
21531 )
21532 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021533 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021534 _res = dict_var;
21535 goto done;
21536 }
21537 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021538 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021539 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
21540 }
21541 { // set
21542 if (p->error_indicator) {
21543 D(p->level--);
21544 return NULL;
21545 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021546 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021547 expr_ty set_var;
21548 if (
21549 (set_var = set_rule(p)) // set
21550 )
21551 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021552 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021553 _res = set_var;
21554 goto done;
21555 }
21556 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021557 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021558 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
21559 }
21560 { // dictcomp
21561 if (p->error_indicator) {
21562 D(p->level--);
21563 return NULL;
21564 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021565 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021566 expr_ty dictcomp_var;
21567 if (
21568 (dictcomp_var = dictcomp_rule(p)) // dictcomp
21569 )
21570 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021571 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021572 _res = dictcomp_var;
21573 goto done;
21574 }
21575 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021576 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021577 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
21578 }
21579 { // setcomp
21580 if (p->error_indicator) {
21581 D(p->level--);
21582 return NULL;
21583 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021584 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021585 expr_ty setcomp_var;
21586 if (
21587 (setcomp_var = setcomp_rule(p)) // setcomp
21588 )
21589 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021590 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021591 _res = setcomp_var;
21592 goto done;
21593 }
21594 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021595 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021596 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
21597 }
21598 _res = NULL;
21599 done:
21600 D(p->level--);
21601 return _res;
21602}
21603
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021604// _loop1_100: STRING
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021605static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021606_loop1_100_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021607{
21608 D(p->level++);
21609 if (p->error_indicator) {
21610 D(p->level--);
21611 return NULL;
21612 }
21613 void *_res = NULL;
21614 int _mark = p->mark;
21615 int _start_mark = p->mark;
21616 void **_children = PyMem_Malloc(sizeof(void *));
21617 if (!_children) {
21618 p->error_indicator = 1;
21619 PyErr_NoMemory();
21620 D(p->level--);
21621 return NULL;
21622 }
21623 ssize_t _children_capacity = 1;
21624 ssize_t _n = 0;
21625 { // STRING
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> _loop1_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021631 expr_ty string_var;
21632 while (
21633 (string_var = _PyPegen_string_token(p)) // STRING
21634 )
21635 {
21636 _res = string_var;
21637 if (_n == _children_capacity) {
21638 _children_capacity *= 2;
21639 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21640 if (!_new_children) {
21641 p->error_indicator = 1;
21642 PyErr_NoMemory();
21643 D(p->level--);
21644 return NULL;
21645 }
21646 _children = _new_children;
21647 }
21648 _children[_n++] = _res;
21649 _mark = p->mark;
21650 }
21651 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021652 D(fprintf(stderr, "%*c%s _loop1_100[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021653 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
21654 }
21655 if (_n == 0 || p->error_indicator) {
21656 PyMem_Free(_children);
21657 D(p->level--);
21658 return NULL;
21659 }
21660 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21661 if (!_seq) {
21662 PyMem_Free(_children);
21663 p->error_indicator = 1;
21664 PyErr_NoMemory();
21665 D(p->level--);
21666 return NULL;
21667 }
21668 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21669 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021670 _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021671 D(p->level--);
21672 return _seq;
21673}
21674
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021675// _tmp_101: star_named_expression ',' star_named_expressions?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021676static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021677_tmp_101_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021678{
21679 D(p->level++);
21680 if (p->error_indicator) {
21681 D(p->level--);
21682 return NULL;
21683 }
21684 void * _res = NULL;
21685 int _mark = p->mark;
21686 { // star_named_expression ',' star_named_expressions?
21687 if (p->error_indicator) {
21688 D(p->level--);
21689 return NULL;
21690 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021691 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 +010021692 Token * _literal;
21693 expr_ty y;
21694 void *z;
21695 if (
21696 (y = star_named_expression_rule(p)) // star_named_expression
21697 &&
21698 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21699 &&
21700 (z = star_named_expressions_rule(p), 1) // star_named_expressions?
21701 )
21702 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021703 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 +010021704 _res = _PyPegen_seq_insert_in_front ( p , y , z );
21705 if (_res == NULL && PyErr_Occurred()) {
21706 p->error_indicator = 1;
21707 D(p->level--);
21708 return NULL;
21709 }
21710 goto done;
21711 }
21712 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021713 D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021714 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
21715 }
21716 _res = NULL;
21717 done:
21718 D(p->level--);
21719 return _res;
21720}
21721
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021722// _tmp_102: yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021723static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021724_tmp_102_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021725{
21726 D(p->level++);
21727 if (p->error_indicator) {
21728 D(p->level--);
21729 return NULL;
21730 }
21731 void * _res = NULL;
21732 int _mark = p->mark;
21733 { // yield_expr
21734 if (p->error_indicator) {
21735 D(p->level--);
21736 return NULL;
21737 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021738 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021739 expr_ty yield_expr_var;
21740 if (
21741 (yield_expr_var = yield_expr_rule(p)) // yield_expr
21742 )
21743 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021744 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 +010021745 _res = yield_expr_var;
21746 goto done;
21747 }
21748 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021749 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021750 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
21751 }
21752 { // named_expression
21753 if (p->error_indicator) {
21754 D(p->level--);
21755 return NULL;
21756 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021757 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021758 expr_ty named_expression_var;
21759 if (
21760 (named_expression_var = named_expression_rule(p)) // named_expression
21761 )
21762 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021763 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 +010021764 _res = named_expression_var;
21765 goto done;
21766 }
21767 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021768 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021769 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
21770 }
21771 _res = NULL;
21772 done:
21773 D(p->level--);
21774 return _res;
21775}
21776
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021777// _loop0_104: ',' double_starred_kvpair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021778static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021779_loop0_104_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021780{
21781 D(p->level++);
21782 if (p->error_indicator) {
21783 D(p->level--);
21784 return NULL;
21785 }
21786 void *_res = NULL;
21787 int _mark = p->mark;
21788 int _start_mark = p->mark;
21789 void **_children = PyMem_Malloc(sizeof(void *));
21790 if (!_children) {
21791 p->error_indicator = 1;
21792 PyErr_NoMemory();
21793 D(p->level--);
21794 return NULL;
21795 }
21796 ssize_t _children_capacity = 1;
21797 ssize_t _n = 0;
21798 { // ',' double_starred_kvpair
21799 if (p->error_indicator) {
21800 D(p->level--);
21801 return NULL;
21802 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021803 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 +010021804 Token * _literal;
21805 KeyValuePair* elem;
21806 while (
21807 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21808 &&
21809 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21810 )
21811 {
21812 _res = elem;
21813 if (_res == NULL && PyErr_Occurred()) {
21814 p->error_indicator = 1;
21815 PyMem_Free(_children);
21816 D(p->level--);
21817 return NULL;
21818 }
21819 if (_n == _children_capacity) {
21820 _children_capacity *= 2;
21821 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21822 if (!_new_children) {
21823 p->error_indicator = 1;
21824 PyErr_NoMemory();
21825 D(p->level--);
21826 return NULL;
21827 }
21828 _children = _new_children;
21829 }
21830 _children[_n++] = _res;
21831 _mark = p->mark;
21832 }
21833 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021834 D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021835 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
21836 }
21837 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21838 if (!_seq) {
21839 PyMem_Free(_children);
21840 p->error_indicator = 1;
21841 PyErr_NoMemory();
21842 D(p->level--);
21843 return NULL;
21844 }
21845 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21846 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021847 _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021848 D(p->level--);
21849 return _seq;
21850}
21851
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021852// _gather_103: double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021853static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021854_gather_103_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021855{
21856 D(p->level++);
21857 if (p->error_indicator) {
21858 D(p->level--);
21859 return NULL;
21860 }
21861 asdl_seq * _res = NULL;
21862 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021863 { // double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021864 if (p->error_indicator) {
21865 D(p->level--);
21866 return NULL;
21867 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021868 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 +010021869 KeyValuePair* elem;
21870 asdl_seq * seq;
21871 if (
21872 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21873 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021874 (seq = _loop0_104_rule(p)) // _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021875 )
21876 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021877 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 +010021878 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21879 goto done;
21880 }
21881 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021882 D(fprintf(stderr, "%*c%s _gather_103[%d-%d]: %s failed!\n", p->level, ' ',
21883 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_104"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021884 }
21885 _res = NULL;
21886 done:
21887 D(p->level--);
21888 return _res;
21889}
21890
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021891// _loop1_105: for_if_clause
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021892static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021893_loop1_105_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021894{
21895 D(p->level++);
21896 if (p->error_indicator) {
21897 D(p->level--);
21898 return NULL;
21899 }
21900 void *_res = NULL;
21901 int _mark = p->mark;
21902 int _start_mark = p->mark;
21903 void **_children = PyMem_Malloc(sizeof(void *));
21904 if (!_children) {
21905 p->error_indicator = 1;
21906 PyErr_NoMemory();
21907 D(p->level--);
21908 return NULL;
21909 }
21910 ssize_t _children_capacity = 1;
21911 ssize_t _n = 0;
21912 { // for_if_clause
21913 if (p->error_indicator) {
21914 D(p->level--);
21915 return NULL;
21916 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021917 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 +010021918 comprehension_ty for_if_clause_var;
21919 while (
21920 (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
21921 )
21922 {
21923 _res = for_if_clause_var;
21924 if (_n == _children_capacity) {
21925 _children_capacity *= 2;
21926 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21927 if (!_new_children) {
21928 p->error_indicator = 1;
21929 PyErr_NoMemory();
21930 D(p->level--);
21931 return NULL;
21932 }
21933 _children = _new_children;
21934 }
21935 _children[_n++] = _res;
21936 _mark = p->mark;
21937 }
21938 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021939 D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021940 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
21941 }
21942 if (_n == 0 || p->error_indicator) {
21943 PyMem_Free(_children);
21944 D(p->level--);
21945 return NULL;
21946 }
21947 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21948 if (!_seq) {
21949 PyMem_Free(_children);
21950 p->error_indicator = 1;
21951 PyErr_NoMemory();
21952 D(p->level--);
21953 return NULL;
21954 }
21955 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21956 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021957 _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021958 D(p->level--);
21959 return _seq;
21960}
21961
21962// _loop0_106: ('if' disjunction)
21963static asdl_seq *
21964_loop0_106_rule(Parser *p)
21965{
21966 D(p->level++);
21967 if (p->error_indicator) {
21968 D(p->level--);
21969 return NULL;
21970 }
21971 void *_res = NULL;
21972 int _mark = p->mark;
21973 int _start_mark = p->mark;
21974 void **_children = PyMem_Malloc(sizeof(void *));
21975 if (!_children) {
21976 p->error_indicator = 1;
21977 PyErr_NoMemory();
21978 D(p->level--);
21979 return NULL;
21980 }
21981 ssize_t _children_capacity = 1;
21982 ssize_t _n = 0;
21983 { // ('if' disjunction)
21984 if (p->error_indicator) {
21985 D(p->level--);
21986 return NULL;
21987 }
21988 D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021989 void *_tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021990 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021991 (_tmp_147_var = _tmp_147_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021992 )
21993 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021994 _res = _tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021995 if (_n == _children_capacity) {
21996 _children_capacity *= 2;
21997 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21998 if (!_new_children) {
21999 p->error_indicator = 1;
22000 PyErr_NoMemory();
22001 D(p->level--);
22002 return NULL;
22003 }
22004 _children = _new_children;
22005 }
22006 _children[_n++] = _res;
22007 _mark = p->mark;
22008 }
22009 p->mark = _mark;
22010 D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ',
22011 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
22012 }
22013 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22014 if (!_seq) {
22015 PyMem_Free(_children);
22016 p->error_indicator = 1;
22017 PyErr_NoMemory();
22018 D(p->level--);
22019 return NULL;
22020 }
22021 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22022 PyMem_Free(_children);
22023 _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq);
22024 D(p->level--);
22025 return _seq;
22026}
22027
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022028// _loop0_107: ('if' disjunction)
22029static asdl_seq *
22030_loop0_107_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022031{
22032 D(p->level++);
22033 if (p->error_indicator) {
22034 D(p->level--);
22035 return NULL;
22036 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022037 void *_res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022038 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022039 int _start_mark = p->mark;
22040 void **_children = PyMem_Malloc(sizeof(void *));
22041 if (!_children) {
22042 p->error_indicator = 1;
22043 PyErr_NoMemory();
22044 D(p->level--);
22045 return NULL;
22046 }
22047 ssize_t _children_capacity = 1;
22048 ssize_t _n = 0;
22049 { // ('if' disjunction)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022050 if (p->error_indicator) {
22051 D(p->level--);
22052 return NULL;
22053 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022054 D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010022055 void *_tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022056 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022057 (_tmp_148_var = _tmp_148_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022058 )
22059 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022060 _res = _tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022061 if (_n == _children_capacity) {
22062 _children_capacity *= 2;
22063 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22064 if (!_new_children) {
22065 p->error_indicator = 1;
22066 PyErr_NoMemory();
22067 D(p->level--);
22068 return NULL;
22069 }
22070 _children = _new_children;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022071 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022072 _children[_n++] = _res;
22073 _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022074 }
22075 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022076 D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ',
22077 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022078 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022079 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22080 if (!_seq) {
22081 PyMem_Free(_children);
22082 p->error_indicator = 1;
22083 PyErr_NoMemory();
22084 D(p->level--);
22085 return NULL;
22086 }
22087 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22088 PyMem_Free(_children);
22089 _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022090 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022091 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022092}
22093
Pablo Galindo4a97b152020-09-02 17:44:19 +010022094// _loop0_109: ',' (starred_expression | named_expression !'=')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022095static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022096_loop0_109_rule(Parser *p)
22097{
22098 D(p->level++);
22099 if (p->error_indicator) {
22100 D(p->level--);
22101 return NULL;
22102 }
22103 void *_res = NULL;
22104 int _mark = p->mark;
22105 int _start_mark = p->mark;
22106 void **_children = PyMem_Malloc(sizeof(void *));
22107 if (!_children) {
22108 p->error_indicator = 1;
22109 PyErr_NoMemory();
22110 D(p->level--);
22111 return NULL;
22112 }
22113 ssize_t _children_capacity = 1;
22114 ssize_t _n = 0;
22115 { // ',' (starred_expression | named_expression !'=')
22116 if (p->error_indicator) {
22117 D(p->level--);
22118 return NULL;
22119 }
22120 D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22121 Token * _literal;
22122 void *elem;
22123 while (
22124 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22125 &&
22126 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22127 )
22128 {
22129 _res = elem;
22130 if (_res == NULL && PyErr_Occurred()) {
22131 p->error_indicator = 1;
22132 PyMem_Free(_children);
22133 D(p->level--);
22134 return NULL;
22135 }
22136 if (_n == _children_capacity) {
22137 _children_capacity *= 2;
22138 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22139 if (!_new_children) {
22140 p->error_indicator = 1;
22141 PyErr_NoMemory();
22142 D(p->level--);
22143 return NULL;
22144 }
22145 _children = _new_children;
22146 }
22147 _children[_n++] = _res;
22148 _mark = p->mark;
22149 }
22150 p->mark = _mark;
22151 D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ',
22152 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22153 }
22154 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22155 if (!_seq) {
22156 PyMem_Free(_children);
22157 p->error_indicator = 1;
22158 PyErr_NoMemory();
22159 D(p->level--);
22160 return NULL;
22161 }
22162 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22163 PyMem_Free(_children);
22164 _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq);
22165 D(p->level--);
22166 return _seq;
22167}
22168
22169// _gather_108: (starred_expression | named_expression !'=') _loop0_109
22170static asdl_seq *
22171_gather_108_rule(Parser *p)
22172{
22173 D(p->level++);
22174 if (p->error_indicator) {
22175 D(p->level--);
22176 return NULL;
22177 }
22178 asdl_seq * _res = NULL;
22179 int _mark = p->mark;
22180 { // (starred_expression | named_expression !'=') _loop0_109
22181 if (p->error_indicator) {
22182 D(p->level--);
22183 return NULL;
22184 }
22185 D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22186 void *elem;
22187 asdl_seq * seq;
22188 if (
22189 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22190 &&
22191 (seq = _loop0_109_rule(p)) // _loop0_109
22192 )
22193 {
22194 D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22195 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22196 goto done;
22197 }
22198 p->mark = _mark;
22199 D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n", p->level, ' ',
22200 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22201 }
22202 _res = NULL;
22203 done:
22204 D(p->level--);
22205 return _res;
22206}
22207
22208// _tmp_110: ',' kwargs
22209static void *
22210_tmp_110_rule(Parser *p)
22211{
22212 D(p->level++);
22213 if (p->error_indicator) {
22214 D(p->level--);
22215 return NULL;
22216 }
22217 void * _res = NULL;
22218 int _mark = p->mark;
22219 { // ',' kwargs
22220 if (p->error_indicator) {
22221 D(p->level--);
22222 return NULL;
22223 }
22224 D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22225 Token * _literal;
22226 asdl_seq* k;
22227 if (
22228 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22229 &&
22230 (k = kwargs_rule(p)) // kwargs
22231 )
22232 {
22233 D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22234 _res = k;
22235 if (_res == NULL && PyErr_Occurred()) {
22236 p->error_indicator = 1;
22237 D(p->level--);
22238 return NULL;
22239 }
22240 goto done;
22241 }
22242 p->mark = _mark;
22243 D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ',
22244 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
22245 }
22246 _res = NULL;
22247 done:
22248 D(p->level--);
22249 return _res;
22250}
22251
22252// _loop0_112: ',' kwarg_or_starred
22253static asdl_seq *
22254_loop0_112_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022255{
22256 D(p->level++);
22257 if (p->error_indicator) {
22258 D(p->level--);
22259 return NULL;
22260 }
22261 void *_res = NULL;
22262 int _mark = p->mark;
22263 int _start_mark = p->mark;
22264 void **_children = PyMem_Malloc(sizeof(void *));
22265 if (!_children) {
22266 p->error_indicator = 1;
22267 PyErr_NoMemory();
22268 D(p->level--);
22269 return NULL;
22270 }
22271 ssize_t _children_capacity = 1;
22272 ssize_t _n = 0;
22273 { // ',' kwarg_or_starred
22274 if (p->error_indicator) {
22275 D(p->level--);
22276 return NULL;
22277 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022278 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 +010022279 Token * _literal;
22280 KeywordOrStarred* elem;
22281 while (
22282 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22283 &&
22284 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22285 )
22286 {
22287 _res = elem;
22288 if (_res == NULL && PyErr_Occurred()) {
22289 p->error_indicator = 1;
22290 PyMem_Free(_children);
22291 D(p->level--);
22292 return NULL;
22293 }
22294 if (_n == _children_capacity) {
22295 _children_capacity *= 2;
22296 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22297 if (!_new_children) {
22298 p->error_indicator = 1;
22299 PyErr_NoMemory();
22300 D(p->level--);
22301 return NULL;
22302 }
22303 _children = _new_children;
22304 }
22305 _children[_n++] = _res;
22306 _mark = p->mark;
22307 }
22308 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022309 D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022310 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22311 }
22312 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22313 if (!_seq) {
22314 PyMem_Free(_children);
22315 p->error_indicator = 1;
22316 PyErr_NoMemory();
22317 D(p->level--);
22318 return NULL;
22319 }
22320 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22321 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022322 _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022323 D(p->level--);
22324 return _seq;
22325}
22326
Pablo Galindo4a97b152020-09-02 17:44:19 +010022327// _gather_111: kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022328static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022329_gather_111_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022330{
22331 D(p->level++);
22332 if (p->error_indicator) {
22333 D(p->level--);
22334 return NULL;
22335 }
22336 asdl_seq * _res = NULL;
22337 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022338 { // kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022339 if (p->error_indicator) {
22340 D(p->level--);
22341 return NULL;
22342 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022343 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 +010022344 KeywordOrStarred* elem;
22345 asdl_seq * seq;
22346 if (
22347 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22348 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022349 (seq = _loop0_112_rule(p)) // _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022350 )
22351 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022352 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 +010022353 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22354 goto done;
22355 }
22356 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022357 D(fprintf(stderr, "%*c%s _gather_111[%d-%d]: %s failed!\n", p->level, ' ',
22358 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_112"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022359 }
22360 _res = NULL;
22361 done:
22362 D(p->level--);
22363 return _res;
22364}
22365
Pablo Galindo4a97b152020-09-02 17:44:19 +010022366// _loop0_114: ',' kwarg_or_double_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022367static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022368_loop0_114_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022369{
22370 D(p->level++);
22371 if (p->error_indicator) {
22372 D(p->level--);
22373 return NULL;
22374 }
22375 void *_res = NULL;
22376 int _mark = p->mark;
22377 int _start_mark = p->mark;
22378 void **_children = PyMem_Malloc(sizeof(void *));
22379 if (!_children) {
22380 p->error_indicator = 1;
22381 PyErr_NoMemory();
22382 D(p->level--);
22383 return NULL;
22384 }
22385 ssize_t _children_capacity = 1;
22386 ssize_t _n = 0;
22387 { // ',' kwarg_or_double_starred
22388 if (p->error_indicator) {
22389 D(p->level--);
22390 return NULL;
22391 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022392 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 +010022393 Token * _literal;
22394 KeywordOrStarred* elem;
22395 while (
22396 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22397 &&
22398 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22399 )
22400 {
22401 _res = elem;
22402 if (_res == NULL && PyErr_Occurred()) {
22403 p->error_indicator = 1;
22404 PyMem_Free(_children);
22405 D(p->level--);
22406 return NULL;
22407 }
22408 if (_n == _children_capacity) {
22409 _children_capacity *= 2;
22410 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22411 if (!_new_children) {
22412 p->error_indicator = 1;
22413 PyErr_NoMemory();
22414 D(p->level--);
22415 return NULL;
22416 }
22417 _children = _new_children;
22418 }
22419 _children[_n++] = _res;
22420 _mark = p->mark;
22421 }
22422 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022423 D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022424 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22425 }
22426 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22427 if (!_seq) {
22428 PyMem_Free(_children);
22429 p->error_indicator = 1;
22430 PyErr_NoMemory();
22431 D(p->level--);
22432 return NULL;
22433 }
22434 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22435 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022436 _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022437 D(p->level--);
22438 return _seq;
22439}
22440
Pablo Galindo4a97b152020-09-02 17:44:19 +010022441// _gather_113: kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022442static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022443_gather_113_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022444{
22445 D(p->level++);
22446 if (p->error_indicator) {
22447 D(p->level--);
22448 return NULL;
22449 }
22450 asdl_seq * _res = NULL;
22451 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022452 { // kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022453 if (p->error_indicator) {
22454 D(p->level--);
22455 return NULL;
22456 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022457 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 +010022458 KeywordOrStarred* elem;
22459 asdl_seq * seq;
22460 if (
22461 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22462 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022463 (seq = _loop0_114_rule(p)) // _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022464 )
22465 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022466 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 +010022467 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22468 goto done;
22469 }
22470 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022471 D(fprintf(stderr, "%*c%s _gather_113[%d-%d]: %s failed!\n", p->level, ' ',
22472 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_114"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022473 }
22474 _res = NULL;
22475 done:
22476 D(p->level--);
22477 return _res;
22478}
22479
Pablo Galindo4a97b152020-09-02 17:44:19 +010022480// _loop0_116: ',' kwarg_or_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022481static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022482_loop0_116_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022483{
22484 D(p->level++);
22485 if (p->error_indicator) {
22486 D(p->level--);
22487 return NULL;
22488 }
22489 void *_res = NULL;
22490 int _mark = p->mark;
22491 int _start_mark = p->mark;
22492 void **_children = PyMem_Malloc(sizeof(void *));
22493 if (!_children) {
22494 p->error_indicator = 1;
22495 PyErr_NoMemory();
22496 D(p->level--);
22497 return NULL;
22498 }
22499 ssize_t _children_capacity = 1;
22500 ssize_t _n = 0;
22501 { // ',' kwarg_or_starred
22502 if (p->error_indicator) {
22503 D(p->level--);
22504 return NULL;
22505 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022506 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 +010022507 Token * _literal;
22508 KeywordOrStarred* elem;
22509 while (
22510 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22511 &&
22512 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22513 )
22514 {
22515 _res = elem;
22516 if (_res == NULL && PyErr_Occurred()) {
22517 p->error_indicator = 1;
22518 PyMem_Free(_children);
22519 D(p->level--);
22520 return NULL;
22521 }
22522 if (_n == _children_capacity) {
22523 _children_capacity *= 2;
22524 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22525 if (!_new_children) {
22526 p->error_indicator = 1;
22527 PyErr_NoMemory();
22528 D(p->level--);
22529 return NULL;
22530 }
22531 _children = _new_children;
22532 }
22533 _children[_n++] = _res;
22534 _mark = p->mark;
22535 }
22536 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022537 D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022538 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22539 }
22540 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22541 if (!_seq) {
22542 PyMem_Free(_children);
22543 p->error_indicator = 1;
22544 PyErr_NoMemory();
22545 D(p->level--);
22546 return NULL;
22547 }
22548 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22549 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022550 _PyPegen_insert_memo(p, _start_mark, _loop0_116_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022551 D(p->level--);
22552 return _seq;
22553}
22554
Pablo Galindo4a97b152020-09-02 17:44:19 +010022555// _gather_115: kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022556static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022557_gather_115_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022558{
22559 D(p->level++);
22560 if (p->error_indicator) {
22561 D(p->level--);
22562 return NULL;
22563 }
22564 asdl_seq * _res = NULL;
22565 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022566 { // kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022567 if (p->error_indicator) {
22568 D(p->level--);
22569 return NULL;
22570 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022571 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 +010022572 KeywordOrStarred* elem;
22573 asdl_seq * seq;
22574 if (
22575 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22576 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022577 (seq = _loop0_116_rule(p)) // _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022578 )
22579 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022580 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 +010022581 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22582 goto done;
22583 }
22584 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022585 D(fprintf(stderr, "%*c%s _gather_115[%d-%d]: %s failed!\n", p->level, ' ',
22586 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_116"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022587 }
22588 _res = NULL;
22589 done:
22590 D(p->level--);
22591 return _res;
22592}
22593
Pablo Galindo4a97b152020-09-02 17:44:19 +010022594// _loop0_118: ',' kwarg_or_double_starred
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022595static asdl_seq *
22596_loop0_118_rule(Parser *p)
22597{
22598 D(p->level++);
22599 if (p->error_indicator) {
22600 D(p->level--);
22601 return NULL;
22602 }
22603 void *_res = NULL;
22604 int _mark = p->mark;
22605 int _start_mark = p->mark;
22606 void **_children = PyMem_Malloc(sizeof(void *));
22607 if (!_children) {
22608 p->error_indicator = 1;
22609 PyErr_NoMemory();
22610 D(p->level--);
22611 return NULL;
22612 }
22613 ssize_t _children_capacity = 1;
22614 ssize_t _n = 0;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022615 { // ',' kwarg_or_double_starred
22616 if (p->error_indicator) {
22617 D(p->level--);
22618 return NULL;
22619 }
22620 D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
22621 Token * _literal;
22622 KeywordOrStarred* elem;
22623 while (
22624 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22625 &&
22626 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22627 )
22628 {
22629 _res = elem;
22630 if (_res == NULL && PyErr_Occurred()) {
22631 p->error_indicator = 1;
22632 PyMem_Free(_children);
22633 D(p->level--);
22634 return NULL;
22635 }
22636 if (_n == _children_capacity) {
22637 _children_capacity *= 2;
22638 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22639 if (!_new_children) {
22640 p->error_indicator = 1;
22641 PyErr_NoMemory();
22642 D(p->level--);
22643 return NULL;
22644 }
22645 _children = _new_children;
22646 }
22647 _children[_n++] = _res;
22648 _mark = p->mark;
22649 }
22650 p->mark = _mark;
22651 D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ',
22652 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22653 }
22654 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22655 if (!_seq) {
22656 PyMem_Free(_children);
22657 p->error_indicator = 1;
22658 PyErr_NoMemory();
22659 D(p->level--);
22660 return NULL;
22661 }
22662 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22663 PyMem_Free(_children);
22664 _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq);
22665 D(p->level--);
22666 return _seq;
22667}
22668
22669// _gather_117: kwarg_or_double_starred _loop0_118
22670static asdl_seq *
22671_gather_117_rule(Parser *p)
22672{
22673 D(p->level++);
22674 if (p->error_indicator) {
22675 D(p->level--);
22676 return NULL;
22677 }
22678 asdl_seq * _res = NULL;
22679 int _mark = p->mark;
22680 { // kwarg_or_double_starred _loop0_118
22681 if (p->error_indicator) {
22682 D(p->level--);
22683 return NULL;
22684 }
22685 D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22686 KeywordOrStarred* elem;
22687 asdl_seq * seq;
22688 if (
22689 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22690 &&
22691 (seq = _loop0_118_rule(p)) // _loop0_118
22692 )
22693 {
22694 D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22695 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22696 goto done;
22697 }
22698 p->mark = _mark;
22699 D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ',
22700 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22701 }
22702 _res = NULL;
22703 done:
22704 D(p->level--);
22705 return _res;
22706}
22707
22708// _loop0_119: (',' star_target)
22709static asdl_seq *
22710_loop0_119_rule(Parser *p)
22711{
22712 D(p->level++);
22713 if (p->error_indicator) {
22714 D(p->level--);
22715 return NULL;
22716 }
22717 void *_res = NULL;
22718 int _mark = p->mark;
22719 int _start_mark = p->mark;
22720 void **_children = PyMem_Malloc(sizeof(void *));
22721 if (!_children) {
22722 p->error_indicator = 1;
22723 PyErr_NoMemory();
22724 D(p->level--);
22725 return NULL;
22726 }
22727 ssize_t _children_capacity = 1;
22728 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022729 { // (',' star_target)
22730 if (p->error_indicator) {
22731 D(p->level--);
22732 return NULL;
22733 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022734 D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
22735 void *_tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022736 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022737 (_tmp_150_var = _tmp_150_rule(p)) // ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022738 )
22739 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022740 _res = _tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022741 if (_n == _children_capacity) {
22742 _children_capacity *= 2;
22743 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22744 if (!_new_children) {
22745 p->error_indicator = 1;
22746 PyErr_NoMemory();
22747 D(p->level--);
22748 return NULL;
22749 }
22750 _children = _new_children;
22751 }
22752 _children[_n++] = _res;
22753 _mark = p->mark;
22754 }
22755 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022756 D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022757 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
22758 }
22759 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22760 if (!_seq) {
22761 PyMem_Free(_children);
22762 p->error_indicator = 1;
22763 PyErr_NoMemory();
22764 D(p->level--);
22765 return NULL;
22766 }
22767 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22768 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022769 _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022770 D(p->level--);
22771 return _seq;
22772}
22773
Pablo Galindo4a97b152020-09-02 17:44:19 +010022774// _loop0_121: ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022775static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022776_loop0_121_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022777{
22778 D(p->level++);
22779 if (p->error_indicator) {
22780 D(p->level--);
22781 return NULL;
22782 }
22783 void *_res = NULL;
22784 int _mark = p->mark;
22785 int _start_mark = p->mark;
22786 void **_children = PyMem_Malloc(sizeof(void *));
22787 if (!_children) {
22788 p->error_indicator = 1;
22789 PyErr_NoMemory();
22790 D(p->level--);
22791 return NULL;
22792 }
22793 ssize_t _children_capacity = 1;
22794 ssize_t _n = 0;
22795 { // ',' star_target
22796 if (p->error_indicator) {
22797 D(p->level--);
22798 return NULL;
22799 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022800 D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022801 Token * _literal;
22802 expr_ty elem;
22803 while (
22804 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22805 &&
22806 (elem = star_target_rule(p)) // star_target
22807 )
22808 {
22809 _res = elem;
22810 if (_res == NULL && PyErr_Occurred()) {
22811 p->error_indicator = 1;
22812 PyMem_Free(_children);
22813 D(p->level--);
22814 return NULL;
22815 }
22816 if (_n == _children_capacity) {
22817 _children_capacity *= 2;
22818 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22819 if (!_new_children) {
22820 p->error_indicator = 1;
22821 PyErr_NoMemory();
22822 D(p->level--);
22823 return NULL;
22824 }
22825 _children = _new_children;
22826 }
22827 _children[_n++] = _res;
22828 _mark = p->mark;
22829 }
22830 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022831 D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022832 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
22833 }
22834 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22835 if (!_seq) {
22836 PyMem_Free(_children);
22837 p->error_indicator = 1;
22838 PyErr_NoMemory();
22839 D(p->level--);
22840 return NULL;
22841 }
22842 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22843 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022844 _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022845 D(p->level--);
22846 return _seq;
22847}
22848
Pablo Galindo4a97b152020-09-02 17:44:19 +010022849// _gather_120: star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022850static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022851_gather_120_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022852{
22853 D(p->level++);
22854 if (p->error_indicator) {
22855 D(p->level--);
22856 return NULL;
22857 }
22858 asdl_seq * _res = NULL;
22859 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022860 { // star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022861 if (p->error_indicator) {
22862 D(p->level--);
22863 return NULL;
22864 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022865 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 +010022866 expr_ty elem;
22867 asdl_seq * seq;
22868 if (
22869 (elem = star_target_rule(p)) // star_target
22870 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022871 (seq = _loop0_121_rule(p)) // _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022872 )
22873 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022874 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 +010022875 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22876 goto done;
22877 }
22878 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022879 D(fprintf(stderr, "%*c%s _gather_120[%d-%d]: %s failed!\n", p->level, ' ',
22880 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_121"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022881 }
22882 _res = NULL;
22883 done:
22884 D(p->level--);
22885 return _res;
22886}
22887
Pablo Galindo4a97b152020-09-02 17:44:19 +010022888// _tmp_122: !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022889static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022890_tmp_122_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022891{
22892 D(p->level++);
22893 if (p->error_indicator) {
22894 D(p->level--);
22895 return NULL;
22896 }
22897 void * _res = NULL;
22898 int _mark = p->mark;
22899 { // !'*' star_target
22900 if (p->error_indicator) {
22901 D(p->level--);
22902 return NULL;
22903 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022904 D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022905 expr_ty star_target_var;
22906 if (
22907 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
22908 &&
22909 (star_target_var = star_target_rule(p)) // star_target
22910 )
22911 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022912 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 +010022913 _res = star_target_var;
22914 goto done;
22915 }
22916 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022917 D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022918 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
22919 }
22920 _res = NULL;
22921 done:
22922 D(p->level--);
22923 return _res;
22924}
22925
Pablo Galindo4a97b152020-09-02 17:44:19 +010022926// _loop0_124: ',' del_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022927static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022928_loop0_124_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022929{
22930 D(p->level++);
22931 if (p->error_indicator) {
22932 D(p->level--);
22933 return NULL;
22934 }
22935 void *_res = NULL;
22936 int _mark = p->mark;
22937 int _start_mark = p->mark;
22938 void **_children = PyMem_Malloc(sizeof(void *));
22939 if (!_children) {
22940 p->error_indicator = 1;
22941 PyErr_NoMemory();
22942 D(p->level--);
22943 return NULL;
22944 }
22945 ssize_t _children_capacity = 1;
22946 ssize_t _n = 0;
22947 { // ',' del_target
22948 if (p->error_indicator) {
22949 D(p->level--);
22950 return NULL;
22951 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022952 D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022953 Token * _literal;
22954 expr_ty elem;
22955 while (
22956 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22957 &&
22958 (elem = del_target_rule(p)) // del_target
22959 )
22960 {
22961 _res = elem;
22962 if (_res == NULL && PyErr_Occurred()) {
22963 p->error_indicator = 1;
22964 PyMem_Free(_children);
22965 D(p->level--);
22966 return NULL;
22967 }
22968 if (_n == _children_capacity) {
22969 _children_capacity *= 2;
22970 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22971 if (!_new_children) {
22972 p->error_indicator = 1;
22973 PyErr_NoMemory();
22974 D(p->level--);
22975 return NULL;
22976 }
22977 _children = _new_children;
22978 }
22979 _children[_n++] = _res;
22980 _mark = p->mark;
22981 }
22982 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022983 D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022984 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
22985 }
22986 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22987 if (!_seq) {
22988 PyMem_Free(_children);
22989 p->error_indicator = 1;
22990 PyErr_NoMemory();
22991 D(p->level--);
22992 return NULL;
22993 }
22994 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22995 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022996 _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022997 D(p->level--);
22998 return _seq;
22999}
23000
Pablo Galindo4a97b152020-09-02 17:44:19 +010023001// _gather_123: del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023002static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023003_gather_123_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023004{
23005 D(p->level++);
23006 if (p->error_indicator) {
23007 D(p->level--);
23008 return NULL;
23009 }
23010 asdl_seq * _res = NULL;
23011 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023012 { // del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023013 if (p->error_indicator) {
23014 D(p->level--);
23015 return NULL;
23016 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023017 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 +010023018 expr_ty elem;
23019 asdl_seq * seq;
23020 if (
23021 (elem = del_target_rule(p)) // del_target
23022 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023023 (seq = _loop0_124_rule(p)) // _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023024 )
23025 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023026 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 +010023027 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23028 goto done;
23029 }
23030 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023031 D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ',
23032 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_124"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023033 }
23034 _res = NULL;
23035 done:
23036 D(p->level--);
23037 return _res;
23038}
23039
Pablo Galindo4a97b152020-09-02 17:44:19 +010023040// _loop0_126: ',' target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023041static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023042_loop0_126_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023043{
23044 D(p->level++);
23045 if (p->error_indicator) {
23046 D(p->level--);
23047 return NULL;
23048 }
23049 void *_res = NULL;
23050 int _mark = p->mark;
23051 int _start_mark = p->mark;
23052 void **_children = PyMem_Malloc(sizeof(void *));
23053 if (!_children) {
23054 p->error_indicator = 1;
23055 PyErr_NoMemory();
23056 D(p->level--);
23057 return NULL;
23058 }
23059 ssize_t _children_capacity = 1;
23060 ssize_t _n = 0;
23061 { // ',' target
23062 if (p->error_indicator) {
23063 D(p->level--);
23064 return NULL;
23065 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023066 D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023067 Token * _literal;
23068 expr_ty elem;
23069 while (
23070 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23071 &&
23072 (elem = target_rule(p)) // target
23073 )
23074 {
23075 _res = elem;
23076 if (_res == NULL && PyErr_Occurred()) {
23077 p->error_indicator = 1;
23078 PyMem_Free(_children);
23079 D(p->level--);
23080 return NULL;
23081 }
23082 if (_n == _children_capacity) {
23083 _children_capacity *= 2;
23084 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23085 if (!_new_children) {
23086 p->error_indicator = 1;
23087 PyErr_NoMemory();
23088 D(p->level--);
23089 return NULL;
23090 }
23091 _children = _new_children;
23092 }
23093 _children[_n++] = _res;
23094 _mark = p->mark;
23095 }
23096 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023097 D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023098 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target"));
23099 }
23100 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23101 if (!_seq) {
23102 PyMem_Free(_children);
23103 p->error_indicator = 1;
23104 PyErr_NoMemory();
23105 D(p->level--);
23106 return NULL;
23107 }
23108 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23109 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023110 _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023111 D(p->level--);
23112 return _seq;
23113}
23114
Pablo Galindo4a97b152020-09-02 17:44:19 +010023115// _gather_125: target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023116static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023117_gather_125_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023118{
23119 D(p->level++);
23120 if (p->error_indicator) {
23121 D(p->level--);
23122 return NULL;
23123 }
23124 asdl_seq * _res = NULL;
23125 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023126 { // target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023127 if (p->error_indicator) {
23128 D(p->level--);
23129 return NULL;
23130 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023131 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 +010023132 expr_ty elem;
23133 asdl_seq * seq;
23134 if (
23135 (elem = target_rule(p)) // target
23136 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023137 (seq = _loop0_126_rule(p)) // _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023138 )
23139 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023140 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 +010023141 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23142 goto done;
23143 }
23144 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023145 D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ',
23146 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_126"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023147 }
23148 _res = NULL;
23149 done:
23150 D(p->level--);
23151 return _res;
23152}
23153
Pablo Galindo4a97b152020-09-02 17:44:19 +010023154// _tmp_127: args | expression for_if_clauses
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023155static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023156_tmp_127_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023157{
23158 D(p->level++);
23159 if (p->error_indicator) {
23160 D(p->level--);
23161 return NULL;
23162 }
23163 void * _res = NULL;
23164 int _mark = p->mark;
23165 { // args
23166 if (p->error_indicator) {
23167 D(p->level--);
23168 return NULL;
23169 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023170 D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023171 expr_ty args_var;
23172 if (
23173 (args_var = args_rule(p)) // args
23174 )
23175 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023176 D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023177 _res = args_var;
23178 goto done;
23179 }
23180 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023181 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023182 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
23183 }
23184 { // expression for_if_clauses
23185 if (p->error_indicator) {
23186 D(p->level--);
23187 return NULL;
23188 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023189 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 +010023190 expr_ty expression_var;
23191 asdl_seq* for_if_clauses_var;
23192 if (
23193 (expression_var = expression_rule(p)) // expression
23194 &&
23195 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
23196 )
23197 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023198 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 +010023199 _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
23200 goto done;
23201 }
23202 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023203 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023204 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
23205 }
23206 _res = NULL;
23207 done:
23208 D(p->level--);
23209 return _res;
23210}
23211
Pablo Galindo4a97b152020-09-02 17:44:19 +010023212// _loop0_128: star_named_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023213static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023214_loop0_128_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023215{
23216 D(p->level++);
23217 if (p->error_indicator) {
23218 D(p->level--);
23219 return NULL;
23220 }
23221 void *_res = NULL;
23222 int _mark = p->mark;
23223 int _start_mark = p->mark;
23224 void **_children = PyMem_Malloc(sizeof(void *));
23225 if (!_children) {
23226 p->error_indicator = 1;
23227 PyErr_NoMemory();
23228 D(p->level--);
23229 return NULL;
23230 }
23231 ssize_t _children_capacity = 1;
23232 ssize_t _n = 0;
23233 { // star_named_expressions
23234 if (p->error_indicator) {
23235 D(p->level--);
23236 return NULL;
23237 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023238 D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023239 asdl_seq* star_named_expressions_var;
23240 while (
23241 (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions
23242 )
23243 {
23244 _res = star_named_expressions_var;
23245 if (_n == _children_capacity) {
23246 _children_capacity *= 2;
23247 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23248 if (!_new_children) {
23249 p->error_indicator = 1;
23250 PyErr_NoMemory();
23251 D(p->level--);
23252 return NULL;
23253 }
23254 _children = _new_children;
23255 }
23256 _children[_n++] = _res;
23257 _mark = p->mark;
23258 }
23259 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023260 D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010023261 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023262 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023263 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23264 if (!_seq) {
23265 PyMem_Free(_children);
23266 p->error_indicator = 1;
23267 PyErr_NoMemory();
23268 D(p->level--);
23269 return NULL;
23270 }
23271 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23272 PyMem_Free(_children);
23273 _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023274 D(p->level--);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023275 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023276}
23277
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023278// _loop0_129: (star_targets '=')
23279static asdl_seq *
23280_loop0_129_rule(Parser *p)
23281{
23282 D(p->level++);
23283 if (p->error_indicator) {
23284 D(p->level--);
23285 return NULL;
23286 }
23287 void *_res = NULL;
23288 int _mark = p->mark;
23289 int _start_mark = p->mark;
23290 void **_children = PyMem_Malloc(sizeof(void *));
23291 if (!_children) {
23292 p->error_indicator = 1;
23293 PyErr_NoMemory();
23294 D(p->level--);
23295 return NULL;
23296 }
23297 ssize_t _children_capacity = 1;
23298 ssize_t _n = 0;
23299 { // (star_targets '=')
23300 if (p->error_indicator) {
23301 D(p->level--);
23302 return NULL;
23303 }
23304 D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010023305 void *_tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023306 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023307 (_tmp_151_var = _tmp_151_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023308 )
23309 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023310 _res = _tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023311 if (_n == _children_capacity) {
23312 _children_capacity *= 2;
23313 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23314 if (!_new_children) {
23315 p->error_indicator = 1;
23316 PyErr_NoMemory();
23317 D(p->level--);
23318 return NULL;
23319 }
23320 _children = _new_children;
23321 }
23322 _children[_n++] = _res;
23323 _mark = p->mark;
23324 }
23325 p->mark = _mark;
23326 D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
23327 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23328 }
23329 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23330 if (!_seq) {
23331 PyMem_Free(_children);
23332 p->error_indicator = 1;
23333 PyErr_NoMemory();
23334 D(p->level--);
23335 return NULL;
23336 }
23337 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23338 PyMem_Free(_children);
23339 _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq);
23340 D(p->level--);
23341 return _seq;
23342}
23343
Pablo Galindo4a97b152020-09-02 17:44:19 +010023344// _loop0_130: (star_targets '=')
23345static asdl_seq *
23346_loop0_130_rule(Parser *p)
23347{
23348 D(p->level++);
23349 if (p->error_indicator) {
23350 D(p->level--);
23351 return NULL;
23352 }
23353 void *_res = NULL;
23354 int _mark = p->mark;
23355 int _start_mark = p->mark;
23356 void **_children = PyMem_Malloc(sizeof(void *));
23357 if (!_children) {
23358 p->error_indicator = 1;
23359 PyErr_NoMemory();
23360 D(p->level--);
23361 return NULL;
23362 }
23363 ssize_t _children_capacity = 1;
23364 ssize_t _n = 0;
23365 { // (star_targets '=')
23366 if (p->error_indicator) {
23367 D(p->level--);
23368 return NULL;
23369 }
23370 D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
23371 void *_tmp_152_var;
23372 while (
23373 (_tmp_152_var = _tmp_152_rule(p)) // star_targets '='
23374 )
23375 {
23376 _res = _tmp_152_var;
23377 if (_n == _children_capacity) {
23378 _children_capacity *= 2;
23379 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23380 if (!_new_children) {
23381 p->error_indicator = 1;
23382 PyErr_NoMemory();
23383 D(p->level--);
23384 return NULL;
23385 }
23386 _children = _new_children;
23387 }
23388 _children[_n++] = _res;
23389 _mark = p->mark;
23390 }
23391 p->mark = _mark;
23392 D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ',
23393 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23394 }
23395 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23396 if (!_seq) {
23397 PyMem_Free(_children);
23398 p->error_indicator = 1;
23399 PyErr_NoMemory();
23400 D(p->level--);
23401 return NULL;
23402 }
23403 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23404 PyMem_Free(_children);
23405 _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq);
23406 D(p->level--);
23407 return _seq;
23408}
23409
23410// _tmp_131: yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023411static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023412_tmp_131_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023413{
23414 D(p->level++);
23415 if (p->error_indicator) {
23416 D(p->level--);
23417 return NULL;
23418 }
23419 void * _res = NULL;
23420 int _mark = p->mark;
23421 { // yield_expr
23422 if (p->error_indicator) {
23423 D(p->level--);
23424 return NULL;
23425 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023426 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023427 expr_ty yield_expr_var;
23428 if (
23429 (yield_expr_var = yield_expr_rule(p)) // yield_expr
23430 )
23431 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023432 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 +010023433 _res = yield_expr_var;
23434 goto done;
23435 }
23436 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023437 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023438 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
23439 }
23440 { // star_expressions
23441 if (p->error_indicator) {
23442 D(p->level--);
23443 return NULL;
23444 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023445 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023446 expr_ty star_expressions_var;
23447 if (
23448 (star_expressions_var = star_expressions_rule(p)) // star_expressions
23449 )
23450 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023451 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 +010023452 _res = star_expressions_var;
23453 goto done;
23454 }
23455 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023456 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023457 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
23458 }
23459 _res = NULL;
23460 done:
23461 D(p->level--);
23462 return _res;
23463}
23464
Pablo Galindo4a97b152020-09-02 17:44:19 +010023465// _tmp_132: '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023466static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023467_tmp_132_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023468{
23469 D(p->level++);
23470 if (p->error_indicator) {
23471 D(p->level--);
23472 return NULL;
23473 }
23474 void * _res = NULL;
23475 int _mark = p->mark;
23476 { // '['
23477 if (p->error_indicator) {
23478 D(p->level--);
23479 return NULL;
23480 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023481 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023482 Token * _literal;
23483 if (
23484 (_literal = _PyPegen_expect_token(p, 9)) // token='['
23485 )
23486 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023487 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023488 _res = _literal;
23489 goto done;
23490 }
23491 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023492 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023493 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
23494 }
23495 { // '('
23496 if (p->error_indicator) {
23497 D(p->level--);
23498 return NULL;
23499 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023500 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023501 Token * _literal;
23502 if (
23503 (_literal = _PyPegen_expect_token(p, 7)) // token='('
23504 )
23505 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023506 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023507 _res = _literal;
23508 goto done;
23509 }
23510 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023511 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023512 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
23513 }
23514 { // '{'
23515 if (p->error_indicator) {
23516 D(p->level--);
23517 return NULL;
23518 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023519 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023520 Token * _literal;
23521 if (
23522 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
23523 )
23524 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023525 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023526 _res = _literal;
23527 goto done;
23528 }
23529 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023530 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023531 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
23532 }
23533 _res = NULL;
23534 done:
23535 D(p->level--);
23536 return _res;
23537}
23538
Pablo Galindo4a97b152020-09-02 17:44:19 +010023539// _loop0_133: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023540static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023541_loop0_133_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023542{
23543 D(p->level++);
23544 if (p->error_indicator) {
23545 D(p->level--);
23546 return NULL;
23547 }
23548 void *_res = NULL;
23549 int _mark = p->mark;
23550 int _start_mark = p->mark;
23551 void **_children = PyMem_Malloc(sizeof(void *));
23552 if (!_children) {
23553 p->error_indicator = 1;
23554 PyErr_NoMemory();
23555 D(p->level--);
23556 return NULL;
23557 }
23558 ssize_t _children_capacity = 1;
23559 ssize_t _n = 0;
23560 { // param_no_default
23561 if (p->error_indicator) {
23562 D(p->level--);
23563 return NULL;
23564 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023565 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 +010023566 arg_ty param_no_default_var;
23567 while (
23568 (param_no_default_var = param_no_default_rule(p)) // param_no_default
23569 )
23570 {
23571 _res = param_no_default_var;
23572 if (_n == _children_capacity) {
23573 _children_capacity *= 2;
23574 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23575 if (!_new_children) {
23576 p->error_indicator = 1;
23577 PyErr_NoMemory();
23578 D(p->level--);
23579 return NULL;
23580 }
23581 _children = _new_children;
23582 }
23583 _children[_n++] = _res;
23584 _mark = p->mark;
23585 }
23586 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023587 D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023588 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
23589 }
23590 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23591 if (!_seq) {
23592 PyMem_Free(_children);
23593 p->error_indicator = 1;
23594 PyErr_NoMemory();
23595 D(p->level--);
23596 return NULL;
23597 }
23598 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23599 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023600 _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023601 D(p->level--);
23602 return _seq;
23603}
23604
Pablo Galindo4a97b152020-09-02 17:44:19 +010023605// _tmp_134: slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023606static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023607_tmp_134_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023608{
23609 D(p->level++);
23610 if (p->error_indicator) {
23611 D(p->level--);
23612 return NULL;
23613 }
23614 void * _res = NULL;
23615 int _mark = p->mark;
23616 { // slash_with_default
23617 if (p->error_indicator) {
23618 D(p->level--);
23619 return NULL;
23620 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023621 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 +010023622 SlashWithDefault* slash_with_default_var;
23623 if (
23624 (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default
23625 )
23626 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023627 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 +010023628 _res = slash_with_default_var;
23629 goto done;
23630 }
23631 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023632 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023633 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
23634 }
23635 { // param_with_default+
23636 if (p->error_indicator) {
23637 D(p->level--);
23638 return NULL;
23639 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023640 D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23641 asdl_seq * _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023642 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023643 (_loop1_153_var = _loop1_153_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023644 )
23645 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023646 D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23647 _res = _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023648 goto done;
23649 }
23650 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023651 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023652 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
23653 }
23654 _res = NULL;
23655 done:
23656 D(p->level--);
23657 return _res;
23658}
23659
Pablo Galindo4a97b152020-09-02 17:44:19 +010023660// _loop0_135: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023661static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023662_loop0_135_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023663{
23664 D(p->level++);
23665 if (p->error_indicator) {
23666 D(p->level--);
23667 return NULL;
23668 }
23669 void *_res = NULL;
23670 int _mark = p->mark;
23671 int _start_mark = p->mark;
23672 void **_children = PyMem_Malloc(sizeof(void *));
23673 if (!_children) {
23674 p->error_indicator = 1;
23675 PyErr_NoMemory();
23676 D(p->level--);
23677 return NULL;
23678 }
23679 ssize_t _children_capacity = 1;
23680 ssize_t _n = 0;
23681 { // lambda_param_no_default
23682 if (p->error_indicator) {
23683 D(p->level--);
23684 return NULL;
23685 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023686 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 +010023687 arg_ty lambda_param_no_default_var;
23688 while (
23689 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
23690 )
23691 {
23692 _res = lambda_param_no_default_var;
23693 if (_n == _children_capacity) {
23694 _children_capacity *= 2;
23695 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23696 if (!_new_children) {
23697 p->error_indicator = 1;
23698 PyErr_NoMemory();
23699 D(p->level--);
23700 return NULL;
23701 }
23702 _children = _new_children;
23703 }
23704 _children[_n++] = _res;
23705 _mark = p->mark;
23706 }
23707 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023708 D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023709 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
23710 }
23711 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23712 if (!_seq) {
23713 PyMem_Free(_children);
23714 p->error_indicator = 1;
23715 PyErr_NoMemory();
23716 D(p->level--);
23717 return NULL;
23718 }
23719 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23720 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023721 _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023722 D(p->level--);
23723 return _seq;
23724}
23725
Pablo Galindo4a97b152020-09-02 17:44:19 +010023726// _tmp_136: lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023727static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023728_tmp_136_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023729{
23730 D(p->level++);
23731 if (p->error_indicator) {
23732 D(p->level--);
23733 return NULL;
23734 }
23735 void * _res = NULL;
23736 int _mark = p->mark;
23737 { // lambda_slash_with_default
23738 if (p->error_indicator) {
23739 D(p->level--);
23740 return NULL;
23741 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023742 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 +010023743 SlashWithDefault* lambda_slash_with_default_var;
23744 if (
23745 (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
23746 )
23747 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023748 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 +010023749 _res = lambda_slash_with_default_var;
23750 goto done;
23751 }
23752 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023753 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023754 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
23755 }
23756 { // lambda_param_with_default+
23757 if (p->error_indicator) {
23758 D(p->level--);
23759 return NULL;
23760 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023761 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23762 asdl_seq * _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023763 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023764 (_loop1_154_var = _loop1_154_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023765 )
23766 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023767 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23768 _res = _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023769 goto done;
23770 }
23771 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023772 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023773 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
23774 }
23775 _res = NULL;
23776 done:
23777 D(p->level--);
23778 return _res;
23779}
23780
Pablo Galindo4a97b152020-09-02 17:44:19 +010023781// _tmp_137: ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023782static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023783_tmp_137_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023784{
23785 D(p->level++);
23786 if (p->error_indicator) {
23787 D(p->level--);
23788 return NULL;
23789 }
23790 void * _res = NULL;
23791 int _mark = p->mark;
23792 { // ')'
23793 if (p->error_indicator) {
23794 D(p->level--);
23795 return NULL;
23796 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023797 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023798 Token * _literal;
23799 if (
23800 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
23801 )
23802 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023803 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023804 _res = _literal;
23805 goto done;
23806 }
23807 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023808 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023809 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
23810 }
23811 { // ',' (')' | '**')
23812 if (p->error_indicator) {
23813 D(p->level--);
23814 return NULL;
23815 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023816 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023817 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023818 void *_tmp_155_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023819 if (
23820 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23821 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023822 (_tmp_155_var = _tmp_155_rule(p)) // ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023823 )
23824 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023825 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
23826 _res = _PyPegen_dummy_name(p, _literal, _tmp_155_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023827 goto done;
23828 }
23829 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023830 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023831 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
23832 }
23833 _res = NULL;
23834 done:
23835 D(p->level--);
23836 return _res;
23837}
23838
Pablo Galindo4a97b152020-09-02 17:44:19 +010023839// _tmp_138: ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023840static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023841_tmp_138_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023842{
23843 D(p->level++);
23844 if (p->error_indicator) {
23845 D(p->level--);
23846 return NULL;
23847 }
23848 void * _res = NULL;
23849 int _mark = p->mark;
23850 { // ':'
23851 if (p->error_indicator) {
23852 D(p->level--);
23853 return NULL;
23854 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023855 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023856 Token * _literal;
23857 if (
23858 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
23859 )
23860 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023861 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023862 _res = _literal;
23863 goto done;
23864 }
23865 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023866 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023867 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
23868 }
23869 { // ',' (':' | '**')
23870 if (p->error_indicator) {
23871 D(p->level--);
23872 return NULL;
23873 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023874 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023875 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023876 void *_tmp_156_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023877 if (
23878 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23879 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023880 (_tmp_156_var = _tmp_156_rule(p)) // ':' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023881 )
23882 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023883 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
23884 _res = _PyPegen_dummy_name(p, _literal, _tmp_156_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023885 goto done;
23886 }
23887 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023888 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023889 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
23890 }
23891 _res = NULL;
23892 done:
23893 D(p->level--);
23894 return _res;
23895}
23896
Pablo Galindo4a97b152020-09-02 17:44:19 +010023897// _tmp_139: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023898static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023899_tmp_139_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023900{
23901 D(p->level++);
23902 if (p->error_indicator) {
23903 D(p->level--);
23904 return NULL;
23905 }
23906 void * _res = NULL;
23907 int _mark = p->mark;
23908 { // star_targets '='
23909 if (p->error_indicator) {
23910 D(p->level--);
23911 return NULL;
23912 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023913 D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023914 Token * _literal;
23915 expr_ty z;
23916 if (
23917 (z = star_targets_rule(p)) // star_targets
23918 &&
23919 (_literal = _PyPegen_expect_token(p, 22)) // token='='
23920 )
23921 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023922 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 +010023923 _res = z;
23924 if (_res == NULL && PyErr_Occurred()) {
23925 p->error_indicator = 1;
23926 D(p->level--);
23927 return NULL;
23928 }
23929 goto done;
23930 }
23931 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023932 D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023933 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
23934 }
23935 _res = NULL;
23936 done:
23937 D(p->level--);
23938 return _res;
23939}
23940
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023941// _tmp_140: '.' | '...'
23942static void *
23943_tmp_140_rule(Parser *p)
23944{
23945 D(p->level++);
23946 if (p->error_indicator) {
23947 D(p->level--);
23948 return NULL;
23949 }
23950 void * _res = NULL;
23951 int _mark = p->mark;
23952 { // '.'
23953 if (p->error_indicator) {
23954 D(p->level--);
23955 return NULL;
23956 }
23957 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
23958 Token * _literal;
23959 if (
23960 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
23961 )
23962 {
23963 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
23964 _res = _literal;
23965 goto done;
23966 }
23967 p->mark = _mark;
23968 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
23969 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
23970 }
23971 { // '...'
23972 if (p->error_indicator) {
23973 D(p->level--);
23974 return NULL;
23975 }
23976 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
23977 Token * _literal;
23978 if (
23979 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
23980 )
23981 {
23982 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
23983 _res = _literal;
23984 goto done;
23985 }
23986 p->mark = _mark;
23987 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
23988 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
23989 }
23990 _res = NULL;
23991 done:
23992 D(p->level--);
23993 return _res;
23994}
23995
Pablo Galindo4a97b152020-09-02 17:44:19 +010023996// _tmp_141: '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023997static void *
23998_tmp_141_rule(Parser *p)
23999{
24000 D(p->level++);
24001 if (p->error_indicator) {
24002 D(p->level--);
24003 return NULL;
24004 }
24005 void * _res = NULL;
24006 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024007 { // '.'
24008 if (p->error_indicator) {
24009 D(p->level--);
24010 return NULL;
24011 }
24012 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
24013 Token * _literal;
24014 if (
24015 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
24016 )
24017 {
24018 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
24019 _res = _literal;
24020 goto done;
24021 }
24022 p->mark = _mark;
24023 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24024 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
24025 }
24026 { // '...'
24027 if (p->error_indicator) {
24028 D(p->level--);
24029 return NULL;
24030 }
24031 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
24032 Token * _literal;
24033 if (
24034 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
24035 )
24036 {
24037 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
24038 _res = _literal;
24039 goto done;
24040 }
24041 p->mark = _mark;
24042 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24043 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
24044 }
24045 _res = NULL;
24046 done:
24047 D(p->level--);
24048 return _res;
24049}
24050
24051// _tmp_142: '@' named_expression NEWLINE
24052static void *
24053_tmp_142_rule(Parser *p)
24054{
24055 D(p->level++);
24056 if (p->error_indicator) {
24057 D(p->level--);
24058 return NULL;
24059 }
24060 void * _res = NULL;
24061 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024062 { // '@' named_expression NEWLINE
24063 if (p->error_indicator) {
24064 D(p->level--);
24065 return NULL;
24066 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024067 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 +010024068 Token * _literal;
24069 expr_ty f;
24070 Token * newline_var;
24071 if (
24072 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
24073 &&
24074 (f = named_expression_rule(p)) // named_expression
24075 &&
24076 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
24077 )
24078 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024079 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 +010024080 _res = f;
24081 if (_res == NULL && PyErr_Occurred()) {
24082 p->error_indicator = 1;
24083 D(p->level--);
24084 return NULL;
24085 }
24086 goto done;
24087 }
24088 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024089 D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024090 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
24091 }
24092 _res = NULL;
24093 done:
24094 D(p->level--);
24095 return _res;
24096}
24097
Pablo Galindo4a97b152020-09-02 17:44:19 +010024098// _tmp_143: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024099static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024100_tmp_143_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024101{
24102 D(p->level++);
24103 if (p->error_indicator) {
24104 D(p->level--);
24105 return NULL;
24106 }
24107 void * _res = NULL;
24108 int _mark = p->mark;
24109 { // ',' star_expression
24110 if (p->error_indicator) {
24111 D(p->level--);
24112 return NULL;
24113 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024114 D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024115 Token * _literal;
24116 expr_ty c;
24117 if (
24118 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24119 &&
24120 (c = star_expression_rule(p)) // star_expression
24121 )
24122 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024123 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 +010024124 _res = c;
24125 if (_res == NULL && PyErr_Occurred()) {
24126 p->error_indicator = 1;
24127 D(p->level--);
24128 return NULL;
24129 }
24130 goto done;
24131 }
24132 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024133 D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024134 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
24135 }
24136 _res = NULL;
24137 done:
24138 D(p->level--);
24139 return _res;
24140}
24141
Pablo Galindo4a97b152020-09-02 17:44:19 +010024142// _tmp_144: ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024143static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024144_tmp_144_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024145{
24146 D(p->level++);
24147 if (p->error_indicator) {
24148 D(p->level--);
24149 return NULL;
24150 }
24151 void * _res = NULL;
24152 int _mark = p->mark;
24153 { // ',' expression
24154 if (p->error_indicator) {
24155 D(p->level--);
24156 return NULL;
24157 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024158 D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024159 Token * _literal;
24160 expr_ty c;
24161 if (
24162 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24163 &&
24164 (c = expression_rule(p)) // expression
24165 )
24166 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024167 D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024168 _res = c;
24169 if (_res == NULL && PyErr_Occurred()) {
24170 p->error_indicator = 1;
24171 D(p->level--);
24172 return NULL;
24173 }
24174 goto done;
24175 }
24176 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024177 D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024178 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
24179 }
24180 _res = NULL;
24181 done:
24182 D(p->level--);
24183 return _res;
24184}
24185
Pablo Galindo4a97b152020-09-02 17:44:19 +010024186// _tmp_145: 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024187static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024188_tmp_145_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024189{
24190 D(p->level++);
24191 if (p->error_indicator) {
24192 D(p->level--);
24193 return NULL;
24194 }
24195 void * _res = NULL;
24196 int _mark = p->mark;
24197 { // 'or' conjunction
24198 if (p->error_indicator) {
24199 D(p->level--);
24200 return NULL;
24201 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024202 D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024203 Token * _keyword;
24204 expr_ty c;
24205 if (
24206 (_keyword = _PyPegen_expect_token(p, 531)) // token='or'
24207 &&
24208 (c = conjunction_rule(p)) // conjunction
24209 )
24210 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024211 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 +010024212 _res = c;
24213 if (_res == NULL && PyErr_Occurred()) {
24214 p->error_indicator = 1;
24215 D(p->level--);
24216 return NULL;
24217 }
24218 goto done;
24219 }
24220 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024221 D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024222 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
24223 }
24224 _res = NULL;
24225 done:
24226 D(p->level--);
24227 return _res;
24228}
24229
Pablo Galindo4a97b152020-09-02 17:44:19 +010024230// _tmp_146: 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024231static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024232_tmp_146_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024233{
24234 D(p->level++);
24235 if (p->error_indicator) {
24236 D(p->level--);
24237 return NULL;
24238 }
24239 void * _res = NULL;
24240 int _mark = p->mark;
24241 { // 'and' inversion
24242 if (p->error_indicator) {
24243 D(p->level--);
24244 return NULL;
24245 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024246 D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024247 Token * _keyword;
24248 expr_ty c;
24249 if (
24250 (_keyword = _PyPegen_expect_token(p, 532)) // token='and'
24251 &&
24252 (c = inversion_rule(p)) // inversion
24253 )
24254 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024255 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 +010024256 _res = c;
24257 if (_res == NULL && PyErr_Occurred()) {
24258 p->error_indicator = 1;
24259 D(p->level--);
24260 return NULL;
24261 }
24262 goto done;
24263 }
24264 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024265 D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010024266 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024267 }
24268 _res = NULL;
24269 done:
24270 D(p->level--);
24271 return _res;
24272}
24273
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024274// _tmp_147: 'if' disjunction
24275static void *
24276_tmp_147_rule(Parser *p)
24277{
24278 D(p->level++);
24279 if (p->error_indicator) {
24280 D(p->level--);
24281 return NULL;
24282 }
24283 void * _res = NULL;
24284 int _mark = p->mark;
24285 { // 'if' disjunction
24286 if (p->error_indicator) {
24287 D(p->level--);
24288 return NULL;
24289 }
24290 D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24291 Token * _keyword;
24292 expr_ty z;
24293 if (
24294 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24295 &&
24296 (z = disjunction_rule(p)) // disjunction
24297 )
24298 {
24299 D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24300 _res = z;
24301 if (_res == NULL && PyErr_Occurred()) {
24302 p->error_indicator = 1;
24303 D(p->level--);
24304 return NULL;
24305 }
24306 goto done;
24307 }
24308 p->mark = _mark;
24309 D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
24310 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24311 }
24312 _res = NULL;
24313 done:
24314 D(p->level--);
24315 return _res;
24316}
24317
Pablo Galindo4a97b152020-09-02 17:44:19 +010024318// _tmp_148: 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024319static void *
24320_tmp_148_rule(Parser *p)
24321{
24322 D(p->level++);
24323 if (p->error_indicator) {
24324 D(p->level--);
24325 return NULL;
24326 }
24327 void * _res = NULL;
24328 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024329 { // 'if' disjunction
24330 if (p->error_indicator) {
24331 D(p->level--);
24332 return NULL;
24333 }
24334 D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24335 Token * _keyword;
24336 expr_ty z;
24337 if (
24338 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24339 &&
24340 (z = disjunction_rule(p)) // disjunction
24341 )
24342 {
24343 D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24344 _res = z;
24345 if (_res == NULL && PyErr_Occurred()) {
24346 p->error_indicator = 1;
24347 D(p->level--);
24348 return NULL;
24349 }
24350 goto done;
24351 }
24352 p->mark = _mark;
24353 D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
24354 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24355 }
24356 _res = NULL;
24357 done:
24358 D(p->level--);
24359 return _res;
24360}
24361
24362// _tmp_149: starred_expression | named_expression !'='
24363static void *
24364_tmp_149_rule(Parser *p)
24365{
24366 D(p->level++);
24367 if (p->error_indicator) {
24368 D(p->level--);
24369 return NULL;
24370 }
24371 void * _res = NULL;
24372 int _mark = p->mark;
24373 { // starred_expression
24374 if (p->error_indicator) {
24375 D(p->level--);
24376 return NULL;
24377 }
24378 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24379 expr_ty starred_expression_var;
24380 if (
24381 (starred_expression_var = starred_expression_rule(p)) // starred_expression
24382 )
24383 {
24384 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24385 _res = starred_expression_var;
24386 goto done;
24387 }
24388 p->mark = _mark;
24389 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24390 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
24391 }
24392 { // named_expression !'='
24393 if (p->error_indicator) {
24394 D(p->level--);
24395 return NULL;
24396 }
24397 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24398 expr_ty named_expression_var;
24399 if (
24400 (named_expression_var = named_expression_rule(p)) // named_expression
24401 &&
24402 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
24403 )
24404 {
24405 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24406 _res = named_expression_var;
24407 goto done;
24408 }
24409 p->mark = _mark;
24410 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24411 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='"));
24412 }
24413 _res = NULL;
24414 done:
24415 D(p->level--);
24416 return _res;
24417}
24418
24419// _tmp_150: ',' star_target
24420static void *
24421_tmp_150_rule(Parser *p)
24422{
24423 D(p->level++);
24424 if (p->error_indicator) {
24425 D(p->level--);
24426 return NULL;
24427 }
24428 void * _res = NULL;
24429 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024430 { // ',' star_target
24431 if (p->error_indicator) {
24432 D(p->level--);
24433 return NULL;
24434 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024435 D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024436 Token * _literal;
24437 expr_ty c;
24438 if (
24439 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24440 &&
24441 (c = star_target_rule(p)) // star_target
24442 )
24443 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024444 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 +010024445 _res = c;
24446 if (_res == NULL && PyErr_Occurred()) {
24447 p->error_indicator = 1;
24448 D(p->level--);
24449 return NULL;
24450 }
24451 goto done;
24452 }
24453 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024454 D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030024455 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024456 }
24457 _res = NULL;
24458 done:
24459 D(p->level--);
24460 return _res;
24461}
24462
Pablo Galindo4a97b152020-09-02 17:44:19 +010024463// _tmp_151: star_targets '='
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024464static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024465_tmp_151_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024466{
24467 D(p->level++);
24468 if (p->error_indicator) {
24469 D(p->level--);
24470 return NULL;
24471 }
24472 void * _res = NULL;
24473 int _mark = p->mark;
24474 { // star_targets '='
24475 if (p->error_indicator) {
24476 D(p->level--);
24477 return NULL;
24478 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024479 D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024480 Token * _literal;
24481 expr_ty star_targets_var;
24482 if (
24483 (star_targets_var = star_targets_rule(p)) // star_targets
24484 &&
24485 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24486 )
24487 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024488 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 +030024489 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24490 goto done;
24491 }
24492 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024493 D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024494 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24495 }
24496 _res = NULL;
24497 done:
24498 D(p->level--);
24499 return _res;
24500}
24501
Pablo Galindo4a97b152020-09-02 17:44:19 +010024502// _tmp_152: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024503static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024504_tmp_152_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024505{
24506 D(p->level++);
24507 if (p->error_indicator) {
24508 D(p->level--);
24509 return NULL;
24510 }
24511 void * _res = NULL;
24512 int _mark = p->mark;
24513 { // star_targets '='
24514 if (p->error_indicator) {
24515 D(p->level--);
24516 return NULL;
24517 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024518 D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024519 Token * _literal;
24520 expr_ty star_targets_var;
24521 if (
24522 (star_targets_var = star_targets_rule(p)) // star_targets
24523 &&
24524 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24525 )
24526 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024527 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 +010024528 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24529 goto done;
24530 }
24531 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024532 D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024533 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24534 }
24535 _res = NULL;
24536 done:
24537 D(p->level--);
24538 return _res;
24539}
24540
Pablo Galindo4a97b152020-09-02 17:44:19 +010024541// _loop1_153: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024542static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024543_loop1_153_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024544{
24545 D(p->level++);
24546 if (p->error_indicator) {
24547 D(p->level--);
24548 return NULL;
24549 }
24550 void *_res = NULL;
24551 int _mark = p->mark;
24552 int _start_mark = p->mark;
24553 void **_children = PyMem_Malloc(sizeof(void *));
24554 if (!_children) {
24555 p->error_indicator = 1;
24556 PyErr_NoMemory();
24557 D(p->level--);
24558 return NULL;
24559 }
24560 ssize_t _children_capacity = 1;
24561 ssize_t _n = 0;
24562 { // param_with_default
24563 if (p->error_indicator) {
24564 D(p->level--);
24565 return NULL;
24566 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024567 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 +010024568 NameDefaultPair* param_with_default_var;
24569 while (
24570 (param_with_default_var = param_with_default_rule(p)) // param_with_default
24571 )
24572 {
24573 _res = param_with_default_var;
24574 if (_n == _children_capacity) {
24575 _children_capacity *= 2;
24576 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24577 if (!_new_children) {
24578 p->error_indicator = 1;
24579 PyErr_NoMemory();
24580 D(p->level--);
24581 return NULL;
24582 }
24583 _children = _new_children;
24584 }
24585 _children[_n++] = _res;
24586 _mark = p->mark;
24587 }
24588 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024589 D(fprintf(stderr, "%*c%s _loop1_153[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024590 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
24591 }
24592 if (_n == 0 || p->error_indicator) {
24593 PyMem_Free(_children);
24594 D(p->level--);
24595 return NULL;
24596 }
24597 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
24598 if (!_seq) {
24599 PyMem_Free(_children);
24600 p->error_indicator = 1;
24601 PyErr_NoMemory();
24602 D(p->level--);
24603 return NULL;
24604 }
24605 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
24606 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024607 _PyPegen_insert_memo(p, _start_mark, _loop1_153_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024608 D(p->level--);
24609 return _seq;
24610}
24611
Pablo Galindo4a97b152020-09-02 17:44:19 +010024612// _loop1_154: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024613static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024614_loop1_154_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024615{
24616 D(p->level++);
24617 if (p->error_indicator) {
24618 D(p->level--);
24619 return NULL;
24620 }
24621 void *_res = NULL;
24622 int _mark = p->mark;
24623 int _start_mark = p->mark;
24624 void **_children = PyMem_Malloc(sizeof(void *));
24625 if (!_children) {
24626 p->error_indicator = 1;
24627 PyErr_NoMemory();
24628 D(p->level--);
24629 return NULL;
24630 }
24631 ssize_t _children_capacity = 1;
24632 ssize_t _n = 0;
24633 { // lambda_param_with_default
24634 if (p->error_indicator) {
24635 D(p->level--);
24636 return NULL;
24637 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024638 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 +010024639 NameDefaultPair* lambda_param_with_default_var;
24640 while (
24641 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
24642 )
24643 {
24644 _res = lambda_param_with_default_var;
24645 if (_n == _children_capacity) {
24646 _children_capacity *= 2;
24647 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24648 if (!_new_children) {
24649 p->error_indicator = 1;
24650 PyErr_NoMemory();
24651 D(p->level--);
24652 return NULL;
24653 }
24654 _children = _new_children;
24655 }
24656 _children[_n++] = _res;
24657 _mark = p->mark;
24658 }
24659 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024660 D(fprintf(stderr, "%*c%s _loop1_154[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024661 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
24662 }
24663 if (_n == 0 || p->error_indicator) {
24664 PyMem_Free(_children);
24665 D(p->level--);
24666 return NULL;
24667 }
24668 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
24669 if (!_seq) {
24670 PyMem_Free(_children);
24671 p->error_indicator = 1;
24672 PyErr_NoMemory();
24673 D(p->level--);
24674 return NULL;
24675 }
24676 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
24677 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024678 _PyPegen_insert_memo(p, _start_mark, _loop1_154_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024679 D(p->level--);
24680 return _seq;
24681}
24682
Pablo Galindo4a97b152020-09-02 17:44:19 +010024683// _tmp_155: ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024684static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024685_tmp_155_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024686{
24687 D(p->level++);
24688 if (p->error_indicator) {
24689 D(p->level--);
24690 return NULL;
24691 }
24692 void * _res = NULL;
24693 int _mark = p->mark;
24694 { // ')'
24695 if (p->error_indicator) {
24696 D(p->level--);
24697 return NULL;
24698 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024699 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024700 Token * _literal;
24701 if (
24702 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
24703 )
24704 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024705 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024706 _res = _literal;
24707 goto done;
24708 }
24709 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024710 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024711 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
24712 }
24713 { // '**'
24714 if (p->error_indicator) {
24715 D(p->level--);
24716 return NULL;
24717 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024718 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024719 Token * _literal;
24720 if (
24721 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24722 )
24723 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024724 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024725 _res = _literal;
24726 goto done;
24727 }
24728 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024729 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024730 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24731 }
24732 _res = NULL;
24733 done:
24734 D(p->level--);
24735 return _res;
24736}
24737
Pablo Galindo4a97b152020-09-02 17:44:19 +010024738// _tmp_156: ':' | '**'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024739static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024740_tmp_156_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024741{
24742 D(p->level++);
24743 if (p->error_indicator) {
24744 D(p->level--);
24745 return NULL;
24746 }
24747 void * _res = NULL;
24748 int _mark = p->mark;
24749 { // ':'
24750 if (p->error_indicator) {
24751 D(p->level--);
24752 return NULL;
24753 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024754 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024755 Token * _literal;
24756 if (
24757 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
24758 )
24759 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024760 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024761 _res = _literal;
24762 goto done;
24763 }
24764 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024765 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024766 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024767 }
24768 { // '**'
24769 if (p->error_indicator) {
24770 D(p->level--);
24771 return NULL;
24772 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024773 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024774 Token * _literal;
24775 if (
24776 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24777 )
24778 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024779 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024780 _res = _literal;
24781 goto done;
24782 }
24783 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024784 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024785 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24786 }
24787 _res = NULL;
24788 done:
24789 D(p->level--);
24790 return _res;
24791}
24792
24793void *
24794_PyPegen_parse(Parser *p)
24795{
24796 // Initialize keywords
24797 p->keywords = reserved_keywords;
24798 p->n_keyword_lists = n_keyword_lists;
24799
24800 // Run parser
24801 void *result = NULL;
24802 if (p->start_rule == Py_file_input) {
24803 result = file_rule(p);
24804 } else if (p->start_rule == Py_single_input) {
24805 result = interactive_rule(p);
24806 } else if (p->start_rule == Py_eval_input) {
24807 result = eval_rule(p);
24808 } else if (p->start_rule == Py_func_type_input) {
24809 result = func_type_rule(p);
24810 } else if (p->start_rule == Py_fstring_input) {
24811 result = fstring_rule(p);
24812 }
24813
24814 return result;
24815}
24816
24817// The end