blob: bfd5c47caf07e1b34bf1e7bf9bc25fff2e640e5a [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[] = {
12 NULL,
13 NULL,
14 (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
337#define _tmp_108_type 1268
338#define _tmp_109_type 1269
339#define _loop0_111_type 1270
340#define _gather_110_type 1271
341#define _loop0_113_type 1272
342#define _gather_112_type 1273
343#define _loop0_115_type 1274
344#define _gather_114_type 1275
345#define _loop0_117_type 1276
346#define _gather_116_type 1277
347#define _loop0_118_type 1278
348#define _loop0_120_type 1279
349#define _gather_119_type 1280
350#define _tmp_121_type 1281
351#define _loop0_123_type 1282
352#define _gather_122_type 1283
353#define _loop0_125_type 1284
354#define _gather_124_type 1285
355#define _tmp_126_type 1286
356#define _loop0_127_type 1287
357#define _loop0_128_type 1288
358#define _loop0_129_type 1289
359#define _tmp_130_type 1290
360#define _tmp_131_type 1291
361#define _loop0_132_type 1292
362#define _tmp_133_type 1293
363#define _loop0_134_type 1294
364#define _tmp_135_type 1295
365#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
380#define _loop1_151_type 1311
381#define _loop1_152_type 1312
382#define _tmp_153_type 1313
383#define _tmp_154_type 1314
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100384
385static mod_ty file_rule(Parser *p);
386static mod_ty interactive_rule(Parser *p);
387static mod_ty eval_rule(Parser *p);
388static mod_ty func_type_rule(Parser *p);
389static expr_ty fstring_rule(Parser *p);
390static asdl_seq* type_expressions_rule(Parser *p);
391static asdl_seq* statements_rule(Parser *p);
392static asdl_seq* statement_rule(Parser *p);
393static asdl_seq* statement_newline_rule(Parser *p);
394static asdl_seq* simple_stmt_rule(Parser *p);
395static stmt_ty small_stmt_rule(Parser *p);
396static stmt_ty compound_stmt_rule(Parser *p);
397static stmt_ty assignment_rule(Parser *p);
398static AugOperator* augassign_rule(Parser *p);
399static stmt_ty global_stmt_rule(Parser *p);
400static stmt_ty nonlocal_stmt_rule(Parser *p);
401static stmt_ty yield_stmt_rule(Parser *p);
402static stmt_ty assert_stmt_rule(Parser *p);
403static stmt_ty del_stmt_rule(Parser *p);
404static stmt_ty import_stmt_rule(Parser *p);
405static stmt_ty import_name_rule(Parser *p);
406static stmt_ty import_from_rule(Parser *p);
407static asdl_seq* import_from_targets_rule(Parser *p);
408static asdl_seq* import_from_as_names_rule(Parser *p);
409static alias_ty import_from_as_name_rule(Parser *p);
410static asdl_seq* dotted_as_names_rule(Parser *p);
411static alias_ty dotted_as_name_rule(Parser *p);
412static expr_ty dotted_name_rule(Parser *p);
413static stmt_ty if_stmt_rule(Parser *p);
414static stmt_ty elif_stmt_rule(Parser *p);
415static asdl_seq* else_block_rule(Parser *p);
416static stmt_ty while_stmt_rule(Parser *p);
417static stmt_ty for_stmt_rule(Parser *p);
418static stmt_ty with_stmt_rule(Parser *p);
419static withitem_ty with_item_rule(Parser *p);
420static stmt_ty try_stmt_rule(Parser *p);
421static excepthandler_ty except_block_rule(Parser *p);
422static asdl_seq* finally_block_rule(Parser *p);
423static stmt_ty return_stmt_rule(Parser *p);
424static stmt_ty raise_stmt_rule(Parser *p);
425static stmt_ty function_def_rule(Parser *p);
426static stmt_ty function_def_raw_rule(Parser *p);
427static Token* func_type_comment_rule(Parser *p);
428static arguments_ty params_rule(Parser *p);
429static arguments_ty parameters_rule(Parser *p);
430static asdl_seq* slash_no_default_rule(Parser *p);
431static SlashWithDefault* slash_with_default_rule(Parser *p);
432static StarEtc* star_etc_rule(Parser *p);
433static arg_ty kwds_rule(Parser *p);
434static arg_ty param_no_default_rule(Parser *p);
435static NameDefaultPair* param_with_default_rule(Parser *p);
436static NameDefaultPair* param_maybe_default_rule(Parser *p);
437static arg_ty param_rule(Parser *p);
438static expr_ty annotation_rule(Parser *p);
439static expr_ty default_rule(Parser *p);
440static asdl_seq* decorators_rule(Parser *p);
441static stmt_ty class_def_rule(Parser *p);
442static stmt_ty class_def_raw_rule(Parser *p);
443static asdl_seq* block_rule(Parser *p);
444static asdl_seq* expressions_list_rule(Parser *p);
445static expr_ty star_expressions_rule(Parser *p);
446static expr_ty star_expression_rule(Parser *p);
447static asdl_seq* star_named_expressions_rule(Parser *p);
448static expr_ty star_named_expression_rule(Parser *p);
449static expr_ty named_expression_rule(Parser *p);
450static expr_ty annotated_rhs_rule(Parser *p);
451static expr_ty expressions_rule(Parser *p);
452static expr_ty expression_rule(Parser *p);
453static expr_ty lambdef_rule(Parser *p);
454static arguments_ty lambda_params_rule(Parser *p);
455static arguments_ty lambda_parameters_rule(Parser *p);
456static asdl_seq* lambda_slash_no_default_rule(Parser *p);
457static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
458static StarEtc* lambda_star_etc_rule(Parser *p);
459static arg_ty lambda_kwds_rule(Parser *p);
460static arg_ty lambda_param_no_default_rule(Parser *p);
461static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
462static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
463static arg_ty lambda_param_rule(Parser *p);
464static expr_ty disjunction_rule(Parser *p);
465static expr_ty conjunction_rule(Parser *p);
466static expr_ty inversion_rule(Parser *p);
467static expr_ty comparison_rule(Parser *p);
468static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
469static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
470static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
471static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
472static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
473static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
474static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
475static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
476static CmpopExprPair* in_bitwise_or_rule(Parser *p);
477static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
478static CmpopExprPair* is_bitwise_or_rule(Parser *p);
479static expr_ty bitwise_or_rule(Parser *p);
480static expr_ty bitwise_xor_rule(Parser *p);
481static expr_ty bitwise_and_rule(Parser *p);
482static expr_ty shift_expr_rule(Parser *p);
483static expr_ty sum_rule(Parser *p);
484static expr_ty term_rule(Parser *p);
485static expr_ty factor_rule(Parser *p);
486static expr_ty power_rule(Parser *p);
487static expr_ty await_primary_rule(Parser *p);
488static expr_ty primary_rule(Parser *p);
489static expr_ty slices_rule(Parser *p);
490static expr_ty slice_rule(Parser *p);
491static expr_ty atom_rule(Parser *p);
492static expr_ty strings_rule(Parser *p);
493static expr_ty list_rule(Parser *p);
494static expr_ty listcomp_rule(Parser *p);
495static expr_ty tuple_rule(Parser *p);
496static expr_ty group_rule(Parser *p);
497static expr_ty genexp_rule(Parser *p);
498static expr_ty set_rule(Parser *p);
499static expr_ty setcomp_rule(Parser *p);
500static expr_ty dict_rule(Parser *p);
501static expr_ty dictcomp_rule(Parser *p);
502static asdl_seq* double_starred_kvpairs_rule(Parser *p);
503static KeyValuePair* double_starred_kvpair_rule(Parser *p);
504static KeyValuePair* kvpair_rule(Parser *p);
505static asdl_seq* for_if_clauses_rule(Parser *p);
506static comprehension_ty for_if_clause_rule(Parser *p);
507static expr_ty yield_expr_rule(Parser *p);
508static expr_ty arguments_rule(Parser *p);
509static expr_ty args_rule(Parser *p);
510static asdl_seq* kwargs_rule(Parser *p);
511static expr_ty starred_expression_rule(Parser *p);
512static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
513static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
514static expr_ty star_targets_rule(Parser *p);
515static asdl_seq* star_targets_seq_rule(Parser *p);
516static expr_ty star_target_rule(Parser *p);
517static expr_ty star_atom_rule(Parser *p);
518static expr_ty single_target_rule(Parser *p);
519static expr_ty single_subscript_attribute_target_rule(Parser *p);
520static asdl_seq* del_targets_rule(Parser *p);
521static expr_ty del_target_rule(Parser *p);
522static expr_ty del_t_atom_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100523static asdl_seq* targets_rule(Parser *p);
524static expr_ty target_rule(Parser *p);
525static expr_ty t_primary_rule(Parser *p);
526static void *t_lookahead_rule(Parser *p);
527static expr_ty t_atom_rule(Parser *p);
528static void *incorrect_arguments_rule(Parser *p);
529static void *invalid_kwarg_rule(Parser *p);
530static void *invalid_named_expression_rule(Parser *p);
531static void *invalid_assignment_rule(Parser *p);
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300532static expr_ty invalid_ann_assign_target_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300533static void *invalid_del_stmt_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100534static void *invalid_block_rule(Parser *p);
535static void *invalid_comprehension_rule(Parser *p);
536static void *invalid_dict_comprehension_rule(Parser *p);
537static void *invalid_parameters_rule(Parser *p);
538static void *invalid_lambda_parameters_rule(Parser *p);
539static void *invalid_star_etc_rule(Parser *p);
540static void *invalid_lambda_star_etc_rule(Parser *p);
541static void *invalid_double_type_comments_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300542static void *invalid_with_item_rule(Parser *p);
543static void *invalid_for_target_rule(Parser *p);
544static void *invalid_group_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100545static void *invalid_import_from_targets_rule(Parser *p);
546static asdl_seq *_loop0_1_rule(Parser *p);
547static asdl_seq *_loop0_2_rule(Parser *p);
548static asdl_seq *_loop0_4_rule(Parser *p);
549static asdl_seq *_gather_3_rule(Parser *p);
550static asdl_seq *_loop0_6_rule(Parser *p);
551static asdl_seq *_gather_5_rule(Parser *p);
552static asdl_seq *_loop0_8_rule(Parser *p);
553static asdl_seq *_gather_7_rule(Parser *p);
554static asdl_seq *_loop0_10_rule(Parser *p);
555static asdl_seq *_gather_9_rule(Parser *p);
556static asdl_seq *_loop1_11_rule(Parser *p);
557static asdl_seq *_loop0_13_rule(Parser *p);
558static asdl_seq *_gather_12_rule(Parser *p);
559static void *_tmp_14_rule(Parser *p);
560static void *_tmp_15_rule(Parser *p);
561static void *_tmp_16_rule(Parser *p);
562static void *_tmp_17_rule(Parser *p);
563static void *_tmp_18_rule(Parser *p);
564static void *_tmp_19_rule(Parser *p);
565static void *_tmp_20_rule(Parser *p);
566static void *_tmp_21_rule(Parser *p);
567static asdl_seq *_loop1_22_rule(Parser *p);
568static void *_tmp_23_rule(Parser *p);
569static void *_tmp_24_rule(Parser *p);
570static asdl_seq *_loop0_26_rule(Parser *p);
571static asdl_seq *_gather_25_rule(Parser *p);
572static asdl_seq *_loop0_28_rule(Parser *p);
573static asdl_seq *_gather_27_rule(Parser *p);
574static void *_tmp_29_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300575static void *_tmp_30_rule(Parser *p);
576static asdl_seq *_loop0_31_rule(Parser *p);
577static asdl_seq *_loop1_32_rule(Parser *p);
578static asdl_seq *_loop0_34_rule(Parser *p);
579static asdl_seq *_gather_33_rule(Parser *p);
580static void *_tmp_35_rule(Parser *p);
581static asdl_seq *_loop0_37_rule(Parser *p);
582static asdl_seq *_gather_36_rule(Parser *p);
583static void *_tmp_38_rule(Parser *p);
584static asdl_seq *_loop0_40_rule(Parser *p);
585static asdl_seq *_gather_39_rule(Parser *p);
586static asdl_seq *_loop0_42_rule(Parser *p);
587static asdl_seq *_gather_41_rule(Parser *p);
588static asdl_seq *_loop0_44_rule(Parser *p);
589static asdl_seq *_gather_43_rule(Parser *p);
590static asdl_seq *_loop0_46_rule(Parser *p);
591static asdl_seq *_gather_45_rule(Parser *p);
592static void *_tmp_47_rule(Parser *p);
593static asdl_seq *_loop1_48_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100594static void *_tmp_49_rule(Parser *p);
595static void *_tmp_50_rule(Parser *p);
596static void *_tmp_51_rule(Parser *p);
597static void *_tmp_52_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300598static void *_tmp_53_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100599static asdl_seq *_loop0_54_rule(Parser *p);
600static asdl_seq *_loop0_55_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300601static asdl_seq *_loop0_56_rule(Parser *p);
602static asdl_seq *_loop1_57_rule(Parser *p);
603static asdl_seq *_loop0_58_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100604static asdl_seq *_loop1_59_rule(Parser *p);
605static asdl_seq *_loop1_60_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300606static asdl_seq *_loop1_61_rule(Parser *p);
607static asdl_seq *_loop0_62_rule(Parser *p);
608static asdl_seq *_loop1_63_rule(Parser *p);
609static asdl_seq *_loop0_64_rule(Parser *p);
610static asdl_seq *_loop1_65_rule(Parser *p);
611static asdl_seq *_loop0_66_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100612static asdl_seq *_loop1_67_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300613static asdl_seq *_loop1_68_rule(Parser *p);
614static void *_tmp_69_rule(Parser *p);
615static asdl_seq *_loop0_71_rule(Parser *p);
616static asdl_seq *_gather_70_rule(Parser *p);
617static asdl_seq *_loop1_72_rule(Parser *p);
618static asdl_seq *_loop0_74_rule(Parser *p);
619static asdl_seq *_gather_73_rule(Parser *p);
620static asdl_seq *_loop1_75_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100621static asdl_seq *_loop0_76_rule(Parser *p);
622static asdl_seq *_loop0_77_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300623static asdl_seq *_loop0_78_rule(Parser *p);
624static asdl_seq *_loop1_79_rule(Parser *p);
625static asdl_seq *_loop0_80_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100626static asdl_seq *_loop1_81_rule(Parser *p);
627static asdl_seq *_loop1_82_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300628static asdl_seq *_loop1_83_rule(Parser *p);
629static asdl_seq *_loop0_84_rule(Parser *p);
630static asdl_seq *_loop1_85_rule(Parser *p);
631static asdl_seq *_loop0_86_rule(Parser *p);
632static asdl_seq *_loop1_87_rule(Parser *p);
633static asdl_seq *_loop0_88_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100634static asdl_seq *_loop1_89_rule(Parser *p);
635static asdl_seq *_loop1_90_rule(Parser *p);
636static asdl_seq *_loop1_91_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300637static asdl_seq *_loop1_92_rule(Parser *p);
638static void *_tmp_93_rule(Parser *p);
639static asdl_seq *_loop0_95_rule(Parser *p);
640static asdl_seq *_gather_94_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100641static void *_tmp_96_rule(Parser *p);
642static void *_tmp_97_rule(Parser *p);
643static void *_tmp_98_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300644static void *_tmp_99_rule(Parser *p);
645static asdl_seq *_loop1_100_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100646static void *_tmp_101_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300647static void *_tmp_102_rule(Parser *p);
648static asdl_seq *_loop0_104_rule(Parser *p);
649static asdl_seq *_gather_103_rule(Parser *p);
650static asdl_seq *_loop1_105_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100651static asdl_seq *_loop0_106_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300652static asdl_seq *_loop0_107_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100653static void *_tmp_108_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300654static void *_tmp_109_rule(Parser *p);
655static asdl_seq *_loop0_111_rule(Parser *p);
656static asdl_seq *_gather_110_rule(Parser *p);
657static asdl_seq *_loop0_113_rule(Parser *p);
658static asdl_seq *_gather_112_rule(Parser *p);
659static asdl_seq *_loop0_115_rule(Parser *p);
660static asdl_seq *_gather_114_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100661static asdl_seq *_loop0_117_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300662static asdl_seq *_gather_116_rule(Parser *p);
663static asdl_seq *_loop0_118_rule(Parser *p);
664static asdl_seq *_loop0_120_rule(Parser *p);
665static asdl_seq *_gather_119_rule(Parser *p);
666static void *_tmp_121_rule(Parser *p);
667static asdl_seq *_loop0_123_rule(Parser *p);
668static asdl_seq *_gather_122_rule(Parser *p);
669static asdl_seq *_loop0_125_rule(Parser *p);
670static asdl_seq *_gather_124_rule(Parser *p);
671static void *_tmp_126_rule(Parser *p);
672static asdl_seq *_loop0_127_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300673static asdl_seq *_loop0_128_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100674static asdl_seq *_loop0_129_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300675static void *_tmp_130_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100676static void *_tmp_131_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300677static asdl_seq *_loop0_132_rule(Parser *p);
678static void *_tmp_133_rule(Parser *p);
679static asdl_seq *_loop0_134_rule(Parser *p);
680static void *_tmp_135_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100681static void *_tmp_136_rule(Parser *p);
682static void *_tmp_137_rule(Parser *p);
683static void *_tmp_138_rule(Parser *p);
684static void *_tmp_139_rule(Parser *p);
685static void *_tmp_140_rule(Parser *p);
686static void *_tmp_141_rule(Parser *p);
687static void *_tmp_142_rule(Parser *p);
688static void *_tmp_143_rule(Parser *p);
689static void *_tmp_144_rule(Parser *p);
690static void *_tmp_145_rule(Parser *p);
691static void *_tmp_146_rule(Parser *p);
692static void *_tmp_147_rule(Parser *p);
693static void *_tmp_148_rule(Parser *p);
694static void *_tmp_149_rule(Parser *p);
695static void *_tmp_150_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300696static asdl_seq *_loop1_151_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100697static asdl_seq *_loop1_152_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300698static void *_tmp_153_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100699static void *_tmp_154_rule(Parser *p);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000700
701
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100702// file: statements? $
703static mod_ty
704file_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000705{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100706 D(p->level++);
707 if (p->error_indicator) {
708 D(p->level--);
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000709 return NULL;
710 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100711 mod_ty _res = NULL;
712 int _mark = p->mark;
713 { // statements? $
714 if (p->error_indicator) {
715 D(p->level--);
716 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000717 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100718 D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $"));
719 void *a;
720 Token * endmarker_var;
721 if (
722 (a = statements_rule(p), 1) // statements?
723 &&
724 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
725 )
726 {
727 D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $"));
728 _res = _PyPegen_make_module ( p , a );
729 if (_res == NULL && PyErr_Occurred()) {
730 p->error_indicator = 1;
731 D(p->level--);
732 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000733 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100734 goto done;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000735 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100736 p->mark = _mark;
737 D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ',
738 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000739 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100740 _res = NULL;
741 done:
742 D(p->level--);
743 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000744}
745
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100746// interactive: statement_newline
747static mod_ty
748interactive_rule(Parser *p)
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000749{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100750 D(p->level++);
751 if (p->error_indicator) {
752 D(p->level--);
753 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000754 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100755 mod_ty _res = NULL;
756 int _mark = p->mark;
757 { // statement_newline
758 if (p->error_indicator) {
759 D(p->level--);
760 return NULL;
761 }
762 D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline"));
763 asdl_seq* a;
764 if (
765 (a = statement_newline_rule(p)) // statement_newline
766 )
767 {
768 D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline"));
769 _res = Interactive ( a , p -> arena );
770 if (_res == NULL && PyErr_Occurred()) {
771 p->error_indicator = 1;
772 D(p->level--);
773 return NULL;
774 }
775 goto done;
776 }
777 p->mark = _mark;
778 D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ',
779 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline"));
780 }
781 _res = NULL;
782 done:
783 D(p->level--);
784 return _res;
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000785}
786
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100787// eval: expressions NEWLINE* $
788static mod_ty
789eval_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000790{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100791 D(p->level++);
792 if (p->error_indicator) {
793 D(p->level--);
794 return NULL;
795 }
796 mod_ty _res = NULL;
797 int _mark = p->mark;
798 { // expressions NEWLINE* $
799 if (p->error_indicator) {
800 D(p->level--);
801 return NULL;
802 }
803 D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
804 asdl_seq * _loop0_1_var;
805 expr_ty a;
806 Token * endmarker_var;
807 if (
808 (a = expressions_rule(p)) // expressions
809 &&
810 (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE*
811 &&
812 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
813 )
814 {
815 D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
816 _res = Expression ( a , p -> arena );
817 if (_res == NULL && PyErr_Occurred()) {
818 p->error_indicator = 1;
819 D(p->level--);
820 return NULL;
821 }
822 goto done;
823 }
824 p->mark = _mark;
825 D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ',
826 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $"));
827 }
828 _res = NULL;
829 done:
830 D(p->level--);
831 return _res;
832}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000833
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100834// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
835static mod_ty
836func_type_rule(Parser *p)
837{
838 D(p->level++);
839 if (p->error_indicator) {
840 D(p->level--);
841 return NULL;
842 }
843 mod_ty _res = NULL;
844 int _mark = p->mark;
845 { // '(' type_expressions? ')' '->' expression NEWLINE* $
846 if (p->error_indicator) {
847 D(p->level--);
848 return NULL;
849 }
850 D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
851 Token * _literal;
852 Token * _literal_1;
853 Token * _literal_2;
854 asdl_seq * _loop0_2_var;
855 void *a;
856 expr_ty b;
857 Token * endmarker_var;
858 if (
859 (_literal = _PyPegen_expect_token(p, 7)) // token='('
860 &&
861 (a = type_expressions_rule(p), 1) // type_expressions?
862 &&
863 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
864 &&
865 (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->'
866 &&
867 (b = expression_rule(p)) // expression
868 &&
869 (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE*
870 &&
871 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
872 )
873 {
874 D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
875 _res = FunctionType ( a , b , p -> arena );
876 if (_res == NULL && PyErr_Occurred()) {
877 p->error_indicator = 1;
878 D(p->level--);
879 return NULL;
880 }
881 goto done;
882 }
883 p->mark = _mark;
884 D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ',
885 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
886 }
887 _res = NULL;
888 done:
889 D(p->level--);
890 return _res;
891}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000892
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100893// fstring: star_expressions
894static expr_ty
895fstring_rule(Parser *p)
896{
897 D(p->level++);
898 if (p->error_indicator) {
899 D(p->level--);
900 return NULL;
901 }
902 expr_ty _res = NULL;
903 int _mark = p->mark;
904 { // star_expressions
905 if (p->error_indicator) {
906 D(p->level--);
907 return NULL;
908 }
909 D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
910 expr_ty star_expressions_var;
911 if (
912 (star_expressions_var = star_expressions_rule(p)) // star_expressions
913 )
914 {
915 D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
916 _res = star_expressions_var;
917 goto done;
918 }
919 p->mark = _mark;
920 D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ',
921 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
922 }
923 _res = NULL;
924 done:
925 D(p->level--);
926 return _res;
927}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000928
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100929// type_expressions:
930// | ','.expression+ ',' '*' expression ',' '**' expression
931// | ','.expression+ ',' '*' expression
932// | ','.expression+ ',' '**' expression
933// | '*' expression ',' '**' expression
934// | '*' expression
935// | '**' expression
936// | ','.expression+
937static asdl_seq*
938type_expressions_rule(Parser *p)
939{
940 D(p->level++);
941 if (p->error_indicator) {
942 D(p->level--);
943 return NULL;
944 }
945 asdl_seq* _res = NULL;
946 int _mark = p->mark;
947 { // ','.expression+ ',' '*' expression ',' '**' expression
948 if (p->error_indicator) {
949 D(p->level--);
950 return NULL;
951 }
952 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
953 Token * _literal;
954 Token * _literal_1;
955 Token * _literal_2;
956 Token * _literal_3;
957 asdl_seq * a;
958 expr_ty b;
959 expr_ty c;
960 if (
961 (a = _gather_3_rule(p)) // ','.expression+
962 &&
963 (_literal = _PyPegen_expect_token(p, 12)) // token=','
964 &&
965 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
966 &&
967 (b = expression_rule(p)) // expression
968 &&
969 (_literal_2 = _PyPegen_expect_token(p, 12)) // token=','
970 &&
971 (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**'
972 &&
973 (c = expression_rule(p)) // expression
974 )
975 {
976 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
977 _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
978 if (_res == NULL && PyErr_Occurred()) {
979 p->error_indicator = 1;
980 D(p->level--);
981 return NULL;
982 }
983 goto done;
984 }
985 p->mark = _mark;
986 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
987 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
988 }
989 { // ','.expression+ ',' '*' expression
990 if (p->error_indicator) {
991 D(p->level--);
992 return NULL;
993 }
994 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
995 Token * _literal;
996 Token * _literal_1;
997 asdl_seq * a;
998 expr_ty b;
999 if (
1000 (a = _gather_5_rule(p)) // ','.expression+
1001 &&
1002 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1003 &&
1004 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
1005 &&
1006 (b = expression_rule(p)) // expression
1007 )
1008 {
1009 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
1010 _res = _PyPegen_seq_append_to_end ( p , a , b );
1011 if (_res == NULL && PyErr_Occurred()) {
1012 p->error_indicator = 1;
1013 D(p->level--);
1014 return NULL;
1015 }
1016 goto done;
1017 }
1018 p->mark = _mark;
1019 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1020 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
1021 }
1022 { // ','.expression+ ',' '**' expression
1023 if (p->error_indicator) {
1024 D(p->level--);
1025 return NULL;
1026 }
1027 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
1028 Token * _literal;
1029 Token * _literal_1;
1030 asdl_seq * a;
1031 expr_ty b;
1032 if (
1033 (a = _gather_7_rule(p)) // ','.expression+
1034 &&
1035 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1036 &&
1037 (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**'
1038 &&
1039 (b = expression_rule(p)) // expression
1040 )
1041 {
1042 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
1043 _res = _PyPegen_seq_append_to_end ( p , a , b );
1044 if (_res == NULL && PyErr_Occurred()) {
1045 p->error_indicator = 1;
1046 D(p->level--);
1047 return NULL;
1048 }
1049 goto done;
1050 }
1051 p->mark = _mark;
1052 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1053 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
1054 }
1055 { // '*' expression ',' '**' expression
1056 if (p->error_indicator) {
1057 D(p->level--);
1058 return NULL;
1059 }
1060 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
1061 Token * _literal;
1062 Token * _literal_1;
1063 Token * _literal_2;
1064 expr_ty a;
1065 expr_ty b;
1066 if (
1067 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1068 &&
1069 (a = expression_rule(p)) // expression
1070 &&
1071 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
1072 &&
1073 (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**'
1074 &&
1075 (b = expression_rule(p)) // expression
1076 )
1077 {
1078 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
1079 _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b );
1080 if (_res == NULL && PyErr_Occurred()) {
1081 p->error_indicator = 1;
1082 D(p->level--);
1083 return NULL;
1084 }
1085 goto done;
1086 }
1087 p->mark = _mark;
1088 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1089 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
1090 }
1091 { // '*' expression
1092 if (p->error_indicator) {
1093 D(p->level--);
1094 return NULL;
1095 }
1096 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
1097 Token * _literal;
1098 expr_ty a;
1099 if (
1100 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1101 &&
1102 (a = expression_rule(p)) // expression
1103 )
1104 {
1105 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
1106 _res = _PyPegen_singleton_seq ( p , a );
1107 if (_res == NULL && PyErr_Occurred()) {
1108 p->error_indicator = 1;
1109 D(p->level--);
1110 return NULL;
1111 }
1112 goto done;
1113 }
1114 p->mark = _mark;
1115 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1116 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
1117 }
1118 { // '**' expression
1119 if (p->error_indicator) {
1120 D(p->level--);
1121 return NULL;
1122 }
1123 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
1124 Token * _literal;
1125 expr_ty a;
1126 if (
1127 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
1128 &&
1129 (a = expression_rule(p)) // expression
1130 )
1131 {
1132 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
1133 _res = _PyPegen_singleton_seq ( p , a );
1134 if (_res == NULL && PyErr_Occurred()) {
1135 p->error_indicator = 1;
1136 D(p->level--);
1137 return NULL;
1138 }
1139 goto done;
1140 }
1141 p->mark = _mark;
1142 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1143 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
1144 }
1145 { // ','.expression+
1146 if (p->error_indicator) {
1147 D(p->level--);
1148 return NULL;
1149 }
1150 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
1151 asdl_seq * _gather_9_var;
1152 if (
1153 (_gather_9_var = _gather_9_rule(p)) // ','.expression+
1154 )
1155 {
1156 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
1157 _res = _gather_9_var;
1158 goto done;
1159 }
1160 p->mark = _mark;
1161 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1162 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
1163 }
1164 _res = NULL;
1165 done:
1166 D(p->level--);
1167 return _res;
1168}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001169
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001170// statements: statement+
1171static asdl_seq*
1172statements_rule(Parser *p)
1173{
1174 D(p->level++);
1175 if (p->error_indicator) {
1176 D(p->level--);
1177 return NULL;
1178 }
1179 asdl_seq* _res = NULL;
1180 int _mark = p->mark;
1181 { // statement+
1182 if (p->error_indicator) {
1183 D(p->level--);
1184 return NULL;
1185 }
1186 D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
1187 asdl_seq * a;
1188 if (
1189 (a = _loop1_11_rule(p)) // statement+
1190 )
1191 {
1192 D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
1193 _res = _PyPegen_seq_flatten ( p , a );
1194 if (_res == NULL && PyErr_Occurred()) {
1195 p->error_indicator = 1;
1196 D(p->level--);
1197 return NULL;
1198 }
1199 goto done;
1200 }
1201 p->mark = _mark;
1202 D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ',
1203 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+"));
1204 }
1205 _res = NULL;
1206 done:
1207 D(p->level--);
1208 return _res;
1209}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001210
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001211// statement: compound_stmt | simple_stmt
1212static asdl_seq*
1213statement_rule(Parser *p)
1214{
1215 D(p->level++);
1216 if (p->error_indicator) {
1217 D(p->level--);
1218 return NULL;
1219 }
1220 asdl_seq* _res = NULL;
1221 int _mark = p->mark;
1222 { // compound_stmt
1223 if (p->error_indicator) {
1224 D(p->level--);
1225 return NULL;
1226 }
1227 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
1228 stmt_ty a;
1229 if (
1230 (a = compound_stmt_rule(p)) // compound_stmt
1231 )
1232 {
1233 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
1234 _res = _PyPegen_singleton_seq ( p , a );
1235 if (_res == NULL && PyErr_Occurred()) {
1236 p->error_indicator = 1;
1237 D(p->level--);
1238 return NULL;
1239 }
1240 goto done;
1241 }
1242 p->mark = _mark;
1243 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1244 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt"));
1245 }
1246 { // simple_stmt
1247 if (p->error_indicator) {
1248 D(p->level--);
1249 return NULL;
1250 }
1251 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1252 asdl_seq* simple_stmt_var;
1253 if (
1254 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
1255 )
1256 {
1257 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1258 _res = simple_stmt_var;
1259 goto done;
1260 }
1261 p->mark = _mark;
1262 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1263 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1264 }
1265 _res = NULL;
1266 done:
1267 D(p->level--);
1268 return _res;
1269}
1270
1271// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
1272static asdl_seq*
1273statement_newline_rule(Parser *p)
1274{
1275 D(p->level++);
1276 if (p->error_indicator) {
1277 D(p->level--);
1278 return NULL;
1279 }
1280 asdl_seq* _res = NULL;
1281 int _mark = p->mark;
1282 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1283 p->error_indicator = 1;
1284 D(p->level--);
1285 return NULL;
1286 }
1287 int _start_lineno = p->tokens[_mark]->lineno;
1288 UNUSED(_start_lineno); // Only used by EXTRA macro
1289 int _start_col_offset = p->tokens[_mark]->col_offset;
1290 UNUSED(_start_col_offset); // Only used by EXTRA macro
1291 { // compound_stmt NEWLINE
1292 if (p->error_indicator) {
1293 D(p->level--);
1294 return NULL;
1295 }
1296 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
1297 stmt_ty a;
1298 Token * newline_var;
1299 if (
1300 (a = compound_stmt_rule(p)) // compound_stmt
1301 &&
1302 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1303 )
1304 {
1305 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
1306 _res = _PyPegen_singleton_seq ( p , a );
1307 if (_res == NULL && PyErr_Occurred()) {
1308 p->error_indicator = 1;
1309 D(p->level--);
1310 return NULL;
1311 }
1312 goto done;
1313 }
1314 p->mark = _mark;
1315 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1316 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE"));
1317 }
1318 { // simple_stmt
1319 if (p->error_indicator) {
1320 D(p->level--);
1321 return NULL;
1322 }
1323 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1324 asdl_seq* simple_stmt_var;
1325 if (
1326 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
1327 )
1328 {
1329 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1330 _res = simple_stmt_var;
1331 goto done;
1332 }
1333 p->mark = _mark;
1334 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1335 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1336 }
1337 { // NEWLINE
1338 if (p->error_indicator) {
1339 D(p->level--);
1340 return NULL;
1341 }
1342 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1343 Token * newline_var;
1344 if (
1345 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1346 )
1347 {
1348 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1349 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1350 if (_token == NULL) {
1351 D(p->level--);
1352 return NULL;
1353 }
1354 int _end_lineno = _token->end_lineno;
1355 UNUSED(_end_lineno); // Only used by EXTRA macro
1356 int _end_col_offset = _token->end_col_offset;
1357 UNUSED(_end_col_offset); // Only used by EXTRA macro
1358 _res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
1359 if (_res == NULL && PyErr_Occurred()) {
1360 p->error_indicator = 1;
1361 D(p->level--);
1362 return NULL;
1363 }
1364 goto done;
1365 }
1366 p->mark = _mark;
1367 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1368 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
1369 }
1370 { // $
1371 if (p->error_indicator) {
1372 D(p->level--);
1373 return NULL;
1374 }
1375 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$"));
1376 Token * endmarker_var;
1377 if (
1378 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
1379 )
1380 {
1381 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
1382 _res = _PyPegen_interactive_exit ( p );
1383 if (_res == NULL && PyErr_Occurred()) {
1384 p->error_indicator = 1;
1385 D(p->level--);
1386 return NULL;
1387 }
1388 goto done;
1389 }
1390 p->mark = _mark;
1391 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1392 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$"));
1393 }
1394 _res = NULL;
1395 done:
1396 D(p->level--);
1397 return _res;
1398}
1399
1400// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
1401static asdl_seq*
1402simple_stmt_rule(Parser *p)
1403{
1404 D(p->level++);
1405 if (p->error_indicator) {
1406 D(p->level--);
1407 return NULL;
1408 }
1409 asdl_seq* _res = NULL;
1410 int _mark = p->mark;
1411 { // small_stmt !';' NEWLINE
1412 if (p->error_indicator) {
1413 D(p->level--);
1414 return NULL;
1415 }
1416 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
1417 stmt_ty a;
1418 Token * newline_var;
1419 if (
1420 (a = small_stmt_rule(p)) // small_stmt
1421 &&
1422 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';'
1423 &&
1424 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1425 )
1426 {
1427 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
1428 _res = _PyPegen_singleton_seq ( p , a );
1429 if (_res == NULL && PyErr_Occurred()) {
1430 p->error_indicator = 1;
1431 D(p->level--);
1432 return NULL;
1433 }
1434 goto done;
1435 }
1436 p->mark = _mark;
1437 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1438 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt !';' NEWLINE"));
1439 }
1440 { // ';'.small_stmt+ ';'? NEWLINE
1441 if (p->error_indicator) {
1442 D(p->level--);
1443 return NULL;
1444 }
1445 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1446 void *_opt_var;
1447 UNUSED(_opt_var); // Silence compiler warnings
1448 asdl_seq * a;
1449 Token * newline_var;
1450 if (
1451 (a = _gather_12_rule(p)) // ';'.small_stmt+
1452 &&
1453 (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'?
1454 &&
1455 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1456 )
1457 {
1458 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1459 _res = a;
1460 if (_res == NULL && PyErr_Occurred()) {
1461 p->error_indicator = 1;
1462 D(p->level--);
1463 return NULL;
1464 }
1465 goto done;
1466 }
1467 p->mark = _mark;
1468 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1469 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1470 }
1471 _res = NULL;
1472 done:
1473 D(p->level--);
1474 return _res;
1475}
1476
1477// small_stmt:
1478// | assignment
1479// | star_expressions
1480// | &'return' return_stmt
1481// | &('import' | 'from') import_stmt
1482// | &'raise' raise_stmt
1483// | 'pass'
1484// | &'del' del_stmt
1485// | &'yield' yield_stmt
1486// | &'assert' assert_stmt
1487// | 'break'
1488// | 'continue'
1489// | &'global' global_stmt
1490// | &'nonlocal' nonlocal_stmt
1491static stmt_ty
1492small_stmt_rule(Parser *p)
1493{
1494 D(p->level++);
1495 if (p->error_indicator) {
1496 D(p->level--);
1497 return NULL;
1498 }
1499 stmt_ty _res = NULL;
1500 if (_PyPegen_is_memoized(p, small_stmt_type, &_res)) {
1501 D(p->level--);
1502 return _res;
1503 }
1504 int _mark = p->mark;
1505 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1506 p->error_indicator = 1;
1507 D(p->level--);
1508 return NULL;
1509 }
1510 int _start_lineno = p->tokens[_mark]->lineno;
1511 UNUSED(_start_lineno); // Only used by EXTRA macro
1512 int _start_col_offset = p->tokens[_mark]->col_offset;
1513 UNUSED(_start_col_offset); // Only used by EXTRA macro
1514 { // assignment
1515 if (p->error_indicator) {
1516 D(p->level--);
1517 return NULL;
1518 }
1519 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment"));
1520 stmt_ty assignment_var;
1521 if (
1522 (assignment_var = assignment_rule(p)) // assignment
1523 )
1524 {
1525 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment"));
1526 _res = assignment_var;
1527 goto done;
1528 }
1529 p->mark = _mark;
1530 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1531 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment"));
1532 }
1533 { // star_expressions
1534 if (p->error_indicator) {
1535 D(p->level--);
1536 return NULL;
1537 }
1538 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1539 expr_ty e;
1540 if (
1541 (e = star_expressions_rule(p)) // star_expressions
1542 )
1543 {
1544 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1545 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1546 if (_token == NULL) {
1547 D(p->level--);
1548 return NULL;
1549 }
1550 int _end_lineno = _token->end_lineno;
1551 UNUSED(_end_lineno); // Only used by EXTRA macro
1552 int _end_col_offset = _token->end_col_offset;
1553 UNUSED(_end_col_offset); // Only used by EXTRA macro
1554 _res = _Py_Expr ( e , EXTRA );
1555 if (_res == NULL && PyErr_Occurred()) {
1556 p->error_indicator = 1;
1557 D(p->level--);
1558 return NULL;
1559 }
1560 goto done;
1561 }
1562 p->mark = _mark;
1563 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1564 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
1565 }
1566 { // &'return' return_stmt
1567 if (p->error_indicator) {
1568 D(p->level--);
1569 return NULL;
1570 }
1571 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1572 stmt_ty return_stmt_var;
1573 if (
1574 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return'
1575 &&
1576 (return_stmt_var = return_stmt_rule(p)) // return_stmt
1577 )
1578 {
1579 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1580 _res = return_stmt_var;
1581 goto done;
1582 }
1583 p->mark = _mark;
1584 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1585 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt"));
1586 }
1587 { // &('import' | 'from') import_stmt
1588 if (p->error_indicator) {
1589 D(p->level--);
1590 return NULL;
1591 }
1592 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1593 stmt_ty import_stmt_var;
1594 if (
1595 _PyPegen_lookahead(1, _tmp_14_rule, p)
1596 &&
1597 (import_stmt_var = import_stmt_rule(p)) // import_stmt
1598 )
1599 {
1600 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1601 _res = import_stmt_var;
1602 goto done;
1603 }
1604 p->mark = _mark;
1605 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1606 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt"));
1607 }
1608 { // &'raise' raise_stmt
1609 if (p->error_indicator) {
1610 D(p->level--);
1611 return NULL;
1612 }
1613 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1614 stmt_ty raise_stmt_var;
1615 if (
1616 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise'
1617 &&
1618 (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt
1619 )
1620 {
1621 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1622 _res = raise_stmt_var;
1623 goto done;
1624 }
1625 p->mark = _mark;
1626 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1627 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt"));
1628 }
1629 { // 'pass'
1630 if (p->error_indicator) {
1631 D(p->level--);
1632 return NULL;
1633 }
1634 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'"));
1635 Token * _keyword;
1636 if (
1637 (_keyword = _PyPegen_expect_token(p, 502)) // token='pass'
1638 )
1639 {
1640 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'"));
1641 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1642 if (_token == NULL) {
1643 D(p->level--);
1644 return NULL;
1645 }
1646 int _end_lineno = _token->end_lineno;
1647 UNUSED(_end_lineno); // Only used by EXTRA macro
1648 int _end_col_offset = _token->end_col_offset;
1649 UNUSED(_end_col_offset); // Only used by EXTRA macro
1650 _res = _Py_Pass ( EXTRA );
1651 if (_res == NULL && PyErr_Occurred()) {
1652 p->error_indicator = 1;
1653 D(p->level--);
1654 return NULL;
1655 }
1656 goto done;
1657 }
1658 p->mark = _mark;
1659 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1660 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'"));
1661 }
1662 { // &'del' del_stmt
1663 if (p->error_indicator) {
1664 D(p->level--);
1665 return NULL;
1666 }
1667 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1668 stmt_ty del_stmt_var;
1669 if (
1670 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del'
1671 &&
1672 (del_stmt_var = del_stmt_rule(p)) // del_stmt
1673 )
1674 {
1675 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1676 _res = del_stmt_var;
1677 goto done;
1678 }
1679 p->mark = _mark;
1680 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1681 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt"));
1682 }
1683 { // &'yield' yield_stmt
1684 if (p->error_indicator) {
1685 D(p->level--);
1686 return NULL;
1687 }
1688 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1689 stmt_ty yield_stmt_var;
1690 if (
1691 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield'
1692 &&
1693 (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt
1694 )
1695 {
1696 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1697 _res = yield_stmt_var;
1698 goto done;
1699 }
1700 p->mark = _mark;
1701 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1702 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt"));
1703 }
1704 { // &'assert' assert_stmt
1705 if (p->error_indicator) {
1706 D(p->level--);
1707 return NULL;
1708 }
1709 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1710 stmt_ty assert_stmt_var;
1711 if (
1712 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert'
1713 &&
1714 (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt
1715 )
1716 {
1717 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1718 _res = assert_stmt_var;
1719 goto done;
1720 }
1721 p->mark = _mark;
1722 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1723 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt"));
1724 }
1725 { // 'break'
1726 if (p->error_indicator) {
1727 D(p->level--);
1728 return NULL;
1729 }
1730 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'"));
1731 Token * _keyword;
1732 if (
1733 (_keyword = _PyPegen_expect_token(p, 506)) // token='break'
1734 )
1735 {
1736 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'"));
1737 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1738 if (_token == NULL) {
1739 D(p->level--);
1740 return NULL;
1741 }
1742 int _end_lineno = _token->end_lineno;
1743 UNUSED(_end_lineno); // Only used by EXTRA macro
1744 int _end_col_offset = _token->end_col_offset;
1745 UNUSED(_end_col_offset); // Only used by EXTRA macro
1746 _res = _Py_Break ( EXTRA );
1747 if (_res == NULL && PyErr_Occurred()) {
1748 p->error_indicator = 1;
1749 D(p->level--);
1750 return NULL;
1751 }
1752 goto done;
1753 }
1754 p->mark = _mark;
1755 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1756 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'"));
1757 }
1758 { // 'continue'
1759 if (p->error_indicator) {
1760 D(p->level--);
1761 return NULL;
1762 }
1763 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'"));
1764 Token * _keyword;
1765 if (
1766 (_keyword = _PyPegen_expect_token(p, 507)) // token='continue'
1767 )
1768 {
1769 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'"));
1770 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1771 if (_token == NULL) {
1772 D(p->level--);
1773 return NULL;
1774 }
1775 int _end_lineno = _token->end_lineno;
1776 UNUSED(_end_lineno); // Only used by EXTRA macro
1777 int _end_col_offset = _token->end_col_offset;
1778 UNUSED(_end_col_offset); // Only used by EXTRA macro
1779 _res = _Py_Continue ( EXTRA );
1780 if (_res == NULL && PyErr_Occurred()) {
1781 p->error_indicator = 1;
1782 D(p->level--);
1783 return NULL;
1784 }
1785 goto done;
1786 }
1787 p->mark = _mark;
1788 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1789 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'"));
1790 }
1791 { // &'global' global_stmt
1792 if (p->error_indicator) {
1793 D(p->level--);
1794 return NULL;
1795 }
1796 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1797 stmt_ty global_stmt_var;
1798 if (
1799 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global'
1800 &&
1801 (global_stmt_var = global_stmt_rule(p)) // global_stmt
1802 )
1803 {
1804 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1805 _res = global_stmt_var;
1806 goto done;
1807 }
1808 p->mark = _mark;
1809 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1810 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt"));
1811 }
1812 { // &'nonlocal' nonlocal_stmt
1813 if (p->error_indicator) {
1814 D(p->level--);
1815 return NULL;
1816 }
1817 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1818 stmt_ty nonlocal_stmt_var;
1819 if (
1820 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal'
1821 &&
1822 (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt
1823 )
1824 {
1825 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1826 _res = nonlocal_stmt_var;
1827 goto done;
1828 }
1829 p->mark = _mark;
1830 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1831 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1832 }
1833 _res = NULL;
1834 done:
1835 _PyPegen_insert_memo(p, _mark, small_stmt_type, _res);
1836 D(p->level--);
1837 return _res;
1838}
1839
1840// compound_stmt:
1841// | &('def' | '@' | ASYNC) function_def
1842// | &'if' if_stmt
1843// | &('class' | '@') class_def
1844// | &('with' | ASYNC) with_stmt
1845// | &('for' | ASYNC) for_stmt
1846// | &'try' try_stmt
1847// | &'while' while_stmt
1848static stmt_ty
1849compound_stmt_rule(Parser *p)
1850{
1851 D(p->level++);
1852 if (p->error_indicator) {
1853 D(p->level--);
1854 return NULL;
1855 }
1856 stmt_ty _res = NULL;
1857 int _mark = p->mark;
1858 { // &('def' | '@' | ASYNC) function_def
1859 if (p->error_indicator) {
1860 D(p->level--);
1861 return NULL;
1862 }
1863 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1864 stmt_ty function_def_var;
1865 if (
1866 _PyPegen_lookahead(1, _tmp_15_rule, p)
1867 &&
1868 (function_def_var = function_def_rule(p)) // function_def
1869 )
1870 {
1871 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1872 _res = function_def_var;
1873 goto done;
1874 }
1875 p->mark = _mark;
1876 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1877 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1878 }
1879 { // &'if' if_stmt
1880 if (p->error_indicator) {
1881 D(p->level--);
1882 return NULL;
1883 }
1884 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1885 stmt_ty if_stmt_var;
1886 if (
1887 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if'
1888 &&
1889 (if_stmt_var = if_stmt_rule(p)) // if_stmt
1890 )
1891 {
1892 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1893 _res = if_stmt_var;
1894 goto done;
1895 }
1896 p->mark = _mark;
1897 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1898 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt"));
1899 }
1900 { // &('class' | '@') class_def
1901 if (p->error_indicator) {
1902 D(p->level--);
1903 return NULL;
1904 }
1905 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1906 stmt_ty class_def_var;
1907 if (
1908 _PyPegen_lookahead(1, _tmp_16_rule, p)
1909 &&
1910 (class_def_var = class_def_rule(p)) // class_def
1911 )
1912 {
1913 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1914 _res = class_def_var;
1915 goto done;
1916 }
1917 p->mark = _mark;
1918 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1919 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def"));
1920 }
1921 { // &('with' | ASYNC) with_stmt
1922 if (p->error_indicator) {
1923 D(p->level--);
1924 return NULL;
1925 }
1926 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1927 stmt_ty with_stmt_var;
1928 if (
1929 _PyPegen_lookahead(1, _tmp_17_rule, p)
1930 &&
1931 (with_stmt_var = with_stmt_rule(p)) // with_stmt
1932 )
1933 {
1934 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1935 _res = with_stmt_var;
1936 goto done;
1937 }
1938 p->mark = _mark;
1939 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1940 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1941 }
1942 { // &('for' | ASYNC) for_stmt
1943 if (p->error_indicator) {
1944 D(p->level--);
1945 return NULL;
1946 }
1947 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1948 stmt_ty for_stmt_var;
1949 if (
1950 _PyPegen_lookahead(1, _tmp_18_rule, p)
1951 &&
1952 (for_stmt_var = for_stmt_rule(p)) // for_stmt
1953 )
1954 {
1955 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1956 _res = for_stmt_var;
1957 goto done;
1958 }
1959 p->mark = _mark;
1960 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1961 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1962 }
1963 { // &'try' try_stmt
1964 if (p->error_indicator) {
1965 D(p->level--);
1966 return NULL;
1967 }
1968 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1969 stmt_ty try_stmt_var;
1970 if (
1971 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try'
1972 &&
1973 (try_stmt_var = try_stmt_rule(p)) // try_stmt
1974 )
1975 {
1976 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1977 _res = try_stmt_var;
1978 goto done;
1979 }
1980 p->mark = _mark;
1981 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1982 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt"));
1983 }
1984 { // &'while' while_stmt
1985 if (p->error_indicator) {
1986 D(p->level--);
1987 return NULL;
1988 }
1989 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
1990 stmt_ty while_stmt_var;
1991 if (
1992 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while'
1993 &&
1994 (while_stmt_var = while_stmt_rule(p)) // while_stmt
1995 )
1996 {
1997 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
1998 _res = while_stmt_var;
1999 goto done;
2000 }
2001 p->mark = _mark;
2002 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2003 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt"));
2004 }
2005 _res = NULL;
2006 done:
2007 D(p->level--);
2008 return _res;
2009}
2010
2011// assignment:
2012// | NAME ':' expression ['=' annotated_rhs]
2013// | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2014// | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002015// | single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002016// | invalid_assignment
2017static stmt_ty
2018assignment_rule(Parser *p)
2019{
2020 D(p->level++);
2021 if (p->error_indicator) {
2022 D(p->level--);
2023 return NULL;
2024 }
2025 stmt_ty _res = NULL;
2026 int _mark = p->mark;
2027 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2028 p->error_indicator = 1;
2029 D(p->level--);
2030 return NULL;
2031 }
2032 int _start_lineno = p->tokens[_mark]->lineno;
2033 UNUSED(_start_lineno); // Only used by EXTRA macro
2034 int _start_col_offset = p->tokens[_mark]->col_offset;
2035 UNUSED(_start_col_offset); // Only used by EXTRA macro
2036 { // NAME ':' expression ['=' annotated_rhs]
2037 if (p->error_indicator) {
2038 D(p->level--);
2039 return NULL;
2040 }
2041 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2042 Token * _literal;
2043 expr_ty a;
2044 expr_ty b;
2045 void *c;
2046 if (
2047 (a = _PyPegen_name_token(p)) // NAME
2048 &&
2049 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2050 &&
2051 (b = expression_rule(p)) // expression
2052 &&
2053 (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs]
2054 )
2055 {
2056 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2057 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2058 if (_token == NULL) {
2059 D(p->level--);
2060 return NULL;
2061 }
2062 int _end_lineno = _token->end_lineno;
2063 UNUSED(_end_lineno); // Only used by EXTRA macro
2064 int _end_col_offset = _token->end_col_offset;
2065 UNUSED(_end_col_offset); // Only used by EXTRA macro
2066 _res = CHECK_VERSION ( 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
2067 if (_res == NULL && PyErr_Occurred()) {
2068 p->error_indicator = 1;
2069 D(p->level--);
2070 return NULL;
2071 }
2072 goto done;
2073 }
2074 p->mark = _mark;
2075 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2076 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2077 }
2078 { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2079 if (p->error_indicator) {
2080 D(p->level--);
2081 return NULL;
2082 }
2083 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2084 Token * _literal;
2085 void *a;
2086 expr_ty b;
2087 void *c;
2088 if (
2089 (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
2090 &&
2091 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2092 &&
2093 (b = expression_rule(p)) // expression
2094 &&
2095 (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs]
2096 )
2097 {
2098 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2099 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2100 if (_token == NULL) {
2101 D(p->level--);
2102 return NULL;
2103 }
2104 int _end_lineno = _token->end_lineno;
2105 UNUSED(_end_lineno); // Only used by EXTRA macro
2106 int _end_col_offset = _token->end_col_offset;
2107 UNUSED(_end_col_offset); // Only used by EXTRA macro
2108 _res = CHECK_VERSION ( 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) );
2109 if (_res == NULL && PyErr_Occurred()) {
2110 p->error_indicator = 1;
2111 D(p->level--);
2112 return NULL;
2113 }
2114 goto done;
2115 }
2116 p->mark = _mark;
2117 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2118 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2119 }
2120 { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
2121 if (p->error_indicator) {
2122 D(p->level--);
2123 return NULL;
2124 }
2125 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2126 asdl_seq * a;
2127 void *b;
2128 void *tc;
2129 if (
2130 (a = _loop1_22_rule(p)) // ((star_targets '='))+
2131 &&
2132 (b = _tmp_23_rule(p)) // yield_expr | star_expressions
2133 &&
2134 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
2135 &&
2136 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
2137 )
2138 {
2139 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2140 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2141 if (_token == NULL) {
2142 D(p->level--);
2143 return NULL;
2144 }
2145 int _end_lineno = _token->end_lineno;
2146 UNUSED(_end_lineno); // Only used by EXTRA macro
2147 int _end_col_offset = _token->end_col_offset;
2148 UNUSED(_end_col_offset); // Only used by EXTRA macro
2149 _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
2150 if (_res == NULL && PyErr_Occurred()) {
2151 p->error_indicator = 1;
2152 D(p->level--);
2153 return NULL;
2154 }
2155 goto done;
2156 }
2157 p->mark = _mark;
2158 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2159 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2160 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002161 { // single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002162 if (p->error_indicator) {
2163 D(p->level--);
2164 return NULL;
2165 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002166 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2167 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002168 expr_ty a;
2169 AugOperator* b;
2170 void *c;
2171 if (
2172 (a = single_target_rule(p)) // single_target
2173 &&
2174 (b = augassign_rule(p)) // augassign
2175 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002176 (_cut_var = 1)
2177 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002178 (c = _tmp_24_rule(p)) // yield_expr | star_expressions
2179 )
2180 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002181 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 +01002182 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2183 if (_token == NULL) {
2184 D(p->level--);
2185 return NULL;
2186 }
2187 int _end_lineno = _token->end_lineno;
2188 UNUSED(_end_lineno); // Only used by EXTRA macro
2189 int _end_col_offset = _token->end_col_offset;
2190 UNUSED(_end_col_offset); // Only used by EXTRA macro
2191 _res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
2192 if (_res == NULL && PyErr_Occurred()) {
2193 p->error_indicator = 1;
2194 D(p->level--);
2195 return NULL;
2196 }
2197 goto done;
2198 }
2199 p->mark = _mark;
2200 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002201 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2202 if (_cut_var) {
2203 D(p->level--);
2204 return NULL;
2205 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002206 }
2207 { // invalid_assignment
2208 if (p->error_indicator) {
2209 D(p->level--);
2210 return NULL;
2211 }
2212 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2213 void *invalid_assignment_var;
2214 if (
2215 (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment
2216 )
2217 {
2218 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2219 _res = invalid_assignment_var;
2220 goto done;
2221 }
2222 p->mark = _mark;
2223 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2224 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment"));
2225 }
2226 _res = NULL;
2227 done:
2228 D(p->level--);
2229 return _res;
2230}
2231
2232// augassign:
2233// | '+='
2234// | '-='
2235// | '*='
2236// | '@='
2237// | '/='
2238// | '%='
2239// | '&='
2240// | '|='
2241// | '^='
2242// | '<<='
2243// | '>>='
2244// | '**='
2245// | '//='
2246static AugOperator*
2247augassign_rule(Parser *p)
2248{
2249 D(p->level++);
2250 if (p->error_indicator) {
2251 D(p->level--);
2252 return NULL;
2253 }
2254 AugOperator* _res = NULL;
2255 int _mark = p->mark;
2256 { // '+='
2257 if (p->error_indicator) {
2258 D(p->level--);
2259 return NULL;
2260 }
2261 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='"));
2262 Token * _literal;
2263 if (
2264 (_literal = _PyPegen_expect_token(p, 36)) // token='+='
2265 )
2266 {
2267 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
2268 _res = _PyPegen_augoperator ( p , Add );
2269 if (_res == NULL && PyErr_Occurred()) {
2270 p->error_indicator = 1;
2271 D(p->level--);
2272 return NULL;
2273 }
2274 goto done;
2275 }
2276 p->mark = _mark;
2277 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2278 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='"));
2279 }
2280 { // '-='
2281 if (p->error_indicator) {
2282 D(p->level--);
2283 return NULL;
2284 }
2285 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='"));
2286 Token * _literal;
2287 if (
2288 (_literal = _PyPegen_expect_token(p, 37)) // token='-='
2289 )
2290 {
2291 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
2292 _res = _PyPegen_augoperator ( p , Sub );
2293 if (_res == NULL && PyErr_Occurred()) {
2294 p->error_indicator = 1;
2295 D(p->level--);
2296 return NULL;
2297 }
2298 goto done;
2299 }
2300 p->mark = _mark;
2301 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2302 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='"));
2303 }
2304 { // '*='
2305 if (p->error_indicator) {
2306 D(p->level--);
2307 return NULL;
2308 }
2309 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='"));
2310 Token * _literal;
2311 if (
2312 (_literal = _PyPegen_expect_token(p, 38)) // token='*='
2313 )
2314 {
2315 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
2316 _res = _PyPegen_augoperator ( p , Mult );
2317 if (_res == NULL && PyErr_Occurred()) {
2318 p->error_indicator = 1;
2319 D(p->level--);
2320 return NULL;
2321 }
2322 goto done;
2323 }
2324 p->mark = _mark;
2325 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2326 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='"));
2327 }
2328 { // '@='
2329 if (p->error_indicator) {
2330 D(p->level--);
2331 return NULL;
2332 }
2333 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='"));
2334 Token * _literal;
2335 if (
2336 (_literal = _PyPegen_expect_token(p, 50)) // token='@='
2337 )
2338 {
2339 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
2340 _res = CHECK_VERSION ( 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
2341 if (_res == NULL && PyErr_Occurred()) {
2342 p->error_indicator = 1;
2343 D(p->level--);
2344 return NULL;
2345 }
2346 goto done;
2347 }
2348 p->mark = _mark;
2349 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2350 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='"));
2351 }
2352 { // '/='
2353 if (p->error_indicator) {
2354 D(p->level--);
2355 return NULL;
2356 }
2357 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='"));
2358 Token * _literal;
2359 if (
2360 (_literal = _PyPegen_expect_token(p, 39)) // token='/='
2361 )
2362 {
2363 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
2364 _res = _PyPegen_augoperator ( p , Div );
2365 if (_res == NULL && PyErr_Occurred()) {
2366 p->error_indicator = 1;
2367 D(p->level--);
2368 return NULL;
2369 }
2370 goto done;
2371 }
2372 p->mark = _mark;
2373 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2374 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='"));
2375 }
2376 { // '%='
2377 if (p->error_indicator) {
2378 D(p->level--);
2379 return NULL;
2380 }
2381 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='"));
2382 Token * _literal;
2383 if (
2384 (_literal = _PyPegen_expect_token(p, 40)) // token='%='
2385 )
2386 {
2387 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
2388 _res = _PyPegen_augoperator ( p , Mod );
2389 if (_res == NULL && PyErr_Occurred()) {
2390 p->error_indicator = 1;
2391 D(p->level--);
2392 return NULL;
2393 }
2394 goto done;
2395 }
2396 p->mark = _mark;
2397 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2398 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='"));
2399 }
2400 { // '&='
2401 if (p->error_indicator) {
2402 D(p->level--);
2403 return NULL;
2404 }
2405 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='"));
2406 Token * _literal;
2407 if (
2408 (_literal = _PyPegen_expect_token(p, 41)) // token='&='
2409 )
2410 {
2411 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
2412 _res = _PyPegen_augoperator ( p , BitAnd );
2413 if (_res == NULL && PyErr_Occurred()) {
2414 p->error_indicator = 1;
2415 D(p->level--);
2416 return NULL;
2417 }
2418 goto done;
2419 }
2420 p->mark = _mark;
2421 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2422 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='"));
2423 }
2424 { // '|='
2425 if (p->error_indicator) {
2426 D(p->level--);
2427 return NULL;
2428 }
2429 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='"));
2430 Token * _literal;
2431 if (
2432 (_literal = _PyPegen_expect_token(p, 42)) // token='|='
2433 )
2434 {
2435 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
2436 _res = _PyPegen_augoperator ( p , BitOr );
2437 if (_res == NULL && PyErr_Occurred()) {
2438 p->error_indicator = 1;
2439 D(p->level--);
2440 return NULL;
2441 }
2442 goto done;
2443 }
2444 p->mark = _mark;
2445 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2446 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='"));
2447 }
2448 { // '^='
2449 if (p->error_indicator) {
2450 D(p->level--);
2451 return NULL;
2452 }
2453 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='"));
2454 Token * _literal;
2455 if (
2456 (_literal = _PyPegen_expect_token(p, 43)) // token='^='
2457 )
2458 {
2459 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
2460 _res = _PyPegen_augoperator ( p , BitXor );
2461 if (_res == NULL && PyErr_Occurred()) {
2462 p->error_indicator = 1;
2463 D(p->level--);
2464 return NULL;
2465 }
2466 goto done;
2467 }
2468 p->mark = _mark;
2469 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2470 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='"));
2471 }
2472 { // '<<='
2473 if (p->error_indicator) {
2474 D(p->level--);
2475 return NULL;
2476 }
2477 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='"));
2478 Token * _literal;
2479 if (
2480 (_literal = _PyPegen_expect_token(p, 44)) // token='<<='
2481 )
2482 {
2483 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
2484 _res = _PyPegen_augoperator ( p , LShift );
2485 if (_res == NULL && PyErr_Occurred()) {
2486 p->error_indicator = 1;
2487 D(p->level--);
2488 return NULL;
2489 }
2490 goto done;
2491 }
2492 p->mark = _mark;
2493 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2494 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='"));
2495 }
2496 { // '>>='
2497 if (p->error_indicator) {
2498 D(p->level--);
2499 return NULL;
2500 }
2501 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='"));
2502 Token * _literal;
2503 if (
2504 (_literal = _PyPegen_expect_token(p, 45)) // token='>>='
2505 )
2506 {
2507 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
2508 _res = _PyPegen_augoperator ( p , RShift );
2509 if (_res == NULL && PyErr_Occurred()) {
2510 p->error_indicator = 1;
2511 D(p->level--);
2512 return NULL;
2513 }
2514 goto done;
2515 }
2516 p->mark = _mark;
2517 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2518 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='"));
2519 }
2520 { // '**='
2521 if (p->error_indicator) {
2522 D(p->level--);
2523 return NULL;
2524 }
2525 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='"));
2526 Token * _literal;
2527 if (
2528 (_literal = _PyPegen_expect_token(p, 46)) // token='**='
2529 )
2530 {
2531 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
2532 _res = _PyPegen_augoperator ( p , Pow );
2533 if (_res == NULL && PyErr_Occurred()) {
2534 p->error_indicator = 1;
2535 D(p->level--);
2536 return NULL;
2537 }
2538 goto done;
2539 }
2540 p->mark = _mark;
2541 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2542 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='"));
2543 }
2544 { // '//='
2545 if (p->error_indicator) {
2546 D(p->level--);
2547 return NULL;
2548 }
2549 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='"));
2550 Token * _literal;
2551 if (
2552 (_literal = _PyPegen_expect_token(p, 48)) // token='//='
2553 )
2554 {
2555 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
2556 _res = _PyPegen_augoperator ( p , FloorDiv );
2557 if (_res == NULL && PyErr_Occurred()) {
2558 p->error_indicator = 1;
2559 D(p->level--);
2560 return NULL;
2561 }
2562 goto done;
2563 }
2564 p->mark = _mark;
2565 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2566 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='"));
2567 }
2568 _res = NULL;
2569 done:
2570 D(p->level--);
2571 return _res;
2572}
2573
2574// global_stmt: 'global' ','.NAME+
2575static stmt_ty
2576global_stmt_rule(Parser *p)
2577{
2578 D(p->level++);
2579 if (p->error_indicator) {
2580 D(p->level--);
2581 return NULL;
2582 }
2583 stmt_ty _res = NULL;
2584 int _mark = p->mark;
2585 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2586 p->error_indicator = 1;
2587 D(p->level--);
2588 return NULL;
2589 }
2590 int _start_lineno = p->tokens[_mark]->lineno;
2591 UNUSED(_start_lineno); // Only used by EXTRA macro
2592 int _start_col_offset = p->tokens[_mark]->col_offset;
2593 UNUSED(_start_col_offset); // Only used by EXTRA macro
2594 { // 'global' ','.NAME+
2595 if (p->error_indicator) {
2596 D(p->level--);
2597 return NULL;
2598 }
2599 D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2600 Token * _keyword;
2601 asdl_seq * a;
2602 if (
2603 (_keyword = _PyPegen_expect_token(p, 508)) // token='global'
2604 &&
2605 (a = _gather_25_rule(p)) // ','.NAME+
2606 )
2607 {
2608 D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2609 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2610 if (_token == NULL) {
2611 D(p->level--);
2612 return NULL;
2613 }
2614 int _end_lineno = _token->end_lineno;
2615 UNUSED(_end_lineno); // Only used by EXTRA macro
2616 int _end_col_offset = _token->end_col_offset;
2617 UNUSED(_end_col_offset); // Only used by EXTRA macro
2618 _res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2619 if (_res == NULL && PyErr_Occurred()) {
2620 p->error_indicator = 1;
2621 D(p->level--);
2622 return NULL;
2623 }
2624 goto done;
2625 }
2626 p->mark = _mark;
2627 D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2628 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
2629 }
2630 _res = NULL;
2631 done:
2632 D(p->level--);
2633 return _res;
2634}
2635
2636// nonlocal_stmt: 'nonlocal' ','.NAME+
2637static stmt_ty
2638nonlocal_stmt_rule(Parser *p)
2639{
2640 D(p->level++);
2641 if (p->error_indicator) {
2642 D(p->level--);
2643 return NULL;
2644 }
2645 stmt_ty _res = NULL;
2646 int _mark = p->mark;
2647 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2648 p->error_indicator = 1;
2649 D(p->level--);
2650 return NULL;
2651 }
2652 int _start_lineno = p->tokens[_mark]->lineno;
2653 UNUSED(_start_lineno); // Only used by EXTRA macro
2654 int _start_col_offset = p->tokens[_mark]->col_offset;
2655 UNUSED(_start_col_offset); // Only used by EXTRA macro
2656 { // 'nonlocal' ','.NAME+
2657 if (p->error_indicator) {
2658 D(p->level--);
2659 return NULL;
2660 }
2661 D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2662 Token * _keyword;
2663 asdl_seq * a;
2664 if (
2665 (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal'
2666 &&
2667 (a = _gather_27_rule(p)) // ','.NAME+
2668 )
2669 {
2670 D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2671 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2672 if (_token == NULL) {
2673 D(p->level--);
2674 return NULL;
2675 }
2676 int _end_lineno = _token->end_lineno;
2677 UNUSED(_end_lineno); // Only used by EXTRA macro
2678 int _end_col_offset = _token->end_col_offset;
2679 UNUSED(_end_col_offset); // Only used by EXTRA macro
2680 _res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2681 if (_res == NULL && PyErr_Occurred()) {
2682 p->error_indicator = 1;
2683 D(p->level--);
2684 return NULL;
2685 }
2686 goto done;
2687 }
2688 p->mark = _mark;
2689 D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2690 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
2691 }
2692 _res = NULL;
2693 done:
2694 D(p->level--);
2695 return _res;
2696}
2697
2698// yield_stmt: yield_expr
2699static stmt_ty
2700yield_stmt_rule(Parser *p)
2701{
2702 D(p->level++);
2703 if (p->error_indicator) {
2704 D(p->level--);
2705 return NULL;
2706 }
2707 stmt_ty _res = NULL;
2708 int _mark = p->mark;
2709 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2710 p->error_indicator = 1;
2711 D(p->level--);
2712 return NULL;
2713 }
2714 int _start_lineno = p->tokens[_mark]->lineno;
2715 UNUSED(_start_lineno); // Only used by EXTRA macro
2716 int _start_col_offset = p->tokens[_mark]->col_offset;
2717 UNUSED(_start_col_offset); // Only used by EXTRA macro
2718 { // yield_expr
2719 if (p->error_indicator) {
2720 D(p->level--);
2721 return NULL;
2722 }
2723 D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2724 expr_ty y;
2725 if (
2726 (y = yield_expr_rule(p)) // yield_expr
2727 )
2728 {
2729 D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2730 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2731 if (_token == NULL) {
2732 D(p->level--);
2733 return NULL;
2734 }
2735 int _end_lineno = _token->end_lineno;
2736 UNUSED(_end_lineno); // Only used by EXTRA macro
2737 int _end_col_offset = _token->end_col_offset;
2738 UNUSED(_end_col_offset); // Only used by EXTRA macro
2739 _res = _Py_Expr ( y , EXTRA );
2740 if (_res == NULL && PyErr_Occurred()) {
2741 p->error_indicator = 1;
2742 D(p->level--);
2743 return NULL;
2744 }
2745 goto done;
2746 }
2747 p->mark = _mark;
2748 D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2749 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
2750 }
2751 _res = NULL;
2752 done:
2753 D(p->level--);
2754 return _res;
2755}
2756
2757// assert_stmt: 'assert' expression [',' expression]
2758static stmt_ty
2759assert_stmt_rule(Parser *p)
2760{
2761 D(p->level++);
2762 if (p->error_indicator) {
2763 D(p->level--);
2764 return NULL;
2765 }
2766 stmt_ty _res = NULL;
2767 int _mark = p->mark;
2768 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2769 p->error_indicator = 1;
2770 D(p->level--);
2771 return NULL;
2772 }
2773 int _start_lineno = p->tokens[_mark]->lineno;
2774 UNUSED(_start_lineno); // Only used by EXTRA macro
2775 int _start_col_offset = p->tokens[_mark]->col_offset;
2776 UNUSED(_start_col_offset); // Only used by EXTRA macro
2777 { // 'assert' expression [',' expression]
2778 if (p->error_indicator) {
2779 D(p->level--);
2780 return NULL;
2781 }
2782 D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2783 Token * _keyword;
2784 expr_ty a;
2785 void *b;
2786 if (
2787 (_keyword = _PyPegen_expect_token(p, 505)) // token='assert'
2788 &&
2789 (a = expression_rule(p)) // expression
2790 &&
2791 (b = _tmp_29_rule(p), 1) // [',' expression]
2792 )
2793 {
2794 D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2795 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2796 if (_token == NULL) {
2797 D(p->level--);
2798 return NULL;
2799 }
2800 int _end_lineno = _token->end_lineno;
2801 UNUSED(_end_lineno); // Only used by EXTRA macro
2802 int _end_col_offset = _token->end_col_offset;
2803 UNUSED(_end_col_offset); // Only used by EXTRA macro
2804 _res = _Py_Assert ( a , b , EXTRA );
2805 if (_res == NULL && PyErr_Occurred()) {
2806 p->error_indicator = 1;
2807 D(p->level--);
2808 return NULL;
2809 }
2810 goto done;
2811 }
2812 p->mark = _mark;
2813 D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2814 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
2815 }
2816 _res = NULL;
2817 done:
2818 D(p->level--);
2819 return _res;
2820}
2821
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002822// del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002823static stmt_ty
2824del_stmt_rule(Parser *p)
2825{
2826 D(p->level++);
2827 if (p->error_indicator) {
2828 D(p->level--);
2829 return NULL;
2830 }
2831 stmt_ty _res = NULL;
2832 int _mark = p->mark;
2833 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2834 p->error_indicator = 1;
2835 D(p->level--);
2836 return NULL;
2837 }
2838 int _start_lineno = p->tokens[_mark]->lineno;
2839 UNUSED(_start_lineno); // Only used by EXTRA macro
2840 int _start_col_offset = p->tokens[_mark]->col_offset;
2841 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002842 { // 'del' del_targets &(';' | NEWLINE)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002843 if (p->error_indicator) {
2844 D(p->level--);
2845 return NULL;
2846 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002847 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 +01002848 Token * _keyword;
2849 asdl_seq* a;
2850 if (
2851 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
2852 &&
2853 (a = del_targets_rule(p)) // del_targets
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002854 &&
2855 _PyPegen_lookahead(1, _tmp_30_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002856 )
2857 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002858 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 +01002859 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2860 if (_token == NULL) {
2861 D(p->level--);
2862 return NULL;
2863 }
2864 int _end_lineno = _token->end_lineno;
2865 UNUSED(_end_lineno); // Only used by EXTRA macro
2866 int _end_col_offset = _token->end_col_offset;
2867 UNUSED(_end_col_offset); // Only used by EXTRA macro
2868 _res = _Py_Delete ( a , EXTRA );
2869 if (_res == NULL && PyErr_Occurred()) {
2870 p->error_indicator = 1;
2871 D(p->level--);
2872 return NULL;
2873 }
2874 goto done;
2875 }
2876 p->mark = _mark;
2877 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002878 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
2879 }
2880 { // invalid_del_stmt
2881 if (p->error_indicator) {
2882 D(p->level--);
2883 return NULL;
2884 }
2885 D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2886 void *invalid_del_stmt_var;
2887 if (
2888 (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt
2889 )
2890 {
2891 D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2892 _res = invalid_del_stmt_var;
2893 goto done;
2894 }
2895 p->mark = _mark;
2896 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2897 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002898 }
2899 _res = NULL;
2900 done:
2901 D(p->level--);
2902 return _res;
2903}
2904
2905// import_stmt: import_name | import_from
2906static stmt_ty
2907import_stmt_rule(Parser *p)
2908{
2909 D(p->level++);
2910 if (p->error_indicator) {
2911 D(p->level--);
2912 return NULL;
2913 }
2914 stmt_ty _res = NULL;
2915 int _mark = p->mark;
2916 { // import_name
2917 if (p->error_indicator) {
2918 D(p->level--);
2919 return NULL;
2920 }
2921 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name"));
2922 stmt_ty import_name_var;
2923 if (
2924 (import_name_var = import_name_rule(p)) // import_name
2925 )
2926 {
2927 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name"));
2928 _res = import_name_var;
2929 goto done;
2930 }
2931 p->mark = _mark;
2932 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2933 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name"));
2934 }
2935 { // import_from
2936 if (p->error_indicator) {
2937 D(p->level--);
2938 return NULL;
2939 }
2940 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from"));
2941 stmt_ty import_from_var;
2942 if (
2943 (import_from_var = import_from_rule(p)) // import_from
2944 )
2945 {
2946 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from"));
2947 _res = import_from_var;
2948 goto done;
2949 }
2950 p->mark = _mark;
2951 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2952 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from"));
2953 }
2954 _res = NULL;
2955 done:
2956 D(p->level--);
2957 return _res;
2958}
2959
2960// import_name: 'import' dotted_as_names
2961static stmt_ty
2962import_name_rule(Parser *p)
2963{
2964 D(p->level++);
2965 if (p->error_indicator) {
2966 D(p->level--);
2967 return NULL;
2968 }
2969 stmt_ty _res = NULL;
2970 int _mark = p->mark;
2971 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2972 p->error_indicator = 1;
2973 D(p->level--);
2974 return NULL;
2975 }
2976 int _start_lineno = p->tokens[_mark]->lineno;
2977 UNUSED(_start_lineno); // Only used by EXTRA macro
2978 int _start_col_offset = p->tokens[_mark]->col_offset;
2979 UNUSED(_start_col_offset); // Only used by EXTRA macro
2980 { // 'import' dotted_as_names
2981 if (p->error_indicator) {
2982 D(p->level--);
2983 return NULL;
2984 }
2985 D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
2986 Token * _keyword;
2987 asdl_seq* a;
2988 if (
2989 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
2990 &&
2991 (a = dotted_as_names_rule(p)) // dotted_as_names
2992 )
2993 {
2994 D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
2995 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2996 if (_token == NULL) {
2997 D(p->level--);
2998 return NULL;
2999 }
3000 int _end_lineno = _token->end_lineno;
3001 UNUSED(_end_lineno); // Only used by EXTRA macro
3002 int _end_col_offset = _token->end_col_offset;
3003 UNUSED(_end_col_offset); // Only used by EXTRA macro
3004 _res = _Py_Import ( a , EXTRA );
3005 if (_res == NULL && PyErr_Occurred()) {
3006 p->error_indicator = 1;
3007 D(p->level--);
3008 return NULL;
3009 }
3010 goto done;
3011 }
3012 p->mark = _mark;
3013 D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ',
3014 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names"));
3015 }
3016 _res = NULL;
3017 done:
3018 D(p->level--);
3019 return _res;
3020}
3021
3022// import_from:
3023// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3024// | 'from' (('.' | '...'))+ 'import' import_from_targets
3025static stmt_ty
3026import_from_rule(Parser *p)
3027{
3028 D(p->level++);
3029 if (p->error_indicator) {
3030 D(p->level--);
3031 return NULL;
3032 }
3033 stmt_ty _res = NULL;
3034 int _mark = p->mark;
3035 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3036 p->error_indicator = 1;
3037 D(p->level--);
3038 return NULL;
3039 }
3040 int _start_lineno = p->tokens[_mark]->lineno;
3041 UNUSED(_start_lineno); // Only used by EXTRA macro
3042 int _start_col_offset = p->tokens[_mark]->col_offset;
3043 UNUSED(_start_col_offset); // Only used by EXTRA macro
3044 { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3045 if (p->error_indicator) {
3046 D(p->level--);
3047 return NULL;
3048 }
3049 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3050 Token * _keyword;
3051 Token * _keyword_1;
3052 asdl_seq * a;
3053 expr_ty b;
3054 asdl_seq* c;
3055 if (
3056 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3057 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003058 (a = _loop0_31_rule(p)) // (('.' | '...'))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003059 &&
3060 (b = dotted_name_rule(p)) // dotted_name
3061 &&
3062 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3063 &&
3064 (c = import_from_targets_rule(p)) // import_from_targets
3065 )
3066 {
3067 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3068 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3069 if (_token == NULL) {
3070 D(p->level--);
3071 return NULL;
3072 }
3073 int _end_lineno = _token->end_lineno;
3074 UNUSED(_end_lineno); // Only used by EXTRA macro
3075 int _end_col_offset = _token->end_col_offset;
3076 UNUSED(_end_col_offset); // Only used by EXTRA macro
3077 _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
3078 if (_res == NULL && PyErr_Occurred()) {
3079 p->error_indicator = 1;
3080 D(p->level--);
3081 return NULL;
3082 }
3083 goto done;
3084 }
3085 p->mark = _mark;
3086 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3087 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3088 }
3089 { // 'from' (('.' | '...'))+ 'import' import_from_targets
3090 if (p->error_indicator) {
3091 D(p->level--);
3092 return NULL;
3093 }
3094 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3095 Token * _keyword;
3096 Token * _keyword_1;
3097 asdl_seq * a;
3098 asdl_seq* b;
3099 if (
3100 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3101 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003102 (a = _loop1_32_rule(p)) // (('.' | '...'))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003103 &&
3104 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3105 &&
3106 (b = import_from_targets_rule(p)) // import_from_targets
3107 )
3108 {
3109 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3110 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3111 if (_token == NULL) {
3112 D(p->level--);
3113 return NULL;
3114 }
3115 int _end_lineno = _token->end_lineno;
3116 UNUSED(_end_lineno); // Only used by EXTRA macro
3117 int _end_col_offset = _token->end_col_offset;
3118 UNUSED(_end_col_offset); // Only used by EXTRA macro
3119 _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
3120 if (_res == NULL && PyErr_Occurred()) {
3121 p->error_indicator = 1;
3122 D(p->level--);
3123 return NULL;
3124 }
3125 goto done;
3126 }
3127 p->mark = _mark;
3128 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3129 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3130 }
3131 _res = NULL;
3132 done:
3133 D(p->level--);
3134 return _res;
3135}
3136
3137// import_from_targets:
3138// | '(' import_from_as_names ','? ')'
3139// | import_from_as_names !','
3140// | '*'
3141// | invalid_import_from_targets
3142static asdl_seq*
3143import_from_targets_rule(Parser *p)
3144{
3145 D(p->level++);
3146 if (p->error_indicator) {
3147 D(p->level--);
3148 return NULL;
3149 }
3150 asdl_seq* _res = NULL;
3151 int _mark = p->mark;
3152 { // '(' import_from_as_names ','? ')'
3153 if (p->error_indicator) {
3154 D(p->level--);
3155 return NULL;
3156 }
3157 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3158 Token * _literal;
3159 Token * _literal_1;
3160 void *_opt_var;
3161 UNUSED(_opt_var); // Silence compiler warnings
3162 asdl_seq* a;
3163 if (
3164 (_literal = _PyPegen_expect_token(p, 7)) // token='('
3165 &&
3166 (a = import_from_as_names_rule(p)) // import_from_as_names
3167 &&
3168 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
3169 &&
3170 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
3171 )
3172 {
3173 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3174 _res = a;
3175 if (_res == NULL && PyErr_Occurred()) {
3176 p->error_indicator = 1;
3177 D(p->level--);
3178 return NULL;
3179 }
3180 goto done;
3181 }
3182 p->mark = _mark;
3183 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3184 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3185 }
3186 { // import_from_as_names !','
3187 if (p->error_indicator) {
3188 D(p->level--);
3189 return NULL;
3190 }
3191 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
3192 asdl_seq* import_from_as_names_var;
3193 if (
3194 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
3195 &&
3196 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
3197 )
3198 {
3199 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
3200 _res = import_from_as_names_var;
3201 goto done;
3202 }
3203 p->mark = _mark;
3204 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3205 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','"));
3206 }
3207 { // '*'
3208 if (p->error_indicator) {
3209 D(p->level--);
3210 return NULL;
3211 }
3212 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
3213 Token * _literal;
3214 if (
3215 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
3216 )
3217 {
3218 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
3219 _res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
3220 if (_res == NULL && PyErr_Occurred()) {
3221 p->error_indicator = 1;
3222 D(p->level--);
3223 return NULL;
3224 }
3225 goto done;
3226 }
3227 p->mark = _mark;
3228 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3229 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
3230 }
3231 { // invalid_import_from_targets
3232 if (p->error_indicator) {
3233 D(p->level--);
3234 return NULL;
3235 }
3236 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3237 void *invalid_import_from_targets_var;
3238 if (
3239 (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets
3240 )
3241 {
3242 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3243 _res = invalid_import_from_targets_var;
3244 goto done;
3245 }
3246 p->mark = _mark;
3247 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3248 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets"));
3249 }
3250 _res = NULL;
3251 done:
3252 D(p->level--);
3253 return _res;
3254}
3255
3256// import_from_as_names: ','.import_from_as_name+
3257static asdl_seq*
3258import_from_as_names_rule(Parser *p)
3259{
3260 D(p->level++);
3261 if (p->error_indicator) {
3262 D(p->level--);
3263 return NULL;
3264 }
3265 asdl_seq* _res = NULL;
3266 int _mark = p->mark;
3267 { // ','.import_from_as_name+
3268 if (p->error_indicator) {
3269 D(p->level--);
3270 return NULL;
3271 }
3272 D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
3273 asdl_seq * a;
3274 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003275 (a = _gather_33_rule(p)) // ','.import_from_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003276 )
3277 {
3278 D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
3279 _res = a;
3280 if (_res == NULL && PyErr_Occurred()) {
3281 p->error_indicator = 1;
3282 D(p->level--);
3283 return NULL;
3284 }
3285 goto done;
3286 }
3287 p->mark = _mark;
3288 D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3289 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+"));
3290 }
3291 _res = NULL;
3292 done:
3293 D(p->level--);
3294 return _res;
3295}
3296
3297// import_from_as_name: NAME ['as' NAME]
3298static alias_ty
3299import_from_as_name_rule(Parser *p)
3300{
3301 D(p->level++);
3302 if (p->error_indicator) {
3303 D(p->level--);
3304 return NULL;
3305 }
3306 alias_ty _res = NULL;
3307 int _mark = p->mark;
3308 { // NAME ['as' NAME]
3309 if (p->error_indicator) {
3310 D(p->level--);
3311 return NULL;
3312 }
3313 D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3314 expr_ty a;
3315 void *b;
3316 if (
3317 (a = _PyPegen_name_token(p)) // NAME
3318 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003319 (b = _tmp_35_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003320 )
3321 {
3322 D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3323 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3324 if (_res == NULL && PyErr_Occurred()) {
3325 p->error_indicator = 1;
3326 D(p->level--);
3327 return NULL;
3328 }
3329 goto done;
3330 }
3331 p->mark = _mark;
3332 D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3333 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]"));
3334 }
3335 _res = NULL;
3336 done:
3337 D(p->level--);
3338 return _res;
3339}
3340
3341// dotted_as_names: ','.dotted_as_name+
3342static asdl_seq*
3343dotted_as_names_rule(Parser *p)
3344{
3345 D(p->level++);
3346 if (p->error_indicator) {
3347 D(p->level--);
3348 return NULL;
3349 }
3350 asdl_seq* _res = NULL;
3351 int _mark = p->mark;
3352 { // ','.dotted_as_name+
3353 if (p->error_indicator) {
3354 D(p->level--);
3355 return NULL;
3356 }
3357 D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
3358 asdl_seq * a;
3359 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003360 (a = _gather_36_rule(p)) // ','.dotted_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003361 )
3362 {
3363 D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
3364 _res = a;
3365 if (_res == NULL && PyErr_Occurred()) {
3366 p->error_indicator = 1;
3367 D(p->level--);
3368 return NULL;
3369 }
3370 goto done;
3371 }
3372 p->mark = _mark;
3373 D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3374 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+"));
3375 }
3376 _res = NULL;
3377 done:
3378 D(p->level--);
3379 return _res;
3380}
3381
3382// dotted_as_name: dotted_name ['as' NAME]
3383static alias_ty
3384dotted_as_name_rule(Parser *p)
3385{
3386 D(p->level++);
3387 if (p->error_indicator) {
3388 D(p->level--);
3389 return NULL;
3390 }
3391 alias_ty _res = NULL;
3392 int _mark = p->mark;
3393 { // dotted_name ['as' NAME]
3394 if (p->error_indicator) {
3395 D(p->level--);
3396 return NULL;
3397 }
3398 D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3399 expr_ty a;
3400 void *b;
3401 if (
3402 (a = dotted_name_rule(p)) // dotted_name
3403 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003404 (b = _tmp_38_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003405 )
3406 {
3407 D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3408 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3409 if (_res == NULL && PyErr_Occurred()) {
3410 p->error_indicator = 1;
3411 D(p->level--);
3412 return NULL;
3413 }
3414 goto done;
3415 }
3416 p->mark = _mark;
3417 D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3418 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]"));
3419 }
3420 _res = NULL;
3421 done:
3422 D(p->level--);
3423 return _res;
3424}
3425
3426// Left-recursive
3427// dotted_name: dotted_name '.' NAME | NAME
3428static expr_ty dotted_name_raw(Parser *);
3429static expr_ty
3430dotted_name_rule(Parser *p)
3431{
3432 D(p->level++);
3433 expr_ty _res = NULL;
3434 if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) {
3435 D(p->level--);
3436 return _res;
3437 }
3438 int _mark = p->mark;
3439 int _resmark = p->mark;
3440 while (1) {
3441 int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res);
3442 if (tmpvar_0) {
3443 D(p->level--);
3444 return _res;
3445 }
3446 p->mark = _mark;
3447 void *_raw = dotted_name_raw(p);
3448 if (_raw == NULL || p->mark <= _resmark)
3449 break;
3450 _resmark = p->mark;
3451 _res = _raw;
3452 }
3453 p->mark = _resmark;
3454 D(p->level--);
3455 return _res;
3456}
3457static expr_ty
3458dotted_name_raw(Parser *p)
3459{
3460 D(p->level++);
3461 if (p->error_indicator) {
3462 D(p->level--);
3463 return NULL;
3464 }
3465 expr_ty _res = NULL;
3466 int _mark = p->mark;
3467 { // dotted_name '.' NAME
3468 if (p->error_indicator) {
3469 D(p->level--);
3470 return NULL;
3471 }
3472 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3473 Token * _literal;
3474 expr_ty a;
3475 expr_ty b;
3476 if (
3477 (a = dotted_name_rule(p)) // dotted_name
3478 &&
3479 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
3480 &&
3481 (b = _PyPegen_name_token(p)) // NAME
3482 )
3483 {
3484 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3485 _res = _PyPegen_join_names_with_dot ( p , a , b );
3486 if (_res == NULL && PyErr_Occurred()) {
3487 p->error_indicator = 1;
3488 D(p->level--);
3489 return NULL;
3490 }
3491 goto done;
3492 }
3493 p->mark = _mark;
3494 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3495 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME"));
3496 }
3497 { // NAME
3498 if (p->error_indicator) {
3499 D(p->level--);
3500 return NULL;
3501 }
3502 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
3503 expr_ty name_var;
3504 if (
3505 (name_var = _PyPegen_name_token(p)) // NAME
3506 )
3507 {
3508 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
3509 _res = name_var;
3510 goto done;
3511 }
3512 p->mark = _mark;
3513 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3514 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
3515 }
3516 _res = NULL;
3517 done:
3518 D(p->level--);
3519 return _res;
3520}
3521
3522// if_stmt:
3523// | 'if' named_expression ':' block elif_stmt
3524// | 'if' named_expression ':' block else_block?
3525static stmt_ty
3526if_stmt_rule(Parser *p)
3527{
3528 D(p->level++);
3529 if (p->error_indicator) {
3530 D(p->level--);
3531 return NULL;
3532 }
3533 stmt_ty _res = NULL;
3534 int _mark = p->mark;
3535 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3536 p->error_indicator = 1;
3537 D(p->level--);
3538 return NULL;
3539 }
3540 int _start_lineno = p->tokens[_mark]->lineno;
3541 UNUSED(_start_lineno); // Only used by EXTRA macro
3542 int _start_col_offset = p->tokens[_mark]->col_offset;
3543 UNUSED(_start_col_offset); // Only used by EXTRA macro
3544 { // 'if' named_expression ':' block elif_stmt
3545 if (p->error_indicator) {
3546 D(p->level--);
3547 return NULL;
3548 }
3549 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3550 Token * _keyword;
3551 Token * _literal;
3552 expr_ty a;
3553 asdl_seq* b;
3554 stmt_ty c;
3555 if (
3556 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3557 &&
3558 (a = named_expression_rule(p)) // named_expression
3559 &&
3560 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3561 &&
3562 (b = block_rule(p)) // block
3563 &&
3564 (c = elif_stmt_rule(p)) // elif_stmt
3565 )
3566 {
3567 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3568 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3569 if (_token == NULL) {
3570 D(p->level--);
3571 return NULL;
3572 }
3573 int _end_lineno = _token->end_lineno;
3574 UNUSED(_end_lineno); // Only used by EXTRA macro
3575 int _end_col_offset = _token->end_col_offset;
3576 UNUSED(_end_col_offset); // Only used by EXTRA macro
3577 _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
3578 if (_res == NULL && PyErr_Occurred()) {
3579 p->error_indicator = 1;
3580 D(p->level--);
3581 return NULL;
3582 }
3583 goto done;
3584 }
3585 p->mark = _mark;
3586 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3587 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3588 }
3589 { // 'if' named_expression ':' block else_block?
3590 if (p->error_indicator) {
3591 D(p->level--);
3592 return NULL;
3593 }
3594 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3595 Token * _keyword;
3596 Token * _literal;
3597 expr_ty a;
3598 asdl_seq* b;
3599 void *c;
3600 if (
3601 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3602 &&
3603 (a = named_expression_rule(p)) // named_expression
3604 &&
3605 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3606 &&
3607 (b = block_rule(p)) // block
3608 &&
3609 (c = else_block_rule(p), 1) // else_block?
3610 )
3611 {
3612 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3613 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3614 if (_token == NULL) {
3615 D(p->level--);
3616 return NULL;
3617 }
3618 int _end_lineno = _token->end_lineno;
3619 UNUSED(_end_lineno); // Only used by EXTRA macro
3620 int _end_col_offset = _token->end_col_offset;
3621 UNUSED(_end_col_offset); // Only used by EXTRA macro
3622 _res = _Py_If ( a , b , c , EXTRA );
3623 if (_res == NULL && PyErr_Occurred()) {
3624 p->error_indicator = 1;
3625 D(p->level--);
3626 return NULL;
3627 }
3628 goto done;
3629 }
3630 p->mark = _mark;
3631 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3632 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?"));
3633 }
3634 _res = NULL;
3635 done:
3636 D(p->level--);
3637 return _res;
3638}
3639
3640// elif_stmt:
3641// | 'elif' named_expression ':' block elif_stmt
3642// | 'elif' named_expression ':' block else_block?
3643static stmt_ty
3644elif_stmt_rule(Parser *p)
3645{
3646 D(p->level++);
3647 if (p->error_indicator) {
3648 D(p->level--);
3649 return NULL;
3650 }
3651 stmt_ty _res = NULL;
3652 int _mark = p->mark;
3653 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3654 p->error_indicator = 1;
3655 D(p->level--);
3656 return NULL;
3657 }
3658 int _start_lineno = p->tokens[_mark]->lineno;
3659 UNUSED(_start_lineno); // Only used by EXTRA macro
3660 int _start_col_offset = p->tokens[_mark]->col_offset;
3661 UNUSED(_start_col_offset); // Only used by EXTRA macro
3662 { // 'elif' named_expression ':' block elif_stmt
3663 if (p->error_indicator) {
3664 D(p->level--);
3665 return NULL;
3666 }
3667 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3668 Token * _keyword;
3669 Token * _literal;
3670 expr_ty a;
3671 asdl_seq* b;
3672 stmt_ty c;
3673 if (
3674 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3675 &&
3676 (a = named_expression_rule(p)) // named_expression
3677 &&
3678 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3679 &&
3680 (b = block_rule(p)) // block
3681 &&
3682 (c = elif_stmt_rule(p)) // elif_stmt
3683 )
3684 {
3685 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3686 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3687 if (_token == NULL) {
3688 D(p->level--);
3689 return NULL;
3690 }
3691 int _end_lineno = _token->end_lineno;
3692 UNUSED(_end_lineno); // Only used by EXTRA macro
3693 int _end_col_offset = _token->end_col_offset;
3694 UNUSED(_end_col_offset); // Only used by EXTRA macro
3695 _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
3696 if (_res == NULL && PyErr_Occurred()) {
3697 p->error_indicator = 1;
3698 D(p->level--);
3699 return NULL;
3700 }
3701 goto done;
3702 }
3703 p->mark = _mark;
3704 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3705 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3706 }
3707 { // 'elif' named_expression ':' block else_block?
3708 if (p->error_indicator) {
3709 D(p->level--);
3710 return NULL;
3711 }
3712 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3713 Token * _keyword;
3714 Token * _literal;
3715 expr_ty a;
3716 asdl_seq* b;
3717 void *c;
3718 if (
3719 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3720 &&
3721 (a = named_expression_rule(p)) // named_expression
3722 &&
3723 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3724 &&
3725 (b = block_rule(p)) // block
3726 &&
3727 (c = else_block_rule(p), 1) // else_block?
3728 )
3729 {
3730 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3731 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3732 if (_token == NULL) {
3733 D(p->level--);
3734 return NULL;
3735 }
3736 int _end_lineno = _token->end_lineno;
3737 UNUSED(_end_lineno); // Only used by EXTRA macro
3738 int _end_col_offset = _token->end_col_offset;
3739 UNUSED(_end_col_offset); // Only used by EXTRA macro
3740 _res = _Py_If ( a , b , c , EXTRA );
3741 if (_res == NULL && PyErr_Occurred()) {
3742 p->error_indicator = 1;
3743 D(p->level--);
3744 return NULL;
3745 }
3746 goto done;
3747 }
3748 p->mark = _mark;
3749 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3750 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3751 }
3752 _res = NULL;
3753 done:
3754 D(p->level--);
3755 return _res;
3756}
3757
3758// else_block: 'else' ':' block
3759static asdl_seq*
3760else_block_rule(Parser *p)
3761{
3762 D(p->level++);
3763 if (p->error_indicator) {
3764 D(p->level--);
3765 return NULL;
3766 }
3767 asdl_seq* _res = NULL;
3768 int _mark = p->mark;
3769 { // 'else' ':' block
3770 if (p->error_indicator) {
3771 D(p->level--);
3772 return NULL;
3773 }
3774 D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3775 Token * _keyword;
3776 Token * _literal;
3777 asdl_seq* b;
3778 if (
3779 (_keyword = _PyPegen_expect_token(p, 516)) // token='else'
3780 &&
3781 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3782 &&
3783 (b = block_rule(p)) // block
3784 )
3785 {
3786 D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3787 _res = b;
3788 if (_res == NULL && PyErr_Occurred()) {
3789 p->error_indicator = 1;
3790 D(p->level--);
3791 return NULL;
3792 }
3793 goto done;
3794 }
3795 p->mark = _mark;
3796 D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
3797 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block"));
3798 }
3799 _res = NULL;
3800 done:
3801 D(p->level--);
3802 return _res;
3803}
3804
3805// while_stmt: 'while' named_expression ':' block else_block?
3806static stmt_ty
3807while_stmt_rule(Parser *p)
3808{
3809 D(p->level++);
3810 if (p->error_indicator) {
3811 D(p->level--);
3812 return NULL;
3813 }
3814 stmt_ty _res = NULL;
3815 int _mark = p->mark;
3816 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3817 p->error_indicator = 1;
3818 D(p->level--);
3819 return NULL;
3820 }
3821 int _start_lineno = p->tokens[_mark]->lineno;
3822 UNUSED(_start_lineno); // Only used by EXTRA macro
3823 int _start_col_offset = p->tokens[_mark]->col_offset;
3824 UNUSED(_start_col_offset); // Only used by EXTRA macro
3825 { // 'while' named_expression ':' block else_block?
3826 if (p->error_indicator) {
3827 D(p->level--);
3828 return NULL;
3829 }
3830 D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3831 Token * _keyword;
3832 Token * _literal;
3833 expr_ty a;
3834 asdl_seq* b;
3835 void *c;
3836 if (
3837 (_keyword = _PyPegen_expect_token(p, 512)) // token='while'
3838 &&
3839 (a = named_expression_rule(p)) // named_expression
3840 &&
3841 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3842 &&
3843 (b = block_rule(p)) // block
3844 &&
3845 (c = else_block_rule(p), 1) // else_block?
3846 )
3847 {
3848 D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3849 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3850 if (_token == NULL) {
3851 D(p->level--);
3852 return NULL;
3853 }
3854 int _end_lineno = _token->end_lineno;
3855 UNUSED(_end_lineno); // Only used by EXTRA macro
3856 int _end_col_offset = _token->end_col_offset;
3857 UNUSED(_end_col_offset); // Only used by EXTRA macro
3858 _res = _Py_While ( a , b , c , EXTRA );
3859 if (_res == NULL && PyErr_Occurred()) {
3860 p->error_indicator = 1;
3861 D(p->level--);
3862 return NULL;
3863 }
3864 goto done;
3865 }
3866 p->mark = _mark;
3867 D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3868 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?"));
3869 }
3870 _res = NULL;
3871 done:
3872 D(p->level--);
3873 return _res;
3874}
3875
3876// for_stmt:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003877// | 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3878// | ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3879// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003880static stmt_ty
3881for_stmt_rule(Parser *p)
3882{
3883 D(p->level++);
3884 if (p->error_indicator) {
3885 D(p->level--);
3886 return NULL;
3887 }
3888 stmt_ty _res = NULL;
3889 int _mark = p->mark;
3890 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3891 p->error_indicator = 1;
3892 D(p->level--);
3893 return NULL;
3894 }
3895 int _start_lineno = p->tokens[_mark]->lineno;
3896 UNUSED(_start_lineno); // Only used by EXTRA macro
3897 int _start_col_offset = p->tokens[_mark]->col_offset;
3898 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003899 { // 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003900 if (p->error_indicator) {
3901 D(p->level--);
3902 return NULL;
3903 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003904 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?"));
3905 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003906 Token * _keyword;
3907 Token * _keyword_1;
3908 Token * _literal;
3909 asdl_seq* b;
3910 void *el;
3911 expr_ty ex;
3912 expr_ty t;
3913 void *tc;
3914 if (
3915 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3916 &&
3917 (t = star_targets_rule(p)) // star_targets
3918 &&
3919 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3920 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003921 (_cut_var = 1)
3922 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003923 (ex = star_expressions_rule(p)) // star_expressions
3924 &&
3925 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3926 &&
3927 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
3928 &&
3929 (b = block_rule(p)) // block
3930 &&
3931 (el = else_block_rule(p), 1) // else_block?
3932 )
3933 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003934 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 +01003935 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3936 if (_token == NULL) {
3937 D(p->level--);
3938 return NULL;
3939 }
3940 int _end_lineno = _token->end_lineno;
3941 UNUSED(_end_lineno); // Only used by EXTRA macro
3942 int _end_col_offset = _token->end_col_offset;
3943 UNUSED(_end_col_offset); // Only used by EXTRA macro
3944 _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
3945 if (_res == NULL && PyErr_Occurred()) {
3946 p->error_indicator = 1;
3947 D(p->level--);
3948 return NULL;
3949 }
3950 goto done;
3951 }
3952 p->mark = _mark;
3953 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003954 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
3955 if (_cut_var) {
3956 D(p->level--);
3957 return NULL;
3958 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003959 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003960 { // ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003961 if (p->error_indicator) {
3962 D(p->level--);
3963 return NULL;
3964 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003965 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?"));
3966 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003967 Token * _keyword;
3968 Token * _keyword_1;
3969 Token * _literal;
3970 Token * async_var;
3971 asdl_seq* b;
3972 void *el;
3973 expr_ty ex;
3974 expr_ty t;
3975 void *tc;
3976 if (
3977 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
3978 &&
3979 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3980 &&
3981 (t = star_targets_rule(p)) // star_targets
3982 &&
3983 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3984 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003985 (_cut_var = 1)
3986 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003987 (ex = star_expressions_rule(p)) // star_expressions
3988 &&
3989 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3990 &&
3991 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
3992 &&
3993 (b = block_rule(p)) // block
3994 &&
3995 (el = else_block_rule(p), 1) // else_block?
3996 )
3997 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003998 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 +01003999 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4000 if (_token == NULL) {
4001 D(p->level--);
4002 return NULL;
4003 }
4004 int _end_lineno = _token->end_lineno;
4005 UNUSED(_end_lineno); // Only used by EXTRA macro
4006 int _end_col_offset = _token->end_col_offset;
4007 UNUSED(_end_col_offset); // Only used by EXTRA macro
4008 _res = CHECK_VERSION ( 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
4009 if (_res == NULL && PyErr_Occurred()) {
4010 p->error_indicator = 1;
4011 D(p->level--);
4012 return NULL;
4013 }
4014 goto done;
4015 }
4016 p->mark = _mark;
4017 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004018 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
4019 if (_cut_var) {
4020 D(p->level--);
4021 return NULL;
4022 }
4023 }
4024 { // invalid_for_target
4025 if (p->error_indicator) {
4026 D(p->level--);
4027 return NULL;
4028 }
4029 D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4030 void *invalid_for_target_var;
4031 if (
4032 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
4033 )
4034 {
4035 D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4036 _res = invalid_for_target_var;
4037 goto done;
4038 }
4039 p->mark = _mark;
4040 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4041 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004042 }
4043 _res = NULL;
4044 done:
4045 D(p->level--);
4046 return _res;
4047}
4048
4049// with_stmt:
4050// | 'with' '(' ','.with_item+ ','? ')' ':' block
4051// | 'with' ','.with_item+ ':' TYPE_COMMENT? block
4052// | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4053// | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4054static stmt_ty
4055with_stmt_rule(Parser *p)
4056{
4057 D(p->level++);
4058 if (p->error_indicator) {
4059 D(p->level--);
4060 return NULL;
4061 }
4062 stmt_ty _res = NULL;
4063 int _mark = p->mark;
4064 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4065 p->error_indicator = 1;
4066 D(p->level--);
4067 return NULL;
4068 }
4069 int _start_lineno = p->tokens[_mark]->lineno;
4070 UNUSED(_start_lineno); // Only used by EXTRA macro
4071 int _start_col_offset = p->tokens[_mark]->col_offset;
4072 UNUSED(_start_col_offset); // Only used by EXTRA macro
4073 { // 'with' '(' ','.with_item+ ','? ')' ':' block
4074 if (p->error_indicator) {
4075 D(p->level--);
4076 return NULL;
4077 }
4078 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4079 Token * _keyword;
4080 Token * _literal;
4081 Token * _literal_1;
4082 Token * _literal_2;
4083 void *_opt_var;
4084 UNUSED(_opt_var); // Silence compiler warnings
4085 asdl_seq * a;
4086 asdl_seq* b;
4087 if (
4088 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4089 &&
4090 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4091 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004092 (a = _gather_39_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004093 &&
4094 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4095 &&
4096 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4097 &&
4098 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4099 &&
4100 (b = block_rule(p)) // block
4101 )
4102 {
4103 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4104 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4105 if (_token == NULL) {
4106 D(p->level--);
4107 return NULL;
4108 }
4109 int _end_lineno = _token->end_lineno;
4110 UNUSED(_end_lineno); // Only used by EXTRA macro
4111 int _end_col_offset = _token->end_col_offset;
4112 UNUSED(_end_col_offset); // Only used by EXTRA macro
4113 _res = _Py_With ( a , b , NULL , EXTRA );
4114 if (_res == NULL && PyErr_Occurred()) {
4115 p->error_indicator = 1;
4116 D(p->level--);
4117 return NULL;
4118 }
4119 goto done;
4120 }
4121 p->mark = _mark;
4122 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4123 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4124 }
4125 { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
4126 if (p->error_indicator) {
4127 D(p->level--);
4128 return NULL;
4129 }
4130 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4131 Token * _keyword;
4132 Token * _literal;
4133 asdl_seq * a;
4134 asdl_seq* b;
4135 void *tc;
4136 if (
4137 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4138 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004139 (a = _gather_41_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004140 &&
4141 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4142 &&
4143 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4144 &&
4145 (b = block_rule(p)) // block
4146 )
4147 {
4148 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4149 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4150 if (_token == NULL) {
4151 D(p->level--);
4152 return NULL;
4153 }
4154 int _end_lineno = _token->end_lineno;
4155 UNUSED(_end_lineno); // Only used by EXTRA macro
4156 int _end_col_offset = _token->end_col_offset;
4157 UNUSED(_end_col_offset); // Only used by EXTRA macro
4158 _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4159 if (_res == NULL && PyErr_Occurred()) {
4160 p->error_indicator = 1;
4161 D(p->level--);
4162 return NULL;
4163 }
4164 goto done;
4165 }
4166 p->mark = _mark;
4167 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4168 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4169 }
4170 { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4171 if (p->error_indicator) {
4172 D(p->level--);
4173 return NULL;
4174 }
4175 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4176 Token * _keyword;
4177 Token * _literal;
4178 Token * _literal_1;
4179 Token * _literal_2;
4180 void *_opt_var;
4181 UNUSED(_opt_var); // Silence compiler warnings
4182 asdl_seq * a;
4183 Token * async_var;
4184 asdl_seq* b;
4185 if (
4186 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4187 &&
4188 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4189 &&
4190 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4191 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004192 (a = _gather_43_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004193 &&
4194 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4195 &&
4196 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4197 &&
4198 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4199 &&
4200 (b = block_rule(p)) // block
4201 )
4202 {
4203 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4204 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4205 if (_token == NULL) {
4206 D(p->level--);
4207 return NULL;
4208 }
4209 int _end_lineno = _token->end_lineno;
4210 UNUSED(_end_lineno); // Only used by EXTRA macro
4211 int _end_col_offset = _token->end_col_offset;
4212 UNUSED(_end_col_offset); // Only used by EXTRA macro
4213 _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) );
4214 if (_res == NULL && PyErr_Occurred()) {
4215 p->error_indicator = 1;
4216 D(p->level--);
4217 return NULL;
4218 }
4219 goto done;
4220 }
4221 p->mark = _mark;
4222 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4223 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4224 }
4225 { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4226 if (p->error_indicator) {
4227 D(p->level--);
4228 return NULL;
4229 }
4230 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4231 Token * _keyword;
4232 Token * _literal;
4233 asdl_seq * a;
4234 Token * async_var;
4235 asdl_seq* b;
4236 void *tc;
4237 if (
4238 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4239 &&
4240 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4241 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004242 (a = _gather_45_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004243 &&
4244 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4245 &&
4246 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4247 &&
4248 (b = block_rule(p)) // block
4249 )
4250 {
4251 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4252 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4253 if (_token == NULL) {
4254 D(p->level--);
4255 return NULL;
4256 }
4257 int _end_lineno = _token->end_lineno;
4258 UNUSED(_end_lineno); // Only used by EXTRA macro
4259 int _end_col_offset = _token->end_col_offset;
4260 UNUSED(_end_col_offset); // Only used by EXTRA macro
4261 _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
4262 if (_res == NULL && PyErr_Occurred()) {
4263 p->error_indicator = 1;
4264 D(p->level--);
4265 return NULL;
4266 }
4267 goto done;
4268 }
4269 p->mark = _mark;
4270 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4271 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4272 }
4273 _res = NULL;
4274 done:
4275 D(p->level--);
4276 return _res;
4277}
4278
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004279// with_item: expression 'as' target &(',' | ')' | ':') | invalid_with_item | expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004280static withitem_ty
4281with_item_rule(Parser *p)
4282{
4283 D(p->level++);
4284 if (p->error_indicator) {
4285 D(p->level--);
4286 return NULL;
4287 }
4288 withitem_ty _res = NULL;
4289 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004290 { // expression 'as' target &(',' | ')' | ':')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004291 if (p->error_indicator) {
4292 D(p->level--);
4293 return NULL;
4294 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004295 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4296 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004297 expr_ty e;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004298 expr_ty t;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004299 if (
4300 (e = expression_rule(p)) // expression
4301 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004302 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
4303 &&
4304 (t = target_rule(p)) // target
4305 &&
4306 _PyPegen_lookahead(1, _tmp_47_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004307 )
4308 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004309 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4310 _res = _Py_withitem ( e , t , p -> arena );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004311 if (_res == NULL && PyErr_Occurred()) {
4312 p->error_indicator = 1;
4313 D(p->level--);
4314 return NULL;
4315 }
4316 goto done;
4317 }
4318 p->mark = _mark;
4319 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004320 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4321 }
4322 { // invalid_with_item
4323 if (p->error_indicator) {
4324 D(p->level--);
4325 return NULL;
4326 }
4327 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4328 void *invalid_with_item_var;
4329 if (
4330 (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item
4331 )
4332 {
4333 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4334 _res = invalid_with_item_var;
4335 goto done;
4336 }
4337 p->mark = _mark;
4338 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4339 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
4340 }
4341 { // expression
4342 if (p->error_indicator) {
4343 D(p->level--);
4344 return NULL;
4345 }
4346 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
4347 expr_ty e;
4348 if (
4349 (e = expression_rule(p)) // expression
4350 )
4351 {
4352 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
4353 _res = _Py_withitem ( e , NULL , p -> arena );
4354 if (_res == NULL && PyErr_Occurred()) {
4355 p->error_indicator = 1;
4356 D(p->level--);
4357 return NULL;
4358 }
4359 goto done;
4360 }
4361 p->mark = _mark;
4362 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4363 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004364 }
4365 _res = NULL;
4366 done:
4367 D(p->level--);
4368 return _res;
4369}
4370
4371// try_stmt:
4372// | 'try' ':' block finally_block
4373// | 'try' ':' block except_block+ else_block? finally_block?
4374static stmt_ty
4375try_stmt_rule(Parser *p)
4376{
4377 D(p->level++);
4378 if (p->error_indicator) {
4379 D(p->level--);
4380 return NULL;
4381 }
4382 stmt_ty _res = NULL;
4383 int _mark = p->mark;
4384 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4385 p->error_indicator = 1;
4386 D(p->level--);
4387 return NULL;
4388 }
4389 int _start_lineno = p->tokens[_mark]->lineno;
4390 UNUSED(_start_lineno); // Only used by EXTRA macro
4391 int _start_col_offset = p->tokens[_mark]->col_offset;
4392 UNUSED(_start_col_offset); // Only used by EXTRA macro
4393 { // 'try' ':' block finally_block
4394 if (p->error_indicator) {
4395 D(p->level--);
4396 return NULL;
4397 }
4398 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4399 Token * _keyword;
4400 Token * _literal;
4401 asdl_seq* b;
4402 asdl_seq* f;
4403 if (
4404 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4405 &&
4406 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4407 &&
4408 (b = block_rule(p)) // block
4409 &&
4410 (f = finally_block_rule(p)) // finally_block
4411 )
4412 {
4413 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4414 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4415 if (_token == NULL) {
4416 D(p->level--);
4417 return NULL;
4418 }
4419 int _end_lineno = _token->end_lineno;
4420 UNUSED(_end_lineno); // Only used by EXTRA macro
4421 int _end_col_offset = _token->end_col_offset;
4422 UNUSED(_end_col_offset); // Only used by EXTRA macro
4423 _res = _Py_Try ( b , NULL , NULL , f , EXTRA );
4424 if (_res == NULL && PyErr_Occurred()) {
4425 p->error_indicator = 1;
4426 D(p->level--);
4427 return NULL;
4428 }
4429 goto done;
4430 }
4431 p->mark = _mark;
4432 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4433 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block finally_block"));
4434 }
4435 { // 'try' ':' block except_block+ else_block? finally_block?
4436 if (p->error_indicator) {
4437 D(p->level--);
4438 return NULL;
4439 }
4440 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4441 Token * _keyword;
4442 Token * _literal;
4443 asdl_seq* b;
4444 void *el;
4445 asdl_seq * ex;
4446 void *f;
4447 if (
4448 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4449 &&
4450 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4451 &&
4452 (b = block_rule(p)) // block
4453 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004454 (ex = _loop1_48_rule(p)) // except_block+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004455 &&
4456 (el = else_block_rule(p), 1) // else_block?
4457 &&
4458 (f = finally_block_rule(p), 1) // finally_block?
4459 )
4460 {
4461 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4462 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4463 if (_token == NULL) {
4464 D(p->level--);
4465 return NULL;
4466 }
4467 int _end_lineno = _token->end_lineno;
4468 UNUSED(_end_lineno); // Only used by EXTRA macro
4469 int _end_col_offset = _token->end_col_offset;
4470 UNUSED(_end_col_offset); // Only used by EXTRA macro
4471 _res = _Py_Try ( b , ex , el , f , EXTRA );
4472 if (_res == NULL && PyErr_Occurred()) {
4473 p->error_indicator = 1;
4474 D(p->level--);
4475 return NULL;
4476 }
4477 goto done;
4478 }
4479 p->mark = _mark;
4480 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4481 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4482 }
4483 _res = NULL;
4484 done:
4485 D(p->level--);
4486 return _res;
4487}
4488
4489// except_block: 'except' expression ['as' NAME] ':' block | 'except' ':' block
4490static excepthandler_ty
4491except_block_rule(Parser *p)
4492{
4493 D(p->level++);
4494 if (p->error_indicator) {
4495 D(p->level--);
4496 return NULL;
4497 }
4498 excepthandler_ty _res = NULL;
4499 int _mark = p->mark;
4500 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4501 p->error_indicator = 1;
4502 D(p->level--);
4503 return NULL;
4504 }
4505 int _start_lineno = p->tokens[_mark]->lineno;
4506 UNUSED(_start_lineno); // Only used by EXTRA macro
4507 int _start_col_offset = p->tokens[_mark]->col_offset;
4508 UNUSED(_start_col_offset); // Only used by EXTRA macro
4509 { // 'except' expression ['as' NAME] ':' block
4510 if (p->error_indicator) {
4511 D(p->level--);
4512 return NULL;
4513 }
4514 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4515 Token * _keyword;
4516 Token * _literal;
4517 asdl_seq* b;
4518 expr_ty e;
4519 void *t;
4520 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004521 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004522 &&
4523 (e = expression_rule(p)) // expression
4524 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004525 (t = _tmp_49_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004526 &&
4527 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4528 &&
4529 (b = block_rule(p)) // block
4530 )
4531 {
4532 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4533 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4534 if (_token == NULL) {
4535 D(p->level--);
4536 return NULL;
4537 }
4538 int _end_lineno = _token->end_lineno;
4539 UNUSED(_end_lineno); // Only used by EXTRA macro
4540 int _end_col_offset = _token->end_col_offset;
4541 UNUSED(_end_col_offset); // Only used by EXTRA macro
4542 _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
4543 if (_res == NULL && PyErr_Occurred()) {
4544 p->error_indicator = 1;
4545 D(p->level--);
4546 return NULL;
4547 }
4548 goto done;
4549 }
4550 p->mark = _mark;
4551 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4552 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4553 }
4554 { // 'except' ':' block
4555 if (p->error_indicator) {
4556 D(p->level--);
4557 return NULL;
4558 }
4559 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4560 Token * _keyword;
4561 Token * _literal;
4562 asdl_seq* b;
4563 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004564 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004565 &&
4566 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4567 &&
4568 (b = block_rule(p)) // block
4569 )
4570 {
4571 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4572 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4573 if (_token == NULL) {
4574 D(p->level--);
4575 return NULL;
4576 }
4577 int _end_lineno = _token->end_lineno;
4578 UNUSED(_end_lineno); // Only used by EXTRA macro
4579 int _end_col_offset = _token->end_col_offset;
4580 UNUSED(_end_col_offset); // Only used by EXTRA macro
4581 _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
4582 if (_res == NULL && PyErr_Occurred()) {
4583 p->error_indicator = 1;
4584 D(p->level--);
4585 return NULL;
4586 }
4587 goto done;
4588 }
4589 p->mark = _mark;
4590 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4591 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
4592 }
4593 _res = NULL;
4594 done:
4595 D(p->level--);
4596 return _res;
4597}
4598
4599// finally_block: 'finally' ':' block
4600static asdl_seq*
4601finally_block_rule(Parser *p)
4602{
4603 D(p->level++);
4604 if (p->error_indicator) {
4605 D(p->level--);
4606 return NULL;
4607 }
4608 asdl_seq* _res = NULL;
4609 int _mark = p->mark;
4610 { // 'finally' ':' block
4611 if (p->error_indicator) {
4612 D(p->level--);
4613 return NULL;
4614 }
4615 D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4616 Token * _keyword;
4617 Token * _literal;
4618 asdl_seq* a;
4619 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004620 (_keyword = _PyPegen_expect_token(p, 522)) // token='finally'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004621 &&
4622 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4623 &&
4624 (a = block_rule(p)) // block
4625 )
4626 {
4627 D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4628 _res = a;
4629 if (_res == NULL && PyErr_Occurred()) {
4630 p->error_indicator = 1;
4631 D(p->level--);
4632 return NULL;
4633 }
4634 goto done;
4635 }
4636 p->mark = _mark;
4637 D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
4638 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block"));
4639 }
4640 _res = NULL;
4641 done:
4642 D(p->level--);
4643 return _res;
4644}
4645
4646// return_stmt: 'return' star_expressions?
4647static stmt_ty
4648return_stmt_rule(Parser *p)
4649{
4650 D(p->level++);
4651 if (p->error_indicator) {
4652 D(p->level--);
4653 return NULL;
4654 }
4655 stmt_ty _res = NULL;
4656 int _mark = p->mark;
4657 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4658 p->error_indicator = 1;
4659 D(p->level--);
4660 return NULL;
4661 }
4662 int _start_lineno = p->tokens[_mark]->lineno;
4663 UNUSED(_start_lineno); // Only used by EXTRA macro
4664 int _start_col_offset = p->tokens[_mark]->col_offset;
4665 UNUSED(_start_col_offset); // Only used by EXTRA macro
4666 { // 'return' star_expressions?
4667 if (p->error_indicator) {
4668 D(p->level--);
4669 return NULL;
4670 }
4671 D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4672 Token * _keyword;
4673 void *a;
4674 if (
4675 (_keyword = _PyPegen_expect_token(p, 500)) // token='return'
4676 &&
4677 (a = star_expressions_rule(p), 1) // star_expressions?
4678 )
4679 {
4680 D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4681 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4682 if (_token == NULL) {
4683 D(p->level--);
4684 return NULL;
4685 }
4686 int _end_lineno = _token->end_lineno;
4687 UNUSED(_end_lineno); // Only used by EXTRA macro
4688 int _end_col_offset = _token->end_col_offset;
4689 UNUSED(_end_col_offset); // Only used by EXTRA macro
4690 _res = _Py_Return ( a , EXTRA );
4691 if (_res == NULL && PyErr_Occurred()) {
4692 p->error_indicator = 1;
4693 D(p->level--);
4694 return NULL;
4695 }
4696 goto done;
4697 }
4698 p->mark = _mark;
4699 D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4700 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
4701 }
4702 _res = NULL;
4703 done:
4704 D(p->level--);
4705 return _res;
4706}
4707
4708// raise_stmt: 'raise' expression ['from' expression] | 'raise'
4709static stmt_ty
4710raise_stmt_rule(Parser *p)
4711{
4712 D(p->level++);
4713 if (p->error_indicator) {
4714 D(p->level--);
4715 return NULL;
4716 }
4717 stmt_ty _res = NULL;
4718 int _mark = p->mark;
4719 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4720 p->error_indicator = 1;
4721 D(p->level--);
4722 return NULL;
4723 }
4724 int _start_lineno = p->tokens[_mark]->lineno;
4725 UNUSED(_start_lineno); // Only used by EXTRA macro
4726 int _start_col_offset = p->tokens[_mark]->col_offset;
4727 UNUSED(_start_col_offset); // Only used by EXTRA macro
4728 { // 'raise' expression ['from' expression]
4729 if (p->error_indicator) {
4730 D(p->level--);
4731 return NULL;
4732 }
4733 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4734 Token * _keyword;
4735 expr_ty a;
4736 void *b;
4737 if (
4738 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4739 &&
4740 (a = expression_rule(p)) // expression
4741 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004742 (b = _tmp_50_rule(p), 1) // ['from' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004743 )
4744 {
4745 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4746 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4747 if (_token == NULL) {
4748 D(p->level--);
4749 return NULL;
4750 }
4751 int _end_lineno = _token->end_lineno;
4752 UNUSED(_end_lineno); // Only used by EXTRA macro
4753 int _end_col_offset = _token->end_col_offset;
4754 UNUSED(_end_col_offset); // Only used by EXTRA macro
4755 _res = _Py_Raise ( a , b , EXTRA );
4756 if (_res == NULL && PyErr_Occurred()) {
4757 p->error_indicator = 1;
4758 D(p->level--);
4759 return NULL;
4760 }
4761 goto done;
4762 }
4763 p->mark = _mark;
4764 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4765 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
4766 }
4767 { // 'raise'
4768 if (p->error_indicator) {
4769 D(p->level--);
4770 return NULL;
4771 }
4772 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
4773 Token * _keyword;
4774 if (
4775 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4776 )
4777 {
4778 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
4779 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4780 if (_token == NULL) {
4781 D(p->level--);
4782 return NULL;
4783 }
4784 int _end_lineno = _token->end_lineno;
4785 UNUSED(_end_lineno); // Only used by EXTRA macro
4786 int _end_col_offset = _token->end_col_offset;
4787 UNUSED(_end_col_offset); // Only used by EXTRA macro
4788 _res = _Py_Raise ( NULL , NULL , EXTRA );
4789 if (_res == NULL && PyErr_Occurred()) {
4790 p->error_indicator = 1;
4791 D(p->level--);
4792 return NULL;
4793 }
4794 goto done;
4795 }
4796 p->mark = _mark;
4797 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4798 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
4799 }
4800 _res = NULL;
4801 done:
4802 D(p->level--);
4803 return _res;
4804}
4805
4806// function_def: decorators function_def_raw | function_def_raw
4807static stmt_ty
4808function_def_rule(Parser *p)
4809{
4810 D(p->level++);
4811 if (p->error_indicator) {
4812 D(p->level--);
4813 return NULL;
4814 }
4815 stmt_ty _res = NULL;
4816 int _mark = p->mark;
4817 { // decorators function_def_raw
4818 if (p->error_indicator) {
4819 D(p->level--);
4820 return NULL;
4821 }
4822 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4823 asdl_seq* d;
4824 stmt_ty f;
4825 if (
4826 (d = decorators_rule(p)) // decorators
4827 &&
4828 (f = function_def_raw_rule(p)) // function_def_raw
4829 )
4830 {
4831 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4832 _res = _PyPegen_function_def_decorators ( p , d , f );
4833 if (_res == NULL && PyErr_Occurred()) {
4834 p->error_indicator = 1;
4835 D(p->level--);
4836 return NULL;
4837 }
4838 goto done;
4839 }
4840 p->mark = _mark;
4841 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4842 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
4843 }
4844 { // function_def_raw
4845 if (p->error_indicator) {
4846 D(p->level--);
4847 return NULL;
4848 }
4849 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4850 stmt_ty function_def_raw_var;
4851 if (
4852 (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
4853 )
4854 {
4855 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4856 _res = function_def_raw_var;
4857 goto done;
4858 }
4859 p->mark = _mark;
4860 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4861 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
4862 }
4863 _res = NULL;
4864 done:
4865 D(p->level--);
4866 return _res;
4867}
4868
4869// function_def_raw:
4870// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4871// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4872static stmt_ty
4873function_def_raw_rule(Parser *p)
4874{
4875 D(p->level++);
4876 if (p->error_indicator) {
4877 D(p->level--);
4878 return NULL;
4879 }
4880 stmt_ty _res = NULL;
4881 int _mark = p->mark;
4882 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4883 p->error_indicator = 1;
4884 D(p->level--);
4885 return NULL;
4886 }
4887 int _start_lineno = p->tokens[_mark]->lineno;
4888 UNUSED(_start_lineno); // Only used by EXTRA macro
4889 int _start_col_offset = p->tokens[_mark]->col_offset;
4890 UNUSED(_start_col_offset); // Only used by EXTRA macro
4891 { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4892 if (p->error_indicator) {
4893 D(p->level--);
4894 return NULL;
4895 }
4896 D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4897 Token * _keyword;
4898 Token * _literal;
4899 Token * _literal_1;
4900 Token * _literal_2;
4901 void *a;
4902 asdl_seq* b;
4903 expr_ty n;
4904 void *params;
4905 void *tc;
4906 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004907 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004908 &&
4909 (n = _PyPegen_name_token(p)) // NAME
4910 &&
4911 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4912 &&
4913 (params = params_rule(p), 1) // params?
4914 &&
4915 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4916 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004917 (a = _tmp_51_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004918 &&
4919 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4920 &&
4921 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4922 &&
4923 (b = block_rule(p)) // block
4924 )
4925 {
4926 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"));
4927 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4928 if (_token == NULL) {
4929 D(p->level--);
4930 return NULL;
4931 }
4932 int _end_lineno = _token->end_lineno;
4933 UNUSED(_end_lineno); // Only used by EXTRA macro
4934 int _end_col_offset = _token->end_col_offset;
4935 UNUSED(_end_col_offset); // Only used by EXTRA macro
4936 _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4937 if (_res == NULL && PyErr_Occurred()) {
4938 p->error_indicator = 1;
4939 D(p->level--);
4940 return NULL;
4941 }
4942 goto done;
4943 }
4944 p->mark = _mark;
4945 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
4946 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4947 }
4948 { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4949 if (p->error_indicator) {
4950 D(p->level--);
4951 return NULL;
4952 }
4953 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"));
4954 Token * _keyword;
4955 Token * _literal;
4956 Token * _literal_1;
4957 Token * _literal_2;
4958 void *a;
4959 Token * async_var;
4960 asdl_seq* b;
4961 expr_ty n;
4962 void *params;
4963 void *tc;
4964 if (
4965 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4966 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004967 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004968 &&
4969 (n = _PyPegen_name_token(p)) // NAME
4970 &&
4971 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4972 &&
4973 (params = params_rule(p), 1) // params?
4974 &&
4975 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4976 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004977 (a = _tmp_52_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004978 &&
4979 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4980 &&
4981 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4982 &&
4983 (b = block_rule(p)) // block
4984 )
4985 {
4986 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"));
4987 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4988 if (_token == NULL) {
4989 D(p->level--);
4990 return NULL;
4991 }
4992 int _end_lineno = _token->end_lineno;
4993 UNUSED(_end_lineno); // Only used by EXTRA macro
4994 int _end_col_offset = _token->end_col_offset;
4995 UNUSED(_end_col_offset); // Only used by EXTRA macro
4996 _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 ) );
4997 if (_res == NULL && PyErr_Occurred()) {
4998 p->error_indicator = 1;
4999 D(p->level--);
5000 return NULL;
5001 }
5002 goto done;
5003 }
5004 p->mark = _mark;
5005 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
5006 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
5007 }
5008 _res = NULL;
5009 done:
5010 D(p->level--);
5011 return _res;
5012}
5013
5014// func_type_comment:
5015// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5016// | invalid_double_type_comments
5017// | TYPE_COMMENT
5018static Token*
5019func_type_comment_rule(Parser *p)
5020{
5021 D(p->level++);
5022 if (p->error_indicator) {
5023 D(p->level--);
5024 return NULL;
5025 }
5026 Token* _res = NULL;
5027 int _mark = p->mark;
5028 { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5029 if (p->error_indicator) {
5030 D(p->level--);
5031 return NULL;
5032 }
5033 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5034 Token * newline_var;
5035 Token * t;
5036 if (
5037 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
5038 &&
5039 (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5040 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005041 _PyPegen_lookahead(1, _tmp_53_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005042 )
5043 {
5044 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5045 _res = t;
5046 if (_res == NULL && PyErr_Occurred()) {
5047 p->error_indicator = 1;
5048 D(p->level--);
5049 return NULL;
5050 }
5051 goto done;
5052 }
5053 p->mark = _mark;
5054 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5055 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5056 }
5057 { // invalid_double_type_comments
5058 if (p->error_indicator) {
5059 D(p->level--);
5060 return NULL;
5061 }
5062 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5063 void *invalid_double_type_comments_var;
5064 if (
5065 (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
5066 )
5067 {
5068 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5069 _res = invalid_double_type_comments_var;
5070 goto done;
5071 }
5072 p->mark = _mark;
5073 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5074 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
5075 }
5076 { // TYPE_COMMENT
5077 if (p->error_indicator) {
5078 D(p->level--);
5079 return NULL;
5080 }
5081 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5082 Token * type_comment_var;
5083 if (
5084 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5085 )
5086 {
5087 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5088 _res = type_comment_var;
5089 goto done;
5090 }
5091 p->mark = _mark;
5092 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5093 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
5094 }
5095 _res = NULL;
5096 done:
5097 D(p->level--);
5098 return _res;
5099}
5100
5101// params: invalid_parameters | parameters
5102static arguments_ty
5103params_rule(Parser *p)
5104{
5105 D(p->level++);
5106 if (p->error_indicator) {
5107 D(p->level--);
5108 return NULL;
5109 }
5110 arguments_ty _res = NULL;
5111 int _mark = p->mark;
5112 { // invalid_parameters
5113 if (p->error_indicator) {
5114 D(p->level--);
5115 return NULL;
5116 }
5117 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5118 void *invalid_parameters_var;
5119 if (
5120 (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
5121 )
5122 {
5123 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5124 _res = invalid_parameters_var;
5125 goto done;
5126 }
5127 p->mark = _mark;
5128 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5129 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
5130 }
5131 { // parameters
5132 if (p->error_indicator) {
5133 D(p->level--);
5134 return NULL;
5135 }
5136 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
5137 arguments_ty parameters_var;
5138 if (
5139 (parameters_var = parameters_rule(p)) // parameters
5140 )
5141 {
5142 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
5143 _res = parameters_var;
5144 goto done;
5145 }
5146 p->mark = _mark;
5147 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5148 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
5149 }
5150 _res = NULL;
5151 done:
5152 D(p->level--);
5153 return _res;
5154}
5155
5156// parameters:
5157// | slash_no_default param_no_default* param_with_default* star_etc?
5158// | slash_with_default param_with_default* star_etc?
5159// | param_no_default+ param_with_default* star_etc?
5160// | param_with_default+ star_etc?
5161// | star_etc
5162static arguments_ty
5163parameters_rule(Parser *p)
5164{
5165 D(p->level++);
5166 if (p->error_indicator) {
5167 D(p->level--);
5168 return NULL;
5169 }
5170 arguments_ty _res = NULL;
5171 int _mark = p->mark;
5172 { // slash_no_default param_no_default* param_with_default* star_etc?
5173 if (p->error_indicator) {
5174 D(p->level--);
5175 return NULL;
5176 }
5177 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?"));
5178 asdl_seq* a;
5179 asdl_seq * b;
5180 asdl_seq * c;
5181 void *d;
5182 if (
5183 (a = slash_no_default_rule(p)) // slash_no_default
5184 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005185 (b = _loop0_54_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005186 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005187 (c = _loop0_55_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005188 &&
5189 (d = star_etc_rule(p), 1) // star_etc?
5190 )
5191 {
5192 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?"));
5193 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
5194 if (_res == NULL && PyErr_Occurred()) {
5195 p->error_indicator = 1;
5196 D(p->level--);
5197 return NULL;
5198 }
5199 goto done;
5200 }
5201 p->mark = _mark;
5202 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5203 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
5204 }
5205 { // slash_with_default param_with_default* star_etc?
5206 if (p->error_indicator) {
5207 D(p->level--);
5208 return NULL;
5209 }
5210 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5211 SlashWithDefault* a;
5212 asdl_seq * b;
5213 void *c;
5214 if (
5215 (a = slash_with_default_rule(p)) // slash_with_default
5216 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005217 (b = _loop0_56_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005218 &&
5219 (c = star_etc_rule(p), 1) // star_etc?
5220 )
5221 {
5222 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5223 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
5224 if (_res == NULL && PyErr_Occurred()) {
5225 p->error_indicator = 1;
5226 D(p->level--);
5227 return NULL;
5228 }
5229 goto done;
5230 }
5231 p->mark = _mark;
5232 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5233 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5234 }
5235 { // param_no_default+ param_with_default* star_etc?
5236 if (p->error_indicator) {
5237 D(p->level--);
5238 return NULL;
5239 }
5240 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5241 asdl_seq * a;
5242 asdl_seq * b;
5243 void *c;
5244 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005245 (a = _loop1_57_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005246 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005247 (b = _loop0_58_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005248 &&
5249 (c = star_etc_rule(p), 1) // star_etc?
5250 )
5251 {
5252 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5253 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
5254 if (_res == NULL && PyErr_Occurred()) {
5255 p->error_indicator = 1;
5256 D(p->level--);
5257 return NULL;
5258 }
5259 goto done;
5260 }
5261 p->mark = _mark;
5262 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5263 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5264 }
5265 { // param_with_default+ star_etc?
5266 if (p->error_indicator) {
5267 D(p->level--);
5268 return NULL;
5269 }
5270 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5271 asdl_seq * a;
5272 void *b;
5273 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005274 (a = _loop1_59_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005275 &&
5276 (b = star_etc_rule(p), 1) // star_etc?
5277 )
5278 {
5279 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5280 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
5281 if (_res == NULL && PyErr_Occurred()) {
5282 p->error_indicator = 1;
5283 D(p->level--);
5284 return NULL;
5285 }
5286 goto done;
5287 }
5288 p->mark = _mark;
5289 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5290 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
5291 }
5292 { // star_etc
5293 if (p->error_indicator) {
5294 D(p->level--);
5295 return NULL;
5296 }
5297 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
5298 StarEtc* a;
5299 if (
5300 (a = star_etc_rule(p)) // star_etc
5301 )
5302 {
5303 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
5304 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
5305 if (_res == NULL && PyErr_Occurred()) {
5306 p->error_indicator = 1;
5307 D(p->level--);
5308 return NULL;
5309 }
5310 goto done;
5311 }
5312 p->mark = _mark;
5313 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5314 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
5315 }
5316 _res = NULL;
5317 done:
5318 D(p->level--);
5319 return _res;
5320}
5321
5322// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
5323static asdl_seq*
5324slash_no_default_rule(Parser *p)
5325{
5326 D(p->level++);
5327 if (p->error_indicator) {
5328 D(p->level--);
5329 return NULL;
5330 }
5331 asdl_seq* _res = NULL;
5332 int _mark = p->mark;
5333 { // param_no_default+ '/' ','
5334 if (p->error_indicator) {
5335 D(p->level--);
5336 return NULL;
5337 }
5338 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5339 Token * _literal;
5340 Token * _literal_1;
5341 asdl_seq * a;
5342 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005343 (a = _loop1_60_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005344 &&
5345 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5346 &&
5347 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5348 )
5349 {
5350 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5351 _res = a;
5352 if (_res == NULL && PyErr_Occurred()) {
5353 p->error_indicator = 1;
5354 D(p->level--);
5355 return NULL;
5356 }
5357 goto done;
5358 }
5359 p->mark = _mark;
5360 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5361 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
5362 }
5363 { // param_no_default+ '/' &')'
5364 if (p->error_indicator) {
5365 D(p->level--);
5366 return NULL;
5367 }
5368 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5369 Token * _literal;
5370 asdl_seq * a;
5371 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005372 (a = _loop1_61_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005373 &&
5374 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5375 &&
5376 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5377 )
5378 {
5379 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5380 _res = a;
5381 if (_res == NULL && PyErr_Occurred()) {
5382 p->error_indicator = 1;
5383 D(p->level--);
5384 return NULL;
5385 }
5386 goto done;
5387 }
5388 p->mark = _mark;
5389 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5390 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
5391 }
5392 _res = NULL;
5393 done:
5394 D(p->level--);
5395 return _res;
5396}
5397
5398// slash_with_default:
5399// | param_no_default* param_with_default+ '/' ','
5400// | param_no_default* param_with_default+ '/' &')'
5401static SlashWithDefault*
5402slash_with_default_rule(Parser *p)
5403{
5404 D(p->level++);
5405 if (p->error_indicator) {
5406 D(p->level--);
5407 return NULL;
5408 }
5409 SlashWithDefault* _res = NULL;
5410 int _mark = p->mark;
5411 { // param_no_default* param_with_default+ '/' ','
5412 if (p->error_indicator) {
5413 D(p->level--);
5414 return NULL;
5415 }
5416 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5417 Token * _literal;
5418 Token * _literal_1;
5419 asdl_seq * a;
5420 asdl_seq * b;
5421 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005422 (a = _loop0_62_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005423 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005424 (b = _loop1_63_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005425 &&
5426 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5427 &&
5428 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5429 )
5430 {
5431 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5432 _res = _PyPegen_slash_with_default ( p , a , b );
5433 if (_res == NULL && PyErr_Occurred()) {
5434 p->error_indicator = 1;
5435 D(p->level--);
5436 return NULL;
5437 }
5438 goto done;
5439 }
5440 p->mark = _mark;
5441 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5442 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5443 }
5444 { // param_no_default* param_with_default+ '/' &')'
5445 if (p->error_indicator) {
5446 D(p->level--);
5447 return NULL;
5448 }
5449 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5450 Token * _literal;
5451 asdl_seq * a;
5452 asdl_seq * b;
5453 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005454 (a = _loop0_64_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005455 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005456 (b = _loop1_65_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005457 &&
5458 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5459 &&
5460 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5461 )
5462 {
5463 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5464 _res = _PyPegen_slash_with_default ( p , a , b );
5465 if (_res == NULL && PyErr_Occurred()) {
5466 p->error_indicator = 1;
5467 D(p->level--);
5468 return NULL;
5469 }
5470 goto done;
5471 }
5472 p->mark = _mark;
5473 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5474 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5475 }
5476 _res = NULL;
5477 done:
5478 D(p->level--);
5479 return _res;
5480}
5481
5482// star_etc:
5483// | '*' param_no_default param_maybe_default* kwds?
5484// | '*' ',' param_maybe_default+ kwds?
5485// | kwds
5486// | invalid_star_etc
5487static StarEtc*
5488star_etc_rule(Parser *p)
5489{
5490 D(p->level++);
5491 if (p->error_indicator) {
5492 D(p->level--);
5493 return NULL;
5494 }
5495 StarEtc* _res = NULL;
5496 int _mark = p->mark;
5497 { // '*' param_no_default param_maybe_default* kwds?
5498 if (p->error_indicator) {
5499 D(p->level--);
5500 return NULL;
5501 }
5502 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5503 Token * _literal;
5504 arg_ty a;
5505 asdl_seq * b;
5506 void *c;
5507 if (
5508 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5509 &&
5510 (a = param_no_default_rule(p)) // param_no_default
5511 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005512 (b = _loop0_66_rule(p)) // param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005513 &&
5514 (c = kwds_rule(p), 1) // kwds?
5515 )
5516 {
5517 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5518 _res = _PyPegen_star_etc ( p , a , b , c );
5519 if (_res == NULL && PyErr_Occurred()) {
5520 p->error_indicator = 1;
5521 D(p->level--);
5522 return NULL;
5523 }
5524 goto done;
5525 }
5526 p->mark = _mark;
5527 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5528 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5529 }
5530 { // '*' ',' param_maybe_default+ kwds?
5531 if (p->error_indicator) {
5532 D(p->level--);
5533 return NULL;
5534 }
5535 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5536 Token * _literal;
5537 Token * _literal_1;
5538 asdl_seq * b;
5539 void *c;
5540 if (
5541 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5542 &&
5543 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5544 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005545 (b = _loop1_67_rule(p)) // param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005546 &&
5547 (c = kwds_rule(p), 1) // kwds?
5548 )
5549 {
5550 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5551 _res = _PyPegen_star_etc ( p , NULL , b , c );
5552 if (_res == NULL && PyErr_Occurred()) {
5553 p->error_indicator = 1;
5554 D(p->level--);
5555 return NULL;
5556 }
5557 goto done;
5558 }
5559 p->mark = _mark;
5560 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5561 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5562 }
5563 { // kwds
5564 if (p->error_indicator) {
5565 D(p->level--);
5566 return NULL;
5567 }
5568 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
5569 arg_ty a;
5570 if (
5571 (a = kwds_rule(p)) // kwds
5572 )
5573 {
5574 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
5575 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
5576 if (_res == NULL && PyErr_Occurred()) {
5577 p->error_indicator = 1;
5578 D(p->level--);
5579 return NULL;
5580 }
5581 goto done;
5582 }
5583 p->mark = _mark;
5584 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5585 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
5586 }
5587 { // invalid_star_etc
5588 if (p->error_indicator) {
5589 D(p->level--);
5590 return NULL;
5591 }
5592 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5593 void *invalid_star_etc_var;
5594 if (
5595 (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
5596 )
5597 {
5598 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5599 _res = invalid_star_etc_var;
5600 goto done;
5601 }
5602 p->mark = _mark;
5603 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5604 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
5605 }
5606 _res = NULL;
5607 done:
5608 D(p->level--);
5609 return _res;
5610}
5611
5612// kwds: '**' param_no_default
5613static arg_ty
5614kwds_rule(Parser *p)
5615{
5616 D(p->level++);
5617 if (p->error_indicator) {
5618 D(p->level--);
5619 return NULL;
5620 }
5621 arg_ty _res = NULL;
5622 int _mark = p->mark;
5623 { // '**' param_no_default
5624 if (p->error_indicator) {
5625 D(p->level--);
5626 return NULL;
5627 }
5628 D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5629 Token * _literal;
5630 arg_ty a;
5631 if (
5632 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
5633 &&
5634 (a = param_no_default_rule(p)) // param_no_default
5635 )
5636 {
5637 D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5638 _res = a;
5639 if (_res == NULL && PyErr_Occurred()) {
5640 p->error_indicator = 1;
5641 D(p->level--);
5642 return NULL;
5643 }
5644 goto done;
5645 }
5646 p->mark = _mark;
5647 D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
5648 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
5649 }
5650 _res = NULL;
5651 done:
5652 D(p->level--);
5653 return _res;
5654}
5655
5656// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
5657static arg_ty
5658param_no_default_rule(Parser *p)
5659{
5660 D(p->level++);
5661 if (p->error_indicator) {
5662 D(p->level--);
5663 return NULL;
5664 }
5665 arg_ty _res = NULL;
5666 int _mark = p->mark;
5667 { // param ',' TYPE_COMMENT?
5668 if (p->error_indicator) {
5669 D(p->level--);
5670 return NULL;
5671 }
5672 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5673 Token * _literal;
5674 arg_ty a;
5675 void *tc;
5676 if (
5677 (a = param_rule(p)) // param
5678 &&
5679 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5680 &&
5681 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5682 )
5683 {
5684 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5685 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5686 if (_res == NULL && PyErr_Occurred()) {
5687 p->error_indicator = 1;
5688 D(p->level--);
5689 return NULL;
5690 }
5691 goto done;
5692 }
5693 p->mark = _mark;
5694 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5695 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
5696 }
5697 { // param TYPE_COMMENT? &')'
5698 if (p->error_indicator) {
5699 D(p->level--);
5700 return NULL;
5701 }
5702 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5703 arg_ty a;
5704 void *tc;
5705 if (
5706 (a = param_rule(p)) // param
5707 &&
5708 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5709 &&
5710 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5711 )
5712 {
5713 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5714 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5715 if (_res == NULL && PyErr_Occurred()) {
5716 p->error_indicator = 1;
5717 D(p->level--);
5718 return NULL;
5719 }
5720 goto done;
5721 }
5722 p->mark = _mark;
5723 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5724 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
5725 }
5726 _res = NULL;
5727 done:
5728 D(p->level--);
5729 return _res;
5730}
5731
5732// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
5733static NameDefaultPair*
5734param_with_default_rule(Parser *p)
5735{
5736 D(p->level++);
5737 if (p->error_indicator) {
5738 D(p->level--);
5739 return NULL;
5740 }
5741 NameDefaultPair* _res = NULL;
5742 int _mark = p->mark;
5743 { // param default ',' TYPE_COMMENT?
5744 if (p->error_indicator) {
5745 D(p->level--);
5746 return NULL;
5747 }
5748 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5749 Token * _literal;
5750 arg_ty a;
5751 expr_ty c;
5752 void *tc;
5753 if (
5754 (a = param_rule(p)) // param
5755 &&
5756 (c = default_rule(p)) // default
5757 &&
5758 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5759 &&
5760 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5761 )
5762 {
5763 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5764 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5765 if (_res == NULL && PyErr_Occurred()) {
5766 p->error_indicator = 1;
5767 D(p->level--);
5768 return NULL;
5769 }
5770 goto done;
5771 }
5772 p->mark = _mark;
5773 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5774 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5775 }
5776 { // param default TYPE_COMMENT? &')'
5777 if (p->error_indicator) {
5778 D(p->level--);
5779 return NULL;
5780 }
5781 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5782 arg_ty a;
5783 expr_ty c;
5784 void *tc;
5785 if (
5786 (a = param_rule(p)) // param
5787 &&
5788 (c = default_rule(p)) // default
5789 &&
5790 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5791 &&
5792 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5793 )
5794 {
5795 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5796 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5797 if (_res == NULL && PyErr_Occurred()) {
5798 p->error_indicator = 1;
5799 D(p->level--);
5800 return NULL;
5801 }
5802 goto done;
5803 }
5804 p->mark = _mark;
5805 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5806 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5807 }
5808 _res = NULL;
5809 done:
5810 D(p->level--);
5811 return _res;
5812}
5813
5814// param_maybe_default:
5815// | param default? ',' TYPE_COMMENT?
5816// | param default? TYPE_COMMENT? &')'
5817static NameDefaultPair*
5818param_maybe_default_rule(Parser *p)
5819{
5820 D(p->level++);
5821 if (p->error_indicator) {
5822 D(p->level--);
5823 return NULL;
5824 }
5825 NameDefaultPair* _res = NULL;
5826 int _mark = p->mark;
5827 { // param default? ',' TYPE_COMMENT?
5828 if (p->error_indicator) {
5829 D(p->level--);
5830 return NULL;
5831 }
5832 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5833 Token * _literal;
5834 arg_ty a;
5835 void *c;
5836 void *tc;
5837 if (
5838 (a = param_rule(p)) // param
5839 &&
5840 (c = default_rule(p), 1) // default?
5841 &&
5842 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5843 &&
5844 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5845 )
5846 {
5847 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5848 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5849 if (_res == NULL && PyErr_Occurred()) {
5850 p->error_indicator = 1;
5851 D(p->level--);
5852 return NULL;
5853 }
5854 goto done;
5855 }
5856 p->mark = _mark;
5857 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5858 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5859 }
5860 { // param default? TYPE_COMMENT? &')'
5861 if (p->error_indicator) {
5862 D(p->level--);
5863 return NULL;
5864 }
5865 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5866 arg_ty a;
5867 void *c;
5868 void *tc;
5869 if (
5870 (a = param_rule(p)) // param
5871 &&
5872 (c = default_rule(p), 1) // default?
5873 &&
5874 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5875 &&
5876 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5877 )
5878 {
5879 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5880 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5881 if (_res == NULL && PyErr_Occurred()) {
5882 p->error_indicator = 1;
5883 D(p->level--);
5884 return NULL;
5885 }
5886 goto done;
5887 }
5888 p->mark = _mark;
5889 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5890 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5891 }
5892 _res = NULL;
5893 done:
5894 D(p->level--);
5895 return _res;
5896}
5897
5898// param: NAME annotation?
5899static arg_ty
5900param_rule(Parser *p)
5901{
5902 D(p->level++);
5903 if (p->error_indicator) {
5904 D(p->level--);
5905 return NULL;
5906 }
5907 arg_ty _res = NULL;
5908 int _mark = p->mark;
5909 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5910 p->error_indicator = 1;
5911 D(p->level--);
5912 return NULL;
5913 }
5914 int _start_lineno = p->tokens[_mark]->lineno;
5915 UNUSED(_start_lineno); // Only used by EXTRA macro
5916 int _start_col_offset = p->tokens[_mark]->col_offset;
5917 UNUSED(_start_col_offset); // Only used by EXTRA macro
5918 { // NAME annotation?
5919 if (p->error_indicator) {
5920 D(p->level--);
5921 return NULL;
5922 }
5923 D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5924 expr_ty a;
5925 void *b;
5926 if (
5927 (a = _PyPegen_name_token(p)) // NAME
5928 &&
5929 (b = annotation_rule(p), 1) // annotation?
5930 )
5931 {
5932 D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5933 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5934 if (_token == NULL) {
5935 D(p->level--);
5936 return NULL;
5937 }
5938 int _end_lineno = _token->end_lineno;
5939 UNUSED(_end_lineno); // Only used by EXTRA macro
5940 int _end_col_offset = _token->end_col_offset;
5941 UNUSED(_end_col_offset); // Only used by EXTRA macro
5942 _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
5943 if (_res == NULL && PyErr_Occurred()) {
5944 p->error_indicator = 1;
5945 D(p->level--);
5946 return NULL;
5947 }
5948 goto done;
5949 }
5950 p->mark = _mark;
5951 D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
5952 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
5953 }
5954 _res = NULL;
5955 done:
5956 D(p->level--);
5957 return _res;
5958}
5959
5960// annotation: ':' expression
5961static expr_ty
5962annotation_rule(Parser *p)
5963{
5964 D(p->level++);
5965 if (p->error_indicator) {
5966 D(p->level--);
5967 return NULL;
5968 }
5969 expr_ty _res = NULL;
5970 int _mark = p->mark;
5971 { // ':' expression
5972 if (p->error_indicator) {
5973 D(p->level--);
5974 return NULL;
5975 }
5976 D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
5977 Token * _literal;
5978 expr_ty a;
5979 if (
5980 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
5981 &&
5982 (a = expression_rule(p)) // expression
5983 )
5984 {
5985 D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
5986 _res = a;
5987 if (_res == NULL && PyErr_Occurred()) {
5988 p->error_indicator = 1;
5989 D(p->level--);
5990 return NULL;
5991 }
5992 goto done;
5993 }
5994 p->mark = _mark;
5995 D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
5996 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
5997 }
5998 _res = NULL;
5999 done:
6000 D(p->level--);
6001 return _res;
6002}
6003
6004// default: '=' expression
6005static expr_ty
6006default_rule(Parser *p)
6007{
6008 D(p->level++);
6009 if (p->error_indicator) {
6010 D(p->level--);
6011 return NULL;
6012 }
6013 expr_ty _res = NULL;
6014 int _mark = p->mark;
6015 { // '=' expression
6016 if (p->error_indicator) {
6017 D(p->level--);
6018 return NULL;
6019 }
6020 D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6021 Token * _literal;
6022 expr_ty a;
6023 if (
6024 (_literal = _PyPegen_expect_token(p, 22)) // token='='
6025 &&
6026 (a = expression_rule(p)) // expression
6027 )
6028 {
6029 D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6030 _res = a;
6031 if (_res == NULL && PyErr_Occurred()) {
6032 p->error_indicator = 1;
6033 D(p->level--);
6034 return NULL;
6035 }
6036 goto done;
6037 }
6038 p->mark = _mark;
6039 D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
6040 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
6041 }
6042 _res = NULL;
6043 done:
6044 D(p->level--);
6045 return _res;
6046}
6047
6048// decorators: (('@' named_expression NEWLINE))+
6049static asdl_seq*
6050decorators_rule(Parser *p)
6051{
6052 D(p->level++);
6053 if (p->error_indicator) {
6054 D(p->level--);
6055 return NULL;
6056 }
6057 asdl_seq* _res = NULL;
6058 int _mark = p->mark;
6059 { // (('@' named_expression NEWLINE))+
6060 if (p->error_indicator) {
6061 D(p->level--);
6062 return NULL;
6063 }
6064 D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6065 asdl_seq * a;
6066 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006067 (a = _loop1_68_rule(p)) // (('@' named_expression NEWLINE))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006068 )
6069 {
6070 D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6071 _res = a;
6072 if (_res == NULL && PyErr_Occurred()) {
6073 p->error_indicator = 1;
6074 D(p->level--);
6075 return NULL;
6076 }
6077 goto done;
6078 }
6079 p->mark = _mark;
6080 D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
6081 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6082 }
6083 _res = NULL;
6084 done:
6085 D(p->level--);
6086 return _res;
6087}
6088
6089// class_def: decorators class_def_raw | class_def_raw
6090static stmt_ty
6091class_def_rule(Parser *p)
6092{
6093 D(p->level++);
6094 if (p->error_indicator) {
6095 D(p->level--);
6096 return NULL;
6097 }
6098 stmt_ty _res = NULL;
6099 int _mark = p->mark;
6100 { // decorators class_def_raw
6101 if (p->error_indicator) {
6102 D(p->level--);
6103 return NULL;
6104 }
6105 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6106 asdl_seq* a;
6107 stmt_ty b;
6108 if (
6109 (a = decorators_rule(p)) // decorators
6110 &&
6111 (b = class_def_raw_rule(p)) // class_def_raw
6112 )
6113 {
6114 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6115 _res = _PyPegen_class_def_decorators ( p , a , b );
6116 if (_res == NULL && PyErr_Occurred()) {
6117 p->error_indicator = 1;
6118 D(p->level--);
6119 return NULL;
6120 }
6121 goto done;
6122 }
6123 p->mark = _mark;
6124 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6125 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
6126 }
6127 { // class_def_raw
6128 if (p->error_indicator) {
6129 D(p->level--);
6130 return NULL;
6131 }
6132 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6133 stmt_ty class_def_raw_var;
6134 if (
6135 (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
6136 )
6137 {
6138 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6139 _res = class_def_raw_var;
6140 goto done;
6141 }
6142 p->mark = _mark;
6143 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6144 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
6145 }
6146 _res = NULL;
6147 done:
6148 D(p->level--);
6149 return _res;
6150}
6151
6152// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
6153static stmt_ty
6154class_def_raw_rule(Parser *p)
6155{
6156 D(p->level++);
6157 if (p->error_indicator) {
6158 D(p->level--);
6159 return NULL;
6160 }
6161 stmt_ty _res = NULL;
6162 int _mark = p->mark;
6163 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6164 p->error_indicator = 1;
6165 D(p->level--);
6166 return NULL;
6167 }
6168 int _start_lineno = p->tokens[_mark]->lineno;
6169 UNUSED(_start_lineno); // Only used by EXTRA macro
6170 int _start_col_offset = p->tokens[_mark]->col_offset;
6171 UNUSED(_start_col_offset); // Only used by EXTRA macro
6172 { // 'class' NAME ['(' arguments? ')'] ':' block
6173 if (p->error_indicator) {
6174 D(p->level--);
6175 return NULL;
6176 }
6177 D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6178 Token * _keyword;
6179 Token * _literal;
6180 expr_ty a;
6181 void *b;
6182 asdl_seq* c;
6183 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006184 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006185 &&
6186 (a = _PyPegen_name_token(p)) // NAME
6187 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006188 (b = _tmp_69_rule(p), 1) // ['(' arguments? ')']
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006189 &&
6190 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
6191 &&
6192 (c = block_rule(p)) // block
6193 )
6194 {
6195 D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6196 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6197 if (_token == NULL) {
6198 D(p->level--);
6199 return NULL;
6200 }
6201 int _end_lineno = _token->end_lineno;
6202 UNUSED(_end_lineno); // Only used by EXTRA macro
6203 int _end_col_offset = _token->end_col_offset;
6204 UNUSED(_end_col_offset); // Only used by EXTRA macro
6205 _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 );
6206 if (_res == NULL && PyErr_Occurred()) {
6207 p->error_indicator = 1;
6208 D(p->level--);
6209 return NULL;
6210 }
6211 goto done;
6212 }
6213 p->mark = _mark;
6214 D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
6215 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6216 }
6217 _res = NULL;
6218 done:
6219 D(p->level--);
6220 return _res;
6221}
6222
6223// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
6224static asdl_seq*
6225block_rule(Parser *p)
6226{
6227 D(p->level++);
6228 if (p->error_indicator) {
6229 D(p->level--);
6230 return NULL;
6231 }
6232 asdl_seq* _res = NULL;
6233 if (_PyPegen_is_memoized(p, block_type, &_res)) {
6234 D(p->level--);
6235 return _res;
6236 }
6237 int _mark = p->mark;
6238 { // NEWLINE INDENT statements DEDENT
6239 if (p->error_indicator) {
6240 D(p->level--);
6241 return NULL;
6242 }
6243 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6244 asdl_seq* a;
6245 Token * dedent_var;
6246 Token * indent_var;
6247 Token * newline_var;
6248 if (
6249 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
6250 &&
6251 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
6252 &&
6253 (a = statements_rule(p)) // statements
6254 &&
6255 (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
6256 )
6257 {
6258 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6259 _res = a;
6260 if (_res == NULL && PyErr_Occurred()) {
6261 p->error_indicator = 1;
6262 D(p->level--);
6263 return NULL;
6264 }
6265 goto done;
6266 }
6267 p->mark = _mark;
6268 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6269 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6270 }
6271 { // simple_stmt
6272 if (p->error_indicator) {
6273 D(p->level--);
6274 return NULL;
6275 }
6276 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6277 asdl_seq* simple_stmt_var;
6278 if (
6279 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
6280 )
6281 {
6282 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6283 _res = simple_stmt_var;
6284 goto done;
6285 }
6286 p->mark = _mark;
6287 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6288 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
6289 }
6290 { // invalid_block
6291 if (p->error_indicator) {
6292 D(p->level--);
6293 return NULL;
6294 }
6295 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6296 void *invalid_block_var;
6297 if (
6298 (invalid_block_var = invalid_block_rule(p)) // invalid_block
6299 )
6300 {
6301 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6302 _res = invalid_block_var;
6303 goto done;
6304 }
6305 p->mark = _mark;
6306 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6307 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
6308 }
6309 _res = NULL;
6310 done:
6311 _PyPegen_insert_memo(p, _mark, block_type, _res);
6312 D(p->level--);
6313 return _res;
6314}
6315
6316// expressions_list: ','.star_expression+ ','?
6317static asdl_seq*
6318expressions_list_rule(Parser *p)
6319{
6320 D(p->level++);
6321 if (p->error_indicator) {
6322 D(p->level--);
6323 return NULL;
6324 }
6325 asdl_seq* _res = NULL;
6326 int _mark = p->mark;
6327 { // ','.star_expression+ ','?
6328 if (p->error_indicator) {
6329 D(p->level--);
6330 return NULL;
6331 }
6332 D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6333 void *_opt_var;
6334 UNUSED(_opt_var); // Silence compiler warnings
6335 asdl_seq * a;
6336 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006337 (a = _gather_70_rule(p)) // ','.star_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006338 &&
6339 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6340 )
6341 {
6342 D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6343 _res = a;
6344 if (_res == NULL && PyErr_Occurred()) {
6345 p->error_indicator = 1;
6346 D(p->level--);
6347 return NULL;
6348 }
6349 goto done;
6350 }
6351 p->mark = _mark;
6352 D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ',
6353 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?"));
6354 }
6355 _res = NULL;
6356 done:
6357 D(p->level--);
6358 return _res;
6359}
6360
6361// star_expressions:
6362// | star_expression ((',' star_expression))+ ','?
6363// | star_expression ','
6364// | star_expression
6365static expr_ty
6366star_expressions_rule(Parser *p)
6367{
6368 D(p->level++);
6369 if (p->error_indicator) {
6370 D(p->level--);
6371 return NULL;
6372 }
6373 expr_ty _res = NULL;
6374 int _mark = p->mark;
6375 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6376 p->error_indicator = 1;
6377 D(p->level--);
6378 return NULL;
6379 }
6380 int _start_lineno = p->tokens[_mark]->lineno;
6381 UNUSED(_start_lineno); // Only used by EXTRA macro
6382 int _start_col_offset = p->tokens[_mark]->col_offset;
6383 UNUSED(_start_col_offset); // Only used by EXTRA macro
6384 { // star_expression ((',' star_expression))+ ','?
6385 if (p->error_indicator) {
6386 D(p->level--);
6387 return NULL;
6388 }
6389 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6390 void *_opt_var;
6391 UNUSED(_opt_var); // Silence compiler warnings
6392 expr_ty a;
6393 asdl_seq * b;
6394 if (
6395 (a = star_expression_rule(p)) // star_expression
6396 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006397 (b = _loop1_72_rule(p)) // ((',' star_expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006398 &&
6399 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6400 )
6401 {
6402 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6403 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6404 if (_token == NULL) {
6405 D(p->level--);
6406 return NULL;
6407 }
6408 int _end_lineno = _token->end_lineno;
6409 UNUSED(_end_lineno); // Only used by EXTRA macro
6410 int _end_col_offset = _token->end_col_offset;
6411 UNUSED(_end_col_offset); // Only used by EXTRA macro
6412 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
6413 if (_res == NULL && PyErr_Occurred()) {
6414 p->error_indicator = 1;
6415 D(p->level--);
6416 return NULL;
6417 }
6418 goto done;
6419 }
6420 p->mark = _mark;
6421 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6422 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6423 }
6424 { // star_expression ','
6425 if (p->error_indicator) {
6426 D(p->level--);
6427 return NULL;
6428 }
6429 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6430 Token * _literal;
6431 expr_ty a;
6432 if (
6433 (a = star_expression_rule(p)) // star_expression
6434 &&
6435 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6436 )
6437 {
6438 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6439 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6440 if (_token == NULL) {
6441 D(p->level--);
6442 return NULL;
6443 }
6444 int _end_lineno = _token->end_lineno;
6445 UNUSED(_end_lineno); // Only used by EXTRA macro
6446 int _end_col_offset = _token->end_col_offset;
6447 UNUSED(_end_col_offset); // Only used by EXTRA macro
6448 _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
6449 if (_res == NULL && PyErr_Occurred()) {
6450 p->error_indicator = 1;
6451 D(p->level--);
6452 return NULL;
6453 }
6454 goto done;
6455 }
6456 p->mark = _mark;
6457 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6458 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','"));
6459 }
6460 { // star_expression
6461 if (p->error_indicator) {
6462 D(p->level--);
6463 return NULL;
6464 }
6465 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
6466 expr_ty star_expression_var;
6467 if (
6468 (star_expression_var = star_expression_rule(p)) // star_expression
6469 )
6470 {
6471 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
6472 _res = star_expression_var;
6473 goto done;
6474 }
6475 p->mark = _mark;
6476 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6477 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
6478 }
6479 _res = NULL;
6480 done:
6481 D(p->level--);
6482 return _res;
6483}
6484
6485// star_expression: '*' bitwise_or | expression
6486static expr_ty
6487star_expression_rule(Parser *p)
6488{
6489 D(p->level++);
6490 if (p->error_indicator) {
6491 D(p->level--);
6492 return NULL;
6493 }
6494 expr_ty _res = NULL;
6495 if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
6496 D(p->level--);
6497 return _res;
6498 }
6499 int _mark = p->mark;
6500 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6501 p->error_indicator = 1;
6502 D(p->level--);
6503 return NULL;
6504 }
6505 int _start_lineno = p->tokens[_mark]->lineno;
6506 UNUSED(_start_lineno); // Only used by EXTRA macro
6507 int _start_col_offset = p->tokens[_mark]->col_offset;
6508 UNUSED(_start_col_offset); // Only used by EXTRA macro
6509 { // '*' bitwise_or
6510 if (p->error_indicator) {
6511 D(p->level--);
6512 return NULL;
6513 }
6514 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6515 Token * _literal;
6516 expr_ty a;
6517 if (
6518 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6519 &&
6520 (a = bitwise_or_rule(p)) // bitwise_or
6521 )
6522 {
6523 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6524 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6525 if (_token == NULL) {
6526 D(p->level--);
6527 return NULL;
6528 }
6529 int _end_lineno = _token->end_lineno;
6530 UNUSED(_end_lineno); // Only used by EXTRA macro
6531 int _end_col_offset = _token->end_col_offset;
6532 UNUSED(_end_col_offset); // Only used by EXTRA macro
6533 _res = _Py_Starred ( a , Load , EXTRA );
6534 if (_res == NULL && PyErr_Occurred()) {
6535 p->error_indicator = 1;
6536 D(p->level--);
6537 return NULL;
6538 }
6539 goto done;
6540 }
6541 p->mark = _mark;
6542 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6543 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6544 }
6545 { // expression
6546 if (p->error_indicator) {
6547 D(p->level--);
6548 return NULL;
6549 }
6550 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6551 expr_ty expression_var;
6552 if (
6553 (expression_var = expression_rule(p)) // expression
6554 )
6555 {
6556 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6557 _res = expression_var;
6558 goto done;
6559 }
6560 p->mark = _mark;
6561 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6562 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6563 }
6564 _res = NULL;
6565 done:
6566 _PyPegen_insert_memo(p, _mark, star_expression_type, _res);
6567 D(p->level--);
6568 return _res;
6569}
6570
6571// star_named_expressions: ','.star_named_expression+ ','?
6572static asdl_seq*
6573star_named_expressions_rule(Parser *p)
6574{
6575 D(p->level++);
6576 if (p->error_indicator) {
6577 D(p->level--);
6578 return NULL;
6579 }
6580 asdl_seq* _res = NULL;
6581 int _mark = p->mark;
6582 { // ','.star_named_expression+ ','?
6583 if (p->error_indicator) {
6584 D(p->level--);
6585 return NULL;
6586 }
6587 D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6588 void *_opt_var;
6589 UNUSED(_opt_var); // Silence compiler warnings
6590 asdl_seq * a;
6591 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006592 (a = _gather_73_rule(p)) // ','.star_named_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006593 &&
6594 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6595 )
6596 {
6597 D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6598 _res = a;
6599 if (_res == NULL && PyErr_Occurred()) {
6600 p->error_indicator = 1;
6601 D(p->level--);
6602 return NULL;
6603 }
6604 goto done;
6605 }
6606 p->mark = _mark;
6607 D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6608 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
6609 }
6610 _res = NULL;
6611 done:
6612 D(p->level--);
6613 return _res;
6614}
6615
6616// star_named_expression: '*' bitwise_or | named_expression
6617static expr_ty
6618star_named_expression_rule(Parser *p)
6619{
6620 D(p->level++);
6621 if (p->error_indicator) {
6622 D(p->level--);
6623 return NULL;
6624 }
6625 expr_ty _res = NULL;
6626 int _mark = p->mark;
6627 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6628 p->error_indicator = 1;
6629 D(p->level--);
6630 return NULL;
6631 }
6632 int _start_lineno = p->tokens[_mark]->lineno;
6633 UNUSED(_start_lineno); // Only used by EXTRA macro
6634 int _start_col_offset = p->tokens[_mark]->col_offset;
6635 UNUSED(_start_col_offset); // Only used by EXTRA macro
6636 { // '*' bitwise_or
6637 if (p->error_indicator) {
6638 D(p->level--);
6639 return NULL;
6640 }
6641 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6642 Token * _literal;
6643 expr_ty a;
6644 if (
6645 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6646 &&
6647 (a = bitwise_or_rule(p)) // bitwise_or
6648 )
6649 {
6650 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6651 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6652 if (_token == NULL) {
6653 D(p->level--);
6654 return NULL;
6655 }
6656 int _end_lineno = _token->end_lineno;
6657 UNUSED(_end_lineno); // Only used by EXTRA macro
6658 int _end_col_offset = _token->end_col_offset;
6659 UNUSED(_end_col_offset); // Only used by EXTRA macro
6660 _res = _Py_Starred ( a , Load , EXTRA );
6661 if (_res == NULL && PyErr_Occurred()) {
6662 p->error_indicator = 1;
6663 D(p->level--);
6664 return NULL;
6665 }
6666 goto done;
6667 }
6668 p->mark = _mark;
6669 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6670 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6671 }
6672 { // named_expression
6673 if (p->error_indicator) {
6674 D(p->level--);
6675 return NULL;
6676 }
6677 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
6678 expr_ty named_expression_var;
6679 if (
6680 (named_expression_var = named_expression_rule(p)) // named_expression
6681 )
6682 {
6683 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
6684 _res = named_expression_var;
6685 goto done;
6686 }
6687 p->mark = _mark;
6688 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6689 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
6690 }
6691 _res = NULL;
6692 done:
6693 D(p->level--);
6694 return _res;
6695}
6696
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006697// named_expression: NAME ':=' ~ expression | expression !':=' | invalid_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006698static expr_ty
6699named_expression_rule(Parser *p)
6700{
6701 D(p->level++);
6702 if (p->error_indicator) {
6703 D(p->level--);
6704 return NULL;
6705 }
6706 expr_ty _res = NULL;
6707 int _mark = p->mark;
6708 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6709 p->error_indicator = 1;
6710 D(p->level--);
6711 return NULL;
6712 }
6713 int _start_lineno = p->tokens[_mark]->lineno;
6714 UNUSED(_start_lineno); // Only used by EXTRA macro
6715 int _start_col_offset = p->tokens[_mark]->col_offset;
6716 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006717 { // NAME ':=' ~ expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006718 if (p->error_indicator) {
6719 D(p->level--);
6720 return NULL;
6721 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006722 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
6723 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006724 Token * _literal;
6725 expr_ty a;
6726 expr_ty b;
6727 if (
6728 (a = _PyPegen_name_token(p)) // NAME
6729 &&
6730 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
6731 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006732 (_cut_var = 1)
6733 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006734 (b = expression_rule(p)) // expression
6735 )
6736 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006737 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 +01006738 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6739 if (_token == NULL) {
6740 D(p->level--);
6741 return NULL;
6742 }
6743 int _end_lineno = _token->end_lineno;
6744 UNUSED(_end_lineno); // Only used by EXTRA macro
6745 int _end_col_offset = _token->end_col_offset;
6746 UNUSED(_end_col_offset); // Only used by EXTRA macro
6747 _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
6748 if (_res == NULL && PyErr_Occurred()) {
6749 p->error_indicator = 1;
6750 D(p->level--);
6751 return NULL;
6752 }
6753 goto done;
6754 }
6755 p->mark = _mark;
6756 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006757 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
6758 if (_cut_var) {
6759 D(p->level--);
6760 return NULL;
6761 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006762 }
6763 { // expression !':='
6764 if (p->error_indicator) {
6765 D(p->level--);
6766 return NULL;
6767 }
6768 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6769 expr_ty expression_var;
6770 if (
6771 (expression_var = expression_rule(p)) // expression
6772 &&
6773 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
6774 )
6775 {
6776 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6777 _res = expression_var;
6778 goto done;
6779 }
6780 p->mark = _mark;
6781 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6782 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
6783 }
6784 { // invalid_named_expression
6785 if (p->error_indicator) {
6786 D(p->level--);
6787 return NULL;
6788 }
6789 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6790 void *invalid_named_expression_var;
6791 if (
6792 (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression
6793 )
6794 {
6795 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6796 _res = invalid_named_expression_var;
6797 goto done;
6798 }
6799 p->mark = _mark;
6800 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6801 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
6802 }
6803 _res = NULL;
6804 done:
6805 D(p->level--);
6806 return _res;
6807}
6808
6809// annotated_rhs: yield_expr | star_expressions
6810static expr_ty
6811annotated_rhs_rule(Parser *p)
6812{
6813 D(p->level++);
6814 if (p->error_indicator) {
6815 D(p->level--);
6816 return NULL;
6817 }
6818 expr_ty _res = NULL;
6819 int _mark = p->mark;
6820 { // yield_expr
6821 if (p->error_indicator) {
6822 D(p->level--);
6823 return NULL;
6824 }
6825 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6826 expr_ty yield_expr_var;
6827 if (
6828 (yield_expr_var = yield_expr_rule(p)) // yield_expr
6829 )
6830 {
6831 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6832 _res = yield_expr_var;
6833 goto done;
6834 }
6835 p->mark = _mark;
6836 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6837 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
6838 }
6839 { // star_expressions
6840 if (p->error_indicator) {
6841 D(p->level--);
6842 return NULL;
6843 }
6844 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6845 expr_ty star_expressions_var;
6846 if (
6847 (star_expressions_var = star_expressions_rule(p)) // star_expressions
6848 )
6849 {
6850 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6851 _res = star_expressions_var;
6852 goto done;
6853 }
6854 p->mark = _mark;
6855 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6856 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
6857 }
6858 _res = NULL;
6859 done:
6860 D(p->level--);
6861 return _res;
6862}
6863
6864// expressions: expression ((',' expression))+ ','? | expression ',' | expression
6865static expr_ty
6866expressions_rule(Parser *p)
6867{
6868 D(p->level++);
6869 if (p->error_indicator) {
6870 D(p->level--);
6871 return NULL;
6872 }
6873 expr_ty _res = NULL;
6874 int _mark = p->mark;
6875 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6876 p->error_indicator = 1;
6877 D(p->level--);
6878 return NULL;
6879 }
6880 int _start_lineno = p->tokens[_mark]->lineno;
6881 UNUSED(_start_lineno); // Only used by EXTRA macro
6882 int _start_col_offset = p->tokens[_mark]->col_offset;
6883 UNUSED(_start_col_offset); // Only used by EXTRA macro
6884 { // expression ((',' expression))+ ','?
6885 if (p->error_indicator) {
6886 D(p->level--);
6887 return NULL;
6888 }
6889 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6890 void *_opt_var;
6891 UNUSED(_opt_var); // Silence compiler warnings
6892 expr_ty a;
6893 asdl_seq * b;
6894 if (
6895 (a = expression_rule(p)) // expression
6896 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006897 (b = _loop1_75_rule(p)) // ((',' expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006898 &&
6899 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6900 )
6901 {
6902 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6903 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6904 if (_token == NULL) {
6905 D(p->level--);
6906 return NULL;
6907 }
6908 int _end_lineno = _token->end_lineno;
6909 UNUSED(_end_lineno); // Only used by EXTRA macro
6910 int _end_col_offset = _token->end_col_offset;
6911 UNUSED(_end_col_offset); // Only used by EXTRA macro
6912 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
6913 if (_res == NULL && PyErr_Occurred()) {
6914 p->error_indicator = 1;
6915 D(p->level--);
6916 return NULL;
6917 }
6918 goto done;
6919 }
6920 p->mark = _mark;
6921 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6922 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
6923 }
6924 { // expression ','
6925 if (p->error_indicator) {
6926 D(p->level--);
6927 return NULL;
6928 }
6929 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
6930 Token * _literal;
6931 expr_ty a;
6932 if (
6933 (a = expression_rule(p)) // expression
6934 &&
6935 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6936 )
6937 {
6938 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
6939 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6940 if (_token == NULL) {
6941 D(p->level--);
6942 return NULL;
6943 }
6944 int _end_lineno = _token->end_lineno;
6945 UNUSED(_end_lineno); // Only used by EXTRA macro
6946 int _end_col_offset = _token->end_col_offset;
6947 UNUSED(_end_col_offset); // Only used by EXTRA macro
6948 _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
6949 if (_res == NULL && PyErr_Occurred()) {
6950 p->error_indicator = 1;
6951 D(p->level--);
6952 return NULL;
6953 }
6954 goto done;
6955 }
6956 p->mark = _mark;
6957 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6958 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
6959 }
6960 { // expression
6961 if (p->error_indicator) {
6962 D(p->level--);
6963 return NULL;
6964 }
6965 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6966 expr_ty expression_var;
6967 if (
6968 (expression_var = expression_rule(p)) // expression
6969 )
6970 {
6971 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6972 _res = expression_var;
6973 goto done;
6974 }
6975 p->mark = _mark;
6976 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6977 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6978 }
6979 _res = NULL;
6980 done:
6981 D(p->level--);
6982 return _res;
6983}
6984
6985// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
6986static expr_ty
6987expression_rule(Parser *p)
6988{
6989 D(p->level++);
6990 if (p->error_indicator) {
6991 D(p->level--);
6992 return NULL;
6993 }
6994 expr_ty _res = NULL;
6995 if (_PyPegen_is_memoized(p, expression_type, &_res)) {
6996 D(p->level--);
6997 return _res;
6998 }
6999 int _mark = p->mark;
7000 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7001 p->error_indicator = 1;
7002 D(p->level--);
7003 return NULL;
7004 }
7005 int _start_lineno = p->tokens[_mark]->lineno;
7006 UNUSED(_start_lineno); // Only used by EXTRA macro
7007 int _start_col_offset = p->tokens[_mark]->col_offset;
7008 UNUSED(_start_col_offset); // Only used by EXTRA macro
7009 { // disjunction 'if' disjunction 'else' expression
7010 if (p->error_indicator) {
7011 D(p->level--);
7012 return NULL;
7013 }
7014 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7015 Token * _keyword;
7016 Token * _keyword_1;
7017 expr_ty a;
7018 expr_ty b;
7019 expr_ty c;
7020 if (
7021 (a = disjunction_rule(p)) // disjunction
7022 &&
7023 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
7024 &&
7025 (b = disjunction_rule(p)) // disjunction
7026 &&
7027 (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else'
7028 &&
7029 (c = expression_rule(p)) // expression
7030 )
7031 {
7032 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7033 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7034 if (_token == NULL) {
7035 D(p->level--);
7036 return NULL;
7037 }
7038 int _end_lineno = _token->end_lineno;
7039 UNUSED(_end_lineno); // Only used by EXTRA macro
7040 int _end_col_offset = _token->end_col_offset;
7041 UNUSED(_end_col_offset); // Only used by EXTRA macro
7042 _res = _Py_IfExp ( b , a , c , EXTRA );
7043 if (_res == NULL && PyErr_Occurred()) {
7044 p->error_indicator = 1;
7045 D(p->level--);
7046 return NULL;
7047 }
7048 goto done;
7049 }
7050 p->mark = _mark;
7051 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7052 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7053 }
7054 { // disjunction
7055 if (p->error_indicator) {
7056 D(p->level--);
7057 return NULL;
7058 }
7059 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
7060 expr_ty disjunction_var;
7061 if (
7062 (disjunction_var = disjunction_rule(p)) // disjunction
7063 )
7064 {
7065 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
7066 _res = disjunction_var;
7067 goto done;
7068 }
7069 p->mark = _mark;
7070 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7071 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
7072 }
7073 { // lambdef
7074 if (p->error_indicator) {
7075 D(p->level--);
7076 return NULL;
7077 }
7078 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
7079 expr_ty lambdef_var;
7080 if (
7081 (lambdef_var = lambdef_rule(p)) // lambdef
7082 )
7083 {
7084 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
7085 _res = lambdef_var;
7086 goto done;
7087 }
7088 p->mark = _mark;
7089 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7090 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
7091 }
7092 _res = NULL;
7093 done:
7094 _PyPegen_insert_memo(p, _mark, expression_type, _res);
7095 D(p->level--);
7096 return _res;
7097}
7098
7099// lambdef: 'lambda' lambda_params? ':' expression
7100static expr_ty
7101lambdef_rule(Parser *p)
7102{
7103 D(p->level++);
7104 if (p->error_indicator) {
7105 D(p->level--);
7106 return NULL;
7107 }
7108 expr_ty _res = NULL;
7109 int _mark = p->mark;
7110 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7111 p->error_indicator = 1;
7112 D(p->level--);
7113 return NULL;
7114 }
7115 int _start_lineno = p->tokens[_mark]->lineno;
7116 UNUSED(_start_lineno); // Only used by EXTRA macro
7117 int _start_col_offset = p->tokens[_mark]->col_offset;
7118 UNUSED(_start_col_offset); // Only used by EXTRA macro
7119 { // 'lambda' lambda_params? ':' expression
7120 if (p->error_indicator) {
7121 D(p->level--);
7122 return NULL;
7123 }
7124 D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7125 Token * _keyword;
7126 Token * _literal;
7127 void *a;
7128 expr_ty b;
7129 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007130 (_keyword = _PyPegen_expect_token(p, 525)) // token='lambda'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007131 &&
7132 (a = lambda_params_rule(p), 1) // lambda_params?
7133 &&
7134 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
7135 &&
7136 (b = expression_rule(p)) // expression
7137 )
7138 {
7139 D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7140 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7141 if (_token == NULL) {
7142 D(p->level--);
7143 return NULL;
7144 }
7145 int _end_lineno = _token->end_lineno;
7146 UNUSED(_end_lineno); // Only used by EXTRA macro
7147 int _end_col_offset = _token->end_col_offset;
7148 UNUSED(_end_col_offset); // Only used by EXTRA macro
7149 _res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
7150 if (_res == NULL && PyErr_Occurred()) {
7151 p->error_indicator = 1;
7152 D(p->level--);
7153 return NULL;
7154 }
7155 goto done;
7156 }
7157 p->mark = _mark;
7158 D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
7159 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7160 }
7161 _res = NULL;
7162 done:
7163 D(p->level--);
7164 return _res;
7165}
7166
7167// lambda_params: invalid_lambda_parameters | lambda_parameters
7168static arguments_ty
7169lambda_params_rule(Parser *p)
7170{
7171 D(p->level++);
7172 if (p->error_indicator) {
7173 D(p->level--);
7174 return NULL;
7175 }
7176 arguments_ty _res = NULL;
7177 int _mark = p->mark;
7178 { // invalid_lambda_parameters
7179 if (p->error_indicator) {
7180 D(p->level--);
7181 return NULL;
7182 }
7183 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7184 void *invalid_lambda_parameters_var;
7185 if (
7186 (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
7187 )
7188 {
7189 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7190 _res = invalid_lambda_parameters_var;
7191 goto done;
7192 }
7193 p->mark = _mark;
7194 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7195 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
7196 }
7197 { // lambda_parameters
7198 if (p->error_indicator) {
7199 D(p->level--);
7200 return NULL;
7201 }
7202 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7203 arguments_ty lambda_parameters_var;
7204 if (
7205 (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
7206 )
7207 {
7208 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7209 _res = lambda_parameters_var;
7210 goto done;
7211 }
7212 p->mark = _mark;
7213 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7214 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
7215 }
7216 _res = NULL;
7217 done:
7218 D(p->level--);
7219 return _res;
7220}
7221
7222// lambda_parameters:
7223// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7224// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7225// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7226// | lambda_param_with_default+ lambda_star_etc?
7227// | lambda_star_etc
7228static arguments_ty
7229lambda_parameters_rule(Parser *p)
7230{
7231 D(p->level++);
7232 if (p->error_indicator) {
7233 D(p->level--);
7234 return NULL;
7235 }
7236 arguments_ty _res = NULL;
7237 int _mark = p->mark;
7238 { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7239 if (p->error_indicator) {
7240 D(p->level--);
7241 return NULL;
7242 }
7243 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?"));
7244 asdl_seq* a;
7245 asdl_seq * b;
7246 asdl_seq * c;
7247 void *d;
7248 if (
7249 (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
7250 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007251 (b = _loop0_76_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007252 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007253 (c = _loop0_77_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007254 &&
7255 (d = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7256 )
7257 {
7258 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?"));
7259 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
7260 if (_res == NULL && PyErr_Occurred()) {
7261 p->error_indicator = 1;
7262 D(p->level--);
7263 return NULL;
7264 }
7265 goto done;
7266 }
7267 p->mark = _mark;
7268 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7269 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
7270 }
7271 { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7272 if (p->error_indicator) {
7273 D(p->level--);
7274 return NULL;
7275 }
7276 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?"));
7277 SlashWithDefault* a;
7278 asdl_seq * b;
7279 void *c;
7280 if (
7281 (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
7282 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007283 (b = _loop0_78_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007284 &&
7285 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7286 )
7287 {
7288 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?"));
7289 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
7290 if (_res == NULL && PyErr_Occurred()) {
7291 p->error_indicator = 1;
7292 D(p->level--);
7293 return NULL;
7294 }
7295 goto done;
7296 }
7297 p->mark = _mark;
7298 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7299 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
7300 }
7301 { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7302 if (p->error_indicator) {
7303 D(p->level--);
7304 return NULL;
7305 }
7306 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?"));
7307 asdl_seq * a;
7308 asdl_seq * b;
7309 void *c;
7310 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007311 (a = _loop1_79_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007312 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007313 (b = _loop0_80_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007314 &&
7315 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7316 )
7317 {
7318 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?"));
7319 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
7320 if (_res == NULL && PyErr_Occurred()) {
7321 p->error_indicator = 1;
7322 D(p->level--);
7323 return NULL;
7324 }
7325 goto done;
7326 }
7327 p->mark = _mark;
7328 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7329 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
7330 }
7331 { // lambda_param_with_default+ lambda_star_etc?
7332 if (p->error_indicator) {
7333 D(p->level--);
7334 return NULL;
7335 }
7336 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7337 asdl_seq * a;
7338 void *b;
7339 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007340 (a = _loop1_81_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007341 &&
7342 (b = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7343 )
7344 {
7345 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7346 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
7347 if (_res == NULL && PyErr_Occurred()) {
7348 p->error_indicator = 1;
7349 D(p->level--);
7350 return NULL;
7351 }
7352 goto done;
7353 }
7354 p->mark = _mark;
7355 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7356 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7357 }
7358 { // lambda_star_etc
7359 if (p->error_indicator) {
7360 D(p->level--);
7361 return NULL;
7362 }
7363 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7364 StarEtc* a;
7365 if (
7366 (a = lambda_star_etc_rule(p)) // lambda_star_etc
7367 )
7368 {
7369 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7370 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
7371 if (_res == NULL && PyErr_Occurred()) {
7372 p->error_indicator = 1;
7373 D(p->level--);
7374 return NULL;
7375 }
7376 goto done;
7377 }
7378 p->mark = _mark;
7379 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7380 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
7381 }
7382 _res = NULL;
7383 done:
7384 D(p->level--);
7385 return _res;
7386}
7387
7388// lambda_slash_no_default:
7389// | lambda_param_no_default+ '/' ','
7390// | lambda_param_no_default+ '/' &':'
7391static asdl_seq*
7392lambda_slash_no_default_rule(Parser *p)
7393{
7394 D(p->level++);
7395 if (p->error_indicator) {
7396 D(p->level--);
7397 return NULL;
7398 }
7399 asdl_seq* _res = NULL;
7400 int _mark = p->mark;
7401 { // lambda_param_no_default+ '/' ','
7402 if (p->error_indicator) {
7403 D(p->level--);
7404 return NULL;
7405 }
7406 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7407 Token * _literal;
7408 Token * _literal_1;
7409 asdl_seq * a;
7410 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007411 (a = _loop1_82_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007412 &&
7413 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7414 &&
7415 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7416 )
7417 {
7418 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7419 _res = a;
7420 if (_res == NULL && PyErr_Occurred()) {
7421 p->error_indicator = 1;
7422 D(p->level--);
7423 return NULL;
7424 }
7425 goto done;
7426 }
7427 p->mark = _mark;
7428 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7429 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7430 }
7431 { // lambda_param_no_default+ '/' &':'
7432 if (p->error_indicator) {
7433 D(p->level--);
7434 return NULL;
7435 }
7436 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7437 Token * _literal;
7438 asdl_seq * a;
7439 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007440 (a = _loop1_83_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007441 &&
7442 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7443 &&
7444 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7445 )
7446 {
7447 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7448 _res = a;
7449 if (_res == NULL && PyErr_Occurred()) {
7450 p->error_indicator = 1;
7451 D(p->level--);
7452 return NULL;
7453 }
7454 goto done;
7455 }
7456 p->mark = _mark;
7457 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7458 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7459 }
7460 _res = NULL;
7461 done:
7462 D(p->level--);
7463 return _res;
7464}
7465
7466// lambda_slash_with_default:
7467// | lambda_param_no_default* lambda_param_with_default+ '/' ','
7468// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
7469static SlashWithDefault*
7470lambda_slash_with_default_rule(Parser *p)
7471{
7472 D(p->level++);
7473 if (p->error_indicator) {
7474 D(p->level--);
7475 return NULL;
7476 }
7477 SlashWithDefault* _res = NULL;
7478 int _mark = p->mark;
7479 { // lambda_param_no_default* lambda_param_with_default+ '/' ','
7480 if (p->error_indicator) {
7481 D(p->level--);
7482 return NULL;
7483 }
7484 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+ '/' ','"));
7485 Token * _literal;
7486 Token * _literal_1;
7487 asdl_seq * a;
7488 asdl_seq * b;
7489 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007490 (a = _loop0_84_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007491 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007492 (b = _loop1_85_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007493 &&
7494 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7495 &&
7496 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7497 )
7498 {
7499 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+ '/' ','"));
7500 _res = _PyPegen_slash_with_default ( p , a , b );
7501 if (_res == NULL && PyErr_Occurred()) {
7502 p->error_indicator = 1;
7503 D(p->level--);
7504 return NULL;
7505 }
7506 goto done;
7507 }
7508 p->mark = _mark;
7509 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7510 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
7511 }
7512 { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
7513 if (p->error_indicator) {
7514 D(p->level--);
7515 return NULL;
7516 }
7517 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+ '/' &':'"));
7518 Token * _literal;
7519 asdl_seq * a;
7520 asdl_seq * b;
7521 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007522 (a = _loop0_86_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007523 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007524 (b = _loop1_87_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007525 &&
7526 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7527 &&
7528 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7529 )
7530 {
7531 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+ '/' &':'"));
7532 _res = _PyPegen_slash_with_default ( p , a , b );
7533 if (_res == NULL && PyErr_Occurred()) {
7534 p->error_indicator = 1;
7535 D(p->level--);
7536 return NULL;
7537 }
7538 goto done;
7539 }
7540 p->mark = _mark;
7541 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7542 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
7543 }
7544 _res = NULL;
7545 done:
7546 D(p->level--);
7547 return _res;
7548}
7549
7550// lambda_star_etc:
7551// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7552// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
7553// | lambda_kwds
7554// | invalid_lambda_star_etc
7555static StarEtc*
7556lambda_star_etc_rule(Parser *p)
7557{
7558 D(p->level++);
7559 if (p->error_indicator) {
7560 D(p->level--);
7561 return NULL;
7562 }
7563 StarEtc* _res = NULL;
7564 int _mark = p->mark;
7565 { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7566 if (p->error_indicator) {
7567 D(p->level--);
7568 return NULL;
7569 }
7570 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?"));
7571 Token * _literal;
7572 arg_ty a;
7573 asdl_seq * b;
7574 void *c;
7575 if (
7576 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7577 &&
7578 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7579 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007580 (b = _loop0_88_rule(p)) // lambda_param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007581 &&
7582 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7583 )
7584 {
7585 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?"));
7586 _res = _PyPegen_star_etc ( p , a , b , c );
7587 if (_res == NULL && PyErr_Occurred()) {
7588 p->error_indicator = 1;
7589 D(p->level--);
7590 return NULL;
7591 }
7592 goto done;
7593 }
7594 p->mark = _mark;
7595 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7596 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
7597 }
7598 { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
7599 if (p->error_indicator) {
7600 D(p->level--);
7601 return NULL;
7602 }
7603 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7604 Token * _literal;
7605 Token * _literal_1;
7606 asdl_seq * b;
7607 void *c;
7608 if (
7609 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7610 &&
7611 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7612 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007613 (b = _loop1_89_rule(p)) // lambda_param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007614 &&
7615 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7616 )
7617 {
7618 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7619 _res = _PyPegen_star_etc ( p , NULL , b , c );
7620 if (_res == NULL && PyErr_Occurred()) {
7621 p->error_indicator = 1;
7622 D(p->level--);
7623 return NULL;
7624 }
7625 goto done;
7626 }
7627 p->mark = _mark;
7628 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7629 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7630 }
7631 { // lambda_kwds
7632 if (p->error_indicator) {
7633 D(p->level--);
7634 return NULL;
7635 }
7636 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7637 arg_ty a;
7638 if (
7639 (a = lambda_kwds_rule(p)) // lambda_kwds
7640 )
7641 {
7642 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7643 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
7644 if (_res == NULL && PyErr_Occurred()) {
7645 p->error_indicator = 1;
7646 D(p->level--);
7647 return NULL;
7648 }
7649 goto done;
7650 }
7651 p->mark = _mark;
7652 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7653 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
7654 }
7655 { // invalid_lambda_star_etc
7656 if (p->error_indicator) {
7657 D(p->level--);
7658 return NULL;
7659 }
7660 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7661 void *invalid_lambda_star_etc_var;
7662 if (
7663 (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
7664 )
7665 {
7666 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7667 _res = invalid_lambda_star_etc_var;
7668 goto done;
7669 }
7670 p->mark = _mark;
7671 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7672 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
7673 }
7674 _res = NULL;
7675 done:
7676 D(p->level--);
7677 return _res;
7678}
7679
7680// lambda_kwds: '**' lambda_param_no_default
7681static arg_ty
7682lambda_kwds_rule(Parser *p)
7683{
7684 D(p->level++);
7685 if (p->error_indicator) {
7686 D(p->level--);
7687 return NULL;
7688 }
7689 arg_ty _res = NULL;
7690 int _mark = p->mark;
7691 { // '**' lambda_param_no_default
7692 if (p->error_indicator) {
7693 D(p->level--);
7694 return NULL;
7695 }
7696 D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7697 Token * _literal;
7698 arg_ty a;
7699 if (
7700 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
7701 &&
7702 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7703 )
7704 {
7705 D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7706 _res = a;
7707 if (_res == NULL && PyErr_Occurred()) {
7708 p->error_indicator = 1;
7709 D(p->level--);
7710 return NULL;
7711 }
7712 goto done;
7713 }
7714 p->mark = _mark;
7715 D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
7716 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
7717 }
7718 _res = NULL;
7719 done:
7720 D(p->level--);
7721 return _res;
7722}
7723
7724// lambda_param_no_default: lambda_param ',' | lambda_param &':'
7725static arg_ty
7726lambda_param_no_default_rule(Parser *p)
7727{
7728 D(p->level++);
7729 if (p->error_indicator) {
7730 D(p->level--);
7731 return NULL;
7732 }
7733 arg_ty _res = NULL;
7734 int _mark = p->mark;
7735 { // lambda_param ','
7736 if (p->error_indicator) {
7737 D(p->level--);
7738 return NULL;
7739 }
7740 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7741 Token * _literal;
7742 arg_ty a;
7743 if (
7744 (a = lambda_param_rule(p)) // lambda_param
7745 &&
7746 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7747 )
7748 {
7749 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7750 _res = a;
7751 if (_res == NULL && PyErr_Occurred()) {
7752 p->error_indicator = 1;
7753 D(p->level--);
7754 return NULL;
7755 }
7756 goto done;
7757 }
7758 p->mark = _mark;
7759 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7760 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
7761 }
7762 { // lambda_param &':'
7763 if (p->error_indicator) {
7764 D(p->level--);
7765 return NULL;
7766 }
7767 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7768 arg_ty a;
7769 if (
7770 (a = lambda_param_rule(p)) // lambda_param
7771 &&
7772 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7773 )
7774 {
7775 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7776 _res = a;
7777 if (_res == NULL && PyErr_Occurred()) {
7778 p->error_indicator = 1;
7779 D(p->level--);
7780 return NULL;
7781 }
7782 goto done;
7783 }
7784 p->mark = _mark;
7785 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7786 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
7787 }
7788 _res = NULL;
7789 done:
7790 D(p->level--);
7791 return _res;
7792}
7793
7794// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
7795static NameDefaultPair*
7796lambda_param_with_default_rule(Parser *p)
7797{
7798 D(p->level++);
7799 if (p->error_indicator) {
7800 D(p->level--);
7801 return NULL;
7802 }
7803 NameDefaultPair* _res = NULL;
7804 int _mark = p->mark;
7805 { // lambda_param default ','
7806 if (p->error_indicator) {
7807 D(p->level--);
7808 return NULL;
7809 }
7810 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7811 Token * _literal;
7812 arg_ty a;
7813 expr_ty c;
7814 if (
7815 (a = lambda_param_rule(p)) // lambda_param
7816 &&
7817 (c = default_rule(p)) // default
7818 &&
7819 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7820 )
7821 {
7822 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7823 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7824 if (_res == NULL && PyErr_Occurred()) {
7825 p->error_indicator = 1;
7826 D(p->level--);
7827 return NULL;
7828 }
7829 goto done;
7830 }
7831 p->mark = _mark;
7832 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7833 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
7834 }
7835 { // lambda_param default &':'
7836 if (p->error_indicator) {
7837 D(p->level--);
7838 return NULL;
7839 }
7840 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7841 arg_ty a;
7842 expr_ty c;
7843 if (
7844 (a = lambda_param_rule(p)) // lambda_param
7845 &&
7846 (c = default_rule(p)) // default
7847 &&
7848 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7849 )
7850 {
7851 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7852 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7853 if (_res == NULL && PyErr_Occurred()) {
7854 p->error_indicator = 1;
7855 D(p->level--);
7856 return NULL;
7857 }
7858 goto done;
7859 }
7860 p->mark = _mark;
7861 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7862 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
7863 }
7864 _res = NULL;
7865 done:
7866 D(p->level--);
7867 return _res;
7868}
7869
7870// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
7871static NameDefaultPair*
7872lambda_param_maybe_default_rule(Parser *p)
7873{
7874 D(p->level++);
7875 if (p->error_indicator) {
7876 D(p->level--);
7877 return NULL;
7878 }
7879 NameDefaultPair* _res = NULL;
7880 int _mark = p->mark;
7881 { // lambda_param default? ','
7882 if (p->error_indicator) {
7883 D(p->level--);
7884 return NULL;
7885 }
7886 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7887 Token * _literal;
7888 arg_ty a;
7889 void *c;
7890 if (
7891 (a = lambda_param_rule(p)) // lambda_param
7892 &&
7893 (c = default_rule(p), 1) // default?
7894 &&
7895 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7896 )
7897 {
7898 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7899 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7900 if (_res == NULL && PyErr_Occurred()) {
7901 p->error_indicator = 1;
7902 D(p->level--);
7903 return NULL;
7904 }
7905 goto done;
7906 }
7907 p->mark = _mark;
7908 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7909 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
7910 }
7911 { // lambda_param default? &':'
7912 if (p->error_indicator) {
7913 D(p->level--);
7914 return NULL;
7915 }
7916 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7917 arg_ty a;
7918 void *c;
7919 if (
7920 (a = lambda_param_rule(p)) // lambda_param
7921 &&
7922 (c = default_rule(p), 1) // default?
7923 &&
7924 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7925 )
7926 {
7927 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7928 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7929 if (_res == NULL && PyErr_Occurred()) {
7930 p->error_indicator = 1;
7931 D(p->level--);
7932 return NULL;
7933 }
7934 goto done;
7935 }
7936 p->mark = _mark;
7937 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7938 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
7939 }
7940 _res = NULL;
7941 done:
7942 D(p->level--);
7943 return _res;
7944}
7945
7946// lambda_param: NAME
7947static arg_ty
7948lambda_param_rule(Parser *p)
7949{
7950 D(p->level++);
7951 if (p->error_indicator) {
7952 D(p->level--);
7953 return NULL;
7954 }
7955 arg_ty _res = NULL;
7956 int _mark = p->mark;
7957 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7958 p->error_indicator = 1;
7959 D(p->level--);
7960 return NULL;
7961 }
7962 int _start_lineno = p->tokens[_mark]->lineno;
7963 UNUSED(_start_lineno); // Only used by EXTRA macro
7964 int _start_col_offset = p->tokens[_mark]->col_offset;
7965 UNUSED(_start_col_offset); // Only used by EXTRA macro
7966 { // NAME
7967 if (p->error_indicator) {
7968 D(p->level--);
7969 return NULL;
7970 }
7971 D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
7972 expr_ty a;
7973 if (
7974 (a = _PyPegen_name_token(p)) // NAME
7975 )
7976 {
7977 D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
7978 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7979 if (_token == NULL) {
7980 D(p->level--);
7981 return NULL;
7982 }
7983 int _end_lineno = _token->end_lineno;
7984 UNUSED(_end_lineno); // Only used by EXTRA macro
7985 int _end_col_offset = _token->end_col_offset;
7986 UNUSED(_end_col_offset); // Only used by EXTRA macro
7987 _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
7988 if (_res == NULL && PyErr_Occurred()) {
7989 p->error_indicator = 1;
7990 D(p->level--);
7991 return NULL;
7992 }
7993 goto done;
7994 }
7995 p->mark = _mark;
7996 D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
7997 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
7998 }
7999 _res = NULL;
8000 done:
8001 D(p->level--);
8002 return _res;
8003}
8004
8005// disjunction: conjunction (('or' conjunction))+ | conjunction
8006static expr_ty
8007disjunction_rule(Parser *p)
8008{
8009 D(p->level++);
8010 if (p->error_indicator) {
8011 D(p->level--);
8012 return NULL;
8013 }
8014 expr_ty _res = NULL;
8015 if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
8016 D(p->level--);
8017 return _res;
8018 }
8019 int _mark = p->mark;
8020 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8021 p->error_indicator = 1;
8022 D(p->level--);
8023 return NULL;
8024 }
8025 int _start_lineno = p->tokens[_mark]->lineno;
8026 UNUSED(_start_lineno); // Only used by EXTRA macro
8027 int _start_col_offset = p->tokens[_mark]->col_offset;
8028 UNUSED(_start_col_offset); // Only used by EXTRA macro
8029 { // conjunction (('or' conjunction))+
8030 if (p->error_indicator) {
8031 D(p->level--);
8032 return NULL;
8033 }
8034 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8035 expr_ty a;
8036 asdl_seq * b;
8037 if (
8038 (a = conjunction_rule(p)) // conjunction
8039 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008040 (b = _loop1_90_rule(p)) // (('or' conjunction))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008041 )
8042 {
8043 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8044 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8045 if (_token == NULL) {
8046 D(p->level--);
8047 return NULL;
8048 }
8049 int _end_lineno = _token->end_lineno;
8050 UNUSED(_end_lineno); // Only used by EXTRA macro
8051 int _end_col_offset = _token->end_col_offset;
8052 UNUSED(_end_col_offset); // Only used by EXTRA macro
8053 _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
8054 if (_res == NULL && PyErr_Occurred()) {
8055 p->error_indicator = 1;
8056 D(p->level--);
8057 return NULL;
8058 }
8059 goto done;
8060 }
8061 p->mark = _mark;
8062 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8063 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+"));
8064 }
8065 { // conjunction
8066 if (p->error_indicator) {
8067 D(p->level--);
8068 return NULL;
8069 }
8070 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
8071 expr_ty conjunction_var;
8072 if (
8073 (conjunction_var = conjunction_rule(p)) // conjunction
8074 )
8075 {
8076 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
8077 _res = conjunction_var;
8078 goto done;
8079 }
8080 p->mark = _mark;
8081 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8082 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
8083 }
8084 _res = NULL;
8085 done:
8086 _PyPegen_insert_memo(p, _mark, disjunction_type, _res);
8087 D(p->level--);
8088 return _res;
8089}
8090
8091// conjunction: inversion (('and' inversion))+ | inversion
8092static expr_ty
8093conjunction_rule(Parser *p)
8094{
8095 D(p->level++);
8096 if (p->error_indicator) {
8097 D(p->level--);
8098 return NULL;
8099 }
8100 expr_ty _res = NULL;
8101 if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
8102 D(p->level--);
8103 return _res;
8104 }
8105 int _mark = p->mark;
8106 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8107 p->error_indicator = 1;
8108 D(p->level--);
8109 return NULL;
8110 }
8111 int _start_lineno = p->tokens[_mark]->lineno;
8112 UNUSED(_start_lineno); // Only used by EXTRA macro
8113 int _start_col_offset = p->tokens[_mark]->col_offset;
8114 UNUSED(_start_col_offset); // Only used by EXTRA macro
8115 { // inversion (('and' inversion))+
8116 if (p->error_indicator) {
8117 D(p->level--);
8118 return NULL;
8119 }
8120 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8121 expr_ty a;
8122 asdl_seq * b;
8123 if (
8124 (a = inversion_rule(p)) // inversion
8125 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008126 (b = _loop1_91_rule(p)) // (('and' inversion))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008127 )
8128 {
8129 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8130 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8131 if (_token == NULL) {
8132 D(p->level--);
8133 return NULL;
8134 }
8135 int _end_lineno = _token->end_lineno;
8136 UNUSED(_end_lineno); // Only used by EXTRA macro
8137 int _end_col_offset = _token->end_col_offset;
8138 UNUSED(_end_col_offset); // Only used by EXTRA macro
8139 _res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
8140 if (_res == NULL && PyErr_Occurred()) {
8141 p->error_indicator = 1;
8142 D(p->level--);
8143 return NULL;
8144 }
8145 goto done;
8146 }
8147 p->mark = _mark;
8148 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8149 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+"));
8150 }
8151 { // inversion
8152 if (p->error_indicator) {
8153 D(p->level--);
8154 return NULL;
8155 }
8156 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
8157 expr_ty inversion_var;
8158 if (
8159 (inversion_var = inversion_rule(p)) // inversion
8160 )
8161 {
8162 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
8163 _res = inversion_var;
8164 goto done;
8165 }
8166 p->mark = _mark;
8167 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8168 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
8169 }
8170 _res = NULL;
8171 done:
8172 _PyPegen_insert_memo(p, _mark, conjunction_type, _res);
8173 D(p->level--);
8174 return _res;
8175}
8176
8177// inversion: 'not' inversion | comparison
8178static expr_ty
8179inversion_rule(Parser *p)
8180{
8181 D(p->level++);
8182 if (p->error_indicator) {
8183 D(p->level--);
8184 return NULL;
8185 }
8186 expr_ty _res = NULL;
8187 if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
8188 D(p->level--);
8189 return _res;
8190 }
8191 int _mark = p->mark;
8192 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8193 p->error_indicator = 1;
8194 D(p->level--);
8195 return NULL;
8196 }
8197 int _start_lineno = p->tokens[_mark]->lineno;
8198 UNUSED(_start_lineno); // Only used by EXTRA macro
8199 int _start_col_offset = p->tokens[_mark]->col_offset;
8200 UNUSED(_start_col_offset); // Only used by EXTRA macro
8201 { // 'not' inversion
8202 if (p->error_indicator) {
8203 D(p->level--);
8204 return NULL;
8205 }
8206 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8207 Token * _keyword;
8208 expr_ty a;
8209 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008210 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008211 &&
8212 (a = inversion_rule(p)) // inversion
8213 )
8214 {
8215 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8216 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8217 if (_token == NULL) {
8218 D(p->level--);
8219 return NULL;
8220 }
8221 int _end_lineno = _token->end_lineno;
8222 UNUSED(_end_lineno); // Only used by EXTRA macro
8223 int _end_col_offset = _token->end_col_offset;
8224 UNUSED(_end_col_offset); // Only used by EXTRA macro
8225 _res = _Py_UnaryOp ( Not , a , EXTRA );
8226 if (_res == NULL && PyErr_Occurred()) {
8227 p->error_indicator = 1;
8228 D(p->level--);
8229 return NULL;
8230 }
8231 goto done;
8232 }
8233 p->mark = _mark;
8234 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8235 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion"));
8236 }
8237 { // comparison
8238 if (p->error_indicator) {
8239 D(p->level--);
8240 return NULL;
8241 }
8242 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
8243 expr_ty comparison_var;
8244 if (
8245 (comparison_var = comparison_rule(p)) // comparison
8246 )
8247 {
8248 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
8249 _res = comparison_var;
8250 goto done;
8251 }
8252 p->mark = _mark;
8253 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8254 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
8255 }
8256 _res = NULL;
8257 done:
8258 _PyPegen_insert_memo(p, _mark, inversion_type, _res);
8259 D(p->level--);
8260 return _res;
8261}
8262
8263// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
8264static expr_ty
8265comparison_rule(Parser *p)
8266{
8267 D(p->level++);
8268 if (p->error_indicator) {
8269 D(p->level--);
8270 return NULL;
8271 }
8272 expr_ty _res = NULL;
8273 int _mark = p->mark;
8274 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8275 p->error_indicator = 1;
8276 D(p->level--);
8277 return NULL;
8278 }
8279 int _start_lineno = p->tokens[_mark]->lineno;
8280 UNUSED(_start_lineno); // Only used by EXTRA macro
8281 int _start_col_offset = p->tokens[_mark]->col_offset;
8282 UNUSED(_start_col_offset); // Only used by EXTRA macro
8283 { // bitwise_or compare_op_bitwise_or_pair+
8284 if (p->error_indicator) {
8285 D(p->level--);
8286 return NULL;
8287 }
8288 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8289 expr_ty a;
8290 asdl_seq * b;
8291 if (
8292 (a = bitwise_or_rule(p)) // bitwise_or
8293 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008294 (b = _loop1_92_rule(p)) // compare_op_bitwise_or_pair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008295 )
8296 {
8297 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8298 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8299 if (_token == NULL) {
8300 D(p->level--);
8301 return NULL;
8302 }
8303 int _end_lineno = _token->end_lineno;
8304 UNUSED(_end_lineno); // Only used by EXTRA macro
8305 int _end_col_offset = _token->end_col_offset;
8306 UNUSED(_end_col_offset); // Only used by EXTRA macro
8307 _res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA );
8308 if (_res == NULL && PyErr_Occurred()) {
8309 p->error_indicator = 1;
8310 D(p->level--);
8311 return NULL;
8312 }
8313 goto done;
8314 }
8315 p->mark = _mark;
8316 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8317 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8318 }
8319 { // bitwise_or
8320 if (p->error_indicator) {
8321 D(p->level--);
8322 return NULL;
8323 }
8324 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8325 expr_ty bitwise_or_var;
8326 if (
8327 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
8328 )
8329 {
8330 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8331 _res = bitwise_or_var;
8332 goto done;
8333 }
8334 p->mark = _mark;
8335 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8336 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
8337 }
8338 _res = NULL;
8339 done:
8340 D(p->level--);
8341 return _res;
8342}
8343
8344// compare_op_bitwise_or_pair:
8345// | eq_bitwise_or
8346// | noteq_bitwise_or
8347// | lte_bitwise_or
8348// | lt_bitwise_or
8349// | gte_bitwise_or
8350// | gt_bitwise_or
8351// | notin_bitwise_or
8352// | in_bitwise_or
8353// | isnot_bitwise_or
8354// | is_bitwise_or
8355static CmpopExprPair*
8356compare_op_bitwise_or_pair_rule(Parser *p)
8357{
8358 D(p->level++);
8359 if (p->error_indicator) {
8360 D(p->level--);
8361 return NULL;
8362 }
8363 CmpopExprPair* _res = NULL;
8364 int _mark = p->mark;
8365 { // eq_bitwise_or
8366 if (p->error_indicator) {
8367 D(p->level--);
8368 return NULL;
8369 }
8370 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8371 CmpopExprPair* eq_bitwise_or_var;
8372 if (
8373 (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or
8374 )
8375 {
8376 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8377 _res = eq_bitwise_or_var;
8378 goto done;
8379 }
8380 p->mark = _mark;
8381 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8382 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or"));
8383 }
8384 { // noteq_bitwise_or
8385 if (p->error_indicator) {
8386 D(p->level--);
8387 return NULL;
8388 }
8389 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8390 CmpopExprPair* noteq_bitwise_or_var;
8391 if (
8392 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or
8393 )
8394 {
8395 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8396 _res = noteq_bitwise_or_var;
8397 goto done;
8398 }
8399 p->mark = _mark;
8400 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8401 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or"));
8402 }
8403 { // lte_bitwise_or
8404 if (p->error_indicator) {
8405 D(p->level--);
8406 return NULL;
8407 }
8408 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8409 CmpopExprPair* lte_bitwise_or_var;
8410 if (
8411 (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or
8412 )
8413 {
8414 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8415 _res = lte_bitwise_or_var;
8416 goto done;
8417 }
8418 p->mark = _mark;
8419 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8420 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or"));
8421 }
8422 { // lt_bitwise_or
8423 if (p->error_indicator) {
8424 D(p->level--);
8425 return NULL;
8426 }
8427 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8428 CmpopExprPair* lt_bitwise_or_var;
8429 if (
8430 (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or
8431 )
8432 {
8433 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8434 _res = lt_bitwise_or_var;
8435 goto done;
8436 }
8437 p->mark = _mark;
8438 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8439 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or"));
8440 }
8441 { // gte_bitwise_or
8442 if (p->error_indicator) {
8443 D(p->level--);
8444 return NULL;
8445 }
8446 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8447 CmpopExprPair* gte_bitwise_or_var;
8448 if (
8449 (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or
8450 )
8451 {
8452 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8453 _res = gte_bitwise_or_var;
8454 goto done;
8455 }
8456 p->mark = _mark;
8457 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8458 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or"));
8459 }
8460 { // gt_bitwise_or
8461 if (p->error_indicator) {
8462 D(p->level--);
8463 return NULL;
8464 }
8465 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8466 CmpopExprPair* gt_bitwise_or_var;
8467 if (
8468 (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or
8469 )
8470 {
8471 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8472 _res = gt_bitwise_or_var;
8473 goto done;
8474 }
8475 p->mark = _mark;
8476 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8477 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or"));
8478 }
8479 { // notin_bitwise_or
8480 if (p->error_indicator) {
8481 D(p->level--);
8482 return NULL;
8483 }
8484 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8485 CmpopExprPair* notin_bitwise_or_var;
8486 if (
8487 (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or
8488 )
8489 {
8490 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8491 _res = notin_bitwise_or_var;
8492 goto done;
8493 }
8494 p->mark = _mark;
8495 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8496 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or"));
8497 }
8498 { // in_bitwise_or
8499 if (p->error_indicator) {
8500 D(p->level--);
8501 return NULL;
8502 }
8503 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8504 CmpopExprPair* in_bitwise_or_var;
8505 if (
8506 (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or
8507 )
8508 {
8509 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8510 _res = in_bitwise_or_var;
8511 goto done;
8512 }
8513 p->mark = _mark;
8514 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8515 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or"));
8516 }
8517 { // isnot_bitwise_or
8518 if (p->error_indicator) {
8519 D(p->level--);
8520 return NULL;
8521 }
8522 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8523 CmpopExprPair* isnot_bitwise_or_var;
8524 if (
8525 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or
8526 )
8527 {
8528 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8529 _res = isnot_bitwise_or_var;
8530 goto done;
8531 }
8532 p->mark = _mark;
8533 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8534 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or"));
8535 }
8536 { // is_bitwise_or
8537 if (p->error_indicator) {
8538 D(p->level--);
8539 return NULL;
8540 }
8541 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8542 CmpopExprPair* is_bitwise_or_var;
8543 if (
8544 (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or
8545 )
8546 {
8547 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8548 _res = is_bitwise_or_var;
8549 goto done;
8550 }
8551 p->mark = _mark;
8552 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8553 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
8554 }
8555 _res = NULL;
8556 done:
8557 D(p->level--);
8558 return _res;
8559}
8560
8561// eq_bitwise_or: '==' bitwise_or
8562static CmpopExprPair*
8563eq_bitwise_or_rule(Parser *p)
8564{
8565 D(p->level++);
8566 if (p->error_indicator) {
8567 D(p->level--);
8568 return NULL;
8569 }
8570 CmpopExprPair* _res = NULL;
8571 int _mark = p->mark;
8572 { // '==' bitwise_or
8573 if (p->error_indicator) {
8574 D(p->level--);
8575 return NULL;
8576 }
8577 D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8578 Token * _literal;
8579 expr_ty a;
8580 if (
8581 (_literal = _PyPegen_expect_token(p, 27)) // token='=='
8582 &&
8583 (a = bitwise_or_rule(p)) // bitwise_or
8584 )
8585 {
8586 D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8587 _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
8588 if (_res == NULL && PyErr_Occurred()) {
8589 p->error_indicator = 1;
8590 D(p->level--);
8591 return NULL;
8592 }
8593 goto done;
8594 }
8595 p->mark = _mark;
8596 D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8597 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
8598 }
8599 _res = NULL;
8600 done:
8601 D(p->level--);
8602 return _res;
8603}
8604
8605// noteq_bitwise_or: ('!=') bitwise_or
8606static CmpopExprPair*
8607noteq_bitwise_or_rule(Parser *p)
8608{
8609 D(p->level++);
8610 if (p->error_indicator) {
8611 D(p->level--);
8612 return NULL;
8613 }
8614 CmpopExprPair* _res = NULL;
8615 int _mark = p->mark;
8616 { // ('!=') bitwise_or
8617 if (p->error_indicator) {
8618 D(p->level--);
8619 return NULL;
8620 }
8621 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 +03008622 void *_tmp_93_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008623 expr_ty a;
8624 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008625 (_tmp_93_var = _tmp_93_rule(p)) // '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008626 &&
8627 (a = bitwise_or_rule(p)) // bitwise_or
8628 )
8629 {
8630 D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
8631 _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
8632 if (_res == NULL && PyErr_Occurred()) {
8633 p->error_indicator = 1;
8634 D(p->level--);
8635 return NULL;
8636 }
8637 goto done;
8638 }
8639 p->mark = _mark;
8640 D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8641 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
8642 }
8643 _res = NULL;
8644 done:
8645 D(p->level--);
8646 return _res;
8647}
8648
8649// lte_bitwise_or: '<=' bitwise_or
8650static CmpopExprPair*
8651lte_bitwise_or_rule(Parser *p)
8652{
8653 D(p->level++);
8654 if (p->error_indicator) {
8655 D(p->level--);
8656 return NULL;
8657 }
8658 CmpopExprPair* _res = NULL;
8659 int _mark = p->mark;
8660 { // '<=' bitwise_or
8661 if (p->error_indicator) {
8662 D(p->level--);
8663 return NULL;
8664 }
8665 D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8666 Token * _literal;
8667 expr_ty a;
8668 if (
8669 (_literal = _PyPegen_expect_token(p, 29)) // token='<='
8670 &&
8671 (a = bitwise_or_rule(p)) // bitwise_or
8672 )
8673 {
8674 D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8675 _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
8676 if (_res == NULL && PyErr_Occurred()) {
8677 p->error_indicator = 1;
8678 D(p->level--);
8679 return NULL;
8680 }
8681 goto done;
8682 }
8683 p->mark = _mark;
8684 D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8685 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
8686 }
8687 _res = NULL;
8688 done:
8689 D(p->level--);
8690 return _res;
8691}
8692
8693// lt_bitwise_or: '<' bitwise_or
8694static CmpopExprPair*
8695lt_bitwise_or_rule(Parser *p)
8696{
8697 D(p->level++);
8698 if (p->error_indicator) {
8699 D(p->level--);
8700 return NULL;
8701 }
8702 CmpopExprPair* _res = NULL;
8703 int _mark = p->mark;
8704 { // '<' bitwise_or
8705 if (p->error_indicator) {
8706 D(p->level--);
8707 return NULL;
8708 }
8709 D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8710 Token * _literal;
8711 expr_ty a;
8712 if (
8713 (_literal = _PyPegen_expect_token(p, 20)) // token='<'
8714 &&
8715 (a = bitwise_or_rule(p)) // bitwise_or
8716 )
8717 {
8718 D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8719 _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
8720 if (_res == NULL && PyErr_Occurred()) {
8721 p->error_indicator = 1;
8722 D(p->level--);
8723 return NULL;
8724 }
8725 goto done;
8726 }
8727 p->mark = _mark;
8728 D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8729 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
8730 }
8731 _res = NULL;
8732 done:
8733 D(p->level--);
8734 return _res;
8735}
8736
8737// gte_bitwise_or: '>=' bitwise_or
8738static CmpopExprPair*
8739gte_bitwise_or_rule(Parser *p)
8740{
8741 D(p->level++);
8742 if (p->error_indicator) {
8743 D(p->level--);
8744 return NULL;
8745 }
8746 CmpopExprPair* _res = NULL;
8747 int _mark = p->mark;
8748 { // '>=' bitwise_or
8749 if (p->error_indicator) {
8750 D(p->level--);
8751 return NULL;
8752 }
8753 D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8754 Token * _literal;
8755 expr_ty a;
8756 if (
8757 (_literal = _PyPegen_expect_token(p, 30)) // token='>='
8758 &&
8759 (a = bitwise_or_rule(p)) // bitwise_or
8760 )
8761 {
8762 D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8763 _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
8764 if (_res == NULL && PyErr_Occurred()) {
8765 p->error_indicator = 1;
8766 D(p->level--);
8767 return NULL;
8768 }
8769 goto done;
8770 }
8771 p->mark = _mark;
8772 D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8773 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
8774 }
8775 _res = NULL;
8776 done:
8777 D(p->level--);
8778 return _res;
8779}
8780
8781// gt_bitwise_or: '>' bitwise_or
8782static CmpopExprPair*
8783gt_bitwise_or_rule(Parser *p)
8784{
8785 D(p->level++);
8786 if (p->error_indicator) {
8787 D(p->level--);
8788 return NULL;
8789 }
8790 CmpopExprPair* _res = NULL;
8791 int _mark = p->mark;
8792 { // '>' bitwise_or
8793 if (p->error_indicator) {
8794 D(p->level--);
8795 return NULL;
8796 }
8797 D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8798 Token * _literal;
8799 expr_ty a;
8800 if (
8801 (_literal = _PyPegen_expect_token(p, 21)) // token='>'
8802 &&
8803 (a = bitwise_or_rule(p)) // bitwise_or
8804 )
8805 {
8806 D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8807 _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
8808 if (_res == NULL && PyErr_Occurred()) {
8809 p->error_indicator = 1;
8810 D(p->level--);
8811 return NULL;
8812 }
8813 goto done;
8814 }
8815 p->mark = _mark;
8816 D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8817 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
8818 }
8819 _res = NULL;
8820 done:
8821 D(p->level--);
8822 return _res;
8823}
8824
8825// notin_bitwise_or: 'not' 'in' bitwise_or
8826static CmpopExprPair*
8827notin_bitwise_or_rule(Parser *p)
8828{
8829 D(p->level++);
8830 if (p->error_indicator) {
8831 D(p->level--);
8832 return NULL;
8833 }
8834 CmpopExprPair* _res = NULL;
8835 int _mark = p->mark;
8836 { // 'not' 'in' bitwise_or
8837 if (p->error_indicator) {
8838 D(p->level--);
8839 return NULL;
8840 }
8841 D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8842 Token * _keyword;
8843 Token * _keyword_1;
8844 expr_ty a;
8845 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008846 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008847 &&
8848 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
8849 &&
8850 (a = bitwise_or_rule(p)) // bitwise_or
8851 )
8852 {
8853 D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8854 _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
8855 if (_res == NULL && PyErr_Occurred()) {
8856 p->error_indicator = 1;
8857 D(p->level--);
8858 return NULL;
8859 }
8860 goto done;
8861 }
8862 p->mark = _mark;
8863 D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8864 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
8865 }
8866 _res = NULL;
8867 done:
8868 D(p->level--);
8869 return _res;
8870}
8871
8872// in_bitwise_or: 'in' bitwise_or
8873static CmpopExprPair*
8874in_bitwise_or_rule(Parser *p)
8875{
8876 D(p->level++);
8877 if (p->error_indicator) {
8878 D(p->level--);
8879 return NULL;
8880 }
8881 CmpopExprPair* _res = NULL;
8882 int _mark = p->mark;
8883 { // 'in' bitwise_or
8884 if (p->error_indicator) {
8885 D(p->level--);
8886 return NULL;
8887 }
8888 D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8889 Token * _keyword;
8890 expr_ty a;
8891 if (
8892 (_keyword = _PyPegen_expect_token(p, 518)) // token='in'
8893 &&
8894 (a = bitwise_or_rule(p)) // bitwise_or
8895 )
8896 {
8897 D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8898 _res = _PyPegen_cmpop_expr_pair ( p , In , a );
8899 if (_res == NULL && PyErr_Occurred()) {
8900 p->error_indicator = 1;
8901 D(p->level--);
8902 return NULL;
8903 }
8904 goto done;
8905 }
8906 p->mark = _mark;
8907 D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8908 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
8909 }
8910 _res = NULL;
8911 done:
8912 D(p->level--);
8913 return _res;
8914}
8915
8916// isnot_bitwise_or: 'is' 'not' bitwise_or
8917static CmpopExprPair*
8918isnot_bitwise_or_rule(Parser *p)
8919{
8920 D(p->level++);
8921 if (p->error_indicator) {
8922 D(p->level--);
8923 return NULL;
8924 }
8925 CmpopExprPair* _res = NULL;
8926 int _mark = p->mark;
8927 { // 'is' 'not' bitwise_or
8928 if (p->error_indicator) {
8929 D(p->level--);
8930 return NULL;
8931 }
8932 D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8933 Token * _keyword;
8934 Token * _keyword_1;
8935 expr_ty a;
8936 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008937 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008938 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008939 (_keyword_1 = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008940 &&
8941 (a = bitwise_or_rule(p)) // bitwise_or
8942 )
8943 {
8944 D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8945 _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
8946 if (_res == NULL && PyErr_Occurred()) {
8947 p->error_indicator = 1;
8948 D(p->level--);
8949 return NULL;
8950 }
8951 goto done;
8952 }
8953 p->mark = _mark;
8954 D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8955 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
8956 }
8957 _res = NULL;
8958 done:
8959 D(p->level--);
8960 return _res;
8961}
8962
8963// is_bitwise_or: 'is' bitwise_or
8964static CmpopExprPair*
8965is_bitwise_or_rule(Parser *p)
8966{
8967 D(p->level++);
8968 if (p->error_indicator) {
8969 D(p->level--);
8970 return NULL;
8971 }
8972 CmpopExprPair* _res = NULL;
8973 int _mark = p->mark;
8974 { // 'is' bitwise_or
8975 if (p->error_indicator) {
8976 D(p->level--);
8977 return NULL;
8978 }
8979 D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
8980 Token * _keyword;
8981 expr_ty a;
8982 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008983 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008984 &&
8985 (a = bitwise_or_rule(p)) // bitwise_or
8986 )
8987 {
8988 D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
8989 _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
8990 if (_res == NULL && PyErr_Occurred()) {
8991 p->error_indicator = 1;
8992 D(p->level--);
8993 return NULL;
8994 }
8995 goto done;
8996 }
8997 p->mark = _mark;
8998 D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8999 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
9000 }
9001 _res = NULL;
9002 done:
9003 D(p->level--);
9004 return _res;
9005}
9006
9007// Left-recursive
9008// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
9009static expr_ty bitwise_or_raw(Parser *);
9010static expr_ty
9011bitwise_or_rule(Parser *p)
9012{
9013 D(p->level++);
9014 expr_ty _res = NULL;
9015 if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
9016 D(p->level--);
9017 return _res;
9018 }
9019 int _mark = p->mark;
9020 int _resmark = p->mark;
9021 while (1) {
9022 int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
9023 if (tmpvar_1) {
9024 D(p->level--);
9025 return _res;
9026 }
9027 p->mark = _mark;
9028 void *_raw = bitwise_or_raw(p);
9029 if (_raw == NULL || p->mark <= _resmark)
9030 break;
9031 _resmark = p->mark;
9032 _res = _raw;
9033 }
9034 p->mark = _resmark;
9035 D(p->level--);
9036 return _res;
9037}
9038static expr_ty
9039bitwise_or_raw(Parser *p)
9040{
9041 D(p->level++);
9042 if (p->error_indicator) {
9043 D(p->level--);
9044 return NULL;
9045 }
9046 expr_ty _res = NULL;
9047 int _mark = p->mark;
9048 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9049 p->error_indicator = 1;
9050 D(p->level--);
9051 return NULL;
9052 }
9053 int _start_lineno = p->tokens[_mark]->lineno;
9054 UNUSED(_start_lineno); // Only used by EXTRA macro
9055 int _start_col_offset = p->tokens[_mark]->col_offset;
9056 UNUSED(_start_col_offset); // Only used by EXTRA macro
9057 { // bitwise_or '|' bitwise_xor
9058 if (p->error_indicator) {
9059 D(p->level--);
9060 return NULL;
9061 }
9062 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9063 Token * _literal;
9064 expr_ty a;
9065 expr_ty b;
9066 if (
9067 (a = bitwise_or_rule(p)) // bitwise_or
9068 &&
9069 (_literal = _PyPegen_expect_token(p, 18)) // token='|'
9070 &&
9071 (b = bitwise_xor_rule(p)) // bitwise_xor
9072 )
9073 {
9074 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9075 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9076 if (_token == NULL) {
9077 D(p->level--);
9078 return NULL;
9079 }
9080 int _end_lineno = _token->end_lineno;
9081 UNUSED(_end_lineno); // Only used by EXTRA macro
9082 int _end_col_offset = _token->end_col_offset;
9083 UNUSED(_end_col_offset); // Only used by EXTRA macro
9084 _res = _Py_BinOp ( a , BitOr , b , EXTRA );
9085 if (_res == NULL && PyErr_Occurred()) {
9086 p->error_indicator = 1;
9087 D(p->level--);
9088 return NULL;
9089 }
9090 goto done;
9091 }
9092 p->mark = _mark;
9093 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9094 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9095 }
9096 { // bitwise_xor
9097 if (p->error_indicator) {
9098 D(p->level--);
9099 return NULL;
9100 }
9101 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9102 expr_ty bitwise_xor_var;
9103 if (
9104 (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor
9105 )
9106 {
9107 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9108 _res = bitwise_xor_var;
9109 goto done;
9110 }
9111 p->mark = _mark;
9112 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9113 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
9114 }
9115 _res = NULL;
9116 done:
9117 D(p->level--);
9118 return _res;
9119}
9120
9121// Left-recursive
9122// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
9123static expr_ty bitwise_xor_raw(Parser *);
9124static expr_ty
9125bitwise_xor_rule(Parser *p)
9126{
9127 D(p->level++);
9128 expr_ty _res = NULL;
9129 if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
9130 D(p->level--);
9131 return _res;
9132 }
9133 int _mark = p->mark;
9134 int _resmark = p->mark;
9135 while (1) {
9136 int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
9137 if (tmpvar_2) {
9138 D(p->level--);
9139 return _res;
9140 }
9141 p->mark = _mark;
9142 void *_raw = bitwise_xor_raw(p);
9143 if (_raw == NULL || p->mark <= _resmark)
9144 break;
9145 _resmark = p->mark;
9146 _res = _raw;
9147 }
9148 p->mark = _resmark;
9149 D(p->level--);
9150 return _res;
9151}
9152static expr_ty
9153bitwise_xor_raw(Parser *p)
9154{
9155 D(p->level++);
9156 if (p->error_indicator) {
9157 D(p->level--);
9158 return NULL;
9159 }
9160 expr_ty _res = NULL;
9161 int _mark = p->mark;
9162 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9163 p->error_indicator = 1;
9164 D(p->level--);
9165 return NULL;
9166 }
9167 int _start_lineno = p->tokens[_mark]->lineno;
9168 UNUSED(_start_lineno); // Only used by EXTRA macro
9169 int _start_col_offset = p->tokens[_mark]->col_offset;
9170 UNUSED(_start_col_offset); // Only used by EXTRA macro
9171 { // bitwise_xor '^' bitwise_and
9172 if (p->error_indicator) {
9173 D(p->level--);
9174 return NULL;
9175 }
9176 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9177 Token * _literal;
9178 expr_ty a;
9179 expr_ty b;
9180 if (
9181 (a = bitwise_xor_rule(p)) // bitwise_xor
9182 &&
9183 (_literal = _PyPegen_expect_token(p, 32)) // token='^'
9184 &&
9185 (b = bitwise_and_rule(p)) // bitwise_and
9186 )
9187 {
9188 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9189 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9190 if (_token == NULL) {
9191 D(p->level--);
9192 return NULL;
9193 }
9194 int _end_lineno = _token->end_lineno;
9195 UNUSED(_end_lineno); // Only used by EXTRA macro
9196 int _end_col_offset = _token->end_col_offset;
9197 UNUSED(_end_col_offset); // Only used by EXTRA macro
9198 _res = _Py_BinOp ( a , BitXor , b , EXTRA );
9199 if (_res == NULL && PyErr_Occurred()) {
9200 p->error_indicator = 1;
9201 D(p->level--);
9202 return NULL;
9203 }
9204 goto done;
9205 }
9206 p->mark = _mark;
9207 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9208 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9209 }
9210 { // bitwise_and
9211 if (p->error_indicator) {
9212 D(p->level--);
9213 return NULL;
9214 }
9215 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9216 expr_ty bitwise_and_var;
9217 if (
9218 (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and
9219 )
9220 {
9221 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9222 _res = bitwise_and_var;
9223 goto done;
9224 }
9225 p->mark = _mark;
9226 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9227 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
9228 }
9229 _res = NULL;
9230 done:
9231 D(p->level--);
9232 return _res;
9233}
9234
9235// Left-recursive
9236// bitwise_and: bitwise_and '&' shift_expr | shift_expr
9237static expr_ty bitwise_and_raw(Parser *);
9238static expr_ty
9239bitwise_and_rule(Parser *p)
9240{
9241 D(p->level++);
9242 expr_ty _res = NULL;
9243 if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
9244 D(p->level--);
9245 return _res;
9246 }
9247 int _mark = p->mark;
9248 int _resmark = p->mark;
9249 while (1) {
9250 int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
9251 if (tmpvar_3) {
9252 D(p->level--);
9253 return _res;
9254 }
9255 p->mark = _mark;
9256 void *_raw = bitwise_and_raw(p);
9257 if (_raw == NULL || p->mark <= _resmark)
9258 break;
9259 _resmark = p->mark;
9260 _res = _raw;
9261 }
9262 p->mark = _resmark;
9263 D(p->level--);
9264 return _res;
9265}
9266static expr_ty
9267bitwise_and_raw(Parser *p)
9268{
9269 D(p->level++);
9270 if (p->error_indicator) {
9271 D(p->level--);
9272 return NULL;
9273 }
9274 expr_ty _res = NULL;
9275 int _mark = p->mark;
9276 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9277 p->error_indicator = 1;
9278 D(p->level--);
9279 return NULL;
9280 }
9281 int _start_lineno = p->tokens[_mark]->lineno;
9282 UNUSED(_start_lineno); // Only used by EXTRA macro
9283 int _start_col_offset = p->tokens[_mark]->col_offset;
9284 UNUSED(_start_col_offset); // Only used by EXTRA macro
9285 { // bitwise_and '&' shift_expr
9286 if (p->error_indicator) {
9287 D(p->level--);
9288 return NULL;
9289 }
9290 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9291 Token * _literal;
9292 expr_ty a;
9293 expr_ty b;
9294 if (
9295 (a = bitwise_and_rule(p)) // bitwise_and
9296 &&
9297 (_literal = _PyPegen_expect_token(p, 19)) // token='&'
9298 &&
9299 (b = shift_expr_rule(p)) // shift_expr
9300 )
9301 {
9302 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9303 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9304 if (_token == NULL) {
9305 D(p->level--);
9306 return NULL;
9307 }
9308 int _end_lineno = _token->end_lineno;
9309 UNUSED(_end_lineno); // Only used by EXTRA macro
9310 int _end_col_offset = _token->end_col_offset;
9311 UNUSED(_end_col_offset); // Only used by EXTRA macro
9312 _res = _Py_BinOp ( a , BitAnd , b , EXTRA );
9313 if (_res == NULL && PyErr_Occurred()) {
9314 p->error_indicator = 1;
9315 D(p->level--);
9316 return NULL;
9317 }
9318 goto done;
9319 }
9320 p->mark = _mark;
9321 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9322 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr"));
9323 }
9324 { // shift_expr
9325 if (p->error_indicator) {
9326 D(p->level--);
9327 return NULL;
9328 }
9329 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9330 expr_ty shift_expr_var;
9331 if (
9332 (shift_expr_var = shift_expr_rule(p)) // shift_expr
9333 )
9334 {
9335 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9336 _res = shift_expr_var;
9337 goto done;
9338 }
9339 p->mark = _mark;
9340 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9341 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
9342 }
9343 _res = NULL;
9344 done:
9345 D(p->level--);
9346 return _res;
9347}
9348
9349// Left-recursive
9350// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
9351static expr_ty shift_expr_raw(Parser *);
9352static expr_ty
9353shift_expr_rule(Parser *p)
9354{
9355 D(p->level++);
9356 expr_ty _res = NULL;
9357 if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
9358 D(p->level--);
9359 return _res;
9360 }
9361 int _mark = p->mark;
9362 int _resmark = p->mark;
9363 while (1) {
9364 int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
9365 if (tmpvar_4) {
9366 D(p->level--);
9367 return _res;
9368 }
9369 p->mark = _mark;
9370 void *_raw = shift_expr_raw(p);
9371 if (_raw == NULL || p->mark <= _resmark)
9372 break;
9373 _resmark = p->mark;
9374 _res = _raw;
9375 }
9376 p->mark = _resmark;
9377 D(p->level--);
9378 return _res;
9379}
9380static expr_ty
9381shift_expr_raw(Parser *p)
9382{
9383 D(p->level++);
9384 if (p->error_indicator) {
9385 D(p->level--);
9386 return NULL;
9387 }
9388 expr_ty _res = NULL;
9389 int _mark = p->mark;
9390 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9391 p->error_indicator = 1;
9392 D(p->level--);
9393 return NULL;
9394 }
9395 int _start_lineno = p->tokens[_mark]->lineno;
9396 UNUSED(_start_lineno); // Only used by EXTRA macro
9397 int _start_col_offset = p->tokens[_mark]->col_offset;
9398 UNUSED(_start_col_offset); // Only used by EXTRA macro
9399 { // shift_expr '<<' sum
9400 if (p->error_indicator) {
9401 D(p->level--);
9402 return NULL;
9403 }
9404 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9405 Token * _literal;
9406 expr_ty a;
9407 expr_ty b;
9408 if (
9409 (a = shift_expr_rule(p)) // shift_expr
9410 &&
9411 (_literal = _PyPegen_expect_token(p, 33)) // token='<<'
9412 &&
9413 (b = sum_rule(p)) // sum
9414 )
9415 {
9416 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9417 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9418 if (_token == NULL) {
9419 D(p->level--);
9420 return NULL;
9421 }
9422 int _end_lineno = _token->end_lineno;
9423 UNUSED(_end_lineno); // Only used by EXTRA macro
9424 int _end_col_offset = _token->end_col_offset;
9425 UNUSED(_end_col_offset); // Only used by EXTRA macro
9426 _res = _Py_BinOp ( a , LShift , b , EXTRA );
9427 if (_res == NULL && PyErr_Occurred()) {
9428 p->error_indicator = 1;
9429 D(p->level--);
9430 return NULL;
9431 }
9432 goto done;
9433 }
9434 p->mark = _mark;
9435 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9436 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
9437 }
9438 { // shift_expr '>>' sum
9439 if (p->error_indicator) {
9440 D(p->level--);
9441 return NULL;
9442 }
9443 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9444 Token * _literal;
9445 expr_ty a;
9446 expr_ty b;
9447 if (
9448 (a = shift_expr_rule(p)) // shift_expr
9449 &&
9450 (_literal = _PyPegen_expect_token(p, 34)) // token='>>'
9451 &&
9452 (b = sum_rule(p)) // sum
9453 )
9454 {
9455 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9456 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9457 if (_token == NULL) {
9458 D(p->level--);
9459 return NULL;
9460 }
9461 int _end_lineno = _token->end_lineno;
9462 UNUSED(_end_lineno); // Only used by EXTRA macro
9463 int _end_col_offset = _token->end_col_offset;
9464 UNUSED(_end_col_offset); // Only used by EXTRA macro
9465 _res = _Py_BinOp ( a , RShift , b , EXTRA );
9466 if (_res == NULL && PyErr_Occurred()) {
9467 p->error_indicator = 1;
9468 D(p->level--);
9469 return NULL;
9470 }
9471 goto done;
9472 }
9473 p->mark = _mark;
9474 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum"));
9476 }
9477 { // sum
9478 if (p->error_indicator) {
9479 D(p->level--);
9480 return NULL;
9481 }
9482 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
9483 expr_ty sum_var;
9484 if (
9485 (sum_var = sum_rule(p)) // sum
9486 )
9487 {
9488 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
9489 _res = sum_var;
9490 goto done;
9491 }
9492 p->mark = _mark;
9493 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9494 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
9495 }
9496 _res = NULL;
9497 done:
9498 D(p->level--);
9499 return _res;
9500}
9501
9502// Left-recursive
9503// sum: sum '+' term | sum '-' term | term
9504static expr_ty sum_raw(Parser *);
9505static expr_ty
9506sum_rule(Parser *p)
9507{
9508 D(p->level++);
9509 expr_ty _res = NULL;
9510 if (_PyPegen_is_memoized(p, sum_type, &_res)) {
9511 D(p->level--);
9512 return _res;
9513 }
9514 int _mark = p->mark;
9515 int _resmark = p->mark;
9516 while (1) {
9517 int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res);
9518 if (tmpvar_5) {
9519 D(p->level--);
9520 return _res;
9521 }
9522 p->mark = _mark;
9523 void *_raw = sum_raw(p);
9524 if (_raw == NULL || p->mark <= _resmark)
9525 break;
9526 _resmark = p->mark;
9527 _res = _raw;
9528 }
9529 p->mark = _resmark;
9530 D(p->level--);
9531 return _res;
9532}
9533static expr_ty
9534sum_raw(Parser *p)
9535{
9536 D(p->level++);
9537 if (p->error_indicator) {
9538 D(p->level--);
9539 return NULL;
9540 }
9541 expr_ty _res = NULL;
9542 int _mark = p->mark;
9543 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9544 p->error_indicator = 1;
9545 D(p->level--);
9546 return NULL;
9547 }
9548 int _start_lineno = p->tokens[_mark]->lineno;
9549 UNUSED(_start_lineno); // Only used by EXTRA macro
9550 int _start_col_offset = p->tokens[_mark]->col_offset;
9551 UNUSED(_start_col_offset); // Only used by EXTRA macro
9552 { // sum '+' term
9553 if (p->error_indicator) {
9554 D(p->level--);
9555 return NULL;
9556 }
9557 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9558 Token * _literal;
9559 expr_ty a;
9560 expr_ty b;
9561 if (
9562 (a = sum_rule(p)) // sum
9563 &&
9564 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9565 &&
9566 (b = term_rule(p)) // term
9567 )
9568 {
9569 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9570 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9571 if (_token == NULL) {
9572 D(p->level--);
9573 return NULL;
9574 }
9575 int _end_lineno = _token->end_lineno;
9576 UNUSED(_end_lineno); // Only used by EXTRA macro
9577 int _end_col_offset = _token->end_col_offset;
9578 UNUSED(_end_col_offset); // Only used by EXTRA macro
9579 _res = _Py_BinOp ( a , Add , b , EXTRA );
9580 if (_res == NULL && PyErr_Occurred()) {
9581 p->error_indicator = 1;
9582 D(p->level--);
9583 return NULL;
9584 }
9585 goto done;
9586 }
9587 p->mark = _mark;
9588 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9589 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
9590 }
9591 { // sum '-' term
9592 if (p->error_indicator) {
9593 D(p->level--);
9594 return NULL;
9595 }
9596 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9597 Token * _literal;
9598 expr_ty a;
9599 expr_ty b;
9600 if (
9601 (a = sum_rule(p)) // sum
9602 &&
9603 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
9604 &&
9605 (b = term_rule(p)) // term
9606 )
9607 {
9608 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9609 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9610 if (_token == NULL) {
9611 D(p->level--);
9612 return NULL;
9613 }
9614 int _end_lineno = _token->end_lineno;
9615 UNUSED(_end_lineno); // Only used by EXTRA macro
9616 int _end_col_offset = _token->end_col_offset;
9617 UNUSED(_end_col_offset); // Only used by EXTRA macro
9618 _res = _Py_BinOp ( a , Sub , b , EXTRA );
9619 if (_res == NULL && PyErr_Occurred()) {
9620 p->error_indicator = 1;
9621 D(p->level--);
9622 return NULL;
9623 }
9624 goto done;
9625 }
9626 p->mark = _mark;
9627 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9628 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term"));
9629 }
9630 { // term
9631 if (p->error_indicator) {
9632 D(p->level--);
9633 return NULL;
9634 }
9635 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
9636 expr_ty term_var;
9637 if (
9638 (term_var = term_rule(p)) // term
9639 )
9640 {
9641 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
9642 _res = term_var;
9643 goto done;
9644 }
9645 p->mark = _mark;
9646 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9647 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
9648 }
9649 _res = NULL;
9650 done:
9651 D(p->level--);
9652 return _res;
9653}
9654
9655// Left-recursive
9656// term:
9657// | term '*' factor
9658// | term '/' factor
9659// | term '//' factor
9660// | term '%' factor
9661// | term '@' factor
9662// | factor
9663static expr_ty term_raw(Parser *);
9664static expr_ty
9665term_rule(Parser *p)
9666{
9667 D(p->level++);
9668 expr_ty _res = NULL;
9669 if (_PyPegen_is_memoized(p, term_type, &_res)) {
9670 D(p->level--);
9671 return _res;
9672 }
9673 int _mark = p->mark;
9674 int _resmark = p->mark;
9675 while (1) {
9676 int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res);
9677 if (tmpvar_6) {
9678 D(p->level--);
9679 return _res;
9680 }
9681 p->mark = _mark;
9682 void *_raw = term_raw(p);
9683 if (_raw == NULL || p->mark <= _resmark)
9684 break;
9685 _resmark = p->mark;
9686 _res = _raw;
9687 }
9688 p->mark = _resmark;
9689 D(p->level--);
9690 return _res;
9691}
9692static expr_ty
9693term_raw(Parser *p)
9694{
9695 D(p->level++);
9696 if (p->error_indicator) {
9697 D(p->level--);
9698 return NULL;
9699 }
9700 expr_ty _res = NULL;
9701 int _mark = p->mark;
9702 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9703 p->error_indicator = 1;
9704 D(p->level--);
9705 return NULL;
9706 }
9707 int _start_lineno = p->tokens[_mark]->lineno;
9708 UNUSED(_start_lineno); // Only used by EXTRA macro
9709 int _start_col_offset = p->tokens[_mark]->col_offset;
9710 UNUSED(_start_col_offset); // Only used by EXTRA macro
9711 { // term '*' factor
9712 if (p->error_indicator) {
9713 D(p->level--);
9714 return NULL;
9715 }
9716 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9717 Token * _literal;
9718 expr_ty a;
9719 expr_ty b;
9720 if (
9721 (a = term_rule(p)) // term
9722 &&
9723 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
9724 &&
9725 (b = factor_rule(p)) // factor
9726 )
9727 {
9728 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9729 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9730 if (_token == NULL) {
9731 D(p->level--);
9732 return NULL;
9733 }
9734 int _end_lineno = _token->end_lineno;
9735 UNUSED(_end_lineno); // Only used by EXTRA macro
9736 int _end_col_offset = _token->end_col_offset;
9737 UNUSED(_end_col_offset); // Only used by EXTRA macro
9738 _res = _Py_BinOp ( a , Mult , b , EXTRA );
9739 if (_res == NULL && PyErr_Occurred()) {
9740 p->error_indicator = 1;
9741 D(p->level--);
9742 return NULL;
9743 }
9744 goto done;
9745 }
9746 p->mark = _mark;
9747 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9748 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
9749 }
9750 { // term '/' factor
9751 if (p->error_indicator) {
9752 D(p->level--);
9753 return NULL;
9754 }
9755 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9756 Token * _literal;
9757 expr_ty a;
9758 expr_ty b;
9759 if (
9760 (a = term_rule(p)) // term
9761 &&
9762 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
9763 &&
9764 (b = factor_rule(p)) // factor
9765 )
9766 {
9767 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9768 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9769 if (_token == NULL) {
9770 D(p->level--);
9771 return NULL;
9772 }
9773 int _end_lineno = _token->end_lineno;
9774 UNUSED(_end_lineno); // Only used by EXTRA macro
9775 int _end_col_offset = _token->end_col_offset;
9776 UNUSED(_end_col_offset); // Only used by EXTRA macro
9777 _res = _Py_BinOp ( a , Div , b , EXTRA );
9778 if (_res == NULL && PyErr_Occurred()) {
9779 p->error_indicator = 1;
9780 D(p->level--);
9781 return NULL;
9782 }
9783 goto done;
9784 }
9785 p->mark = _mark;
9786 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9787 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
9788 }
9789 { // term '//' factor
9790 if (p->error_indicator) {
9791 D(p->level--);
9792 return NULL;
9793 }
9794 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9795 Token * _literal;
9796 expr_ty a;
9797 expr_ty b;
9798 if (
9799 (a = term_rule(p)) // term
9800 &&
9801 (_literal = _PyPegen_expect_token(p, 47)) // token='//'
9802 &&
9803 (b = factor_rule(p)) // factor
9804 )
9805 {
9806 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9807 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9808 if (_token == NULL) {
9809 D(p->level--);
9810 return NULL;
9811 }
9812 int _end_lineno = _token->end_lineno;
9813 UNUSED(_end_lineno); // Only used by EXTRA macro
9814 int _end_col_offset = _token->end_col_offset;
9815 UNUSED(_end_col_offset); // Only used by EXTRA macro
9816 _res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
9817 if (_res == NULL && PyErr_Occurred()) {
9818 p->error_indicator = 1;
9819 D(p->level--);
9820 return NULL;
9821 }
9822 goto done;
9823 }
9824 p->mark = _mark;
9825 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9826 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
9827 }
9828 { // term '%' factor
9829 if (p->error_indicator) {
9830 D(p->level--);
9831 return NULL;
9832 }
9833 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9834 Token * _literal;
9835 expr_ty a;
9836 expr_ty b;
9837 if (
9838 (a = term_rule(p)) // term
9839 &&
9840 (_literal = _PyPegen_expect_token(p, 24)) // token='%'
9841 &&
9842 (b = factor_rule(p)) // factor
9843 )
9844 {
9845 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9846 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9847 if (_token == NULL) {
9848 D(p->level--);
9849 return NULL;
9850 }
9851 int _end_lineno = _token->end_lineno;
9852 UNUSED(_end_lineno); // Only used by EXTRA macro
9853 int _end_col_offset = _token->end_col_offset;
9854 UNUSED(_end_col_offset); // Only used by EXTRA macro
9855 _res = _Py_BinOp ( a , Mod , b , EXTRA );
9856 if (_res == NULL && PyErr_Occurred()) {
9857 p->error_indicator = 1;
9858 D(p->level--);
9859 return NULL;
9860 }
9861 goto done;
9862 }
9863 p->mark = _mark;
9864 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9865 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
9866 }
9867 { // term '@' factor
9868 if (p->error_indicator) {
9869 D(p->level--);
9870 return NULL;
9871 }
9872 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9873 Token * _literal;
9874 expr_ty a;
9875 expr_ty b;
9876 if (
9877 (a = term_rule(p)) // term
9878 &&
9879 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
9880 &&
9881 (b = factor_rule(p)) // factor
9882 )
9883 {
9884 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9885 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9886 if (_token == NULL) {
9887 D(p->level--);
9888 return NULL;
9889 }
9890 int _end_lineno = _token->end_lineno;
9891 UNUSED(_end_lineno); // Only used by EXTRA macro
9892 int _end_col_offset = _token->end_col_offset;
9893 UNUSED(_end_col_offset); // Only used by EXTRA macro
9894 _res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) );
9895 if (_res == NULL && PyErr_Occurred()) {
9896 p->error_indicator = 1;
9897 D(p->level--);
9898 return NULL;
9899 }
9900 goto done;
9901 }
9902 p->mark = _mark;
9903 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9904 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor"));
9905 }
9906 { // factor
9907 if (p->error_indicator) {
9908 D(p->level--);
9909 return NULL;
9910 }
9911 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
9912 expr_ty factor_var;
9913 if (
9914 (factor_var = factor_rule(p)) // factor
9915 )
9916 {
9917 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
9918 _res = factor_var;
9919 goto done;
9920 }
9921 p->mark = _mark;
9922 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9923 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
9924 }
9925 _res = NULL;
9926 done:
9927 D(p->level--);
9928 return _res;
9929}
9930
9931// factor: '+' factor | '-' factor | '~' factor | power
9932static expr_ty
9933factor_rule(Parser *p)
9934{
9935 D(p->level++);
9936 if (p->error_indicator) {
9937 D(p->level--);
9938 return NULL;
9939 }
9940 expr_ty _res = NULL;
9941 if (_PyPegen_is_memoized(p, factor_type, &_res)) {
9942 D(p->level--);
9943 return _res;
9944 }
9945 int _mark = p->mark;
9946 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9947 p->error_indicator = 1;
9948 D(p->level--);
9949 return NULL;
9950 }
9951 int _start_lineno = p->tokens[_mark]->lineno;
9952 UNUSED(_start_lineno); // Only used by EXTRA macro
9953 int _start_col_offset = p->tokens[_mark]->col_offset;
9954 UNUSED(_start_col_offset); // Only used by EXTRA macro
9955 { // '+' factor
9956 if (p->error_indicator) {
9957 D(p->level--);
9958 return NULL;
9959 }
9960 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9961 Token * _literal;
9962 expr_ty a;
9963 if (
9964 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9965 &&
9966 (a = factor_rule(p)) // factor
9967 )
9968 {
9969 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9970 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9971 if (_token == NULL) {
9972 D(p->level--);
9973 return NULL;
9974 }
9975 int _end_lineno = _token->end_lineno;
9976 UNUSED(_end_lineno); // Only used by EXTRA macro
9977 int _end_col_offset = _token->end_col_offset;
9978 UNUSED(_end_col_offset); // Only used by EXTRA macro
9979 _res = _Py_UnaryOp ( UAdd , a , EXTRA );
9980 if (_res == NULL && PyErr_Occurred()) {
9981 p->error_indicator = 1;
9982 D(p->level--);
9983 return NULL;
9984 }
9985 goto done;
9986 }
9987 p->mark = _mark;
9988 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
9989 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
9990 }
9991 { // '-' factor
9992 if (p->error_indicator) {
9993 D(p->level--);
9994 return NULL;
9995 }
9996 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
9997 Token * _literal;
9998 expr_ty a;
9999 if (
10000 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
10001 &&
10002 (a = factor_rule(p)) // factor
10003 )
10004 {
10005 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10006 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10007 if (_token == NULL) {
10008 D(p->level--);
10009 return NULL;
10010 }
10011 int _end_lineno = _token->end_lineno;
10012 UNUSED(_end_lineno); // Only used by EXTRA macro
10013 int _end_col_offset = _token->end_col_offset;
10014 UNUSED(_end_col_offset); // Only used by EXTRA macro
10015 _res = _Py_UnaryOp ( USub , a , EXTRA );
10016 if (_res == NULL && PyErr_Occurred()) {
10017 p->error_indicator = 1;
10018 D(p->level--);
10019 return NULL;
10020 }
10021 goto done;
10022 }
10023 p->mark = _mark;
10024 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10025 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
10026 }
10027 { // '~' factor
10028 if (p->error_indicator) {
10029 D(p->level--);
10030 return NULL;
10031 }
10032 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10033 Token * _literal;
10034 expr_ty a;
10035 if (
10036 (_literal = _PyPegen_expect_token(p, 31)) // token='~'
10037 &&
10038 (a = factor_rule(p)) // factor
10039 )
10040 {
10041 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10042 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10043 if (_token == NULL) {
10044 D(p->level--);
10045 return NULL;
10046 }
10047 int _end_lineno = _token->end_lineno;
10048 UNUSED(_end_lineno); // Only used by EXTRA macro
10049 int _end_col_offset = _token->end_col_offset;
10050 UNUSED(_end_col_offset); // Only used by EXTRA macro
10051 _res = _Py_UnaryOp ( Invert , a , EXTRA );
10052 if (_res == NULL && PyErr_Occurred()) {
10053 p->error_indicator = 1;
10054 D(p->level--);
10055 return NULL;
10056 }
10057 goto done;
10058 }
10059 p->mark = _mark;
10060 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10061 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor"));
10062 }
10063 { // power
10064 if (p->error_indicator) {
10065 D(p->level--);
10066 return NULL;
10067 }
10068 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
10069 expr_ty power_var;
10070 if (
10071 (power_var = power_rule(p)) // power
10072 )
10073 {
10074 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
10075 _res = power_var;
10076 goto done;
10077 }
10078 p->mark = _mark;
10079 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10080 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
10081 }
10082 _res = NULL;
10083 done:
10084 _PyPegen_insert_memo(p, _mark, factor_type, _res);
10085 D(p->level--);
10086 return _res;
10087}
10088
10089// power: await_primary '**' factor | await_primary
10090static expr_ty
10091power_rule(Parser *p)
10092{
10093 D(p->level++);
10094 if (p->error_indicator) {
10095 D(p->level--);
10096 return NULL;
10097 }
10098 expr_ty _res = NULL;
10099 int _mark = p->mark;
10100 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10101 p->error_indicator = 1;
10102 D(p->level--);
10103 return NULL;
10104 }
10105 int _start_lineno = p->tokens[_mark]->lineno;
10106 UNUSED(_start_lineno); // Only used by EXTRA macro
10107 int _start_col_offset = p->tokens[_mark]->col_offset;
10108 UNUSED(_start_col_offset); // Only used by EXTRA macro
10109 { // await_primary '**' factor
10110 if (p->error_indicator) {
10111 D(p->level--);
10112 return NULL;
10113 }
10114 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10115 Token * _literal;
10116 expr_ty a;
10117 expr_ty b;
10118 if (
10119 (a = await_primary_rule(p)) // await_primary
10120 &&
10121 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
10122 &&
10123 (b = factor_rule(p)) // factor
10124 )
10125 {
10126 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10127 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10128 if (_token == NULL) {
10129 D(p->level--);
10130 return NULL;
10131 }
10132 int _end_lineno = _token->end_lineno;
10133 UNUSED(_end_lineno); // Only used by EXTRA macro
10134 int _end_col_offset = _token->end_col_offset;
10135 UNUSED(_end_col_offset); // Only used by EXTRA macro
10136 _res = _Py_BinOp ( a , Pow , b , EXTRA );
10137 if (_res == NULL && PyErr_Occurred()) {
10138 p->error_indicator = 1;
10139 D(p->level--);
10140 return NULL;
10141 }
10142 goto done;
10143 }
10144 p->mark = _mark;
10145 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10146 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor"));
10147 }
10148 { // await_primary
10149 if (p->error_indicator) {
10150 D(p->level--);
10151 return NULL;
10152 }
10153 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
10154 expr_ty await_primary_var;
10155 if (
10156 (await_primary_var = await_primary_rule(p)) // await_primary
10157 )
10158 {
10159 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
10160 _res = await_primary_var;
10161 goto done;
10162 }
10163 p->mark = _mark;
10164 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10165 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
10166 }
10167 _res = NULL;
10168 done:
10169 D(p->level--);
10170 return _res;
10171}
10172
10173// await_primary: AWAIT primary | primary
10174static expr_ty
10175await_primary_rule(Parser *p)
10176{
10177 D(p->level++);
10178 if (p->error_indicator) {
10179 D(p->level--);
10180 return NULL;
10181 }
10182 expr_ty _res = NULL;
10183 if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
10184 D(p->level--);
10185 return _res;
10186 }
10187 int _mark = p->mark;
10188 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10189 p->error_indicator = 1;
10190 D(p->level--);
10191 return NULL;
10192 }
10193 int _start_lineno = p->tokens[_mark]->lineno;
10194 UNUSED(_start_lineno); // Only used by EXTRA macro
10195 int _start_col_offset = p->tokens[_mark]->col_offset;
10196 UNUSED(_start_col_offset); // Only used by EXTRA macro
10197 { // AWAIT primary
10198 if (p->error_indicator) {
10199 D(p->level--);
10200 return NULL;
10201 }
10202 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10203 expr_ty a;
10204 Token * await_var;
10205 if (
10206 (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT'
10207 &&
10208 (a = primary_rule(p)) // primary
10209 )
10210 {
10211 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10212 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10213 if (_token == NULL) {
10214 D(p->level--);
10215 return NULL;
10216 }
10217 int _end_lineno = _token->end_lineno;
10218 UNUSED(_end_lineno); // Only used by EXTRA macro
10219 int _end_col_offset = _token->end_col_offset;
10220 UNUSED(_end_col_offset); // Only used by EXTRA macro
10221 _res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) );
10222 if (_res == NULL && PyErr_Occurred()) {
10223 p->error_indicator = 1;
10224 D(p->level--);
10225 return NULL;
10226 }
10227 goto done;
10228 }
10229 p->mark = _mark;
10230 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10231 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary"));
10232 }
10233 { // primary
10234 if (p->error_indicator) {
10235 D(p->level--);
10236 return NULL;
10237 }
10238 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
10239 expr_ty primary_var;
10240 if (
10241 (primary_var = primary_rule(p)) // primary
10242 )
10243 {
10244 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
10245 _res = primary_var;
10246 goto done;
10247 }
10248 p->mark = _mark;
10249 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10250 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
10251 }
10252 _res = NULL;
10253 done:
10254 _PyPegen_insert_memo(p, _mark, await_primary_type, _res);
10255 D(p->level--);
10256 return _res;
10257}
10258
10259// Left-recursive
10260// primary:
10261// | primary '.' NAME
10262// | primary genexp
10263// | primary '(' arguments? ')'
10264// | primary '[' slices ']'
10265// | atom
10266static expr_ty primary_raw(Parser *);
10267static expr_ty
10268primary_rule(Parser *p)
10269{
10270 D(p->level++);
10271 expr_ty _res = NULL;
10272 if (_PyPegen_is_memoized(p, primary_type, &_res)) {
10273 D(p->level--);
10274 return _res;
10275 }
10276 int _mark = p->mark;
10277 int _resmark = p->mark;
10278 while (1) {
10279 int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res);
10280 if (tmpvar_7) {
10281 D(p->level--);
10282 return _res;
10283 }
10284 p->mark = _mark;
10285 void *_raw = primary_raw(p);
10286 if (_raw == NULL || p->mark <= _resmark)
10287 break;
10288 _resmark = p->mark;
10289 _res = _raw;
10290 }
10291 p->mark = _resmark;
10292 D(p->level--);
10293 return _res;
10294}
10295static expr_ty
10296primary_raw(Parser *p)
10297{
10298 D(p->level++);
10299 if (p->error_indicator) {
10300 D(p->level--);
10301 return NULL;
10302 }
10303 expr_ty _res = NULL;
10304 int _mark = p->mark;
10305 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10306 p->error_indicator = 1;
10307 D(p->level--);
10308 return NULL;
10309 }
10310 int _start_lineno = p->tokens[_mark]->lineno;
10311 UNUSED(_start_lineno); // Only used by EXTRA macro
10312 int _start_col_offset = p->tokens[_mark]->col_offset;
10313 UNUSED(_start_col_offset); // Only used by EXTRA macro
10314 { // primary '.' NAME
10315 if (p->error_indicator) {
10316 D(p->level--);
10317 return NULL;
10318 }
10319 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10320 Token * _literal;
10321 expr_ty a;
10322 expr_ty b;
10323 if (
10324 (a = primary_rule(p)) // primary
10325 &&
10326 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
10327 &&
10328 (b = _PyPegen_name_token(p)) // NAME
10329 )
10330 {
10331 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10332 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10333 if (_token == NULL) {
10334 D(p->level--);
10335 return NULL;
10336 }
10337 int _end_lineno = _token->end_lineno;
10338 UNUSED(_end_lineno); // Only used by EXTRA macro
10339 int _end_col_offset = _token->end_col_offset;
10340 UNUSED(_end_col_offset); // Only used by EXTRA macro
10341 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
10342 if (_res == NULL && PyErr_Occurred()) {
10343 p->error_indicator = 1;
10344 D(p->level--);
10345 return NULL;
10346 }
10347 goto done;
10348 }
10349 p->mark = _mark;
10350 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10351 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
10352 }
10353 { // primary genexp
10354 if (p->error_indicator) {
10355 D(p->level--);
10356 return NULL;
10357 }
10358 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10359 expr_ty a;
10360 expr_ty b;
10361 if (
10362 (a = primary_rule(p)) // primary
10363 &&
10364 (b = genexp_rule(p)) // genexp
10365 )
10366 {
10367 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10368 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10369 if (_token == NULL) {
10370 D(p->level--);
10371 return NULL;
10372 }
10373 int _end_lineno = _token->end_lineno;
10374 UNUSED(_end_lineno); // Only used by EXTRA macro
10375 int _end_col_offset = _token->end_col_offset;
10376 UNUSED(_end_col_offset); // Only used by EXTRA macro
10377 _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
10378 if (_res == NULL && PyErr_Occurred()) {
10379 p->error_indicator = 1;
10380 D(p->level--);
10381 return NULL;
10382 }
10383 goto done;
10384 }
10385 p->mark = _mark;
10386 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10387 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
10388 }
10389 { // primary '(' arguments? ')'
10390 if (p->error_indicator) {
10391 D(p->level--);
10392 return NULL;
10393 }
10394 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10395 Token * _literal;
10396 Token * _literal_1;
10397 expr_ty a;
10398 void *b;
10399 if (
10400 (a = primary_rule(p)) // primary
10401 &&
10402 (_literal = _PyPegen_expect_token(p, 7)) // token='('
10403 &&
10404 (b = arguments_rule(p), 1) // arguments?
10405 &&
10406 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
10407 )
10408 {
10409 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10410 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10411 if (_token == NULL) {
10412 D(p->level--);
10413 return NULL;
10414 }
10415 int _end_lineno = _token->end_lineno;
10416 UNUSED(_end_lineno); // Only used by EXTRA macro
10417 int _end_col_offset = _token->end_col_offset;
10418 UNUSED(_end_col_offset); // Only used by EXTRA macro
10419 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
10420 if (_res == NULL && PyErr_Occurred()) {
10421 p->error_indicator = 1;
10422 D(p->level--);
10423 return NULL;
10424 }
10425 goto done;
10426 }
10427 p->mark = _mark;
10428 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10429 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
10430 }
10431 { // primary '[' slices ']'
10432 if (p->error_indicator) {
10433 D(p->level--);
10434 return NULL;
10435 }
10436 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10437 Token * _literal;
10438 Token * _literal_1;
10439 expr_ty a;
10440 expr_ty b;
10441 if (
10442 (a = primary_rule(p)) // primary
10443 &&
10444 (_literal = _PyPegen_expect_token(p, 9)) // token='['
10445 &&
10446 (b = slices_rule(p)) // slices
10447 &&
10448 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
10449 )
10450 {
10451 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10452 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10453 if (_token == NULL) {
10454 D(p->level--);
10455 return NULL;
10456 }
10457 int _end_lineno = _token->end_lineno;
10458 UNUSED(_end_lineno); // Only used by EXTRA macro
10459 int _end_col_offset = _token->end_col_offset;
10460 UNUSED(_end_col_offset); // Only used by EXTRA macro
10461 _res = _Py_Subscript ( a , b , Load , EXTRA );
10462 if (_res == NULL && PyErr_Occurred()) {
10463 p->error_indicator = 1;
10464 D(p->level--);
10465 return NULL;
10466 }
10467 goto done;
10468 }
10469 p->mark = _mark;
10470 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10471 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
10472 }
10473 { // atom
10474 if (p->error_indicator) {
10475 D(p->level--);
10476 return NULL;
10477 }
10478 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
10479 expr_ty atom_var;
10480 if (
10481 (atom_var = atom_rule(p)) // atom
10482 )
10483 {
10484 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
10485 _res = atom_var;
10486 goto done;
10487 }
10488 p->mark = _mark;
10489 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10490 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
10491 }
10492 _res = NULL;
10493 done:
10494 D(p->level--);
10495 return _res;
10496}
10497
10498// slices: slice !',' | ','.slice+ ','?
10499static expr_ty
10500slices_rule(Parser *p)
10501{
10502 D(p->level++);
10503 if (p->error_indicator) {
10504 D(p->level--);
10505 return NULL;
10506 }
10507 expr_ty _res = NULL;
10508 int _mark = p->mark;
10509 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10510 p->error_indicator = 1;
10511 D(p->level--);
10512 return NULL;
10513 }
10514 int _start_lineno = p->tokens[_mark]->lineno;
10515 UNUSED(_start_lineno); // Only used by EXTRA macro
10516 int _start_col_offset = p->tokens[_mark]->col_offset;
10517 UNUSED(_start_col_offset); // Only used by EXTRA macro
10518 { // slice !','
10519 if (p->error_indicator) {
10520 D(p->level--);
10521 return NULL;
10522 }
10523 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
10524 expr_ty a;
10525 if (
10526 (a = slice_rule(p)) // slice
10527 &&
10528 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
10529 )
10530 {
10531 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
10532 _res = a;
10533 if (_res == NULL && PyErr_Occurred()) {
10534 p->error_indicator = 1;
10535 D(p->level--);
10536 return NULL;
10537 }
10538 goto done;
10539 }
10540 p->mark = _mark;
10541 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10542 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
10543 }
10544 { // ','.slice+ ','?
10545 if (p->error_indicator) {
10546 D(p->level--);
10547 return NULL;
10548 }
10549 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10550 void *_opt_var;
10551 UNUSED(_opt_var); // Silence compiler warnings
10552 asdl_seq * a;
10553 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010554 (a = _gather_94_rule(p)) // ','.slice+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010555 &&
10556 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
10557 )
10558 {
10559 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10560 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10561 if (_token == NULL) {
10562 D(p->level--);
10563 return NULL;
10564 }
10565 int _end_lineno = _token->end_lineno;
10566 UNUSED(_end_lineno); // Only used by EXTRA macro
10567 int _end_col_offset = _token->end_col_offset;
10568 UNUSED(_end_col_offset); // Only used by EXTRA macro
10569 _res = _Py_Tuple ( a , Load , EXTRA );
10570 if (_res == NULL && PyErr_Occurred()) {
10571 p->error_indicator = 1;
10572 D(p->level--);
10573 return NULL;
10574 }
10575 goto done;
10576 }
10577 p->mark = _mark;
10578 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10579 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?"));
10580 }
10581 _res = NULL;
10582 done:
10583 D(p->level--);
10584 return _res;
10585}
10586
10587// slice: expression? ':' expression? [':' expression?] | expression
10588static expr_ty
10589slice_rule(Parser *p)
10590{
10591 D(p->level++);
10592 if (p->error_indicator) {
10593 D(p->level--);
10594 return NULL;
10595 }
10596 expr_ty _res = NULL;
10597 int _mark = p->mark;
10598 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10599 p->error_indicator = 1;
10600 D(p->level--);
10601 return NULL;
10602 }
10603 int _start_lineno = p->tokens[_mark]->lineno;
10604 UNUSED(_start_lineno); // Only used by EXTRA macro
10605 int _start_col_offset = p->tokens[_mark]->col_offset;
10606 UNUSED(_start_col_offset); // Only used by EXTRA macro
10607 { // expression? ':' expression? [':' expression?]
10608 if (p->error_indicator) {
10609 D(p->level--);
10610 return NULL;
10611 }
10612 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10613 Token * _literal;
10614 void *a;
10615 void *b;
10616 void *c;
10617 if (
10618 (a = expression_rule(p), 1) // expression?
10619 &&
10620 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
10621 &&
10622 (b = expression_rule(p), 1) // expression?
10623 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010624 (c = _tmp_96_rule(p), 1) // [':' expression?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010625 )
10626 {
10627 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10628 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10629 if (_token == NULL) {
10630 D(p->level--);
10631 return NULL;
10632 }
10633 int _end_lineno = _token->end_lineno;
10634 UNUSED(_end_lineno); // Only used by EXTRA macro
10635 int _end_col_offset = _token->end_col_offset;
10636 UNUSED(_end_col_offset); // Only used by EXTRA macro
10637 _res = _Py_Slice ( a , b , c , EXTRA );
10638 if (_res == NULL && PyErr_Occurred()) {
10639 p->error_indicator = 1;
10640 D(p->level--);
10641 return NULL;
10642 }
10643 goto done;
10644 }
10645 p->mark = _mark;
10646 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10647 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10648 }
10649 { // expression
10650 if (p->error_indicator) {
10651 D(p->level--);
10652 return NULL;
10653 }
10654 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
10655 expr_ty a;
10656 if (
10657 (a = expression_rule(p)) // expression
10658 )
10659 {
10660 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
10661 _res = a;
10662 if (_res == NULL && PyErr_Occurred()) {
10663 p->error_indicator = 1;
10664 D(p->level--);
10665 return NULL;
10666 }
10667 goto done;
10668 }
10669 p->mark = _mark;
10670 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10671 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
10672 }
10673 _res = NULL;
10674 done:
10675 D(p->level--);
10676 return _res;
10677}
10678
10679// atom:
10680// | NAME
10681// | 'True'
10682// | 'False'
10683// | 'None'
10684// | &STRING strings
10685// | NUMBER
10686// | &'(' (tuple | group | genexp)
10687// | &'[' (list | listcomp)
10688// | &'{' (dict | set | dictcomp | setcomp)
10689// | '...'
10690static expr_ty
10691atom_rule(Parser *p)
10692{
10693 D(p->level++);
10694 if (p->error_indicator) {
10695 D(p->level--);
10696 return NULL;
10697 }
10698 expr_ty _res = NULL;
10699 int _mark = p->mark;
10700 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10701 p->error_indicator = 1;
10702 D(p->level--);
10703 return NULL;
10704 }
10705 int _start_lineno = p->tokens[_mark]->lineno;
10706 UNUSED(_start_lineno); // Only used by EXTRA macro
10707 int _start_col_offset = p->tokens[_mark]->col_offset;
10708 UNUSED(_start_col_offset); // Only used by EXTRA macro
10709 { // NAME
10710 if (p->error_indicator) {
10711 D(p->level--);
10712 return NULL;
10713 }
10714 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
10715 expr_ty name_var;
10716 if (
10717 (name_var = _PyPegen_name_token(p)) // NAME
10718 )
10719 {
10720 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
10721 _res = name_var;
10722 goto done;
10723 }
10724 p->mark = _mark;
10725 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10726 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
10727 }
10728 { // 'True'
10729 if (p->error_indicator) {
10730 D(p->level--);
10731 return NULL;
10732 }
10733 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
10734 Token * _keyword;
10735 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010736 (_keyword = _PyPegen_expect_token(p, 528)) // token='True'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010737 )
10738 {
10739 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
10740 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10741 if (_token == NULL) {
10742 D(p->level--);
10743 return NULL;
10744 }
10745 int _end_lineno = _token->end_lineno;
10746 UNUSED(_end_lineno); // Only used by EXTRA macro
10747 int _end_col_offset = _token->end_col_offset;
10748 UNUSED(_end_col_offset); // Only used by EXTRA macro
10749 _res = _Py_Constant ( Py_True , NULL , EXTRA );
10750 if (_res == NULL && PyErr_Occurred()) {
10751 p->error_indicator = 1;
10752 D(p->level--);
10753 return NULL;
10754 }
10755 goto done;
10756 }
10757 p->mark = _mark;
10758 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10759 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
10760 }
10761 { // 'False'
10762 if (p->error_indicator) {
10763 D(p->level--);
10764 return NULL;
10765 }
10766 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
10767 Token * _keyword;
10768 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010769 (_keyword = _PyPegen_expect_token(p, 529)) // token='False'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010770 )
10771 {
10772 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
10773 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10774 if (_token == NULL) {
10775 D(p->level--);
10776 return NULL;
10777 }
10778 int _end_lineno = _token->end_lineno;
10779 UNUSED(_end_lineno); // Only used by EXTRA macro
10780 int _end_col_offset = _token->end_col_offset;
10781 UNUSED(_end_col_offset); // Only used by EXTRA macro
10782 _res = _Py_Constant ( Py_False , NULL , EXTRA );
10783 if (_res == NULL && PyErr_Occurred()) {
10784 p->error_indicator = 1;
10785 D(p->level--);
10786 return NULL;
10787 }
10788 goto done;
10789 }
10790 p->mark = _mark;
10791 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10792 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
10793 }
10794 { // 'None'
10795 if (p->error_indicator) {
10796 D(p->level--);
10797 return NULL;
10798 }
10799 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
10800 Token * _keyword;
10801 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010802 (_keyword = _PyPegen_expect_token(p, 530)) // token='None'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010803 )
10804 {
10805 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
10806 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10807 if (_token == NULL) {
10808 D(p->level--);
10809 return NULL;
10810 }
10811 int _end_lineno = _token->end_lineno;
10812 UNUSED(_end_lineno); // Only used by EXTRA macro
10813 int _end_col_offset = _token->end_col_offset;
10814 UNUSED(_end_col_offset); // Only used by EXTRA macro
10815 _res = _Py_Constant ( Py_None , NULL , EXTRA );
10816 if (_res == NULL && PyErr_Occurred()) {
10817 p->error_indicator = 1;
10818 D(p->level--);
10819 return NULL;
10820 }
10821 goto done;
10822 }
10823 p->mark = _mark;
10824 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10825 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
10826 }
10827 { // &STRING strings
10828 if (p->error_indicator) {
10829 D(p->level--);
10830 return NULL;
10831 }
10832 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10833 expr_ty strings_var;
10834 if (
10835 _PyPegen_lookahead(1, _PyPegen_string_token, p)
10836 &&
10837 (strings_var = strings_rule(p)) // strings
10838 )
10839 {
10840 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10841 _res = strings_var;
10842 goto done;
10843 }
10844 p->mark = _mark;
10845 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10846 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings"));
10847 }
10848 { // NUMBER
10849 if (p->error_indicator) {
10850 D(p->level--);
10851 return NULL;
10852 }
10853 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10854 expr_ty number_var;
10855 if (
10856 (number_var = _PyPegen_number_token(p)) // NUMBER
10857 )
10858 {
10859 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10860 _res = number_var;
10861 goto done;
10862 }
10863 p->mark = _mark;
10864 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10865 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
10866 }
10867 { // &'(' (tuple | group | genexp)
10868 if (p->error_indicator) {
10869 D(p->level--);
10870 return NULL;
10871 }
10872 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010873 void *_tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010874 if (
10875 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='('
10876 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010877 (_tmp_97_var = _tmp_97_rule(p)) // tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010878 )
10879 {
10880 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 +030010881 _res = _tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010882 goto done;
10883 }
10884 p->mark = _mark;
10885 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10886 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
10887 }
10888 { // &'[' (list | listcomp)
10889 if (p->error_indicator) {
10890 D(p->level--);
10891 return NULL;
10892 }
10893 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010894 void *_tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010895 if (
10896 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='['
10897 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010898 (_tmp_98_var = _tmp_98_rule(p)) // list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010899 )
10900 {
10901 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010902 _res = _tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010903 goto done;
10904 }
10905 p->mark = _mark;
10906 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10907 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
10908 }
10909 { // &'{' (dict | set | dictcomp | setcomp)
10910 if (p->error_indicator) {
10911 D(p->level--);
10912 return NULL;
10913 }
10914 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 +030010915 void *_tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010916 if (
10917 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{'
10918 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010919 (_tmp_99_var = _tmp_99_rule(p)) // dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010920 )
10921 {
10922 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 +030010923 _res = _tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010924 goto done;
10925 }
10926 p->mark = _mark;
10927 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10928 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
10929 }
10930 { // '...'
10931 if (p->error_indicator) {
10932 D(p->level--);
10933 return NULL;
10934 }
10935 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
10936 Token * _literal;
10937 if (
10938 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
10939 )
10940 {
10941 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
10942 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10943 if (_token == NULL) {
10944 D(p->level--);
10945 return NULL;
10946 }
10947 int _end_lineno = _token->end_lineno;
10948 UNUSED(_end_lineno); // Only used by EXTRA macro
10949 int _end_col_offset = _token->end_col_offset;
10950 UNUSED(_end_col_offset); // Only used by EXTRA macro
10951 _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
10952 if (_res == NULL && PyErr_Occurred()) {
10953 p->error_indicator = 1;
10954 D(p->level--);
10955 return NULL;
10956 }
10957 goto done;
10958 }
10959 p->mark = _mark;
10960 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10961 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
10962 }
10963 _res = NULL;
10964 done:
10965 D(p->level--);
10966 return _res;
10967}
10968
10969// strings: STRING+
10970static expr_ty
10971strings_rule(Parser *p)
10972{
10973 D(p->level++);
10974 if (p->error_indicator) {
10975 D(p->level--);
10976 return NULL;
10977 }
10978 expr_ty _res = NULL;
10979 if (_PyPegen_is_memoized(p, strings_type, &_res)) {
10980 D(p->level--);
10981 return _res;
10982 }
10983 int _mark = p->mark;
10984 { // STRING+
10985 if (p->error_indicator) {
10986 D(p->level--);
10987 return NULL;
10988 }
10989 D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
10990 asdl_seq * a;
10991 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010992 (a = _loop1_100_rule(p)) // STRING+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010993 )
10994 {
10995 D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
10996 _res = _PyPegen_concatenate_strings ( p , a );
10997 if (_res == NULL && PyErr_Occurred()) {
10998 p->error_indicator = 1;
10999 D(p->level--);
11000 return NULL;
11001 }
11002 goto done;
11003 }
11004 p->mark = _mark;
11005 D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
11006 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
11007 }
11008 _res = NULL;
11009 done:
11010 _PyPegen_insert_memo(p, _mark, strings_type, _res);
11011 D(p->level--);
11012 return _res;
11013}
11014
11015// list: '[' star_named_expressions? ']'
11016static expr_ty
11017list_rule(Parser *p)
11018{
11019 D(p->level++);
11020 if (p->error_indicator) {
11021 D(p->level--);
11022 return NULL;
11023 }
11024 expr_ty _res = NULL;
11025 int _mark = p->mark;
11026 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11027 p->error_indicator = 1;
11028 D(p->level--);
11029 return NULL;
11030 }
11031 int _start_lineno = p->tokens[_mark]->lineno;
11032 UNUSED(_start_lineno); // Only used by EXTRA macro
11033 int _start_col_offset = p->tokens[_mark]->col_offset;
11034 UNUSED(_start_col_offset); // Only used by EXTRA macro
11035 { // '[' star_named_expressions? ']'
11036 if (p->error_indicator) {
11037 D(p->level--);
11038 return NULL;
11039 }
11040 D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11041 Token * _literal;
11042 Token * _literal_1;
11043 void *a;
11044 if (
11045 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11046 &&
11047 (a = star_named_expressions_rule(p), 1) // star_named_expressions?
11048 &&
11049 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11050 )
11051 {
11052 D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11053 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11054 if (_token == NULL) {
11055 D(p->level--);
11056 return NULL;
11057 }
11058 int _end_lineno = _token->end_lineno;
11059 UNUSED(_end_lineno); // Only used by EXTRA macro
11060 int _end_col_offset = _token->end_col_offset;
11061 UNUSED(_end_col_offset); // Only used by EXTRA macro
11062 _res = _Py_List ( a , Load , EXTRA );
11063 if (_res == NULL && PyErr_Occurred()) {
11064 p->error_indicator = 1;
11065 D(p->level--);
11066 return NULL;
11067 }
11068 goto done;
11069 }
11070 p->mark = _mark;
11071 D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
11072 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
11073 }
11074 _res = NULL;
11075 done:
11076 D(p->level--);
11077 return _res;
11078}
11079
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011080// listcomp: '[' named_expression ~ for_if_clauses ']' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011081static expr_ty
11082listcomp_rule(Parser *p)
11083{
11084 D(p->level++);
11085 if (p->error_indicator) {
11086 D(p->level--);
11087 return NULL;
11088 }
11089 expr_ty _res = NULL;
11090 int _mark = p->mark;
11091 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11092 p->error_indicator = 1;
11093 D(p->level--);
11094 return NULL;
11095 }
11096 int _start_lineno = p->tokens[_mark]->lineno;
11097 UNUSED(_start_lineno); // Only used by EXTRA macro
11098 int _start_col_offset = p->tokens[_mark]->col_offset;
11099 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011100 { // '[' named_expression ~ for_if_clauses ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011101 if (p->error_indicator) {
11102 D(p->level--);
11103 return NULL;
11104 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011105 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11106 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011107 Token * _literal;
11108 Token * _literal_1;
11109 expr_ty a;
11110 asdl_seq* b;
11111 if (
11112 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11113 &&
11114 (a = named_expression_rule(p)) // named_expression
11115 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011116 (_cut_var = 1)
11117 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011118 (b = for_if_clauses_rule(p)) // for_if_clauses
11119 &&
11120 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11121 )
11122 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011123 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 +010011124 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11125 if (_token == NULL) {
11126 D(p->level--);
11127 return NULL;
11128 }
11129 int _end_lineno = _token->end_lineno;
11130 UNUSED(_end_lineno); // Only used by EXTRA macro
11131 int _end_col_offset = _token->end_col_offset;
11132 UNUSED(_end_col_offset); // Only used by EXTRA macro
11133 _res = _Py_ListComp ( a , b , EXTRA );
11134 if (_res == NULL && PyErr_Occurred()) {
11135 p->error_indicator = 1;
11136 D(p->level--);
11137 return NULL;
11138 }
11139 goto done;
11140 }
11141 p->mark = _mark;
11142 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011143 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11144 if (_cut_var) {
11145 D(p->level--);
11146 return NULL;
11147 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011148 }
11149 { // invalid_comprehension
11150 if (p->error_indicator) {
11151 D(p->level--);
11152 return NULL;
11153 }
11154 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11155 void *invalid_comprehension_var;
11156 if (
11157 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11158 )
11159 {
11160 D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11161 _res = invalid_comprehension_var;
11162 goto done;
11163 }
11164 p->mark = _mark;
11165 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
11166 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11167 }
11168 _res = NULL;
11169 done:
11170 D(p->level--);
11171 return _res;
11172}
11173
11174// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
11175static expr_ty
11176tuple_rule(Parser *p)
11177{
11178 D(p->level++);
11179 if (p->error_indicator) {
11180 D(p->level--);
11181 return NULL;
11182 }
11183 expr_ty _res = NULL;
11184 int _mark = p->mark;
11185 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11186 p->error_indicator = 1;
11187 D(p->level--);
11188 return NULL;
11189 }
11190 int _start_lineno = p->tokens[_mark]->lineno;
11191 UNUSED(_start_lineno); // Only used by EXTRA macro
11192 int _start_col_offset = p->tokens[_mark]->col_offset;
11193 UNUSED(_start_col_offset); // Only used by EXTRA macro
11194 { // '(' [star_named_expression ',' star_named_expressions?] ')'
11195 if (p->error_indicator) {
11196 D(p->level--);
11197 return NULL;
11198 }
11199 D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11200 Token * _literal;
11201 Token * _literal_1;
11202 void *a;
11203 if (
11204 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11205 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011206 (a = _tmp_101_rule(p), 1) // [star_named_expression ',' star_named_expressions?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011207 &&
11208 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11209 )
11210 {
11211 D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11212 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11213 if (_token == NULL) {
11214 D(p->level--);
11215 return NULL;
11216 }
11217 int _end_lineno = _token->end_lineno;
11218 UNUSED(_end_lineno); // Only used by EXTRA macro
11219 int _end_col_offset = _token->end_col_offset;
11220 UNUSED(_end_col_offset); // Only used by EXTRA macro
11221 _res = _Py_Tuple ( a , Load , EXTRA );
11222 if (_res == NULL && PyErr_Occurred()) {
11223 p->error_indicator = 1;
11224 D(p->level--);
11225 return NULL;
11226 }
11227 goto done;
11228 }
11229 p->mark = _mark;
11230 D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
11231 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11232 }
11233 _res = NULL;
11234 done:
11235 D(p->level--);
11236 return _res;
11237}
11238
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011239// group: '(' (yield_expr | named_expression) ')' | invalid_group
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011240static expr_ty
11241group_rule(Parser *p)
11242{
11243 D(p->level++);
11244 if (p->error_indicator) {
11245 D(p->level--);
11246 return NULL;
11247 }
11248 expr_ty _res = NULL;
11249 int _mark = p->mark;
11250 { // '(' (yield_expr | named_expression) ')'
11251 if (p->error_indicator) {
11252 D(p->level--);
11253 return NULL;
11254 }
11255 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11256 Token * _literal;
11257 Token * _literal_1;
11258 void *a;
11259 if (
11260 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11261 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011262 (a = _tmp_102_rule(p)) // yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011263 &&
11264 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11265 )
11266 {
11267 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11268 _res = a;
11269 if (_res == NULL && PyErr_Occurred()) {
11270 p->error_indicator = 1;
11271 D(p->level--);
11272 return NULL;
11273 }
11274 goto done;
11275 }
11276 p->mark = _mark;
11277 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11278 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11279 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011280 { // invalid_group
11281 if (p->error_indicator) {
11282 D(p->level--);
11283 return NULL;
11284 }
11285 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11286 void *invalid_group_var;
11287 if (
11288 (invalid_group_var = invalid_group_rule(p)) // invalid_group
11289 )
11290 {
11291 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11292 _res = invalid_group_var;
11293 goto done;
11294 }
11295 p->mark = _mark;
11296 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11297 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
11298 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011299 _res = NULL;
11300 done:
11301 D(p->level--);
11302 return _res;
11303}
11304
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011305// genexp: '(' expression ~ for_if_clauses ')' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011306static expr_ty
11307genexp_rule(Parser *p)
11308{
11309 D(p->level++);
11310 if (p->error_indicator) {
11311 D(p->level--);
11312 return NULL;
11313 }
11314 expr_ty _res = NULL;
11315 int _mark = p->mark;
11316 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11317 p->error_indicator = 1;
11318 D(p->level--);
11319 return NULL;
11320 }
11321 int _start_lineno = p->tokens[_mark]->lineno;
11322 UNUSED(_start_lineno); // Only used by EXTRA macro
11323 int _start_col_offset = p->tokens[_mark]->col_offset;
11324 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011325 { // '(' expression ~ for_if_clauses ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011326 if (p->error_indicator) {
11327 D(p->level--);
11328 return NULL;
11329 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011330 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11331 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011332 Token * _literal;
11333 Token * _literal_1;
11334 expr_ty a;
11335 asdl_seq* b;
11336 if (
11337 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11338 &&
11339 (a = expression_rule(p)) // expression
11340 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011341 (_cut_var = 1)
11342 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011343 (b = for_if_clauses_rule(p)) // for_if_clauses
11344 &&
11345 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11346 )
11347 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011348 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 +010011349 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11350 if (_token == NULL) {
11351 D(p->level--);
11352 return NULL;
11353 }
11354 int _end_lineno = _token->end_lineno;
11355 UNUSED(_end_lineno); // Only used by EXTRA macro
11356 int _end_col_offset = _token->end_col_offset;
11357 UNUSED(_end_col_offset); // Only used by EXTRA macro
11358 _res = _Py_GeneratorExp ( a , b , EXTRA );
11359 if (_res == NULL && PyErr_Occurred()) {
11360 p->error_indicator = 1;
11361 D(p->level--);
11362 return NULL;
11363 }
11364 goto done;
11365 }
11366 p->mark = _mark;
11367 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011368 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11369 if (_cut_var) {
11370 D(p->level--);
11371 return NULL;
11372 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011373 }
11374 { // invalid_comprehension
11375 if (p->error_indicator) {
11376 D(p->level--);
11377 return NULL;
11378 }
11379 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11380 void *invalid_comprehension_var;
11381 if (
11382 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11383 )
11384 {
11385 D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11386 _res = invalid_comprehension_var;
11387 goto done;
11388 }
11389 p->mark = _mark;
11390 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
11391 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11392 }
11393 _res = NULL;
11394 done:
11395 D(p->level--);
11396 return _res;
11397}
11398
11399// set: '{' expressions_list '}'
11400static expr_ty
11401set_rule(Parser *p)
11402{
11403 D(p->level++);
11404 if (p->error_indicator) {
11405 D(p->level--);
11406 return NULL;
11407 }
11408 expr_ty _res = NULL;
11409 int _mark = p->mark;
11410 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11411 p->error_indicator = 1;
11412 D(p->level--);
11413 return NULL;
11414 }
11415 int _start_lineno = p->tokens[_mark]->lineno;
11416 UNUSED(_start_lineno); // Only used by EXTRA macro
11417 int _start_col_offset = p->tokens[_mark]->col_offset;
11418 UNUSED(_start_col_offset); // Only used by EXTRA macro
11419 { // '{' expressions_list '}'
11420 if (p->error_indicator) {
11421 D(p->level--);
11422 return NULL;
11423 }
11424 D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11425 Token * _literal;
11426 Token * _literal_1;
11427 asdl_seq* a;
11428 if (
11429 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11430 &&
11431 (a = expressions_list_rule(p)) // expressions_list
11432 &&
11433 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11434 )
11435 {
11436 D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11437 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11438 if (_token == NULL) {
11439 D(p->level--);
11440 return NULL;
11441 }
11442 int _end_lineno = _token->end_lineno;
11443 UNUSED(_end_lineno); // Only used by EXTRA macro
11444 int _end_col_offset = _token->end_col_offset;
11445 UNUSED(_end_col_offset); // Only used by EXTRA macro
11446 _res = _Py_Set ( a , EXTRA );
11447 if (_res == NULL && PyErr_Occurred()) {
11448 p->error_indicator = 1;
11449 D(p->level--);
11450 return NULL;
11451 }
11452 goto done;
11453 }
11454 p->mark = _mark;
11455 D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
11456 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'"));
11457 }
11458 _res = NULL;
11459 done:
11460 D(p->level--);
11461 return _res;
11462}
11463
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011464// setcomp: '{' expression ~ for_if_clauses '}' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011465static expr_ty
11466setcomp_rule(Parser *p)
11467{
11468 D(p->level++);
11469 if (p->error_indicator) {
11470 D(p->level--);
11471 return NULL;
11472 }
11473 expr_ty _res = NULL;
11474 int _mark = p->mark;
11475 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11476 p->error_indicator = 1;
11477 D(p->level--);
11478 return NULL;
11479 }
11480 int _start_lineno = p->tokens[_mark]->lineno;
11481 UNUSED(_start_lineno); // Only used by EXTRA macro
11482 int _start_col_offset = p->tokens[_mark]->col_offset;
11483 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011484 { // '{' expression ~ for_if_clauses '}'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011485 if (p->error_indicator) {
11486 D(p->level--);
11487 return NULL;
11488 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011489 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11490 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011491 Token * _literal;
11492 Token * _literal_1;
11493 expr_ty a;
11494 asdl_seq* b;
11495 if (
11496 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11497 &&
11498 (a = expression_rule(p)) // expression
11499 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011500 (_cut_var = 1)
11501 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011502 (b = for_if_clauses_rule(p)) // for_if_clauses
11503 &&
11504 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11505 )
11506 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011507 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 +010011508 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11509 if (_token == NULL) {
11510 D(p->level--);
11511 return NULL;
11512 }
11513 int _end_lineno = _token->end_lineno;
11514 UNUSED(_end_lineno); // Only used by EXTRA macro
11515 int _end_col_offset = _token->end_col_offset;
11516 UNUSED(_end_col_offset); // Only used by EXTRA macro
11517 _res = _Py_SetComp ( a , b , EXTRA );
11518 if (_res == NULL && PyErr_Occurred()) {
11519 p->error_indicator = 1;
11520 D(p->level--);
11521 return NULL;
11522 }
11523 goto done;
11524 }
11525 p->mark = _mark;
11526 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011527 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11528 if (_cut_var) {
11529 D(p->level--);
11530 return NULL;
11531 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011532 }
11533 { // invalid_comprehension
11534 if (p->error_indicator) {
11535 D(p->level--);
11536 return NULL;
11537 }
11538 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11539 void *invalid_comprehension_var;
11540 if (
11541 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11542 )
11543 {
11544 D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11545 _res = invalid_comprehension_var;
11546 goto done;
11547 }
11548 p->mark = _mark;
11549 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
11550 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11551 }
11552 _res = NULL;
11553 done:
11554 D(p->level--);
11555 return _res;
11556}
11557
11558// dict: '{' double_starred_kvpairs? '}'
11559static expr_ty
11560dict_rule(Parser *p)
11561{
11562 D(p->level++);
11563 if (p->error_indicator) {
11564 D(p->level--);
11565 return NULL;
11566 }
11567 expr_ty _res = NULL;
11568 int _mark = p->mark;
11569 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11570 p->error_indicator = 1;
11571 D(p->level--);
11572 return NULL;
11573 }
11574 int _start_lineno = p->tokens[_mark]->lineno;
11575 UNUSED(_start_lineno); // Only used by EXTRA macro
11576 int _start_col_offset = p->tokens[_mark]->col_offset;
11577 UNUSED(_start_col_offset); // Only used by EXTRA macro
11578 { // '{' double_starred_kvpairs? '}'
11579 if (p->error_indicator) {
11580 D(p->level--);
11581 return NULL;
11582 }
11583 D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11584 Token * _literal;
11585 Token * _literal_1;
11586 void *a;
11587 if (
11588 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11589 &&
11590 (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs?
11591 &&
11592 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11593 )
11594 {
11595 D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11596 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11597 if (_token == NULL) {
11598 D(p->level--);
11599 return NULL;
11600 }
11601 int _end_lineno = _token->end_lineno;
11602 UNUSED(_end_lineno); // Only used by EXTRA macro
11603 int _end_col_offset = _token->end_col_offset;
11604 UNUSED(_end_col_offset); // Only used by EXTRA macro
11605 _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA );
11606 if (_res == NULL && PyErr_Occurred()) {
11607 p->error_indicator = 1;
11608 D(p->level--);
11609 return NULL;
11610 }
11611 goto done;
11612 }
11613 p->mark = _mark;
11614 D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
11615 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11616 }
11617 _res = NULL;
11618 done:
11619 D(p->level--);
11620 return _res;
11621}
11622
11623// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
11624static expr_ty
11625dictcomp_rule(Parser *p)
11626{
11627 D(p->level++);
11628 if (p->error_indicator) {
11629 D(p->level--);
11630 return NULL;
11631 }
11632 expr_ty _res = NULL;
11633 int _mark = p->mark;
11634 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11635 p->error_indicator = 1;
11636 D(p->level--);
11637 return NULL;
11638 }
11639 int _start_lineno = p->tokens[_mark]->lineno;
11640 UNUSED(_start_lineno); // Only used by EXTRA macro
11641 int _start_col_offset = p->tokens[_mark]->col_offset;
11642 UNUSED(_start_col_offset); // Only used by EXTRA macro
11643 { // '{' kvpair for_if_clauses '}'
11644 if (p->error_indicator) {
11645 D(p->level--);
11646 return NULL;
11647 }
11648 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11649 Token * _literal;
11650 Token * _literal_1;
11651 KeyValuePair* a;
11652 asdl_seq* b;
11653 if (
11654 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11655 &&
11656 (a = kvpair_rule(p)) // kvpair
11657 &&
11658 (b = for_if_clauses_rule(p)) // for_if_clauses
11659 &&
11660 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11661 )
11662 {
11663 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11664 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11665 if (_token == NULL) {
11666 D(p->level--);
11667 return NULL;
11668 }
11669 int _end_lineno = _token->end_lineno;
11670 UNUSED(_end_lineno); // Only used by EXTRA macro
11671 int _end_col_offset = _token->end_col_offset;
11672 UNUSED(_end_col_offset); // Only used by EXTRA macro
11673 _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
11674 if (_res == NULL && PyErr_Occurred()) {
11675 p->error_indicator = 1;
11676 D(p->level--);
11677 return NULL;
11678 }
11679 goto done;
11680 }
11681 p->mark = _mark;
11682 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11683 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11684 }
11685 { // invalid_dict_comprehension
11686 if (p->error_indicator) {
11687 D(p->level--);
11688 return NULL;
11689 }
11690 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11691 void *invalid_dict_comprehension_var;
11692 if (
11693 (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
11694 )
11695 {
11696 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11697 _res = invalid_dict_comprehension_var;
11698 goto done;
11699 }
11700 p->mark = _mark;
11701 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11702 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
11703 }
11704 _res = NULL;
11705 done:
11706 D(p->level--);
11707 return _res;
11708}
11709
11710// double_starred_kvpairs: ','.double_starred_kvpair+ ','?
11711static asdl_seq*
11712double_starred_kvpairs_rule(Parser *p)
11713{
11714 D(p->level++);
11715 if (p->error_indicator) {
11716 D(p->level--);
11717 return NULL;
11718 }
11719 asdl_seq* _res = NULL;
11720 int _mark = p->mark;
11721 { // ','.double_starred_kvpair+ ','?
11722 if (p->error_indicator) {
11723 D(p->level--);
11724 return NULL;
11725 }
11726 D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11727 void *_opt_var;
11728 UNUSED(_opt_var); // Silence compiler warnings
11729 asdl_seq * a;
11730 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011731 (a = _gather_103_rule(p)) // ','.double_starred_kvpair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011732 &&
11733 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
11734 )
11735 {
11736 D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11737 _res = a;
11738 if (_res == NULL && PyErr_Occurred()) {
11739 p->error_indicator = 1;
11740 D(p->level--);
11741 return NULL;
11742 }
11743 goto done;
11744 }
11745 p->mark = _mark;
11746 D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
11747 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11748 }
11749 _res = NULL;
11750 done:
11751 D(p->level--);
11752 return _res;
11753}
11754
11755// double_starred_kvpair: '**' bitwise_or | kvpair
11756static KeyValuePair*
11757double_starred_kvpair_rule(Parser *p)
11758{
11759 D(p->level++);
11760 if (p->error_indicator) {
11761 D(p->level--);
11762 return NULL;
11763 }
11764 KeyValuePair* _res = NULL;
11765 int _mark = p->mark;
11766 { // '**' bitwise_or
11767 if (p->error_indicator) {
11768 D(p->level--);
11769 return NULL;
11770 }
11771 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11772 Token * _literal;
11773 expr_ty a;
11774 if (
11775 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
11776 &&
11777 (a = bitwise_or_rule(p)) // bitwise_or
11778 )
11779 {
11780 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11781 _res = _PyPegen_key_value_pair ( p , NULL , a );
11782 if (_res == NULL && PyErr_Occurred()) {
11783 p->error_indicator = 1;
11784 D(p->level--);
11785 return NULL;
11786 }
11787 goto done;
11788 }
11789 p->mark = _mark;
11790 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11791 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
11792 }
11793 { // kvpair
11794 if (p->error_indicator) {
11795 D(p->level--);
11796 return NULL;
11797 }
11798 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
11799 KeyValuePair* kvpair_var;
11800 if (
11801 (kvpair_var = kvpair_rule(p)) // kvpair
11802 )
11803 {
11804 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
11805 _res = kvpair_var;
11806 goto done;
11807 }
11808 p->mark = _mark;
11809 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11810 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
11811 }
11812 _res = NULL;
11813 done:
11814 D(p->level--);
11815 return _res;
11816}
11817
11818// kvpair: expression ':' expression
11819static KeyValuePair*
11820kvpair_rule(Parser *p)
11821{
11822 D(p->level++);
11823 if (p->error_indicator) {
11824 D(p->level--);
11825 return NULL;
11826 }
11827 KeyValuePair* _res = NULL;
11828 int _mark = p->mark;
11829 { // expression ':' expression
11830 if (p->error_indicator) {
11831 D(p->level--);
11832 return NULL;
11833 }
11834 D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11835 Token * _literal;
11836 expr_ty a;
11837 expr_ty b;
11838 if (
11839 (a = expression_rule(p)) // expression
11840 &&
11841 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
11842 &&
11843 (b = expression_rule(p)) // expression
11844 )
11845 {
11846 D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11847 _res = _PyPegen_key_value_pair ( p , a , b );
11848 if (_res == NULL && PyErr_Occurred()) {
11849 p->error_indicator = 1;
11850 D(p->level--);
11851 return NULL;
11852 }
11853 goto done;
11854 }
11855 p->mark = _mark;
11856 D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11857 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
11858 }
11859 _res = NULL;
11860 done:
11861 D(p->level--);
11862 return _res;
11863}
11864
11865// for_if_clauses: for_if_clause+
11866static asdl_seq*
11867for_if_clauses_rule(Parser *p)
11868{
11869 D(p->level++);
11870 if (p->error_indicator) {
11871 D(p->level--);
11872 return NULL;
11873 }
11874 asdl_seq* _res = NULL;
11875 int _mark = p->mark;
11876 { // for_if_clause+
11877 if (p->error_indicator) {
11878 D(p->level--);
11879 return NULL;
11880 }
11881 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 +030011882 asdl_seq * _loop1_105_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011883 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011884 (_loop1_105_var = _loop1_105_rule(p)) // for_if_clause+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011885 )
11886 {
11887 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 +030011888 _res = _loop1_105_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011889 goto done;
11890 }
11891 p->mark = _mark;
11892 D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
11893 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
11894 }
11895 _res = NULL;
11896 done:
11897 D(p->level--);
11898 return _res;
11899}
11900
11901// for_if_clause:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011902// | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11903// | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11904// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011905static comprehension_ty
11906for_if_clause_rule(Parser *p)
11907{
11908 D(p->level++);
11909 if (p->error_indicator) {
11910 D(p->level--);
11911 return NULL;
11912 }
11913 comprehension_ty _res = NULL;
11914 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011915 { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011916 if (p->error_indicator) {
11917 D(p->level--);
11918 return NULL;
11919 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011920 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11921 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011922 Token * _keyword;
11923 Token * _keyword_1;
11924 expr_ty a;
11925 Token * async_var;
11926 expr_ty b;
11927 asdl_seq * c;
11928 if (
11929 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
11930 &&
11931 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11932 &&
11933 (a = star_targets_rule(p)) // star_targets
11934 &&
11935 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11936 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011937 (_cut_var = 1)
11938 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011939 (b = disjunction_rule(p)) // disjunction
11940 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011941 (c = _loop0_106_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011942 )
11943 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011944 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 +010011945 _res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) );
11946 if (_res == NULL && PyErr_Occurred()) {
11947 p->error_indicator = 1;
11948 D(p->level--);
11949 return NULL;
11950 }
11951 goto done;
11952 }
11953 p->mark = _mark;
11954 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011955 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11956 if (_cut_var) {
11957 D(p->level--);
11958 return NULL;
11959 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011960 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011961 { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011962 if (p->error_indicator) {
11963 D(p->level--);
11964 return NULL;
11965 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011966 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11967 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011968 Token * _keyword;
11969 Token * _keyword_1;
11970 expr_ty a;
11971 expr_ty b;
11972 asdl_seq * c;
11973 if (
11974 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11975 &&
11976 (a = star_targets_rule(p)) // star_targets
11977 &&
11978 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11979 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011980 (_cut_var = 1)
11981 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011982 (b = disjunction_rule(p)) // disjunction
11983 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011984 (c = _loop0_107_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011985 )
11986 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011987 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 +010011988 _res = _Py_comprehension ( a , b , c , 0 , p -> arena );
11989 if (_res == NULL && PyErr_Occurred()) {
11990 p->error_indicator = 1;
11991 D(p->level--);
11992 return NULL;
11993 }
11994 goto done;
11995 }
11996 p->mark = _mark;
11997 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011998 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11999 if (_cut_var) {
12000 D(p->level--);
12001 return NULL;
12002 }
12003 }
12004 { // invalid_for_target
12005 if (p->error_indicator) {
12006 D(p->level--);
12007 return NULL;
12008 }
12009 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12010 void *invalid_for_target_var;
12011 if (
12012 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
12013 )
12014 {
12015 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12016 _res = invalid_for_target_var;
12017 goto done;
12018 }
12019 p->mark = _mark;
12020 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
12021 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012022 }
12023 _res = NULL;
12024 done:
12025 D(p->level--);
12026 return _res;
12027}
12028
12029// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
12030static expr_ty
12031yield_expr_rule(Parser *p)
12032{
12033 D(p->level++);
12034 if (p->error_indicator) {
12035 D(p->level--);
12036 return NULL;
12037 }
12038 expr_ty _res = NULL;
12039 int _mark = p->mark;
12040 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12041 p->error_indicator = 1;
12042 D(p->level--);
12043 return NULL;
12044 }
12045 int _start_lineno = p->tokens[_mark]->lineno;
12046 UNUSED(_start_lineno); // Only used by EXTRA macro
12047 int _start_col_offset = p->tokens[_mark]->col_offset;
12048 UNUSED(_start_col_offset); // Only used by EXTRA macro
12049 { // 'yield' 'from' expression
12050 if (p->error_indicator) {
12051 D(p->level--);
12052 return NULL;
12053 }
12054 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12055 Token * _keyword;
12056 Token * _keyword_1;
12057 expr_ty a;
12058 if (
12059 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12060 &&
12061 (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from'
12062 &&
12063 (a = expression_rule(p)) // expression
12064 )
12065 {
12066 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12067 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12068 if (_token == NULL) {
12069 D(p->level--);
12070 return NULL;
12071 }
12072 int _end_lineno = _token->end_lineno;
12073 UNUSED(_end_lineno); // Only used by EXTRA macro
12074 int _end_col_offset = _token->end_col_offset;
12075 UNUSED(_end_col_offset); // Only used by EXTRA macro
12076 _res = _Py_YieldFrom ( a , EXTRA );
12077 if (_res == NULL && PyErr_Occurred()) {
12078 p->error_indicator = 1;
12079 D(p->level--);
12080 return NULL;
12081 }
12082 goto done;
12083 }
12084 p->mark = _mark;
12085 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12086 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
12087 }
12088 { // 'yield' star_expressions?
12089 if (p->error_indicator) {
12090 D(p->level--);
12091 return NULL;
12092 }
12093 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12094 Token * _keyword;
12095 void *a;
12096 if (
12097 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12098 &&
12099 (a = star_expressions_rule(p), 1) // star_expressions?
12100 )
12101 {
12102 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12103 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12104 if (_token == NULL) {
12105 D(p->level--);
12106 return NULL;
12107 }
12108 int _end_lineno = _token->end_lineno;
12109 UNUSED(_end_lineno); // Only used by EXTRA macro
12110 int _end_col_offset = _token->end_col_offset;
12111 UNUSED(_end_col_offset); // Only used by EXTRA macro
12112 _res = _Py_Yield ( a , EXTRA );
12113 if (_res == NULL && PyErr_Occurred()) {
12114 p->error_indicator = 1;
12115 D(p->level--);
12116 return NULL;
12117 }
12118 goto done;
12119 }
12120 p->mark = _mark;
12121 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12122 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
12123 }
12124 _res = NULL;
12125 done:
12126 D(p->level--);
12127 return _res;
12128}
12129
12130// arguments: args ','? &')' | incorrect_arguments
12131static expr_ty
12132arguments_rule(Parser *p)
12133{
12134 D(p->level++);
12135 if (p->error_indicator) {
12136 D(p->level--);
12137 return NULL;
12138 }
12139 expr_ty _res = NULL;
12140 if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
12141 D(p->level--);
12142 return _res;
12143 }
12144 int _mark = p->mark;
12145 { // args ','? &')'
12146 if (p->error_indicator) {
12147 D(p->level--);
12148 return NULL;
12149 }
12150 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12151 void *_opt_var;
12152 UNUSED(_opt_var); // Silence compiler warnings
12153 expr_ty a;
12154 if (
12155 (a = args_rule(p)) // args
12156 &&
12157 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12158 &&
12159 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
12160 )
12161 {
12162 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12163 _res = a;
12164 if (_res == NULL && PyErr_Occurred()) {
12165 p->error_indicator = 1;
12166 D(p->level--);
12167 return NULL;
12168 }
12169 goto done;
12170 }
12171 p->mark = _mark;
12172 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12173 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
12174 }
12175 { // incorrect_arguments
12176 if (p->error_indicator) {
12177 D(p->level--);
12178 return NULL;
12179 }
12180 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "incorrect_arguments"));
12181 void *incorrect_arguments_var;
12182 if (
12183 (incorrect_arguments_var = incorrect_arguments_rule(p)) // incorrect_arguments
12184 )
12185 {
12186 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "incorrect_arguments"));
12187 _res = incorrect_arguments_var;
12188 goto done;
12189 }
12190 p->mark = _mark;
12191 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12192 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "incorrect_arguments"));
12193 }
12194 _res = NULL;
12195 done:
12196 _PyPegen_insert_memo(p, _mark, arguments_type, _res);
12197 D(p->level--);
12198 return _res;
12199}
12200
12201// args: starred_expression [',' args] | kwargs | named_expression [',' args]
12202static expr_ty
12203args_rule(Parser *p)
12204{
12205 D(p->level++);
12206 if (p->error_indicator) {
12207 D(p->level--);
12208 return NULL;
12209 }
12210 expr_ty _res = NULL;
12211 int _mark = p->mark;
12212 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12213 p->error_indicator = 1;
12214 D(p->level--);
12215 return NULL;
12216 }
12217 int _start_lineno = p->tokens[_mark]->lineno;
12218 UNUSED(_start_lineno); // Only used by EXTRA macro
12219 int _start_col_offset = p->tokens[_mark]->col_offset;
12220 UNUSED(_start_col_offset); // Only used by EXTRA macro
12221 { // starred_expression [',' args]
12222 if (p->error_indicator) {
12223 D(p->level--);
12224 return NULL;
12225 }
12226 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]"));
12227 expr_ty a;
12228 void *b;
12229 if (
12230 (a = starred_expression_rule(p)) // starred_expression
12231 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012232 (b = _tmp_108_rule(p), 1) // [',' args]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012233 )
12234 {
12235 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]"));
12236 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12237 if (_token == NULL) {
12238 D(p->level--);
12239 return NULL;
12240 }
12241 int _end_lineno = _token->end_lineno;
12242 UNUSED(_end_lineno); // Only used by EXTRA macro
12243 int _end_col_offset = _token->end_col_offset;
12244 UNUSED(_end_col_offset); // Only used by EXTRA macro
12245 _res = _Py_Call ( _PyPegen_dummy_name ( p ) , ( b ) ? CHECK ( _PyPegen_seq_insert_in_front ( p , a , ( ( expr_ty ) b ) -> v . Call . args ) ) : CHECK ( _PyPegen_singleton_seq ( p , a ) ) , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
12246 if (_res == NULL && PyErr_Occurred()) {
12247 p->error_indicator = 1;
12248 D(p->level--);
12249 return NULL;
12250 }
12251 goto done;
12252 }
12253 p->mark = _mark;
12254 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12255 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression [',' args]"));
12256 }
12257 { // kwargs
12258 if (p->error_indicator) {
12259 D(p->level--);
12260 return NULL;
12261 }
12262 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
12263 asdl_seq* a;
12264 if (
12265 (a = kwargs_rule(p)) // kwargs
12266 )
12267 {
12268 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
12269 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12270 if (_token == NULL) {
12271 D(p->level--);
12272 return NULL;
12273 }
12274 int _end_lineno = _token->end_lineno;
12275 UNUSED(_end_lineno); // Only used by EXTRA macro
12276 int _end_col_offset = _token->end_col_offset;
12277 UNUSED(_end_col_offset); // Only used by EXTRA macro
12278 _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 );
12279 if (_res == NULL && PyErr_Occurred()) {
12280 p->error_indicator = 1;
12281 D(p->level--);
12282 return NULL;
12283 }
12284 goto done;
12285 }
12286 p->mark = _mark;
12287 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12288 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
12289 }
12290 { // named_expression [',' args]
12291 if (p->error_indicator) {
12292 D(p->level--);
12293 return NULL;
12294 }
12295 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]"));
12296 expr_ty a;
12297 void *b;
12298 if (
12299 (a = named_expression_rule(p)) // named_expression
12300 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012301 (b = _tmp_109_rule(p), 1) // [',' args]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012302 )
12303 {
12304 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]"));
12305 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12306 if (_token == NULL) {
12307 D(p->level--);
12308 return NULL;
12309 }
12310 int _end_lineno = _token->end_lineno;
12311 UNUSED(_end_lineno); // Only used by EXTRA macro
12312 int _end_col_offset = _token->end_col_offset;
12313 UNUSED(_end_col_offset); // Only used by EXTRA macro
12314 _res = _Py_Call ( _PyPegen_dummy_name ( p ) , ( b ) ? CHECK ( _PyPegen_seq_insert_in_front ( p , a , ( ( expr_ty ) b ) -> v . Call . args ) ) : CHECK ( _PyPegen_singleton_seq ( p , a ) ) , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
12315 if (_res == NULL && PyErr_Occurred()) {
12316 p->error_indicator = 1;
12317 D(p->level--);
12318 return NULL;
12319 }
12320 goto done;
12321 }
12322 p->mark = _mark;
12323 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12324 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression [',' args]"));
12325 }
12326 _res = NULL;
12327 done:
12328 D(p->level--);
12329 return _res;
12330}
12331
12332// kwargs:
12333// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12334// | ','.kwarg_or_starred+
12335// | ','.kwarg_or_double_starred+
12336static asdl_seq*
12337kwargs_rule(Parser *p)
12338{
12339 D(p->level++);
12340 if (p->error_indicator) {
12341 D(p->level--);
12342 return NULL;
12343 }
12344 asdl_seq* _res = NULL;
12345 int _mark = p->mark;
12346 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12347 if (p->error_indicator) {
12348 D(p->level--);
12349 return NULL;
12350 }
12351 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12352 Token * _literal;
12353 asdl_seq * a;
12354 asdl_seq * b;
12355 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012356 (a = _gather_110_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012357 &&
12358 (_literal = _PyPegen_expect_token(p, 12)) // token=','
12359 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012360 (b = _gather_112_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012361 )
12362 {
12363 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12364 _res = _PyPegen_join_sequences ( p , a , b );
12365 if (_res == NULL && PyErr_Occurred()) {
12366 p->error_indicator = 1;
12367 D(p->level--);
12368 return NULL;
12369 }
12370 goto done;
12371 }
12372 p->mark = _mark;
12373 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12374 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12375 }
12376 { // ','.kwarg_or_starred+
12377 if (p->error_indicator) {
12378 D(p->level--);
12379 return NULL;
12380 }
12381 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012382 asdl_seq * _gather_114_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012383 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012384 (_gather_114_var = _gather_114_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012385 )
12386 {
12387 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012388 _res = _gather_114_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012389 goto done;
12390 }
12391 p->mark = _mark;
12392 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12393 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
12394 }
12395 { // ','.kwarg_or_double_starred+
12396 if (p->error_indicator) {
12397 D(p->level--);
12398 return NULL;
12399 }
12400 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012401 asdl_seq * _gather_116_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012402 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012403 (_gather_116_var = _gather_116_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012404 )
12405 {
12406 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012407 _res = _gather_116_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012408 goto done;
12409 }
12410 p->mark = _mark;
12411 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12412 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
12413 }
12414 _res = NULL;
12415 done:
12416 D(p->level--);
12417 return _res;
12418}
12419
12420// starred_expression: '*' expression
12421static expr_ty
12422starred_expression_rule(Parser *p)
12423{
12424 D(p->level++);
12425 if (p->error_indicator) {
12426 D(p->level--);
12427 return NULL;
12428 }
12429 expr_ty _res = NULL;
12430 int _mark = p->mark;
12431 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12432 p->error_indicator = 1;
12433 D(p->level--);
12434 return NULL;
12435 }
12436 int _start_lineno = p->tokens[_mark]->lineno;
12437 UNUSED(_start_lineno); // Only used by EXTRA macro
12438 int _start_col_offset = p->tokens[_mark]->col_offset;
12439 UNUSED(_start_col_offset); // Only used by EXTRA macro
12440 { // '*' expression
12441 if (p->error_indicator) {
12442 D(p->level--);
12443 return NULL;
12444 }
12445 D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12446 Token * _literal;
12447 expr_ty a;
12448 if (
12449 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12450 &&
12451 (a = expression_rule(p)) // expression
12452 )
12453 {
12454 D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12455 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12456 if (_token == NULL) {
12457 D(p->level--);
12458 return NULL;
12459 }
12460 int _end_lineno = _token->end_lineno;
12461 UNUSED(_end_lineno); // Only used by EXTRA macro
12462 int _end_col_offset = _token->end_col_offset;
12463 UNUSED(_end_col_offset); // Only used by EXTRA macro
12464 _res = _Py_Starred ( a , Load , EXTRA );
12465 if (_res == NULL && PyErr_Occurred()) {
12466 p->error_indicator = 1;
12467 D(p->level--);
12468 return NULL;
12469 }
12470 goto done;
12471 }
12472 p->mark = _mark;
12473 D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
12474 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
12475 }
12476 _res = NULL;
12477 done:
12478 D(p->level--);
12479 return _res;
12480}
12481
12482// kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg
12483static KeywordOrStarred*
12484kwarg_or_starred_rule(Parser *p)
12485{
12486 D(p->level++);
12487 if (p->error_indicator) {
12488 D(p->level--);
12489 return NULL;
12490 }
12491 KeywordOrStarred* _res = NULL;
12492 int _mark = p->mark;
12493 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12494 p->error_indicator = 1;
12495 D(p->level--);
12496 return NULL;
12497 }
12498 int _start_lineno = p->tokens[_mark]->lineno;
12499 UNUSED(_start_lineno); // Only used by EXTRA macro
12500 int _start_col_offset = p->tokens[_mark]->col_offset;
12501 UNUSED(_start_col_offset); // Only used by EXTRA macro
12502 { // NAME '=' expression
12503 if (p->error_indicator) {
12504 D(p->level--);
12505 return NULL;
12506 }
12507 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12508 Token * _literal;
12509 expr_ty a;
12510 expr_ty b;
12511 if (
12512 (a = _PyPegen_name_token(p)) // NAME
12513 &&
12514 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12515 &&
12516 (b = expression_rule(p)) // expression
12517 )
12518 {
12519 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12520 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12521 if (_token == NULL) {
12522 D(p->level--);
12523 return NULL;
12524 }
12525 int _end_lineno = _token->end_lineno;
12526 UNUSED(_end_lineno); // Only used by EXTRA macro
12527 int _end_col_offset = _token->end_col_offset;
12528 UNUSED(_end_col_offset); // Only used by EXTRA macro
12529 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
12530 if (_res == NULL && PyErr_Occurred()) {
12531 p->error_indicator = 1;
12532 D(p->level--);
12533 return NULL;
12534 }
12535 goto done;
12536 }
12537 p->mark = _mark;
12538 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12539 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12540 }
12541 { // starred_expression
12542 if (p->error_indicator) {
12543 D(p->level--);
12544 return NULL;
12545 }
12546 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12547 expr_ty a;
12548 if (
12549 (a = starred_expression_rule(p)) // starred_expression
12550 )
12551 {
12552 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12553 _res = _PyPegen_keyword_or_starred ( p , a , 0 );
12554 if (_res == NULL && PyErr_Occurred()) {
12555 p->error_indicator = 1;
12556 D(p->level--);
12557 return NULL;
12558 }
12559 goto done;
12560 }
12561 p->mark = _mark;
12562 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12563 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
12564 }
12565 { // invalid_kwarg
12566 if (p->error_indicator) {
12567 D(p->level--);
12568 return NULL;
12569 }
12570 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12571 void *invalid_kwarg_var;
12572 if (
12573 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12574 )
12575 {
12576 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12577 _res = invalid_kwarg_var;
12578 goto done;
12579 }
12580 p->mark = _mark;
12581 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12582 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12583 }
12584 _res = NULL;
12585 done:
12586 D(p->level--);
12587 return _res;
12588}
12589
12590// kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg
12591static KeywordOrStarred*
12592kwarg_or_double_starred_rule(Parser *p)
12593{
12594 D(p->level++);
12595 if (p->error_indicator) {
12596 D(p->level--);
12597 return NULL;
12598 }
12599 KeywordOrStarred* _res = NULL;
12600 int _mark = p->mark;
12601 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12602 p->error_indicator = 1;
12603 D(p->level--);
12604 return NULL;
12605 }
12606 int _start_lineno = p->tokens[_mark]->lineno;
12607 UNUSED(_start_lineno); // Only used by EXTRA macro
12608 int _start_col_offset = p->tokens[_mark]->col_offset;
12609 UNUSED(_start_col_offset); // Only used by EXTRA macro
12610 { // NAME '=' expression
12611 if (p->error_indicator) {
12612 D(p->level--);
12613 return NULL;
12614 }
12615 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12616 Token * _literal;
12617 expr_ty a;
12618 expr_ty b;
12619 if (
12620 (a = _PyPegen_name_token(p)) // NAME
12621 &&
12622 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12623 &&
12624 (b = expression_rule(p)) // expression
12625 )
12626 {
12627 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12628 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12629 if (_token == NULL) {
12630 D(p->level--);
12631 return NULL;
12632 }
12633 int _end_lineno = _token->end_lineno;
12634 UNUSED(_end_lineno); // Only used by EXTRA macro
12635 int _end_col_offset = _token->end_col_offset;
12636 UNUSED(_end_col_offset); // Only used by EXTRA macro
12637 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
12638 if (_res == NULL && PyErr_Occurred()) {
12639 p->error_indicator = 1;
12640 D(p->level--);
12641 return NULL;
12642 }
12643 goto done;
12644 }
12645 p->mark = _mark;
12646 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12647 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12648 }
12649 { // '**' expression
12650 if (p->error_indicator) {
12651 D(p->level--);
12652 return NULL;
12653 }
12654 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12655 Token * _literal;
12656 expr_ty a;
12657 if (
12658 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
12659 &&
12660 (a = expression_rule(p)) // expression
12661 )
12662 {
12663 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12664 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12665 if (_token == NULL) {
12666 D(p->level--);
12667 return NULL;
12668 }
12669 int _end_lineno = _token->end_lineno;
12670 UNUSED(_end_lineno); // Only used by EXTRA macro
12671 int _end_col_offset = _token->end_col_offset;
12672 UNUSED(_end_col_offset); // Only used by EXTRA macro
12673 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
12674 if (_res == NULL && PyErr_Occurred()) {
12675 p->error_indicator = 1;
12676 D(p->level--);
12677 return NULL;
12678 }
12679 goto done;
12680 }
12681 p->mark = _mark;
12682 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12683 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
12684 }
12685 { // invalid_kwarg
12686 if (p->error_indicator) {
12687 D(p->level--);
12688 return NULL;
12689 }
12690 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12691 void *invalid_kwarg_var;
12692 if (
12693 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12694 )
12695 {
12696 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12697 _res = invalid_kwarg_var;
12698 goto done;
12699 }
12700 p->mark = _mark;
12701 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12702 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12703 }
12704 _res = NULL;
12705 done:
12706 D(p->level--);
12707 return _res;
12708}
12709
12710// star_targets: star_target !',' | star_target ((',' star_target))* ','?
12711static expr_ty
12712star_targets_rule(Parser *p)
12713{
12714 D(p->level++);
12715 if (p->error_indicator) {
12716 D(p->level--);
12717 return NULL;
12718 }
12719 expr_ty _res = NULL;
12720 int _mark = p->mark;
12721 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12722 p->error_indicator = 1;
12723 D(p->level--);
12724 return NULL;
12725 }
12726 int _start_lineno = p->tokens[_mark]->lineno;
12727 UNUSED(_start_lineno); // Only used by EXTRA macro
12728 int _start_col_offset = p->tokens[_mark]->col_offset;
12729 UNUSED(_start_col_offset); // Only used by EXTRA macro
12730 { // star_target !','
12731 if (p->error_indicator) {
12732 D(p->level--);
12733 return NULL;
12734 }
12735 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12736 expr_ty a;
12737 if (
12738 (a = star_target_rule(p)) // star_target
12739 &&
12740 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
12741 )
12742 {
12743 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12744 _res = a;
12745 if (_res == NULL && PyErr_Occurred()) {
12746 p->error_indicator = 1;
12747 D(p->level--);
12748 return NULL;
12749 }
12750 goto done;
12751 }
12752 p->mark = _mark;
12753 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12754 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
12755 }
12756 { // star_target ((',' star_target))* ','?
12757 if (p->error_indicator) {
12758 D(p->level--);
12759 return NULL;
12760 }
12761 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12762 void *_opt_var;
12763 UNUSED(_opt_var); // Silence compiler warnings
12764 expr_ty a;
12765 asdl_seq * b;
12766 if (
12767 (a = star_target_rule(p)) // star_target
12768 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012769 (b = _loop0_118_rule(p)) // ((',' star_target))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012770 &&
12771 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12772 )
12773 {
12774 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12775 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12776 if (_token == NULL) {
12777 D(p->level--);
12778 return NULL;
12779 }
12780 int _end_lineno = _token->end_lineno;
12781 UNUSED(_end_lineno); // Only used by EXTRA macro
12782 int _end_col_offset = _token->end_col_offset;
12783 UNUSED(_end_col_offset); // Only used by EXTRA macro
12784 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
12785 if (_res == NULL && PyErr_Occurred()) {
12786 p->error_indicator = 1;
12787 D(p->level--);
12788 return NULL;
12789 }
12790 goto done;
12791 }
12792 p->mark = _mark;
12793 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12794 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
12795 }
12796 _res = NULL;
12797 done:
12798 D(p->level--);
12799 return _res;
12800}
12801
12802// star_targets_seq: ','.star_target+ ','?
12803static asdl_seq*
12804star_targets_seq_rule(Parser *p)
12805{
12806 D(p->level++);
12807 if (p->error_indicator) {
12808 D(p->level--);
12809 return NULL;
12810 }
12811 asdl_seq* _res = NULL;
12812 int _mark = p->mark;
12813 { // ','.star_target+ ','?
12814 if (p->error_indicator) {
12815 D(p->level--);
12816 return NULL;
12817 }
12818 D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12819 void *_opt_var;
12820 UNUSED(_opt_var); // Silence compiler warnings
12821 asdl_seq * a;
12822 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012823 (a = _gather_119_rule(p)) // ','.star_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012824 &&
12825 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12826 )
12827 {
12828 D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12829 _res = a;
12830 if (_res == NULL && PyErr_Occurred()) {
12831 p->error_indicator = 1;
12832 D(p->level--);
12833 return NULL;
12834 }
12835 goto done;
12836 }
12837 p->mark = _mark;
12838 D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ',
12839 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
12840 }
12841 _res = NULL;
12842 done:
12843 D(p->level--);
12844 return _res;
12845}
12846
12847// star_target:
12848// | '*' (!'*' star_target)
12849// | t_primary '.' NAME !t_lookahead
12850// | t_primary '[' slices ']' !t_lookahead
12851// | star_atom
12852static expr_ty
12853star_target_rule(Parser *p)
12854{
12855 D(p->level++);
12856 if (p->error_indicator) {
12857 D(p->level--);
12858 return NULL;
12859 }
12860 expr_ty _res = NULL;
12861 if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
12862 D(p->level--);
12863 return _res;
12864 }
12865 int _mark = p->mark;
12866 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12867 p->error_indicator = 1;
12868 D(p->level--);
12869 return NULL;
12870 }
12871 int _start_lineno = p->tokens[_mark]->lineno;
12872 UNUSED(_start_lineno); // Only used by EXTRA macro
12873 int _start_col_offset = p->tokens[_mark]->col_offset;
12874 UNUSED(_start_col_offset); // Only used by EXTRA macro
12875 { // '*' (!'*' star_target)
12876 if (p->error_indicator) {
12877 D(p->level--);
12878 return NULL;
12879 }
12880 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12881 Token * _literal;
12882 void *a;
12883 if (
12884 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12885 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012886 (a = _tmp_121_rule(p)) // !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012887 )
12888 {
12889 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12890 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12891 if (_token == NULL) {
12892 D(p->level--);
12893 return NULL;
12894 }
12895 int _end_lineno = _token->end_lineno;
12896 UNUSED(_end_lineno); // Only used by EXTRA macro
12897 int _end_col_offset = _token->end_col_offset;
12898 UNUSED(_end_col_offset); // Only used by EXTRA macro
12899 _res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
12900 if (_res == NULL && PyErr_Occurred()) {
12901 p->error_indicator = 1;
12902 D(p->level--);
12903 return NULL;
12904 }
12905 goto done;
12906 }
12907 p->mark = _mark;
12908 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12909 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
12910 }
12911 { // t_primary '.' NAME !t_lookahead
12912 if (p->error_indicator) {
12913 D(p->level--);
12914 return NULL;
12915 }
12916 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12917 Token * _literal;
12918 expr_ty a;
12919 expr_ty b;
12920 if (
12921 (a = t_primary_rule(p)) // t_primary
12922 &&
12923 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
12924 &&
12925 (b = _PyPegen_name_token(p)) // NAME
12926 &&
12927 _PyPegen_lookahead(0, t_lookahead_rule, p)
12928 )
12929 {
12930 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12931 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12932 if (_token == NULL) {
12933 D(p->level--);
12934 return NULL;
12935 }
12936 int _end_lineno = _token->end_lineno;
12937 UNUSED(_end_lineno); // Only used by EXTRA macro
12938 int _end_col_offset = _token->end_col_offset;
12939 UNUSED(_end_col_offset); // Only used by EXTRA macro
12940 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
12941 if (_res == NULL && PyErr_Occurred()) {
12942 p->error_indicator = 1;
12943 D(p->level--);
12944 return NULL;
12945 }
12946 goto done;
12947 }
12948 p->mark = _mark;
12949 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12950 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12951 }
12952 { // t_primary '[' slices ']' !t_lookahead
12953 if (p->error_indicator) {
12954 D(p->level--);
12955 return NULL;
12956 }
12957 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12958 Token * _literal;
12959 Token * _literal_1;
12960 expr_ty a;
12961 expr_ty b;
12962 if (
12963 (a = t_primary_rule(p)) // t_primary
12964 &&
12965 (_literal = _PyPegen_expect_token(p, 9)) // token='['
12966 &&
12967 (b = slices_rule(p)) // slices
12968 &&
12969 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
12970 &&
12971 _PyPegen_lookahead(0, t_lookahead_rule, p)
12972 )
12973 {
12974 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12975 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12976 if (_token == NULL) {
12977 D(p->level--);
12978 return NULL;
12979 }
12980 int _end_lineno = _token->end_lineno;
12981 UNUSED(_end_lineno); // Only used by EXTRA macro
12982 int _end_col_offset = _token->end_col_offset;
12983 UNUSED(_end_col_offset); // Only used by EXTRA macro
12984 _res = _Py_Subscript ( a , b , Store , EXTRA );
12985 if (_res == NULL && PyErr_Occurred()) {
12986 p->error_indicator = 1;
12987 D(p->level--);
12988 return NULL;
12989 }
12990 goto done;
12991 }
12992 p->mark = _mark;
12993 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12994 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12995 }
12996 { // star_atom
12997 if (p->error_indicator) {
12998 D(p->level--);
12999 return NULL;
13000 }
13001 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
13002 expr_ty star_atom_var;
13003 if (
13004 (star_atom_var = star_atom_rule(p)) // star_atom
13005 )
13006 {
13007 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
13008 _res = star_atom_var;
13009 goto done;
13010 }
13011 p->mark = _mark;
13012 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
13013 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
13014 }
13015 _res = NULL;
13016 done:
13017 _PyPegen_insert_memo(p, _mark, star_target_type, _res);
13018 D(p->level--);
13019 return _res;
13020}
13021
13022// star_atom:
13023// | NAME
13024// | '(' star_target ')'
13025// | '(' star_targets_seq? ')'
13026// | '[' star_targets_seq? ']'
13027static expr_ty
13028star_atom_rule(Parser *p)
13029{
13030 D(p->level++);
13031 if (p->error_indicator) {
13032 D(p->level--);
13033 return NULL;
13034 }
13035 expr_ty _res = NULL;
13036 int _mark = p->mark;
13037 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13038 p->error_indicator = 1;
13039 D(p->level--);
13040 return NULL;
13041 }
13042 int _start_lineno = p->tokens[_mark]->lineno;
13043 UNUSED(_start_lineno); // Only used by EXTRA macro
13044 int _start_col_offset = p->tokens[_mark]->col_offset;
13045 UNUSED(_start_col_offset); // Only used by EXTRA macro
13046 { // NAME
13047 if (p->error_indicator) {
13048 D(p->level--);
13049 return NULL;
13050 }
13051 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13052 expr_ty a;
13053 if (
13054 (a = _PyPegen_name_token(p)) // NAME
13055 )
13056 {
13057 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13058 _res = _PyPegen_set_expr_context ( p , a , Store );
13059 if (_res == NULL && PyErr_Occurred()) {
13060 p->error_indicator = 1;
13061 D(p->level--);
13062 return NULL;
13063 }
13064 goto done;
13065 }
13066 p->mark = _mark;
13067 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13068 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13069 }
13070 { // '(' star_target ')'
13071 if (p->error_indicator) {
13072 D(p->level--);
13073 return NULL;
13074 }
13075 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13076 Token * _literal;
13077 Token * _literal_1;
13078 expr_ty a;
13079 if (
13080 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13081 &&
13082 (a = star_target_rule(p)) // star_target
13083 &&
13084 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13085 )
13086 {
13087 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13088 _res = _PyPegen_set_expr_context ( p , a , Store );
13089 if (_res == NULL && PyErr_Occurred()) {
13090 p->error_indicator = 1;
13091 D(p->level--);
13092 return NULL;
13093 }
13094 goto done;
13095 }
13096 p->mark = _mark;
13097 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13098 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'"));
13099 }
13100 { // '(' star_targets_seq? ')'
13101 if (p->error_indicator) {
13102 D(p->level--);
13103 return NULL;
13104 }
13105 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13106 Token * _literal;
13107 Token * _literal_1;
13108 void *a;
13109 if (
13110 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13111 &&
13112 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13113 &&
13114 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13115 )
13116 {
13117 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13118 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13119 if (_token == NULL) {
13120 D(p->level--);
13121 return NULL;
13122 }
13123 int _end_lineno = _token->end_lineno;
13124 UNUSED(_end_lineno); // Only used by EXTRA macro
13125 int _end_col_offset = _token->end_col_offset;
13126 UNUSED(_end_col_offset); // Only used by EXTRA macro
13127 _res = _Py_Tuple ( a , Store , EXTRA );
13128 if (_res == NULL && PyErr_Occurred()) {
13129 p->error_indicator = 1;
13130 D(p->level--);
13131 return NULL;
13132 }
13133 goto done;
13134 }
13135 p->mark = _mark;
13136 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13137 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'"));
13138 }
13139 { // '[' star_targets_seq? ']'
13140 if (p->error_indicator) {
13141 D(p->level--);
13142 return NULL;
13143 }
13144 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13145 Token * _literal;
13146 Token * _literal_1;
13147 void *a;
13148 if (
13149 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13150 &&
13151 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13152 &&
13153 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13154 )
13155 {
13156 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13157 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13158 if (_token == NULL) {
13159 D(p->level--);
13160 return NULL;
13161 }
13162 int _end_lineno = _token->end_lineno;
13163 UNUSED(_end_lineno); // Only used by EXTRA macro
13164 int _end_col_offset = _token->end_col_offset;
13165 UNUSED(_end_col_offset); // Only used by EXTRA macro
13166 _res = _Py_List ( a , Store , EXTRA );
13167 if (_res == NULL && PyErr_Occurred()) {
13168 p->error_indicator = 1;
13169 D(p->level--);
13170 return NULL;
13171 }
13172 goto done;
13173 }
13174 p->mark = _mark;
13175 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13176 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'"));
13177 }
13178 _res = NULL;
13179 done:
13180 D(p->level--);
13181 return _res;
13182}
13183
13184// single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
13185static expr_ty
13186single_target_rule(Parser *p)
13187{
13188 D(p->level++);
13189 if (p->error_indicator) {
13190 D(p->level--);
13191 return NULL;
13192 }
13193 expr_ty _res = NULL;
13194 int _mark = p->mark;
13195 { // single_subscript_attribute_target
13196 if (p->error_indicator) {
13197 D(p->level--);
13198 return NULL;
13199 }
13200 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13201 expr_ty single_subscript_attribute_target_var;
13202 if (
13203 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
13204 )
13205 {
13206 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13207 _res = single_subscript_attribute_target_var;
13208 goto done;
13209 }
13210 p->mark = _mark;
13211 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13212 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
13213 }
13214 { // NAME
13215 if (p->error_indicator) {
13216 D(p->level--);
13217 return NULL;
13218 }
13219 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13220 expr_ty a;
13221 if (
13222 (a = _PyPegen_name_token(p)) // NAME
13223 )
13224 {
13225 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13226 _res = _PyPegen_set_expr_context ( p , a , Store );
13227 if (_res == NULL && PyErr_Occurred()) {
13228 p->error_indicator = 1;
13229 D(p->level--);
13230 return NULL;
13231 }
13232 goto done;
13233 }
13234 p->mark = _mark;
13235 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13236 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13237 }
13238 { // '(' single_target ')'
13239 if (p->error_indicator) {
13240 D(p->level--);
13241 return NULL;
13242 }
13243 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13244 Token * _literal;
13245 Token * _literal_1;
13246 expr_ty a;
13247 if (
13248 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13249 &&
13250 (a = single_target_rule(p)) // single_target
13251 &&
13252 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13253 )
13254 {
13255 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13256 _res = a;
13257 if (_res == NULL && PyErr_Occurred()) {
13258 p->error_indicator = 1;
13259 D(p->level--);
13260 return NULL;
13261 }
13262 goto done;
13263 }
13264 p->mark = _mark;
13265 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13266 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
13267 }
13268 _res = NULL;
13269 done:
13270 D(p->level--);
13271 return _res;
13272}
13273
13274// single_subscript_attribute_target:
13275// | t_primary '.' NAME !t_lookahead
13276// | t_primary '[' slices ']' !t_lookahead
13277static expr_ty
13278single_subscript_attribute_target_rule(Parser *p)
13279{
13280 D(p->level++);
13281 if (p->error_indicator) {
13282 D(p->level--);
13283 return NULL;
13284 }
13285 expr_ty _res = NULL;
13286 int _mark = p->mark;
13287 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13288 p->error_indicator = 1;
13289 D(p->level--);
13290 return NULL;
13291 }
13292 int _start_lineno = p->tokens[_mark]->lineno;
13293 UNUSED(_start_lineno); // Only used by EXTRA macro
13294 int _start_col_offset = p->tokens[_mark]->col_offset;
13295 UNUSED(_start_col_offset); // Only used by EXTRA macro
13296 { // t_primary '.' NAME !t_lookahead
13297 if (p->error_indicator) {
13298 D(p->level--);
13299 return NULL;
13300 }
13301 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13302 Token * _literal;
13303 expr_ty a;
13304 expr_ty b;
13305 if (
13306 (a = t_primary_rule(p)) // t_primary
13307 &&
13308 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13309 &&
13310 (b = _PyPegen_name_token(p)) // NAME
13311 &&
13312 _PyPegen_lookahead(0, t_lookahead_rule, p)
13313 )
13314 {
13315 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13316 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13317 if (_token == NULL) {
13318 D(p->level--);
13319 return NULL;
13320 }
13321 int _end_lineno = _token->end_lineno;
13322 UNUSED(_end_lineno); // Only used by EXTRA macro
13323 int _end_col_offset = _token->end_col_offset;
13324 UNUSED(_end_col_offset); // Only used by EXTRA macro
13325 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13326 if (_res == NULL && PyErr_Occurred()) {
13327 p->error_indicator = 1;
13328 D(p->level--);
13329 return NULL;
13330 }
13331 goto done;
13332 }
13333 p->mark = _mark;
13334 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13335 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13336 }
13337 { // t_primary '[' slices ']' !t_lookahead
13338 if (p->error_indicator) {
13339 D(p->level--);
13340 return NULL;
13341 }
13342 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13343 Token * _literal;
13344 Token * _literal_1;
13345 expr_ty a;
13346 expr_ty b;
13347 if (
13348 (a = t_primary_rule(p)) // t_primary
13349 &&
13350 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13351 &&
13352 (b = slices_rule(p)) // slices
13353 &&
13354 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13355 &&
13356 _PyPegen_lookahead(0, t_lookahead_rule, p)
13357 )
13358 {
13359 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13360 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13361 if (_token == NULL) {
13362 D(p->level--);
13363 return NULL;
13364 }
13365 int _end_lineno = _token->end_lineno;
13366 UNUSED(_end_lineno); // Only used by EXTRA macro
13367 int _end_col_offset = _token->end_col_offset;
13368 UNUSED(_end_col_offset); // Only used by EXTRA macro
13369 _res = _Py_Subscript ( a , b , Store , EXTRA );
13370 if (_res == NULL && PyErr_Occurred()) {
13371 p->error_indicator = 1;
13372 D(p->level--);
13373 return NULL;
13374 }
13375 goto done;
13376 }
13377 p->mark = _mark;
13378 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13379 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13380 }
13381 _res = NULL;
13382 done:
13383 D(p->level--);
13384 return _res;
13385}
13386
13387// del_targets: ','.del_target+ ','?
13388static asdl_seq*
13389del_targets_rule(Parser *p)
13390{
13391 D(p->level++);
13392 if (p->error_indicator) {
13393 D(p->level--);
13394 return NULL;
13395 }
13396 asdl_seq* _res = NULL;
13397 int _mark = p->mark;
13398 { // ','.del_target+ ','?
13399 if (p->error_indicator) {
13400 D(p->level--);
13401 return NULL;
13402 }
13403 D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13404 void *_opt_var;
13405 UNUSED(_opt_var); // Silence compiler warnings
13406 asdl_seq * a;
13407 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013408 (a = _gather_122_rule(p)) // ','.del_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013409 &&
13410 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13411 )
13412 {
13413 D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13414 _res = a;
13415 if (_res == NULL && PyErr_Occurred()) {
13416 p->error_indicator = 1;
13417 D(p->level--);
13418 return NULL;
13419 }
13420 goto done;
13421 }
13422 p->mark = _mark;
13423 D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
13424 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
13425 }
13426 _res = NULL;
13427 done:
13428 D(p->level--);
13429 return _res;
13430}
13431
13432// del_target:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013433// | t_primary '.' NAME !t_lookahead
13434// | t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013435// | del_t_atom
13436static expr_ty
13437del_target_rule(Parser *p)
13438{
13439 D(p->level++);
13440 if (p->error_indicator) {
13441 D(p->level--);
13442 return NULL;
13443 }
13444 expr_ty _res = NULL;
13445 if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
13446 D(p->level--);
13447 return _res;
13448 }
13449 int _mark = p->mark;
13450 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13451 p->error_indicator = 1;
13452 D(p->level--);
13453 return NULL;
13454 }
13455 int _start_lineno = p->tokens[_mark]->lineno;
13456 UNUSED(_start_lineno); // Only used by EXTRA macro
13457 int _start_col_offset = p->tokens[_mark]->col_offset;
13458 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013459 { // t_primary '.' NAME !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013460 if (p->error_indicator) {
13461 D(p->level--);
13462 return NULL;
13463 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013464 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013465 Token * _literal;
13466 expr_ty a;
13467 expr_ty b;
13468 if (
13469 (a = t_primary_rule(p)) // t_primary
13470 &&
13471 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13472 &&
13473 (b = _PyPegen_name_token(p)) // NAME
13474 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013475 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013476 )
13477 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013478 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 +010013479 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13480 if (_token == NULL) {
13481 D(p->level--);
13482 return NULL;
13483 }
13484 int _end_lineno = _token->end_lineno;
13485 UNUSED(_end_lineno); // Only used by EXTRA macro
13486 int _end_col_offset = _token->end_col_offset;
13487 UNUSED(_end_col_offset); // Only used by EXTRA macro
13488 _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
13489 if (_res == NULL && PyErr_Occurred()) {
13490 p->error_indicator = 1;
13491 D(p->level--);
13492 return NULL;
13493 }
13494 goto done;
13495 }
13496 p->mark = _mark;
13497 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013499 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013500 { // t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013501 if (p->error_indicator) {
13502 D(p->level--);
13503 return NULL;
13504 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013505 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 +010013506 Token * _literal;
13507 Token * _literal_1;
13508 expr_ty a;
13509 expr_ty b;
13510 if (
13511 (a = t_primary_rule(p)) // t_primary
13512 &&
13513 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13514 &&
13515 (b = slices_rule(p)) // slices
13516 &&
13517 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13518 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013519 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013520 )
13521 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013522 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 +010013523 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13524 if (_token == NULL) {
13525 D(p->level--);
13526 return NULL;
13527 }
13528 int _end_lineno = _token->end_lineno;
13529 UNUSED(_end_lineno); // Only used by EXTRA macro
13530 int _end_col_offset = _token->end_col_offset;
13531 UNUSED(_end_col_offset); // Only used by EXTRA macro
13532 _res = _Py_Subscript ( a , b , Del , EXTRA );
13533 if (_res == NULL && PyErr_Occurred()) {
13534 p->error_indicator = 1;
13535 D(p->level--);
13536 return NULL;
13537 }
13538 goto done;
13539 }
13540 p->mark = _mark;
13541 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013542 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013543 }
13544 { // del_t_atom
13545 if (p->error_indicator) {
13546 D(p->level--);
13547 return NULL;
13548 }
13549 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13550 expr_ty del_t_atom_var;
13551 if (
13552 (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom
13553 )
13554 {
13555 D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13556 _res = del_t_atom_var;
13557 goto done;
13558 }
13559 p->mark = _mark;
13560 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
13561 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
13562 }
13563 _res = NULL;
13564 done:
13565 _PyPegen_insert_memo(p, _mark, del_target_type, _res);
13566 D(p->level--);
13567 return _res;
13568}
13569
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013570// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013571static expr_ty
13572del_t_atom_rule(Parser *p)
13573{
13574 D(p->level++);
13575 if (p->error_indicator) {
13576 D(p->level--);
13577 return NULL;
13578 }
13579 expr_ty _res = NULL;
13580 int _mark = p->mark;
13581 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13582 p->error_indicator = 1;
13583 D(p->level--);
13584 return NULL;
13585 }
13586 int _start_lineno = p->tokens[_mark]->lineno;
13587 UNUSED(_start_lineno); // Only used by EXTRA macro
13588 int _start_col_offset = p->tokens[_mark]->col_offset;
13589 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013590 { // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013591 if (p->error_indicator) {
13592 D(p->level--);
13593 return NULL;
13594 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013595 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013596 expr_ty a;
13597 if (
13598 (a = _PyPegen_name_token(p)) // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013599 )
13600 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013601 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 +010013602 _res = _PyPegen_set_expr_context ( p , a , Del );
13603 if (_res == NULL && PyErr_Occurred()) {
13604 p->error_indicator = 1;
13605 D(p->level--);
13606 return NULL;
13607 }
13608 goto done;
13609 }
13610 p->mark = _mark;
13611 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013612 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013613 }
13614 { // '(' del_target ')'
13615 if (p->error_indicator) {
13616 D(p->level--);
13617 return NULL;
13618 }
13619 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13620 Token * _literal;
13621 Token * _literal_1;
13622 expr_ty a;
13623 if (
13624 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13625 &&
13626 (a = del_target_rule(p)) // del_target
13627 &&
13628 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13629 )
13630 {
13631 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13632 _res = _PyPegen_set_expr_context ( p , a , Del );
13633 if (_res == NULL && PyErr_Occurred()) {
13634 p->error_indicator = 1;
13635 D(p->level--);
13636 return NULL;
13637 }
13638 goto done;
13639 }
13640 p->mark = _mark;
13641 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13642 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
13643 }
13644 { // '(' del_targets? ')'
13645 if (p->error_indicator) {
13646 D(p->level--);
13647 return NULL;
13648 }
13649 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13650 Token * _literal;
13651 Token * _literal_1;
13652 void *a;
13653 if (
13654 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13655 &&
13656 (a = del_targets_rule(p), 1) // del_targets?
13657 &&
13658 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13659 )
13660 {
13661 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13662 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13663 if (_token == NULL) {
13664 D(p->level--);
13665 return NULL;
13666 }
13667 int _end_lineno = _token->end_lineno;
13668 UNUSED(_end_lineno); // Only used by EXTRA macro
13669 int _end_col_offset = _token->end_col_offset;
13670 UNUSED(_end_col_offset); // Only used by EXTRA macro
13671 _res = _Py_Tuple ( a , Del , EXTRA );
13672 if (_res == NULL && PyErr_Occurred()) {
13673 p->error_indicator = 1;
13674 D(p->level--);
13675 return NULL;
13676 }
13677 goto done;
13678 }
13679 p->mark = _mark;
13680 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13681 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
13682 }
13683 { // '[' del_targets? ']'
13684 if (p->error_indicator) {
13685 D(p->level--);
13686 return NULL;
13687 }
13688 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13689 Token * _literal;
13690 Token * _literal_1;
13691 void *a;
13692 if (
13693 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13694 &&
13695 (a = del_targets_rule(p), 1) // del_targets?
13696 &&
13697 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13698 )
13699 {
13700 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13701 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13702 if (_token == NULL) {
13703 D(p->level--);
13704 return NULL;
13705 }
13706 int _end_lineno = _token->end_lineno;
13707 UNUSED(_end_lineno); // Only used by EXTRA macro
13708 int _end_col_offset = _token->end_col_offset;
13709 UNUSED(_end_col_offset); // Only used by EXTRA macro
13710 _res = _Py_List ( a , Del , EXTRA );
13711 if (_res == NULL && PyErr_Occurred()) {
13712 p->error_indicator = 1;
13713 D(p->level--);
13714 return NULL;
13715 }
13716 goto done;
13717 }
13718 p->mark = _mark;
13719 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13720 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
13721 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013722 _res = NULL;
13723 done:
13724 D(p->level--);
13725 return _res;
13726}
13727
13728// targets: ','.target+ ','?
13729static asdl_seq*
13730targets_rule(Parser *p)
13731{
13732 D(p->level++);
13733 if (p->error_indicator) {
13734 D(p->level--);
13735 return NULL;
13736 }
13737 asdl_seq* _res = NULL;
13738 int _mark = p->mark;
13739 { // ','.target+ ','?
13740 if (p->error_indicator) {
13741 D(p->level--);
13742 return NULL;
13743 }
13744 D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13745 void *_opt_var;
13746 UNUSED(_opt_var); // Silence compiler warnings
13747 asdl_seq * a;
13748 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013749 (a = _gather_124_rule(p)) // ','.target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013750 &&
13751 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13752 )
13753 {
13754 D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13755 _res = a;
13756 if (_res == NULL && PyErr_Occurred()) {
13757 p->error_indicator = 1;
13758 D(p->level--);
13759 return NULL;
13760 }
13761 goto done;
13762 }
13763 p->mark = _mark;
13764 D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ',
13765 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?"));
13766 }
13767 _res = NULL;
13768 done:
13769 D(p->level--);
13770 return _res;
13771}
13772
13773// target:
13774// | t_primary '.' NAME !t_lookahead
13775// | t_primary '[' slices ']' !t_lookahead
13776// | t_atom
13777static expr_ty
13778target_rule(Parser *p)
13779{
13780 D(p->level++);
13781 if (p->error_indicator) {
13782 D(p->level--);
13783 return NULL;
13784 }
13785 expr_ty _res = NULL;
13786 if (_PyPegen_is_memoized(p, target_type, &_res)) {
13787 D(p->level--);
13788 return _res;
13789 }
13790 int _mark = p->mark;
13791 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13792 p->error_indicator = 1;
13793 D(p->level--);
13794 return NULL;
13795 }
13796 int _start_lineno = p->tokens[_mark]->lineno;
13797 UNUSED(_start_lineno); // Only used by EXTRA macro
13798 int _start_col_offset = p->tokens[_mark]->col_offset;
13799 UNUSED(_start_col_offset); // Only used by EXTRA macro
13800 { // t_primary '.' NAME !t_lookahead
13801 if (p->error_indicator) {
13802 D(p->level--);
13803 return NULL;
13804 }
13805 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13806 Token * _literal;
13807 expr_ty a;
13808 expr_ty b;
13809 if (
13810 (a = t_primary_rule(p)) // t_primary
13811 &&
13812 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13813 &&
13814 (b = _PyPegen_name_token(p)) // NAME
13815 &&
13816 _PyPegen_lookahead(0, t_lookahead_rule, p)
13817 )
13818 {
13819 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13820 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13821 if (_token == NULL) {
13822 D(p->level--);
13823 return NULL;
13824 }
13825 int _end_lineno = _token->end_lineno;
13826 UNUSED(_end_lineno); // Only used by EXTRA macro
13827 int _end_col_offset = _token->end_col_offset;
13828 UNUSED(_end_col_offset); // Only used by EXTRA macro
13829 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13830 if (_res == NULL && PyErr_Occurred()) {
13831 p->error_indicator = 1;
13832 D(p->level--);
13833 return NULL;
13834 }
13835 goto done;
13836 }
13837 p->mark = _mark;
13838 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13839 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13840 }
13841 { // t_primary '[' slices ']' !t_lookahead
13842 if (p->error_indicator) {
13843 D(p->level--);
13844 return NULL;
13845 }
13846 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13847 Token * _literal;
13848 Token * _literal_1;
13849 expr_ty a;
13850 expr_ty b;
13851 if (
13852 (a = t_primary_rule(p)) // t_primary
13853 &&
13854 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13855 &&
13856 (b = slices_rule(p)) // slices
13857 &&
13858 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13859 &&
13860 _PyPegen_lookahead(0, t_lookahead_rule, p)
13861 )
13862 {
13863 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13864 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13865 if (_token == NULL) {
13866 D(p->level--);
13867 return NULL;
13868 }
13869 int _end_lineno = _token->end_lineno;
13870 UNUSED(_end_lineno); // Only used by EXTRA macro
13871 int _end_col_offset = _token->end_col_offset;
13872 UNUSED(_end_col_offset); // Only used by EXTRA macro
13873 _res = _Py_Subscript ( a , b , Store , EXTRA );
13874 if (_res == NULL && PyErr_Occurred()) {
13875 p->error_indicator = 1;
13876 D(p->level--);
13877 return NULL;
13878 }
13879 goto done;
13880 }
13881 p->mark = _mark;
13882 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13883 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13884 }
13885 { // t_atom
13886 if (p->error_indicator) {
13887 D(p->level--);
13888 return NULL;
13889 }
13890 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom"));
13891 expr_ty t_atom_var;
13892 if (
13893 (t_atom_var = t_atom_rule(p)) // t_atom
13894 )
13895 {
13896 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom"));
13897 _res = t_atom_var;
13898 goto done;
13899 }
13900 p->mark = _mark;
13901 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13902 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom"));
13903 }
13904 _res = NULL;
13905 done:
13906 _PyPegen_insert_memo(p, _mark, target_type, _res);
13907 D(p->level--);
13908 return _res;
13909}
13910
13911// Left-recursive
13912// t_primary:
13913// | t_primary '.' NAME &t_lookahead
13914// | t_primary '[' slices ']' &t_lookahead
13915// | t_primary genexp &t_lookahead
13916// | t_primary '(' arguments? ')' &t_lookahead
13917// | atom &t_lookahead
13918static expr_ty t_primary_raw(Parser *);
13919static expr_ty
13920t_primary_rule(Parser *p)
13921{
13922 D(p->level++);
13923 expr_ty _res = NULL;
13924 if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
13925 D(p->level--);
13926 return _res;
13927 }
13928 int _mark = p->mark;
13929 int _resmark = p->mark;
13930 while (1) {
13931 int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
13932 if (tmpvar_8) {
13933 D(p->level--);
13934 return _res;
13935 }
13936 p->mark = _mark;
13937 void *_raw = t_primary_raw(p);
13938 if (_raw == NULL || p->mark <= _resmark)
13939 break;
13940 _resmark = p->mark;
13941 _res = _raw;
13942 }
13943 p->mark = _resmark;
13944 D(p->level--);
13945 return _res;
13946}
13947static expr_ty
13948t_primary_raw(Parser *p)
13949{
13950 D(p->level++);
13951 if (p->error_indicator) {
13952 D(p->level--);
13953 return NULL;
13954 }
13955 expr_ty _res = NULL;
13956 int _mark = p->mark;
13957 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13958 p->error_indicator = 1;
13959 D(p->level--);
13960 return NULL;
13961 }
13962 int _start_lineno = p->tokens[_mark]->lineno;
13963 UNUSED(_start_lineno); // Only used by EXTRA macro
13964 int _start_col_offset = p->tokens[_mark]->col_offset;
13965 UNUSED(_start_col_offset); // Only used by EXTRA macro
13966 { // t_primary '.' NAME &t_lookahead
13967 if (p->error_indicator) {
13968 D(p->level--);
13969 return NULL;
13970 }
13971 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13972 Token * _literal;
13973 expr_ty a;
13974 expr_ty b;
13975 if (
13976 (a = t_primary_rule(p)) // t_primary
13977 &&
13978 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13979 &&
13980 (b = _PyPegen_name_token(p)) // NAME
13981 &&
13982 _PyPegen_lookahead(1, t_lookahead_rule, p)
13983 )
13984 {
13985 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13986 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13987 if (_token == NULL) {
13988 D(p->level--);
13989 return NULL;
13990 }
13991 int _end_lineno = _token->end_lineno;
13992 UNUSED(_end_lineno); // Only used by EXTRA macro
13993 int _end_col_offset = _token->end_col_offset;
13994 UNUSED(_end_col_offset); // Only used by EXTRA macro
13995 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
13996 if (_res == NULL && PyErr_Occurred()) {
13997 p->error_indicator = 1;
13998 D(p->level--);
13999 return NULL;
14000 }
14001 goto done;
14002 }
14003 p->mark = _mark;
14004 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14005 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
14006 }
14007 { // t_primary '[' slices ']' &t_lookahead
14008 if (p->error_indicator) {
14009 D(p->level--);
14010 return NULL;
14011 }
14012 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14013 Token * _literal;
14014 Token * _literal_1;
14015 expr_ty a;
14016 expr_ty b;
14017 if (
14018 (a = t_primary_rule(p)) // t_primary
14019 &&
14020 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14021 &&
14022 (b = slices_rule(p)) // slices
14023 &&
14024 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14025 &&
14026 _PyPegen_lookahead(1, t_lookahead_rule, p)
14027 )
14028 {
14029 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14030 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14031 if (_token == NULL) {
14032 D(p->level--);
14033 return NULL;
14034 }
14035 int _end_lineno = _token->end_lineno;
14036 UNUSED(_end_lineno); // Only used by EXTRA macro
14037 int _end_col_offset = _token->end_col_offset;
14038 UNUSED(_end_col_offset); // Only used by EXTRA macro
14039 _res = _Py_Subscript ( a , b , Load , EXTRA );
14040 if (_res == NULL && PyErr_Occurred()) {
14041 p->error_indicator = 1;
14042 D(p->level--);
14043 return NULL;
14044 }
14045 goto done;
14046 }
14047 p->mark = _mark;
14048 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14049 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14050 }
14051 { // t_primary genexp &t_lookahead
14052 if (p->error_indicator) {
14053 D(p->level--);
14054 return NULL;
14055 }
14056 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14057 expr_ty a;
14058 expr_ty b;
14059 if (
14060 (a = t_primary_rule(p)) // t_primary
14061 &&
14062 (b = genexp_rule(p)) // genexp
14063 &&
14064 _PyPegen_lookahead(1, t_lookahead_rule, p)
14065 )
14066 {
14067 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14068 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14069 if (_token == NULL) {
14070 D(p->level--);
14071 return NULL;
14072 }
14073 int _end_lineno = _token->end_lineno;
14074 UNUSED(_end_lineno); // Only used by EXTRA macro
14075 int _end_col_offset = _token->end_col_offset;
14076 UNUSED(_end_col_offset); // Only used by EXTRA macro
14077 _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
14078 if (_res == NULL && PyErr_Occurred()) {
14079 p->error_indicator = 1;
14080 D(p->level--);
14081 return NULL;
14082 }
14083 goto done;
14084 }
14085 p->mark = _mark;
14086 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14087 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
14088 }
14089 { // t_primary '(' arguments? ')' &t_lookahead
14090 if (p->error_indicator) {
14091 D(p->level--);
14092 return NULL;
14093 }
14094 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14095 Token * _literal;
14096 Token * _literal_1;
14097 expr_ty a;
14098 void *b;
14099 if (
14100 (a = t_primary_rule(p)) // t_primary
14101 &&
14102 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14103 &&
14104 (b = arguments_rule(p), 1) // arguments?
14105 &&
14106 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14107 &&
14108 _PyPegen_lookahead(1, t_lookahead_rule, p)
14109 )
14110 {
14111 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14112 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14113 if (_token == NULL) {
14114 D(p->level--);
14115 return NULL;
14116 }
14117 int _end_lineno = _token->end_lineno;
14118 UNUSED(_end_lineno); // Only used by EXTRA macro
14119 int _end_col_offset = _token->end_col_offset;
14120 UNUSED(_end_col_offset); // Only used by EXTRA macro
14121 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
14122 if (_res == NULL && PyErr_Occurred()) {
14123 p->error_indicator = 1;
14124 D(p->level--);
14125 return NULL;
14126 }
14127 goto done;
14128 }
14129 p->mark = _mark;
14130 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14131 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14132 }
14133 { // atom &t_lookahead
14134 if (p->error_indicator) {
14135 D(p->level--);
14136 return NULL;
14137 }
14138 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14139 expr_ty a;
14140 if (
14141 (a = atom_rule(p)) // atom
14142 &&
14143 _PyPegen_lookahead(1, t_lookahead_rule, p)
14144 )
14145 {
14146 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14147 _res = a;
14148 if (_res == NULL && PyErr_Occurred()) {
14149 p->error_indicator = 1;
14150 D(p->level--);
14151 return NULL;
14152 }
14153 goto done;
14154 }
14155 p->mark = _mark;
14156 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14157 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
14158 }
14159 _res = NULL;
14160 done:
14161 D(p->level--);
14162 return _res;
14163}
14164
14165// t_lookahead: '(' | '[' | '.'
14166static void *
14167t_lookahead_rule(Parser *p)
14168{
14169 D(p->level++);
14170 if (p->error_indicator) {
14171 D(p->level--);
14172 return NULL;
14173 }
14174 void * _res = NULL;
14175 int _mark = p->mark;
14176 { // '('
14177 if (p->error_indicator) {
14178 D(p->level--);
14179 return NULL;
14180 }
14181 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
14182 Token * _literal;
14183 if (
14184 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14185 )
14186 {
14187 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
14188 _res = _literal;
14189 goto done;
14190 }
14191 p->mark = _mark;
14192 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14193 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
14194 }
14195 { // '['
14196 if (p->error_indicator) {
14197 D(p->level--);
14198 return NULL;
14199 }
14200 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
14201 Token * _literal;
14202 if (
14203 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14204 )
14205 {
14206 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
14207 _res = _literal;
14208 goto done;
14209 }
14210 p->mark = _mark;
14211 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14212 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
14213 }
14214 { // '.'
14215 if (p->error_indicator) {
14216 D(p->level--);
14217 return NULL;
14218 }
14219 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
14220 Token * _literal;
14221 if (
14222 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
14223 )
14224 {
14225 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
14226 _res = _literal;
14227 goto done;
14228 }
14229 p->mark = _mark;
14230 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14231 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
14232 }
14233 _res = NULL;
14234 done:
14235 D(p->level--);
14236 return _res;
14237}
14238
14239// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
14240static expr_ty
14241t_atom_rule(Parser *p)
14242{
14243 D(p->level++);
14244 if (p->error_indicator) {
14245 D(p->level--);
14246 return NULL;
14247 }
14248 expr_ty _res = NULL;
14249 int _mark = p->mark;
14250 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
14251 p->error_indicator = 1;
14252 D(p->level--);
14253 return NULL;
14254 }
14255 int _start_lineno = p->tokens[_mark]->lineno;
14256 UNUSED(_start_lineno); // Only used by EXTRA macro
14257 int _start_col_offset = p->tokens[_mark]->col_offset;
14258 UNUSED(_start_col_offset); // Only used by EXTRA macro
14259 { // NAME
14260 if (p->error_indicator) {
14261 D(p->level--);
14262 return NULL;
14263 }
14264 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
14265 expr_ty a;
14266 if (
14267 (a = _PyPegen_name_token(p)) // NAME
14268 )
14269 {
14270 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
14271 _res = _PyPegen_set_expr_context ( p , a , Store );
14272 if (_res == NULL && PyErr_Occurred()) {
14273 p->error_indicator = 1;
14274 D(p->level--);
14275 return NULL;
14276 }
14277 goto done;
14278 }
14279 p->mark = _mark;
14280 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14281 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
14282 }
14283 { // '(' target ')'
14284 if (p->error_indicator) {
14285 D(p->level--);
14286 return NULL;
14287 }
14288 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14289 Token * _literal;
14290 Token * _literal_1;
14291 expr_ty a;
14292 if (
14293 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14294 &&
14295 (a = target_rule(p)) // target
14296 &&
14297 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14298 )
14299 {
14300 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14301 _res = _PyPegen_set_expr_context ( p , a , Store );
14302 if (_res == NULL && PyErr_Occurred()) {
14303 p->error_indicator = 1;
14304 D(p->level--);
14305 return NULL;
14306 }
14307 goto done;
14308 }
14309 p->mark = _mark;
14310 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14311 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'"));
14312 }
14313 { // '(' targets? ')'
14314 if (p->error_indicator) {
14315 D(p->level--);
14316 return NULL;
14317 }
14318 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14319 Token * _literal;
14320 Token * _literal_1;
14321 void *b;
14322 if (
14323 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14324 &&
14325 (b = targets_rule(p), 1) // targets?
14326 &&
14327 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14328 )
14329 {
14330 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14331 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14332 if (_token == NULL) {
14333 D(p->level--);
14334 return NULL;
14335 }
14336 int _end_lineno = _token->end_lineno;
14337 UNUSED(_end_lineno); // Only used by EXTRA macro
14338 int _end_col_offset = _token->end_col_offset;
14339 UNUSED(_end_col_offset); // Only used by EXTRA macro
14340 _res = _Py_Tuple ( b , Store , EXTRA );
14341 if (_res == NULL && PyErr_Occurred()) {
14342 p->error_indicator = 1;
14343 D(p->level--);
14344 return NULL;
14345 }
14346 goto done;
14347 }
14348 p->mark = _mark;
14349 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14350 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'"));
14351 }
14352 { // '[' targets? ']'
14353 if (p->error_indicator) {
14354 D(p->level--);
14355 return NULL;
14356 }
14357 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14358 Token * _literal;
14359 Token * _literal_1;
14360 void *b;
14361 if (
14362 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14363 &&
14364 (b = targets_rule(p), 1) // targets?
14365 &&
14366 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14367 )
14368 {
14369 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14370 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14371 if (_token == NULL) {
14372 D(p->level--);
14373 return NULL;
14374 }
14375 int _end_lineno = _token->end_lineno;
14376 UNUSED(_end_lineno); // Only used by EXTRA macro
14377 int _end_col_offset = _token->end_col_offset;
14378 UNUSED(_end_col_offset); // Only used by EXTRA macro
14379 _res = _Py_List ( b , Store , EXTRA );
14380 if (_res == NULL && PyErr_Occurred()) {
14381 p->error_indicator = 1;
14382 D(p->level--);
14383 return NULL;
14384 }
14385 goto done;
14386 }
14387 p->mark = _mark;
14388 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14389 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'"));
14390 }
14391 _res = NULL;
14392 done:
14393 D(p->level--);
14394 return _res;
14395}
14396
14397// incorrect_arguments:
14398// | args ',' '*'
14399// | expression for_if_clauses ',' [args | expression for_if_clauses]
14400// | args for_if_clauses
14401// | args ',' expression for_if_clauses
14402// | args ',' args
14403static void *
14404incorrect_arguments_rule(Parser *p)
14405{
14406 D(p->level++);
14407 if (p->error_indicator) {
14408 D(p->level--);
14409 return NULL;
14410 }
14411 void * _res = NULL;
14412 int _mark = p->mark;
14413 { // args ',' '*'
14414 if (p->error_indicator) {
14415 D(p->level--);
14416 return NULL;
14417 }
14418 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
14419 Token * _literal;
14420 Token * _literal_1;
14421 expr_ty args_var;
14422 if (
14423 (args_var = args_rule(p)) // args
14424 &&
14425 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14426 &&
14427 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
14428 )
14429 {
14430 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
14431 _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
14432 if (_res == NULL && PyErr_Occurred()) {
14433 p->error_indicator = 1;
14434 D(p->level--);
14435 return NULL;
14436 }
14437 goto done;
14438 }
14439 p->mark = _mark;
14440 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14441 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'"));
14442 }
14443 { // expression for_if_clauses ',' [args | expression for_if_clauses]
14444 if (p->error_indicator) {
14445 D(p->level--);
14446 return NULL;
14447 }
14448 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14449 Token * _literal;
14450 void *_opt_var;
14451 UNUSED(_opt_var); // Silence compiler warnings
14452 expr_ty a;
14453 asdl_seq* for_if_clauses_var;
14454 if (
14455 (a = expression_rule(p)) // expression
14456 &&
14457 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14458 &&
14459 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14460 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014461 (_opt_var = _tmp_126_rule(p), 1) // [args | expression for_if_clauses]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014462 )
14463 {
14464 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]"));
14465 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14466 if (_res == NULL && PyErr_Occurred()) {
14467 p->error_indicator = 1;
14468 D(p->level--);
14469 return NULL;
14470 }
14471 goto done;
14472 }
14473 p->mark = _mark;
14474 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14476 }
14477 { // args for_if_clauses
14478 if (p->error_indicator) {
14479 D(p->level--);
14480 return NULL;
14481 }
14482 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
14483 expr_ty a;
14484 asdl_seq* for_if_clauses_var;
14485 if (
14486 (a = args_rule(p)) // args
14487 &&
14488 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14489 )
14490 {
14491 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
14492 _res = _PyPegen_nonparen_genexp_in_call ( p , a );
14493 if (_res == NULL && PyErr_Occurred()) {
14494 p->error_indicator = 1;
14495 D(p->level--);
14496 return NULL;
14497 }
14498 goto done;
14499 }
14500 p->mark = _mark;
14501 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14502 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
14503 }
14504 { // args ',' expression for_if_clauses
14505 if (p->error_indicator) {
14506 D(p->level--);
14507 return NULL;
14508 }
14509 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
14510 Token * _literal;
14511 expr_ty a;
14512 expr_ty args_var;
14513 asdl_seq* for_if_clauses_var;
14514 if (
14515 (args_var = args_rule(p)) // args
14516 &&
14517 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14518 &&
14519 (a = expression_rule(p)) // expression
14520 &&
14521 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14522 )
14523 {
14524 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
14525 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14526 if (_res == NULL && PyErr_Occurred()) {
14527 p->error_indicator = 1;
14528 D(p->level--);
14529 return NULL;
14530 }
14531 goto done;
14532 }
14533 p->mark = _mark;
14534 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14535 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
14536 }
14537 { // args ',' args
14538 if (p->error_indicator) {
14539 D(p->level--);
14540 return NULL;
14541 }
14542 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
14543 Token * _literal;
14544 expr_ty a;
14545 expr_ty args_var;
14546 if (
14547 (a = args_rule(p)) // args
14548 &&
14549 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14550 &&
14551 (args_var = args_rule(p)) // args
14552 )
14553 {
14554 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
14555 _res = _PyPegen_arguments_parsing_error ( p , a );
14556 if (_res == NULL && PyErr_Occurred()) {
14557 p->error_indicator = 1;
14558 D(p->level--);
14559 return NULL;
14560 }
14561 goto done;
14562 }
14563 p->mark = _mark;
14564 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14565 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
14566 }
14567 _res = NULL;
14568 done:
14569 D(p->level--);
14570 return _res;
14571}
14572
14573// invalid_kwarg: expression '='
14574static void *
14575invalid_kwarg_rule(Parser *p)
14576{
14577 D(p->level++);
14578 if (p->error_indicator) {
14579 D(p->level--);
14580 return NULL;
14581 }
14582 void * _res = NULL;
14583 int _mark = p->mark;
14584 { // expression '='
14585 if (p->error_indicator) {
14586 D(p->level--);
14587 return NULL;
14588 }
14589 D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='"));
14590 Token * _literal;
14591 expr_ty a;
14592 if (
14593 (a = expression_rule(p)) // expression
14594 &&
14595 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14596 )
14597 {
14598 D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='"));
14599 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" );
14600 if (_res == NULL && PyErr_Occurred()) {
14601 p->error_indicator = 1;
14602 D(p->level--);
14603 return NULL;
14604 }
14605 goto done;
14606 }
14607 p->mark = _mark;
14608 D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
14609 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='"));
14610 }
14611 _res = NULL;
14612 done:
14613 D(p->level--);
14614 return _res;
14615}
14616
14617// invalid_named_expression: expression ':=' expression
14618static void *
14619invalid_named_expression_rule(Parser *p)
14620{
14621 D(p->level++);
14622 if (p->error_indicator) {
14623 D(p->level--);
14624 return NULL;
14625 }
14626 void * _res = NULL;
14627 int _mark = p->mark;
14628 { // expression ':=' expression
14629 if (p->error_indicator) {
14630 D(p->level--);
14631 return NULL;
14632 }
14633 D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14634 Token * _literal;
14635 expr_ty a;
14636 expr_ty expression_var;
14637 if (
14638 (a = expression_rule(p)) // expression
14639 &&
14640 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
14641 &&
14642 (expression_var = expression_rule(p)) // expression
14643 )
14644 {
14645 D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14646 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
14647 if (_res == NULL && PyErr_Occurred()) {
14648 p->error_indicator = 1;
14649 D(p->level--);
14650 return NULL;
14651 }
14652 goto done;
14653 }
14654 p->mark = _mark;
14655 D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
14656 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
14657 }
14658 _res = NULL;
14659 done:
14660 D(p->level--);
14661 return _res;
14662}
14663
14664// invalid_assignment:
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014665// | invalid_ann_assign_target ':' expression
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014666// | star_named_expression ',' star_named_expressions* ':' expression
14667// | expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014668// | ((star_targets '='))* star_expressions '='
14669// | ((star_targets '='))* yield_expr '='
14670// | star_expressions augassign (yield_expr | star_expressions)
14671static void *
14672invalid_assignment_rule(Parser *p)
14673{
14674 D(p->level++);
14675 if (p->error_indicator) {
14676 D(p->level--);
14677 return NULL;
14678 }
14679 void * _res = NULL;
14680 int _mark = p->mark;
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014681 { // invalid_ann_assign_target ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014682 if (p->error_indicator) {
14683 D(p->level--);
14684 return NULL;
14685 }
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014686 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 +010014687 Token * _literal;
14688 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014689 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014690 if (
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014691 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014692 &&
14693 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014694 &&
14695 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014696 )
14697 {
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014698 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
14699 _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 +010014700 if (_res == NULL && PyErr_Occurred()) {
14701 p->error_indicator = 1;
14702 D(p->level--);
14703 return NULL;
14704 }
14705 goto done;
14706 }
14707 p->mark = _mark;
14708 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014709 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014710 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014711 { // star_named_expression ',' star_named_expressions* ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014712 if (p->error_indicator) {
14713 D(p->level--);
14714 return NULL;
14715 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014716 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 +010014717 Token * _literal;
14718 Token * _literal_1;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014719 asdl_seq * _loop0_127_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014720 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014721 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014722 if (
14723 (a = star_named_expression_rule(p)) // star_named_expression
14724 &&
14725 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14726 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014727 (_loop0_127_var = _loop0_127_rule(p)) // star_named_expressions*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014728 &&
14729 (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014730 &&
14731 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014732 )
14733 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014734 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 +010014735 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
14736 if (_res == NULL && PyErr_Occurred()) {
14737 p->error_indicator = 1;
14738 D(p->level--);
14739 return NULL;
14740 }
14741 goto done;
14742 }
14743 p->mark = _mark;
14744 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014745 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014746 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014747 { // expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014748 if (p->error_indicator) {
14749 D(p->level--);
14750 return NULL;
14751 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014752 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014753 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014754 expr_ty a;
14755 expr_ty expression_var;
14756 if (
14757 (a = expression_rule(p)) // expression
14758 &&
14759 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
14760 &&
14761 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014762 )
14763 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014764 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 +010014765 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
14766 if (_res == NULL && PyErr_Occurred()) {
14767 p->error_indicator = 1;
14768 D(p->level--);
14769 return NULL;
14770 }
14771 goto done;
14772 }
14773 p->mark = _mark;
14774 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014775 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014776 }
14777 { // ((star_targets '='))* star_expressions '='
14778 if (p->error_indicator) {
14779 D(p->level--);
14780 return NULL;
14781 }
14782 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14783 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014784 asdl_seq * _loop0_128_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014785 expr_ty a;
14786 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014787 (_loop0_128_var = _loop0_128_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014788 &&
14789 (a = star_expressions_rule(p)) // star_expressions
14790 &&
14791 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14792 )
14793 {
14794 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 +030014795 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014796 if (_res == NULL && PyErr_Occurred()) {
14797 p->error_indicator = 1;
14798 D(p->level--);
14799 return NULL;
14800 }
14801 goto done;
14802 }
14803 p->mark = _mark;
14804 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14805 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14806 }
14807 { // ((star_targets '='))* yield_expr '='
14808 if (p->error_indicator) {
14809 D(p->level--);
14810 return NULL;
14811 }
14812 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14813 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014814 asdl_seq * _loop0_129_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014815 expr_ty a;
14816 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014817 (_loop0_129_var = _loop0_129_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014818 &&
14819 (a = yield_expr_rule(p)) // yield_expr
14820 &&
14821 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14822 )
14823 {
14824 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14825 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
14826 if (_res == NULL && PyErr_Occurred()) {
14827 p->error_indicator = 1;
14828 D(p->level--);
14829 return NULL;
14830 }
14831 goto done;
14832 }
14833 p->mark = _mark;
14834 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14835 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14836 }
14837 { // star_expressions augassign (yield_expr | star_expressions)
14838 if (p->error_indicator) {
14839 D(p->level--);
14840 return NULL;
14841 }
14842 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014843 void *_tmp_130_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014844 expr_ty a;
14845 AugOperator* augassign_var;
14846 if (
14847 (a = star_expressions_rule(p)) // star_expressions
14848 &&
14849 (augassign_var = augassign_rule(p)) // augassign
14850 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014851 (_tmp_130_var = _tmp_130_rule(p)) // yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014852 )
14853 {
14854 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14855 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
14856 if (_res == NULL && PyErr_Occurred()) {
14857 p->error_indicator = 1;
14858 D(p->level--);
14859 return NULL;
14860 }
14861 goto done;
14862 }
14863 p->mark = _mark;
14864 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14865 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14866 }
14867 _res = NULL;
14868 done:
14869 D(p->level--);
14870 return _res;
14871}
14872
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014873// invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
14874static expr_ty
14875invalid_ann_assign_target_rule(Parser *p)
14876{
14877 D(p->level++);
14878 if (p->error_indicator) {
14879 D(p->level--);
14880 return NULL;
14881 }
14882 expr_ty _res = NULL;
14883 int _mark = p->mark;
14884 { // list
14885 if (p->error_indicator) {
14886 D(p->level--);
14887 return NULL;
14888 }
14889 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
14890 expr_ty list_var;
14891 if (
14892 (list_var = list_rule(p)) // list
14893 )
14894 {
14895 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
14896 _res = list_var;
14897 goto done;
14898 }
14899 p->mark = _mark;
14900 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14901 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
14902 }
14903 { // tuple
14904 if (p->error_indicator) {
14905 D(p->level--);
14906 return NULL;
14907 }
14908 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
14909 expr_ty tuple_var;
14910 if (
14911 (tuple_var = tuple_rule(p)) // tuple
14912 )
14913 {
14914 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
14915 _res = tuple_var;
14916 goto done;
14917 }
14918 p->mark = _mark;
14919 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14920 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
14921 }
14922 { // '(' invalid_ann_assign_target ')'
14923 if (p->error_indicator) {
14924 D(p->level--);
14925 return NULL;
14926 }
14927 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14928 Token * _literal;
14929 Token * _literal_1;
14930 expr_ty a;
14931 if (
14932 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14933 &&
14934 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
14935 &&
14936 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14937 )
14938 {
14939 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14940 _res = a;
14941 if (_res == NULL && PyErr_Occurred()) {
14942 p->error_indicator = 1;
14943 D(p->level--);
14944 return NULL;
14945 }
14946 goto done;
14947 }
14948 p->mark = _mark;
14949 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14950 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14951 }
14952 _res = NULL;
14953 done:
14954 D(p->level--);
14955 return _res;
14956}
14957
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014958// invalid_del_stmt: 'del' star_expressions
14959static void *
14960invalid_del_stmt_rule(Parser *p)
14961{
14962 D(p->level++);
14963 if (p->error_indicator) {
14964 D(p->level--);
14965 return NULL;
14966 }
14967 void * _res = NULL;
14968 int _mark = p->mark;
14969 { // 'del' star_expressions
14970 if (p->error_indicator) {
14971 D(p->level--);
14972 return NULL;
14973 }
14974 D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
14975 Token * _keyword;
14976 expr_ty a;
14977 if (
14978 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
14979 &&
14980 (a = star_expressions_rule(p)) // star_expressions
14981 )
14982 {
14983 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 +030014984 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014985 if (_res == NULL && PyErr_Occurred()) {
14986 p->error_indicator = 1;
14987 D(p->level--);
14988 return NULL;
14989 }
14990 goto done;
14991 }
14992 p->mark = _mark;
14993 D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
14994 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
14995 }
14996 _res = NULL;
14997 done:
14998 D(p->level--);
14999 return _res;
15000}
15001
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015002// invalid_block: NEWLINE !INDENT
15003static void *
15004invalid_block_rule(Parser *p)
15005{
15006 D(p->level++);
15007 if (p->error_indicator) {
15008 D(p->level--);
15009 return NULL;
15010 }
15011 void * _res = NULL;
15012 int _mark = p->mark;
15013 { // NEWLINE !INDENT
15014 if (p->error_indicator) {
15015 D(p->level--);
15016 return NULL;
15017 }
15018 D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
15019 Token * newline_var;
15020 if (
15021 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15022 &&
15023 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
15024 )
15025 {
15026 D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
15027 _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
15028 if (_res == NULL && PyErr_Occurred()) {
15029 p->error_indicator = 1;
15030 D(p->level--);
15031 return NULL;
15032 }
15033 goto done;
15034 }
15035 p->mark = _mark;
15036 D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
15037 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
15038 }
15039 _res = NULL;
15040 done:
15041 D(p->level--);
15042 return _res;
15043}
15044
15045// invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses
15046static void *
15047invalid_comprehension_rule(Parser *p)
15048{
15049 D(p->level++);
15050 if (p->error_indicator) {
15051 D(p->level--);
15052 return NULL;
15053 }
15054 void * _res = NULL;
15055 int _mark = p->mark;
15056 { // ('[' | '(' | '{') starred_expression for_if_clauses
15057 if (p->error_indicator) {
15058 D(p->level--);
15059 return NULL;
15060 }
15061 D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015062 void *_tmp_131_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015063 expr_ty a;
15064 asdl_seq* for_if_clauses_var;
15065 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015066 (_tmp_131_var = _tmp_131_rule(p)) // '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015067 &&
15068 (a = starred_expression_rule(p)) // starred_expression
15069 &&
15070 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15071 )
15072 {
15073 D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15074 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
15075 if (_res == NULL && PyErr_Occurred()) {
15076 p->error_indicator = 1;
15077 D(p->level--);
15078 return NULL;
15079 }
15080 goto done;
15081 }
15082 p->mark = _mark;
15083 D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15084 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15085 }
15086 _res = NULL;
15087 done:
15088 D(p->level--);
15089 return _res;
15090}
15091
15092// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
15093static void *
15094invalid_dict_comprehension_rule(Parser *p)
15095{
15096 D(p->level++);
15097 if (p->error_indicator) {
15098 D(p->level--);
15099 return NULL;
15100 }
15101 void * _res = NULL;
15102 int _mark = p->mark;
15103 { // '{' '**' bitwise_or for_if_clauses '}'
15104 if (p->error_indicator) {
15105 D(p->level--);
15106 return NULL;
15107 }
15108 D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15109 Token * _literal;
15110 Token * _literal_1;
15111 Token * a;
15112 expr_ty bitwise_or_var;
15113 asdl_seq* for_if_clauses_var;
15114 if (
15115 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
15116 &&
15117 (a = _PyPegen_expect_token(p, 35)) // token='**'
15118 &&
15119 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
15120 &&
15121 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15122 &&
15123 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
15124 )
15125 {
15126 D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15127 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
15128 if (_res == NULL && PyErr_Occurred()) {
15129 p->error_indicator = 1;
15130 D(p->level--);
15131 return NULL;
15132 }
15133 goto done;
15134 }
15135 p->mark = _mark;
15136 D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15137 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15138 }
15139 _res = NULL;
15140 done:
15141 D(p->level--);
15142 return _res;
15143}
15144
15145// invalid_parameters:
15146// | param_no_default* (slash_with_default | param_with_default+) param_no_default
15147static void *
15148invalid_parameters_rule(Parser *p)
15149{
15150 D(p->level++);
15151 if (p->error_indicator) {
15152 D(p->level--);
15153 return NULL;
15154 }
15155 void * _res = NULL;
15156 int _mark = p->mark;
15157 { // param_no_default* (slash_with_default | param_with_default+) param_no_default
15158 if (p->error_indicator) {
15159 D(p->level--);
15160 return NULL;
15161 }
15162 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"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015163 asdl_seq * _loop0_132_var;
15164 void *_tmp_133_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015165 arg_ty param_no_default_var;
15166 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015167 (_loop0_132_var = _loop0_132_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015168 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015169 (_tmp_133_var = _tmp_133_rule(p)) // slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015170 &&
15171 (param_no_default_var = param_no_default_rule(p)) // param_no_default
15172 )
15173 {
15174 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"));
15175 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15176 if (_res == NULL && PyErr_Occurred()) {
15177 p->error_indicator = 1;
15178 D(p->level--);
15179 return NULL;
15180 }
15181 goto done;
15182 }
15183 p->mark = _mark;
15184 D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15185 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
15186 }
15187 _res = NULL;
15188 done:
15189 D(p->level--);
15190 return _res;
15191}
15192
15193// invalid_lambda_parameters:
15194// | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15195static void *
15196invalid_lambda_parameters_rule(Parser *p)
15197{
15198 D(p->level++);
15199 if (p->error_indicator) {
15200 D(p->level--);
15201 return NULL;
15202 }
15203 void * _res = NULL;
15204 int _mark = p->mark;
15205 { // lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15206 if (p->error_indicator) {
15207 D(p->level--);
15208 return NULL;
15209 }
15210 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"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015211 asdl_seq * _loop0_134_var;
15212 void *_tmp_135_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015213 arg_ty lambda_param_no_default_var;
15214 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015215 (_loop0_134_var = _loop0_134_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015216 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015217 (_tmp_135_var = _tmp_135_rule(p)) // lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015218 &&
15219 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
15220 )
15221 {
15222 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"));
15223 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15224 if (_res == NULL && PyErr_Occurred()) {
15225 p->error_indicator = 1;
15226 D(p->level--);
15227 return NULL;
15228 }
15229 goto done;
15230 }
15231 p->mark = _mark;
15232 D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15233 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
15234 }
15235 _res = NULL;
15236 done:
15237 D(p->level--);
15238 return _res;
15239}
15240
15241// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT
15242static void *
15243invalid_star_etc_rule(Parser *p)
15244{
15245 D(p->level++);
15246 if (p->error_indicator) {
15247 D(p->level--);
15248 return NULL;
15249 }
15250 void * _res = NULL;
15251 int _mark = p->mark;
15252 { // '*' (')' | ',' (')' | '**'))
15253 if (p->error_indicator) {
15254 D(p->level--);
15255 return NULL;
15256 }
15257 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15258 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015259 void *_tmp_136_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015260 if (
15261 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15262 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015263 (_tmp_136_var = _tmp_136_rule(p)) // ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015264 )
15265 {
15266 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15267 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15268 if (_res == NULL && PyErr_Occurred()) {
15269 p->error_indicator = 1;
15270 D(p->level--);
15271 return NULL;
15272 }
15273 goto done;
15274 }
15275 p->mark = _mark;
15276 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15277 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15278 }
15279 { // '*' ',' TYPE_COMMENT
15280 if (p->error_indicator) {
15281 D(p->level--);
15282 return NULL;
15283 }
15284 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15285 Token * _literal;
15286 Token * _literal_1;
15287 Token * type_comment_var;
15288 if (
15289 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15290 &&
15291 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
15292 &&
15293 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15294 )
15295 {
15296 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15297 _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
15298 if (_res == NULL && PyErr_Occurred()) {
15299 p->error_indicator = 1;
15300 D(p->level--);
15301 return NULL;
15302 }
15303 goto done;
15304 }
15305 p->mark = _mark;
15306 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15307 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15308 }
15309 _res = NULL;
15310 done:
15311 D(p->level--);
15312 return _res;
15313}
15314
15315// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**'))
15316static void *
15317invalid_lambda_star_etc_rule(Parser *p)
15318{
15319 D(p->level++);
15320 if (p->error_indicator) {
15321 D(p->level--);
15322 return NULL;
15323 }
15324 void * _res = NULL;
15325 int _mark = p->mark;
15326 { // '*' (':' | ',' (':' | '**'))
15327 if (p->error_indicator) {
15328 D(p->level--);
15329 return NULL;
15330 }
15331 D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15332 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015333 void *_tmp_137_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015334 if (
15335 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15336 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015337 (_tmp_137_var = _tmp_137_rule(p)) // ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015338 )
15339 {
15340 D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15341 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15342 if (_res == NULL && PyErr_Occurred()) {
15343 p->error_indicator = 1;
15344 D(p->level--);
15345 return NULL;
15346 }
15347 goto done;
15348 }
15349 p->mark = _mark;
15350 D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15351 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15352 }
15353 _res = NULL;
15354 done:
15355 D(p->level--);
15356 return _res;
15357}
15358
15359// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15360static void *
15361invalid_double_type_comments_rule(Parser *p)
15362{
15363 D(p->level++);
15364 if (p->error_indicator) {
15365 D(p->level--);
15366 return NULL;
15367 }
15368 void * _res = NULL;
15369 int _mark = p->mark;
15370 { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15371 if (p->error_indicator) {
15372 D(p->level--);
15373 return NULL;
15374 }
15375 D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15376 Token * indent_var;
15377 Token * newline_var;
15378 Token * newline_var_1;
15379 Token * type_comment_var;
15380 Token * type_comment_var_1;
15381 if (
15382 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15383 &&
15384 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15385 &&
15386 (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15387 &&
15388 (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15389 &&
15390 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
15391 )
15392 {
15393 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"));
15394 _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
15395 if (_res == NULL && PyErr_Occurred()) {
15396 p->error_indicator = 1;
15397 D(p->level--);
15398 return NULL;
15399 }
15400 goto done;
15401 }
15402 p->mark = _mark;
15403 D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
15404 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15405 }
15406 _res = NULL;
15407 done:
15408 D(p->level--);
15409 return _res;
15410}
15411
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015412// invalid_with_item: expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015413static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015414invalid_with_item_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015415{
15416 D(p->level++);
15417 if (p->error_indicator) {
15418 D(p->level--);
15419 return NULL;
15420 }
15421 void * _res = NULL;
15422 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015423 { // expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015424 if (p->error_indicator) {
15425 D(p->level--);
15426 return NULL;
15427 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015428 D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression"));
15429 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015430 expr_ty a;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015431 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015432 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015433 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015434 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015435 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
15436 &&
15437 (a = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015438 )
15439 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015440 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 +030015441 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015442 if (_res == NULL && PyErr_Occurred()) {
15443 p->error_indicator = 1;
15444 D(p->level--);
15445 return NULL;
15446 }
15447 goto done;
15448 }
15449 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015450 D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
15451 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression"));
15452 }
15453 _res = NULL;
15454 done:
15455 D(p->level--);
15456 return _res;
15457}
15458
15459// invalid_for_target: ASYNC? 'for' star_expressions
15460static void *
15461invalid_for_target_rule(Parser *p)
15462{
15463 D(p->level++);
15464 if (p->error_indicator) {
15465 D(p->level--);
15466 return NULL;
15467 }
15468 void * _res = NULL;
15469 int _mark = p->mark;
15470 { // ASYNC? 'for' star_expressions
15471 if (p->error_indicator) {
15472 D(p->level--);
15473 return NULL;
15474 }
15475 D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
15476 Token * _keyword;
15477 void *_opt_var;
15478 UNUSED(_opt_var); // Silence compiler warnings
15479 expr_ty a;
15480 if (
15481 (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
15482 &&
15483 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
15484 &&
15485 (a = star_expressions_rule(p)) // star_expressions
15486 )
15487 {
15488 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 +030015489 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015490 if (_res == NULL && PyErr_Occurred()) {
15491 p->error_indicator = 1;
15492 D(p->level--);
15493 return NULL;
15494 }
15495 goto done;
15496 }
15497 p->mark = _mark;
15498 D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
15499 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions"));
15500 }
15501 _res = NULL;
15502 done:
15503 D(p->level--);
15504 return _res;
15505}
15506
15507// invalid_group: '(' starred_expression ')'
15508static void *
15509invalid_group_rule(Parser *p)
15510{
15511 D(p->level++);
15512 if (p->error_indicator) {
15513 D(p->level--);
15514 return NULL;
15515 }
15516 void * _res = NULL;
15517 int _mark = p->mark;
15518 { // '(' starred_expression ')'
15519 if (p->error_indicator) {
15520 D(p->level--);
15521 return NULL;
15522 }
15523 D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15524 Token * _literal;
15525 Token * _literal_1;
15526 expr_ty a;
15527 if (
15528 (_literal = _PyPegen_expect_token(p, 7)) // token='('
15529 &&
15530 (a = starred_expression_rule(p)) // starred_expression
15531 &&
15532 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
15533 )
15534 {
15535 D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15536 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "can't use starred expression here" );
15537 if (_res == NULL && PyErr_Occurred()) {
15538 p->error_indicator = 1;
15539 D(p->level--);
15540 return NULL;
15541 }
15542 goto done;
15543 }
15544 p->mark = _mark;
15545 D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
15546 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015547 }
15548 _res = NULL;
15549 done:
15550 D(p->level--);
15551 return _res;
15552}
15553
15554// invalid_import_from_targets: import_from_as_names ','
15555static void *
15556invalid_import_from_targets_rule(Parser *p)
15557{
15558 D(p->level++);
15559 if (p->error_indicator) {
15560 D(p->level--);
15561 return NULL;
15562 }
15563 void * _res = NULL;
15564 int _mark = p->mark;
15565 { // import_from_as_names ','
15566 if (p->error_indicator) {
15567 D(p->level--);
15568 return NULL;
15569 }
15570 D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15571 Token * _literal;
15572 asdl_seq* import_from_as_names_var;
15573 if (
15574 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
15575 &&
15576 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15577 )
15578 {
15579 D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15580 _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
15581 if (_res == NULL && PyErr_Occurred()) {
15582 p->error_indicator = 1;
15583 D(p->level--);
15584 return NULL;
15585 }
15586 goto done;
15587 }
15588 p->mark = _mark;
15589 D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
15590 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','"));
15591 }
15592 _res = NULL;
15593 done:
15594 D(p->level--);
15595 return _res;
15596}
15597
15598// _loop0_1: NEWLINE
15599static asdl_seq *
15600_loop0_1_rule(Parser *p)
15601{
15602 D(p->level++);
15603 if (p->error_indicator) {
15604 D(p->level--);
15605 return NULL;
15606 }
15607 void *_res = NULL;
15608 int _mark = p->mark;
15609 int _start_mark = p->mark;
15610 void **_children = PyMem_Malloc(sizeof(void *));
15611 if (!_children) {
15612 p->error_indicator = 1;
15613 PyErr_NoMemory();
15614 D(p->level--);
15615 return NULL;
15616 }
15617 ssize_t _children_capacity = 1;
15618 ssize_t _n = 0;
15619 { // NEWLINE
15620 if (p->error_indicator) {
15621 D(p->level--);
15622 return NULL;
15623 }
15624 D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15625 Token * newline_var;
15626 while (
15627 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15628 )
15629 {
15630 _res = newline_var;
15631 if (_n == _children_capacity) {
15632 _children_capacity *= 2;
15633 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15634 if (!_new_children) {
15635 p->error_indicator = 1;
15636 PyErr_NoMemory();
15637 D(p->level--);
15638 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015639 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015640 _children = _new_children;
15641 }
15642 _children[_n++] = _res;
15643 _mark = p->mark;
15644 }
15645 p->mark = _mark;
15646 D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
15647 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15648 }
15649 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15650 if (!_seq) {
15651 PyMem_Free(_children);
15652 p->error_indicator = 1;
15653 PyErr_NoMemory();
15654 D(p->level--);
15655 return NULL;
15656 }
15657 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15658 PyMem_Free(_children);
15659 _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq);
15660 D(p->level--);
15661 return _seq;
15662}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015663
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015664// _loop0_2: NEWLINE
15665static asdl_seq *
15666_loop0_2_rule(Parser *p)
15667{
15668 D(p->level++);
15669 if (p->error_indicator) {
15670 D(p->level--);
15671 return NULL;
15672 }
15673 void *_res = NULL;
15674 int _mark = p->mark;
15675 int _start_mark = p->mark;
15676 void **_children = PyMem_Malloc(sizeof(void *));
15677 if (!_children) {
15678 p->error_indicator = 1;
15679 PyErr_NoMemory();
15680 D(p->level--);
15681 return NULL;
15682 }
15683 ssize_t _children_capacity = 1;
15684 ssize_t _n = 0;
15685 { // NEWLINE
15686 if (p->error_indicator) {
15687 D(p->level--);
15688 return NULL;
15689 }
15690 D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15691 Token * newline_var;
15692 while (
15693 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15694 )
15695 {
15696 _res = newline_var;
15697 if (_n == _children_capacity) {
15698 _children_capacity *= 2;
15699 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15700 if (!_new_children) {
15701 p->error_indicator = 1;
15702 PyErr_NoMemory();
15703 D(p->level--);
15704 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015705 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015706 _children = _new_children;
15707 }
15708 _children[_n++] = _res;
15709 _mark = p->mark;
15710 }
15711 p->mark = _mark;
15712 D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
15713 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15714 }
15715 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15716 if (!_seq) {
15717 PyMem_Free(_children);
15718 p->error_indicator = 1;
15719 PyErr_NoMemory();
15720 D(p->level--);
15721 return NULL;
15722 }
15723 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15724 PyMem_Free(_children);
15725 _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq);
15726 D(p->level--);
15727 return _seq;
15728}
15729
15730// _loop0_4: ',' expression
15731static asdl_seq *
15732_loop0_4_rule(Parser *p)
15733{
15734 D(p->level++);
15735 if (p->error_indicator) {
15736 D(p->level--);
15737 return NULL;
15738 }
15739 void *_res = NULL;
15740 int _mark = p->mark;
15741 int _start_mark = p->mark;
15742 void **_children = PyMem_Malloc(sizeof(void *));
15743 if (!_children) {
15744 p->error_indicator = 1;
15745 PyErr_NoMemory();
15746 D(p->level--);
15747 return NULL;
15748 }
15749 ssize_t _children_capacity = 1;
15750 ssize_t _n = 0;
15751 { // ',' expression
15752 if (p->error_indicator) {
15753 D(p->level--);
15754 return NULL;
15755 }
15756 D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15757 Token * _literal;
15758 expr_ty elem;
15759 while (
15760 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15761 &&
15762 (elem = expression_rule(p)) // expression
15763 )
15764 {
15765 _res = elem;
15766 if (_res == NULL && PyErr_Occurred()) {
15767 p->error_indicator = 1;
15768 PyMem_Free(_children);
15769 D(p->level--);
15770 return NULL;
15771 }
15772 if (_n == _children_capacity) {
15773 _children_capacity *= 2;
15774 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15775 if (!_new_children) {
15776 p->error_indicator = 1;
15777 PyErr_NoMemory();
15778 D(p->level--);
15779 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015780 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015781 _children = _new_children;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015782 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015783 _children[_n++] = _res;
15784 _mark = p->mark;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015785 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015786 p->mark = _mark;
15787 D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
15788 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015789 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015790 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15791 if (!_seq) {
15792 PyMem_Free(_children);
15793 p->error_indicator = 1;
15794 PyErr_NoMemory();
15795 D(p->level--);
15796 return NULL;
15797 }
15798 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15799 PyMem_Free(_children);
15800 _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
15801 D(p->level--);
15802 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015803}
15804
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015805// _gather_3: expression _loop0_4
15806static asdl_seq *
15807_gather_3_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015808{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015809 D(p->level++);
15810 if (p->error_indicator) {
15811 D(p->level--);
15812 return NULL;
15813 }
15814 asdl_seq * _res = NULL;
15815 int _mark = p->mark;
15816 { // expression _loop0_4
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 D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15822 expr_ty elem;
15823 asdl_seq * seq;
15824 if (
15825 (elem = expression_rule(p)) // expression
15826 &&
15827 (seq = _loop0_4_rule(p)) // _loop0_4
15828 )
15829 {
15830 D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15831 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15832 goto done;
15833 }
15834 p->mark = _mark;
15835 D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ',
15836 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015837 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015838 _res = NULL;
15839 done:
15840 D(p->level--);
15841 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015842}
15843
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015844// _loop0_6: ',' expression
15845static asdl_seq *
15846_loop0_6_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015847{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015848 D(p->level++);
15849 if (p->error_indicator) {
15850 D(p->level--);
15851 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015852 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015853 void *_res = NULL;
15854 int _mark = p->mark;
15855 int _start_mark = p->mark;
15856 void **_children = PyMem_Malloc(sizeof(void *));
15857 if (!_children) {
15858 p->error_indicator = 1;
15859 PyErr_NoMemory();
15860 D(p->level--);
15861 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015862 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015863 ssize_t _children_capacity = 1;
15864 ssize_t _n = 0;
15865 { // ',' expression
15866 if (p->error_indicator) {
15867 D(p->level--);
15868 return NULL;
15869 }
15870 D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15871 Token * _literal;
15872 expr_ty elem;
15873 while (
15874 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15875 &&
15876 (elem = expression_rule(p)) // expression
15877 )
15878 {
15879 _res = elem;
15880 if (_res == NULL && PyErr_Occurred()) {
15881 p->error_indicator = 1;
15882 PyMem_Free(_children);
15883 D(p->level--);
15884 return NULL;
15885 }
15886 if (_n == _children_capacity) {
15887 _children_capacity *= 2;
15888 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15889 if (!_new_children) {
15890 p->error_indicator = 1;
15891 PyErr_NoMemory();
15892 D(p->level--);
15893 return NULL;
15894 }
15895 _children = _new_children;
15896 }
15897 _children[_n++] = _res;
15898 _mark = p->mark;
15899 }
15900 p->mark = _mark;
15901 D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
15902 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
15903 }
15904 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15905 if (!_seq) {
15906 PyMem_Free(_children);
15907 p->error_indicator = 1;
15908 PyErr_NoMemory();
15909 D(p->level--);
15910 return NULL;
15911 }
15912 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15913 PyMem_Free(_children);
15914 _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
15915 D(p->level--);
15916 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015917}
15918
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015919// _gather_5: expression _loop0_6
15920static asdl_seq *
15921_gather_5_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015922{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015923 D(p->level++);
15924 if (p->error_indicator) {
15925 D(p->level--);
15926 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015927 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015928 asdl_seq * _res = NULL;
15929 int _mark = p->mark;
15930 { // expression _loop0_6
15931 if (p->error_indicator) {
15932 D(p->level--);
15933 return NULL;
15934 }
15935 D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15936 expr_ty elem;
15937 asdl_seq * seq;
15938 if (
15939 (elem = expression_rule(p)) // expression
15940 &&
15941 (seq = _loop0_6_rule(p)) // _loop0_6
15942 )
15943 {
15944 D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15945 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15946 goto done;
15947 }
15948 p->mark = _mark;
15949 D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ',
15950 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6"));
15951 }
15952 _res = NULL;
15953 done:
15954 D(p->level--);
15955 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015956}
15957
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015958// _loop0_8: ',' expression
15959static asdl_seq *
15960_loop0_8_rule(Parser *p)
15961{
15962 D(p->level++);
15963 if (p->error_indicator) {
15964 D(p->level--);
15965 return NULL;
15966 }
15967 void *_res = NULL;
15968 int _mark = p->mark;
15969 int _start_mark = p->mark;
15970 void **_children = PyMem_Malloc(sizeof(void *));
15971 if (!_children) {
15972 p->error_indicator = 1;
15973 PyErr_NoMemory();
15974 D(p->level--);
15975 return NULL;
15976 }
15977 ssize_t _children_capacity = 1;
15978 ssize_t _n = 0;
15979 { // ',' expression
15980 if (p->error_indicator) {
15981 D(p->level--);
15982 return NULL;
15983 }
15984 D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15985 Token * _literal;
15986 expr_ty elem;
15987 while (
15988 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15989 &&
15990 (elem = expression_rule(p)) // expression
15991 )
15992 {
15993 _res = elem;
15994 if (_res == NULL && PyErr_Occurred()) {
15995 p->error_indicator = 1;
15996 PyMem_Free(_children);
15997 D(p->level--);
15998 return NULL;
15999 }
16000 if (_n == _children_capacity) {
16001 _children_capacity *= 2;
16002 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16003 if (!_new_children) {
16004 p->error_indicator = 1;
16005 PyErr_NoMemory();
16006 D(p->level--);
16007 return NULL;
16008 }
16009 _children = _new_children;
16010 }
16011 _children[_n++] = _res;
16012 _mark = p->mark;
16013 }
16014 p->mark = _mark;
16015 D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
16016 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16017 }
16018 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16019 if (!_seq) {
16020 PyMem_Free(_children);
16021 p->error_indicator = 1;
16022 PyErr_NoMemory();
16023 D(p->level--);
16024 return NULL;
16025 }
16026 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16027 PyMem_Free(_children);
16028 _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
16029 D(p->level--);
16030 return _seq;
16031}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016032
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016033// _gather_7: expression _loop0_8
16034static asdl_seq *
16035_gather_7_rule(Parser *p)
16036{
16037 D(p->level++);
16038 if (p->error_indicator) {
16039 D(p->level--);
16040 return NULL;
16041 }
16042 asdl_seq * _res = NULL;
16043 int _mark = p->mark;
16044 { // expression _loop0_8
16045 if (p->error_indicator) {
16046 D(p->level--);
16047 return NULL;
16048 }
16049 D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16050 expr_ty elem;
16051 asdl_seq * seq;
16052 if (
16053 (elem = expression_rule(p)) // expression
16054 &&
16055 (seq = _loop0_8_rule(p)) // _loop0_8
16056 )
16057 {
16058 D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16059 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16060 goto done;
16061 }
16062 p->mark = _mark;
16063 D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ',
16064 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8"));
16065 }
16066 _res = NULL;
16067 done:
16068 D(p->level--);
16069 return _res;
16070}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016071
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016072// _loop0_10: ',' expression
16073static asdl_seq *
16074_loop0_10_rule(Parser *p)
16075{
16076 D(p->level++);
16077 if (p->error_indicator) {
16078 D(p->level--);
16079 return NULL;
16080 }
16081 void *_res = NULL;
16082 int _mark = p->mark;
16083 int _start_mark = p->mark;
16084 void **_children = PyMem_Malloc(sizeof(void *));
16085 if (!_children) {
16086 p->error_indicator = 1;
16087 PyErr_NoMemory();
16088 D(p->level--);
16089 return NULL;
16090 }
16091 ssize_t _children_capacity = 1;
16092 ssize_t _n = 0;
16093 { // ',' expression
16094 if (p->error_indicator) {
16095 D(p->level--);
16096 return NULL;
16097 }
16098 D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
16099 Token * _literal;
16100 expr_ty elem;
16101 while (
16102 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16103 &&
16104 (elem = expression_rule(p)) // expression
16105 )
16106 {
16107 _res = elem;
16108 if (_res == NULL && PyErr_Occurred()) {
16109 p->error_indicator = 1;
16110 PyMem_Free(_children);
16111 D(p->level--);
16112 return NULL;
16113 }
16114 if (_n == _children_capacity) {
16115 _children_capacity *= 2;
16116 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16117 if (!_new_children) {
16118 p->error_indicator = 1;
16119 PyErr_NoMemory();
16120 D(p->level--);
16121 return NULL;
16122 }
16123 _children = _new_children;
16124 }
16125 _children[_n++] = _res;
16126 _mark = p->mark;
16127 }
16128 p->mark = _mark;
16129 D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
16130 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16131 }
16132 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16133 if (!_seq) {
16134 PyMem_Free(_children);
16135 p->error_indicator = 1;
16136 PyErr_NoMemory();
16137 D(p->level--);
16138 return NULL;
16139 }
16140 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16141 PyMem_Free(_children);
16142 _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
16143 D(p->level--);
16144 return _seq;
16145}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016146
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016147// _gather_9: expression _loop0_10
16148static asdl_seq *
16149_gather_9_rule(Parser *p)
16150{
16151 D(p->level++);
16152 if (p->error_indicator) {
16153 D(p->level--);
16154 return NULL;
16155 }
16156 asdl_seq * _res = NULL;
16157 int _mark = p->mark;
16158 { // expression _loop0_10
16159 if (p->error_indicator) {
16160 D(p->level--);
16161 return NULL;
16162 }
16163 D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16164 expr_ty elem;
16165 asdl_seq * seq;
16166 if (
16167 (elem = expression_rule(p)) // expression
16168 &&
16169 (seq = _loop0_10_rule(p)) // _loop0_10
16170 )
16171 {
16172 D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16173 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16174 goto done;
16175 }
16176 p->mark = _mark;
16177 D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ',
16178 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10"));
16179 }
16180 _res = NULL;
16181 done:
16182 D(p->level--);
16183 return _res;
16184}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016185
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016186// _loop1_11: statement
16187static asdl_seq *
16188_loop1_11_rule(Parser *p)
16189{
16190 D(p->level++);
16191 if (p->error_indicator) {
16192 D(p->level--);
16193 return NULL;
16194 }
16195 void *_res = NULL;
16196 int _mark = p->mark;
16197 int _start_mark = p->mark;
16198 void **_children = PyMem_Malloc(sizeof(void *));
16199 if (!_children) {
16200 p->error_indicator = 1;
16201 PyErr_NoMemory();
16202 D(p->level--);
16203 return NULL;
16204 }
16205 ssize_t _children_capacity = 1;
16206 ssize_t _n = 0;
16207 { // statement
16208 if (p->error_indicator) {
16209 D(p->level--);
16210 return NULL;
16211 }
16212 D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
16213 asdl_seq* statement_var;
16214 while (
16215 (statement_var = statement_rule(p)) // statement
16216 )
16217 {
16218 _res = statement_var;
16219 if (_n == _children_capacity) {
16220 _children_capacity *= 2;
16221 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16222 if (!_new_children) {
16223 p->error_indicator = 1;
16224 PyErr_NoMemory();
16225 D(p->level--);
16226 return NULL;
16227 }
16228 _children = _new_children;
16229 }
16230 _children[_n++] = _res;
16231 _mark = p->mark;
16232 }
16233 p->mark = _mark;
16234 D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ',
16235 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
16236 }
16237 if (_n == 0 || p->error_indicator) {
16238 PyMem_Free(_children);
16239 D(p->level--);
16240 return NULL;
16241 }
16242 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16243 if (!_seq) {
16244 PyMem_Free(_children);
16245 p->error_indicator = 1;
16246 PyErr_NoMemory();
16247 D(p->level--);
16248 return NULL;
16249 }
16250 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16251 PyMem_Free(_children);
16252 _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
16253 D(p->level--);
16254 return _seq;
16255}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016256
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016257// _loop0_13: ';' small_stmt
16258static asdl_seq *
16259_loop0_13_rule(Parser *p)
16260{
16261 D(p->level++);
16262 if (p->error_indicator) {
16263 D(p->level--);
16264 return NULL;
16265 }
16266 void *_res = NULL;
16267 int _mark = p->mark;
16268 int _start_mark = p->mark;
16269 void **_children = PyMem_Malloc(sizeof(void *));
16270 if (!_children) {
16271 p->error_indicator = 1;
16272 PyErr_NoMemory();
16273 D(p->level--);
16274 return NULL;
16275 }
16276 ssize_t _children_capacity = 1;
16277 ssize_t _n = 0;
16278 { // ';' small_stmt
16279 if (p->error_indicator) {
16280 D(p->level--);
16281 return NULL;
16282 }
16283 D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt"));
16284 Token * _literal;
16285 stmt_ty elem;
16286 while (
16287 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
16288 &&
16289 (elem = small_stmt_rule(p)) // small_stmt
16290 )
16291 {
16292 _res = elem;
16293 if (_res == NULL && PyErr_Occurred()) {
16294 p->error_indicator = 1;
16295 PyMem_Free(_children);
16296 D(p->level--);
16297 return NULL;
16298 }
16299 if (_n == _children_capacity) {
16300 _children_capacity *= 2;
16301 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16302 if (!_new_children) {
16303 p->error_indicator = 1;
16304 PyErr_NoMemory();
16305 D(p->level--);
16306 return NULL;
16307 }
16308 _children = _new_children;
16309 }
16310 _children[_n++] = _res;
16311 _mark = p->mark;
16312 }
16313 p->mark = _mark;
16314 D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
16315 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt"));
16316 }
16317 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16318 if (!_seq) {
16319 PyMem_Free(_children);
16320 p->error_indicator = 1;
16321 PyErr_NoMemory();
16322 D(p->level--);
16323 return NULL;
16324 }
16325 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16326 PyMem_Free(_children);
16327 _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
16328 D(p->level--);
16329 return _seq;
16330}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016331
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016332// _gather_12: small_stmt _loop0_13
16333static asdl_seq *
16334_gather_12_rule(Parser *p)
16335{
16336 D(p->level++);
16337 if (p->error_indicator) {
16338 D(p->level--);
16339 return NULL;
16340 }
16341 asdl_seq * _res = NULL;
16342 int _mark = p->mark;
16343 { // small_stmt _loop0_13
16344 if (p->error_indicator) {
16345 D(p->level--);
16346 return NULL;
16347 }
16348 D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16349 stmt_ty elem;
16350 asdl_seq * seq;
16351 if (
16352 (elem = small_stmt_rule(p)) // small_stmt
16353 &&
16354 (seq = _loop0_13_rule(p)) // _loop0_13
16355 )
16356 {
16357 D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16358 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16359 goto done;
16360 }
16361 p->mark = _mark;
16362 D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ',
16363 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13"));
16364 }
16365 _res = NULL;
16366 done:
16367 D(p->level--);
16368 return _res;
16369}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016370
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016371// _tmp_14: 'import' | 'from'
16372static void *
16373_tmp_14_rule(Parser *p)
16374{
16375 D(p->level++);
16376 if (p->error_indicator) {
16377 D(p->level--);
16378 return NULL;
16379 }
16380 void * _res = NULL;
16381 int _mark = p->mark;
16382 { // 'import'
16383 if (p->error_indicator) {
16384 D(p->level--);
16385 return NULL;
16386 }
16387 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
16388 Token * _keyword;
16389 if (
16390 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
16391 )
16392 {
16393 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
16394 _res = _keyword;
16395 goto done;
16396 }
16397 p->mark = _mark;
16398 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16399 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
16400 }
16401 { // 'from'
16402 if (p->error_indicator) {
16403 D(p->level--);
16404 return NULL;
16405 }
16406 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
16407 Token * _keyword;
16408 if (
16409 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
16410 )
16411 {
16412 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
16413 _res = _keyword;
16414 goto done;
16415 }
16416 p->mark = _mark;
16417 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16418 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
16419 }
16420 _res = NULL;
16421 done:
16422 D(p->level--);
16423 return _res;
16424}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016425
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016426// _tmp_15: 'def' | '@' | ASYNC
16427static void *
16428_tmp_15_rule(Parser *p)
16429{
16430 D(p->level++);
16431 if (p->error_indicator) {
16432 D(p->level--);
16433 return NULL;
16434 }
16435 void * _res = NULL;
16436 int _mark = p->mark;
16437 { // 'def'
16438 if (p->error_indicator) {
16439 D(p->level--);
16440 return NULL;
16441 }
16442 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
16443 Token * _keyword;
16444 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016445 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016446 )
16447 {
16448 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
16449 _res = _keyword;
16450 goto done;
16451 }
16452 p->mark = _mark;
16453 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16454 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
16455 }
16456 { // '@'
16457 if (p->error_indicator) {
16458 D(p->level--);
16459 return NULL;
16460 }
16461 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16462 Token * _literal;
16463 if (
16464 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16465 )
16466 {
16467 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16468 _res = _literal;
16469 goto done;
16470 }
16471 p->mark = _mark;
16472 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16473 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16474 }
16475 { // ASYNC
16476 if (p->error_indicator) {
16477 D(p->level--);
16478 return NULL;
16479 }
16480 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16481 Token * async_var;
16482 if (
16483 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16484 )
16485 {
16486 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16487 _res = async_var;
16488 goto done;
16489 }
16490 p->mark = _mark;
16491 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16492 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16493 }
16494 _res = NULL;
16495 done:
16496 D(p->level--);
16497 return _res;
16498}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016499
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016500// _tmp_16: 'class' | '@'
16501static void *
16502_tmp_16_rule(Parser *p)
16503{
16504 D(p->level++);
16505 if (p->error_indicator) {
16506 D(p->level--);
16507 return NULL;
16508 }
16509 void * _res = NULL;
16510 int _mark = p->mark;
16511 { // 'class'
16512 if (p->error_indicator) {
16513 D(p->level--);
16514 return NULL;
16515 }
16516 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
16517 Token * _keyword;
16518 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016519 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016520 )
16521 {
16522 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
16523 _res = _keyword;
16524 goto done;
16525 }
16526 p->mark = _mark;
16527 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16528 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
16529 }
16530 { // '@'
16531 if (p->error_indicator) {
16532 D(p->level--);
16533 return NULL;
16534 }
16535 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16536 Token * _literal;
16537 if (
16538 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16539 )
16540 {
16541 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16542 _res = _literal;
16543 goto done;
16544 }
16545 p->mark = _mark;
16546 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16547 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16548 }
16549 _res = NULL;
16550 done:
16551 D(p->level--);
16552 return _res;
16553}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016554
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016555// _tmp_17: 'with' | ASYNC
16556static void *
16557_tmp_17_rule(Parser *p)
16558{
16559 D(p->level++);
16560 if (p->error_indicator) {
16561 D(p->level--);
16562 return NULL;
16563 }
16564 void * _res = NULL;
16565 int _mark = p->mark;
16566 { // 'with'
16567 if (p->error_indicator) {
16568 D(p->level--);
16569 return NULL;
16570 }
16571 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
16572 Token * _keyword;
16573 if (
16574 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
16575 )
16576 {
16577 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
16578 _res = _keyword;
16579 goto done;
16580 }
16581 p->mark = _mark;
16582 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16583 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
16584 }
16585 { // ASYNC
16586 if (p->error_indicator) {
16587 D(p->level--);
16588 return NULL;
16589 }
16590 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16591 Token * async_var;
16592 if (
16593 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16594 )
16595 {
16596 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16597 _res = async_var;
16598 goto done;
16599 }
16600 p->mark = _mark;
16601 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16602 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16603 }
16604 _res = NULL;
16605 done:
16606 D(p->level--);
16607 return _res;
16608}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016609
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016610// _tmp_18: 'for' | ASYNC
16611static void *
16612_tmp_18_rule(Parser *p)
16613{
16614 D(p->level++);
16615 if (p->error_indicator) {
16616 D(p->level--);
16617 return NULL;
16618 }
16619 void * _res = NULL;
16620 int _mark = p->mark;
16621 { // 'for'
16622 if (p->error_indicator) {
16623 D(p->level--);
16624 return NULL;
16625 }
16626 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
16627 Token * _keyword;
16628 if (
16629 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
16630 )
16631 {
16632 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
16633 _res = _keyword;
16634 goto done;
16635 }
16636 p->mark = _mark;
16637 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16638 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
16639 }
16640 { // ASYNC
16641 if (p->error_indicator) {
16642 D(p->level--);
16643 return NULL;
16644 }
16645 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16646 Token * async_var;
16647 if (
16648 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16649 )
16650 {
16651 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16652 _res = async_var;
16653 goto done;
16654 }
16655 p->mark = _mark;
16656 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16657 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16658 }
16659 _res = NULL;
16660 done:
16661 D(p->level--);
16662 return _res;
16663}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016664
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016665// _tmp_19: '=' annotated_rhs
16666static void *
16667_tmp_19_rule(Parser *p)
16668{
16669 D(p->level++);
16670 if (p->error_indicator) {
16671 D(p->level--);
16672 return NULL;
16673 }
16674 void * _res = NULL;
16675 int _mark = p->mark;
16676 { // '=' annotated_rhs
16677 if (p->error_indicator) {
16678 D(p->level--);
16679 return NULL;
16680 }
16681 D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16682 Token * _literal;
16683 expr_ty d;
16684 if (
16685 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16686 &&
16687 (d = annotated_rhs_rule(p)) // annotated_rhs
16688 )
16689 {
16690 D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16691 _res = d;
16692 if (_res == NULL && PyErr_Occurred()) {
16693 p->error_indicator = 1;
16694 D(p->level--);
16695 return NULL;
16696 }
16697 goto done;
16698 }
16699 p->mark = _mark;
16700 D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ',
16701 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16702 }
16703 _res = NULL;
16704 done:
16705 D(p->level--);
16706 return _res;
16707}
16708
16709// _tmp_20: '(' single_target ')' | single_subscript_attribute_target
16710static void *
16711_tmp_20_rule(Parser *p)
16712{
16713 D(p->level++);
16714 if (p->error_indicator) {
16715 D(p->level--);
16716 return NULL;
16717 }
16718 void * _res = NULL;
16719 int _mark = p->mark;
16720 { // '(' single_target ')'
16721 if (p->error_indicator) {
16722 D(p->level--);
16723 return NULL;
16724 }
16725 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16726 Token * _literal;
16727 Token * _literal_1;
16728 expr_ty b;
16729 if (
16730 (_literal = _PyPegen_expect_token(p, 7)) // token='('
16731 &&
16732 (b = single_target_rule(p)) // single_target
16733 &&
16734 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
16735 )
16736 {
16737 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16738 _res = b;
16739 if (_res == NULL && PyErr_Occurred()) {
16740 p->error_indicator = 1;
16741 D(p->level--);
16742 return NULL;
16743 }
16744 goto done;
16745 }
16746 p->mark = _mark;
16747 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16748 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
16749 }
16750 { // single_subscript_attribute_target
16751 if (p->error_indicator) {
16752 D(p->level--);
16753 return NULL;
16754 }
16755 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16756 expr_ty single_subscript_attribute_target_var;
16757 if (
16758 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
16759 )
16760 {
16761 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16762 _res = single_subscript_attribute_target_var;
16763 goto done;
16764 }
16765 p->mark = _mark;
16766 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16767 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
16768 }
16769 _res = NULL;
16770 done:
16771 D(p->level--);
16772 return _res;
16773}
16774
16775// _tmp_21: '=' annotated_rhs
16776static void *
16777_tmp_21_rule(Parser *p)
16778{
16779 D(p->level++);
16780 if (p->error_indicator) {
16781 D(p->level--);
16782 return NULL;
16783 }
16784 void * _res = NULL;
16785 int _mark = p->mark;
16786 { // '=' annotated_rhs
16787 if (p->error_indicator) {
16788 D(p->level--);
16789 return NULL;
16790 }
16791 D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16792 Token * _literal;
16793 expr_ty d;
16794 if (
16795 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16796 &&
16797 (d = annotated_rhs_rule(p)) // annotated_rhs
16798 )
16799 {
16800 D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16801 _res = d;
16802 if (_res == NULL && PyErr_Occurred()) {
16803 p->error_indicator = 1;
16804 D(p->level--);
16805 return NULL;
16806 }
16807 goto done;
16808 }
16809 p->mark = _mark;
16810 D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ',
16811 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16812 }
16813 _res = NULL;
16814 done:
16815 D(p->level--);
16816 return _res;
16817}
16818
16819// _loop1_22: (star_targets '=')
16820static asdl_seq *
16821_loop1_22_rule(Parser *p)
16822{
16823 D(p->level++);
16824 if (p->error_indicator) {
16825 D(p->level--);
16826 return NULL;
16827 }
16828 void *_res = NULL;
16829 int _mark = p->mark;
16830 int _start_mark = p->mark;
16831 void **_children = PyMem_Malloc(sizeof(void *));
16832 if (!_children) {
16833 p->error_indicator = 1;
16834 PyErr_NoMemory();
16835 D(p->level--);
16836 return NULL;
16837 }
16838 ssize_t _children_capacity = 1;
16839 ssize_t _n = 0;
16840 { // (star_targets '=')
16841 if (p->error_indicator) {
16842 D(p->level--);
16843 return NULL;
16844 }
16845 D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030016846 void *_tmp_138_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016847 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030016848 (_tmp_138_var = _tmp_138_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016849 )
16850 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030016851 _res = _tmp_138_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016852 if (_n == _children_capacity) {
16853 _children_capacity *= 2;
16854 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16855 if (!_new_children) {
16856 p->error_indicator = 1;
16857 PyErr_NoMemory();
16858 D(p->level--);
16859 return NULL;
16860 }
16861 _children = _new_children;
16862 }
16863 _children[_n++] = _res;
16864 _mark = p->mark;
16865 }
16866 p->mark = _mark;
16867 D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ',
16868 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
16869 }
16870 if (_n == 0 || p->error_indicator) {
16871 PyMem_Free(_children);
16872 D(p->level--);
16873 return NULL;
16874 }
16875 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16876 if (!_seq) {
16877 PyMem_Free(_children);
16878 p->error_indicator = 1;
16879 PyErr_NoMemory();
16880 D(p->level--);
16881 return NULL;
16882 }
16883 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16884 PyMem_Free(_children);
16885 _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
16886 D(p->level--);
16887 return _seq;
16888}
16889
16890// _tmp_23: yield_expr | star_expressions
16891static void *
16892_tmp_23_rule(Parser *p)
16893{
16894 D(p->level++);
16895 if (p->error_indicator) {
16896 D(p->level--);
16897 return NULL;
16898 }
16899 void * _res = NULL;
16900 int _mark = p->mark;
16901 { // yield_expr
16902 if (p->error_indicator) {
16903 D(p->level--);
16904 return NULL;
16905 }
16906 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16907 expr_ty yield_expr_var;
16908 if (
16909 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16910 )
16911 {
16912 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16913 _res = yield_expr_var;
16914 goto done;
16915 }
16916 p->mark = _mark;
16917 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16918 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16919 }
16920 { // star_expressions
16921 if (p->error_indicator) {
16922 D(p->level--);
16923 return NULL;
16924 }
16925 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16926 expr_ty star_expressions_var;
16927 if (
16928 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16929 )
16930 {
16931 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16932 _res = star_expressions_var;
16933 goto done;
16934 }
16935 p->mark = _mark;
16936 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16937 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16938 }
16939 _res = NULL;
16940 done:
16941 D(p->level--);
16942 return _res;
16943}
16944
16945// _tmp_24: yield_expr | star_expressions
16946static void *
16947_tmp_24_rule(Parser *p)
16948{
16949 D(p->level++);
16950 if (p->error_indicator) {
16951 D(p->level--);
16952 return NULL;
16953 }
16954 void * _res = NULL;
16955 int _mark = p->mark;
16956 { // yield_expr
16957 if (p->error_indicator) {
16958 D(p->level--);
16959 return NULL;
16960 }
16961 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16962 expr_ty yield_expr_var;
16963 if (
16964 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16965 )
16966 {
16967 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16968 _res = yield_expr_var;
16969 goto done;
16970 }
16971 p->mark = _mark;
16972 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16973 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16974 }
16975 { // star_expressions
16976 if (p->error_indicator) {
16977 D(p->level--);
16978 return NULL;
16979 }
16980 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16981 expr_ty star_expressions_var;
16982 if (
16983 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16984 )
16985 {
16986 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16987 _res = star_expressions_var;
16988 goto done;
16989 }
16990 p->mark = _mark;
16991 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16992 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16993 }
16994 _res = NULL;
16995 done:
16996 D(p->level--);
16997 return _res;
16998}
16999
17000// _loop0_26: ',' NAME
17001static asdl_seq *
17002_loop0_26_rule(Parser *p)
17003{
17004 D(p->level++);
17005 if (p->error_indicator) {
17006 D(p->level--);
17007 return NULL;
17008 }
17009 void *_res = NULL;
17010 int _mark = p->mark;
17011 int _start_mark = p->mark;
17012 void **_children = PyMem_Malloc(sizeof(void *));
17013 if (!_children) {
17014 p->error_indicator = 1;
17015 PyErr_NoMemory();
17016 D(p->level--);
17017 return NULL;
17018 }
17019 ssize_t _children_capacity = 1;
17020 ssize_t _n = 0;
17021 { // ',' NAME
17022 if (p->error_indicator) {
17023 D(p->level--);
17024 return NULL;
17025 }
17026 D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17027 Token * _literal;
17028 expr_ty elem;
17029 while (
17030 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17031 &&
17032 (elem = _PyPegen_name_token(p)) // NAME
17033 )
17034 {
17035 _res = elem;
17036 if (_res == NULL && PyErr_Occurred()) {
17037 p->error_indicator = 1;
17038 PyMem_Free(_children);
17039 D(p->level--);
17040 return NULL;
17041 }
17042 if (_n == _children_capacity) {
17043 _children_capacity *= 2;
17044 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17045 if (!_new_children) {
17046 p->error_indicator = 1;
17047 PyErr_NoMemory();
17048 D(p->level--);
17049 return NULL;
17050 }
17051 _children = _new_children;
17052 }
17053 _children[_n++] = _res;
17054 _mark = p->mark;
17055 }
17056 p->mark = _mark;
17057 D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
17058 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17059 }
17060 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17061 if (!_seq) {
17062 PyMem_Free(_children);
17063 p->error_indicator = 1;
17064 PyErr_NoMemory();
17065 D(p->level--);
17066 return NULL;
17067 }
17068 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17069 PyMem_Free(_children);
17070 _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
17071 D(p->level--);
17072 return _seq;
17073}
17074
17075// _gather_25: NAME _loop0_26
17076static asdl_seq *
17077_gather_25_rule(Parser *p)
17078{
17079 D(p->level++);
17080 if (p->error_indicator) {
17081 D(p->level--);
17082 return NULL;
17083 }
17084 asdl_seq * _res = NULL;
17085 int _mark = p->mark;
17086 { // NAME _loop0_26
17087 if (p->error_indicator) {
17088 D(p->level--);
17089 return NULL;
17090 }
17091 D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17092 expr_ty elem;
17093 asdl_seq * seq;
17094 if (
17095 (elem = _PyPegen_name_token(p)) // NAME
17096 &&
17097 (seq = _loop0_26_rule(p)) // _loop0_26
17098 )
17099 {
17100 D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17101 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17102 goto done;
17103 }
17104 p->mark = _mark;
17105 D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ',
17106 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26"));
17107 }
17108 _res = NULL;
17109 done:
17110 D(p->level--);
17111 return _res;
17112}
17113
17114// _loop0_28: ',' NAME
17115static asdl_seq *
17116_loop0_28_rule(Parser *p)
17117{
17118 D(p->level++);
17119 if (p->error_indicator) {
17120 D(p->level--);
17121 return NULL;
17122 }
17123 void *_res = NULL;
17124 int _mark = p->mark;
17125 int _start_mark = p->mark;
17126 void **_children = PyMem_Malloc(sizeof(void *));
17127 if (!_children) {
17128 p->error_indicator = 1;
17129 PyErr_NoMemory();
17130 D(p->level--);
17131 return NULL;
17132 }
17133 ssize_t _children_capacity = 1;
17134 ssize_t _n = 0;
17135 { // ',' NAME
17136 if (p->error_indicator) {
17137 D(p->level--);
17138 return NULL;
17139 }
17140 D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17141 Token * _literal;
17142 expr_ty elem;
17143 while (
17144 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17145 &&
17146 (elem = _PyPegen_name_token(p)) // NAME
17147 )
17148 {
17149 _res = elem;
17150 if (_res == NULL && PyErr_Occurred()) {
17151 p->error_indicator = 1;
17152 PyMem_Free(_children);
17153 D(p->level--);
17154 return NULL;
17155 }
17156 if (_n == _children_capacity) {
17157 _children_capacity *= 2;
17158 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17159 if (!_new_children) {
17160 p->error_indicator = 1;
17161 PyErr_NoMemory();
17162 D(p->level--);
17163 return NULL;
17164 }
17165 _children = _new_children;
17166 }
17167 _children[_n++] = _res;
17168 _mark = p->mark;
17169 }
17170 p->mark = _mark;
17171 D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
17172 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17173 }
17174 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17175 if (!_seq) {
17176 PyMem_Free(_children);
17177 p->error_indicator = 1;
17178 PyErr_NoMemory();
17179 D(p->level--);
17180 return NULL;
17181 }
17182 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17183 PyMem_Free(_children);
17184 _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
17185 D(p->level--);
17186 return _seq;
17187}
17188
17189// _gather_27: NAME _loop0_28
17190static asdl_seq *
17191_gather_27_rule(Parser *p)
17192{
17193 D(p->level++);
17194 if (p->error_indicator) {
17195 D(p->level--);
17196 return NULL;
17197 }
17198 asdl_seq * _res = NULL;
17199 int _mark = p->mark;
17200 { // NAME _loop0_28
17201 if (p->error_indicator) {
17202 D(p->level--);
17203 return NULL;
17204 }
17205 D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17206 expr_ty elem;
17207 asdl_seq * seq;
17208 if (
17209 (elem = _PyPegen_name_token(p)) // NAME
17210 &&
17211 (seq = _loop0_28_rule(p)) // _loop0_28
17212 )
17213 {
17214 D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17215 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17216 goto done;
17217 }
17218 p->mark = _mark;
17219 D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ',
17220 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28"));
17221 }
17222 _res = NULL;
17223 done:
17224 D(p->level--);
17225 return _res;
17226}
17227
17228// _tmp_29: ',' expression
17229static void *
17230_tmp_29_rule(Parser *p)
17231{
17232 D(p->level++);
17233 if (p->error_indicator) {
17234 D(p->level--);
17235 return NULL;
17236 }
17237 void * _res = NULL;
17238 int _mark = p->mark;
17239 { // ',' expression
17240 if (p->error_indicator) {
17241 D(p->level--);
17242 return NULL;
17243 }
17244 D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
17245 Token * _literal;
17246 expr_ty z;
17247 if (
17248 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17249 &&
17250 (z = expression_rule(p)) // expression
17251 )
17252 {
17253 D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
17254 _res = z;
17255 if (_res == NULL && PyErr_Occurred()) {
17256 p->error_indicator = 1;
17257 D(p->level--);
17258 return NULL;
17259 }
17260 goto done;
17261 }
17262 p->mark = _mark;
17263 D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ',
17264 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
17265 }
17266 _res = NULL;
17267 done:
17268 D(p->level--);
17269 return _res;
17270}
17271
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017272// _tmp_30: ';' | NEWLINE
17273static void *
17274_tmp_30_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017275{
17276 D(p->level++);
17277 if (p->error_indicator) {
17278 D(p->level--);
17279 return NULL;
17280 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017281 void * _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017282 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017283 { // ';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017284 if (p->error_indicator) {
17285 D(p->level--);
17286 return NULL;
17287 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017288 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
17289 Token * _literal;
17290 if (
17291 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017292 )
17293 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017294 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
17295 _res = _literal;
17296 goto done;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017297 }
17298 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017299 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17300 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017301 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017302 { // NEWLINE
17303 if (p->error_indicator) {
17304 D(p->level--);
17305 return NULL;
17306 }
17307 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17308 Token * newline_var;
17309 if (
17310 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
17311 )
17312 {
17313 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17314 _res = newline_var;
17315 goto done;
17316 }
17317 p->mark = _mark;
17318 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17319 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017320 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017321 _res = NULL;
17322 done:
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017323 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017324 return _res;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017325}
17326
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017327// _loop0_31: ('.' | '...')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017328static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017329_loop0_31_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017330{
17331 D(p->level++);
17332 if (p->error_indicator) {
17333 D(p->level--);
17334 return NULL;
17335 }
17336 void *_res = NULL;
17337 int _mark = p->mark;
17338 int _start_mark = p->mark;
17339 void **_children = PyMem_Malloc(sizeof(void *));
17340 if (!_children) {
17341 p->error_indicator = 1;
17342 PyErr_NoMemory();
17343 D(p->level--);
17344 return NULL;
17345 }
17346 ssize_t _children_capacity = 1;
17347 ssize_t _n = 0;
17348 { // ('.' | '...')
17349 if (p->error_indicator) {
17350 D(p->level--);
17351 return NULL;
17352 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017353 D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017354 void *_tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017355 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017356 (_tmp_139_var = _tmp_139_rule(p)) // '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017357 )
17358 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017359 _res = _tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017360 if (_n == _children_capacity) {
17361 _children_capacity *= 2;
17362 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17363 if (!_new_children) {
17364 p->error_indicator = 1;
17365 PyErr_NoMemory();
17366 D(p->level--);
17367 return NULL;
17368 }
17369 _children = _new_children;
17370 }
17371 _children[_n++] = _res;
17372 _mark = p->mark;
17373 }
17374 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017375 D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
17376 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17377 }
17378 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17379 if (!_seq) {
17380 PyMem_Free(_children);
17381 p->error_indicator = 1;
17382 PyErr_NoMemory();
17383 D(p->level--);
17384 return NULL;
17385 }
17386 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17387 PyMem_Free(_children);
17388 _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
17389 D(p->level--);
17390 return _seq;
17391}
17392
17393// _loop1_32: ('.' | '...')
17394static asdl_seq *
17395_loop1_32_rule(Parser *p)
17396{
17397 D(p->level++);
17398 if (p->error_indicator) {
17399 D(p->level--);
17400 return NULL;
17401 }
17402 void *_res = NULL;
17403 int _mark = p->mark;
17404 int _start_mark = p->mark;
17405 void **_children = PyMem_Malloc(sizeof(void *));
17406 if (!_children) {
17407 p->error_indicator = 1;
17408 PyErr_NoMemory();
17409 D(p->level--);
17410 return NULL;
17411 }
17412 ssize_t _children_capacity = 1;
17413 ssize_t _n = 0;
17414 { // ('.' | '...')
17415 if (p->error_indicator) {
17416 D(p->level--);
17417 return NULL;
17418 }
17419 D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017420 void *_tmp_140_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017421 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017422 (_tmp_140_var = _tmp_140_rule(p)) // '.' | '...'
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017423 )
17424 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017425 _res = _tmp_140_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017426 if (_n == _children_capacity) {
17427 _children_capacity *= 2;
17428 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17429 if (!_new_children) {
17430 p->error_indicator = 1;
17431 PyErr_NoMemory();
17432 D(p->level--);
17433 return NULL;
17434 }
17435 _children = _new_children;
17436 }
17437 _children[_n++] = _res;
17438 _mark = p->mark;
17439 }
17440 p->mark = _mark;
17441 D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017442 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17443 }
17444 if (_n == 0 || p->error_indicator) {
17445 PyMem_Free(_children);
17446 D(p->level--);
17447 return NULL;
17448 }
17449 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17450 if (!_seq) {
17451 PyMem_Free(_children);
17452 p->error_indicator = 1;
17453 PyErr_NoMemory();
17454 D(p->level--);
17455 return NULL;
17456 }
17457 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17458 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017459 _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017460 D(p->level--);
17461 return _seq;
17462}
17463
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017464// _loop0_34: ',' import_from_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017465static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017466_loop0_34_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017467{
17468 D(p->level++);
17469 if (p->error_indicator) {
17470 D(p->level--);
17471 return NULL;
17472 }
17473 void *_res = NULL;
17474 int _mark = p->mark;
17475 int _start_mark = p->mark;
17476 void **_children = PyMem_Malloc(sizeof(void *));
17477 if (!_children) {
17478 p->error_indicator = 1;
17479 PyErr_NoMemory();
17480 D(p->level--);
17481 return NULL;
17482 }
17483 ssize_t _children_capacity = 1;
17484 ssize_t _n = 0;
17485 { // ',' import_from_as_name
17486 if (p->error_indicator) {
17487 D(p->level--);
17488 return NULL;
17489 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017490 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 +010017491 Token * _literal;
17492 alias_ty elem;
17493 while (
17494 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17495 &&
17496 (elem = import_from_as_name_rule(p)) // import_from_as_name
17497 )
17498 {
17499 _res = elem;
17500 if (_res == NULL && PyErr_Occurred()) {
17501 p->error_indicator = 1;
17502 PyMem_Free(_children);
17503 D(p->level--);
17504 return NULL;
17505 }
17506 if (_n == _children_capacity) {
17507 _children_capacity *= 2;
17508 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17509 if (!_new_children) {
17510 p->error_indicator = 1;
17511 PyErr_NoMemory();
17512 D(p->level--);
17513 return NULL;
17514 }
17515 _children = _new_children;
17516 }
17517 _children[_n++] = _res;
17518 _mark = p->mark;
17519 }
17520 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017521 D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017522 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
17523 }
17524 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17525 if (!_seq) {
17526 PyMem_Free(_children);
17527 p->error_indicator = 1;
17528 PyErr_NoMemory();
17529 D(p->level--);
17530 return NULL;
17531 }
17532 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17533 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017534 _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017535 D(p->level--);
17536 return _seq;
17537}
17538
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017539// _gather_33: import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017540static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017541_gather_33_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017542{
17543 D(p->level++);
17544 if (p->error_indicator) {
17545 D(p->level--);
17546 return NULL;
17547 }
17548 asdl_seq * _res = NULL;
17549 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017550 { // import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017551 if (p->error_indicator) {
17552 D(p->level--);
17553 return NULL;
17554 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017555 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 +010017556 alias_ty elem;
17557 asdl_seq * seq;
17558 if (
17559 (elem = import_from_as_name_rule(p)) // import_from_as_name
17560 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017561 (seq = _loop0_34_rule(p)) // _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017562 )
17563 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017564 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 +010017565 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17566 goto done;
17567 }
17568 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017569 D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ',
17570 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017571 }
17572 _res = NULL;
17573 done:
17574 D(p->level--);
17575 return _res;
17576}
17577
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017578// _tmp_35: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017579static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017580_tmp_35_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017581{
17582 D(p->level++);
17583 if (p->error_indicator) {
17584 D(p->level--);
17585 return NULL;
17586 }
17587 void * _res = NULL;
17588 int _mark = p->mark;
17589 { // 'as' NAME
17590 if (p->error_indicator) {
17591 D(p->level--);
17592 return NULL;
17593 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017594 D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017595 Token * _keyword;
17596 expr_ty z;
17597 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017598 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017599 &&
17600 (z = _PyPegen_name_token(p)) // NAME
17601 )
17602 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017603 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 +010017604 _res = z;
17605 if (_res == NULL && PyErr_Occurred()) {
17606 p->error_indicator = 1;
17607 D(p->level--);
17608 return NULL;
17609 }
17610 goto done;
17611 }
17612 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017613 D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017614 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17615 }
17616 _res = NULL;
17617 done:
17618 D(p->level--);
17619 return _res;
17620}
17621
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017622// _loop0_37: ',' dotted_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017623static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017624_loop0_37_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017625{
17626 D(p->level++);
17627 if (p->error_indicator) {
17628 D(p->level--);
17629 return NULL;
17630 }
17631 void *_res = NULL;
17632 int _mark = p->mark;
17633 int _start_mark = p->mark;
17634 void **_children = PyMem_Malloc(sizeof(void *));
17635 if (!_children) {
17636 p->error_indicator = 1;
17637 PyErr_NoMemory();
17638 D(p->level--);
17639 return NULL;
17640 }
17641 ssize_t _children_capacity = 1;
17642 ssize_t _n = 0;
17643 { // ',' dotted_as_name
17644 if (p->error_indicator) {
17645 D(p->level--);
17646 return NULL;
17647 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017648 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 +010017649 Token * _literal;
17650 alias_ty elem;
17651 while (
17652 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17653 &&
17654 (elem = dotted_as_name_rule(p)) // dotted_as_name
17655 )
17656 {
17657 _res = elem;
17658 if (_res == NULL && PyErr_Occurred()) {
17659 p->error_indicator = 1;
17660 PyMem_Free(_children);
17661 D(p->level--);
17662 return NULL;
17663 }
17664 if (_n == _children_capacity) {
17665 _children_capacity *= 2;
17666 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17667 if (!_new_children) {
17668 p->error_indicator = 1;
17669 PyErr_NoMemory();
17670 D(p->level--);
17671 return NULL;
17672 }
17673 _children = _new_children;
17674 }
17675 _children[_n++] = _res;
17676 _mark = p->mark;
17677 }
17678 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017679 D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017680 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
17681 }
17682 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17683 if (!_seq) {
17684 PyMem_Free(_children);
17685 p->error_indicator = 1;
17686 PyErr_NoMemory();
17687 D(p->level--);
17688 return NULL;
17689 }
17690 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17691 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017692 _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017693 D(p->level--);
17694 return _seq;
17695}
17696
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017697// _gather_36: dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017698static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017699_gather_36_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017700{
17701 D(p->level++);
17702 if (p->error_indicator) {
17703 D(p->level--);
17704 return NULL;
17705 }
17706 asdl_seq * _res = NULL;
17707 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017708 { // dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017709 if (p->error_indicator) {
17710 D(p->level--);
17711 return NULL;
17712 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017713 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 +010017714 alias_ty elem;
17715 asdl_seq * seq;
17716 if (
17717 (elem = dotted_as_name_rule(p)) // dotted_as_name
17718 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017719 (seq = _loop0_37_rule(p)) // _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017720 )
17721 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017722 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 +010017723 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17724 goto done;
17725 }
17726 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017727 D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ',
17728 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017729 }
17730 _res = NULL;
17731 done:
17732 D(p->level--);
17733 return _res;
17734}
17735
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017736// _tmp_38: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017737static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017738_tmp_38_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017739{
17740 D(p->level++);
17741 if (p->error_indicator) {
17742 D(p->level--);
17743 return NULL;
17744 }
17745 void * _res = NULL;
17746 int _mark = p->mark;
17747 { // 'as' NAME
17748 if (p->error_indicator) {
17749 D(p->level--);
17750 return NULL;
17751 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017752 D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017753 Token * _keyword;
17754 expr_ty z;
17755 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017756 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017757 &&
17758 (z = _PyPegen_name_token(p)) // NAME
17759 )
17760 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017761 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 +010017762 _res = z;
17763 if (_res == NULL && PyErr_Occurred()) {
17764 p->error_indicator = 1;
17765 D(p->level--);
17766 return NULL;
17767 }
17768 goto done;
17769 }
17770 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017771 D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017772 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17773 }
17774 _res = NULL;
17775 done:
17776 D(p->level--);
17777 return _res;
17778}
17779
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017780// _loop0_40: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017781static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017782_loop0_40_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017783{
17784 D(p->level++);
17785 if (p->error_indicator) {
17786 D(p->level--);
17787 return NULL;
17788 }
17789 void *_res = NULL;
17790 int _mark = p->mark;
17791 int _start_mark = p->mark;
17792 void **_children = PyMem_Malloc(sizeof(void *));
17793 if (!_children) {
17794 p->error_indicator = 1;
17795 PyErr_NoMemory();
17796 D(p->level--);
17797 return NULL;
17798 }
17799 ssize_t _children_capacity = 1;
17800 ssize_t _n = 0;
17801 { // ',' with_item
17802 if (p->error_indicator) {
17803 D(p->level--);
17804 return NULL;
17805 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017806 D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017807 Token * _literal;
17808 withitem_ty elem;
17809 while (
17810 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17811 &&
17812 (elem = with_item_rule(p)) // with_item
17813 )
17814 {
17815 _res = elem;
17816 if (_res == NULL && PyErr_Occurred()) {
17817 p->error_indicator = 1;
17818 PyMem_Free(_children);
17819 D(p->level--);
17820 return NULL;
17821 }
17822 if (_n == _children_capacity) {
17823 _children_capacity *= 2;
17824 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17825 if (!_new_children) {
17826 p->error_indicator = 1;
17827 PyErr_NoMemory();
17828 D(p->level--);
17829 return NULL;
17830 }
17831 _children = _new_children;
17832 }
17833 _children[_n++] = _res;
17834 _mark = p->mark;
17835 }
17836 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017837 D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017838 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17839 }
17840 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17841 if (!_seq) {
17842 PyMem_Free(_children);
17843 p->error_indicator = 1;
17844 PyErr_NoMemory();
17845 D(p->level--);
17846 return NULL;
17847 }
17848 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17849 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017850 _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017851 D(p->level--);
17852 return _seq;
17853}
17854
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017855// _gather_39: with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017856static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017857_gather_39_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017858{
17859 D(p->level++);
17860 if (p->error_indicator) {
17861 D(p->level--);
17862 return NULL;
17863 }
17864 asdl_seq * _res = NULL;
17865 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017866 { // with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017867 if (p->error_indicator) {
17868 D(p->level--);
17869 return NULL;
17870 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017871 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 +010017872 withitem_ty elem;
17873 asdl_seq * seq;
17874 if (
17875 (elem = with_item_rule(p)) // with_item
17876 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017877 (seq = _loop0_40_rule(p)) // _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017878 )
17879 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017880 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 +010017881 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17882 goto done;
17883 }
17884 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017885 D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ',
17886 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017887 }
17888 _res = NULL;
17889 done:
17890 D(p->level--);
17891 return _res;
17892}
17893
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017894// _loop0_42: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017895static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017896_loop0_42_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017897{
17898 D(p->level++);
17899 if (p->error_indicator) {
17900 D(p->level--);
17901 return NULL;
17902 }
17903 void *_res = NULL;
17904 int _mark = p->mark;
17905 int _start_mark = p->mark;
17906 void **_children = PyMem_Malloc(sizeof(void *));
17907 if (!_children) {
17908 p->error_indicator = 1;
17909 PyErr_NoMemory();
17910 D(p->level--);
17911 return NULL;
17912 }
17913 ssize_t _children_capacity = 1;
17914 ssize_t _n = 0;
17915 { // ',' with_item
17916 if (p->error_indicator) {
17917 D(p->level--);
17918 return NULL;
17919 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017920 D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017921 Token * _literal;
17922 withitem_ty elem;
17923 while (
17924 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17925 &&
17926 (elem = with_item_rule(p)) // with_item
17927 )
17928 {
17929 _res = elem;
17930 if (_res == NULL && PyErr_Occurred()) {
17931 p->error_indicator = 1;
17932 PyMem_Free(_children);
17933 D(p->level--);
17934 return NULL;
17935 }
17936 if (_n == _children_capacity) {
17937 _children_capacity *= 2;
17938 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17939 if (!_new_children) {
17940 p->error_indicator = 1;
17941 PyErr_NoMemory();
17942 D(p->level--);
17943 return NULL;
17944 }
17945 _children = _new_children;
17946 }
17947 _children[_n++] = _res;
17948 _mark = p->mark;
17949 }
17950 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017951 D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017952 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17953 }
17954 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17955 if (!_seq) {
17956 PyMem_Free(_children);
17957 p->error_indicator = 1;
17958 PyErr_NoMemory();
17959 D(p->level--);
17960 return NULL;
17961 }
17962 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17963 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017964 _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017965 D(p->level--);
17966 return _seq;
17967}
17968
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017969// _gather_41: with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017970static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017971_gather_41_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017972{
17973 D(p->level++);
17974 if (p->error_indicator) {
17975 D(p->level--);
17976 return NULL;
17977 }
17978 asdl_seq * _res = NULL;
17979 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017980 { // with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017981 if (p->error_indicator) {
17982 D(p->level--);
17983 return NULL;
17984 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017985 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 +010017986 withitem_ty elem;
17987 asdl_seq * seq;
17988 if (
17989 (elem = with_item_rule(p)) // with_item
17990 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017991 (seq = _loop0_42_rule(p)) // _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017992 )
17993 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017994 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 +010017995 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17996 goto done;
17997 }
17998 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017999 D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
18000 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018001 }
18002 _res = NULL;
18003 done:
18004 D(p->level--);
18005 return _res;
18006}
18007
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018008// _loop0_44: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018009static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018010_loop0_44_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018011{
18012 D(p->level++);
18013 if (p->error_indicator) {
18014 D(p->level--);
18015 return NULL;
18016 }
18017 void *_res = NULL;
18018 int _mark = p->mark;
18019 int _start_mark = p->mark;
18020 void **_children = PyMem_Malloc(sizeof(void *));
18021 if (!_children) {
18022 p->error_indicator = 1;
18023 PyErr_NoMemory();
18024 D(p->level--);
18025 return NULL;
18026 }
18027 ssize_t _children_capacity = 1;
18028 ssize_t _n = 0;
18029 { // ',' with_item
18030 if (p->error_indicator) {
18031 D(p->level--);
18032 return NULL;
18033 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018034 D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018035 Token * _literal;
18036 withitem_ty elem;
18037 while (
18038 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18039 &&
18040 (elem = with_item_rule(p)) // with_item
18041 )
18042 {
18043 _res = elem;
18044 if (_res == NULL && PyErr_Occurred()) {
18045 p->error_indicator = 1;
18046 PyMem_Free(_children);
18047 D(p->level--);
18048 return NULL;
18049 }
18050 if (_n == _children_capacity) {
18051 _children_capacity *= 2;
18052 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18053 if (!_new_children) {
18054 p->error_indicator = 1;
18055 PyErr_NoMemory();
18056 D(p->level--);
18057 return NULL;
18058 }
18059 _children = _new_children;
18060 }
18061 _children[_n++] = _res;
18062 _mark = p->mark;
18063 }
18064 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018065 D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018066 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18067 }
18068 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18069 if (!_seq) {
18070 PyMem_Free(_children);
18071 p->error_indicator = 1;
18072 PyErr_NoMemory();
18073 D(p->level--);
18074 return NULL;
18075 }
18076 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18077 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018078 _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018079 D(p->level--);
18080 return _seq;
18081}
18082
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018083// _gather_43: with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018084static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018085_gather_43_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018086{
18087 D(p->level++);
18088 if (p->error_indicator) {
18089 D(p->level--);
18090 return NULL;
18091 }
18092 asdl_seq * _res = NULL;
18093 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018094 { // with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018095 if (p->error_indicator) {
18096 D(p->level--);
18097 return NULL;
18098 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018099 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 +010018100 withitem_ty elem;
18101 asdl_seq * seq;
18102 if (
18103 (elem = with_item_rule(p)) // with_item
18104 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018105 (seq = _loop0_44_rule(p)) // _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018106 )
18107 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018108 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 +010018109 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18110 goto done;
18111 }
18112 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018113 D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ',
18114 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018115 }
18116 _res = NULL;
18117 done:
18118 D(p->level--);
18119 return _res;
18120}
18121
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018122// _loop0_46: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018123static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018124_loop0_46_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018125{
18126 D(p->level++);
18127 if (p->error_indicator) {
18128 D(p->level--);
18129 return NULL;
18130 }
18131 void *_res = NULL;
18132 int _mark = p->mark;
18133 int _start_mark = p->mark;
18134 void **_children = PyMem_Malloc(sizeof(void *));
18135 if (!_children) {
18136 p->error_indicator = 1;
18137 PyErr_NoMemory();
18138 D(p->level--);
18139 return NULL;
18140 }
18141 ssize_t _children_capacity = 1;
18142 ssize_t _n = 0;
18143 { // ',' with_item
18144 if (p->error_indicator) {
18145 D(p->level--);
18146 return NULL;
18147 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018148 D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018149 Token * _literal;
18150 withitem_ty elem;
18151 while (
18152 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18153 &&
18154 (elem = with_item_rule(p)) // with_item
18155 )
18156 {
18157 _res = elem;
18158 if (_res == NULL && PyErr_Occurred()) {
18159 p->error_indicator = 1;
18160 PyMem_Free(_children);
18161 D(p->level--);
18162 return NULL;
18163 }
18164 if (_n == _children_capacity) {
18165 _children_capacity *= 2;
18166 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18167 if (!_new_children) {
18168 p->error_indicator = 1;
18169 PyErr_NoMemory();
18170 D(p->level--);
18171 return NULL;
18172 }
18173 _children = _new_children;
18174 }
18175 _children[_n++] = _res;
18176 _mark = p->mark;
18177 }
18178 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018179 D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018180 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18181 }
18182 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18183 if (!_seq) {
18184 PyMem_Free(_children);
18185 p->error_indicator = 1;
18186 PyErr_NoMemory();
18187 D(p->level--);
18188 return NULL;
18189 }
18190 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18191 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018192 _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018193 D(p->level--);
18194 return _seq;
18195}
18196
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018197// _gather_45: with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018198static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018199_gather_45_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018200{
18201 D(p->level++);
18202 if (p->error_indicator) {
18203 D(p->level--);
18204 return NULL;
18205 }
18206 asdl_seq * _res = NULL;
18207 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018208 { // with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018209 if (p->error_indicator) {
18210 D(p->level--);
18211 return NULL;
18212 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018213 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 +010018214 withitem_ty elem;
18215 asdl_seq * seq;
18216 if (
18217 (elem = with_item_rule(p)) // with_item
18218 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018219 (seq = _loop0_46_rule(p)) // _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018220 )
18221 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018222 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 +010018223 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18224 goto done;
18225 }
18226 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018227 D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
18228 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018229 }
18230 _res = NULL;
18231 done:
18232 D(p->level--);
18233 return _res;
18234}
18235
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018236// _tmp_47: ',' | ')' | ':'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018237static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018238_tmp_47_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018239{
18240 D(p->level++);
18241 if (p->error_indicator) {
18242 D(p->level--);
18243 return NULL;
18244 }
18245 void * _res = NULL;
18246 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018247 { // ','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018248 if (p->error_indicator) {
18249 D(p->level--);
18250 return NULL;
18251 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018252 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
18253 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018254 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018255 (_literal = _PyPegen_expect_token(p, 12)) // token=','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018256 )
18257 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018258 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
18259 _res = _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018260 goto done;
18261 }
18262 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018263 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18264 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
18265 }
18266 { // ')'
18267 if (p->error_indicator) {
18268 D(p->level--);
18269 return NULL;
18270 }
18271 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
18272 Token * _literal;
18273 if (
18274 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
18275 )
18276 {
18277 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
18278 _res = _literal;
18279 goto done;
18280 }
18281 p->mark = _mark;
18282 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18283 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
18284 }
18285 { // ':'
18286 if (p->error_indicator) {
18287 D(p->level--);
18288 return NULL;
18289 }
18290 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
18291 Token * _literal;
18292 if (
18293 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
18294 )
18295 {
18296 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
18297 _res = _literal;
18298 goto done;
18299 }
18300 p->mark = _mark;
18301 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18302 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018303 }
18304 _res = NULL;
18305 done:
18306 D(p->level--);
18307 return _res;
18308}
18309
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018310// _loop1_48: except_block
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018311static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018312_loop1_48_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018313{
18314 D(p->level++);
18315 if (p->error_indicator) {
18316 D(p->level--);
18317 return NULL;
18318 }
18319 void *_res = NULL;
18320 int _mark = p->mark;
18321 int _start_mark = p->mark;
18322 void **_children = PyMem_Malloc(sizeof(void *));
18323 if (!_children) {
18324 p->error_indicator = 1;
18325 PyErr_NoMemory();
18326 D(p->level--);
18327 return NULL;
18328 }
18329 ssize_t _children_capacity = 1;
18330 ssize_t _n = 0;
18331 { // except_block
18332 if (p->error_indicator) {
18333 D(p->level--);
18334 return NULL;
18335 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018336 D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018337 excepthandler_ty except_block_var;
18338 while (
18339 (except_block_var = except_block_rule(p)) // except_block
18340 )
18341 {
18342 _res = except_block_var;
18343 if (_n == _children_capacity) {
18344 _children_capacity *= 2;
18345 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18346 if (!_new_children) {
18347 p->error_indicator = 1;
18348 PyErr_NoMemory();
18349 D(p->level--);
18350 return NULL;
18351 }
18352 _children = _new_children;
18353 }
18354 _children[_n++] = _res;
18355 _mark = p->mark;
18356 }
18357 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018358 D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018359 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
18360 }
18361 if (_n == 0 || p->error_indicator) {
18362 PyMem_Free(_children);
18363 D(p->level--);
18364 return NULL;
18365 }
18366 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18367 if (!_seq) {
18368 PyMem_Free(_children);
18369 p->error_indicator = 1;
18370 PyErr_NoMemory();
18371 D(p->level--);
18372 return NULL;
18373 }
18374 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18375 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018376 _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018377 D(p->level--);
18378 return _seq;
18379}
18380
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018381// _tmp_49: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018382static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018383_tmp_49_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018384{
18385 D(p->level++);
18386 if (p->error_indicator) {
18387 D(p->level--);
18388 return NULL;
18389 }
18390 void * _res = NULL;
18391 int _mark = p->mark;
18392 { // 'as' NAME
18393 if (p->error_indicator) {
18394 D(p->level--);
18395 return NULL;
18396 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018397 D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018398 Token * _keyword;
18399 expr_ty z;
18400 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018401 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018402 &&
18403 (z = _PyPegen_name_token(p)) // NAME
18404 )
18405 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018406 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 +010018407 _res = z;
18408 if (_res == NULL && PyErr_Occurred()) {
18409 p->error_indicator = 1;
18410 D(p->level--);
18411 return NULL;
18412 }
18413 goto done;
18414 }
18415 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018416 D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018417 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
18418 }
18419 _res = NULL;
18420 done:
18421 D(p->level--);
18422 return _res;
18423}
18424
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018425// _tmp_50: 'from' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018426static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018427_tmp_50_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018428{
18429 D(p->level++);
18430 if (p->error_indicator) {
18431 D(p->level--);
18432 return NULL;
18433 }
18434 void * _res = NULL;
18435 int _mark = p->mark;
18436 { // 'from' expression
18437 if (p->error_indicator) {
18438 D(p->level--);
18439 return NULL;
18440 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018441 D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018442 Token * _keyword;
18443 expr_ty z;
18444 if (
18445 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
18446 &&
18447 (z = expression_rule(p)) // expression
18448 )
18449 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018450 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 +010018451 _res = z;
18452 if (_res == NULL && PyErr_Occurred()) {
18453 p->error_indicator = 1;
18454 D(p->level--);
18455 return NULL;
18456 }
18457 goto done;
18458 }
18459 p->mark = _mark;
18460 D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018461 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018462 }
18463 _res = NULL;
18464 done:
18465 D(p->level--);
18466 return _res;
18467}
18468
18469// _tmp_51: '->' expression
18470static void *
18471_tmp_51_rule(Parser *p)
18472{
18473 D(p->level++);
18474 if (p->error_indicator) {
18475 D(p->level--);
18476 return NULL;
18477 }
18478 void * _res = NULL;
18479 int _mark = p->mark;
18480 { // '->' expression
18481 if (p->error_indicator) {
18482 D(p->level--);
18483 return NULL;
18484 }
18485 D(fprintf(stderr, "%*c> _tmp_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18486 Token * _literal;
18487 expr_ty z;
18488 if (
18489 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18490 &&
18491 (z = expression_rule(p)) // expression
18492 )
18493 {
18494 D(fprintf(stderr, "%*c+ _tmp_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18495 _res = z;
18496 if (_res == NULL && PyErr_Occurred()) {
18497 p->error_indicator = 1;
18498 D(p->level--);
18499 return NULL;
18500 }
18501 goto done;
18502 }
18503 p->mark = _mark;
18504 D(fprintf(stderr, "%*c%s _tmp_51[%d-%d]: %s failed!\n", p->level, ' ',
18505 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18506 }
18507 _res = NULL;
18508 done:
18509 D(p->level--);
18510 return _res;
18511}
18512
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018513// _tmp_52: '->' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018514static void *
18515_tmp_52_rule(Parser *p)
18516{
18517 D(p->level++);
18518 if (p->error_indicator) {
18519 D(p->level--);
18520 return NULL;
18521 }
18522 void * _res = NULL;
18523 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018524 { // '->' expression
18525 if (p->error_indicator) {
18526 D(p->level--);
18527 return NULL;
18528 }
18529 D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18530 Token * _literal;
18531 expr_ty z;
18532 if (
18533 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18534 &&
18535 (z = expression_rule(p)) // expression
18536 )
18537 {
18538 D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18539 _res = z;
18540 if (_res == NULL && PyErr_Occurred()) {
18541 p->error_indicator = 1;
18542 D(p->level--);
18543 return NULL;
18544 }
18545 goto done;
18546 }
18547 p->mark = _mark;
18548 D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ',
18549 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18550 }
18551 _res = NULL;
18552 done:
18553 D(p->level--);
18554 return _res;
18555}
18556
18557// _tmp_53: NEWLINE INDENT
18558static void *
18559_tmp_53_rule(Parser *p)
18560{
18561 D(p->level++);
18562 if (p->error_indicator) {
18563 D(p->level--);
18564 return NULL;
18565 }
18566 void * _res = NULL;
18567 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018568 { // NEWLINE INDENT
18569 if (p->error_indicator) {
18570 D(p->level--);
18571 return NULL;
18572 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018573 D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018574 Token * indent_var;
18575 Token * newline_var;
18576 if (
18577 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
18578 &&
18579 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
18580 )
18581 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018582 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 +010018583 _res = _PyPegen_dummy_name(p, newline_var, indent_var);
18584 goto done;
18585 }
18586 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018587 D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018588 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
18589 }
18590 _res = NULL;
18591 done:
18592 D(p->level--);
18593 return _res;
18594}
18595
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018596// _loop0_54: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018597static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018598_loop0_54_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018599{
18600 D(p->level++);
18601 if (p->error_indicator) {
18602 D(p->level--);
18603 return NULL;
18604 }
18605 void *_res = NULL;
18606 int _mark = p->mark;
18607 int _start_mark = p->mark;
18608 void **_children = PyMem_Malloc(sizeof(void *));
18609 if (!_children) {
18610 p->error_indicator = 1;
18611 PyErr_NoMemory();
18612 D(p->level--);
18613 return NULL;
18614 }
18615 ssize_t _children_capacity = 1;
18616 ssize_t _n = 0;
18617 { // param_no_default
18618 if (p->error_indicator) {
18619 D(p->level--);
18620 return NULL;
18621 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018622 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 +010018623 arg_ty param_no_default_var;
18624 while (
18625 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18626 )
18627 {
18628 _res = param_no_default_var;
18629 if (_n == _children_capacity) {
18630 _children_capacity *= 2;
18631 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18632 if (!_new_children) {
18633 p->error_indicator = 1;
18634 PyErr_NoMemory();
18635 D(p->level--);
18636 return NULL;
18637 }
18638 _children = _new_children;
18639 }
18640 _children[_n++] = _res;
18641 _mark = p->mark;
18642 }
18643 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018644 D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018645 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018646 }
18647 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18648 if (!_seq) {
18649 PyMem_Free(_children);
18650 p->error_indicator = 1;
18651 PyErr_NoMemory();
18652 D(p->level--);
18653 return NULL;
18654 }
18655 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18656 PyMem_Free(_children);
18657 _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq);
18658 D(p->level--);
18659 return _seq;
18660}
18661
18662// _loop0_55: param_with_default
18663static asdl_seq *
18664_loop0_55_rule(Parser *p)
18665{
18666 D(p->level++);
18667 if (p->error_indicator) {
18668 D(p->level--);
18669 return NULL;
18670 }
18671 void *_res = NULL;
18672 int _mark = p->mark;
18673 int _start_mark = p->mark;
18674 void **_children = PyMem_Malloc(sizeof(void *));
18675 if (!_children) {
18676 p->error_indicator = 1;
18677 PyErr_NoMemory();
18678 D(p->level--);
18679 return NULL;
18680 }
18681 ssize_t _children_capacity = 1;
18682 ssize_t _n = 0;
18683 { // param_with_default
18684 if (p->error_indicator) {
18685 D(p->level--);
18686 return NULL;
18687 }
18688 D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18689 NameDefaultPair* param_with_default_var;
18690 while (
18691 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18692 )
18693 {
18694 _res = param_with_default_var;
18695 if (_n == _children_capacity) {
18696 _children_capacity *= 2;
18697 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18698 if (!_new_children) {
18699 p->error_indicator = 1;
18700 PyErr_NoMemory();
18701 D(p->level--);
18702 return NULL;
18703 }
18704 _children = _new_children;
18705 }
18706 _children[_n++] = _res;
18707 _mark = p->mark;
18708 }
18709 p->mark = _mark;
18710 D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ',
18711 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18712 }
18713 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18714 if (!_seq) {
18715 PyMem_Free(_children);
18716 p->error_indicator = 1;
18717 PyErr_NoMemory();
18718 D(p->level--);
18719 return NULL;
18720 }
18721 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18722 PyMem_Free(_children);
18723 _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq);
18724 D(p->level--);
18725 return _seq;
18726}
18727
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018728// _loop0_56: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018729static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018730_loop0_56_rule(Parser *p)
18731{
18732 D(p->level++);
18733 if (p->error_indicator) {
18734 D(p->level--);
18735 return NULL;
18736 }
18737 void *_res = NULL;
18738 int _mark = p->mark;
18739 int _start_mark = p->mark;
18740 void **_children = PyMem_Malloc(sizeof(void *));
18741 if (!_children) {
18742 p->error_indicator = 1;
18743 PyErr_NoMemory();
18744 D(p->level--);
18745 return NULL;
18746 }
18747 ssize_t _children_capacity = 1;
18748 ssize_t _n = 0;
18749 { // param_with_default
18750 if (p->error_indicator) {
18751 D(p->level--);
18752 return NULL;
18753 }
18754 D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18755 NameDefaultPair* param_with_default_var;
18756 while (
18757 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18758 )
18759 {
18760 _res = param_with_default_var;
18761 if (_n == _children_capacity) {
18762 _children_capacity *= 2;
18763 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18764 if (!_new_children) {
18765 p->error_indicator = 1;
18766 PyErr_NoMemory();
18767 D(p->level--);
18768 return NULL;
18769 }
18770 _children = _new_children;
18771 }
18772 _children[_n++] = _res;
18773 _mark = p->mark;
18774 }
18775 p->mark = _mark;
18776 D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ',
18777 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18778 }
18779 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18780 if (!_seq) {
18781 PyMem_Free(_children);
18782 p->error_indicator = 1;
18783 PyErr_NoMemory();
18784 D(p->level--);
18785 return NULL;
18786 }
18787 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18788 PyMem_Free(_children);
18789 _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq);
18790 D(p->level--);
18791 return _seq;
18792}
18793
18794// _loop1_57: param_no_default
18795static asdl_seq *
18796_loop1_57_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018797{
18798 D(p->level++);
18799 if (p->error_indicator) {
18800 D(p->level--);
18801 return NULL;
18802 }
18803 void *_res = NULL;
18804 int _mark = p->mark;
18805 int _start_mark = p->mark;
18806 void **_children = PyMem_Malloc(sizeof(void *));
18807 if (!_children) {
18808 p->error_indicator = 1;
18809 PyErr_NoMemory();
18810 D(p->level--);
18811 return NULL;
18812 }
18813 ssize_t _children_capacity = 1;
18814 ssize_t _n = 0;
18815 { // param_no_default
18816 if (p->error_indicator) {
18817 D(p->level--);
18818 return NULL;
18819 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018820 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 +010018821 arg_ty param_no_default_var;
18822 while (
18823 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18824 )
18825 {
18826 _res = param_no_default_var;
18827 if (_n == _children_capacity) {
18828 _children_capacity *= 2;
18829 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18830 if (!_new_children) {
18831 p->error_indicator = 1;
18832 PyErr_NoMemory();
18833 D(p->level--);
18834 return NULL;
18835 }
18836 _children = _new_children;
18837 }
18838 _children[_n++] = _res;
18839 _mark = p->mark;
18840 }
18841 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018842 D(fprintf(stderr, "%*c%s _loop1_57[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018843 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
18844 }
18845 if (_n == 0 || p->error_indicator) {
18846 PyMem_Free(_children);
18847 D(p->level--);
18848 return NULL;
18849 }
18850 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18851 if (!_seq) {
18852 PyMem_Free(_children);
18853 p->error_indicator = 1;
18854 PyErr_NoMemory();
18855 D(p->level--);
18856 return NULL;
18857 }
18858 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18859 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018860 _PyPegen_insert_memo(p, _start_mark, _loop1_57_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018861 D(p->level--);
18862 return _seq;
18863}
18864
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018865// _loop0_58: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018866static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018867_loop0_58_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018868{
18869 D(p->level++);
18870 if (p->error_indicator) {
18871 D(p->level--);
18872 return NULL;
18873 }
18874 void *_res = NULL;
18875 int _mark = p->mark;
18876 int _start_mark = p->mark;
18877 void **_children = PyMem_Malloc(sizeof(void *));
18878 if (!_children) {
18879 p->error_indicator = 1;
18880 PyErr_NoMemory();
18881 D(p->level--);
18882 return NULL;
18883 }
18884 ssize_t _children_capacity = 1;
18885 ssize_t _n = 0;
18886 { // param_with_default
18887 if (p->error_indicator) {
18888 D(p->level--);
18889 return NULL;
18890 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018891 D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018892 NameDefaultPair* param_with_default_var;
18893 while (
18894 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18895 )
18896 {
18897 _res = param_with_default_var;
18898 if (_n == _children_capacity) {
18899 _children_capacity *= 2;
18900 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18901 if (!_new_children) {
18902 p->error_indicator = 1;
18903 PyErr_NoMemory();
18904 D(p->level--);
18905 return NULL;
18906 }
18907 _children = _new_children;
18908 }
18909 _children[_n++] = _res;
18910 _mark = p->mark;
18911 }
18912 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018913 D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018914 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18915 }
18916 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18917 if (!_seq) {
18918 PyMem_Free(_children);
18919 p->error_indicator = 1;
18920 PyErr_NoMemory();
18921 D(p->level--);
18922 return NULL;
18923 }
18924 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18925 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018926 _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018927 D(p->level--);
18928 return _seq;
18929}
18930
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018931// _loop1_59: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018932static asdl_seq *
18933_loop1_59_rule(Parser *p)
18934{
18935 D(p->level++);
18936 if (p->error_indicator) {
18937 D(p->level--);
18938 return NULL;
18939 }
18940 void *_res = NULL;
18941 int _mark = p->mark;
18942 int _start_mark = p->mark;
18943 void **_children = PyMem_Malloc(sizeof(void *));
18944 if (!_children) {
18945 p->error_indicator = 1;
18946 PyErr_NoMemory();
18947 D(p->level--);
18948 return NULL;
18949 }
18950 ssize_t _children_capacity = 1;
18951 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018952 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018953 if (p->error_indicator) {
18954 D(p->level--);
18955 return NULL;
18956 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018957 D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18958 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018959 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018960 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018961 )
18962 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018963 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018964 if (_n == _children_capacity) {
18965 _children_capacity *= 2;
18966 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18967 if (!_new_children) {
18968 p->error_indicator = 1;
18969 PyErr_NoMemory();
18970 D(p->level--);
18971 return NULL;
18972 }
18973 _children = _new_children;
18974 }
18975 _children[_n++] = _res;
18976 _mark = p->mark;
18977 }
18978 p->mark = _mark;
18979 D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018980 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018981 }
18982 if (_n == 0 || p->error_indicator) {
18983 PyMem_Free(_children);
18984 D(p->level--);
18985 return NULL;
18986 }
18987 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18988 if (!_seq) {
18989 PyMem_Free(_children);
18990 p->error_indicator = 1;
18991 PyErr_NoMemory();
18992 D(p->level--);
18993 return NULL;
18994 }
18995 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18996 PyMem_Free(_children);
18997 _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq);
18998 D(p->level--);
18999 return _seq;
19000}
19001
19002// _loop1_60: param_no_default
19003static asdl_seq *
19004_loop1_60_rule(Parser *p)
19005{
19006 D(p->level++);
19007 if (p->error_indicator) {
19008 D(p->level--);
19009 return NULL;
19010 }
19011 void *_res = NULL;
19012 int _mark = p->mark;
19013 int _start_mark = p->mark;
19014 void **_children = PyMem_Malloc(sizeof(void *));
19015 if (!_children) {
19016 p->error_indicator = 1;
19017 PyErr_NoMemory();
19018 D(p->level--);
19019 return NULL;
19020 }
19021 ssize_t _children_capacity = 1;
19022 ssize_t _n = 0;
19023 { // param_no_default
19024 if (p->error_indicator) {
19025 D(p->level--);
19026 return NULL;
19027 }
19028 D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19029 arg_ty param_no_default_var;
19030 while (
19031 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19032 )
19033 {
19034 _res = param_no_default_var;
19035 if (_n == _children_capacity) {
19036 _children_capacity *= 2;
19037 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19038 if (!_new_children) {
19039 p->error_indicator = 1;
19040 PyErr_NoMemory();
19041 D(p->level--);
19042 return NULL;
19043 }
19044 _children = _new_children;
19045 }
19046 _children[_n++] = _res;
19047 _mark = p->mark;
19048 }
19049 p->mark = _mark;
19050 D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ',
19051 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19052 }
19053 if (_n == 0 || p->error_indicator) {
19054 PyMem_Free(_children);
19055 D(p->level--);
19056 return NULL;
19057 }
19058 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19059 if (!_seq) {
19060 PyMem_Free(_children);
19061 p->error_indicator = 1;
19062 PyErr_NoMemory();
19063 D(p->level--);
19064 return NULL;
19065 }
19066 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19067 PyMem_Free(_children);
19068 _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq);
19069 D(p->level--);
19070 return _seq;
19071}
19072
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019073// _loop1_61: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019074static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019075_loop1_61_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019076{
19077 D(p->level++);
19078 if (p->error_indicator) {
19079 D(p->level--);
19080 return NULL;
19081 }
19082 void *_res = NULL;
19083 int _mark = p->mark;
19084 int _start_mark = p->mark;
19085 void **_children = PyMem_Malloc(sizeof(void *));
19086 if (!_children) {
19087 p->error_indicator = 1;
19088 PyErr_NoMemory();
19089 D(p->level--);
19090 return NULL;
19091 }
19092 ssize_t _children_capacity = 1;
19093 ssize_t _n = 0;
19094 { // param_no_default
19095 if (p->error_indicator) {
19096 D(p->level--);
19097 return NULL;
19098 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019099 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 +010019100 arg_ty param_no_default_var;
19101 while (
19102 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19103 )
19104 {
19105 _res = param_no_default_var;
19106 if (_n == _children_capacity) {
19107 _children_capacity *= 2;
19108 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19109 if (!_new_children) {
19110 p->error_indicator = 1;
19111 PyErr_NoMemory();
19112 D(p->level--);
19113 return NULL;
19114 }
19115 _children = _new_children;
19116 }
19117 _children[_n++] = _res;
19118 _mark = p->mark;
19119 }
19120 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019121 D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019122 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19123 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019124 if (_n == 0 || p->error_indicator) {
19125 PyMem_Free(_children);
19126 D(p->level--);
19127 return NULL;
19128 }
19129 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19130 if (!_seq) {
19131 PyMem_Free(_children);
19132 p->error_indicator = 1;
19133 PyErr_NoMemory();
19134 D(p->level--);
19135 return NULL;
19136 }
19137 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19138 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019139 _PyPegen_insert_memo(p, _start_mark, _loop1_61_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019140 D(p->level--);
19141 return _seq;
19142}
19143
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019144// _loop0_62: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019145static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019146_loop0_62_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019147{
19148 D(p->level++);
19149 if (p->error_indicator) {
19150 D(p->level--);
19151 return NULL;
19152 }
19153 void *_res = NULL;
19154 int _mark = p->mark;
19155 int _start_mark = p->mark;
19156 void **_children = PyMem_Malloc(sizeof(void *));
19157 if (!_children) {
19158 p->error_indicator = 1;
19159 PyErr_NoMemory();
19160 D(p->level--);
19161 return NULL;
19162 }
19163 ssize_t _children_capacity = 1;
19164 ssize_t _n = 0;
19165 { // param_no_default
19166 if (p->error_indicator) {
19167 D(p->level--);
19168 return NULL;
19169 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019170 D(fprintf(stderr, "%*c> _loop0_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019171 arg_ty param_no_default_var;
19172 while (
19173 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19174 )
19175 {
19176 _res = param_no_default_var;
19177 if (_n == _children_capacity) {
19178 _children_capacity *= 2;
19179 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19180 if (!_new_children) {
19181 p->error_indicator = 1;
19182 PyErr_NoMemory();
19183 D(p->level--);
19184 return NULL;
19185 }
19186 _children = _new_children;
19187 }
19188 _children[_n++] = _res;
19189 _mark = p->mark;
19190 }
19191 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019192 D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019193 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19194 }
19195 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19196 if (!_seq) {
19197 PyMem_Free(_children);
19198 p->error_indicator = 1;
19199 PyErr_NoMemory();
19200 D(p->level--);
19201 return NULL;
19202 }
19203 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19204 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019205 _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019206 D(p->level--);
19207 return _seq;
19208}
19209
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019210// _loop1_63: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019211static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019212_loop1_63_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019213{
19214 D(p->level++);
19215 if (p->error_indicator) {
19216 D(p->level--);
19217 return NULL;
19218 }
19219 void *_res = NULL;
19220 int _mark = p->mark;
19221 int _start_mark = p->mark;
19222 void **_children = PyMem_Malloc(sizeof(void *));
19223 if (!_children) {
19224 p->error_indicator = 1;
19225 PyErr_NoMemory();
19226 D(p->level--);
19227 return NULL;
19228 }
19229 ssize_t _children_capacity = 1;
19230 ssize_t _n = 0;
19231 { // param_with_default
19232 if (p->error_indicator) {
19233 D(p->level--);
19234 return NULL;
19235 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019236 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 +010019237 NameDefaultPair* param_with_default_var;
19238 while (
19239 (param_with_default_var = param_with_default_rule(p)) // param_with_default
19240 )
19241 {
19242 _res = param_with_default_var;
19243 if (_n == _children_capacity) {
19244 _children_capacity *= 2;
19245 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19246 if (!_new_children) {
19247 p->error_indicator = 1;
19248 PyErr_NoMemory();
19249 D(p->level--);
19250 return NULL;
19251 }
19252 _children = _new_children;
19253 }
19254 _children[_n++] = _res;
19255 _mark = p->mark;
19256 }
19257 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019258 D(fprintf(stderr, "%*c%s _loop1_63[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019259 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
19260 }
19261 if (_n == 0 || p->error_indicator) {
19262 PyMem_Free(_children);
19263 D(p->level--);
19264 return NULL;
19265 }
19266 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19267 if (!_seq) {
19268 PyMem_Free(_children);
19269 p->error_indicator = 1;
19270 PyErr_NoMemory();
19271 D(p->level--);
19272 return NULL;
19273 }
19274 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19275 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019276 _PyPegen_insert_memo(p, _start_mark, _loop1_63_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019277 D(p->level--);
19278 return _seq;
19279}
19280
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019281// _loop0_64: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019282static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019283_loop0_64_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019284{
19285 D(p->level++);
19286 if (p->error_indicator) {
19287 D(p->level--);
19288 return NULL;
19289 }
19290 void *_res = NULL;
19291 int _mark = p->mark;
19292 int _start_mark = p->mark;
19293 void **_children = PyMem_Malloc(sizeof(void *));
19294 if (!_children) {
19295 p->error_indicator = 1;
19296 PyErr_NoMemory();
19297 D(p->level--);
19298 return NULL;
19299 }
19300 ssize_t _children_capacity = 1;
19301 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019302 { // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019303 if (p->error_indicator) {
19304 D(p->level--);
19305 return NULL;
19306 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019307 D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19308 arg_ty param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019309 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019310 (param_no_default_var = param_no_default_rule(p)) // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019311 )
19312 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019313 _res = param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019314 if (_n == _children_capacity) {
19315 _children_capacity *= 2;
19316 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19317 if (!_new_children) {
19318 p->error_indicator = 1;
19319 PyErr_NoMemory();
19320 D(p->level--);
19321 return NULL;
19322 }
19323 _children = _new_children;
19324 }
19325 _children[_n++] = _res;
19326 _mark = p->mark;
19327 }
19328 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019329 D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ',
19330 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019331 }
19332 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19333 if (!_seq) {
19334 PyMem_Free(_children);
19335 p->error_indicator = 1;
19336 PyErr_NoMemory();
19337 D(p->level--);
19338 return NULL;
19339 }
19340 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19341 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019342 _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019343 D(p->level--);
19344 return _seq;
19345}
19346
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019347// _loop1_65: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019348static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019349_loop1_65_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019350{
19351 D(p->level++);
19352 if (p->error_indicator) {
19353 D(p->level--);
19354 return NULL;
19355 }
19356 void *_res = NULL;
19357 int _mark = p->mark;
19358 int _start_mark = p->mark;
19359 void **_children = PyMem_Malloc(sizeof(void *));
19360 if (!_children) {
19361 p->error_indicator = 1;
19362 PyErr_NoMemory();
19363 D(p->level--);
19364 return NULL;
19365 }
19366 ssize_t _children_capacity = 1;
19367 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019368 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019369 if (p->error_indicator) {
19370 D(p->level--);
19371 return NULL;
19372 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019373 D(fprintf(stderr, "%*c> _loop1_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
19374 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019375 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019376 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019377 )
19378 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019379 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019380 if (_n == _children_capacity) {
19381 _children_capacity *= 2;
19382 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19383 if (!_new_children) {
19384 p->error_indicator = 1;
19385 PyErr_NoMemory();
19386 D(p->level--);
19387 return NULL;
19388 }
19389 _children = _new_children;
19390 }
19391 _children[_n++] = _res;
19392 _mark = p->mark;
19393 }
19394 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019395 D(fprintf(stderr, "%*c%s _loop1_65[%d-%d]: %s failed!\n", p->level, ' ',
19396 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019397 }
19398 if (_n == 0 || p->error_indicator) {
19399 PyMem_Free(_children);
19400 D(p->level--);
19401 return NULL;
19402 }
19403 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19404 if (!_seq) {
19405 PyMem_Free(_children);
19406 p->error_indicator = 1;
19407 PyErr_NoMemory();
19408 D(p->level--);
19409 return NULL;
19410 }
19411 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19412 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019413 _PyPegen_insert_memo(p, _start_mark, _loop1_65_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019414 D(p->level--);
19415 return _seq;
19416}
19417
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019418// _loop0_66: param_maybe_default
19419static asdl_seq *
19420_loop0_66_rule(Parser *p)
19421{
19422 D(p->level++);
19423 if (p->error_indicator) {
19424 D(p->level--);
19425 return NULL;
19426 }
19427 void *_res = NULL;
19428 int _mark = p->mark;
19429 int _start_mark = p->mark;
19430 void **_children = PyMem_Malloc(sizeof(void *));
19431 if (!_children) {
19432 p->error_indicator = 1;
19433 PyErr_NoMemory();
19434 D(p->level--);
19435 return NULL;
19436 }
19437 ssize_t _children_capacity = 1;
19438 ssize_t _n = 0;
19439 { // param_maybe_default
19440 if (p->error_indicator) {
19441 D(p->level--);
19442 return NULL;
19443 }
19444 D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19445 NameDefaultPair* param_maybe_default_var;
19446 while (
19447 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19448 )
19449 {
19450 _res = param_maybe_default_var;
19451 if (_n == _children_capacity) {
19452 _children_capacity *= 2;
19453 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19454 if (!_new_children) {
19455 p->error_indicator = 1;
19456 PyErr_NoMemory();
19457 D(p->level--);
19458 return NULL;
19459 }
19460 _children = _new_children;
19461 }
19462 _children[_n++] = _res;
19463 _mark = p->mark;
19464 }
19465 p->mark = _mark;
19466 D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ',
19467 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19468 }
19469 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19470 if (!_seq) {
19471 PyMem_Free(_children);
19472 p->error_indicator = 1;
19473 PyErr_NoMemory();
19474 D(p->level--);
19475 return NULL;
19476 }
19477 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19478 PyMem_Free(_children);
19479 _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq);
19480 D(p->level--);
19481 return _seq;
19482}
19483
19484// _loop1_67: param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019485static asdl_seq *
19486_loop1_67_rule(Parser *p)
19487{
19488 D(p->level++);
19489 if (p->error_indicator) {
19490 D(p->level--);
19491 return NULL;
19492 }
19493 void *_res = NULL;
19494 int _mark = p->mark;
19495 int _start_mark = p->mark;
19496 void **_children = PyMem_Malloc(sizeof(void *));
19497 if (!_children) {
19498 p->error_indicator = 1;
19499 PyErr_NoMemory();
19500 D(p->level--);
19501 return NULL;
19502 }
19503 ssize_t _children_capacity = 1;
19504 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019505 { // param_maybe_default
19506 if (p->error_indicator) {
19507 D(p->level--);
19508 return NULL;
19509 }
19510 D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19511 NameDefaultPair* param_maybe_default_var;
19512 while (
19513 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19514 )
19515 {
19516 _res = param_maybe_default_var;
19517 if (_n == _children_capacity) {
19518 _children_capacity *= 2;
19519 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19520 if (!_new_children) {
19521 p->error_indicator = 1;
19522 PyErr_NoMemory();
19523 D(p->level--);
19524 return NULL;
19525 }
19526 _children = _new_children;
19527 }
19528 _children[_n++] = _res;
19529 _mark = p->mark;
19530 }
19531 p->mark = _mark;
19532 D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ',
19533 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19534 }
19535 if (_n == 0 || p->error_indicator) {
19536 PyMem_Free(_children);
19537 D(p->level--);
19538 return NULL;
19539 }
19540 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19541 if (!_seq) {
19542 PyMem_Free(_children);
19543 p->error_indicator = 1;
19544 PyErr_NoMemory();
19545 D(p->level--);
19546 return NULL;
19547 }
19548 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19549 PyMem_Free(_children);
19550 _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq);
19551 D(p->level--);
19552 return _seq;
19553}
19554
19555// _loop1_68: ('@' named_expression NEWLINE)
19556static asdl_seq *
19557_loop1_68_rule(Parser *p)
19558{
19559 D(p->level++);
19560 if (p->error_indicator) {
19561 D(p->level--);
19562 return NULL;
19563 }
19564 void *_res = NULL;
19565 int _mark = p->mark;
19566 int _start_mark = p->mark;
19567 void **_children = PyMem_Malloc(sizeof(void *));
19568 if (!_children) {
19569 p->error_indicator = 1;
19570 PyErr_NoMemory();
19571 D(p->level--);
19572 return NULL;
19573 }
19574 ssize_t _children_capacity = 1;
19575 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019576 { // ('@' named_expression NEWLINE)
19577 if (p->error_indicator) {
19578 D(p->level--);
19579 return NULL;
19580 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019581 D(fprintf(stderr, "%*c> _loop1_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019582 void *_tmp_141_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019583 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019584 (_tmp_141_var = _tmp_141_rule(p)) // '@' named_expression NEWLINE
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019585 )
19586 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019587 _res = _tmp_141_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019588 if (_n == _children_capacity) {
19589 _children_capacity *= 2;
19590 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19591 if (!_new_children) {
19592 p->error_indicator = 1;
19593 PyErr_NoMemory();
19594 D(p->level--);
19595 return NULL;
19596 }
19597 _children = _new_children;
19598 }
19599 _children[_n++] = _res;
19600 _mark = p->mark;
19601 }
19602 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019603 D(fprintf(stderr, "%*c%s _loop1_68[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019604 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
19605 }
19606 if (_n == 0 || p->error_indicator) {
19607 PyMem_Free(_children);
19608 D(p->level--);
19609 return NULL;
19610 }
19611 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19612 if (!_seq) {
19613 PyMem_Free(_children);
19614 p->error_indicator = 1;
19615 PyErr_NoMemory();
19616 D(p->level--);
19617 return NULL;
19618 }
19619 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19620 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019621 _PyPegen_insert_memo(p, _start_mark, _loop1_68_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019622 D(p->level--);
19623 return _seq;
19624}
19625
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019626// _tmp_69: '(' arguments? ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019627static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019628_tmp_69_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019629{
19630 D(p->level++);
19631 if (p->error_indicator) {
19632 D(p->level--);
19633 return NULL;
19634 }
19635 void * _res = NULL;
19636 int _mark = p->mark;
19637 { // '(' arguments? ')'
19638 if (p->error_indicator) {
19639 D(p->level--);
19640 return NULL;
19641 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019642 D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019643 Token * _literal;
19644 Token * _literal_1;
19645 void *z;
19646 if (
19647 (_literal = _PyPegen_expect_token(p, 7)) // token='('
19648 &&
19649 (z = arguments_rule(p), 1) // arguments?
19650 &&
19651 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
19652 )
19653 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019654 D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019655 _res = z;
19656 if (_res == NULL && PyErr_Occurred()) {
19657 p->error_indicator = 1;
19658 D(p->level--);
19659 return NULL;
19660 }
19661 goto done;
19662 }
19663 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019664 D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019665 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
19666 }
19667 _res = NULL;
19668 done:
19669 D(p->level--);
19670 return _res;
19671}
19672
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019673// _loop0_71: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019674static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019675_loop0_71_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019676{
19677 D(p->level++);
19678 if (p->error_indicator) {
19679 D(p->level--);
19680 return NULL;
19681 }
19682 void *_res = NULL;
19683 int _mark = p->mark;
19684 int _start_mark = p->mark;
19685 void **_children = PyMem_Malloc(sizeof(void *));
19686 if (!_children) {
19687 p->error_indicator = 1;
19688 PyErr_NoMemory();
19689 D(p->level--);
19690 return NULL;
19691 }
19692 ssize_t _children_capacity = 1;
19693 ssize_t _n = 0;
19694 { // ',' star_expression
19695 if (p->error_indicator) {
19696 D(p->level--);
19697 return NULL;
19698 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019699 D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019700 Token * _literal;
19701 expr_ty elem;
19702 while (
19703 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19704 &&
19705 (elem = star_expression_rule(p)) // star_expression
19706 )
19707 {
19708 _res = elem;
19709 if (_res == NULL && PyErr_Occurred()) {
19710 p->error_indicator = 1;
19711 PyMem_Free(_children);
19712 D(p->level--);
19713 return NULL;
19714 }
19715 if (_n == _children_capacity) {
19716 _children_capacity *= 2;
19717 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19718 if (!_new_children) {
19719 p->error_indicator = 1;
19720 PyErr_NoMemory();
19721 D(p->level--);
19722 return NULL;
19723 }
19724 _children = _new_children;
19725 }
19726 _children[_n++] = _res;
19727 _mark = p->mark;
19728 }
19729 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019730 D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019731 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
19732 }
19733 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19734 if (!_seq) {
19735 PyMem_Free(_children);
19736 p->error_indicator = 1;
19737 PyErr_NoMemory();
19738 D(p->level--);
19739 return NULL;
19740 }
19741 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19742 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019743 _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019744 D(p->level--);
19745 return _seq;
19746}
19747
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019748// _gather_70: star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019749static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019750_gather_70_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019751{
19752 D(p->level++);
19753 if (p->error_indicator) {
19754 D(p->level--);
19755 return NULL;
19756 }
19757 asdl_seq * _res = NULL;
19758 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019759 { // star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019760 if (p->error_indicator) {
19761 D(p->level--);
19762 return NULL;
19763 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019764 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 +010019765 expr_ty elem;
19766 asdl_seq * seq;
19767 if (
19768 (elem = star_expression_rule(p)) // star_expression
19769 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019770 (seq = _loop0_71_rule(p)) // _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019771 )
19772 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019773 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 +010019774 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19775 goto done;
19776 }
19777 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019778 D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ',
19779 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_71"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019780 }
19781 _res = NULL;
19782 done:
19783 D(p->level--);
19784 return _res;
19785}
19786
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019787// _loop1_72: (',' star_expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019788static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019789_loop1_72_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019790{
19791 D(p->level++);
19792 if (p->error_indicator) {
19793 D(p->level--);
19794 return NULL;
19795 }
19796 void *_res = NULL;
19797 int _mark = p->mark;
19798 int _start_mark = p->mark;
19799 void **_children = PyMem_Malloc(sizeof(void *));
19800 if (!_children) {
19801 p->error_indicator = 1;
19802 PyErr_NoMemory();
19803 D(p->level--);
19804 return NULL;
19805 }
19806 ssize_t _children_capacity = 1;
19807 ssize_t _n = 0;
19808 { // (',' star_expression)
19809 if (p->error_indicator) {
19810 D(p->level--);
19811 return NULL;
19812 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019813 D(fprintf(stderr, "%*c> _loop1_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019814 void *_tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019815 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019816 (_tmp_142_var = _tmp_142_rule(p)) // ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019817 )
19818 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019819 _res = _tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019820 if (_n == _children_capacity) {
19821 _children_capacity *= 2;
19822 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19823 if (!_new_children) {
19824 p->error_indicator = 1;
19825 PyErr_NoMemory();
19826 D(p->level--);
19827 return NULL;
19828 }
19829 _children = _new_children;
19830 }
19831 _children[_n++] = _res;
19832 _mark = p->mark;
19833 }
19834 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019835 D(fprintf(stderr, "%*c%s _loop1_72[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019836 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
19837 }
19838 if (_n == 0 || p->error_indicator) {
19839 PyMem_Free(_children);
19840 D(p->level--);
19841 return NULL;
19842 }
19843 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19844 if (!_seq) {
19845 PyMem_Free(_children);
19846 p->error_indicator = 1;
19847 PyErr_NoMemory();
19848 D(p->level--);
19849 return NULL;
19850 }
19851 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19852 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019853 _PyPegen_insert_memo(p, _start_mark, _loop1_72_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019854 D(p->level--);
19855 return _seq;
19856}
19857
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019858// _loop0_74: ',' star_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019859static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019860_loop0_74_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019861{
19862 D(p->level++);
19863 if (p->error_indicator) {
19864 D(p->level--);
19865 return NULL;
19866 }
19867 void *_res = NULL;
19868 int _mark = p->mark;
19869 int _start_mark = p->mark;
19870 void **_children = PyMem_Malloc(sizeof(void *));
19871 if (!_children) {
19872 p->error_indicator = 1;
19873 PyErr_NoMemory();
19874 D(p->level--);
19875 return NULL;
19876 }
19877 ssize_t _children_capacity = 1;
19878 ssize_t _n = 0;
19879 { // ',' star_named_expression
19880 if (p->error_indicator) {
19881 D(p->level--);
19882 return NULL;
19883 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019884 D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019885 Token * _literal;
19886 expr_ty elem;
19887 while (
19888 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19889 &&
19890 (elem = star_named_expression_rule(p)) // star_named_expression
19891 )
19892 {
19893 _res = elem;
19894 if (_res == NULL && PyErr_Occurred()) {
19895 p->error_indicator = 1;
19896 PyMem_Free(_children);
19897 D(p->level--);
19898 return NULL;
19899 }
19900 if (_n == _children_capacity) {
19901 _children_capacity *= 2;
19902 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19903 if (!_new_children) {
19904 p->error_indicator = 1;
19905 PyErr_NoMemory();
19906 D(p->level--);
19907 return NULL;
19908 }
19909 _children = _new_children;
19910 }
19911 _children[_n++] = _res;
19912 _mark = p->mark;
19913 }
19914 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019915 D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019916 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
19917 }
19918 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19919 if (!_seq) {
19920 PyMem_Free(_children);
19921 p->error_indicator = 1;
19922 PyErr_NoMemory();
19923 D(p->level--);
19924 return NULL;
19925 }
19926 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19927 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019928 _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019929 D(p->level--);
19930 return _seq;
19931}
19932
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019933// _gather_73: star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019934static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019935_gather_73_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019936{
19937 D(p->level++);
19938 if (p->error_indicator) {
19939 D(p->level--);
19940 return NULL;
19941 }
19942 asdl_seq * _res = NULL;
19943 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019944 { // star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019945 if (p->error_indicator) {
19946 D(p->level--);
19947 return NULL;
19948 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019949 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 +010019950 expr_ty elem;
19951 asdl_seq * seq;
19952 if (
19953 (elem = star_named_expression_rule(p)) // star_named_expression
19954 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019955 (seq = _loop0_74_rule(p)) // _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019956 )
19957 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019958 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 +010019959 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19960 goto done;
19961 }
19962 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019963 D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ',
19964 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_74"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019965 }
19966 _res = NULL;
19967 done:
19968 D(p->level--);
19969 return _res;
19970}
19971
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019972// _loop1_75: (',' expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019973static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019974_loop1_75_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019975{
19976 D(p->level++);
19977 if (p->error_indicator) {
19978 D(p->level--);
19979 return NULL;
19980 }
19981 void *_res = NULL;
19982 int _mark = p->mark;
19983 int _start_mark = p->mark;
19984 void **_children = PyMem_Malloc(sizeof(void *));
19985 if (!_children) {
19986 p->error_indicator = 1;
19987 PyErr_NoMemory();
19988 D(p->level--);
19989 return NULL;
19990 }
19991 ssize_t _children_capacity = 1;
19992 ssize_t _n = 0;
19993 { // (',' expression)
19994 if (p->error_indicator) {
19995 D(p->level--);
19996 return NULL;
19997 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019998 D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019999 void *_tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020000 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030020001 (_tmp_143_var = _tmp_143_rule(p)) // ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020002 )
20003 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030020004 _res = _tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020005 if (_n == _children_capacity) {
20006 _children_capacity *= 2;
20007 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20008 if (!_new_children) {
20009 p->error_indicator = 1;
20010 PyErr_NoMemory();
20011 D(p->level--);
20012 return NULL;
20013 }
20014 _children = _new_children;
20015 }
20016 _children[_n++] = _res;
20017 _mark = p->mark;
20018 }
20019 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020020 D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020021 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
20022 }
20023 if (_n == 0 || p->error_indicator) {
20024 PyMem_Free(_children);
20025 D(p->level--);
20026 return NULL;
20027 }
20028 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20029 if (!_seq) {
20030 PyMem_Free(_children);
20031 p->error_indicator = 1;
20032 PyErr_NoMemory();
20033 D(p->level--);
20034 return NULL;
20035 }
20036 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20037 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020038 _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020039 D(p->level--);
20040 return _seq;
20041}
20042
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020043// _loop0_76: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020044static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020045_loop0_76_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020046{
20047 D(p->level++);
20048 if (p->error_indicator) {
20049 D(p->level--);
20050 return NULL;
20051 }
20052 void *_res = NULL;
20053 int _mark = p->mark;
20054 int _start_mark = p->mark;
20055 void **_children = PyMem_Malloc(sizeof(void *));
20056 if (!_children) {
20057 p->error_indicator = 1;
20058 PyErr_NoMemory();
20059 D(p->level--);
20060 return NULL;
20061 }
20062 ssize_t _children_capacity = 1;
20063 ssize_t _n = 0;
20064 { // lambda_param_no_default
20065 if (p->error_indicator) {
20066 D(p->level--);
20067 return NULL;
20068 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020069 D(fprintf(stderr, "%*c> _loop0_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020070 arg_ty lambda_param_no_default_var;
20071 while (
20072 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20073 )
20074 {
20075 _res = lambda_param_no_default_var;
20076 if (_n == _children_capacity) {
20077 _children_capacity *= 2;
20078 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20079 if (!_new_children) {
20080 p->error_indicator = 1;
20081 PyErr_NoMemory();
20082 D(p->level--);
20083 return NULL;
20084 }
20085 _children = _new_children;
20086 }
20087 _children[_n++] = _res;
20088 _mark = p->mark;
20089 }
20090 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020091 D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020092 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020093 }
20094 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20095 if (!_seq) {
20096 PyMem_Free(_children);
20097 p->error_indicator = 1;
20098 PyErr_NoMemory();
20099 D(p->level--);
20100 return NULL;
20101 }
20102 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20103 PyMem_Free(_children);
20104 _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq);
20105 D(p->level--);
20106 return _seq;
20107}
20108
20109// _loop0_77: lambda_param_with_default
20110static asdl_seq *
20111_loop0_77_rule(Parser *p)
20112{
20113 D(p->level++);
20114 if (p->error_indicator) {
20115 D(p->level--);
20116 return NULL;
20117 }
20118 void *_res = NULL;
20119 int _mark = p->mark;
20120 int _start_mark = p->mark;
20121 void **_children = PyMem_Malloc(sizeof(void *));
20122 if (!_children) {
20123 p->error_indicator = 1;
20124 PyErr_NoMemory();
20125 D(p->level--);
20126 return NULL;
20127 }
20128 ssize_t _children_capacity = 1;
20129 ssize_t _n = 0;
20130 { // lambda_param_with_default
20131 if (p->error_indicator) {
20132 D(p->level--);
20133 return NULL;
20134 }
20135 D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20136 NameDefaultPair* lambda_param_with_default_var;
20137 while (
20138 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20139 )
20140 {
20141 _res = lambda_param_with_default_var;
20142 if (_n == _children_capacity) {
20143 _children_capacity *= 2;
20144 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20145 if (!_new_children) {
20146 p->error_indicator = 1;
20147 PyErr_NoMemory();
20148 D(p->level--);
20149 return NULL;
20150 }
20151 _children = _new_children;
20152 }
20153 _children[_n++] = _res;
20154 _mark = p->mark;
20155 }
20156 p->mark = _mark;
20157 D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ',
20158 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20159 }
20160 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20161 if (!_seq) {
20162 PyMem_Free(_children);
20163 p->error_indicator = 1;
20164 PyErr_NoMemory();
20165 D(p->level--);
20166 return NULL;
20167 }
20168 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20169 PyMem_Free(_children);
20170 _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq);
20171 D(p->level--);
20172 return _seq;
20173}
20174
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020175// _loop0_78: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020176static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020177_loop0_78_rule(Parser *p)
20178{
20179 D(p->level++);
20180 if (p->error_indicator) {
20181 D(p->level--);
20182 return NULL;
20183 }
20184 void *_res = NULL;
20185 int _mark = p->mark;
20186 int _start_mark = p->mark;
20187 void **_children = PyMem_Malloc(sizeof(void *));
20188 if (!_children) {
20189 p->error_indicator = 1;
20190 PyErr_NoMemory();
20191 D(p->level--);
20192 return NULL;
20193 }
20194 ssize_t _children_capacity = 1;
20195 ssize_t _n = 0;
20196 { // lambda_param_with_default
20197 if (p->error_indicator) {
20198 D(p->level--);
20199 return NULL;
20200 }
20201 D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20202 NameDefaultPair* lambda_param_with_default_var;
20203 while (
20204 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20205 )
20206 {
20207 _res = lambda_param_with_default_var;
20208 if (_n == _children_capacity) {
20209 _children_capacity *= 2;
20210 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20211 if (!_new_children) {
20212 p->error_indicator = 1;
20213 PyErr_NoMemory();
20214 D(p->level--);
20215 return NULL;
20216 }
20217 _children = _new_children;
20218 }
20219 _children[_n++] = _res;
20220 _mark = p->mark;
20221 }
20222 p->mark = _mark;
20223 D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
20224 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20225 }
20226 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20227 if (!_seq) {
20228 PyMem_Free(_children);
20229 p->error_indicator = 1;
20230 PyErr_NoMemory();
20231 D(p->level--);
20232 return NULL;
20233 }
20234 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20235 PyMem_Free(_children);
20236 _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
20237 D(p->level--);
20238 return _seq;
20239}
20240
20241// _loop1_79: lambda_param_no_default
20242static asdl_seq *
20243_loop1_79_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020244{
20245 D(p->level++);
20246 if (p->error_indicator) {
20247 D(p->level--);
20248 return NULL;
20249 }
20250 void *_res = NULL;
20251 int _mark = p->mark;
20252 int _start_mark = p->mark;
20253 void **_children = PyMem_Malloc(sizeof(void *));
20254 if (!_children) {
20255 p->error_indicator = 1;
20256 PyErr_NoMemory();
20257 D(p->level--);
20258 return NULL;
20259 }
20260 ssize_t _children_capacity = 1;
20261 ssize_t _n = 0;
20262 { // lambda_param_no_default
20263 if (p->error_indicator) {
20264 D(p->level--);
20265 return NULL;
20266 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020267 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 +010020268 arg_ty lambda_param_no_default_var;
20269 while (
20270 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20271 )
20272 {
20273 _res = lambda_param_no_default_var;
20274 if (_n == _children_capacity) {
20275 _children_capacity *= 2;
20276 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20277 if (!_new_children) {
20278 p->error_indicator = 1;
20279 PyErr_NoMemory();
20280 D(p->level--);
20281 return NULL;
20282 }
20283 _children = _new_children;
20284 }
20285 _children[_n++] = _res;
20286 _mark = p->mark;
20287 }
20288 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020289 D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020290 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20291 }
20292 if (_n == 0 || p->error_indicator) {
20293 PyMem_Free(_children);
20294 D(p->level--);
20295 return NULL;
20296 }
20297 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20298 if (!_seq) {
20299 PyMem_Free(_children);
20300 p->error_indicator = 1;
20301 PyErr_NoMemory();
20302 D(p->level--);
20303 return NULL;
20304 }
20305 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20306 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020307 _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020308 D(p->level--);
20309 return _seq;
20310}
20311
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020312// _loop0_80: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020313static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020314_loop0_80_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020315{
20316 D(p->level++);
20317 if (p->error_indicator) {
20318 D(p->level--);
20319 return NULL;
20320 }
20321 void *_res = NULL;
20322 int _mark = p->mark;
20323 int _start_mark = p->mark;
20324 void **_children = PyMem_Malloc(sizeof(void *));
20325 if (!_children) {
20326 p->error_indicator = 1;
20327 PyErr_NoMemory();
20328 D(p->level--);
20329 return NULL;
20330 }
20331 ssize_t _children_capacity = 1;
20332 ssize_t _n = 0;
20333 { // lambda_param_with_default
20334 if (p->error_indicator) {
20335 D(p->level--);
20336 return NULL;
20337 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020338 D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020339 NameDefaultPair* lambda_param_with_default_var;
20340 while (
20341 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20342 )
20343 {
20344 _res = lambda_param_with_default_var;
20345 if (_n == _children_capacity) {
20346 _children_capacity *= 2;
20347 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20348 if (!_new_children) {
20349 p->error_indicator = 1;
20350 PyErr_NoMemory();
20351 D(p->level--);
20352 return NULL;
20353 }
20354 _children = _new_children;
20355 }
20356 _children[_n++] = _res;
20357 _mark = p->mark;
20358 }
20359 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020360 D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020361 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20362 }
20363 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20364 if (!_seq) {
20365 PyMem_Free(_children);
20366 p->error_indicator = 1;
20367 PyErr_NoMemory();
20368 D(p->level--);
20369 return NULL;
20370 }
20371 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20372 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020373 _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020374 D(p->level--);
20375 return _seq;
20376}
20377
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020378// _loop1_81: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020379static asdl_seq *
20380_loop1_81_rule(Parser *p)
20381{
20382 D(p->level++);
20383 if (p->error_indicator) {
20384 D(p->level--);
20385 return NULL;
20386 }
20387 void *_res = NULL;
20388 int _mark = p->mark;
20389 int _start_mark = p->mark;
20390 void **_children = PyMem_Malloc(sizeof(void *));
20391 if (!_children) {
20392 p->error_indicator = 1;
20393 PyErr_NoMemory();
20394 D(p->level--);
20395 return NULL;
20396 }
20397 ssize_t _children_capacity = 1;
20398 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020399 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020400 if (p->error_indicator) {
20401 D(p->level--);
20402 return NULL;
20403 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020404 D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20405 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020406 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020407 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020408 )
20409 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020410 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020411 if (_n == _children_capacity) {
20412 _children_capacity *= 2;
20413 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20414 if (!_new_children) {
20415 p->error_indicator = 1;
20416 PyErr_NoMemory();
20417 D(p->level--);
20418 return NULL;
20419 }
20420 _children = _new_children;
20421 }
20422 _children[_n++] = _res;
20423 _mark = p->mark;
20424 }
20425 p->mark = _mark;
20426 D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020427 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020428 }
20429 if (_n == 0 || p->error_indicator) {
20430 PyMem_Free(_children);
20431 D(p->level--);
20432 return NULL;
20433 }
20434 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20435 if (!_seq) {
20436 PyMem_Free(_children);
20437 p->error_indicator = 1;
20438 PyErr_NoMemory();
20439 D(p->level--);
20440 return NULL;
20441 }
20442 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20443 PyMem_Free(_children);
20444 _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
20445 D(p->level--);
20446 return _seq;
20447}
20448
20449// _loop1_82: lambda_param_no_default
20450static asdl_seq *
20451_loop1_82_rule(Parser *p)
20452{
20453 D(p->level++);
20454 if (p->error_indicator) {
20455 D(p->level--);
20456 return NULL;
20457 }
20458 void *_res = NULL;
20459 int _mark = p->mark;
20460 int _start_mark = p->mark;
20461 void **_children = PyMem_Malloc(sizeof(void *));
20462 if (!_children) {
20463 p->error_indicator = 1;
20464 PyErr_NoMemory();
20465 D(p->level--);
20466 return NULL;
20467 }
20468 ssize_t _children_capacity = 1;
20469 ssize_t _n = 0;
20470 { // lambda_param_no_default
20471 if (p->error_indicator) {
20472 D(p->level--);
20473 return NULL;
20474 }
20475 D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20476 arg_ty lambda_param_no_default_var;
20477 while (
20478 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20479 )
20480 {
20481 _res = lambda_param_no_default_var;
20482 if (_n == _children_capacity) {
20483 _children_capacity *= 2;
20484 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20485 if (!_new_children) {
20486 p->error_indicator = 1;
20487 PyErr_NoMemory();
20488 D(p->level--);
20489 return NULL;
20490 }
20491 _children = _new_children;
20492 }
20493 _children[_n++] = _res;
20494 _mark = p->mark;
20495 }
20496 p->mark = _mark;
20497 D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ',
20498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20499 }
20500 if (_n == 0 || p->error_indicator) {
20501 PyMem_Free(_children);
20502 D(p->level--);
20503 return NULL;
20504 }
20505 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20506 if (!_seq) {
20507 PyMem_Free(_children);
20508 p->error_indicator = 1;
20509 PyErr_NoMemory();
20510 D(p->level--);
20511 return NULL;
20512 }
20513 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20514 PyMem_Free(_children);
20515 _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq);
20516 D(p->level--);
20517 return _seq;
20518}
20519
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020520// _loop1_83: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020521static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020522_loop1_83_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020523{
20524 D(p->level++);
20525 if (p->error_indicator) {
20526 D(p->level--);
20527 return NULL;
20528 }
20529 void *_res = NULL;
20530 int _mark = p->mark;
20531 int _start_mark = p->mark;
20532 void **_children = PyMem_Malloc(sizeof(void *));
20533 if (!_children) {
20534 p->error_indicator = 1;
20535 PyErr_NoMemory();
20536 D(p->level--);
20537 return NULL;
20538 }
20539 ssize_t _children_capacity = 1;
20540 ssize_t _n = 0;
20541 { // lambda_param_no_default
20542 if (p->error_indicator) {
20543 D(p->level--);
20544 return NULL;
20545 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020546 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 +010020547 arg_ty lambda_param_no_default_var;
20548 while (
20549 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20550 )
20551 {
20552 _res = lambda_param_no_default_var;
20553 if (_n == _children_capacity) {
20554 _children_capacity *= 2;
20555 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20556 if (!_new_children) {
20557 p->error_indicator = 1;
20558 PyErr_NoMemory();
20559 D(p->level--);
20560 return NULL;
20561 }
20562 _children = _new_children;
20563 }
20564 _children[_n++] = _res;
20565 _mark = p->mark;
20566 }
20567 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020568 D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020569 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20570 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020571 if (_n == 0 || p->error_indicator) {
20572 PyMem_Free(_children);
20573 D(p->level--);
20574 return NULL;
20575 }
20576 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20577 if (!_seq) {
20578 PyMem_Free(_children);
20579 p->error_indicator = 1;
20580 PyErr_NoMemory();
20581 D(p->level--);
20582 return NULL;
20583 }
20584 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20585 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020586 _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020587 D(p->level--);
20588 return _seq;
20589}
20590
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020591// _loop0_84: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020592static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020593_loop0_84_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020594{
20595 D(p->level++);
20596 if (p->error_indicator) {
20597 D(p->level--);
20598 return NULL;
20599 }
20600 void *_res = NULL;
20601 int _mark = p->mark;
20602 int _start_mark = p->mark;
20603 void **_children = PyMem_Malloc(sizeof(void *));
20604 if (!_children) {
20605 p->error_indicator = 1;
20606 PyErr_NoMemory();
20607 D(p->level--);
20608 return NULL;
20609 }
20610 ssize_t _children_capacity = 1;
20611 ssize_t _n = 0;
20612 { // lambda_param_no_default
20613 if (p->error_indicator) {
20614 D(p->level--);
20615 return NULL;
20616 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020617 D(fprintf(stderr, "%*c> _loop0_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020618 arg_ty lambda_param_no_default_var;
20619 while (
20620 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20621 )
20622 {
20623 _res = lambda_param_no_default_var;
20624 if (_n == _children_capacity) {
20625 _children_capacity *= 2;
20626 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20627 if (!_new_children) {
20628 p->error_indicator = 1;
20629 PyErr_NoMemory();
20630 D(p->level--);
20631 return NULL;
20632 }
20633 _children = _new_children;
20634 }
20635 _children[_n++] = _res;
20636 _mark = p->mark;
20637 }
20638 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020639 D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020640 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20641 }
20642 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20643 if (!_seq) {
20644 PyMem_Free(_children);
20645 p->error_indicator = 1;
20646 PyErr_NoMemory();
20647 D(p->level--);
20648 return NULL;
20649 }
20650 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20651 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020652 _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020653 D(p->level--);
20654 return _seq;
20655}
20656
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020657// _loop1_85: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020658static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020659_loop1_85_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020660{
20661 D(p->level++);
20662 if (p->error_indicator) {
20663 D(p->level--);
20664 return NULL;
20665 }
20666 void *_res = NULL;
20667 int _mark = p->mark;
20668 int _start_mark = p->mark;
20669 void **_children = PyMem_Malloc(sizeof(void *));
20670 if (!_children) {
20671 p->error_indicator = 1;
20672 PyErr_NoMemory();
20673 D(p->level--);
20674 return NULL;
20675 }
20676 ssize_t _children_capacity = 1;
20677 ssize_t _n = 0;
20678 { // lambda_param_with_default
20679 if (p->error_indicator) {
20680 D(p->level--);
20681 return NULL;
20682 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020683 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 +010020684 NameDefaultPair* lambda_param_with_default_var;
20685 while (
20686 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20687 )
20688 {
20689 _res = lambda_param_with_default_var;
20690 if (_n == _children_capacity) {
20691 _children_capacity *= 2;
20692 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20693 if (!_new_children) {
20694 p->error_indicator = 1;
20695 PyErr_NoMemory();
20696 D(p->level--);
20697 return NULL;
20698 }
20699 _children = _new_children;
20700 }
20701 _children[_n++] = _res;
20702 _mark = p->mark;
20703 }
20704 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020705 D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020706 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20707 }
20708 if (_n == 0 || p->error_indicator) {
20709 PyMem_Free(_children);
20710 D(p->level--);
20711 return NULL;
20712 }
20713 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20714 if (!_seq) {
20715 PyMem_Free(_children);
20716 p->error_indicator = 1;
20717 PyErr_NoMemory();
20718 D(p->level--);
20719 return NULL;
20720 }
20721 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20722 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020723 _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020724 D(p->level--);
20725 return _seq;
20726}
20727
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020728// _loop0_86: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020729static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020730_loop0_86_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020731{
20732 D(p->level++);
20733 if (p->error_indicator) {
20734 D(p->level--);
20735 return NULL;
20736 }
20737 void *_res = NULL;
20738 int _mark = p->mark;
20739 int _start_mark = p->mark;
20740 void **_children = PyMem_Malloc(sizeof(void *));
20741 if (!_children) {
20742 p->error_indicator = 1;
20743 PyErr_NoMemory();
20744 D(p->level--);
20745 return NULL;
20746 }
20747 ssize_t _children_capacity = 1;
20748 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020749 { // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020750 if (p->error_indicator) {
20751 D(p->level--);
20752 return NULL;
20753 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020754 D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20755 arg_ty lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020756 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020757 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020758 )
20759 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020760 _res = lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020761 if (_n == _children_capacity) {
20762 _children_capacity *= 2;
20763 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20764 if (!_new_children) {
20765 p->error_indicator = 1;
20766 PyErr_NoMemory();
20767 D(p->level--);
20768 return NULL;
20769 }
20770 _children = _new_children;
20771 }
20772 _children[_n++] = _res;
20773 _mark = p->mark;
20774 }
20775 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020776 D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
20777 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020778 }
20779 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20780 if (!_seq) {
20781 PyMem_Free(_children);
20782 p->error_indicator = 1;
20783 PyErr_NoMemory();
20784 D(p->level--);
20785 return NULL;
20786 }
20787 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20788 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020789 _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020790 D(p->level--);
20791 return _seq;
20792}
20793
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020794// _loop1_87: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020795static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020796_loop1_87_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020797{
20798 D(p->level++);
20799 if (p->error_indicator) {
20800 D(p->level--);
20801 return NULL;
20802 }
20803 void *_res = NULL;
20804 int _mark = p->mark;
20805 int _start_mark = p->mark;
20806 void **_children = PyMem_Malloc(sizeof(void *));
20807 if (!_children) {
20808 p->error_indicator = 1;
20809 PyErr_NoMemory();
20810 D(p->level--);
20811 return NULL;
20812 }
20813 ssize_t _children_capacity = 1;
20814 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020815 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020816 if (p->error_indicator) {
20817 D(p->level--);
20818 return NULL;
20819 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020820 D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20821 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020822 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020823 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020824 )
20825 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020826 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020827 if (_n == _children_capacity) {
20828 _children_capacity *= 2;
20829 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20830 if (!_new_children) {
20831 p->error_indicator = 1;
20832 PyErr_NoMemory();
20833 D(p->level--);
20834 return NULL;
20835 }
20836 _children = _new_children;
20837 }
20838 _children[_n++] = _res;
20839 _mark = p->mark;
20840 }
20841 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020842 D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ',
20843 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020844 }
20845 if (_n == 0 || p->error_indicator) {
20846 PyMem_Free(_children);
20847 D(p->level--);
20848 return NULL;
20849 }
20850 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20851 if (!_seq) {
20852 PyMem_Free(_children);
20853 p->error_indicator = 1;
20854 PyErr_NoMemory();
20855 D(p->level--);
20856 return NULL;
20857 }
20858 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20859 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020860 _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020861 D(p->level--);
20862 return _seq;
20863}
20864
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020865// _loop0_88: lambda_param_maybe_default
20866static asdl_seq *
20867_loop0_88_rule(Parser *p)
20868{
20869 D(p->level++);
20870 if (p->error_indicator) {
20871 D(p->level--);
20872 return NULL;
20873 }
20874 void *_res = NULL;
20875 int _mark = p->mark;
20876 int _start_mark = p->mark;
20877 void **_children = PyMem_Malloc(sizeof(void *));
20878 if (!_children) {
20879 p->error_indicator = 1;
20880 PyErr_NoMemory();
20881 D(p->level--);
20882 return NULL;
20883 }
20884 ssize_t _children_capacity = 1;
20885 ssize_t _n = 0;
20886 { // lambda_param_maybe_default
20887 if (p->error_indicator) {
20888 D(p->level--);
20889 return NULL;
20890 }
20891 D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20892 NameDefaultPair* lambda_param_maybe_default_var;
20893 while (
20894 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20895 )
20896 {
20897 _res = lambda_param_maybe_default_var;
20898 if (_n == _children_capacity) {
20899 _children_capacity *= 2;
20900 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20901 if (!_new_children) {
20902 p->error_indicator = 1;
20903 PyErr_NoMemory();
20904 D(p->level--);
20905 return NULL;
20906 }
20907 _children = _new_children;
20908 }
20909 _children[_n++] = _res;
20910 _mark = p->mark;
20911 }
20912 p->mark = _mark;
20913 D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ',
20914 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20915 }
20916 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20917 if (!_seq) {
20918 PyMem_Free(_children);
20919 p->error_indicator = 1;
20920 PyErr_NoMemory();
20921 D(p->level--);
20922 return NULL;
20923 }
20924 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20925 PyMem_Free(_children);
20926 _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq);
20927 D(p->level--);
20928 return _seq;
20929}
20930
20931// _loop1_89: lambda_param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020932static asdl_seq *
20933_loop1_89_rule(Parser *p)
20934{
20935 D(p->level++);
20936 if (p->error_indicator) {
20937 D(p->level--);
20938 return NULL;
20939 }
20940 void *_res = NULL;
20941 int _mark = p->mark;
20942 int _start_mark = p->mark;
20943 void **_children = PyMem_Malloc(sizeof(void *));
20944 if (!_children) {
20945 p->error_indicator = 1;
20946 PyErr_NoMemory();
20947 D(p->level--);
20948 return NULL;
20949 }
20950 ssize_t _children_capacity = 1;
20951 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020952 { // lambda_param_maybe_default
20953 if (p->error_indicator) {
20954 D(p->level--);
20955 return NULL;
20956 }
20957 D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20958 NameDefaultPair* lambda_param_maybe_default_var;
20959 while (
20960 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20961 )
20962 {
20963 _res = lambda_param_maybe_default_var;
20964 if (_n == _children_capacity) {
20965 _children_capacity *= 2;
20966 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20967 if (!_new_children) {
20968 p->error_indicator = 1;
20969 PyErr_NoMemory();
20970 D(p->level--);
20971 return NULL;
20972 }
20973 _children = _new_children;
20974 }
20975 _children[_n++] = _res;
20976 _mark = p->mark;
20977 }
20978 p->mark = _mark;
20979 D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ',
20980 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20981 }
20982 if (_n == 0 || p->error_indicator) {
20983 PyMem_Free(_children);
20984 D(p->level--);
20985 return NULL;
20986 }
20987 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20988 if (!_seq) {
20989 PyMem_Free(_children);
20990 p->error_indicator = 1;
20991 PyErr_NoMemory();
20992 D(p->level--);
20993 return NULL;
20994 }
20995 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20996 PyMem_Free(_children);
20997 _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
20998 D(p->level--);
20999 return _seq;
21000}
21001
21002// _loop1_90: ('or' conjunction)
21003static asdl_seq *
21004_loop1_90_rule(Parser *p)
21005{
21006 D(p->level++);
21007 if (p->error_indicator) {
21008 D(p->level--);
21009 return NULL;
21010 }
21011 void *_res = NULL;
21012 int _mark = p->mark;
21013 int _start_mark = p->mark;
21014 void **_children = PyMem_Malloc(sizeof(void *));
21015 if (!_children) {
21016 p->error_indicator = 1;
21017 PyErr_NoMemory();
21018 D(p->level--);
21019 return NULL;
21020 }
21021 ssize_t _children_capacity = 1;
21022 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021023 { // ('or' conjunction)
21024 if (p->error_indicator) {
21025 D(p->level--);
21026 return NULL;
21027 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021028 D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021029 void *_tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021030 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021031 (_tmp_144_var = _tmp_144_rule(p)) // 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021032 )
21033 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021034 _res = _tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021035 if (_n == _children_capacity) {
21036 _children_capacity *= 2;
21037 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21038 if (!_new_children) {
21039 p->error_indicator = 1;
21040 PyErr_NoMemory();
21041 D(p->level--);
21042 return NULL;
21043 }
21044 _children = _new_children;
21045 }
21046 _children[_n++] = _res;
21047 _mark = p->mark;
21048 }
21049 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021050 D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021051 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
21052 }
21053 if (_n == 0 || p->error_indicator) {
21054 PyMem_Free(_children);
21055 D(p->level--);
21056 return NULL;
21057 }
21058 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21059 if (!_seq) {
21060 PyMem_Free(_children);
21061 p->error_indicator = 1;
21062 PyErr_NoMemory();
21063 D(p->level--);
21064 return NULL;
21065 }
21066 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21067 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021068 _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021069 D(p->level--);
21070 return _seq;
21071}
21072
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021073// _loop1_91: ('and' inversion)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021074static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021075_loop1_91_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021076{
21077 D(p->level++);
21078 if (p->error_indicator) {
21079 D(p->level--);
21080 return NULL;
21081 }
21082 void *_res = NULL;
21083 int _mark = p->mark;
21084 int _start_mark = p->mark;
21085 void **_children = PyMem_Malloc(sizeof(void *));
21086 if (!_children) {
21087 p->error_indicator = 1;
21088 PyErr_NoMemory();
21089 D(p->level--);
21090 return NULL;
21091 }
21092 ssize_t _children_capacity = 1;
21093 ssize_t _n = 0;
21094 { // ('and' inversion)
21095 if (p->error_indicator) {
21096 D(p->level--);
21097 return NULL;
21098 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021099 D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021100 void *_tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021101 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021102 (_tmp_145_var = _tmp_145_rule(p)) // 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021103 )
21104 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021105 _res = _tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021106 if (_n == _children_capacity) {
21107 _children_capacity *= 2;
21108 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21109 if (!_new_children) {
21110 p->error_indicator = 1;
21111 PyErr_NoMemory();
21112 D(p->level--);
21113 return NULL;
21114 }
21115 _children = _new_children;
21116 }
21117 _children[_n++] = _res;
21118 _mark = p->mark;
21119 }
21120 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021121 D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021122 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
21123 }
21124 if (_n == 0 || p->error_indicator) {
21125 PyMem_Free(_children);
21126 D(p->level--);
21127 return NULL;
21128 }
21129 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21130 if (!_seq) {
21131 PyMem_Free(_children);
21132 p->error_indicator = 1;
21133 PyErr_NoMemory();
21134 D(p->level--);
21135 return NULL;
21136 }
21137 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21138 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021139 _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021140 D(p->level--);
21141 return _seq;
21142}
21143
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021144// _loop1_92: compare_op_bitwise_or_pair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021145static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021146_loop1_92_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021147{
21148 D(p->level++);
21149 if (p->error_indicator) {
21150 D(p->level--);
21151 return NULL;
21152 }
21153 void *_res = NULL;
21154 int _mark = p->mark;
21155 int _start_mark = p->mark;
21156 void **_children = PyMem_Malloc(sizeof(void *));
21157 if (!_children) {
21158 p->error_indicator = 1;
21159 PyErr_NoMemory();
21160 D(p->level--);
21161 return NULL;
21162 }
21163 ssize_t _children_capacity = 1;
21164 ssize_t _n = 0;
21165 { // compare_op_bitwise_or_pair
21166 if (p->error_indicator) {
21167 D(p->level--);
21168 return NULL;
21169 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021170 D(fprintf(stderr, "%*c> _loop1_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021171 CmpopExprPair* compare_op_bitwise_or_pair_var;
21172 while (
21173 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
21174 )
21175 {
21176 _res = compare_op_bitwise_or_pair_var;
21177 if (_n == _children_capacity) {
21178 _children_capacity *= 2;
21179 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21180 if (!_new_children) {
21181 p->error_indicator = 1;
21182 PyErr_NoMemory();
21183 D(p->level--);
21184 return NULL;
21185 }
21186 _children = _new_children;
21187 }
21188 _children[_n++] = _res;
21189 _mark = p->mark;
21190 }
21191 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021192 D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021193 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
21194 }
21195 if (_n == 0 || p->error_indicator) {
21196 PyMem_Free(_children);
21197 D(p->level--);
21198 return NULL;
21199 }
21200 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21201 if (!_seq) {
21202 PyMem_Free(_children);
21203 p->error_indicator = 1;
21204 PyErr_NoMemory();
21205 D(p->level--);
21206 return NULL;
21207 }
21208 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21209 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021210 _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021211 D(p->level--);
21212 return _seq;
21213}
21214
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021215// _tmp_93: '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021216static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021217_tmp_93_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021218{
21219 D(p->level++);
21220 if (p->error_indicator) {
21221 D(p->level--);
21222 return NULL;
21223 }
21224 void * _res = NULL;
21225 int _mark = p->mark;
21226 { // '!='
21227 if (p->error_indicator) {
21228 D(p->level--);
21229 return NULL;
21230 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021231 D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021232 Token * tok;
21233 if (
21234 (tok = _PyPegen_expect_token(p, 28)) // token='!='
21235 )
21236 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021237 D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021238 _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok;
21239 if (_res == NULL && PyErr_Occurred()) {
21240 p->error_indicator = 1;
21241 D(p->level--);
21242 return NULL;
21243 }
21244 goto done;
21245 }
21246 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021247 D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021248 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
21249 }
21250 _res = NULL;
21251 done:
21252 D(p->level--);
21253 return _res;
21254}
21255
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021256// _loop0_95: ',' slice
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021257static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021258_loop0_95_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021259{
21260 D(p->level++);
21261 if (p->error_indicator) {
21262 D(p->level--);
21263 return NULL;
21264 }
21265 void *_res = NULL;
21266 int _mark = p->mark;
21267 int _start_mark = p->mark;
21268 void **_children = PyMem_Malloc(sizeof(void *));
21269 if (!_children) {
21270 p->error_indicator = 1;
21271 PyErr_NoMemory();
21272 D(p->level--);
21273 return NULL;
21274 }
21275 ssize_t _children_capacity = 1;
21276 ssize_t _n = 0;
21277 { // ',' slice
21278 if (p->error_indicator) {
21279 D(p->level--);
21280 return NULL;
21281 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021282 D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021283 Token * _literal;
21284 expr_ty elem;
21285 while (
21286 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21287 &&
21288 (elem = slice_rule(p)) // slice
21289 )
21290 {
21291 _res = elem;
21292 if (_res == NULL && PyErr_Occurred()) {
21293 p->error_indicator = 1;
21294 PyMem_Free(_children);
21295 D(p->level--);
21296 return NULL;
21297 }
21298 if (_n == _children_capacity) {
21299 _children_capacity *= 2;
21300 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21301 if (!_new_children) {
21302 p->error_indicator = 1;
21303 PyErr_NoMemory();
21304 D(p->level--);
21305 return NULL;
21306 }
21307 _children = _new_children;
21308 }
21309 _children[_n++] = _res;
21310 _mark = p->mark;
21311 }
21312 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021313 D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021314 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
21315 }
21316 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21317 if (!_seq) {
21318 PyMem_Free(_children);
21319 p->error_indicator = 1;
21320 PyErr_NoMemory();
21321 D(p->level--);
21322 return NULL;
21323 }
21324 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21325 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021326 _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021327 D(p->level--);
21328 return _seq;
21329}
21330
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021331// _gather_94: slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021332static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021333_gather_94_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021334{
21335 D(p->level++);
21336 if (p->error_indicator) {
21337 D(p->level--);
21338 return NULL;
21339 }
21340 asdl_seq * _res = NULL;
21341 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021342 { // slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021343 if (p->error_indicator) {
21344 D(p->level--);
21345 return NULL;
21346 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021347 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 +010021348 expr_ty elem;
21349 asdl_seq * seq;
21350 if (
21351 (elem = slice_rule(p)) // slice
21352 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021353 (seq = _loop0_95_rule(p)) // _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021354 )
21355 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021356 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 +010021357 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21358 goto done;
21359 }
21360 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021361 D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ',
21362 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_95"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021363 }
21364 _res = NULL;
21365 done:
21366 D(p->level--);
21367 return _res;
21368}
21369
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021370// _tmp_96: ':' expression?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021371static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021372_tmp_96_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021373{
21374 D(p->level++);
21375 if (p->error_indicator) {
21376 D(p->level--);
21377 return NULL;
21378 }
21379 void * _res = NULL;
21380 int _mark = p->mark;
21381 { // ':' expression?
21382 if (p->error_indicator) {
21383 D(p->level--);
21384 return NULL;
21385 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021386 D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021387 Token * _literal;
21388 void *d;
21389 if (
21390 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
21391 &&
21392 (d = expression_rule(p), 1) // expression?
21393 )
21394 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021395 D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021396 _res = d;
21397 if (_res == NULL && PyErr_Occurred()) {
21398 p->error_indicator = 1;
21399 D(p->level--);
21400 return NULL;
21401 }
21402 goto done;
21403 }
21404 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021405 D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021406 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
21407 }
21408 _res = NULL;
21409 done:
21410 D(p->level--);
21411 return _res;
21412}
21413
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021414// _tmp_97: tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021415static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021416_tmp_97_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021417{
21418 D(p->level++);
21419 if (p->error_indicator) {
21420 D(p->level--);
21421 return NULL;
21422 }
21423 void * _res = NULL;
21424 int _mark = p->mark;
21425 { // tuple
21426 if (p->error_indicator) {
21427 D(p->level--);
21428 return NULL;
21429 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021430 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021431 expr_ty tuple_var;
21432 if (
21433 (tuple_var = tuple_rule(p)) // tuple
21434 )
21435 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021436 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021437 _res = tuple_var;
21438 goto done;
21439 }
21440 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021441 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021442 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
21443 }
21444 { // group
21445 if (p->error_indicator) {
21446 D(p->level--);
21447 return NULL;
21448 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021449 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021450 expr_ty group_var;
21451 if (
21452 (group_var = group_rule(p)) // group
21453 )
21454 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021455 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021456 _res = group_var;
21457 goto done;
21458 }
21459 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021460 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021461 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
21462 }
21463 { // genexp
21464 if (p->error_indicator) {
21465 D(p->level--);
21466 return NULL;
21467 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021468 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021469 expr_ty genexp_var;
21470 if (
21471 (genexp_var = genexp_rule(p)) // genexp
21472 )
21473 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021474 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021475 _res = genexp_var;
21476 goto done;
21477 }
21478 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021479 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021480 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
21481 }
21482 _res = NULL;
21483 done:
21484 D(p->level--);
21485 return _res;
21486}
21487
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021488// _tmp_98: list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021489static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021490_tmp_98_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021491{
21492 D(p->level++);
21493 if (p->error_indicator) {
21494 D(p->level--);
21495 return NULL;
21496 }
21497 void * _res = NULL;
21498 int _mark = p->mark;
21499 { // list
21500 if (p->error_indicator) {
21501 D(p->level--);
21502 return NULL;
21503 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021504 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021505 expr_ty list_var;
21506 if (
21507 (list_var = list_rule(p)) // list
21508 )
21509 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021510 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021511 _res = list_var;
21512 goto done;
21513 }
21514 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021515 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021516 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
21517 }
21518 { // listcomp
21519 if (p->error_indicator) {
21520 D(p->level--);
21521 return NULL;
21522 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021523 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021524 expr_ty listcomp_var;
21525 if (
21526 (listcomp_var = listcomp_rule(p)) // listcomp
21527 )
21528 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021529 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021530 _res = listcomp_var;
21531 goto done;
21532 }
21533 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021534 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021535 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
21536 }
21537 _res = NULL;
21538 done:
21539 D(p->level--);
21540 return _res;
21541}
21542
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021543// _tmp_99: dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021544static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021545_tmp_99_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021546{
21547 D(p->level++);
21548 if (p->error_indicator) {
21549 D(p->level--);
21550 return NULL;
21551 }
21552 void * _res = NULL;
21553 int _mark = p->mark;
21554 { // dict
21555 if (p->error_indicator) {
21556 D(p->level--);
21557 return NULL;
21558 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021559 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021560 expr_ty dict_var;
21561 if (
21562 (dict_var = dict_rule(p)) // dict
21563 )
21564 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021565 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021566 _res = dict_var;
21567 goto done;
21568 }
21569 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021570 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021571 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
21572 }
21573 { // set
21574 if (p->error_indicator) {
21575 D(p->level--);
21576 return NULL;
21577 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021578 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021579 expr_ty set_var;
21580 if (
21581 (set_var = set_rule(p)) // set
21582 )
21583 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021584 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021585 _res = set_var;
21586 goto done;
21587 }
21588 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021589 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021590 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
21591 }
21592 { // dictcomp
21593 if (p->error_indicator) {
21594 D(p->level--);
21595 return NULL;
21596 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021597 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021598 expr_ty dictcomp_var;
21599 if (
21600 (dictcomp_var = dictcomp_rule(p)) // dictcomp
21601 )
21602 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021603 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021604 _res = dictcomp_var;
21605 goto done;
21606 }
21607 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021608 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021609 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
21610 }
21611 { // setcomp
21612 if (p->error_indicator) {
21613 D(p->level--);
21614 return NULL;
21615 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021616 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021617 expr_ty setcomp_var;
21618 if (
21619 (setcomp_var = setcomp_rule(p)) // setcomp
21620 )
21621 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021622 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021623 _res = setcomp_var;
21624 goto done;
21625 }
21626 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021627 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021628 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
21629 }
21630 _res = NULL;
21631 done:
21632 D(p->level--);
21633 return _res;
21634}
21635
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021636// _loop1_100: STRING
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021637static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021638_loop1_100_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021639{
21640 D(p->level++);
21641 if (p->error_indicator) {
21642 D(p->level--);
21643 return NULL;
21644 }
21645 void *_res = NULL;
21646 int _mark = p->mark;
21647 int _start_mark = p->mark;
21648 void **_children = PyMem_Malloc(sizeof(void *));
21649 if (!_children) {
21650 p->error_indicator = 1;
21651 PyErr_NoMemory();
21652 D(p->level--);
21653 return NULL;
21654 }
21655 ssize_t _children_capacity = 1;
21656 ssize_t _n = 0;
21657 { // STRING
21658 if (p->error_indicator) {
21659 D(p->level--);
21660 return NULL;
21661 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021662 D(fprintf(stderr, "%*c> _loop1_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021663 expr_ty string_var;
21664 while (
21665 (string_var = _PyPegen_string_token(p)) // STRING
21666 )
21667 {
21668 _res = string_var;
21669 if (_n == _children_capacity) {
21670 _children_capacity *= 2;
21671 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21672 if (!_new_children) {
21673 p->error_indicator = 1;
21674 PyErr_NoMemory();
21675 D(p->level--);
21676 return NULL;
21677 }
21678 _children = _new_children;
21679 }
21680 _children[_n++] = _res;
21681 _mark = p->mark;
21682 }
21683 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021684 D(fprintf(stderr, "%*c%s _loop1_100[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021685 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
21686 }
21687 if (_n == 0 || p->error_indicator) {
21688 PyMem_Free(_children);
21689 D(p->level--);
21690 return NULL;
21691 }
21692 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21693 if (!_seq) {
21694 PyMem_Free(_children);
21695 p->error_indicator = 1;
21696 PyErr_NoMemory();
21697 D(p->level--);
21698 return NULL;
21699 }
21700 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21701 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021702 _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021703 D(p->level--);
21704 return _seq;
21705}
21706
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021707// _tmp_101: star_named_expression ',' star_named_expressions?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021708static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021709_tmp_101_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021710{
21711 D(p->level++);
21712 if (p->error_indicator) {
21713 D(p->level--);
21714 return NULL;
21715 }
21716 void * _res = NULL;
21717 int _mark = p->mark;
21718 { // star_named_expression ',' star_named_expressions?
21719 if (p->error_indicator) {
21720 D(p->level--);
21721 return NULL;
21722 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021723 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 +010021724 Token * _literal;
21725 expr_ty y;
21726 void *z;
21727 if (
21728 (y = star_named_expression_rule(p)) // star_named_expression
21729 &&
21730 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21731 &&
21732 (z = star_named_expressions_rule(p), 1) // star_named_expressions?
21733 )
21734 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021735 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 +010021736 _res = _PyPegen_seq_insert_in_front ( p , y , z );
21737 if (_res == NULL && PyErr_Occurred()) {
21738 p->error_indicator = 1;
21739 D(p->level--);
21740 return NULL;
21741 }
21742 goto done;
21743 }
21744 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021745 D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021746 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
21747 }
21748 _res = NULL;
21749 done:
21750 D(p->level--);
21751 return _res;
21752}
21753
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021754// _tmp_102: yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021755static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021756_tmp_102_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021757{
21758 D(p->level++);
21759 if (p->error_indicator) {
21760 D(p->level--);
21761 return NULL;
21762 }
21763 void * _res = NULL;
21764 int _mark = p->mark;
21765 { // yield_expr
21766 if (p->error_indicator) {
21767 D(p->level--);
21768 return NULL;
21769 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021770 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021771 expr_ty yield_expr_var;
21772 if (
21773 (yield_expr_var = yield_expr_rule(p)) // yield_expr
21774 )
21775 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021776 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 +010021777 _res = yield_expr_var;
21778 goto done;
21779 }
21780 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021781 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021782 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
21783 }
21784 { // named_expression
21785 if (p->error_indicator) {
21786 D(p->level--);
21787 return NULL;
21788 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021789 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021790 expr_ty named_expression_var;
21791 if (
21792 (named_expression_var = named_expression_rule(p)) // named_expression
21793 )
21794 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021795 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 +010021796 _res = named_expression_var;
21797 goto done;
21798 }
21799 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021800 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021801 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
21802 }
21803 _res = NULL;
21804 done:
21805 D(p->level--);
21806 return _res;
21807}
21808
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021809// _loop0_104: ',' double_starred_kvpair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021810static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021811_loop0_104_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021812{
21813 D(p->level++);
21814 if (p->error_indicator) {
21815 D(p->level--);
21816 return NULL;
21817 }
21818 void *_res = NULL;
21819 int _mark = p->mark;
21820 int _start_mark = p->mark;
21821 void **_children = PyMem_Malloc(sizeof(void *));
21822 if (!_children) {
21823 p->error_indicator = 1;
21824 PyErr_NoMemory();
21825 D(p->level--);
21826 return NULL;
21827 }
21828 ssize_t _children_capacity = 1;
21829 ssize_t _n = 0;
21830 { // ',' double_starred_kvpair
21831 if (p->error_indicator) {
21832 D(p->level--);
21833 return NULL;
21834 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021835 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 +010021836 Token * _literal;
21837 KeyValuePair* elem;
21838 while (
21839 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21840 &&
21841 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21842 )
21843 {
21844 _res = elem;
21845 if (_res == NULL && PyErr_Occurred()) {
21846 p->error_indicator = 1;
21847 PyMem_Free(_children);
21848 D(p->level--);
21849 return NULL;
21850 }
21851 if (_n == _children_capacity) {
21852 _children_capacity *= 2;
21853 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21854 if (!_new_children) {
21855 p->error_indicator = 1;
21856 PyErr_NoMemory();
21857 D(p->level--);
21858 return NULL;
21859 }
21860 _children = _new_children;
21861 }
21862 _children[_n++] = _res;
21863 _mark = p->mark;
21864 }
21865 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021866 D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021867 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
21868 }
21869 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21870 if (!_seq) {
21871 PyMem_Free(_children);
21872 p->error_indicator = 1;
21873 PyErr_NoMemory();
21874 D(p->level--);
21875 return NULL;
21876 }
21877 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21878 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021879 _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021880 D(p->level--);
21881 return _seq;
21882}
21883
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021884// _gather_103: double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021885static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021886_gather_103_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021887{
21888 D(p->level++);
21889 if (p->error_indicator) {
21890 D(p->level--);
21891 return NULL;
21892 }
21893 asdl_seq * _res = NULL;
21894 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021895 { // double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021896 if (p->error_indicator) {
21897 D(p->level--);
21898 return NULL;
21899 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021900 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 +010021901 KeyValuePair* elem;
21902 asdl_seq * seq;
21903 if (
21904 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21905 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021906 (seq = _loop0_104_rule(p)) // _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021907 )
21908 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021909 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 +010021910 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21911 goto done;
21912 }
21913 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021914 D(fprintf(stderr, "%*c%s _gather_103[%d-%d]: %s failed!\n", p->level, ' ',
21915 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_104"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021916 }
21917 _res = NULL;
21918 done:
21919 D(p->level--);
21920 return _res;
21921}
21922
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021923// _loop1_105: for_if_clause
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021924static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021925_loop1_105_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021926{
21927 D(p->level++);
21928 if (p->error_indicator) {
21929 D(p->level--);
21930 return NULL;
21931 }
21932 void *_res = NULL;
21933 int _mark = p->mark;
21934 int _start_mark = p->mark;
21935 void **_children = PyMem_Malloc(sizeof(void *));
21936 if (!_children) {
21937 p->error_indicator = 1;
21938 PyErr_NoMemory();
21939 D(p->level--);
21940 return NULL;
21941 }
21942 ssize_t _children_capacity = 1;
21943 ssize_t _n = 0;
21944 { // for_if_clause
21945 if (p->error_indicator) {
21946 D(p->level--);
21947 return NULL;
21948 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021949 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 +010021950 comprehension_ty for_if_clause_var;
21951 while (
21952 (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
21953 )
21954 {
21955 _res = for_if_clause_var;
21956 if (_n == _children_capacity) {
21957 _children_capacity *= 2;
21958 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21959 if (!_new_children) {
21960 p->error_indicator = 1;
21961 PyErr_NoMemory();
21962 D(p->level--);
21963 return NULL;
21964 }
21965 _children = _new_children;
21966 }
21967 _children[_n++] = _res;
21968 _mark = p->mark;
21969 }
21970 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021971 D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021972 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
21973 }
21974 if (_n == 0 || p->error_indicator) {
21975 PyMem_Free(_children);
21976 D(p->level--);
21977 return NULL;
21978 }
21979 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21980 if (!_seq) {
21981 PyMem_Free(_children);
21982 p->error_indicator = 1;
21983 PyErr_NoMemory();
21984 D(p->level--);
21985 return NULL;
21986 }
21987 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21988 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021989 _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021990 D(p->level--);
21991 return _seq;
21992}
21993
21994// _loop0_106: ('if' disjunction)
21995static asdl_seq *
21996_loop0_106_rule(Parser *p)
21997{
21998 D(p->level++);
21999 if (p->error_indicator) {
22000 D(p->level--);
22001 return NULL;
22002 }
22003 void *_res = NULL;
22004 int _mark = p->mark;
22005 int _start_mark = p->mark;
22006 void **_children = PyMem_Malloc(sizeof(void *));
22007 if (!_children) {
22008 p->error_indicator = 1;
22009 PyErr_NoMemory();
22010 D(p->level--);
22011 return NULL;
22012 }
22013 ssize_t _children_capacity = 1;
22014 ssize_t _n = 0;
22015 { // ('if' disjunction)
22016 if (p->error_indicator) {
22017 D(p->level--);
22018 return NULL;
22019 }
22020 D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022021 void *_tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022022 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022023 (_tmp_146_var = _tmp_146_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022024 )
22025 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022026 _res = _tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022027 if (_n == _children_capacity) {
22028 _children_capacity *= 2;
22029 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22030 if (!_new_children) {
22031 p->error_indicator = 1;
22032 PyErr_NoMemory();
22033 D(p->level--);
22034 return NULL;
22035 }
22036 _children = _new_children;
22037 }
22038 _children[_n++] = _res;
22039 _mark = p->mark;
22040 }
22041 p->mark = _mark;
22042 D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ',
22043 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
22044 }
22045 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22046 if (!_seq) {
22047 PyMem_Free(_children);
22048 p->error_indicator = 1;
22049 PyErr_NoMemory();
22050 D(p->level--);
22051 return NULL;
22052 }
22053 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22054 PyMem_Free(_children);
22055 _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq);
22056 D(p->level--);
22057 return _seq;
22058}
22059
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022060// _loop0_107: ('if' disjunction)
22061static asdl_seq *
22062_loop0_107_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022063{
22064 D(p->level++);
22065 if (p->error_indicator) {
22066 D(p->level--);
22067 return NULL;
22068 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022069 void *_res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022070 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022071 int _start_mark = p->mark;
22072 void **_children = PyMem_Malloc(sizeof(void *));
22073 if (!_children) {
22074 p->error_indicator = 1;
22075 PyErr_NoMemory();
22076 D(p->level--);
22077 return NULL;
22078 }
22079 ssize_t _children_capacity = 1;
22080 ssize_t _n = 0;
22081 { // ('if' disjunction)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022082 if (p->error_indicator) {
22083 D(p->level--);
22084 return NULL;
22085 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022086 D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022087 void *_tmp_147_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022088 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022089 (_tmp_147_var = _tmp_147_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022090 )
22091 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022092 _res = _tmp_147_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022093 if (_n == _children_capacity) {
22094 _children_capacity *= 2;
22095 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22096 if (!_new_children) {
22097 p->error_indicator = 1;
22098 PyErr_NoMemory();
22099 D(p->level--);
22100 return NULL;
22101 }
22102 _children = _new_children;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022103 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022104 _children[_n++] = _res;
22105 _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022106 }
22107 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022108 D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ',
22109 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022110 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022111 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22112 if (!_seq) {
22113 PyMem_Free(_children);
22114 p->error_indicator = 1;
22115 PyErr_NoMemory();
22116 D(p->level--);
22117 return NULL;
22118 }
22119 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22120 PyMem_Free(_children);
22121 _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022122 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022123 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022124}
22125
22126// _tmp_108: ',' args
22127static void *
22128_tmp_108_rule(Parser *p)
22129{
22130 D(p->level++);
22131 if (p->error_indicator) {
22132 D(p->level--);
22133 return NULL;
22134 }
22135 void * _res = NULL;
22136 int _mark = p->mark;
22137 { // ',' args
22138 if (p->error_indicator) {
22139 D(p->level--);
22140 return NULL;
22141 }
22142 D(fprintf(stderr, "%*c> _tmp_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args"));
22143 Token * _literal;
22144 expr_ty c;
22145 if (
22146 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22147 &&
22148 (c = args_rule(p)) // args
22149 )
22150 {
22151 D(fprintf(stderr, "%*c+ _tmp_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args"));
22152 _res = c;
22153 if (_res == NULL && PyErr_Occurred()) {
22154 p->error_indicator = 1;
22155 D(p->level--);
22156 return NULL;
22157 }
22158 goto done;
22159 }
22160 p->mark = _mark;
22161 D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ',
22162 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args"));
22163 }
22164 _res = NULL;
22165 done:
22166 D(p->level--);
22167 return _res;
22168}
22169
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022170// _tmp_109: ',' args
22171static void *
22172_tmp_109_rule(Parser *p)
22173{
22174 D(p->level++);
22175 if (p->error_indicator) {
22176 D(p->level--);
22177 return NULL;
22178 }
22179 void * _res = NULL;
22180 int _mark = p->mark;
22181 { // ',' args
22182 if (p->error_indicator) {
22183 D(p->level--);
22184 return NULL;
22185 }
22186 D(fprintf(stderr, "%*c> _tmp_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args"));
22187 Token * _literal;
22188 expr_ty c;
22189 if (
22190 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22191 &&
22192 (c = args_rule(p)) // args
22193 )
22194 {
22195 D(fprintf(stderr, "%*c+ _tmp_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args"));
22196 _res = c;
22197 if (_res == NULL && PyErr_Occurred()) {
22198 p->error_indicator = 1;
22199 D(p->level--);
22200 return NULL;
22201 }
22202 goto done;
22203 }
22204 p->mark = _mark;
22205 D(fprintf(stderr, "%*c%s _tmp_109[%d-%d]: %s failed!\n", p->level, ' ',
22206 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args"));
22207 }
22208 _res = NULL;
22209 done:
22210 D(p->level--);
22211 return _res;
22212}
22213
22214// _loop0_111: ',' kwarg_or_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022215static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022216_loop0_111_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022217{
22218 D(p->level++);
22219 if (p->error_indicator) {
22220 D(p->level--);
22221 return NULL;
22222 }
22223 void *_res = NULL;
22224 int _mark = p->mark;
22225 int _start_mark = p->mark;
22226 void **_children = PyMem_Malloc(sizeof(void *));
22227 if (!_children) {
22228 p->error_indicator = 1;
22229 PyErr_NoMemory();
22230 D(p->level--);
22231 return NULL;
22232 }
22233 ssize_t _children_capacity = 1;
22234 ssize_t _n = 0;
22235 { // ',' kwarg_or_starred
22236 if (p->error_indicator) {
22237 D(p->level--);
22238 return NULL;
22239 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022240 D(fprintf(stderr, "%*c> _loop0_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022241 Token * _literal;
22242 KeywordOrStarred* elem;
22243 while (
22244 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22245 &&
22246 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22247 )
22248 {
22249 _res = elem;
22250 if (_res == NULL && PyErr_Occurred()) {
22251 p->error_indicator = 1;
22252 PyMem_Free(_children);
22253 D(p->level--);
22254 return NULL;
22255 }
22256 if (_n == _children_capacity) {
22257 _children_capacity *= 2;
22258 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22259 if (!_new_children) {
22260 p->error_indicator = 1;
22261 PyErr_NoMemory();
22262 D(p->level--);
22263 return NULL;
22264 }
22265 _children = _new_children;
22266 }
22267 _children[_n++] = _res;
22268 _mark = p->mark;
22269 }
22270 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022271 D(fprintf(stderr, "%*c%s _loop0_111[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022272 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22273 }
22274 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22275 if (!_seq) {
22276 PyMem_Free(_children);
22277 p->error_indicator = 1;
22278 PyErr_NoMemory();
22279 D(p->level--);
22280 return NULL;
22281 }
22282 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22283 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022284 _PyPegen_insert_memo(p, _start_mark, _loop0_111_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022285 D(p->level--);
22286 return _seq;
22287}
22288
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022289// _gather_110: kwarg_or_starred _loop0_111
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022290static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022291_gather_110_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022292{
22293 D(p->level++);
22294 if (p->error_indicator) {
22295 D(p->level--);
22296 return NULL;
22297 }
22298 asdl_seq * _res = NULL;
22299 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022300 { // kwarg_or_starred _loop0_111
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022301 if (p->error_indicator) {
22302 D(p->level--);
22303 return NULL;
22304 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022305 D(fprintf(stderr, "%*c> _gather_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_111"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022306 KeywordOrStarred* elem;
22307 asdl_seq * seq;
22308 if (
22309 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22310 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022311 (seq = _loop0_111_rule(p)) // _loop0_111
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022312 )
22313 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022314 D(fprintf(stderr, "%*c+ _gather_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_111"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022315 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22316 goto done;
22317 }
22318 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022319 D(fprintf(stderr, "%*c%s _gather_110[%d-%d]: %s failed!\n", p->level, ' ',
22320 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_111"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022321 }
22322 _res = NULL;
22323 done:
22324 D(p->level--);
22325 return _res;
22326}
22327
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022328// _loop0_113: ',' kwarg_or_double_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022329static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022330_loop0_113_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022331{
22332 D(p->level++);
22333 if (p->error_indicator) {
22334 D(p->level--);
22335 return NULL;
22336 }
22337 void *_res = NULL;
22338 int _mark = p->mark;
22339 int _start_mark = p->mark;
22340 void **_children = PyMem_Malloc(sizeof(void *));
22341 if (!_children) {
22342 p->error_indicator = 1;
22343 PyErr_NoMemory();
22344 D(p->level--);
22345 return NULL;
22346 }
22347 ssize_t _children_capacity = 1;
22348 ssize_t _n = 0;
22349 { // ',' kwarg_or_double_starred
22350 if (p->error_indicator) {
22351 D(p->level--);
22352 return NULL;
22353 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022354 D(fprintf(stderr, "%*c> _loop0_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022355 Token * _literal;
22356 KeywordOrStarred* elem;
22357 while (
22358 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22359 &&
22360 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22361 )
22362 {
22363 _res = elem;
22364 if (_res == NULL && PyErr_Occurred()) {
22365 p->error_indicator = 1;
22366 PyMem_Free(_children);
22367 D(p->level--);
22368 return NULL;
22369 }
22370 if (_n == _children_capacity) {
22371 _children_capacity *= 2;
22372 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22373 if (!_new_children) {
22374 p->error_indicator = 1;
22375 PyErr_NoMemory();
22376 D(p->level--);
22377 return NULL;
22378 }
22379 _children = _new_children;
22380 }
22381 _children[_n++] = _res;
22382 _mark = p->mark;
22383 }
22384 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022385 D(fprintf(stderr, "%*c%s _loop0_113[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022386 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22387 }
22388 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22389 if (!_seq) {
22390 PyMem_Free(_children);
22391 p->error_indicator = 1;
22392 PyErr_NoMemory();
22393 D(p->level--);
22394 return NULL;
22395 }
22396 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22397 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022398 _PyPegen_insert_memo(p, _start_mark, _loop0_113_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022399 D(p->level--);
22400 return _seq;
22401}
22402
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022403// _gather_112: kwarg_or_double_starred _loop0_113
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022404static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022405_gather_112_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022406{
22407 D(p->level++);
22408 if (p->error_indicator) {
22409 D(p->level--);
22410 return NULL;
22411 }
22412 asdl_seq * _res = NULL;
22413 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022414 { // kwarg_or_double_starred _loop0_113
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022415 if (p->error_indicator) {
22416 D(p->level--);
22417 return NULL;
22418 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022419 D(fprintf(stderr, "%*c> _gather_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_113"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022420 KeywordOrStarred* elem;
22421 asdl_seq * seq;
22422 if (
22423 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22424 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022425 (seq = _loop0_113_rule(p)) // _loop0_113
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022426 )
22427 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022428 D(fprintf(stderr, "%*c+ _gather_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_113"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022429 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22430 goto done;
22431 }
22432 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022433 D(fprintf(stderr, "%*c%s _gather_112[%d-%d]: %s failed!\n", p->level, ' ',
22434 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_113"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022435 }
22436 _res = NULL;
22437 done:
22438 D(p->level--);
22439 return _res;
22440}
22441
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022442// _loop0_115: ',' kwarg_or_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022443static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022444_loop0_115_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022445{
22446 D(p->level++);
22447 if (p->error_indicator) {
22448 D(p->level--);
22449 return NULL;
22450 }
22451 void *_res = NULL;
22452 int _mark = p->mark;
22453 int _start_mark = p->mark;
22454 void **_children = PyMem_Malloc(sizeof(void *));
22455 if (!_children) {
22456 p->error_indicator = 1;
22457 PyErr_NoMemory();
22458 D(p->level--);
22459 return NULL;
22460 }
22461 ssize_t _children_capacity = 1;
22462 ssize_t _n = 0;
22463 { // ',' kwarg_or_starred
22464 if (p->error_indicator) {
22465 D(p->level--);
22466 return NULL;
22467 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022468 D(fprintf(stderr, "%*c> _loop0_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022469 Token * _literal;
22470 KeywordOrStarred* elem;
22471 while (
22472 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22473 &&
22474 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22475 )
22476 {
22477 _res = elem;
22478 if (_res == NULL && PyErr_Occurred()) {
22479 p->error_indicator = 1;
22480 PyMem_Free(_children);
22481 D(p->level--);
22482 return NULL;
22483 }
22484 if (_n == _children_capacity) {
22485 _children_capacity *= 2;
22486 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22487 if (!_new_children) {
22488 p->error_indicator = 1;
22489 PyErr_NoMemory();
22490 D(p->level--);
22491 return NULL;
22492 }
22493 _children = _new_children;
22494 }
22495 _children[_n++] = _res;
22496 _mark = p->mark;
22497 }
22498 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022499 D(fprintf(stderr, "%*c%s _loop0_115[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022500 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22501 }
22502 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22503 if (!_seq) {
22504 PyMem_Free(_children);
22505 p->error_indicator = 1;
22506 PyErr_NoMemory();
22507 D(p->level--);
22508 return NULL;
22509 }
22510 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22511 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022512 _PyPegen_insert_memo(p, _start_mark, _loop0_115_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022513 D(p->level--);
22514 return _seq;
22515}
22516
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022517// _gather_114: kwarg_or_starred _loop0_115
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022518static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022519_gather_114_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022520{
22521 D(p->level++);
22522 if (p->error_indicator) {
22523 D(p->level--);
22524 return NULL;
22525 }
22526 asdl_seq * _res = NULL;
22527 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022528 { // kwarg_or_starred _loop0_115
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022529 if (p->error_indicator) {
22530 D(p->level--);
22531 return NULL;
22532 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022533 D(fprintf(stderr, "%*c> _gather_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_115"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022534 KeywordOrStarred* elem;
22535 asdl_seq * seq;
22536 if (
22537 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22538 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022539 (seq = _loop0_115_rule(p)) // _loop0_115
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022540 )
22541 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022542 D(fprintf(stderr, "%*c+ _gather_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_115"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022543 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22544 goto done;
22545 }
22546 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022547 D(fprintf(stderr, "%*c%s _gather_114[%d-%d]: %s failed!\n", p->level, ' ',
22548 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_115"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022549 }
22550 _res = NULL;
22551 done:
22552 D(p->level--);
22553 return _res;
22554}
22555
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022556// _loop0_117: ',' kwarg_or_double_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022557static asdl_seq *
22558_loop0_117_rule(Parser *p)
22559{
22560 D(p->level++);
22561 if (p->error_indicator) {
22562 D(p->level--);
22563 return NULL;
22564 }
22565 void *_res = NULL;
22566 int _mark = p->mark;
22567 int _start_mark = p->mark;
22568 void **_children = PyMem_Malloc(sizeof(void *));
22569 if (!_children) {
22570 p->error_indicator = 1;
22571 PyErr_NoMemory();
22572 D(p->level--);
22573 return NULL;
22574 }
22575 ssize_t _children_capacity = 1;
22576 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022577 { // ',' kwarg_or_double_starred
22578 if (p->error_indicator) {
22579 D(p->level--);
22580 return NULL;
22581 }
22582 D(fprintf(stderr, "%*c> _loop0_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
22583 Token * _literal;
22584 KeywordOrStarred* elem;
22585 while (
22586 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22587 &&
22588 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22589 )
22590 {
22591 _res = elem;
22592 if (_res == NULL && PyErr_Occurred()) {
22593 p->error_indicator = 1;
22594 PyMem_Free(_children);
22595 D(p->level--);
22596 return NULL;
22597 }
22598 if (_n == _children_capacity) {
22599 _children_capacity *= 2;
22600 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22601 if (!_new_children) {
22602 p->error_indicator = 1;
22603 PyErr_NoMemory();
22604 D(p->level--);
22605 return NULL;
22606 }
22607 _children = _new_children;
22608 }
22609 _children[_n++] = _res;
22610 _mark = p->mark;
22611 }
22612 p->mark = _mark;
22613 D(fprintf(stderr, "%*c%s _loop0_117[%d-%d]: %s failed!\n", p->level, ' ',
22614 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22615 }
22616 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22617 if (!_seq) {
22618 PyMem_Free(_children);
22619 p->error_indicator = 1;
22620 PyErr_NoMemory();
22621 D(p->level--);
22622 return NULL;
22623 }
22624 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22625 PyMem_Free(_children);
22626 _PyPegen_insert_memo(p, _start_mark, _loop0_117_type, _seq);
22627 D(p->level--);
22628 return _seq;
22629}
22630
22631// _gather_116: kwarg_or_double_starred _loop0_117
22632static asdl_seq *
22633_gather_116_rule(Parser *p)
22634{
22635 D(p->level++);
22636 if (p->error_indicator) {
22637 D(p->level--);
22638 return NULL;
22639 }
22640 asdl_seq * _res = NULL;
22641 int _mark = p->mark;
22642 { // kwarg_or_double_starred _loop0_117
22643 if (p->error_indicator) {
22644 D(p->level--);
22645 return NULL;
22646 }
22647 D(fprintf(stderr, "%*c> _gather_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_117"));
22648 KeywordOrStarred* elem;
22649 asdl_seq * seq;
22650 if (
22651 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22652 &&
22653 (seq = _loop0_117_rule(p)) // _loop0_117
22654 )
22655 {
22656 D(fprintf(stderr, "%*c+ _gather_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_117"));
22657 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22658 goto done;
22659 }
22660 p->mark = _mark;
22661 D(fprintf(stderr, "%*c%s _gather_116[%d-%d]: %s failed!\n", p->level, ' ',
22662 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_117"));
22663 }
22664 _res = NULL;
22665 done:
22666 D(p->level--);
22667 return _res;
22668}
22669
22670// _loop0_118: (',' star_target)
22671static asdl_seq *
22672_loop0_118_rule(Parser *p)
22673{
22674 D(p->level++);
22675 if (p->error_indicator) {
22676 D(p->level--);
22677 return NULL;
22678 }
22679 void *_res = NULL;
22680 int _mark = p->mark;
22681 int _start_mark = p->mark;
22682 void **_children = PyMem_Malloc(sizeof(void *));
22683 if (!_children) {
22684 p->error_indicator = 1;
22685 PyErr_NoMemory();
22686 D(p->level--);
22687 return NULL;
22688 }
22689 ssize_t _children_capacity = 1;
22690 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022691 { // (',' star_target)
22692 if (p->error_indicator) {
22693 D(p->level--);
22694 return NULL;
22695 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022696 D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022697 void *_tmp_148_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022698 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022699 (_tmp_148_var = _tmp_148_rule(p)) // ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022700 )
22701 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022702 _res = _tmp_148_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022703 if (_n == _children_capacity) {
22704 _children_capacity *= 2;
22705 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22706 if (!_new_children) {
22707 p->error_indicator = 1;
22708 PyErr_NoMemory();
22709 D(p->level--);
22710 return NULL;
22711 }
22712 _children = _new_children;
22713 }
22714 _children[_n++] = _res;
22715 _mark = p->mark;
22716 }
22717 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022718 D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022719 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
22720 }
22721 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22722 if (!_seq) {
22723 PyMem_Free(_children);
22724 p->error_indicator = 1;
22725 PyErr_NoMemory();
22726 D(p->level--);
22727 return NULL;
22728 }
22729 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22730 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022731 _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022732 D(p->level--);
22733 return _seq;
22734}
22735
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022736// _loop0_120: ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022737static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022738_loop0_120_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022739{
22740 D(p->level++);
22741 if (p->error_indicator) {
22742 D(p->level--);
22743 return NULL;
22744 }
22745 void *_res = NULL;
22746 int _mark = p->mark;
22747 int _start_mark = p->mark;
22748 void **_children = PyMem_Malloc(sizeof(void *));
22749 if (!_children) {
22750 p->error_indicator = 1;
22751 PyErr_NoMemory();
22752 D(p->level--);
22753 return NULL;
22754 }
22755 ssize_t _children_capacity = 1;
22756 ssize_t _n = 0;
22757 { // ',' star_target
22758 if (p->error_indicator) {
22759 D(p->level--);
22760 return NULL;
22761 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022762 D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022763 Token * _literal;
22764 expr_ty elem;
22765 while (
22766 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22767 &&
22768 (elem = star_target_rule(p)) // star_target
22769 )
22770 {
22771 _res = elem;
22772 if (_res == NULL && PyErr_Occurred()) {
22773 p->error_indicator = 1;
22774 PyMem_Free(_children);
22775 D(p->level--);
22776 return NULL;
22777 }
22778 if (_n == _children_capacity) {
22779 _children_capacity *= 2;
22780 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22781 if (!_new_children) {
22782 p->error_indicator = 1;
22783 PyErr_NoMemory();
22784 D(p->level--);
22785 return NULL;
22786 }
22787 _children = _new_children;
22788 }
22789 _children[_n++] = _res;
22790 _mark = p->mark;
22791 }
22792 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022793 D(fprintf(stderr, "%*c%s _loop0_120[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022794 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
22795 }
22796 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22797 if (!_seq) {
22798 PyMem_Free(_children);
22799 p->error_indicator = 1;
22800 PyErr_NoMemory();
22801 D(p->level--);
22802 return NULL;
22803 }
22804 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22805 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022806 _PyPegen_insert_memo(p, _start_mark, _loop0_120_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022807 D(p->level--);
22808 return _seq;
22809}
22810
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022811// _gather_119: star_target _loop0_120
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022812static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022813_gather_119_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022814{
22815 D(p->level++);
22816 if (p->error_indicator) {
22817 D(p->level--);
22818 return NULL;
22819 }
22820 asdl_seq * _res = NULL;
22821 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022822 { // star_target _loop0_120
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022823 if (p->error_indicator) {
22824 D(p->level--);
22825 return NULL;
22826 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022827 D(fprintf(stderr, "%*c> _gather_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_120"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022828 expr_ty elem;
22829 asdl_seq * seq;
22830 if (
22831 (elem = star_target_rule(p)) // star_target
22832 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022833 (seq = _loop0_120_rule(p)) // _loop0_120
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022834 )
22835 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022836 D(fprintf(stderr, "%*c+ _gather_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_120"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022837 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22838 goto done;
22839 }
22840 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022841 D(fprintf(stderr, "%*c%s _gather_119[%d-%d]: %s failed!\n", p->level, ' ',
22842 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_120"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022843 }
22844 _res = NULL;
22845 done:
22846 D(p->level--);
22847 return _res;
22848}
22849
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022850// _tmp_121: !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022851static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022852_tmp_121_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022853{
22854 D(p->level++);
22855 if (p->error_indicator) {
22856 D(p->level--);
22857 return NULL;
22858 }
22859 void * _res = NULL;
22860 int _mark = p->mark;
22861 { // !'*' star_target
22862 if (p->error_indicator) {
22863 D(p->level--);
22864 return NULL;
22865 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022866 D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022867 expr_ty star_target_var;
22868 if (
22869 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
22870 &&
22871 (star_target_var = star_target_rule(p)) // star_target
22872 )
22873 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022874 D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022875 _res = star_target_var;
22876 goto done;
22877 }
22878 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022879 D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022880 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
22881 }
22882 _res = NULL;
22883 done:
22884 D(p->level--);
22885 return _res;
22886}
22887
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022888// _loop0_123: ',' del_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022889static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022890_loop0_123_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 int _start_mark = p->mark;
22900 void **_children = PyMem_Malloc(sizeof(void *));
22901 if (!_children) {
22902 p->error_indicator = 1;
22903 PyErr_NoMemory();
22904 D(p->level--);
22905 return NULL;
22906 }
22907 ssize_t _children_capacity = 1;
22908 ssize_t _n = 0;
22909 { // ',' del_target
22910 if (p->error_indicator) {
22911 D(p->level--);
22912 return NULL;
22913 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022914 D(fprintf(stderr, "%*c> _loop0_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022915 Token * _literal;
22916 expr_ty elem;
22917 while (
22918 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22919 &&
22920 (elem = del_target_rule(p)) // del_target
22921 )
22922 {
22923 _res = elem;
22924 if (_res == NULL && PyErr_Occurred()) {
22925 p->error_indicator = 1;
22926 PyMem_Free(_children);
22927 D(p->level--);
22928 return NULL;
22929 }
22930 if (_n == _children_capacity) {
22931 _children_capacity *= 2;
22932 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22933 if (!_new_children) {
22934 p->error_indicator = 1;
22935 PyErr_NoMemory();
22936 D(p->level--);
22937 return NULL;
22938 }
22939 _children = _new_children;
22940 }
22941 _children[_n++] = _res;
22942 _mark = p->mark;
22943 }
22944 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022945 D(fprintf(stderr, "%*c%s _loop0_123[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022946 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
22947 }
22948 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22949 if (!_seq) {
22950 PyMem_Free(_children);
22951 p->error_indicator = 1;
22952 PyErr_NoMemory();
22953 D(p->level--);
22954 return NULL;
22955 }
22956 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22957 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022958 _PyPegen_insert_memo(p, _start_mark, _loop0_123_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022959 D(p->level--);
22960 return _seq;
22961}
22962
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022963// _gather_122: del_target _loop0_123
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022964static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022965_gather_122_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022966{
22967 D(p->level++);
22968 if (p->error_indicator) {
22969 D(p->level--);
22970 return NULL;
22971 }
22972 asdl_seq * _res = NULL;
22973 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022974 { // del_target _loop0_123
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022975 if (p->error_indicator) {
22976 D(p->level--);
22977 return NULL;
22978 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022979 D(fprintf(stderr, "%*c> _gather_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_123"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022980 expr_ty elem;
22981 asdl_seq * seq;
22982 if (
22983 (elem = del_target_rule(p)) // del_target
22984 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022985 (seq = _loop0_123_rule(p)) // _loop0_123
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022986 )
22987 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022988 D(fprintf(stderr, "%*c+ _gather_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_123"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022989 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22990 goto done;
22991 }
22992 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022993 D(fprintf(stderr, "%*c%s _gather_122[%d-%d]: %s failed!\n", p->level, ' ',
22994 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_123"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022995 }
22996 _res = NULL;
22997 done:
22998 D(p->level--);
22999 return _res;
23000}
23001
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023002// _loop0_125: ',' target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023003static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023004_loop0_125_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023005{
23006 D(p->level++);
23007 if (p->error_indicator) {
23008 D(p->level--);
23009 return NULL;
23010 }
23011 void *_res = NULL;
23012 int _mark = p->mark;
23013 int _start_mark = p->mark;
23014 void **_children = PyMem_Malloc(sizeof(void *));
23015 if (!_children) {
23016 p->error_indicator = 1;
23017 PyErr_NoMemory();
23018 D(p->level--);
23019 return NULL;
23020 }
23021 ssize_t _children_capacity = 1;
23022 ssize_t _n = 0;
23023 { // ',' target
23024 if (p->error_indicator) {
23025 D(p->level--);
23026 return NULL;
23027 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023028 D(fprintf(stderr, "%*c> _loop0_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023029 Token * _literal;
23030 expr_ty elem;
23031 while (
23032 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23033 &&
23034 (elem = target_rule(p)) // target
23035 )
23036 {
23037 _res = elem;
23038 if (_res == NULL && PyErr_Occurred()) {
23039 p->error_indicator = 1;
23040 PyMem_Free(_children);
23041 D(p->level--);
23042 return NULL;
23043 }
23044 if (_n == _children_capacity) {
23045 _children_capacity *= 2;
23046 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23047 if (!_new_children) {
23048 p->error_indicator = 1;
23049 PyErr_NoMemory();
23050 D(p->level--);
23051 return NULL;
23052 }
23053 _children = _new_children;
23054 }
23055 _children[_n++] = _res;
23056 _mark = p->mark;
23057 }
23058 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023059 D(fprintf(stderr, "%*c%s _loop0_125[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023060 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target"));
23061 }
23062 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23063 if (!_seq) {
23064 PyMem_Free(_children);
23065 p->error_indicator = 1;
23066 PyErr_NoMemory();
23067 D(p->level--);
23068 return NULL;
23069 }
23070 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23071 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023072 _PyPegen_insert_memo(p, _start_mark, _loop0_125_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023073 D(p->level--);
23074 return _seq;
23075}
23076
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023077// _gather_124: target _loop0_125
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023078static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023079_gather_124_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023080{
23081 D(p->level++);
23082 if (p->error_indicator) {
23083 D(p->level--);
23084 return NULL;
23085 }
23086 asdl_seq * _res = NULL;
23087 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023088 { // target _loop0_125
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023089 if (p->error_indicator) {
23090 D(p->level--);
23091 return NULL;
23092 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023093 D(fprintf(stderr, "%*c> _gather_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_125"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023094 expr_ty elem;
23095 asdl_seq * seq;
23096 if (
23097 (elem = target_rule(p)) // target
23098 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023099 (seq = _loop0_125_rule(p)) // _loop0_125
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023100 )
23101 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023102 D(fprintf(stderr, "%*c+ _gather_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_125"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023103 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23104 goto done;
23105 }
23106 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023107 D(fprintf(stderr, "%*c%s _gather_124[%d-%d]: %s failed!\n", p->level, ' ',
23108 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_125"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023109 }
23110 _res = NULL;
23111 done:
23112 D(p->level--);
23113 return _res;
23114}
23115
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023116// _tmp_126: args | expression for_if_clauses
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023117static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023118_tmp_126_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023119{
23120 D(p->level++);
23121 if (p->error_indicator) {
23122 D(p->level--);
23123 return NULL;
23124 }
23125 void * _res = NULL;
23126 int _mark = p->mark;
23127 { // args
23128 if (p->error_indicator) {
23129 D(p->level--);
23130 return NULL;
23131 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023132 D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023133 expr_ty args_var;
23134 if (
23135 (args_var = args_rule(p)) // args
23136 )
23137 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023138 D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023139 _res = args_var;
23140 goto done;
23141 }
23142 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023143 D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023144 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
23145 }
23146 { // expression for_if_clauses
23147 if (p->error_indicator) {
23148 D(p->level--);
23149 return NULL;
23150 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023151 D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023152 expr_ty expression_var;
23153 asdl_seq* for_if_clauses_var;
23154 if (
23155 (expression_var = expression_rule(p)) // expression
23156 &&
23157 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
23158 )
23159 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023160 D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023161 _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
23162 goto done;
23163 }
23164 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023165 D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023166 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
23167 }
23168 _res = NULL;
23169 done:
23170 D(p->level--);
23171 return _res;
23172}
23173
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023174// _loop0_127: star_named_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023175static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023176_loop0_127_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023177{
23178 D(p->level++);
23179 if (p->error_indicator) {
23180 D(p->level--);
23181 return NULL;
23182 }
23183 void *_res = NULL;
23184 int _mark = p->mark;
23185 int _start_mark = p->mark;
23186 void **_children = PyMem_Malloc(sizeof(void *));
23187 if (!_children) {
23188 p->error_indicator = 1;
23189 PyErr_NoMemory();
23190 D(p->level--);
23191 return NULL;
23192 }
23193 ssize_t _children_capacity = 1;
23194 ssize_t _n = 0;
23195 { // star_named_expressions
23196 if (p->error_indicator) {
23197 D(p->level--);
23198 return NULL;
23199 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023200 D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023201 asdl_seq* star_named_expressions_var;
23202 while (
23203 (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions
23204 )
23205 {
23206 _res = star_named_expressions_var;
23207 if (_n == _children_capacity) {
23208 _children_capacity *= 2;
23209 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23210 if (!_new_children) {
23211 p->error_indicator = 1;
23212 PyErr_NoMemory();
23213 D(p->level--);
23214 return NULL;
23215 }
23216 _children = _new_children;
23217 }
23218 _children[_n++] = _res;
23219 _mark = p->mark;
23220 }
23221 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023222 D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023223 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
23224 }
23225 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23226 if (!_seq) {
23227 PyMem_Free(_children);
23228 p->error_indicator = 1;
23229 PyErr_NoMemory();
23230 D(p->level--);
23231 return NULL;
23232 }
23233 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23234 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023235 _PyPegen_insert_memo(p, _start_mark, _loop0_127_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023236 D(p->level--);
23237 return _seq;
23238}
23239
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023240// _loop0_128: (star_targets '=')
23241static asdl_seq *
23242_loop0_128_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023243{
23244 D(p->level++);
23245 if (p->error_indicator) {
23246 D(p->level--);
23247 return NULL;
23248 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023249 void *_res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023250 int _mark = p->mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023251 int _start_mark = p->mark;
23252 void **_children = PyMem_Malloc(sizeof(void *));
23253 if (!_children) {
23254 p->error_indicator = 1;
23255 PyErr_NoMemory();
23256 D(p->level--);
23257 return NULL;
23258 }
23259 ssize_t _children_capacity = 1;
23260 ssize_t _n = 0;
23261 { // (star_targets '=')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023262 if (p->error_indicator) {
23263 D(p->level--);
23264 return NULL;
23265 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023266 D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
23267 void *_tmp_149_var;
23268 while (
23269 (_tmp_149_var = _tmp_149_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023270 )
23271 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023272 _res = _tmp_149_var;
23273 if (_n == _children_capacity) {
23274 _children_capacity *= 2;
23275 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23276 if (!_new_children) {
23277 p->error_indicator = 1;
23278 PyErr_NoMemory();
23279 D(p->level--);
23280 return NULL;
23281 }
23282 _children = _new_children;
23283 }
23284 _children[_n++] = _res;
23285 _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023286 }
23287 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023288 D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ',
23289 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023290 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023291 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23292 if (!_seq) {
23293 PyMem_Free(_children);
23294 p->error_indicator = 1;
23295 PyErr_NoMemory();
23296 D(p->level--);
23297 return NULL;
23298 }
23299 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23300 PyMem_Free(_children);
23301 _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023302 D(p->level--);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023303 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023304}
23305
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023306// _loop0_129: (star_targets '=')
23307static asdl_seq *
23308_loop0_129_rule(Parser *p)
23309{
23310 D(p->level++);
23311 if (p->error_indicator) {
23312 D(p->level--);
23313 return NULL;
23314 }
23315 void *_res = NULL;
23316 int _mark = p->mark;
23317 int _start_mark = p->mark;
23318 void **_children = PyMem_Malloc(sizeof(void *));
23319 if (!_children) {
23320 p->error_indicator = 1;
23321 PyErr_NoMemory();
23322 D(p->level--);
23323 return NULL;
23324 }
23325 ssize_t _children_capacity = 1;
23326 ssize_t _n = 0;
23327 { // (star_targets '=')
23328 if (p->error_indicator) {
23329 D(p->level--);
23330 return NULL;
23331 }
23332 D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
23333 void *_tmp_150_var;
23334 while (
23335 (_tmp_150_var = _tmp_150_rule(p)) // star_targets '='
23336 )
23337 {
23338 _res = _tmp_150_var;
23339 if (_n == _children_capacity) {
23340 _children_capacity *= 2;
23341 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23342 if (!_new_children) {
23343 p->error_indicator = 1;
23344 PyErr_NoMemory();
23345 D(p->level--);
23346 return NULL;
23347 }
23348 _children = _new_children;
23349 }
23350 _children[_n++] = _res;
23351 _mark = p->mark;
23352 }
23353 p->mark = _mark;
23354 D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
23355 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23356 }
23357 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23358 if (!_seq) {
23359 PyMem_Free(_children);
23360 p->error_indicator = 1;
23361 PyErr_NoMemory();
23362 D(p->level--);
23363 return NULL;
23364 }
23365 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23366 PyMem_Free(_children);
23367 _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq);
23368 D(p->level--);
23369 return _seq;
23370}
23371
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023372// _tmp_130: yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023373static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023374_tmp_130_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023375{
23376 D(p->level++);
23377 if (p->error_indicator) {
23378 D(p->level--);
23379 return NULL;
23380 }
23381 void * _res = NULL;
23382 int _mark = p->mark;
23383 { // yield_expr
23384 if (p->error_indicator) {
23385 D(p->level--);
23386 return NULL;
23387 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023388 D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023389 expr_ty yield_expr_var;
23390 if (
23391 (yield_expr_var = yield_expr_rule(p)) // yield_expr
23392 )
23393 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023394 D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023395 _res = yield_expr_var;
23396 goto done;
23397 }
23398 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023399 D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023400 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
23401 }
23402 { // star_expressions
23403 if (p->error_indicator) {
23404 D(p->level--);
23405 return NULL;
23406 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023407 D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023408 expr_ty star_expressions_var;
23409 if (
23410 (star_expressions_var = star_expressions_rule(p)) // star_expressions
23411 )
23412 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023413 D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023414 _res = star_expressions_var;
23415 goto done;
23416 }
23417 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023418 D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023419 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
23420 }
23421 _res = NULL;
23422 done:
23423 D(p->level--);
23424 return _res;
23425}
23426
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023427// _tmp_131: '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023428static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023429_tmp_131_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023430{
23431 D(p->level++);
23432 if (p->error_indicator) {
23433 D(p->level--);
23434 return NULL;
23435 }
23436 void * _res = NULL;
23437 int _mark = p->mark;
23438 { // '['
23439 if (p->error_indicator) {
23440 D(p->level--);
23441 return NULL;
23442 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023443 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023444 Token * _literal;
23445 if (
23446 (_literal = _PyPegen_expect_token(p, 9)) // token='['
23447 )
23448 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023449 D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023450 _res = _literal;
23451 goto done;
23452 }
23453 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023454 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023455 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
23456 }
23457 { // '('
23458 if (p->error_indicator) {
23459 D(p->level--);
23460 return NULL;
23461 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023462 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023463 Token * _literal;
23464 if (
23465 (_literal = _PyPegen_expect_token(p, 7)) // token='('
23466 )
23467 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023468 D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023469 _res = _literal;
23470 goto done;
23471 }
23472 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023473 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023474 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
23475 }
23476 { // '{'
23477 if (p->error_indicator) {
23478 D(p->level--);
23479 return NULL;
23480 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023481 D(fprintf(stderr, "%*c> _tmp_131[%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, 25)) // token='{'
23485 )
23486 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023487 D(fprintf(stderr, "%*c+ _tmp_131[%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;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023492 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023493 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
23494 }
23495 _res = NULL;
23496 done:
23497 D(p->level--);
23498 return _res;
23499}
23500
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023501// _loop0_132: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023502static asdl_seq *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023503_loop0_132_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023504{
23505 D(p->level++);
23506 if (p->error_indicator) {
23507 D(p->level--);
23508 return NULL;
23509 }
23510 void *_res = NULL;
23511 int _mark = p->mark;
23512 int _start_mark = p->mark;
23513 void **_children = PyMem_Malloc(sizeof(void *));
23514 if (!_children) {
23515 p->error_indicator = 1;
23516 PyErr_NoMemory();
23517 D(p->level--);
23518 return NULL;
23519 }
23520 ssize_t _children_capacity = 1;
23521 ssize_t _n = 0;
23522 { // param_no_default
23523 if (p->error_indicator) {
23524 D(p->level--);
23525 return NULL;
23526 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023527 D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023528 arg_ty param_no_default_var;
23529 while (
23530 (param_no_default_var = param_no_default_rule(p)) // param_no_default
23531 )
23532 {
23533 _res = param_no_default_var;
23534 if (_n == _children_capacity) {
23535 _children_capacity *= 2;
23536 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23537 if (!_new_children) {
23538 p->error_indicator = 1;
23539 PyErr_NoMemory();
23540 D(p->level--);
23541 return NULL;
23542 }
23543 _children = _new_children;
23544 }
23545 _children[_n++] = _res;
23546 _mark = p->mark;
23547 }
23548 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023549 D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023550 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
23551 }
23552 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23553 if (!_seq) {
23554 PyMem_Free(_children);
23555 p->error_indicator = 1;
23556 PyErr_NoMemory();
23557 D(p->level--);
23558 return NULL;
23559 }
23560 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23561 PyMem_Free(_children);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023562 _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023563 D(p->level--);
23564 return _seq;
23565}
23566
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023567// _tmp_133: slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023568static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023569_tmp_133_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023570{
23571 D(p->level++);
23572 if (p->error_indicator) {
23573 D(p->level--);
23574 return NULL;
23575 }
23576 void * _res = NULL;
23577 int _mark = p->mark;
23578 { // slash_with_default
23579 if (p->error_indicator) {
23580 D(p->level--);
23581 return NULL;
23582 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023583 D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023584 SlashWithDefault* slash_with_default_var;
23585 if (
23586 (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default
23587 )
23588 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023589 D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023590 _res = slash_with_default_var;
23591 goto done;
23592 }
23593 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023594 D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023595 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
23596 }
23597 { // param_with_default+
23598 if (p->error_indicator) {
23599 D(p->level--);
23600 return NULL;
23601 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023602 D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23603 asdl_seq * _loop1_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023604 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023605 (_loop1_151_var = _loop1_151_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023606 )
23607 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023608 D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23609 _res = _loop1_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023610 goto done;
23611 }
23612 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023613 D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023614 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
23615 }
23616 _res = NULL;
23617 done:
23618 D(p->level--);
23619 return _res;
23620}
23621
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023622// _loop0_134: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023623static asdl_seq *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023624_loop0_134_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023625{
23626 D(p->level++);
23627 if (p->error_indicator) {
23628 D(p->level--);
23629 return NULL;
23630 }
23631 void *_res = NULL;
23632 int _mark = p->mark;
23633 int _start_mark = p->mark;
23634 void **_children = PyMem_Malloc(sizeof(void *));
23635 if (!_children) {
23636 p->error_indicator = 1;
23637 PyErr_NoMemory();
23638 D(p->level--);
23639 return NULL;
23640 }
23641 ssize_t _children_capacity = 1;
23642 ssize_t _n = 0;
23643 { // lambda_param_no_default
23644 if (p->error_indicator) {
23645 D(p->level--);
23646 return NULL;
23647 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023648 D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023649 arg_ty lambda_param_no_default_var;
23650 while (
23651 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
23652 )
23653 {
23654 _res = lambda_param_no_default_var;
23655 if (_n == _children_capacity) {
23656 _children_capacity *= 2;
23657 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23658 if (!_new_children) {
23659 p->error_indicator = 1;
23660 PyErr_NoMemory();
23661 D(p->level--);
23662 return NULL;
23663 }
23664 _children = _new_children;
23665 }
23666 _children[_n++] = _res;
23667 _mark = p->mark;
23668 }
23669 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023670 D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023671 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
23672 }
23673 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23674 if (!_seq) {
23675 PyMem_Free(_children);
23676 p->error_indicator = 1;
23677 PyErr_NoMemory();
23678 D(p->level--);
23679 return NULL;
23680 }
23681 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23682 PyMem_Free(_children);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023683 _PyPegen_insert_memo(p, _start_mark, _loop0_134_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023684 D(p->level--);
23685 return _seq;
23686}
23687
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023688// _tmp_135: lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023689static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023690_tmp_135_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023691{
23692 D(p->level++);
23693 if (p->error_indicator) {
23694 D(p->level--);
23695 return NULL;
23696 }
23697 void * _res = NULL;
23698 int _mark = p->mark;
23699 { // lambda_slash_with_default
23700 if (p->error_indicator) {
23701 D(p->level--);
23702 return NULL;
23703 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023704 D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023705 SlashWithDefault* lambda_slash_with_default_var;
23706 if (
23707 (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
23708 )
23709 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023710 D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023711 _res = lambda_slash_with_default_var;
23712 goto done;
23713 }
23714 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023715 D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023716 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
23717 }
23718 { // lambda_param_with_default+
23719 if (p->error_indicator) {
23720 D(p->level--);
23721 return NULL;
23722 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023723 D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23724 asdl_seq * _loop1_152_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023725 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023726 (_loop1_152_var = _loop1_152_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023727 )
23728 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023729 D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23730 _res = _loop1_152_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023731 goto done;
23732 }
23733 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023734 D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023735 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
23736 }
23737 _res = NULL;
23738 done:
23739 D(p->level--);
23740 return _res;
23741}
23742
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023743// _tmp_136: ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023744static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023745_tmp_136_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023746{
23747 D(p->level++);
23748 if (p->error_indicator) {
23749 D(p->level--);
23750 return NULL;
23751 }
23752 void * _res = NULL;
23753 int _mark = p->mark;
23754 { // ')'
23755 if (p->error_indicator) {
23756 D(p->level--);
23757 return NULL;
23758 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023759 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023760 Token * _literal;
23761 if (
23762 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
23763 )
23764 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023765 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023766 _res = _literal;
23767 goto done;
23768 }
23769 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023770 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023771 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
23772 }
23773 { // ',' (')' | '**')
23774 if (p->error_indicator) {
23775 D(p->level--);
23776 return NULL;
23777 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023778 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023779 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023780 void *_tmp_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023781 if (
23782 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23783 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023784 (_tmp_153_var = _tmp_153_rule(p)) // ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023785 )
23786 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023787 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
23788 _res = _PyPegen_dummy_name(p, _literal, _tmp_153_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023789 goto done;
23790 }
23791 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023792 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023793 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
23794 }
23795 _res = NULL;
23796 done:
23797 D(p->level--);
23798 return _res;
23799}
23800
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023801// _tmp_137: ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023802static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023803_tmp_137_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023804{
23805 D(p->level++);
23806 if (p->error_indicator) {
23807 D(p->level--);
23808 return NULL;
23809 }
23810 void * _res = NULL;
23811 int _mark = p->mark;
23812 { // ':'
23813 if (p->error_indicator) {
23814 D(p->level--);
23815 return NULL;
23816 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023817 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023818 Token * _literal;
23819 if (
23820 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
23821 )
23822 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023823 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023824 _res = _literal;
23825 goto done;
23826 }
23827 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023828 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023829 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
23830 }
23831 { // ',' (':' | '**')
23832 if (p->error_indicator) {
23833 D(p->level--);
23834 return NULL;
23835 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023836 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023837 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023838 void *_tmp_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023839 if (
23840 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23841 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023842 (_tmp_154_var = _tmp_154_rule(p)) // ':' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023843 )
23844 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023845 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
23846 _res = _PyPegen_dummy_name(p, _literal, _tmp_154_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023847 goto done;
23848 }
23849 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023850 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023851 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
23852 }
23853 _res = NULL;
23854 done:
23855 D(p->level--);
23856 return _res;
23857}
23858
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023859// _tmp_138: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023860static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023861_tmp_138_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023862{
23863 D(p->level++);
23864 if (p->error_indicator) {
23865 D(p->level--);
23866 return NULL;
23867 }
23868 void * _res = NULL;
23869 int _mark = p->mark;
23870 { // star_targets '='
23871 if (p->error_indicator) {
23872 D(p->level--);
23873 return NULL;
23874 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023875 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023876 Token * _literal;
23877 expr_ty z;
23878 if (
23879 (z = star_targets_rule(p)) // star_targets
23880 &&
23881 (_literal = _PyPegen_expect_token(p, 22)) // token='='
23882 )
23883 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023884 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023885 _res = z;
23886 if (_res == NULL && PyErr_Occurred()) {
23887 p->error_indicator = 1;
23888 D(p->level--);
23889 return NULL;
23890 }
23891 goto done;
23892 }
23893 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023894 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023895 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
23896 }
23897 _res = NULL;
23898 done:
23899 D(p->level--);
23900 return _res;
23901}
23902
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023903// _tmp_139: '.' | '...'
23904static void *
23905_tmp_139_rule(Parser *p)
23906{
23907 D(p->level++);
23908 if (p->error_indicator) {
23909 D(p->level--);
23910 return NULL;
23911 }
23912 void * _res = NULL;
23913 int _mark = p->mark;
23914 { // '.'
23915 if (p->error_indicator) {
23916 D(p->level--);
23917 return NULL;
23918 }
23919 D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
23920 Token * _literal;
23921 if (
23922 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
23923 )
23924 {
23925 D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
23926 _res = _literal;
23927 goto done;
23928 }
23929 p->mark = _mark;
23930 D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
23931 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
23932 }
23933 { // '...'
23934 if (p->error_indicator) {
23935 D(p->level--);
23936 return NULL;
23937 }
23938 D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
23939 Token * _literal;
23940 if (
23941 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
23942 )
23943 {
23944 D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
23945 _res = _literal;
23946 goto done;
23947 }
23948 p->mark = _mark;
23949 D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
23950 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
23951 }
23952 _res = NULL;
23953 done:
23954 D(p->level--);
23955 return _res;
23956}
23957
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023958// _tmp_140: '.' | '...'
23959static void *
23960_tmp_140_rule(Parser *p)
23961{
23962 D(p->level++);
23963 if (p->error_indicator) {
23964 D(p->level--);
23965 return NULL;
23966 }
23967 void * _res = NULL;
23968 int _mark = p->mark;
23969 { // '.'
23970 if (p->error_indicator) {
23971 D(p->level--);
23972 return NULL;
23973 }
23974 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
23975 Token * _literal;
23976 if (
23977 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
23978 )
23979 {
23980 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
23981 _res = _literal;
23982 goto done;
23983 }
23984 p->mark = _mark;
23985 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
23986 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
23987 }
23988 { // '...'
23989 if (p->error_indicator) {
23990 D(p->level--);
23991 return NULL;
23992 }
23993 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
23994 Token * _literal;
23995 if (
23996 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
23997 )
23998 {
23999 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
24000 _res = _literal;
24001 goto done;
24002 }
24003 p->mark = _mark;
24004 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
24005 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
24006 }
24007 _res = NULL;
24008 done:
24009 D(p->level--);
24010 return _res;
24011}
24012
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024013// _tmp_141: '@' named_expression NEWLINE
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024014static void *
24015_tmp_141_rule(Parser *p)
24016{
24017 D(p->level++);
24018 if (p->error_indicator) {
24019 D(p->level--);
24020 return NULL;
24021 }
24022 void * _res = NULL;
24023 int _mark = p->mark;
24024 { // '@' named_expression NEWLINE
24025 if (p->error_indicator) {
24026 D(p->level--);
24027 return NULL;
24028 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024029 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024030 Token * _literal;
24031 expr_ty f;
24032 Token * newline_var;
24033 if (
24034 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
24035 &&
24036 (f = named_expression_rule(p)) // named_expression
24037 &&
24038 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
24039 )
24040 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024041 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024042 _res = f;
24043 if (_res == NULL && PyErr_Occurred()) {
24044 p->error_indicator = 1;
24045 D(p->level--);
24046 return NULL;
24047 }
24048 goto done;
24049 }
24050 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024051 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024052 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
24053 }
24054 _res = NULL;
24055 done:
24056 D(p->level--);
24057 return _res;
24058}
24059
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024060// _tmp_142: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024061static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024062_tmp_142_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024063{
24064 D(p->level++);
24065 if (p->error_indicator) {
24066 D(p->level--);
24067 return NULL;
24068 }
24069 void * _res = NULL;
24070 int _mark = p->mark;
24071 { // ',' star_expression
24072 if (p->error_indicator) {
24073 D(p->level--);
24074 return NULL;
24075 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024076 D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024077 Token * _literal;
24078 expr_ty c;
24079 if (
24080 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24081 &&
24082 (c = star_expression_rule(p)) // star_expression
24083 )
24084 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024085 D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024086 _res = c;
24087 if (_res == NULL && PyErr_Occurred()) {
24088 p->error_indicator = 1;
24089 D(p->level--);
24090 return NULL;
24091 }
24092 goto done;
24093 }
24094 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024095 D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024096 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
24097 }
24098 _res = NULL;
24099 done:
24100 D(p->level--);
24101 return _res;
24102}
24103
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024104// _tmp_143: ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024105static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024106_tmp_143_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024107{
24108 D(p->level++);
24109 if (p->error_indicator) {
24110 D(p->level--);
24111 return NULL;
24112 }
24113 void * _res = NULL;
24114 int _mark = p->mark;
24115 { // ',' expression
24116 if (p->error_indicator) {
24117 D(p->level--);
24118 return NULL;
24119 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024120 D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024121 Token * _literal;
24122 expr_ty c;
24123 if (
24124 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24125 &&
24126 (c = expression_rule(p)) // expression
24127 )
24128 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024129 D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024130 _res = c;
24131 if (_res == NULL && PyErr_Occurred()) {
24132 p->error_indicator = 1;
24133 D(p->level--);
24134 return NULL;
24135 }
24136 goto done;
24137 }
24138 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024139 D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024140 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
24141 }
24142 _res = NULL;
24143 done:
24144 D(p->level--);
24145 return _res;
24146}
24147
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024148// _tmp_144: 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024149static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024150_tmp_144_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024151{
24152 D(p->level++);
24153 if (p->error_indicator) {
24154 D(p->level--);
24155 return NULL;
24156 }
24157 void * _res = NULL;
24158 int _mark = p->mark;
24159 { // 'or' conjunction
24160 if (p->error_indicator) {
24161 D(p->level--);
24162 return NULL;
24163 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024164 D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024165 Token * _keyword;
24166 expr_ty c;
24167 if (
24168 (_keyword = _PyPegen_expect_token(p, 531)) // token='or'
24169 &&
24170 (c = conjunction_rule(p)) // conjunction
24171 )
24172 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024173 D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024174 _res = c;
24175 if (_res == NULL && PyErr_Occurred()) {
24176 p->error_indicator = 1;
24177 D(p->level--);
24178 return NULL;
24179 }
24180 goto done;
24181 }
24182 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024183 D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024184 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
24185 }
24186 _res = NULL;
24187 done:
24188 D(p->level--);
24189 return _res;
24190}
24191
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024192// _tmp_145: 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024193static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024194_tmp_145_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024195{
24196 D(p->level++);
24197 if (p->error_indicator) {
24198 D(p->level--);
24199 return NULL;
24200 }
24201 void * _res = NULL;
24202 int _mark = p->mark;
24203 { // 'and' inversion
24204 if (p->error_indicator) {
24205 D(p->level--);
24206 return NULL;
24207 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024208 D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024209 Token * _keyword;
24210 expr_ty c;
24211 if (
24212 (_keyword = _PyPegen_expect_token(p, 532)) // token='and'
24213 &&
24214 (c = inversion_rule(p)) // inversion
24215 )
24216 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024217 D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024218 _res = c;
24219 if (_res == NULL && PyErr_Occurred()) {
24220 p->error_indicator = 1;
24221 D(p->level--);
24222 return NULL;
24223 }
24224 goto done;
24225 }
24226 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024227 D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030024228 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024229 }
24230 _res = NULL;
24231 done:
24232 D(p->level--);
24233 return _res;
24234}
24235
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024236// _tmp_146: 'if' disjunction
24237static void *
24238_tmp_146_rule(Parser *p)
24239{
24240 D(p->level++);
24241 if (p->error_indicator) {
24242 D(p->level--);
24243 return NULL;
24244 }
24245 void * _res = NULL;
24246 int _mark = p->mark;
24247 { // 'if' disjunction
24248 if (p->error_indicator) {
24249 D(p->level--);
24250 return NULL;
24251 }
24252 D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24253 Token * _keyword;
24254 expr_ty z;
24255 if (
24256 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24257 &&
24258 (z = disjunction_rule(p)) // disjunction
24259 )
24260 {
24261 D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24262 _res = z;
24263 if (_res == NULL && PyErr_Occurred()) {
24264 p->error_indicator = 1;
24265 D(p->level--);
24266 return NULL;
24267 }
24268 goto done;
24269 }
24270 p->mark = _mark;
24271 D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
24272 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24273 }
24274 _res = NULL;
24275 done:
24276 D(p->level--);
24277 return _res;
24278}
24279
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024280// _tmp_147: 'if' disjunction
24281static void *
24282_tmp_147_rule(Parser *p)
24283{
24284 D(p->level++);
24285 if (p->error_indicator) {
24286 D(p->level--);
24287 return NULL;
24288 }
24289 void * _res = NULL;
24290 int _mark = p->mark;
24291 { // 'if' disjunction
24292 if (p->error_indicator) {
24293 D(p->level--);
24294 return NULL;
24295 }
24296 D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24297 Token * _keyword;
24298 expr_ty z;
24299 if (
24300 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24301 &&
24302 (z = disjunction_rule(p)) // disjunction
24303 )
24304 {
24305 D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24306 _res = z;
24307 if (_res == NULL && PyErr_Occurred()) {
24308 p->error_indicator = 1;
24309 D(p->level--);
24310 return NULL;
24311 }
24312 goto done;
24313 }
24314 p->mark = _mark;
24315 D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
24316 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24317 }
24318 _res = NULL;
24319 done:
24320 D(p->level--);
24321 return _res;
24322}
24323
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024324// _tmp_148: ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024325static void *
24326_tmp_148_rule(Parser *p)
24327{
24328 D(p->level++);
24329 if (p->error_indicator) {
24330 D(p->level--);
24331 return NULL;
24332 }
24333 void * _res = NULL;
24334 int _mark = p->mark;
24335 { // ',' star_target
24336 if (p->error_indicator) {
24337 D(p->level--);
24338 return NULL;
24339 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024340 D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024341 Token * _literal;
24342 expr_ty c;
24343 if (
24344 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24345 &&
24346 (c = star_target_rule(p)) // star_target
24347 )
24348 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024349 D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024350 _res = c;
24351 if (_res == NULL && PyErr_Occurred()) {
24352 p->error_indicator = 1;
24353 D(p->level--);
24354 return NULL;
24355 }
24356 goto done;
24357 }
24358 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024359 D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030024360 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024361 }
24362 _res = NULL;
24363 done:
24364 D(p->level--);
24365 return _res;
24366}
24367
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024368// _tmp_149: star_targets '='
24369static void *
24370_tmp_149_rule(Parser *p)
24371{
24372 D(p->level++);
24373 if (p->error_indicator) {
24374 D(p->level--);
24375 return NULL;
24376 }
24377 void * _res = NULL;
24378 int _mark = p->mark;
24379 { // star_targets '='
24380 if (p->error_indicator) {
24381 D(p->level--);
24382 return NULL;
24383 }
24384 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
24385 Token * _literal;
24386 expr_ty star_targets_var;
24387 if (
24388 (star_targets_var = star_targets_rule(p)) // star_targets
24389 &&
24390 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24391 )
24392 {
24393 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
24394 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24395 goto done;
24396 }
24397 p->mark = _mark;
24398 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24399 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24400 }
24401 _res = NULL;
24402 done:
24403 D(p->level--);
24404 return _res;
24405}
24406
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024407// _tmp_150: star_targets '='
24408static void *
24409_tmp_150_rule(Parser *p)
24410{
24411 D(p->level++);
24412 if (p->error_indicator) {
24413 D(p->level--);
24414 return NULL;
24415 }
24416 void * _res = NULL;
24417 int _mark = p->mark;
24418 { // star_targets '='
24419 if (p->error_indicator) {
24420 D(p->level--);
24421 return NULL;
24422 }
24423 D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
24424 Token * _literal;
24425 expr_ty star_targets_var;
24426 if (
24427 (star_targets_var = star_targets_rule(p)) // star_targets
24428 &&
24429 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24430 )
24431 {
24432 D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
24433 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24434 goto done;
24435 }
24436 p->mark = _mark;
24437 D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
24438 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24439 }
24440 _res = NULL;
24441 done:
24442 D(p->level--);
24443 return _res;
24444}
24445
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024446// _loop1_151: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024447static asdl_seq *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024448_loop1_151_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024449{
24450 D(p->level++);
24451 if (p->error_indicator) {
24452 D(p->level--);
24453 return NULL;
24454 }
24455 void *_res = NULL;
24456 int _mark = p->mark;
24457 int _start_mark = p->mark;
24458 void **_children = PyMem_Malloc(sizeof(void *));
24459 if (!_children) {
24460 p->error_indicator = 1;
24461 PyErr_NoMemory();
24462 D(p->level--);
24463 return NULL;
24464 }
24465 ssize_t _children_capacity = 1;
24466 ssize_t _n = 0;
24467 { // param_with_default
24468 if (p->error_indicator) {
24469 D(p->level--);
24470 return NULL;
24471 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024472 D(fprintf(stderr, "%*c> _loop1_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024473 NameDefaultPair* param_with_default_var;
24474 while (
24475 (param_with_default_var = param_with_default_rule(p)) // param_with_default
24476 )
24477 {
24478 _res = param_with_default_var;
24479 if (_n == _children_capacity) {
24480 _children_capacity *= 2;
24481 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24482 if (!_new_children) {
24483 p->error_indicator = 1;
24484 PyErr_NoMemory();
24485 D(p->level--);
24486 return NULL;
24487 }
24488 _children = _new_children;
24489 }
24490 _children[_n++] = _res;
24491 _mark = p->mark;
24492 }
24493 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024494 D(fprintf(stderr, "%*c%s _loop1_151[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024495 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
24496 }
24497 if (_n == 0 || p->error_indicator) {
24498 PyMem_Free(_children);
24499 D(p->level--);
24500 return NULL;
24501 }
24502 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
24503 if (!_seq) {
24504 PyMem_Free(_children);
24505 p->error_indicator = 1;
24506 PyErr_NoMemory();
24507 D(p->level--);
24508 return NULL;
24509 }
24510 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
24511 PyMem_Free(_children);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024512 _PyPegen_insert_memo(p, _start_mark, _loop1_151_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024513 D(p->level--);
24514 return _seq;
24515}
24516
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024517// _loop1_152: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024518static asdl_seq *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024519_loop1_152_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024520{
24521 D(p->level++);
24522 if (p->error_indicator) {
24523 D(p->level--);
24524 return NULL;
24525 }
24526 void *_res = NULL;
24527 int _mark = p->mark;
24528 int _start_mark = p->mark;
24529 void **_children = PyMem_Malloc(sizeof(void *));
24530 if (!_children) {
24531 p->error_indicator = 1;
24532 PyErr_NoMemory();
24533 D(p->level--);
24534 return NULL;
24535 }
24536 ssize_t _children_capacity = 1;
24537 ssize_t _n = 0;
24538 { // lambda_param_with_default
24539 if (p->error_indicator) {
24540 D(p->level--);
24541 return NULL;
24542 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024543 D(fprintf(stderr, "%*c> _loop1_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024544 NameDefaultPair* lambda_param_with_default_var;
24545 while (
24546 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
24547 )
24548 {
24549 _res = lambda_param_with_default_var;
24550 if (_n == _children_capacity) {
24551 _children_capacity *= 2;
24552 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24553 if (!_new_children) {
24554 p->error_indicator = 1;
24555 PyErr_NoMemory();
24556 D(p->level--);
24557 return NULL;
24558 }
24559 _children = _new_children;
24560 }
24561 _children[_n++] = _res;
24562 _mark = p->mark;
24563 }
24564 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024565 D(fprintf(stderr, "%*c%s _loop1_152[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024566 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
24567 }
24568 if (_n == 0 || p->error_indicator) {
24569 PyMem_Free(_children);
24570 D(p->level--);
24571 return NULL;
24572 }
24573 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
24574 if (!_seq) {
24575 PyMem_Free(_children);
24576 p->error_indicator = 1;
24577 PyErr_NoMemory();
24578 D(p->level--);
24579 return NULL;
24580 }
24581 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
24582 PyMem_Free(_children);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024583 _PyPegen_insert_memo(p, _start_mark, _loop1_152_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024584 D(p->level--);
24585 return _seq;
24586}
24587
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024588// _tmp_153: ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024589static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024590_tmp_153_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024591{
24592 D(p->level++);
24593 if (p->error_indicator) {
24594 D(p->level--);
24595 return NULL;
24596 }
24597 void * _res = NULL;
24598 int _mark = p->mark;
24599 { // ')'
24600 if (p->error_indicator) {
24601 D(p->level--);
24602 return NULL;
24603 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024604 D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024605 Token * _literal;
24606 if (
24607 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
24608 )
24609 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024610 D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
24611 _res = _literal;
24612 goto done;
24613 }
24614 p->mark = _mark;
24615 D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
24616 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
24617 }
24618 { // '**'
24619 if (p->error_indicator) {
24620 D(p->level--);
24621 return NULL;
24622 }
24623 D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
24624 Token * _literal;
24625 if (
24626 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24627 )
24628 {
24629 D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
24630 _res = _literal;
24631 goto done;
24632 }
24633 p->mark = _mark;
24634 D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
24635 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24636 }
24637 _res = NULL;
24638 done:
24639 D(p->level--);
24640 return _res;
24641}
24642
24643// _tmp_154: ':' | '**'
24644static void *
24645_tmp_154_rule(Parser *p)
24646{
24647 D(p->level++);
24648 if (p->error_indicator) {
24649 D(p->level--);
24650 return NULL;
24651 }
24652 void * _res = NULL;
24653 int _mark = p->mark;
24654 { // ':'
24655 if (p->error_indicator) {
24656 D(p->level--);
24657 return NULL;
24658 }
24659 D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
24660 Token * _literal;
24661 if (
24662 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
24663 )
24664 {
24665 D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024666 _res = _literal;
24667 goto done;
24668 }
24669 p->mark = _mark;
24670 D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024671 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024672 }
24673 { // '**'
24674 if (p->error_indicator) {
24675 D(p->level--);
24676 return NULL;
24677 }
24678 D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
24679 Token * _literal;
24680 if (
24681 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24682 )
24683 {
24684 D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
24685 _res = _literal;
24686 goto done;
24687 }
24688 p->mark = _mark;
24689 D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ',
24690 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24691 }
24692 _res = NULL;
24693 done:
24694 D(p->level--);
24695 return _res;
24696}
24697
24698void *
24699_PyPegen_parse(Parser *p)
24700{
24701 // Initialize keywords
24702 p->keywords = reserved_keywords;
24703 p->n_keyword_lists = n_keyword_lists;
24704
24705 // Run parser
24706 void *result = NULL;
24707 if (p->start_rule == Py_file_input) {
24708 result = file_rule(p);
24709 } else if (p->start_rule == Py_single_input) {
24710 result = interactive_rule(p);
24711 } else if (p->start_rule == Py_eval_input) {
24712 result = eval_rule(p);
24713 } else if (p->start_rule == Py_func_type_input) {
24714 result = func_type_rule(p);
24715 } else if (p->start_rule == Py_fstring_input) {
24716 result = fstring_rule(p);
24717 }
24718
24719 return result;
24720}
24721
24722// The end