blob: a882a81344cc61c1ad78489cab6a67776636e095 [file] [log] [blame]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001// @generated by pegen.py from ./Grammar/python.gram
2#include "pegen.h"
Guido van Rossumf70e43a1991-02-19 12:39:46 +00003
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004#if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
Guido van Rossum86bea461997-04-29 21:03:06 +00005extern int Py_DebugFlag;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006#define D(x) if (Py_DebugFlag) x;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00007#else
8#define D(x)
9#endif
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010static const int n_keyword_lists = 9;
11static KeywordToken *reserved_keywords[] = {
Pablo Galindo1ac0cbc2020-07-06 20:31:16 +010012 (KeywordToken[]) {{NULL, -1}},
13 (KeywordToken[]) {{NULL, -1}},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014 (KeywordToken[]) {
15 {"if", 510},
16 {"in", 518},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017 {"as", 520},
18 {"is", 527},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019 {"or", 531},
20 {NULL, -1},
21 },
22 (KeywordToken[]) {
23 {"del", 503},
24 {"try", 511},
25 {"for", 517},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030026 {"def", 523},
27 {"not", 526},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010028 {"and", 532},
29 {NULL, -1},
30 },
31 (KeywordToken[]) {
32 {"pass", 502},
33 {"from", 514},
34 {"elif", 515},
35 {"else", 516},
36 {"with", 519},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030037 {"True", 528},
38 {"None", 530},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010039 {NULL, -1},
40 },
41 (KeywordToken[]) {
42 {"raise", 501},
43 {"yield", 504},
44 {"break", 506},
45 {"while", 512},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030046 {"class", 524},
47 {"False", 529},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010048 {NULL, -1},
49 },
50 (KeywordToken[]) {
51 {"return", 500},
52 {"assert", 505},
53 {"global", 508},
54 {"import", 513},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030055 {"except", 521},
56 {"lambda", 525},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010057 {NULL, -1},
58 },
59 (KeywordToken[]) {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030060 {"finally", 522},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010061 {NULL, -1},
62 },
63 (KeywordToken[]) {
64 {"continue", 507},
65 {"nonlocal", 509},
66 {NULL, -1},
67 },
68};
69#define file_type 1000
70#define interactive_type 1001
71#define eval_type 1002
72#define func_type_type 1003
73#define fstring_type 1004
74#define type_expressions_type 1005
75#define statements_type 1006
76#define statement_type 1007
77#define statement_newline_type 1008
78#define simple_stmt_type 1009
79#define small_stmt_type 1010
80#define compound_stmt_type 1011
81#define assignment_type 1012
82#define augassign_type 1013
83#define global_stmt_type 1014
84#define nonlocal_stmt_type 1015
85#define yield_stmt_type 1016
86#define assert_stmt_type 1017
87#define del_stmt_type 1018
88#define import_stmt_type 1019
89#define import_name_type 1020
90#define import_from_type 1021
91#define import_from_targets_type 1022
92#define import_from_as_names_type 1023
93#define import_from_as_name_type 1024
94#define dotted_as_names_type 1025
95#define dotted_as_name_type 1026
96#define dotted_name_type 1027 // Left-recursive
97#define if_stmt_type 1028
98#define elif_stmt_type 1029
99#define else_block_type 1030
100#define while_stmt_type 1031
101#define for_stmt_type 1032
102#define with_stmt_type 1033
103#define with_item_type 1034
104#define try_stmt_type 1035
105#define except_block_type 1036
106#define finally_block_type 1037
107#define return_stmt_type 1038
108#define raise_stmt_type 1039
109#define function_def_type 1040
110#define function_def_raw_type 1041
111#define func_type_comment_type 1042
112#define params_type 1043
113#define parameters_type 1044
114#define slash_no_default_type 1045
115#define slash_with_default_type 1046
116#define star_etc_type 1047
117#define kwds_type 1048
118#define param_no_default_type 1049
119#define param_with_default_type 1050
120#define param_maybe_default_type 1051
121#define param_type 1052
122#define annotation_type 1053
123#define default_type 1054
124#define decorators_type 1055
125#define class_def_type 1056
126#define class_def_raw_type 1057
127#define block_type 1058
128#define expressions_list_type 1059
129#define star_expressions_type 1060
130#define star_expression_type 1061
131#define star_named_expressions_type 1062
132#define star_named_expression_type 1063
133#define named_expression_type 1064
134#define annotated_rhs_type 1065
135#define expressions_type 1066
136#define expression_type 1067
137#define lambdef_type 1068
138#define lambda_params_type 1069
139#define lambda_parameters_type 1070
140#define lambda_slash_no_default_type 1071
141#define lambda_slash_with_default_type 1072
142#define lambda_star_etc_type 1073
143#define lambda_kwds_type 1074
144#define lambda_param_no_default_type 1075
145#define lambda_param_with_default_type 1076
146#define lambda_param_maybe_default_type 1077
147#define lambda_param_type 1078
148#define disjunction_type 1079
149#define conjunction_type 1080
150#define inversion_type 1081
151#define comparison_type 1082
152#define compare_op_bitwise_or_pair_type 1083
153#define eq_bitwise_or_type 1084
154#define noteq_bitwise_or_type 1085
155#define lte_bitwise_or_type 1086
156#define lt_bitwise_or_type 1087
157#define gte_bitwise_or_type 1088
158#define gt_bitwise_or_type 1089
159#define notin_bitwise_or_type 1090
160#define in_bitwise_or_type 1091
161#define isnot_bitwise_or_type 1092
162#define is_bitwise_or_type 1093
163#define bitwise_or_type 1094 // Left-recursive
164#define bitwise_xor_type 1095 // Left-recursive
165#define bitwise_and_type 1096 // Left-recursive
166#define shift_expr_type 1097 // Left-recursive
167#define sum_type 1098 // Left-recursive
168#define term_type 1099 // Left-recursive
169#define factor_type 1100
170#define power_type 1101
171#define await_primary_type 1102
172#define primary_type 1103 // Left-recursive
173#define slices_type 1104
174#define slice_type 1105
175#define atom_type 1106
176#define strings_type 1107
177#define list_type 1108
178#define listcomp_type 1109
179#define tuple_type 1110
180#define group_type 1111
181#define genexp_type 1112
182#define set_type 1113
183#define setcomp_type 1114
184#define dict_type 1115
185#define dictcomp_type 1116
186#define double_starred_kvpairs_type 1117
187#define double_starred_kvpair_type 1118
188#define kvpair_type 1119
189#define for_if_clauses_type 1120
190#define for_if_clause_type 1121
191#define yield_expr_type 1122
192#define arguments_type 1123
193#define args_type 1124
194#define kwargs_type 1125
195#define starred_expression_type 1126
196#define kwarg_or_starred_type 1127
197#define kwarg_or_double_starred_type 1128
198#define star_targets_type 1129
199#define star_targets_seq_type 1130
200#define star_target_type 1131
201#define star_atom_type 1132
202#define single_target_type 1133
203#define single_subscript_attribute_target_type 1134
204#define del_targets_type 1135
205#define del_target_type 1136
206#define del_t_atom_type 1137
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300207#define targets_type 1138
208#define target_type 1139
209#define t_primary_type 1140 // Left-recursive
210#define t_lookahead_type 1141
211#define t_atom_type 1142
Lysandros Nikolaoubca70142020-10-27 00:42:04 +0200212#define invalid_arguments_type 1143
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300213#define invalid_kwarg_type 1144
214#define invalid_named_expression_type 1145
215#define invalid_assignment_type 1146
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300216#define invalid_ann_assign_target_type 1147
217#define invalid_del_stmt_type 1148
218#define invalid_block_type 1149
Lysandros Nikolaou15acc4e2020-10-27 20:54:20 +0200219#define invalid_primary_type 1150 // Left-recursive
220#define invalid_comprehension_type 1151
221#define invalid_dict_comprehension_type 1152
222#define invalid_parameters_type 1153
223#define invalid_lambda_parameters_type 1154
224#define invalid_star_etc_type 1155
225#define invalid_lambda_star_etc_type 1156
226#define invalid_double_type_comments_type 1157
227#define invalid_with_item_type 1158
228#define invalid_for_target_type 1159
229#define invalid_group_type 1160
230#define invalid_import_from_targets_type 1161
231#define _loop0_1_type 1162
232#define _loop0_2_type 1163
233#define _loop0_4_type 1164
234#define _gather_3_type 1165
235#define _loop0_6_type 1166
236#define _gather_5_type 1167
237#define _loop0_8_type 1168
238#define _gather_7_type 1169
239#define _loop0_10_type 1170
240#define _gather_9_type 1171
241#define _loop1_11_type 1172
242#define _loop0_13_type 1173
243#define _gather_12_type 1174
244#define _tmp_14_type 1175
245#define _tmp_15_type 1176
246#define _tmp_16_type 1177
247#define _tmp_17_type 1178
248#define _tmp_18_type 1179
249#define _tmp_19_type 1180
250#define _tmp_20_type 1181
251#define _tmp_21_type 1182
252#define _loop1_22_type 1183
253#define _tmp_23_type 1184
254#define _tmp_24_type 1185
255#define _loop0_26_type 1186
256#define _gather_25_type 1187
257#define _loop0_28_type 1188
258#define _gather_27_type 1189
259#define _tmp_29_type 1190
260#define _tmp_30_type 1191
261#define _loop0_31_type 1192
262#define _loop1_32_type 1193
263#define _loop0_34_type 1194
264#define _gather_33_type 1195
265#define _tmp_35_type 1196
266#define _loop0_37_type 1197
267#define _gather_36_type 1198
268#define _tmp_38_type 1199
269#define _loop0_40_type 1200
270#define _gather_39_type 1201
271#define _loop0_42_type 1202
272#define _gather_41_type 1203
273#define _loop0_44_type 1204
274#define _gather_43_type 1205
275#define _loop0_46_type 1206
276#define _gather_45_type 1207
277#define _tmp_47_type 1208
278#define _loop1_48_type 1209
279#define _tmp_49_type 1210
280#define _tmp_50_type 1211
281#define _tmp_51_type 1212
282#define _tmp_52_type 1213
283#define _tmp_53_type 1214
284#define _loop0_54_type 1215
285#define _loop0_55_type 1216
286#define _loop0_56_type 1217
287#define _loop1_57_type 1218
288#define _loop0_58_type 1219
289#define _loop1_59_type 1220
290#define _loop1_60_type 1221
291#define _loop1_61_type 1222
292#define _loop0_62_type 1223
293#define _loop1_63_type 1224
294#define _loop0_64_type 1225
295#define _loop1_65_type 1226
296#define _loop0_66_type 1227
297#define _loop1_67_type 1228
298#define _loop1_68_type 1229
299#define _tmp_69_type 1230
300#define _loop0_71_type 1231
301#define _gather_70_type 1232
302#define _loop1_72_type 1233
303#define _loop0_74_type 1234
304#define _gather_73_type 1235
305#define _loop1_75_type 1236
306#define _loop0_76_type 1237
307#define _loop0_77_type 1238
308#define _loop0_78_type 1239
309#define _loop1_79_type 1240
310#define _loop0_80_type 1241
311#define _loop1_81_type 1242
312#define _loop1_82_type 1243
313#define _loop1_83_type 1244
314#define _loop0_84_type 1245
315#define _loop1_85_type 1246
316#define _loop0_86_type 1247
317#define _loop1_87_type 1248
318#define _loop0_88_type 1249
319#define _loop1_89_type 1250
320#define _loop1_90_type 1251
321#define _loop1_91_type 1252
322#define _loop1_92_type 1253
323#define _tmp_93_type 1254
324#define _loop0_95_type 1255
325#define _gather_94_type 1256
326#define _tmp_96_type 1257
327#define _tmp_97_type 1258
328#define _tmp_98_type 1259
329#define _tmp_99_type 1260
330#define _loop1_100_type 1261
331#define _tmp_101_type 1262
332#define _tmp_102_type 1263
333#define _loop0_104_type 1264
334#define _gather_103_type 1265
335#define _loop1_105_type 1266
336#define _loop0_106_type 1267
337#define _loop0_107_type 1268
338#define _loop0_109_type 1269
339#define _gather_108_type 1270
340#define _tmp_110_type 1271
341#define _loop0_112_type 1272
342#define _gather_111_type 1273
343#define _loop0_114_type 1274
344#define _gather_113_type 1275
345#define _loop0_116_type 1276
346#define _gather_115_type 1277
347#define _loop0_118_type 1278
348#define _gather_117_type 1279
349#define _loop0_119_type 1280
350#define _loop0_121_type 1281
351#define _gather_120_type 1282
352#define _tmp_122_type 1283
353#define _loop0_124_type 1284
354#define _gather_123_type 1285
355#define _loop0_126_type 1286
356#define _gather_125_type 1287
357#define _tmp_127_type 1288
358#define _loop0_128_type 1289
359#define _loop0_129_type 1290
360#define _loop0_130_type 1291
361#define _tmp_131_type 1292
362#define _tmp_132_type 1293
363#define _loop0_133_type 1294
364#define _tmp_134_type 1295
365#define _loop0_135_type 1296
366#define _tmp_136_type 1297
367#define _tmp_137_type 1298
368#define _tmp_138_type 1299
369#define _tmp_139_type 1300
370#define _tmp_140_type 1301
371#define _tmp_141_type 1302
372#define _tmp_142_type 1303
373#define _tmp_143_type 1304
374#define _tmp_144_type 1305
375#define _tmp_145_type 1306
376#define _tmp_146_type 1307
377#define _tmp_147_type 1308
378#define _tmp_148_type 1309
379#define _tmp_149_type 1310
380#define _tmp_150_type 1311
381#define _tmp_151_type 1312
382#define _tmp_152_type 1313
383#define _loop1_153_type 1314
384#define _loop1_154_type 1315
385#define _tmp_155_type 1316
386#define _tmp_156_type 1317
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100387
388static mod_ty file_rule(Parser *p);
389static mod_ty interactive_rule(Parser *p);
390static mod_ty eval_rule(Parser *p);
391static mod_ty func_type_rule(Parser *p);
392static expr_ty fstring_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100393static asdl_expr_seq* type_expressions_rule(Parser *p);
394static asdl_stmt_seq* statements_rule(Parser *p);
395static asdl_stmt_seq* statement_rule(Parser *p);
396static asdl_stmt_seq* statement_newline_rule(Parser *p);
397static asdl_stmt_seq* simple_stmt_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100398static stmt_ty small_stmt_rule(Parser *p);
399static stmt_ty compound_stmt_rule(Parser *p);
400static stmt_ty assignment_rule(Parser *p);
401static AugOperator* augassign_rule(Parser *p);
402static stmt_ty global_stmt_rule(Parser *p);
403static stmt_ty nonlocal_stmt_rule(Parser *p);
404static stmt_ty yield_stmt_rule(Parser *p);
405static stmt_ty assert_stmt_rule(Parser *p);
406static stmt_ty del_stmt_rule(Parser *p);
407static stmt_ty import_stmt_rule(Parser *p);
408static stmt_ty import_name_rule(Parser *p);
409static stmt_ty import_from_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100410static asdl_alias_seq* import_from_targets_rule(Parser *p);
411static asdl_alias_seq* import_from_as_names_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100412static alias_ty import_from_as_name_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100413static asdl_alias_seq* dotted_as_names_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100414static alias_ty dotted_as_name_rule(Parser *p);
415static expr_ty dotted_name_rule(Parser *p);
416static stmt_ty if_stmt_rule(Parser *p);
417static stmt_ty elif_stmt_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100418static asdl_stmt_seq* else_block_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100419static stmt_ty while_stmt_rule(Parser *p);
420static stmt_ty for_stmt_rule(Parser *p);
421static stmt_ty with_stmt_rule(Parser *p);
422static withitem_ty with_item_rule(Parser *p);
423static stmt_ty try_stmt_rule(Parser *p);
424static excepthandler_ty except_block_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100425static asdl_stmt_seq* finally_block_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100426static stmt_ty return_stmt_rule(Parser *p);
427static stmt_ty raise_stmt_rule(Parser *p);
428static stmt_ty function_def_rule(Parser *p);
429static stmt_ty function_def_raw_rule(Parser *p);
430static Token* func_type_comment_rule(Parser *p);
431static arguments_ty params_rule(Parser *p);
432static arguments_ty parameters_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100433static asdl_arg_seq* slash_no_default_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100434static SlashWithDefault* slash_with_default_rule(Parser *p);
435static StarEtc* star_etc_rule(Parser *p);
436static arg_ty kwds_rule(Parser *p);
437static arg_ty param_no_default_rule(Parser *p);
438static NameDefaultPair* param_with_default_rule(Parser *p);
439static NameDefaultPair* param_maybe_default_rule(Parser *p);
440static arg_ty param_rule(Parser *p);
441static expr_ty annotation_rule(Parser *p);
442static expr_ty default_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100443static asdl_expr_seq* decorators_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100444static stmt_ty class_def_rule(Parser *p);
445static stmt_ty class_def_raw_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100446static asdl_stmt_seq* block_rule(Parser *p);
447static asdl_expr_seq* expressions_list_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100448static expr_ty star_expressions_rule(Parser *p);
449static expr_ty star_expression_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100450static asdl_expr_seq* star_named_expressions_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100451static expr_ty star_named_expression_rule(Parser *p);
452static expr_ty named_expression_rule(Parser *p);
453static expr_ty annotated_rhs_rule(Parser *p);
454static expr_ty expressions_rule(Parser *p);
455static expr_ty expression_rule(Parser *p);
456static expr_ty lambdef_rule(Parser *p);
457static arguments_ty lambda_params_rule(Parser *p);
458static arguments_ty lambda_parameters_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100459static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100460static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
461static StarEtc* lambda_star_etc_rule(Parser *p);
462static arg_ty lambda_kwds_rule(Parser *p);
463static arg_ty lambda_param_no_default_rule(Parser *p);
464static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
465static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
466static arg_ty lambda_param_rule(Parser *p);
467static expr_ty disjunction_rule(Parser *p);
468static expr_ty conjunction_rule(Parser *p);
469static expr_ty inversion_rule(Parser *p);
470static expr_ty comparison_rule(Parser *p);
471static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
472static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
473static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
474static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
475static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
476static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
477static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
478static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
479static CmpopExprPair* in_bitwise_or_rule(Parser *p);
480static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
481static CmpopExprPair* is_bitwise_or_rule(Parser *p);
482static expr_ty bitwise_or_rule(Parser *p);
483static expr_ty bitwise_xor_rule(Parser *p);
484static expr_ty bitwise_and_rule(Parser *p);
485static expr_ty shift_expr_rule(Parser *p);
486static expr_ty sum_rule(Parser *p);
487static expr_ty term_rule(Parser *p);
488static expr_ty factor_rule(Parser *p);
489static expr_ty power_rule(Parser *p);
490static expr_ty await_primary_rule(Parser *p);
491static expr_ty primary_rule(Parser *p);
492static expr_ty slices_rule(Parser *p);
493static expr_ty slice_rule(Parser *p);
494static expr_ty atom_rule(Parser *p);
495static expr_ty strings_rule(Parser *p);
496static expr_ty list_rule(Parser *p);
497static expr_ty listcomp_rule(Parser *p);
498static expr_ty tuple_rule(Parser *p);
499static expr_ty group_rule(Parser *p);
500static expr_ty genexp_rule(Parser *p);
501static expr_ty set_rule(Parser *p);
502static expr_ty setcomp_rule(Parser *p);
503static expr_ty dict_rule(Parser *p);
504static expr_ty dictcomp_rule(Parser *p);
505static asdl_seq* double_starred_kvpairs_rule(Parser *p);
506static KeyValuePair* double_starred_kvpair_rule(Parser *p);
507static KeyValuePair* kvpair_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100508static asdl_comprehension_seq* for_if_clauses_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100509static comprehension_ty for_if_clause_rule(Parser *p);
510static expr_ty yield_expr_rule(Parser *p);
511static expr_ty arguments_rule(Parser *p);
512static expr_ty args_rule(Parser *p);
513static asdl_seq* kwargs_rule(Parser *p);
514static expr_ty starred_expression_rule(Parser *p);
515static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
516static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
517static expr_ty star_targets_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100518static asdl_expr_seq* star_targets_seq_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100519static expr_ty star_target_rule(Parser *p);
520static expr_ty star_atom_rule(Parser *p);
521static expr_ty single_target_rule(Parser *p);
522static expr_ty single_subscript_attribute_target_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100523static asdl_expr_seq* del_targets_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100524static expr_ty del_target_rule(Parser *p);
525static expr_ty del_t_atom_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100526static asdl_expr_seq* targets_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100527static expr_ty target_rule(Parser *p);
528static expr_ty t_primary_rule(Parser *p);
529static void *t_lookahead_rule(Parser *p);
530static expr_ty t_atom_rule(Parser *p);
Lysandros Nikolaoubca70142020-10-27 00:42:04 +0200531static void *invalid_arguments_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100532static void *invalid_kwarg_rule(Parser *p);
533static void *invalid_named_expression_rule(Parser *p);
534static void *invalid_assignment_rule(Parser *p);
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300535static expr_ty invalid_ann_assign_target_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300536static void *invalid_del_stmt_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100537static void *invalid_block_rule(Parser *p);
Lysandros Nikolaou15acc4e2020-10-27 20:54:20 +0200538static void *invalid_primary_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100539static void *invalid_comprehension_rule(Parser *p);
540static void *invalid_dict_comprehension_rule(Parser *p);
541static void *invalid_parameters_rule(Parser *p);
542static void *invalid_lambda_parameters_rule(Parser *p);
543static void *invalid_star_etc_rule(Parser *p);
544static void *invalid_lambda_star_etc_rule(Parser *p);
545static void *invalid_double_type_comments_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300546static void *invalid_with_item_rule(Parser *p);
547static void *invalid_for_target_rule(Parser *p);
548static void *invalid_group_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100549static void *invalid_import_from_targets_rule(Parser *p);
550static asdl_seq *_loop0_1_rule(Parser *p);
551static asdl_seq *_loop0_2_rule(Parser *p);
552static asdl_seq *_loop0_4_rule(Parser *p);
553static asdl_seq *_gather_3_rule(Parser *p);
554static asdl_seq *_loop0_6_rule(Parser *p);
555static asdl_seq *_gather_5_rule(Parser *p);
556static asdl_seq *_loop0_8_rule(Parser *p);
557static asdl_seq *_gather_7_rule(Parser *p);
558static asdl_seq *_loop0_10_rule(Parser *p);
559static asdl_seq *_gather_9_rule(Parser *p);
560static asdl_seq *_loop1_11_rule(Parser *p);
561static asdl_seq *_loop0_13_rule(Parser *p);
562static asdl_seq *_gather_12_rule(Parser *p);
563static void *_tmp_14_rule(Parser *p);
564static void *_tmp_15_rule(Parser *p);
565static void *_tmp_16_rule(Parser *p);
566static void *_tmp_17_rule(Parser *p);
567static void *_tmp_18_rule(Parser *p);
568static void *_tmp_19_rule(Parser *p);
569static void *_tmp_20_rule(Parser *p);
570static void *_tmp_21_rule(Parser *p);
571static asdl_seq *_loop1_22_rule(Parser *p);
572static void *_tmp_23_rule(Parser *p);
573static void *_tmp_24_rule(Parser *p);
574static asdl_seq *_loop0_26_rule(Parser *p);
575static asdl_seq *_gather_25_rule(Parser *p);
576static asdl_seq *_loop0_28_rule(Parser *p);
577static asdl_seq *_gather_27_rule(Parser *p);
578static void *_tmp_29_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300579static void *_tmp_30_rule(Parser *p);
580static asdl_seq *_loop0_31_rule(Parser *p);
581static asdl_seq *_loop1_32_rule(Parser *p);
582static asdl_seq *_loop0_34_rule(Parser *p);
583static asdl_seq *_gather_33_rule(Parser *p);
584static void *_tmp_35_rule(Parser *p);
585static asdl_seq *_loop0_37_rule(Parser *p);
586static asdl_seq *_gather_36_rule(Parser *p);
587static void *_tmp_38_rule(Parser *p);
588static asdl_seq *_loop0_40_rule(Parser *p);
589static asdl_seq *_gather_39_rule(Parser *p);
590static asdl_seq *_loop0_42_rule(Parser *p);
591static asdl_seq *_gather_41_rule(Parser *p);
592static asdl_seq *_loop0_44_rule(Parser *p);
593static asdl_seq *_gather_43_rule(Parser *p);
594static asdl_seq *_loop0_46_rule(Parser *p);
595static asdl_seq *_gather_45_rule(Parser *p);
596static void *_tmp_47_rule(Parser *p);
597static asdl_seq *_loop1_48_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100598static void *_tmp_49_rule(Parser *p);
599static void *_tmp_50_rule(Parser *p);
600static void *_tmp_51_rule(Parser *p);
601static void *_tmp_52_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300602static void *_tmp_53_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100603static asdl_seq *_loop0_54_rule(Parser *p);
604static asdl_seq *_loop0_55_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300605static asdl_seq *_loop0_56_rule(Parser *p);
606static asdl_seq *_loop1_57_rule(Parser *p);
607static asdl_seq *_loop0_58_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100608static asdl_seq *_loop1_59_rule(Parser *p);
609static asdl_seq *_loop1_60_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300610static asdl_seq *_loop1_61_rule(Parser *p);
611static asdl_seq *_loop0_62_rule(Parser *p);
612static asdl_seq *_loop1_63_rule(Parser *p);
613static asdl_seq *_loop0_64_rule(Parser *p);
614static asdl_seq *_loop1_65_rule(Parser *p);
615static asdl_seq *_loop0_66_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100616static asdl_seq *_loop1_67_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300617static asdl_seq *_loop1_68_rule(Parser *p);
618static void *_tmp_69_rule(Parser *p);
619static asdl_seq *_loop0_71_rule(Parser *p);
620static asdl_seq *_gather_70_rule(Parser *p);
621static asdl_seq *_loop1_72_rule(Parser *p);
622static asdl_seq *_loop0_74_rule(Parser *p);
623static asdl_seq *_gather_73_rule(Parser *p);
624static asdl_seq *_loop1_75_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100625static asdl_seq *_loop0_76_rule(Parser *p);
626static asdl_seq *_loop0_77_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300627static asdl_seq *_loop0_78_rule(Parser *p);
628static asdl_seq *_loop1_79_rule(Parser *p);
629static asdl_seq *_loop0_80_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100630static asdl_seq *_loop1_81_rule(Parser *p);
631static asdl_seq *_loop1_82_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300632static asdl_seq *_loop1_83_rule(Parser *p);
633static asdl_seq *_loop0_84_rule(Parser *p);
634static asdl_seq *_loop1_85_rule(Parser *p);
635static asdl_seq *_loop0_86_rule(Parser *p);
636static asdl_seq *_loop1_87_rule(Parser *p);
637static asdl_seq *_loop0_88_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100638static asdl_seq *_loop1_89_rule(Parser *p);
639static asdl_seq *_loop1_90_rule(Parser *p);
640static asdl_seq *_loop1_91_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300641static asdl_seq *_loop1_92_rule(Parser *p);
642static void *_tmp_93_rule(Parser *p);
643static asdl_seq *_loop0_95_rule(Parser *p);
644static asdl_seq *_gather_94_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100645static void *_tmp_96_rule(Parser *p);
646static void *_tmp_97_rule(Parser *p);
647static void *_tmp_98_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300648static void *_tmp_99_rule(Parser *p);
649static asdl_seq *_loop1_100_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100650static void *_tmp_101_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300651static void *_tmp_102_rule(Parser *p);
652static asdl_seq *_loop0_104_rule(Parser *p);
653static asdl_seq *_gather_103_rule(Parser *p);
654static asdl_seq *_loop1_105_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100655static asdl_seq *_loop0_106_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300656static asdl_seq *_loop0_107_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100657static asdl_seq *_loop0_109_rule(Parser *p);
658static asdl_seq *_gather_108_rule(Parser *p);
659static void *_tmp_110_rule(Parser *p);
660static asdl_seq *_loop0_112_rule(Parser *p);
661static asdl_seq *_gather_111_rule(Parser *p);
662static asdl_seq *_loop0_114_rule(Parser *p);
663static asdl_seq *_gather_113_rule(Parser *p);
664static asdl_seq *_loop0_116_rule(Parser *p);
665static asdl_seq *_gather_115_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300666static asdl_seq *_loop0_118_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100667static asdl_seq *_gather_117_rule(Parser *p);
668static asdl_seq *_loop0_119_rule(Parser *p);
669static asdl_seq *_loop0_121_rule(Parser *p);
670static asdl_seq *_gather_120_rule(Parser *p);
671static void *_tmp_122_rule(Parser *p);
672static asdl_seq *_loop0_124_rule(Parser *p);
673static asdl_seq *_gather_123_rule(Parser *p);
674static asdl_seq *_loop0_126_rule(Parser *p);
675static asdl_seq *_gather_125_rule(Parser *p);
676static void *_tmp_127_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300677static asdl_seq *_loop0_128_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100678static asdl_seq *_loop0_129_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100679static asdl_seq *_loop0_130_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100680static void *_tmp_131_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100681static void *_tmp_132_rule(Parser *p);
682static asdl_seq *_loop0_133_rule(Parser *p);
683static void *_tmp_134_rule(Parser *p);
684static asdl_seq *_loop0_135_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100685static void *_tmp_136_rule(Parser *p);
686static void *_tmp_137_rule(Parser *p);
687static void *_tmp_138_rule(Parser *p);
688static void *_tmp_139_rule(Parser *p);
689static void *_tmp_140_rule(Parser *p);
690static void *_tmp_141_rule(Parser *p);
691static void *_tmp_142_rule(Parser *p);
692static void *_tmp_143_rule(Parser *p);
693static void *_tmp_144_rule(Parser *p);
694static void *_tmp_145_rule(Parser *p);
695static void *_tmp_146_rule(Parser *p);
696static void *_tmp_147_rule(Parser *p);
697static void *_tmp_148_rule(Parser *p);
698static void *_tmp_149_rule(Parser *p);
699static void *_tmp_150_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100700static void *_tmp_151_rule(Parser *p);
701static void *_tmp_152_rule(Parser *p);
702static asdl_seq *_loop1_153_rule(Parser *p);
703static asdl_seq *_loop1_154_rule(Parser *p);
704static void *_tmp_155_rule(Parser *p);
705static void *_tmp_156_rule(Parser *p);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000706
707
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100708// file: statements? $
709static mod_ty
710file_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000711{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100712 D(p->level++);
713 if (p->error_indicator) {
714 D(p->level--);
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000715 return NULL;
716 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100717 mod_ty _res = NULL;
718 int _mark = p->mark;
719 { // statements? $
720 if (p->error_indicator) {
721 D(p->level--);
722 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000723 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100724 D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $"));
725 void *a;
726 Token * endmarker_var;
727 if (
728 (a = statements_rule(p), 1) // statements?
729 &&
730 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
731 )
732 {
733 D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $"));
734 _res = _PyPegen_make_module ( p , a );
735 if (_res == NULL && PyErr_Occurred()) {
736 p->error_indicator = 1;
737 D(p->level--);
738 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000739 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100740 goto done;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000741 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100742 p->mark = _mark;
743 D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ',
744 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000745 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100746 _res = NULL;
747 done:
748 D(p->level--);
749 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000750}
751
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100752// interactive: statement_newline
753static mod_ty
754interactive_rule(Parser *p)
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000755{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100756 D(p->level++);
757 if (p->error_indicator) {
758 D(p->level--);
759 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000760 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100761 mod_ty _res = NULL;
762 int _mark = p->mark;
763 { // statement_newline
764 if (p->error_indicator) {
765 D(p->level--);
766 return NULL;
767 }
768 D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline"));
Pablo Galindoa5634c42020-09-16 19:42:00 +0100769 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100770 if (
771 (a = statement_newline_rule(p)) // statement_newline
772 )
773 {
774 D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline"));
775 _res = Interactive ( a , p -> arena );
776 if (_res == NULL && PyErr_Occurred()) {
777 p->error_indicator = 1;
778 D(p->level--);
779 return NULL;
780 }
781 goto done;
782 }
783 p->mark = _mark;
784 D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ',
785 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline"));
786 }
787 _res = NULL;
788 done:
789 D(p->level--);
790 return _res;
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000791}
792
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100793// eval: expressions NEWLINE* $
794static mod_ty
795eval_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000796{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100797 D(p->level++);
798 if (p->error_indicator) {
799 D(p->level--);
800 return NULL;
801 }
802 mod_ty _res = NULL;
803 int _mark = p->mark;
804 { // expressions NEWLINE* $
805 if (p->error_indicator) {
806 D(p->level--);
807 return NULL;
808 }
809 D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
810 asdl_seq * _loop0_1_var;
811 expr_ty a;
812 Token * endmarker_var;
813 if (
814 (a = expressions_rule(p)) // expressions
815 &&
816 (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE*
817 &&
818 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
819 )
820 {
821 D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
822 _res = Expression ( a , p -> arena );
823 if (_res == NULL && PyErr_Occurred()) {
824 p->error_indicator = 1;
825 D(p->level--);
826 return NULL;
827 }
828 goto done;
829 }
830 p->mark = _mark;
831 D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ',
832 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $"));
833 }
834 _res = NULL;
835 done:
836 D(p->level--);
837 return _res;
838}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000839
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100840// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
841static mod_ty
842func_type_rule(Parser *p)
843{
844 D(p->level++);
845 if (p->error_indicator) {
846 D(p->level--);
847 return NULL;
848 }
849 mod_ty _res = NULL;
850 int _mark = p->mark;
851 { // '(' type_expressions? ')' '->' expression NEWLINE* $
852 if (p->error_indicator) {
853 D(p->level--);
854 return NULL;
855 }
856 D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
857 Token * _literal;
858 Token * _literal_1;
859 Token * _literal_2;
860 asdl_seq * _loop0_2_var;
861 void *a;
862 expr_ty b;
863 Token * endmarker_var;
864 if (
865 (_literal = _PyPegen_expect_token(p, 7)) // token='('
866 &&
867 (a = type_expressions_rule(p), 1) // type_expressions?
868 &&
869 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
870 &&
871 (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->'
872 &&
873 (b = expression_rule(p)) // expression
874 &&
875 (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE*
876 &&
877 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
878 )
879 {
880 D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
881 _res = FunctionType ( a , b , p -> arena );
882 if (_res == NULL && PyErr_Occurred()) {
883 p->error_indicator = 1;
884 D(p->level--);
885 return NULL;
886 }
887 goto done;
888 }
889 p->mark = _mark;
890 D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ',
891 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
892 }
893 _res = NULL;
894 done:
895 D(p->level--);
896 return _res;
897}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000898
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100899// fstring: star_expressions
900static expr_ty
901fstring_rule(Parser *p)
902{
903 D(p->level++);
904 if (p->error_indicator) {
905 D(p->level--);
906 return NULL;
907 }
908 expr_ty _res = NULL;
909 int _mark = p->mark;
910 { // star_expressions
911 if (p->error_indicator) {
912 D(p->level--);
913 return NULL;
914 }
915 D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
916 expr_ty star_expressions_var;
917 if (
918 (star_expressions_var = star_expressions_rule(p)) // star_expressions
919 )
920 {
921 D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
922 _res = star_expressions_var;
923 goto done;
924 }
925 p->mark = _mark;
926 D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ',
927 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
928 }
929 _res = NULL;
930 done:
931 D(p->level--);
932 return _res;
933}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000934
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100935// type_expressions:
936// | ','.expression+ ',' '*' expression ',' '**' expression
937// | ','.expression+ ',' '*' expression
938// | ','.expression+ ',' '**' expression
939// | '*' expression ',' '**' expression
940// | '*' expression
941// | '**' expression
942// | ','.expression+
Pablo Galindoa5634c42020-09-16 19:42:00 +0100943static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100944type_expressions_rule(Parser *p)
945{
946 D(p->level++);
947 if (p->error_indicator) {
948 D(p->level--);
949 return NULL;
950 }
Pablo Galindoa5634c42020-09-16 19:42:00 +0100951 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100952 int _mark = p->mark;
953 { // ','.expression+ ',' '*' expression ',' '**' expression
954 if (p->error_indicator) {
955 D(p->level--);
956 return NULL;
957 }
958 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
959 Token * _literal;
960 Token * _literal_1;
961 Token * _literal_2;
962 Token * _literal_3;
963 asdl_seq * a;
964 expr_ty b;
965 expr_ty c;
966 if (
967 (a = _gather_3_rule(p)) // ','.expression+
968 &&
969 (_literal = _PyPegen_expect_token(p, 12)) // token=','
970 &&
971 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
972 &&
973 (b = expression_rule(p)) // expression
974 &&
975 (_literal_2 = _PyPegen_expect_token(p, 12)) // token=','
976 &&
977 (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**'
978 &&
979 (c = expression_rule(p)) // expression
980 )
981 {
982 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +0300983 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100984 if (_res == NULL && PyErr_Occurred()) {
985 p->error_indicator = 1;
986 D(p->level--);
987 return NULL;
988 }
989 goto done;
990 }
991 p->mark = _mark;
992 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
993 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
994 }
995 { // ','.expression+ ',' '*' expression
996 if (p->error_indicator) {
997 D(p->level--);
998 return NULL;
999 }
1000 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
1001 Token * _literal;
1002 Token * _literal_1;
1003 asdl_seq * a;
1004 expr_ty b;
1005 if (
1006 (a = _gather_5_rule(p)) // ','.expression+
1007 &&
1008 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1009 &&
1010 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
1011 &&
1012 (b = expression_rule(p)) // expression
1013 )
1014 {
1015 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001016 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001017 if (_res == NULL && PyErr_Occurred()) {
1018 p->error_indicator = 1;
1019 D(p->level--);
1020 return NULL;
1021 }
1022 goto done;
1023 }
1024 p->mark = _mark;
1025 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1026 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
1027 }
1028 { // ','.expression+ ',' '**' expression
1029 if (p->error_indicator) {
1030 D(p->level--);
1031 return NULL;
1032 }
1033 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
1034 Token * _literal;
1035 Token * _literal_1;
1036 asdl_seq * a;
1037 expr_ty b;
1038 if (
1039 (a = _gather_7_rule(p)) // ','.expression+
1040 &&
1041 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1042 &&
1043 (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**'
1044 &&
1045 (b = expression_rule(p)) // expression
1046 )
1047 {
1048 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001049 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001050 if (_res == NULL && PyErr_Occurred()) {
1051 p->error_indicator = 1;
1052 D(p->level--);
1053 return NULL;
1054 }
1055 goto done;
1056 }
1057 p->mark = _mark;
1058 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1059 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
1060 }
1061 { // '*' expression ',' '**' expression
1062 if (p->error_indicator) {
1063 D(p->level--);
1064 return NULL;
1065 }
1066 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
1067 Token * _literal;
1068 Token * _literal_1;
1069 Token * _literal_2;
1070 expr_ty a;
1071 expr_ty b;
1072 if (
1073 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1074 &&
1075 (a = expression_rule(p)) // expression
1076 &&
1077 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
1078 &&
1079 (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**'
1080 &&
1081 (b = expression_rule(p)) // expression
1082 )
1083 {
1084 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03001085 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_singleton_seq ( p , a ) ) , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001086 if (_res == NULL && PyErr_Occurred()) {
1087 p->error_indicator = 1;
1088 D(p->level--);
1089 return NULL;
1090 }
1091 goto done;
1092 }
1093 p->mark = _mark;
1094 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1095 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
1096 }
1097 { // '*' expression
1098 if (p->error_indicator) {
1099 D(p->level--);
1100 return NULL;
1101 }
1102 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
1103 Token * _literal;
1104 expr_ty a;
1105 if (
1106 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1107 &&
1108 (a = expression_rule(p)) // expression
1109 )
1110 {
1111 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001112 _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001113 if (_res == NULL && PyErr_Occurred()) {
1114 p->error_indicator = 1;
1115 D(p->level--);
1116 return NULL;
1117 }
1118 goto done;
1119 }
1120 p->mark = _mark;
1121 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1122 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
1123 }
1124 { // '**' expression
1125 if (p->error_indicator) {
1126 D(p->level--);
1127 return NULL;
1128 }
1129 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
1130 Token * _literal;
1131 expr_ty a;
1132 if (
1133 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
1134 &&
1135 (a = expression_rule(p)) // expression
1136 )
1137 {
1138 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001139 _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001140 if (_res == NULL && PyErr_Occurred()) {
1141 p->error_indicator = 1;
1142 D(p->level--);
1143 return NULL;
1144 }
1145 goto done;
1146 }
1147 p->mark = _mark;
1148 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1149 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
1150 }
1151 { // ','.expression+
1152 if (p->error_indicator) {
1153 D(p->level--);
1154 return NULL;
1155 }
1156 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001157 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001158 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01001159 (a = (asdl_expr_seq*)_gather_9_rule(p)) // ','.expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001160 )
1161 {
1162 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001163 _res = a;
1164 if (_res == NULL && PyErr_Occurred()) {
1165 p->error_indicator = 1;
1166 D(p->level--);
1167 return NULL;
1168 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001169 goto done;
1170 }
1171 p->mark = _mark;
1172 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1173 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
1174 }
1175 _res = NULL;
1176 done:
1177 D(p->level--);
1178 return _res;
1179}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001180
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001181// statements: statement+
Pablo Galindoa5634c42020-09-16 19:42:00 +01001182static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001183statements_rule(Parser *p)
1184{
1185 D(p->level++);
1186 if (p->error_indicator) {
1187 D(p->level--);
1188 return NULL;
1189 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001190 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001191 int _mark = p->mark;
1192 { // statement+
1193 if (p->error_indicator) {
1194 D(p->level--);
1195 return NULL;
1196 }
1197 D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
1198 asdl_seq * a;
1199 if (
1200 (a = _loop1_11_rule(p)) // statement+
1201 )
1202 {
1203 D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001204 _res = ( asdl_stmt_seq * ) _PyPegen_seq_flatten ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001205 if (_res == NULL && PyErr_Occurred()) {
1206 p->error_indicator = 1;
1207 D(p->level--);
1208 return NULL;
1209 }
1210 goto done;
1211 }
1212 p->mark = _mark;
1213 D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ',
1214 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+"));
1215 }
1216 _res = NULL;
1217 done:
1218 D(p->level--);
1219 return _res;
1220}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001221
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001222// statement: compound_stmt | simple_stmt
Pablo Galindoa5634c42020-09-16 19:42:00 +01001223static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001224statement_rule(Parser *p)
1225{
1226 D(p->level++);
1227 if (p->error_indicator) {
1228 D(p->level--);
1229 return NULL;
1230 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001231 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001232 int _mark = p->mark;
1233 { // compound_stmt
1234 if (p->error_indicator) {
1235 D(p->level--);
1236 return NULL;
1237 }
1238 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
1239 stmt_ty a;
1240 if (
1241 (a = compound_stmt_rule(p)) // compound_stmt
1242 )
1243 {
1244 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001245 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001246 if (_res == NULL && PyErr_Occurred()) {
1247 p->error_indicator = 1;
1248 D(p->level--);
1249 return NULL;
1250 }
1251 goto done;
1252 }
1253 p->mark = _mark;
1254 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1255 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt"));
1256 }
1257 { // simple_stmt
1258 if (p->error_indicator) {
1259 D(p->level--);
1260 return NULL;
1261 }
1262 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001263 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001264 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01001265 (a = (asdl_stmt_seq*)simple_stmt_rule(p)) // simple_stmt
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001266 )
1267 {
1268 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001269 _res = a;
1270 if (_res == NULL && PyErr_Occurred()) {
1271 p->error_indicator = 1;
1272 D(p->level--);
1273 return NULL;
1274 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001275 goto done;
1276 }
1277 p->mark = _mark;
1278 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1279 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1280 }
1281 _res = NULL;
1282 done:
1283 D(p->level--);
1284 return _res;
1285}
1286
1287// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
Pablo Galindoa5634c42020-09-16 19:42:00 +01001288static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001289statement_newline_rule(Parser *p)
1290{
1291 D(p->level++);
1292 if (p->error_indicator) {
1293 D(p->level--);
1294 return NULL;
1295 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001296 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001297 int _mark = p->mark;
1298 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1299 p->error_indicator = 1;
1300 D(p->level--);
1301 return NULL;
1302 }
1303 int _start_lineno = p->tokens[_mark]->lineno;
1304 UNUSED(_start_lineno); // Only used by EXTRA macro
1305 int _start_col_offset = p->tokens[_mark]->col_offset;
1306 UNUSED(_start_col_offset); // Only used by EXTRA macro
1307 { // compound_stmt NEWLINE
1308 if (p->error_indicator) {
1309 D(p->level--);
1310 return NULL;
1311 }
1312 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
1313 stmt_ty a;
1314 Token * newline_var;
1315 if (
1316 (a = compound_stmt_rule(p)) // compound_stmt
1317 &&
1318 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1319 )
1320 {
1321 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001322 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001323 if (_res == NULL && PyErr_Occurred()) {
1324 p->error_indicator = 1;
1325 D(p->level--);
1326 return NULL;
1327 }
1328 goto done;
1329 }
1330 p->mark = _mark;
1331 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1332 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE"));
1333 }
1334 { // simple_stmt
1335 if (p->error_indicator) {
1336 D(p->level--);
1337 return NULL;
1338 }
1339 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001340 asdl_stmt_seq* simple_stmt_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001341 if (
1342 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
1343 )
1344 {
1345 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1346 _res = simple_stmt_var;
1347 goto done;
1348 }
1349 p->mark = _mark;
1350 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1351 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1352 }
1353 { // NEWLINE
1354 if (p->error_indicator) {
1355 D(p->level--);
1356 return NULL;
1357 }
1358 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1359 Token * newline_var;
1360 if (
1361 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1362 )
1363 {
1364 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1365 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1366 if (_token == NULL) {
1367 D(p->level--);
1368 return NULL;
1369 }
1370 int _end_lineno = _token->end_lineno;
1371 UNUSED(_end_lineno); // Only used by EXTRA macro
1372 int _end_col_offset = _token->end_col_offset;
1373 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03001374 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , CHECK ( stmt_ty , _Py_Pass ( EXTRA ) ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001375 if (_res == NULL && PyErr_Occurred()) {
1376 p->error_indicator = 1;
1377 D(p->level--);
1378 return NULL;
1379 }
1380 goto done;
1381 }
1382 p->mark = _mark;
1383 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1384 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
1385 }
1386 { // $
1387 if (p->error_indicator) {
1388 D(p->level--);
1389 return NULL;
1390 }
1391 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$"));
1392 Token * endmarker_var;
1393 if (
1394 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
1395 )
1396 {
1397 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
1398 _res = _PyPegen_interactive_exit ( p );
1399 if (_res == NULL && PyErr_Occurred()) {
1400 p->error_indicator = 1;
1401 D(p->level--);
1402 return NULL;
1403 }
1404 goto done;
1405 }
1406 p->mark = _mark;
1407 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1408 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$"));
1409 }
1410 _res = NULL;
1411 done:
1412 D(p->level--);
1413 return _res;
1414}
1415
1416// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
Pablo Galindoa5634c42020-09-16 19:42:00 +01001417static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001418simple_stmt_rule(Parser *p)
1419{
1420 D(p->level++);
1421 if (p->error_indicator) {
1422 D(p->level--);
1423 return NULL;
1424 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001425 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001426 int _mark = p->mark;
1427 { // small_stmt !';' NEWLINE
1428 if (p->error_indicator) {
1429 D(p->level--);
1430 return NULL;
1431 }
1432 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
1433 stmt_ty a;
1434 Token * newline_var;
1435 if (
1436 (a = small_stmt_rule(p)) // small_stmt
1437 &&
1438 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';'
1439 &&
1440 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1441 )
1442 {
1443 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001444 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001445 if (_res == NULL && PyErr_Occurred()) {
1446 p->error_indicator = 1;
1447 D(p->level--);
1448 return NULL;
1449 }
1450 goto done;
1451 }
1452 p->mark = _mark;
1453 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1454 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt !';' NEWLINE"));
1455 }
1456 { // ';'.small_stmt+ ';'? NEWLINE
1457 if (p->error_indicator) {
1458 D(p->level--);
1459 return NULL;
1460 }
1461 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1462 void *_opt_var;
1463 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01001464 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001465 Token * newline_var;
1466 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01001467 (a = (asdl_stmt_seq*)_gather_12_rule(p)) // ';'.small_stmt+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001468 &&
1469 (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'?
1470 &&
1471 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1472 )
1473 {
1474 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1475 _res = a;
1476 if (_res == NULL && PyErr_Occurred()) {
1477 p->error_indicator = 1;
1478 D(p->level--);
1479 return NULL;
1480 }
1481 goto done;
1482 }
1483 p->mark = _mark;
1484 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1485 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1486 }
1487 _res = NULL;
1488 done:
1489 D(p->level--);
1490 return _res;
1491}
1492
1493// small_stmt:
1494// | assignment
1495// | star_expressions
1496// | &'return' return_stmt
1497// | &('import' | 'from') import_stmt
1498// | &'raise' raise_stmt
1499// | 'pass'
1500// | &'del' del_stmt
1501// | &'yield' yield_stmt
1502// | &'assert' assert_stmt
1503// | 'break'
1504// | 'continue'
1505// | &'global' global_stmt
1506// | &'nonlocal' nonlocal_stmt
1507static stmt_ty
1508small_stmt_rule(Parser *p)
1509{
1510 D(p->level++);
1511 if (p->error_indicator) {
1512 D(p->level--);
1513 return NULL;
1514 }
1515 stmt_ty _res = NULL;
1516 if (_PyPegen_is_memoized(p, small_stmt_type, &_res)) {
1517 D(p->level--);
1518 return _res;
1519 }
1520 int _mark = p->mark;
1521 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1522 p->error_indicator = 1;
1523 D(p->level--);
1524 return NULL;
1525 }
1526 int _start_lineno = p->tokens[_mark]->lineno;
1527 UNUSED(_start_lineno); // Only used by EXTRA macro
1528 int _start_col_offset = p->tokens[_mark]->col_offset;
1529 UNUSED(_start_col_offset); // Only used by EXTRA macro
1530 { // assignment
1531 if (p->error_indicator) {
1532 D(p->level--);
1533 return NULL;
1534 }
1535 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment"));
1536 stmt_ty assignment_var;
1537 if (
1538 (assignment_var = assignment_rule(p)) // assignment
1539 )
1540 {
1541 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment"));
1542 _res = assignment_var;
1543 goto done;
1544 }
1545 p->mark = _mark;
1546 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1547 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment"));
1548 }
1549 { // star_expressions
1550 if (p->error_indicator) {
1551 D(p->level--);
1552 return NULL;
1553 }
1554 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1555 expr_ty e;
1556 if (
1557 (e = star_expressions_rule(p)) // star_expressions
1558 )
1559 {
1560 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1561 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1562 if (_token == NULL) {
1563 D(p->level--);
1564 return NULL;
1565 }
1566 int _end_lineno = _token->end_lineno;
1567 UNUSED(_end_lineno); // Only used by EXTRA macro
1568 int _end_col_offset = _token->end_col_offset;
1569 UNUSED(_end_col_offset); // Only used by EXTRA macro
1570 _res = _Py_Expr ( e , EXTRA );
1571 if (_res == NULL && PyErr_Occurred()) {
1572 p->error_indicator = 1;
1573 D(p->level--);
1574 return NULL;
1575 }
1576 goto done;
1577 }
1578 p->mark = _mark;
1579 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1580 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
1581 }
1582 { // &'return' return_stmt
1583 if (p->error_indicator) {
1584 D(p->level--);
1585 return NULL;
1586 }
1587 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1588 stmt_ty return_stmt_var;
1589 if (
1590 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return'
1591 &&
1592 (return_stmt_var = return_stmt_rule(p)) // return_stmt
1593 )
1594 {
1595 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1596 _res = return_stmt_var;
1597 goto done;
1598 }
1599 p->mark = _mark;
1600 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1601 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt"));
1602 }
1603 { // &('import' | 'from') import_stmt
1604 if (p->error_indicator) {
1605 D(p->level--);
1606 return NULL;
1607 }
1608 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1609 stmt_ty import_stmt_var;
1610 if (
1611 _PyPegen_lookahead(1, _tmp_14_rule, p)
1612 &&
1613 (import_stmt_var = import_stmt_rule(p)) // import_stmt
1614 )
1615 {
1616 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1617 _res = import_stmt_var;
1618 goto done;
1619 }
1620 p->mark = _mark;
1621 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1622 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt"));
1623 }
1624 { // &'raise' raise_stmt
1625 if (p->error_indicator) {
1626 D(p->level--);
1627 return NULL;
1628 }
1629 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1630 stmt_ty raise_stmt_var;
1631 if (
1632 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise'
1633 &&
1634 (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt
1635 )
1636 {
1637 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1638 _res = raise_stmt_var;
1639 goto done;
1640 }
1641 p->mark = _mark;
1642 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1643 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt"));
1644 }
1645 { // 'pass'
1646 if (p->error_indicator) {
1647 D(p->level--);
1648 return NULL;
1649 }
1650 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'"));
1651 Token * _keyword;
1652 if (
1653 (_keyword = _PyPegen_expect_token(p, 502)) // token='pass'
1654 )
1655 {
1656 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'"));
1657 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1658 if (_token == NULL) {
1659 D(p->level--);
1660 return NULL;
1661 }
1662 int _end_lineno = _token->end_lineno;
1663 UNUSED(_end_lineno); // Only used by EXTRA macro
1664 int _end_col_offset = _token->end_col_offset;
1665 UNUSED(_end_col_offset); // Only used by EXTRA macro
1666 _res = _Py_Pass ( EXTRA );
1667 if (_res == NULL && PyErr_Occurred()) {
1668 p->error_indicator = 1;
1669 D(p->level--);
1670 return NULL;
1671 }
1672 goto done;
1673 }
1674 p->mark = _mark;
1675 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1676 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'"));
1677 }
1678 { // &'del' del_stmt
1679 if (p->error_indicator) {
1680 D(p->level--);
1681 return NULL;
1682 }
1683 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1684 stmt_ty del_stmt_var;
1685 if (
1686 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del'
1687 &&
1688 (del_stmt_var = del_stmt_rule(p)) // del_stmt
1689 )
1690 {
1691 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1692 _res = del_stmt_var;
1693 goto done;
1694 }
1695 p->mark = _mark;
1696 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1697 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt"));
1698 }
1699 { // &'yield' yield_stmt
1700 if (p->error_indicator) {
1701 D(p->level--);
1702 return NULL;
1703 }
1704 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1705 stmt_ty yield_stmt_var;
1706 if (
1707 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield'
1708 &&
1709 (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt
1710 )
1711 {
1712 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1713 _res = yield_stmt_var;
1714 goto done;
1715 }
1716 p->mark = _mark;
1717 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1718 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt"));
1719 }
1720 { // &'assert' assert_stmt
1721 if (p->error_indicator) {
1722 D(p->level--);
1723 return NULL;
1724 }
1725 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1726 stmt_ty assert_stmt_var;
1727 if (
1728 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert'
1729 &&
1730 (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt
1731 )
1732 {
1733 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1734 _res = assert_stmt_var;
1735 goto done;
1736 }
1737 p->mark = _mark;
1738 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1739 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt"));
1740 }
1741 { // 'break'
1742 if (p->error_indicator) {
1743 D(p->level--);
1744 return NULL;
1745 }
1746 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'"));
1747 Token * _keyword;
1748 if (
1749 (_keyword = _PyPegen_expect_token(p, 506)) // token='break'
1750 )
1751 {
1752 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'"));
1753 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1754 if (_token == NULL) {
1755 D(p->level--);
1756 return NULL;
1757 }
1758 int _end_lineno = _token->end_lineno;
1759 UNUSED(_end_lineno); // Only used by EXTRA macro
1760 int _end_col_offset = _token->end_col_offset;
1761 UNUSED(_end_col_offset); // Only used by EXTRA macro
1762 _res = _Py_Break ( EXTRA );
1763 if (_res == NULL && PyErr_Occurred()) {
1764 p->error_indicator = 1;
1765 D(p->level--);
1766 return NULL;
1767 }
1768 goto done;
1769 }
1770 p->mark = _mark;
1771 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1772 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'"));
1773 }
1774 { // 'continue'
1775 if (p->error_indicator) {
1776 D(p->level--);
1777 return NULL;
1778 }
1779 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'"));
1780 Token * _keyword;
1781 if (
1782 (_keyword = _PyPegen_expect_token(p, 507)) // token='continue'
1783 )
1784 {
1785 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'"));
1786 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1787 if (_token == NULL) {
1788 D(p->level--);
1789 return NULL;
1790 }
1791 int _end_lineno = _token->end_lineno;
1792 UNUSED(_end_lineno); // Only used by EXTRA macro
1793 int _end_col_offset = _token->end_col_offset;
1794 UNUSED(_end_col_offset); // Only used by EXTRA macro
1795 _res = _Py_Continue ( EXTRA );
1796 if (_res == NULL && PyErr_Occurred()) {
1797 p->error_indicator = 1;
1798 D(p->level--);
1799 return NULL;
1800 }
1801 goto done;
1802 }
1803 p->mark = _mark;
1804 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1805 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'"));
1806 }
1807 { // &'global' global_stmt
1808 if (p->error_indicator) {
1809 D(p->level--);
1810 return NULL;
1811 }
1812 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1813 stmt_ty global_stmt_var;
1814 if (
1815 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global'
1816 &&
1817 (global_stmt_var = global_stmt_rule(p)) // global_stmt
1818 )
1819 {
1820 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1821 _res = global_stmt_var;
1822 goto done;
1823 }
1824 p->mark = _mark;
1825 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1826 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt"));
1827 }
1828 { // &'nonlocal' nonlocal_stmt
1829 if (p->error_indicator) {
1830 D(p->level--);
1831 return NULL;
1832 }
1833 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1834 stmt_ty nonlocal_stmt_var;
1835 if (
1836 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal'
1837 &&
1838 (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt
1839 )
1840 {
1841 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1842 _res = nonlocal_stmt_var;
1843 goto done;
1844 }
1845 p->mark = _mark;
1846 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1847 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1848 }
1849 _res = NULL;
1850 done:
1851 _PyPegen_insert_memo(p, _mark, small_stmt_type, _res);
1852 D(p->level--);
1853 return _res;
1854}
1855
1856// compound_stmt:
1857// | &('def' | '@' | ASYNC) function_def
1858// | &'if' if_stmt
1859// | &('class' | '@') class_def
1860// | &('with' | ASYNC) with_stmt
1861// | &('for' | ASYNC) for_stmt
1862// | &'try' try_stmt
1863// | &'while' while_stmt
1864static stmt_ty
1865compound_stmt_rule(Parser *p)
1866{
1867 D(p->level++);
1868 if (p->error_indicator) {
1869 D(p->level--);
1870 return NULL;
1871 }
1872 stmt_ty _res = NULL;
1873 int _mark = p->mark;
1874 { // &('def' | '@' | ASYNC) function_def
1875 if (p->error_indicator) {
1876 D(p->level--);
1877 return NULL;
1878 }
1879 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1880 stmt_ty function_def_var;
1881 if (
1882 _PyPegen_lookahead(1, _tmp_15_rule, p)
1883 &&
1884 (function_def_var = function_def_rule(p)) // function_def
1885 )
1886 {
1887 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1888 _res = function_def_var;
1889 goto done;
1890 }
1891 p->mark = _mark;
1892 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1893 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1894 }
1895 { // &'if' if_stmt
1896 if (p->error_indicator) {
1897 D(p->level--);
1898 return NULL;
1899 }
1900 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1901 stmt_ty if_stmt_var;
1902 if (
1903 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if'
1904 &&
1905 (if_stmt_var = if_stmt_rule(p)) // if_stmt
1906 )
1907 {
1908 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1909 _res = if_stmt_var;
1910 goto done;
1911 }
1912 p->mark = _mark;
1913 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1914 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt"));
1915 }
1916 { // &('class' | '@') class_def
1917 if (p->error_indicator) {
1918 D(p->level--);
1919 return NULL;
1920 }
1921 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1922 stmt_ty class_def_var;
1923 if (
1924 _PyPegen_lookahead(1, _tmp_16_rule, p)
1925 &&
1926 (class_def_var = class_def_rule(p)) // class_def
1927 )
1928 {
1929 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1930 _res = class_def_var;
1931 goto done;
1932 }
1933 p->mark = _mark;
1934 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1935 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def"));
1936 }
1937 { // &('with' | ASYNC) with_stmt
1938 if (p->error_indicator) {
1939 D(p->level--);
1940 return NULL;
1941 }
1942 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1943 stmt_ty with_stmt_var;
1944 if (
1945 _PyPegen_lookahead(1, _tmp_17_rule, p)
1946 &&
1947 (with_stmt_var = with_stmt_rule(p)) // with_stmt
1948 )
1949 {
1950 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1951 _res = with_stmt_var;
1952 goto done;
1953 }
1954 p->mark = _mark;
1955 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1956 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1957 }
1958 { // &('for' | ASYNC) for_stmt
1959 if (p->error_indicator) {
1960 D(p->level--);
1961 return NULL;
1962 }
1963 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1964 stmt_ty for_stmt_var;
1965 if (
1966 _PyPegen_lookahead(1, _tmp_18_rule, p)
1967 &&
1968 (for_stmt_var = for_stmt_rule(p)) // for_stmt
1969 )
1970 {
1971 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1972 _res = for_stmt_var;
1973 goto done;
1974 }
1975 p->mark = _mark;
1976 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1977 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1978 }
1979 { // &'try' try_stmt
1980 if (p->error_indicator) {
1981 D(p->level--);
1982 return NULL;
1983 }
1984 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1985 stmt_ty try_stmt_var;
1986 if (
1987 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try'
1988 &&
1989 (try_stmt_var = try_stmt_rule(p)) // try_stmt
1990 )
1991 {
1992 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1993 _res = try_stmt_var;
1994 goto done;
1995 }
1996 p->mark = _mark;
1997 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1998 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt"));
1999 }
2000 { // &'while' while_stmt
2001 if (p->error_indicator) {
2002 D(p->level--);
2003 return NULL;
2004 }
2005 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
2006 stmt_ty while_stmt_var;
2007 if (
2008 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while'
2009 &&
2010 (while_stmt_var = while_stmt_rule(p)) // while_stmt
2011 )
2012 {
2013 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
2014 _res = while_stmt_var;
2015 goto done;
2016 }
2017 p->mark = _mark;
2018 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2019 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt"));
2020 }
2021 _res = NULL;
2022 done:
2023 D(p->level--);
2024 return _res;
2025}
2026
2027// assignment:
2028// | NAME ':' expression ['=' annotated_rhs]
2029// | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2030// | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002031// | single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002032// | invalid_assignment
2033static stmt_ty
2034assignment_rule(Parser *p)
2035{
2036 D(p->level++);
2037 if (p->error_indicator) {
2038 D(p->level--);
2039 return NULL;
2040 }
2041 stmt_ty _res = NULL;
2042 int _mark = p->mark;
2043 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2044 p->error_indicator = 1;
2045 D(p->level--);
2046 return NULL;
2047 }
2048 int _start_lineno = p->tokens[_mark]->lineno;
2049 UNUSED(_start_lineno); // Only used by EXTRA macro
2050 int _start_col_offset = p->tokens[_mark]->col_offset;
2051 UNUSED(_start_col_offset); // Only used by EXTRA macro
2052 { // NAME ':' expression ['=' annotated_rhs]
2053 if (p->error_indicator) {
2054 D(p->level--);
2055 return NULL;
2056 }
2057 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2058 Token * _literal;
2059 expr_ty a;
2060 expr_ty b;
2061 void *c;
2062 if (
2063 (a = _PyPegen_name_token(p)) // NAME
2064 &&
2065 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2066 &&
2067 (b = expression_rule(p)) // expression
2068 &&
2069 (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs]
2070 )
2071 {
2072 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2073 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2074 if (_token == NULL) {
2075 D(p->level--);
2076 return NULL;
2077 }
2078 int _end_lineno = _token->end_lineno;
2079 UNUSED(_end_lineno); // Only used by EXTRA macro
2080 int _end_col_offset = _token->end_col_offset;
2081 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002082 _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002083 if (_res == NULL && PyErr_Occurred()) {
2084 p->error_indicator = 1;
2085 D(p->level--);
2086 return NULL;
2087 }
2088 goto done;
2089 }
2090 p->mark = _mark;
2091 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2092 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2093 }
2094 { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2095 if (p->error_indicator) {
2096 D(p->level--);
2097 return NULL;
2098 }
2099 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2100 Token * _literal;
2101 void *a;
2102 expr_ty b;
2103 void *c;
2104 if (
2105 (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
2106 &&
2107 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2108 &&
2109 (b = expression_rule(p)) // expression
2110 &&
2111 (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs]
2112 )
2113 {
2114 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2115 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2116 if (_token == NULL) {
2117 D(p->level--);
2118 return NULL;
2119 }
2120 int _end_lineno = _token->end_lineno;
2121 UNUSED(_end_lineno); // Only used by EXTRA macro
2122 int _end_col_offset = _token->end_col_offset;
2123 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002124 _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002125 if (_res == NULL && PyErr_Occurred()) {
2126 p->error_indicator = 1;
2127 D(p->level--);
2128 return NULL;
2129 }
2130 goto done;
2131 }
2132 p->mark = _mark;
2133 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2134 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2135 }
2136 { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
2137 if (p->error_indicator) {
2138 D(p->level--);
2139 return NULL;
2140 }
2141 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01002142 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002143 void *b;
2144 void *tc;
2145 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01002146 (a = (asdl_expr_seq*)_loop1_22_rule(p)) // ((star_targets '='))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002147 &&
2148 (b = _tmp_23_rule(p)) // yield_expr | star_expressions
2149 &&
2150 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
2151 &&
2152 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
2153 )
2154 {
2155 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2156 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2157 if (_token == NULL) {
2158 D(p->level--);
2159 return NULL;
2160 }
2161 int _end_lineno = _token->end_lineno;
2162 UNUSED(_end_lineno); // Only used by EXTRA macro
2163 int _end_col_offset = _token->end_col_offset;
2164 UNUSED(_end_col_offset); // Only used by EXTRA macro
2165 _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
2166 if (_res == NULL && PyErr_Occurred()) {
2167 p->error_indicator = 1;
2168 D(p->level--);
2169 return NULL;
2170 }
2171 goto done;
2172 }
2173 p->mark = _mark;
2174 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2175 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2176 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002177 { // single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002178 if (p->error_indicator) {
2179 D(p->level--);
2180 return NULL;
2181 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002182 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2183 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002184 expr_ty a;
2185 AugOperator* b;
2186 void *c;
2187 if (
2188 (a = single_target_rule(p)) // single_target
2189 &&
2190 (b = augassign_rule(p)) // augassign
2191 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002192 (_cut_var = 1)
2193 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002194 (c = _tmp_24_rule(p)) // yield_expr | star_expressions
2195 )
2196 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002197 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002198 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2199 if (_token == NULL) {
2200 D(p->level--);
2201 return NULL;
2202 }
2203 int _end_lineno = _token->end_lineno;
2204 UNUSED(_end_lineno); // Only used by EXTRA macro
2205 int _end_col_offset = _token->end_col_offset;
2206 UNUSED(_end_col_offset); // Only used by EXTRA macro
2207 _res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
2208 if (_res == NULL && PyErr_Occurred()) {
2209 p->error_indicator = 1;
2210 D(p->level--);
2211 return NULL;
2212 }
2213 goto done;
2214 }
2215 p->mark = _mark;
2216 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002217 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2218 if (_cut_var) {
2219 D(p->level--);
2220 return NULL;
2221 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002222 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02002223 if (p->call_invalid_rules) { // invalid_assignment
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002224 if (p->error_indicator) {
2225 D(p->level--);
2226 return NULL;
2227 }
2228 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2229 void *invalid_assignment_var;
2230 if (
2231 (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment
2232 )
2233 {
2234 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2235 _res = invalid_assignment_var;
2236 goto done;
2237 }
2238 p->mark = _mark;
2239 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2240 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment"));
2241 }
2242 _res = NULL;
2243 done:
2244 D(p->level--);
2245 return _res;
2246}
2247
2248// augassign:
2249// | '+='
2250// | '-='
2251// | '*='
2252// | '@='
2253// | '/='
2254// | '%='
2255// | '&='
2256// | '|='
2257// | '^='
2258// | '<<='
2259// | '>>='
2260// | '**='
2261// | '//='
2262static AugOperator*
2263augassign_rule(Parser *p)
2264{
2265 D(p->level++);
2266 if (p->error_indicator) {
2267 D(p->level--);
2268 return NULL;
2269 }
2270 AugOperator* _res = NULL;
2271 int _mark = p->mark;
2272 { // '+='
2273 if (p->error_indicator) {
2274 D(p->level--);
2275 return NULL;
2276 }
2277 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='"));
2278 Token * _literal;
2279 if (
2280 (_literal = _PyPegen_expect_token(p, 36)) // token='+='
2281 )
2282 {
2283 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
2284 _res = _PyPegen_augoperator ( p , Add );
2285 if (_res == NULL && PyErr_Occurred()) {
2286 p->error_indicator = 1;
2287 D(p->level--);
2288 return NULL;
2289 }
2290 goto done;
2291 }
2292 p->mark = _mark;
2293 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2294 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='"));
2295 }
2296 { // '-='
2297 if (p->error_indicator) {
2298 D(p->level--);
2299 return NULL;
2300 }
2301 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='"));
2302 Token * _literal;
2303 if (
2304 (_literal = _PyPegen_expect_token(p, 37)) // token='-='
2305 )
2306 {
2307 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
2308 _res = _PyPegen_augoperator ( p , Sub );
2309 if (_res == NULL && PyErr_Occurred()) {
2310 p->error_indicator = 1;
2311 D(p->level--);
2312 return NULL;
2313 }
2314 goto done;
2315 }
2316 p->mark = _mark;
2317 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2318 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='"));
2319 }
2320 { // '*='
2321 if (p->error_indicator) {
2322 D(p->level--);
2323 return NULL;
2324 }
2325 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='"));
2326 Token * _literal;
2327 if (
2328 (_literal = _PyPegen_expect_token(p, 38)) // token='*='
2329 )
2330 {
2331 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
2332 _res = _PyPegen_augoperator ( p , Mult );
2333 if (_res == NULL && PyErr_Occurred()) {
2334 p->error_indicator = 1;
2335 D(p->level--);
2336 return NULL;
2337 }
2338 goto done;
2339 }
2340 p->mark = _mark;
2341 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2342 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='"));
2343 }
2344 { // '@='
2345 if (p->error_indicator) {
2346 D(p->level--);
2347 return NULL;
2348 }
2349 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='"));
2350 Token * _literal;
2351 if (
2352 (_literal = _PyPegen_expect_token(p, 50)) // token='@='
2353 )
2354 {
2355 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002356 _res = CHECK_VERSION ( AugOperator * , 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002357 if (_res == NULL && PyErr_Occurred()) {
2358 p->error_indicator = 1;
2359 D(p->level--);
2360 return NULL;
2361 }
2362 goto done;
2363 }
2364 p->mark = _mark;
2365 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2366 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='"));
2367 }
2368 { // '/='
2369 if (p->error_indicator) {
2370 D(p->level--);
2371 return NULL;
2372 }
2373 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='"));
2374 Token * _literal;
2375 if (
2376 (_literal = _PyPegen_expect_token(p, 39)) // token='/='
2377 )
2378 {
2379 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
2380 _res = _PyPegen_augoperator ( p , Div );
2381 if (_res == NULL && PyErr_Occurred()) {
2382 p->error_indicator = 1;
2383 D(p->level--);
2384 return NULL;
2385 }
2386 goto done;
2387 }
2388 p->mark = _mark;
2389 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2390 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='"));
2391 }
2392 { // '%='
2393 if (p->error_indicator) {
2394 D(p->level--);
2395 return NULL;
2396 }
2397 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='"));
2398 Token * _literal;
2399 if (
2400 (_literal = _PyPegen_expect_token(p, 40)) // token='%='
2401 )
2402 {
2403 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
2404 _res = _PyPegen_augoperator ( p , Mod );
2405 if (_res == NULL && PyErr_Occurred()) {
2406 p->error_indicator = 1;
2407 D(p->level--);
2408 return NULL;
2409 }
2410 goto done;
2411 }
2412 p->mark = _mark;
2413 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2414 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='"));
2415 }
2416 { // '&='
2417 if (p->error_indicator) {
2418 D(p->level--);
2419 return NULL;
2420 }
2421 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='"));
2422 Token * _literal;
2423 if (
2424 (_literal = _PyPegen_expect_token(p, 41)) // token='&='
2425 )
2426 {
2427 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
2428 _res = _PyPegen_augoperator ( p , BitAnd );
2429 if (_res == NULL && PyErr_Occurred()) {
2430 p->error_indicator = 1;
2431 D(p->level--);
2432 return NULL;
2433 }
2434 goto done;
2435 }
2436 p->mark = _mark;
2437 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2438 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='"));
2439 }
2440 { // '|='
2441 if (p->error_indicator) {
2442 D(p->level--);
2443 return NULL;
2444 }
2445 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='"));
2446 Token * _literal;
2447 if (
2448 (_literal = _PyPegen_expect_token(p, 42)) // token='|='
2449 )
2450 {
2451 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
2452 _res = _PyPegen_augoperator ( p , BitOr );
2453 if (_res == NULL && PyErr_Occurred()) {
2454 p->error_indicator = 1;
2455 D(p->level--);
2456 return NULL;
2457 }
2458 goto done;
2459 }
2460 p->mark = _mark;
2461 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2462 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='"));
2463 }
2464 { // '^='
2465 if (p->error_indicator) {
2466 D(p->level--);
2467 return NULL;
2468 }
2469 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='"));
2470 Token * _literal;
2471 if (
2472 (_literal = _PyPegen_expect_token(p, 43)) // token='^='
2473 )
2474 {
2475 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
2476 _res = _PyPegen_augoperator ( p , BitXor );
2477 if (_res == NULL && PyErr_Occurred()) {
2478 p->error_indicator = 1;
2479 D(p->level--);
2480 return NULL;
2481 }
2482 goto done;
2483 }
2484 p->mark = _mark;
2485 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2486 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='"));
2487 }
2488 { // '<<='
2489 if (p->error_indicator) {
2490 D(p->level--);
2491 return NULL;
2492 }
2493 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='"));
2494 Token * _literal;
2495 if (
2496 (_literal = _PyPegen_expect_token(p, 44)) // token='<<='
2497 )
2498 {
2499 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
2500 _res = _PyPegen_augoperator ( p , LShift );
2501 if (_res == NULL && PyErr_Occurred()) {
2502 p->error_indicator = 1;
2503 D(p->level--);
2504 return NULL;
2505 }
2506 goto done;
2507 }
2508 p->mark = _mark;
2509 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2510 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='"));
2511 }
2512 { // '>>='
2513 if (p->error_indicator) {
2514 D(p->level--);
2515 return NULL;
2516 }
2517 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='"));
2518 Token * _literal;
2519 if (
2520 (_literal = _PyPegen_expect_token(p, 45)) // token='>>='
2521 )
2522 {
2523 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
2524 _res = _PyPegen_augoperator ( p , RShift );
2525 if (_res == NULL && PyErr_Occurred()) {
2526 p->error_indicator = 1;
2527 D(p->level--);
2528 return NULL;
2529 }
2530 goto done;
2531 }
2532 p->mark = _mark;
2533 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2534 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='"));
2535 }
2536 { // '**='
2537 if (p->error_indicator) {
2538 D(p->level--);
2539 return NULL;
2540 }
2541 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='"));
2542 Token * _literal;
2543 if (
2544 (_literal = _PyPegen_expect_token(p, 46)) // token='**='
2545 )
2546 {
2547 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
2548 _res = _PyPegen_augoperator ( p , Pow );
2549 if (_res == NULL && PyErr_Occurred()) {
2550 p->error_indicator = 1;
2551 D(p->level--);
2552 return NULL;
2553 }
2554 goto done;
2555 }
2556 p->mark = _mark;
2557 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2558 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='"));
2559 }
2560 { // '//='
2561 if (p->error_indicator) {
2562 D(p->level--);
2563 return NULL;
2564 }
2565 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='"));
2566 Token * _literal;
2567 if (
2568 (_literal = _PyPegen_expect_token(p, 48)) // token='//='
2569 )
2570 {
2571 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
2572 _res = _PyPegen_augoperator ( p , FloorDiv );
2573 if (_res == NULL && PyErr_Occurred()) {
2574 p->error_indicator = 1;
2575 D(p->level--);
2576 return NULL;
2577 }
2578 goto done;
2579 }
2580 p->mark = _mark;
2581 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2582 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='"));
2583 }
2584 _res = NULL;
2585 done:
2586 D(p->level--);
2587 return _res;
2588}
2589
2590// global_stmt: 'global' ','.NAME+
2591static stmt_ty
2592global_stmt_rule(Parser *p)
2593{
2594 D(p->level++);
2595 if (p->error_indicator) {
2596 D(p->level--);
2597 return NULL;
2598 }
2599 stmt_ty _res = NULL;
2600 int _mark = p->mark;
2601 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2602 p->error_indicator = 1;
2603 D(p->level--);
2604 return NULL;
2605 }
2606 int _start_lineno = p->tokens[_mark]->lineno;
2607 UNUSED(_start_lineno); // Only used by EXTRA macro
2608 int _start_col_offset = p->tokens[_mark]->col_offset;
2609 UNUSED(_start_col_offset); // Only used by EXTRA macro
2610 { // 'global' ','.NAME+
2611 if (p->error_indicator) {
2612 D(p->level--);
2613 return NULL;
2614 }
2615 D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2616 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01002617 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002618 if (
2619 (_keyword = _PyPegen_expect_token(p, 508)) // token='global'
2620 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01002621 (a = (asdl_expr_seq*)_gather_25_rule(p)) // ','.NAME+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002622 )
2623 {
2624 D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2625 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2626 if (_token == NULL) {
2627 D(p->level--);
2628 return NULL;
2629 }
2630 int _end_lineno = _token->end_lineno;
2631 UNUSED(_end_lineno); // Only used by EXTRA macro
2632 int _end_col_offset = _token->end_col_offset;
2633 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002634 _res = _Py_Global ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002635 if (_res == NULL && PyErr_Occurred()) {
2636 p->error_indicator = 1;
2637 D(p->level--);
2638 return NULL;
2639 }
2640 goto done;
2641 }
2642 p->mark = _mark;
2643 D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2644 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
2645 }
2646 _res = NULL;
2647 done:
2648 D(p->level--);
2649 return _res;
2650}
2651
2652// nonlocal_stmt: 'nonlocal' ','.NAME+
2653static stmt_ty
2654nonlocal_stmt_rule(Parser *p)
2655{
2656 D(p->level++);
2657 if (p->error_indicator) {
2658 D(p->level--);
2659 return NULL;
2660 }
2661 stmt_ty _res = NULL;
2662 int _mark = p->mark;
2663 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2664 p->error_indicator = 1;
2665 D(p->level--);
2666 return NULL;
2667 }
2668 int _start_lineno = p->tokens[_mark]->lineno;
2669 UNUSED(_start_lineno); // Only used by EXTRA macro
2670 int _start_col_offset = p->tokens[_mark]->col_offset;
2671 UNUSED(_start_col_offset); // Only used by EXTRA macro
2672 { // 'nonlocal' ','.NAME+
2673 if (p->error_indicator) {
2674 D(p->level--);
2675 return NULL;
2676 }
2677 D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2678 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01002679 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002680 if (
2681 (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal'
2682 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01002683 (a = (asdl_expr_seq*)_gather_27_rule(p)) // ','.NAME+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002684 )
2685 {
2686 D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2687 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2688 if (_token == NULL) {
2689 D(p->level--);
2690 return NULL;
2691 }
2692 int _end_lineno = _token->end_lineno;
2693 UNUSED(_end_lineno); // Only used by EXTRA macro
2694 int _end_col_offset = _token->end_col_offset;
2695 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002696 _res = _Py_Nonlocal ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002697 if (_res == NULL && PyErr_Occurred()) {
2698 p->error_indicator = 1;
2699 D(p->level--);
2700 return NULL;
2701 }
2702 goto done;
2703 }
2704 p->mark = _mark;
2705 D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2706 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
2707 }
2708 _res = NULL;
2709 done:
2710 D(p->level--);
2711 return _res;
2712}
2713
2714// yield_stmt: yield_expr
2715static stmt_ty
2716yield_stmt_rule(Parser *p)
2717{
2718 D(p->level++);
2719 if (p->error_indicator) {
2720 D(p->level--);
2721 return NULL;
2722 }
2723 stmt_ty _res = NULL;
2724 int _mark = p->mark;
2725 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2726 p->error_indicator = 1;
2727 D(p->level--);
2728 return NULL;
2729 }
2730 int _start_lineno = p->tokens[_mark]->lineno;
2731 UNUSED(_start_lineno); // Only used by EXTRA macro
2732 int _start_col_offset = p->tokens[_mark]->col_offset;
2733 UNUSED(_start_col_offset); // Only used by EXTRA macro
2734 { // yield_expr
2735 if (p->error_indicator) {
2736 D(p->level--);
2737 return NULL;
2738 }
2739 D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2740 expr_ty y;
2741 if (
2742 (y = yield_expr_rule(p)) // yield_expr
2743 )
2744 {
2745 D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2746 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2747 if (_token == NULL) {
2748 D(p->level--);
2749 return NULL;
2750 }
2751 int _end_lineno = _token->end_lineno;
2752 UNUSED(_end_lineno); // Only used by EXTRA macro
2753 int _end_col_offset = _token->end_col_offset;
2754 UNUSED(_end_col_offset); // Only used by EXTRA macro
2755 _res = _Py_Expr ( y , EXTRA );
2756 if (_res == NULL && PyErr_Occurred()) {
2757 p->error_indicator = 1;
2758 D(p->level--);
2759 return NULL;
2760 }
2761 goto done;
2762 }
2763 p->mark = _mark;
2764 D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2765 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
2766 }
2767 _res = NULL;
2768 done:
2769 D(p->level--);
2770 return _res;
2771}
2772
2773// assert_stmt: 'assert' expression [',' expression]
2774static stmt_ty
2775assert_stmt_rule(Parser *p)
2776{
2777 D(p->level++);
2778 if (p->error_indicator) {
2779 D(p->level--);
2780 return NULL;
2781 }
2782 stmt_ty _res = NULL;
2783 int _mark = p->mark;
2784 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2785 p->error_indicator = 1;
2786 D(p->level--);
2787 return NULL;
2788 }
2789 int _start_lineno = p->tokens[_mark]->lineno;
2790 UNUSED(_start_lineno); // Only used by EXTRA macro
2791 int _start_col_offset = p->tokens[_mark]->col_offset;
2792 UNUSED(_start_col_offset); // Only used by EXTRA macro
2793 { // 'assert' expression [',' expression]
2794 if (p->error_indicator) {
2795 D(p->level--);
2796 return NULL;
2797 }
2798 D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2799 Token * _keyword;
2800 expr_ty a;
2801 void *b;
2802 if (
2803 (_keyword = _PyPegen_expect_token(p, 505)) // token='assert'
2804 &&
2805 (a = expression_rule(p)) // expression
2806 &&
2807 (b = _tmp_29_rule(p), 1) // [',' expression]
2808 )
2809 {
2810 D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2811 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2812 if (_token == NULL) {
2813 D(p->level--);
2814 return NULL;
2815 }
2816 int _end_lineno = _token->end_lineno;
2817 UNUSED(_end_lineno); // Only used by EXTRA macro
2818 int _end_col_offset = _token->end_col_offset;
2819 UNUSED(_end_col_offset); // Only used by EXTRA macro
2820 _res = _Py_Assert ( a , b , EXTRA );
2821 if (_res == NULL && PyErr_Occurred()) {
2822 p->error_indicator = 1;
2823 D(p->level--);
2824 return NULL;
2825 }
2826 goto done;
2827 }
2828 p->mark = _mark;
2829 D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2830 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
2831 }
2832 _res = NULL;
2833 done:
2834 D(p->level--);
2835 return _res;
2836}
2837
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002838// del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002839static stmt_ty
2840del_stmt_rule(Parser *p)
2841{
2842 D(p->level++);
2843 if (p->error_indicator) {
2844 D(p->level--);
2845 return NULL;
2846 }
2847 stmt_ty _res = NULL;
2848 int _mark = p->mark;
2849 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2850 p->error_indicator = 1;
2851 D(p->level--);
2852 return NULL;
2853 }
2854 int _start_lineno = p->tokens[_mark]->lineno;
2855 UNUSED(_start_lineno); // Only used by EXTRA macro
2856 int _start_col_offset = p->tokens[_mark]->col_offset;
2857 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002858 { // 'del' del_targets &(';' | NEWLINE)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002859 if (p->error_indicator) {
2860 D(p->level--);
2861 return NULL;
2862 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002863 D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002864 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01002865 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002866 if (
2867 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
2868 &&
2869 (a = del_targets_rule(p)) // del_targets
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002870 &&
2871 _PyPegen_lookahead(1, _tmp_30_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002872 )
2873 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002874 D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002875 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2876 if (_token == NULL) {
2877 D(p->level--);
2878 return NULL;
2879 }
2880 int _end_lineno = _token->end_lineno;
2881 UNUSED(_end_lineno); // Only used by EXTRA macro
2882 int _end_col_offset = _token->end_col_offset;
2883 UNUSED(_end_col_offset); // Only used by EXTRA macro
2884 _res = _Py_Delete ( a , EXTRA );
2885 if (_res == NULL && PyErr_Occurred()) {
2886 p->error_indicator = 1;
2887 D(p->level--);
2888 return NULL;
2889 }
2890 goto done;
2891 }
2892 p->mark = _mark;
2893 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002894 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
2895 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02002896 if (p->call_invalid_rules) { // invalid_del_stmt
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002897 if (p->error_indicator) {
2898 D(p->level--);
2899 return NULL;
2900 }
2901 D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2902 void *invalid_del_stmt_var;
2903 if (
2904 (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt
2905 )
2906 {
2907 D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2908 _res = invalid_del_stmt_var;
2909 goto done;
2910 }
2911 p->mark = _mark;
2912 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2913 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002914 }
2915 _res = NULL;
2916 done:
2917 D(p->level--);
2918 return _res;
2919}
2920
2921// import_stmt: import_name | import_from
2922static stmt_ty
2923import_stmt_rule(Parser *p)
2924{
2925 D(p->level++);
2926 if (p->error_indicator) {
2927 D(p->level--);
2928 return NULL;
2929 }
2930 stmt_ty _res = NULL;
2931 int _mark = p->mark;
2932 { // import_name
2933 if (p->error_indicator) {
2934 D(p->level--);
2935 return NULL;
2936 }
2937 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name"));
2938 stmt_ty import_name_var;
2939 if (
2940 (import_name_var = import_name_rule(p)) // import_name
2941 )
2942 {
2943 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name"));
2944 _res = import_name_var;
2945 goto done;
2946 }
2947 p->mark = _mark;
2948 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2949 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name"));
2950 }
2951 { // import_from
2952 if (p->error_indicator) {
2953 D(p->level--);
2954 return NULL;
2955 }
2956 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from"));
2957 stmt_ty import_from_var;
2958 if (
2959 (import_from_var = import_from_rule(p)) // import_from
2960 )
2961 {
2962 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from"));
2963 _res = import_from_var;
2964 goto done;
2965 }
2966 p->mark = _mark;
2967 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2968 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from"));
2969 }
2970 _res = NULL;
2971 done:
2972 D(p->level--);
2973 return _res;
2974}
2975
2976// import_name: 'import' dotted_as_names
2977static stmt_ty
2978import_name_rule(Parser *p)
2979{
2980 D(p->level++);
2981 if (p->error_indicator) {
2982 D(p->level--);
2983 return NULL;
2984 }
2985 stmt_ty _res = NULL;
2986 int _mark = p->mark;
2987 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2988 p->error_indicator = 1;
2989 D(p->level--);
2990 return NULL;
2991 }
2992 int _start_lineno = p->tokens[_mark]->lineno;
2993 UNUSED(_start_lineno); // Only used by EXTRA macro
2994 int _start_col_offset = p->tokens[_mark]->col_offset;
2995 UNUSED(_start_col_offset); // Only used by EXTRA macro
2996 { // 'import' dotted_as_names
2997 if (p->error_indicator) {
2998 D(p->level--);
2999 return NULL;
3000 }
3001 D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
3002 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003003 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003004 if (
3005 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
3006 &&
3007 (a = dotted_as_names_rule(p)) // dotted_as_names
3008 )
3009 {
3010 D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
3011 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3012 if (_token == NULL) {
3013 D(p->level--);
3014 return NULL;
3015 }
3016 int _end_lineno = _token->end_lineno;
3017 UNUSED(_end_lineno); // Only used by EXTRA macro
3018 int _end_col_offset = _token->end_col_offset;
3019 UNUSED(_end_col_offset); // Only used by EXTRA macro
3020 _res = _Py_Import ( a , EXTRA );
3021 if (_res == NULL && PyErr_Occurred()) {
3022 p->error_indicator = 1;
3023 D(p->level--);
3024 return NULL;
3025 }
3026 goto done;
3027 }
3028 p->mark = _mark;
3029 D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ',
3030 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names"));
3031 }
3032 _res = NULL;
3033 done:
3034 D(p->level--);
3035 return _res;
3036}
3037
3038// import_from:
3039// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3040// | 'from' (('.' | '...'))+ 'import' import_from_targets
3041static stmt_ty
3042import_from_rule(Parser *p)
3043{
3044 D(p->level++);
3045 if (p->error_indicator) {
3046 D(p->level--);
3047 return NULL;
3048 }
3049 stmt_ty _res = NULL;
3050 int _mark = p->mark;
3051 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3052 p->error_indicator = 1;
3053 D(p->level--);
3054 return NULL;
3055 }
3056 int _start_lineno = p->tokens[_mark]->lineno;
3057 UNUSED(_start_lineno); // Only used by EXTRA macro
3058 int _start_col_offset = p->tokens[_mark]->col_offset;
3059 UNUSED(_start_col_offset); // Only used by EXTRA macro
3060 { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3061 if (p->error_indicator) {
3062 D(p->level--);
3063 return NULL;
3064 }
3065 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3066 Token * _keyword;
3067 Token * _keyword_1;
3068 asdl_seq * a;
3069 expr_ty b;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003070 asdl_alias_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003071 if (
3072 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3073 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003074 (a = _loop0_31_rule(p)) // (('.' | '...'))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003075 &&
3076 (b = dotted_name_rule(p)) // dotted_name
3077 &&
3078 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3079 &&
3080 (c = import_from_targets_rule(p)) // import_from_targets
3081 )
3082 {
3083 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3084 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3085 if (_token == NULL) {
3086 D(p->level--);
3087 return NULL;
3088 }
3089 int _end_lineno = _token->end_lineno;
3090 UNUSED(_end_lineno); // Only used by EXTRA macro
3091 int _end_col_offset = _token->end_col_offset;
3092 UNUSED(_end_col_offset); // Only used by EXTRA macro
3093 _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
3094 if (_res == NULL && PyErr_Occurred()) {
3095 p->error_indicator = 1;
3096 D(p->level--);
3097 return NULL;
3098 }
3099 goto done;
3100 }
3101 p->mark = _mark;
3102 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3103 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3104 }
3105 { // 'from' (('.' | '...'))+ 'import' import_from_targets
3106 if (p->error_indicator) {
3107 D(p->level--);
3108 return NULL;
3109 }
3110 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3111 Token * _keyword;
3112 Token * _keyword_1;
3113 asdl_seq * a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003114 asdl_alias_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003115 if (
3116 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3117 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003118 (a = _loop1_32_rule(p)) // (('.' | '...'))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003119 &&
3120 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3121 &&
3122 (b = import_from_targets_rule(p)) // import_from_targets
3123 )
3124 {
3125 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3126 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3127 if (_token == NULL) {
3128 D(p->level--);
3129 return NULL;
3130 }
3131 int _end_lineno = _token->end_lineno;
3132 UNUSED(_end_lineno); // Only used by EXTRA macro
3133 int _end_col_offset = _token->end_col_offset;
3134 UNUSED(_end_col_offset); // Only used by EXTRA macro
3135 _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
3136 if (_res == NULL && PyErr_Occurred()) {
3137 p->error_indicator = 1;
3138 D(p->level--);
3139 return NULL;
3140 }
3141 goto done;
3142 }
3143 p->mark = _mark;
3144 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3145 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3146 }
3147 _res = NULL;
3148 done:
3149 D(p->level--);
3150 return _res;
3151}
3152
3153// import_from_targets:
3154// | '(' import_from_as_names ','? ')'
3155// | import_from_as_names !','
3156// | '*'
3157// | invalid_import_from_targets
Pablo Galindoa5634c42020-09-16 19:42:00 +01003158static asdl_alias_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003159import_from_targets_rule(Parser *p)
3160{
3161 D(p->level++);
3162 if (p->error_indicator) {
3163 D(p->level--);
3164 return NULL;
3165 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003166 asdl_alias_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003167 int _mark = p->mark;
3168 { // '(' import_from_as_names ','? ')'
3169 if (p->error_indicator) {
3170 D(p->level--);
3171 return NULL;
3172 }
3173 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3174 Token * _literal;
3175 Token * _literal_1;
3176 void *_opt_var;
3177 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01003178 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003179 if (
3180 (_literal = _PyPegen_expect_token(p, 7)) // token='('
3181 &&
3182 (a = import_from_as_names_rule(p)) // import_from_as_names
3183 &&
3184 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
3185 &&
3186 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
3187 )
3188 {
3189 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3190 _res = a;
3191 if (_res == NULL && PyErr_Occurred()) {
3192 p->error_indicator = 1;
3193 D(p->level--);
3194 return NULL;
3195 }
3196 goto done;
3197 }
3198 p->mark = _mark;
3199 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3200 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3201 }
3202 { // import_from_as_names !','
3203 if (p->error_indicator) {
3204 D(p->level--);
3205 return NULL;
3206 }
3207 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01003208 asdl_alias_seq* import_from_as_names_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003209 if (
3210 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
3211 &&
3212 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
3213 )
3214 {
3215 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
3216 _res = import_from_as_names_var;
3217 goto done;
3218 }
3219 p->mark = _mark;
3220 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3221 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','"));
3222 }
3223 { // '*'
3224 if (p->error_indicator) {
3225 D(p->level--);
3226 return NULL;
3227 }
3228 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
3229 Token * _literal;
3230 if (
3231 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
3232 )
3233 {
3234 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03003235 _res = ( asdl_alias_seq * ) _PyPegen_singleton_seq ( p , CHECK ( alias_ty , _PyPegen_alias_for_star ( p ) ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003236 if (_res == NULL && PyErr_Occurred()) {
3237 p->error_indicator = 1;
3238 D(p->level--);
3239 return NULL;
3240 }
3241 goto done;
3242 }
3243 p->mark = _mark;
3244 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3245 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
3246 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02003247 if (p->call_invalid_rules) { // invalid_import_from_targets
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003248 if (p->error_indicator) {
3249 D(p->level--);
3250 return NULL;
3251 }
3252 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3253 void *invalid_import_from_targets_var;
3254 if (
3255 (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets
3256 )
3257 {
3258 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3259 _res = invalid_import_from_targets_var;
3260 goto done;
3261 }
3262 p->mark = _mark;
3263 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3264 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets"));
3265 }
3266 _res = NULL;
3267 done:
3268 D(p->level--);
3269 return _res;
3270}
3271
3272// import_from_as_names: ','.import_from_as_name+
Pablo Galindoa5634c42020-09-16 19:42:00 +01003273static asdl_alias_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003274import_from_as_names_rule(Parser *p)
3275{
3276 D(p->level++);
3277 if (p->error_indicator) {
3278 D(p->level--);
3279 return NULL;
3280 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003281 asdl_alias_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003282 int _mark = p->mark;
3283 { // ','.import_from_as_name+
3284 if (p->error_indicator) {
3285 D(p->level--);
3286 return NULL;
3287 }
3288 D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01003289 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003290 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01003291 (a = (asdl_alias_seq*)_gather_33_rule(p)) // ','.import_from_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003292 )
3293 {
3294 D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
3295 _res = a;
3296 if (_res == NULL && PyErr_Occurred()) {
3297 p->error_indicator = 1;
3298 D(p->level--);
3299 return NULL;
3300 }
3301 goto done;
3302 }
3303 p->mark = _mark;
3304 D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3305 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+"));
3306 }
3307 _res = NULL;
3308 done:
3309 D(p->level--);
3310 return _res;
3311}
3312
3313// import_from_as_name: NAME ['as' NAME]
3314static alias_ty
3315import_from_as_name_rule(Parser *p)
3316{
3317 D(p->level++);
3318 if (p->error_indicator) {
3319 D(p->level--);
3320 return NULL;
3321 }
3322 alias_ty _res = NULL;
3323 int _mark = p->mark;
3324 { // NAME ['as' NAME]
3325 if (p->error_indicator) {
3326 D(p->level--);
3327 return NULL;
3328 }
3329 D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3330 expr_ty a;
3331 void *b;
3332 if (
3333 (a = _PyPegen_name_token(p)) // NAME
3334 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003335 (b = _tmp_35_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003336 )
3337 {
3338 D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3339 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3340 if (_res == NULL && PyErr_Occurred()) {
3341 p->error_indicator = 1;
3342 D(p->level--);
3343 return NULL;
3344 }
3345 goto done;
3346 }
3347 p->mark = _mark;
3348 D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3349 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]"));
3350 }
3351 _res = NULL;
3352 done:
3353 D(p->level--);
3354 return _res;
3355}
3356
3357// dotted_as_names: ','.dotted_as_name+
Pablo Galindoa5634c42020-09-16 19:42:00 +01003358static asdl_alias_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003359dotted_as_names_rule(Parser *p)
3360{
3361 D(p->level++);
3362 if (p->error_indicator) {
3363 D(p->level--);
3364 return NULL;
3365 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003366 asdl_alias_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003367 int _mark = p->mark;
3368 { // ','.dotted_as_name+
3369 if (p->error_indicator) {
3370 D(p->level--);
3371 return NULL;
3372 }
3373 D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01003374 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003375 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01003376 (a = (asdl_alias_seq*)_gather_36_rule(p)) // ','.dotted_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003377 )
3378 {
3379 D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
3380 _res = a;
3381 if (_res == NULL && PyErr_Occurred()) {
3382 p->error_indicator = 1;
3383 D(p->level--);
3384 return NULL;
3385 }
3386 goto done;
3387 }
3388 p->mark = _mark;
3389 D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3390 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+"));
3391 }
3392 _res = NULL;
3393 done:
3394 D(p->level--);
3395 return _res;
3396}
3397
3398// dotted_as_name: dotted_name ['as' NAME]
3399static alias_ty
3400dotted_as_name_rule(Parser *p)
3401{
3402 D(p->level++);
3403 if (p->error_indicator) {
3404 D(p->level--);
3405 return NULL;
3406 }
3407 alias_ty _res = NULL;
3408 int _mark = p->mark;
3409 { // dotted_name ['as' NAME]
3410 if (p->error_indicator) {
3411 D(p->level--);
3412 return NULL;
3413 }
3414 D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3415 expr_ty a;
3416 void *b;
3417 if (
3418 (a = dotted_name_rule(p)) // dotted_name
3419 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003420 (b = _tmp_38_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003421 )
3422 {
3423 D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3424 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3425 if (_res == NULL && PyErr_Occurred()) {
3426 p->error_indicator = 1;
3427 D(p->level--);
3428 return NULL;
3429 }
3430 goto done;
3431 }
3432 p->mark = _mark;
3433 D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3434 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]"));
3435 }
3436 _res = NULL;
3437 done:
3438 D(p->level--);
3439 return _res;
3440}
3441
3442// Left-recursive
3443// dotted_name: dotted_name '.' NAME | NAME
3444static expr_ty dotted_name_raw(Parser *);
3445static expr_ty
3446dotted_name_rule(Parser *p)
3447{
3448 D(p->level++);
3449 expr_ty _res = NULL;
3450 if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) {
3451 D(p->level--);
3452 return _res;
3453 }
3454 int _mark = p->mark;
3455 int _resmark = p->mark;
3456 while (1) {
3457 int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res);
3458 if (tmpvar_0) {
3459 D(p->level--);
3460 return _res;
3461 }
3462 p->mark = _mark;
3463 void *_raw = dotted_name_raw(p);
3464 if (_raw == NULL || p->mark <= _resmark)
3465 break;
3466 _resmark = p->mark;
3467 _res = _raw;
3468 }
3469 p->mark = _resmark;
3470 D(p->level--);
3471 return _res;
3472}
3473static expr_ty
3474dotted_name_raw(Parser *p)
3475{
3476 D(p->level++);
3477 if (p->error_indicator) {
3478 D(p->level--);
3479 return NULL;
3480 }
3481 expr_ty _res = NULL;
3482 int _mark = p->mark;
3483 { // dotted_name '.' NAME
3484 if (p->error_indicator) {
3485 D(p->level--);
3486 return NULL;
3487 }
3488 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3489 Token * _literal;
3490 expr_ty a;
3491 expr_ty b;
3492 if (
3493 (a = dotted_name_rule(p)) // dotted_name
3494 &&
3495 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
3496 &&
3497 (b = _PyPegen_name_token(p)) // NAME
3498 )
3499 {
3500 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3501 _res = _PyPegen_join_names_with_dot ( p , a , b );
3502 if (_res == NULL && PyErr_Occurred()) {
3503 p->error_indicator = 1;
3504 D(p->level--);
3505 return NULL;
3506 }
3507 goto done;
3508 }
3509 p->mark = _mark;
3510 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3511 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME"));
3512 }
3513 { // NAME
3514 if (p->error_indicator) {
3515 D(p->level--);
3516 return NULL;
3517 }
3518 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
3519 expr_ty name_var;
3520 if (
3521 (name_var = _PyPegen_name_token(p)) // NAME
3522 )
3523 {
3524 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
3525 _res = name_var;
3526 goto done;
3527 }
3528 p->mark = _mark;
3529 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3530 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
3531 }
3532 _res = NULL;
3533 done:
3534 D(p->level--);
3535 return _res;
3536}
3537
3538// if_stmt:
3539// | 'if' named_expression ':' block elif_stmt
3540// | 'if' named_expression ':' block else_block?
3541static stmt_ty
3542if_stmt_rule(Parser *p)
3543{
3544 D(p->level++);
3545 if (p->error_indicator) {
3546 D(p->level--);
3547 return NULL;
3548 }
3549 stmt_ty _res = NULL;
3550 int _mark = p->mark;
3551 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3552 p->error_indicator = 1;
3553 D(p->level--);
3554 return NULL;
3555 }
3556 int _start_lineno = p->tokens[_mark]->lineno;
3557 UNUSED(_start_lineno); // Only used by EXTRA macro
3558 int _start_col_offset = p->tokens[_mark]->col_offset;
3559 UNUSED(_start_col_offset); // Only used by EXTRA macro
3560 { // 'if' named_expression ':' block elif_stmt
3561 if (p->error_indicator) {
3562 D(p->level--);
3563 return NULL;
3564 }
3565 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3566 Token * _keyword;
3567 Token * _literal;
3568 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003569 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003570 stmt_ty c;
3571 if (
3572 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3573 &&
3574 (a = named_expression_rule(p)) // named_expression
3575 &&
3576 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3577 &&
3578 (b = block_rule(p)) // block
3579 &&
3580 (c = elif_stmt_rule(p)) // elif_stmt
3581 )
3582 {
3583 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3584 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3585 if (_token == NULL) {
3586 D(p->level--);
3587 return NULL;
3588 }
3589 int _end_lineno = _token->end_lineno;
3590 UNUSED(_end_lineno); // Only used by EXTRA macro
3591 int _end_col_offset = _token->end_col_offset;
3592 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03003593 _res = _Py_If ( a , b , CHECK ( asdl_stmt_seq * , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003594 if (_res == NULL && PyErr_Occurred()) {
3595 p->error_indicator = 1;
3596 D(p->level--);
3597 return NULL;
3598 }
3599 goto done;
3600 }
3601 p->mark = _mark;
3602 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3603 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3604 }
3605 { // 'if' named_expression ':' block else_block?
3606 if (p->error_indicator) {
3607 D(p->level--);
3608 return NULL;
3609 }
3610 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3611 Token * _keyword;
3612 Token * _literal;
3613 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003614 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003615 void *c;
3616 if (
3617 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3618 &&
3619 (a = named_expression_rule(p)) // named_expression
3620 &&
3621 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3622 &&
3623 (b = block_rule(p)) // block
3624 &&
3625 (c = else_block_rule(p), 1) // else_block?
3626 )
3627 {
3628 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3629 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3630 if (_token == NULL) {
3631 D(p->level--);
3632 return NULL;
3633 }
3634 int _end_lineno = _token->end_lineno;
3635 UNUSED(_end_lineno); // Only used by EXTRA macro
3636 int _end_col_offset = _token->end_col_offset;
3637 UNUSED(_end_col_offset); // Only used by EXTRA macro
3638 _res = _Py_If ( a , b , c , EXTRA );
3639 if (_res == NULL && PyErr_Occurred()) {
3640 p->error_indicator = 1;
3641 D(p->level--);
3642 return NULL;
3643 }
3644 goto done;
3645 }
3646 p->mark = _mark;
3647 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3648 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?"));
3649 }
3650 _res = NULL;
3651 done:
3652 D(p->level--);
3653 return _res;
3654}
3655
3656// elif_stmt:
3657// | 'elif' named_expression ':' block elif_stmt
3658// | 'elif' named_expression ':' block else_block?
3659static stmt_ty
3660elif_stmt_rule(Parser *p)
3661{
3662 D(p->level++);
3663 if (p->error_indicator) {
3664 D(p->level--);
3665 return NULL;
3666 }
3667 stmt_ty _res = NULL;
3668 int _mark = p->mark;
3669 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3670 p->error_indicator = 1;
3671 D(p->level--);
3672 return NULL;
3673 }
3674 int _start_lineno = p->tokens[_mark]->lineno;
3675 UNUSED(_start_lineno); // Only used by EXTRA macro
3676 int _start_col_offset = p->tokens[_mark]->col_offset;
3677 UNUSED(_start_col_offset); // Only used by EXTRA macro
3678 { // 'elif' named_expression ':' block elif_stmt
3679 if (p->error_indicator) {
3680 D(p->level--);
3681 return NULL;
3682 }
3683 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3684 Token * _keyword;
3685 Token * _literal;
3686 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003687 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003688 stmt_ty c;
3689 if (
3690 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3691 &&
3692 (a = named_expression_rule(p)) // named_expression
3693 &&
3694 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3695 &&
3696 (b = block_rule(p)) // block
3697 &&
3698 (c = elif_stmt_rule(p)) // elif_stmt
3699 )
3700 {
3701 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3702 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3703 if (_token == NULL) {
3704 D(p->level--);
3705 return NULL;
3706 }
3707 int _end_lineno = _token->end_lineno;
3708 UNUSED(_end_lineno); // Only used by EXTRA macro
3709 int _end_col_offset = _token->end_col_offset;
3710 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03003711 _res = _Py_If ( a , b , CHECK ( asdl_stmt_seq * , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003712 if (_res == NULL && PyErr_Occurred()) {
3713 p->error_indicator = 1;
3714 D(p->level--);
3715 return NULL;
3716 }
3717 goto done;
3718 }
3719 p->mark = _mark;
3720 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3721 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3722 }
3723 { // 'elif' named_expression ':' block else_block?
3724 if (p->error_indicator) {
3725 D(p->level--);
3726 return NULL;
3727 }
3728 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3729 Token * _keyword;
3730 Token * _literal;
3731 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003732 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003733 void *c;
3734 if (
3735 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3736 &&
3737 (a = named_expression_rule(p)) // named_expression
3738 &&
3739 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3740 &&
3741 (b = block_rule(p)) // block
3742 &&
3743 (c = else_block_rule(p), 1) // else_block?
3744 )
3745 {
3746 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3747 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3748 if (_token == NULL) {
3749 D(p->level--);
3750 return NULL;
3751 }
3752 int _end_lineno = _token->end_lineno;
3753 UNUSED(_end_lineno); // Only used by EXTRA macro
3754 int _end_col_offset = _token->end_col_offset;
3755 UNUSED(_end_col_offset); // Only used by EXTRA macro
3756 _res = _Py_If ( a , b , c , EXTRA );
3757 if (_res == NULL && PyErr_Occurred()) {
3758 p->error_indicator = 1;
3759 D(p->level--);
3760 return NULL;
3761 }
3762 goto done;
3763 }
3764 p->mark = _mark;
3765 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3766 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3767 }
3768 _res = NULL;
3769 done:
3770 D(p->level--);
3771 return _res;
3772}
3773
3774// else_block: 'else' ':' block
Pablo Galindoa5634c42020-09-16 19:42:00 +01003775static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003776else_block_rule(Parser *p)
3777{
3778 D(p->level++);
3779 if (p->error_indicator) {
3780 D(p->level--);
3781 return NULL;
3782 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003783 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003784 int _mark = p->mark;
3785 { // 'else' ':' block
3786 if (p->error_indicator) {
3787 D(p->level--);
3788 return NULL;
3789 }
3790 D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3791 Token * _keyword;
3792 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003793 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003794 if (
3795 (_keyword = _PyPegen_expect_token(p, 516)) // token='else'
3796 &&
3797 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3798 &&
3799 (b = block_rule(p)) // block
3800 )
3801 {
3802 D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3803 _res = b;
3804 if (_res == NULL && PyErr_Occurred()) {
3805 p->error_indicator = 1;
3806 D(p->level--);
3807 return NULL;
3808 }
3809 goto done;
3810 }
3811 p->mark = _mark;
3812 D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
3813 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block"));
3814 }
3815 _res = NULL;
3816 done:
3817 D(p->level--);
3818 return _res;
3819}
3820
3821// while_stmt: 'while' named_expression ':' block else_block?
3822static stmt_ty
3823while_stmt_rule(Parser *p)
3824{
3825 D(p->level++);
3826 if (p->error_indicator) {
3827 D(p->level--);
3828 return NULL;
3829 }
3830 stmt_ty _res = NULL;
3831 int _mark = p->mark;
3832 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3833 p->error_indicator = 1;
3834 D(p->level--);
3835 return NULL;
3836 }
3837 int _start_lineno = p->tokens[_mark]->lineno;
3838 UNUSED(_start_lineno); // Only used by EXTRA macro
3839 int _start_col_offset = p->tokens[_mark]->col_offset;
3840 UNUSED(_start_col_offset); // Only used by EXTRA macro
3841 { // 'while' named_expression ':' block else_block?
3842 if (p->error_indicator) {
3843 D(p->level--);
3844 return NULL;
3845 }
3846 D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3847 Token * _keyword;
3848 Token * _literal;
3849 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003850 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003851 void *c;
3852 if (
3853 (_keyword = _PyPegen_expect_token(p, 512)) // token='while'
3854 &&
3855 (a = named_expression_rule(p)) // named_expression
3856 &&
3857 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3858 &&
3859 (b = block_rule(p)) // block
3860 &&
3861 (c = else_block_rule(p), 1) // else_block?
3862 )
3863 {
3864 D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3865 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3866 if (_token == NULL) {
3867 D(p->level--);
3868 return NULL;
3869 }
3870 int _end_lineno = _token->end_lineno;
3871 UNUSED(_end_lineno); // Only used by EXTRA macro
3872 int _end_col_offset = _token->end_col_offset;
3873 UNUSED(_end_col_offset); // Only used by EXTRA macro
3874 _res = _Py_While ( a , b , c , EXTRA );
3875 if (_res == NULL && PyErr_Occurred()) {
3876 p->error_indicator = 1;
3877 D(p->level--);
3878 return NULL;
3879 }
3880 goto done;
3881 }
3882 p->mark = _mark;
3883 D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3884 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?"));
3885 }
3886 _res = NULL;
3887 done:
3888 D(p->level--);
3889 return _res;
3890}
3891
3892// for_stmt:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003893// | 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3894// | ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3895// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003896static stmt_ty
3897for_stmt_rule(Parser *p)
3898{
3899 D(p->level++);
3900 if (p->error_indicator) {
3901 D(p->level--);
3902 return NULL;
3903 }
3904 stmt_ty _res = NULL;
3905 int _mark = p->mark;
3906 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3907 p->error_indicator = 1;
3908 D(p->level--);
3909 return NULL;
3910 }
3911 int _start_lineno = p->tokens[_mark]->lineno;
3912 UNUSED(_start_lineno); // Only used by EXTRA macro
3913 int _start_col_offset = p->tokens[_mark]->col_offset;
3914 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003915 { // 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003916 if (p->error_indicator) {
3917 D(p->level--);
3918 return NULL;
3919 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003920 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?"));
3921 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003922 Token * _keyword;
3923 Token * _keyword_1;
3924 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003925 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003926 void *el;
3927 expr_ty ex;
3928 expr_ty t;
3929 void *tc;
3930 if (
3931 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3932 &&
3933 (t = star_targets_rule(p)) // star_targets
3934 &&
3935 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3936 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003937 (_cut_var = 1)
3938 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003939 (ex = star_expressions_rule(p)) // star_expressions
3940 &&
3941 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3942 &&
3943 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
3944 &&
3945 (b = block_rule(p)) // block
3946 &&
3947 (el = else_block_rule(p), 1) // else_block?
3948 )
3949 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003950 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 +01003951 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3952 if (_token == NULL) {
3953 D(p->level--);
3954 return NULL;
3955 }
3956 int _end_lineno = _token->end_lineno;
3957 UNUSED(_end_lineno); // Only used by EXTRA macro
3958 int _end_col_offset = _token->end_col_offset;
3959 UNUSED(_end_col_offset); // Only used by EXTRA macro
3960 _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
3961 if (_res == NULL && PyErr_Occurred()) {
3962 p->error_indicator = 1;
3963 D(p->level--);
3964 return NULL;
3965 }
3966 goto done;
3967 }
3968 p->mark = _mark;
3969 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003970 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
3971 if (_cut_var) {
3972 D(p->level--);
3973 return NULL;
3974 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003975 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003976 { // ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003977 if (p->error_indicator) {
3978 D(p->level--);
3979 return NULL;
3980 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003981 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?"));
3982 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003983 Token * _keyword;
3984 Token * _keyword_1;
3985 Token * _literal;
3986 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003987 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003988 void *el;
3989 expr_ty ex;
3990 expr_ty t;
3991 void *tc;
3992 if (
3993 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
3994 &&
3995 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3996 &&
3997 (t = star_targets_rule(p)) // star_targets
3998 &&
3999 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
4000 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004001 (_cut_var = 1)
4002 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004003 (ex = star_expressions_rule(p)) // star_expressions
4004 &&
4005 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4006 &&
4007 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4008 &&
4009 (b = block_rule(p)) // block
4010 &&
4011 (el = else_block_rule(p), 1) // else_block?
4012 )
4013 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004014 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 +01004015 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4016 if (_token == NULL) {
4017 D(p->level--);
4018 return NULL;
4019 }
4020 int _end_lineno = _token->end_lineno;
4021 UNUSED(_end_lineno); // Only used by EXTRA macro
4022 int _end_col_offset = _token->end_col_offset;
4023 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004024 _res = CHECK_VERSION ( stmt_ty , 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004025 if (_res == NULL && PyErr_Occurred()) {
4026 p->error_indicator = 1;
4027 D(p->level--);
4028 return NULL;
4029 }
4030 goto done;
4031 }
4032 p->mark = _mark;
4033 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004034 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
4035 if (_cut_var) {
4036 D(p->level--);
4037 return NULL;
4038 }
4039 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02004040 if (p->call_invalid_rules) { // invalid_for_target
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004041 if (p->error_indicator) {
4042 D(p->level--);
4043 return NULL;
4044 }
4045 D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4046 void *invalid_for_target_var;
4047 if (
4048 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
4049 )
4050 {
4051 D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4052 _res = invalid_for_target_var;
4053 goto done;
4054 }
4055 p->mark = _mark;
4056 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4057 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004058 }
4059 _res = NULL;
4060 done:
4061 D(p->level--);
4062 return _res;
4063}
4064
4065// with_stmt:
4066// | 'with' '(' ','.with_item+ ','? ')' ':' block
4067// | 'with' ','.with_item+ ':' TYPE_COMMENT? block
4068// | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4069// | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4070static stmt_ty
4071with_stmt_rule(Parser *p)
4072{
4073 D(p->level++);
4074 if (p->error_indicator) {
4075 D(p->level--);
4076 return NULL;
4077 }
4078 stmt_ty _res = NULL;
4079 int _mark = p->mark;
4080 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4081 p->error_indicator = 1;
4082 D(p->level--);
4083 return NULL;
4084 }
4085 int _start_lineno = p->tokens[_mark]->lineno;
4086 UNUSED(_start_lineno); // Only used by EXTRA macro
4087 int _start_col_offset = p->tokens[_mark]->col_offset;
4088 UNUSED(_start_col_offset); // Only used by EXTRA macro
4089 { // 'with' '(' ','.with_item+ ','? ')' ':' block
4090 if (p->error_indicator) {
4091 D(p->level--);
4092 return NULL;
4093 }
4094 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4095 Token * _keyword;
4096 Token * _literal;
4097 Token * _literal_1;
4098 Token * _literal_2;
4099 void *_opt_var;
4100 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01004101 asdl_withitem_seq* a;
4102 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004103 if (
4104 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4105 &&
4106 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4107 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004108 (a = (asdl_withitem_seq*)_gather_39_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004109 &&
4110 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4111 &&
4112 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4113 &&
4114 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4115 &&
4116 (b = block_rule(p)) // block
4117 )
4118 {
4119 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4120 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4121 if (_token == NULL) {
4122 D(p->level--);
4123 return NULL;
4124 }
4125 int _end_lineno = _token->end_lineno;
4126 UNUSED(_end_lineno); // Only used by EXTRA macro
4127 int _end_col_offset = _token->end_col_offset;
4128 UNUSED(_end_col_offset); // Only used by EXTRA macro
4129 _res = _Py_With ( a , b , NULL , EXTRA );
4130 if (_res == NULL && PyErr_Occurred()) {
4131 p->error_indicator = 1;
4132 D(p->level--);
4133 return NULL;
4134 }
4135 goto done;
4136 }
4137 p->mark = _mark;
4138 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4139 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4140 }
4141 { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
4142 if (p->error_indicator) {
4143 D(p->level--);
4144 return NULL;
4145 }
4146 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4147 Token * _keyword;
4148 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004149 asdl_withitem_seq* a;
4150 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004151 void *tc;
4152 if (
4153 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4154 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004155 (a = (asdl_withitem_seq*)_gather_41_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004156 &&
4157 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4158 &&
4159 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4160 &&
4161 (b = block_rule(p)) // block
4162 )
4163 {
4164 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4165 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4166 if (_token == NULL) {
4167 D(p->level--);
4168 return NULL;
4169 }
4170 int _end_lineno = _token->end_lineno;
4171 UNUSED(_end_lineno); // Only used by EXTRA macro
4172 int _end_col_offset = _token->end_col_offset;
4173 UNUSED(_end_col_offset); // Only used by EXTRA macro
4174 _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4175 if (_res == NULL && PyErr_Occurred()) {
4176 p->error_indicator = 1;
4177 D(p->level--);
4178 return NULL;
4179 }
4180 goto done;
4181 }
4182 p->mark = _mark;
4183 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4184 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4185 }
4186 { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4187 if (p->error_indicator) {
4188 D(p->level--);
4189 return NULL;
4190 }
4191 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4192 Token * _keyword;
4193 Token * _literal;
4194 Token * _literal_1;
4195 Token * _literal_2;
4196 void *_opt_var;
4197 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01004198 asdl_withitem_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004199 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004200 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004201 if (
4202 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4203 &&
4204 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4205 &&
4206 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4207 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004208 (a = (asdl_withitem_seq*)_gather_43_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004209 &&
4210 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4211 &&
4212 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4213 &&
4214 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4215 &&
4216 (b = block_rule(p)) // block
4217 )
4218 {
4219 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4220 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4221 if (_token == NULL) {
4222 D(p->level--);
4223 return NULL;
4224 }
4225 int _end_lineno = _token->end_lineno;
4226 UNUSED(_end_lineno); // Only used by EXTRA macro
4227 int _end_col_offset = _token->end_col_offset;
4228 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004229 _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004230 if (_res == NULL && PyErr_Occurred()) {
4231 p->error_indicator = 1;
4232 D(p->level--);
4233 return NULL;
4234 }
4235 goto done;
4236 }
4237 p->mark = _mark;
4238 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4239 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4240 }
4241 { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4242 if (p->error_indicator) {
4243 D(p->level--);
4244 return NULL;
4245 }
4246 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4247 Token * _keyword;
4248 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004249 asdl_withitem_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004250 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004251 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004252 void *tc;
4253 if (
4254 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4255 &&
4256 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4257 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004258 (a = (asdl_withitem_seq*)_gather_45_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004259 &&
4260 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4261 &&
4262 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4263 &&
4264 (b = block_rule(p)) // block
4265 )
4266 {
4267 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4268 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4269 if (_token == NULL) {
4270 D(p->level--);
4271 return NULL;
4272 }
4273 int _end_lineno = _token->end_lineno;
4274 UNUSED(_end_lineno); // Only used by EXTRA macro
4275 int _end_col_offset = _token->end_col_offset;
4276 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004277 _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004278 if (_res == NULL && PyErr_Occurred()) {
4279 p->error_indicator = 1;
4280 D(p->level--);
4281 return NULL;
4282 }
4283 goto done;
4284 }
4285 p->mark = _mark;
4286 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4287 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4288 }
4289 _res = NULL;
4290 done:
4291 D(p->level--);
4292 return _res;
4293}
4294
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004295// with_item:
4296// | expression 'as' star_target &(',' | ')' | ':')
4297// | invalid_with_item
4298// | expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004299static withitem_ty
4300with_item_rule(Parser *p)
4301{
4302 D(p->level++);
4303 if (p->error_indicator) {
4304 D(p->level--);
4305 return NULL;
4306 }
4307 withitem_ty _res = NULL;
4308 int _mark = p->mark;
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004309 { // expression 'as' star_target &(',' | ')' | ':')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004310 if (p->error_indicator) {
4311 D(p->level--);
4312 return NULL;
4313 }
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004314 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004315 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004316 expr_ty e;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004317 expr_ty t;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004318 if (
4319 (e = expression_rule(p)) // expression
4320 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004321 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
4322 &&
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004323 (t = star_target_rule(p)) // star_target
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004324 &&
4325 _PyPegen_lookahead(1, _tmp_47_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004326 )
4327 {
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004328 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004329 _res = _Py_withitem ( e , t , p -> arena );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004330 if (_res == NULL && PyErr_Occurred()) {
4331 p->error_indicator = 1;
4332 D(p->level--);
4333 return NULL;
4334 }
4335 goto done;
4336 }
4337 p->mark = _mark;
4338 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004339 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004340 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02004341 if (p->call_invalid_rules) { // invalid_with_item
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004342 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, "invalid_with_item"));
4347 void *invalid_with_item_var;
4348 if (
4349 (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item
4350 )
4351 {
4352 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4353 _res = invalid_with_item_var;
4354 goto done;
4355 }
4356 p->mark = _mark;
4357 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4358 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
4359 }
4360 { // expression
4361 if (p->error_indicator) {
4362 D(p->level--);
4363 return NULL;
4364 }
4365 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
4366 expr_ty e;
4367 if (
4368 (e = expression_rule(p)) // expression
4369 )
4370 {
4371 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
4372 _res = _Py_withitem ( e , NULL , p -> arena );
4373 if (_res == NULL && PyErr_Occurred()) {
4374 p->error_indicator = 1;
4375 D(p->level--);
4376 return NULL;
4377 }
4378 goto done;
4379 }
4380 p->mark = _mark;
4381 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4382 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004383 }
4384 _res = NULL;
4385 done:
4386 D(p->level--);
4387 return _res;
4388}
4389
4390// try_stmt:
4391// | 'try' ':' block finally_block
4392// | 'try' ':' block except_block+ else_block? finally_block?
4393static stmt_ty
4394try_stmt_rule(Parser *p)
4395{
4396 D(p->level++);
4397 if (p->error_indicator) {
4398 D(p->level--);
4399 return NULL;
4400 }
4401 stmt_ty _res = NULL;
4402 int _mark = p->mark;
4403 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4404 p->error_indicator = 1;
4405 D(p->level--);
4406 return NULL;
4407 }
4408 int _start_lineno = p->tokens[_mark]->lineno;
4409 UNUSED(_start_lineno); // Only used by EXTRA macro
4410 int _start_col_offset = p->tokens[_mark]->col_offset;
4411 UNUSED(_start_col_offset); // Only used by EXTRA macro
4412 { // 'try' ':' block finally_block
4413 if (p->error_indicator) {
4414 D(p->level--);
4415 return NULL;
4416 }
4417 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4418 Token * _keyword;
4419 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004420 asdl_stmt_seq* b;
4421 asdl_stmt_seq* f;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004422 if (
4423 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4424 &&
4425 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4426 &&
4427 (b = block_rule(p)) // block
4428 &&
4429 (f = finally_block_rule(p)) // finally_block
4430 )
4431 {
4432 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4433 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4434 if (_token == NULL) {
4435 D(p->level--);
4436 return NULL;
4437 }
4438 int _end_lineno = _token->end_lineno;
4439 UNUSED(_end_lineno); // Only used by EXTRA macro
4440 int _end_col_offset = _token->end_col_offset;
4441 UNUSED(_end_col_offset); // Only used by EXTRA macro
4442 _res = _Py_Try ( b , NULL , NULL , f , EXTRA );
4443 if (_res == NULL && PyErr_Occurred()) {
4444 p->error_indicator = 1;
4445 D(p->level--);
4446 return NULL;
4447 }
4448 goto done;
4449 }
4450 p->mark = _mark;
4451 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4452 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block finally_block"));
4453 }
4454 { // 'try' ':' block except_block+ else_block? finally_block?
4455 if (p->error_indicator) {
4456 D(p->level--);
4457 return NULL;
4458 }
4459 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4460 Token * _keyword;
4461 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004462 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004463 void *el;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004464 asdl_excepthandler_seq* ex;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004465 void *f;
4466 if (
4467 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4468 &&
4469 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4470 &&
4471 (b = block_rule(p)) // block
4472 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004473 (ex = (asdl_excepthandler_seq*)_loop1_48_rule(p)) // except_block+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004474 &&
4475 (el = else_block_rule(p), 1) // else_block?
4476 &&
4477 (f = finally_block_rule(p), 1) // finally_block?
4478 )
4479 {
4480 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4481 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4482 if (_token == NULL) {
4483 D(p->level--);
4484 return NULL;
4485 }
4486 int _end_lineno = _token->end_lineno;
4487 UNUSED(_end_lineno); // Only used by EXTRA macro
4488 int _end_col_offset = _token->end_col_offset;
4489 UNUSED(_end_col_offset); // Only used by EXTRA macro
4490 _res = _Py_Try ( b , ex , el , f , EXTRA );
4491 if (_res == NULL && PyErr_Occurred()) {
4492 p->error_indicator = 1;
4493 D(p->level--);
4494 return NULL;
4495 }
4496 goto done;
4497 }
4498 p->mark = _mark;
4499 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4500 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4501 }
4502 _res = NULL;
4503 done:
4504 D(p->level--);
4505 return _res;
4506}
4507
4508// except_block: 'except' expression ['as' NAME] ':' block | 'except' ':' block
4509static excepthandler_ty
4510except_block_rule(Parser *p)
4511{
4512 D(p->level++);
4513 if (p->error_indicator) {
4514 D(p->level--);
4515 return NULL;
4516 }
4517 excepthandler_ty _res = NULL;
4518 int _mark = p->mark;
4519 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4520 p->error_indicator = 1;
4521 D(p->level--);
4522 return NULL;
4523 }
4524 int _start_lineno = p->tokens[_mark]->lineno;
4525 UNUSED(_start_lineno); // Only used by EXTRA macro
4526 int _start_col_offset = p->tokens[_mark]->col_offset;
4527 UNUSED(_start_col_offset); // Only used by EXTRA macro
4528 { // 'except' expression ['as' NAME] ':' block
4529 if (p->error_indicator) {
4530 D(p->level--);
4531 return NULL;
4532 }
4533 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4534 Token * _keyword;
4535 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004536 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004537 expr_ty e;
4538 void *t;
4539 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004540 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004541 &&
4542 (e = expression_rule(p)) // expression
4543 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004544 (t = _tmp_49_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004545 &&
4546 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4547 &&
4548 (b = block_rule(p)) // block
4549 )
4550 {
4551 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4552 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4553 if (_token == NULL) {
4554 D(p->level--);
4555 return NULL;
4556 }
4557 int _end_lineno = _token->end_lineno;
4558 UNUSED(_end_lineno); // Only used by EXTRA macro
4559 int _end_col_offset = _token->end_col_offset;
4560 UNUSED(_end_col_offset); // Only used by EXTRA macro
4561 _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
4562 if (_res == NULL && PyErr_Occurred()) {
4563 p->error_indicator = 1;
4564 D(p->level--);
4565 return NULL;
4566 }
4567 goto done;
4568 }
4569 p->mark = _mark;
4570 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4571 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4572 }
4573 { // 'except' ':' block
4574 if (p->error_indicator) {
4575 D(p->level--);
4576 return NULL;
4577 }
4578 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4579 Token * _keyword;
4580 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004581 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004582 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004583 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004584 &&
4585 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4586 &&
4587 (b = block_rule(p)) // block
4588 )
4589 {
4590 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4591 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4592 if (_token == NULL) {
4593 D(p->level--);
4594 return NULL;
4595 }
4596 int _end_lineno = _token->end_lineno;
4597 UNUSED(_end_lineno); // Only used by EXTRA macro
4598 int _end_col_offset = _token->end_col_offset;
4599 UNUSED(_end_col_offset); // Only used by EXTRA macro
4600 _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
4601 if (_res == NULL && PyErr_Occurred()) {
4602 p->error_indicator = 1;
4603 D(p->level--);
4604 return NULL;
4605 }
4606 goto done;
4607 }
4608 p->mark = _mark;
4609 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4610 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
4611 }
4612 _res = NULL;
4613 done:
4614 D(p->level--);
4615 return _res;
4616}
4617
4618// finally_block: 'finally' ':' block
Pablo Galindoa5634c42020-09-16 19:42:00 +01004619static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004620finally_block_rule(Parser *p)
4621{
4622 D(p->level++);
4623 if (p->error_indicator) {
4624 D(p->level--);
4625 return NULL;
4626 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01004627 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004628 int _mark = p->mark;
4629 { // 'finally' ':' block
4630 if (p->error_indicator) {
4631 D(p->level--);
4632 return NULL;
4633 }
4634 D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4635 Token * _keyword;
4636 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004637 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004638 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004639 (_keyword = _PyPegen_expect_token(p, 522)) // token='finally'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004640 &&
4641 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4642 &&
4643 (a = block_rule(p)) // block
4644 )
4645 {
4646 D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4647 _res = a;
4648 if (_res == NULL && PyErr_Occurred()) {
4649 p->error_indicator = 1;
4650 D(p->level--);
4651 return NULL;
4652 }
4653 goto done;
4654 }
4655 p->mark = _mark;
4656 D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
4657 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block"));
4658 }
4659 _res = NULL;
4660 done:
4661 D(p->level--);
4662 return _res;
4663}
4664
4665// return_stmt: 'return' star_expressions?
4666static stmt_ty
4667return_stmt_rule(Parser *p)
4668{
4669 D(p->level++);
4670 if (p->error_indicator) {
4671 D(p->level--);
4672 return NULL;
4673 }
4674 stmt_ty _res = NULL;
4675 int _mark = p->mark;
4676 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4677 p->error_indicator = 1;
4678 D(p->level--);
4679 return NULL;
4680 }
4681 int _start_lineno = p->tokens[_mark]->lineno;
4682 UNUSED(_start_lineno); // Only used by EXTRA macro
4683 int _start_col_offset = p->tokens[_mark]->col_offset;
4684 UNUSED(_start_col_offset); // Only used by EXTRA macro
4685 { // 'return' star_expressions?
4686 if (p->error_indicator) {
4687 D(p->level--);
4688 return NULL;
4689 }
4690 D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4691 Token * _keyword;
4692 void *a;
4693 if (
4694 (_keyword = _PyPegen_expect_token(p, 500)) // token='return'
4695 &&
4696 (a = star_expressions_rule(p), 1) // star_expressions?
4697 )
4698 {
4699 D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4700 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4701 if (_token == NULL) {
4702 D(p->level--);
4703 return NULL;
4704 }
4705 int _end_lineno = _token->end_lineno;
4706 UNUSED(_end_lineno); // Only used by EXTRA macro
4707 int _end_col_offset = _token->end_col_offset;
4708 UNUSED(_end_col_offset); // Only used by EXTRA macro
4709 _res = _Py_Return ( a , EXTRA );
4710 if (_res == NULL && PyErr_Occurred()) {
4711 p->error_indicator = 1;
4712 D(p->level--);
4713 return NULL;
4714 }
4715 goto done;
4716 }
4717 p->mark = _mark;
4718 D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4719 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
4720 }
4721 _res = NULL;
4722 done:
4723 D(p->level--);
4724 return _res;
4725}
4726
4727// raise_stmt: 'raise' expression ['from' expression] | 'raise'
4728static stmt_ty
4729raise_stmt_rule(Parser *p)
4730{
4731 D(p->level++);
4732 if (p->error_indicator) {
4733 D(p->level--);
4734 return NULL;
4735 }
4736 stmt_ty _res = NULL;
4737 int _mark = p->mark;
4738 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4739 p->error_indicator = 1;
4740 D(p->level--);
4741 return NULL;
4742 }
4743 int _start_lineno = p->tokens[_mark]->lineno;
4744 UNUSED(_start_lineno); // Only used by EXTRA macro
4745 int _start_col_offset = p->tokens[_mark]->col_offset;
4746 UNUSED(_start_col_offset); // Only used by EXTRA macro
4747 { // 'raise' expression ['from' expression]
4748 if (p->error_indicator) {
4749 D(p->level--);
4750 return NULL;
4751 }
4752 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4753 Token * _keyword;
4754 expr_ty a;
4755 void *b;
4756 if (
4757 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4758 &&
4759 (a = expression_rule(p)) // expression
4760 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004761 (b = _tmp_50_rule(p), 1) // ['from' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004762 )
4763 {
4764 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4765 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4766 if (_token == NULL) {
4767 D(p->level--);
4768 return NULL;
4769 }
4770 int _end_lineno = _token->end_lineno;
4771 UNUSED(_end_lineno); // Only used by EXTRA macro
4772 int _end_col_offset = _token->end_col_offset;
4773 UNUSED(_end_col_offset); // Only used by EXTRA macro
4774 _res = _Py_Raise ( a , b , EXTRA );
4775 if (_res == NULL && PyErr_Occurred()) {
4776 p->error_indicator = 1;
4777 D(p->level--);
4778 return NULL;
4779 }
4780 goto done;
4781 }
4782 p->mark = _mark;
4783 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4784 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
4785 }
4786 { // 'raise'
4787 if (p->error_indicator) {
4788 D(p->level--);
4789 return NULL;
4790 }
4791 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
4792 Token * _keyword;
4793 if (
4794 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4795 )
4796 {
4797 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
4798 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4799 if (_token == NULL) {
4800 D(p->level--);
4801 return NULL;
4802 }
4803 int _end_lineno = _token->end_lineno;
4804 UNUSED(_end_lineno); // Only used by EXTRA macro
4805 int _end_col_offset = _token->end_col_offset;
4806 UNUSED(_end_col_offset); // Only used by EXTRA macro
4807 _res = _Py_Raise ( NULL , NULL , EXTRA );
4808 if (_res == NULL && PyErr_Occurred()) {
4809 p->error_indicator = 1;
4810 D(p->level--);
4811 return NULL;
4812 }
4813 goto done;
4814 }
4815 p->mark = _mark;
4816 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4817 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
4818 }
4819 _res = NULL;
4820 done:
4821 D(p->level--);
4822 return _res;
4823}
4824
4825// function_def: decorators function_def_raw | function_def_raw
4826static stmt_ty
4827function_def_rule(Parser *p)
4828{
4829 D(p->level++);
4830 if (p->error_indicator) {
4831 D(p->level--);
4832 return NULL;
4833 }
4834 stmt_ty _res = NULL;
4835 int _mark = p->mark;
4836 { // decorators function_def_raw
4837 if (p->error_indicator) {
4838 D(p->level--);
4839 return NULL;
4840 }
4841 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01004842 asdl_expr_seq* d;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004843 stmt_ty f;
4844 if (
4845 (d = decorators_rule(p)) // decorators
4846 &&
4847 (f = function_def_raw_rule(p)) // function_def_raw
4848 )
4849 {
4850 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4851 _res = _PyPegen_function_def_decorators ( p , d , f );
4852 if (_res == NULL && PyErr_Occurred()) {
4853 p->error_indicator = 1;
4854 D(p->level--);
4855 return NULL;
4856 }
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, "decorators function_def_raw"));
4862 }
4863 { // function_def_raw
4864 if (p->error_indicator) {
4865 D(p->level--);
4866 return NULL;
4867 }
4868 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4869 stmt_ty function_def_raw_var;
4870 if (
4871 (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
4872 )
4873 {
4874 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4875 _res = function_def_raw_var;
4876 goto done;
4877 }
4878 p->mark = _mark;
4879 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4880 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
4881 }
4882 _res = NULL;
4883 done:
4884 D(p->level--);
4885 return _res;
4886}
4887
4888// function_def_raw:
4889// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4890// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4891static stmt_ty
4892function_def_raw_rule(Parser *p)
4893{
4894 D(p->level++);
4895 if (p->error_indicator) {
4896 D(p->level--);
4897 return NULL;
4898 }
4899 stmt_ty _res = NULL;
4900 int _mark = p->mark;
4901 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4902 p->error_indicator = 1;
4903 D(p->level--);
4904 return NULL;
4905 }
4906 int _start_lineno = p->tokens[_mark]->lineno;
4907 UNUSED(_start_lineno); // Only used by EXTRA macro
4908 int _start_col_offset = p->tokens[_mark]->col_offset;
4909 UNUSED(_start_col_offset); // Only used by EXTRA macro
4910 { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4911 if (p->error_indicator) {
4912 D(p->level--);
4913 return NULL;
4914 }
4915 D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4916 Token * _keyword;
4917 Token * _literal;
4918 Token * _literal_1;
4919 Token * _literal_2;
4920 void *a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004921 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004922 expr_ty n;
4923 void *params;
4924 void *tc;
4925 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004926 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004927 &&
4928 (n = _PyPegen_name_token(p)) // NAME
4929 &&
4930 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4931 &&
4932 (params = params_rule(p), 1) // params?
4933 &&
4934 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4935 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004936 (a = _tmp_51_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004937 &&
4938 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4939 &&
4940 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4941 &&
4942 (b = block_rule(p)) // block
4943 )
4944 {
4945 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"));
4946 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4947 if (_token == NULL) {
4948 D(p->level--);
4949 return NULL;
4950 }
4951 int _end_lineno = _token->end_lineno;
4952 UNUSED(_end_lineno); // Only used by EXTRA macro
4953 int _end_col_offset = _token->end_col_offset;
4954 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004955 _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004956 if (_res == NULL && PyErr_Occurred()) {
4957 p->error_indicator = 1;
4958 D(p->level--);
4959 return NULL;
4960 }
4961 goto done;
4962 }
4963 p->mark = _mark;
4964 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
4965 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4966 }
4967 { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4968 if (p->error_indicator) {
4969 D(p->level--);
4970 return NULL;
4971 }
4972 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"));
4973 Token * _keyword;
4974 Token * _literal;
4975 Token * _literal_1;
4976 Token * _literal_2;
4977 void *a;
4978 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004979 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004980 expr_ty n;
4981 void *params;
4982 void *tc;
4983 if (
4984 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4985 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004986 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004987 &&
4988 (n = _PyPegen_name_token(p)) // NAME
4989 &&
4990 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4991 &&
4992 (params = params_rule(p), 1) // params?
4993 &&
4994 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4995 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004996 (a = _tmp_52_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004997 &&
4998 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4999 &&
5000 (tc = func_type_comment_rule(p), 1) // func_type_comment?
5001 &&
5002 (b = block_rule(p)) // block
5003 )
5004 {
5005 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"));
5006 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5007 if (_token == NULL) {
5008 D(p->level--);
5009 return NULL;
5010 }
5011 int _end_lineno = _token->end_lineno;
5012 UNUSED(_end_lineno); // Only used by EXTRA macro
5013 int _end_col_offset = _token->end_col_offset;
5014 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03005015 _res = CHECK_VERSION ( stmt_ty , 5 , "Async functions are" , _Py_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005016 if (_res == NULL && PyErr_Occurred()) {
5017 p->error_indicator = 1;
5018 D(p->level--);
5019 return NULL;
5020 }
5021 goto done;
5022 }
5023 p->mark = _mark;
5024 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
5025 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
5026 }
5027 _res = NULL;
5028 done:
5029 D(p->level--);
5030 return _res;
5031}
5032
5033// func_type_comment:
5034// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5035// | invalid_double_type_comments
5036// | TYPE_COMMENT
5037static Token*
5038func_type_comment_rule(Parser *p)
5039{
5040 D(p->level++);
5041 if (p->error_indicator) {
5042 D(p->level--);
5043 return NULL;
5044 }
5045 Token* _res = NULL;
5046 int _mark = p->mark;
5047 { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5048 if (p->error_indicator) {
5049 D(p->level--);
5050 return NULL;
5051 }
5052 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5053 Token * newline_var;
5054 Token * t;
5055 if (
5056 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
5057 &&
5058 (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5059 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005060 _PyPegen_lookahead(1, _tmp_53_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005061 )
5062 {
5063 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5064 _res = t;
5065 if (_res == NULL && PyErr_Occurred()) {
5066 p->error_indicator = 1;
5067 D(p->level--);
5068 return NULL;
5069 }
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, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5075 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02005076 if (p->call_invalid_rules) { // invalid_double_type_comments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005077 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, "invalid_double_type_comments"));
5082 void *invalid_double_type_comments_var;
5083 if (
5084 (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
5085 )
5086 {
5087 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5088 _res = invalid_double_type_comments_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, "invalid_double_type_comments"));
5094 }
5095 { // TYPE_COMMENT
5096 if (p->error_indicator) {
5097 D(p->level--);
5098 return NULL;
5099 }
5100 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5101 Token * type_comment_var;
5102 if (
5103 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5104 )
5105 {
5106 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5107 _res = type_comment_var;
5108 goto done;
5109 }
5110 p->mark = _mark;
5111 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5112 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
5113 }
5114 _res = NULL;
5115 done:
5116 D(p->level--);
5117 return _res;
5118}
5119
5120// params: invalid_parameters | parameters
5121static arguments_ty
5122params_rule(Parser *p)
5123{
5124 D(p->level++);
5125 if (p->error_indicator) {
5126 D(p->level--);
5127 return NULL;
5128 }
5129 arguments_ty _res = NULL;
5130 int _mark = p->mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02005131 if (p->call_invalid_rules) { // invalid_parameters
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005132 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, "invalid_parameters"));
5137 void *invalid_parameters_var;
5138 if (
5139 (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
5140 )
5141 {
5142 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5143 _res = invalid_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, "invalid_parameters"));
5149 }
5150 { // parameters
5151 if (p->error_indicator) {
5152 D(p->level--);
5153 return NULL;
5154 }
5155 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
5156 arguments_ty parameters_var;
5157 if (
5158 (parameters_var = parameters_rule(p)) // parameters
5159 )
5160 {
5161 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
5162 _res = parameters_var;
5163 goto done;
5164 }
5165 p->mark = _mark;
5166 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5167 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
5168 }
5169 _res = NULL;
5170 done:
5171 D(p->level--);
5172 return _res;
5173}
5174
5175// parameters:
5176// | slash_no_default param_no_default* param_with_default* star_etc?
5177// | slash_with_default param_with_default* star_etc?
5178// | param_no_default+ param_with_default* star_etc?
5179// | param_with_default+ star_etc?
5180// | star_etc
5181static arguments_ty
5182parameters_rule(Parser *p)
5183{
5184 D(p->level++);
5185 if (p->error_indicator) {
5186 D(p->level--);
5187 return NULL;
5188 }
5189 arguments_ty _res = NULL;
5190 int _mark = p->mark;
5191 { // slash_no_default param_no_default* param_with_default* star_etc?
5192 if (p->error_indicator) {
5193 D(p->level--);
5194 return NULL;
5195 }
5196 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01005197 asdl_arg_seq* a;
5198 asdl_arg_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005199 asdl_seq * c;
5200 void *d;
5201 if (
5202 (a = slash_no_default_rule(p)) // slash_no_default
5203 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01005204 (b = (asdl_arg_seq*)_loop0_54_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005205 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005206 (c = _loop0_55_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005207 &&
5208 (d = star_etc_rule(p), 1) // star_etc?
5209 )
5210 {
5211 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?"));
5212 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
5213 if (_res == NULL && PyErr_Occurred()) {
5214 p->error_indicator = 1;
5215 D(p->level--);
5216 return NULL;
5217 }
5218 goto done;
5219 }
5220 p->mark = _mark;
5221 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5222 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
5223 }
5224 { // slash_with_default param_with_default* star_etc?
5225 if (p->error_indicator) {
5226 D(p->level--);
5227 return NULL;
5228 }
5229 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5230 SlashWithDefault* a;
5231 asdl_seq * b;
5232 void *c;
5233 if (
5234 (a = slash_with_default_rule(p)) // slash_with_default
5235 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005236 (b = _loop0_56_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005237 &&
5238 (c = star_etc_rule(p), 1) // star_etc?
5239 )
5240 {
5241 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5242 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
5243 if (_res == NULL && PyErr_Occurred()) {
5244 p->error_indicator = 1;
5245 D(p->level--);
5246 return NULL;
5247 }
5248 goto done;
5249 }
5250 p->mark = _mark;
5251 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5252 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5253 }
5254 { // param_no_default+ param_with_default* star_etc?
5255 if (p->error_indicator) {
5256 D(p->level--);
5257 return NULL;
5258 }
5259 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01005260 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005261 asdl_seq * b;
5262 void *c;
5263 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005264 (a = (asdl_arg_seq*)_loop1_57_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005265 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005266 (b = _loop0_58_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005267 &&
5268 (c = star_etc_rule(p), 1) // star_etc?
5269 )
5270 {
5271 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5272 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
5273 if (_res == NULL && PyErr_Occurred()) {
5274 p->error_indicator = 1;
5275 D(p->level--);
5276 return NULL;
5277 }
5278 goto done;
5279 }
5280 p->mark = _mark;
5281 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5282 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5283 }
5284 { // param_with_default+ star_etc?
5285 if (p->error_indicator) {
5286 D(p->level--);
5287 return NULL;
5288 }
5289 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5290 asdl_seq * a;
5291 void *b;
5292 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005293 (a = _loop1_59_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005294 &&
5295 (b = star_etc_rule(p), 1) // star_etc?
5296 )
5297 {
5298 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5299 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
5300 if (_res == NULL && PyErr_Occurred()) {
5301 p->error_indicator = 1;
5302 D(p->level--);
5303 return NULL;
5304 }
5305 goto done;
5306 }
5307 p->mark = _mark;
5308 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5309 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
5310 }
5311 { // star_etc
5312 if (p->error_indicator) {
5313 D(p->level--);
5314 return NULL;
5315 }
5316 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
5317 StarEtc* a;
5318 if (
5319 (a = star_etc_rule(p)) // star_etc
5320 )
5321 {
5322 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
5323 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
5324 if (_res == NULL && PyErr_Occurred()) {
5325 p->error_indicator = 1;
5326 D(p->level--);
5327 return NULL;
5328 }
5329 goto done;
5330 }
5331 p->mark = _mark;
5332 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5333 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
5334 }
5335 _res = NULL;
5336 done:
5337 D(p->level--);
5338 return _res;
5339}
5340
5341// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
Pablo Galindoa5634c42020-09-16 19:42:00 +01005342static asdl_arg_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005343slash_no_default_rule(Parser *p)
5344{
5345 D(p->level++);
5346 if (p->error_indicator) {
5347 D(p->level--);
5348 return NULL;
5349 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01005350 asdl_arg_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005351 int _mark = p->mark;
5352 { // param_no_default+ '/' ','
5353 if (p->error_indicator) {
5354 D(p->level--);
5355 return NULL;
5356 }
5357 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5358 Token * _literal;
5359 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +01005360 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005361 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005362 (a = (asdl_arg_seq*)_loop1_60_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005363 &&
5364 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5365 &&
5366 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5367 )
5368 {
5369 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5370 _res = a;
5371 if (_res == NULL && PyErr_Occurred()) {
5372 p->error_indicator = 1;
5373 D(p->level--);
5374 return NULL;
5375 }
5376 goto done;
5377 }
5378 p->mark = _mark;
5379 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5380 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
5381 }
5382 { // param_no_default+ '/' &')'
5383 if (p->error_indicator) {
5384 D(p->level--);
5385 return NULL;
5386 }
5387 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5388 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01005389 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005390 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005391 (a = (asdl_arg_seq*)_loop1_61_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005392 &&
5393 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5394 &&
5395 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5396 )
5397 {
5398 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5399 _res = a;
5400 if (_res == NULL && PyErr_Occurred()) {
5401 p->error_indicator = 1;
5402 D(p->level--);
5403 return NULL;
5404 }
5405 goto done;
5406 }
5407 p->mark = _mark;
5408 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5409 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
5410 }
5411 _res = NULL;
5412 done:
5413 D(p->level--);
5414 return _res;
5415}
5416
5417// slash_with_default:
5418// | param_no_default* param_with_default+ '/' ','
5419// | param_no_default* param_with_default+ '/' &')'
5420static SlashWithDefault*
5421slash_with_default_rule(Parser *p)
5422{
5423 D(p->level++);
5424 if (p->error_indicator) {
5425 D(p->level--);
5426 return NULL;
5427 }
5428 SlashWithDefault* _res = NULL;
5429 int _mark = p->mark;
5430 { // param_no_default* param_with_default+ '/' ','
5431 if (p->error_indicator) {
5432 D(p->level--);
5433 return NULL;
5434 }
5435 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5436 Token * _literal;
5437 Token * _literal_1;
5438 asdl_seq * a;
5439 asdl_seq * b;
5440 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005441 (a = _loop0_62_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005442 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005443 (b = _loop1_63_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005444 &&
5445 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5446 &&
5447 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5448 )
5449 {
5450 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01005451 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005452 if (_res == NULL && PyErr_Occurred()) {
5453 p->error_indicator = 1;
5454 D(p->level--);
5455 return NULL;
5456 }
5457 goto done;
5458 }
5459 p->mark = _mark;
5460 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5461 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5462 }
5463 { // param_no_default* param_with_default+ '/' &')'
5464 if (p->error_indicator) {
5465 D(p->level--);
5466 return NULL;
5467 }
5468 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5469 Token * _literal;
5470 asdl_seq * a;
5471 asdl_seq * b;
5472 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005473 (a = _loop0_64_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005474 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005475 (b = _loop1_65_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005476 &&
5477 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5478 &&
5479 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5480 )
5481 {
5482 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01005483 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005484 if (_res == NULL && PyErr_Occurred()) {
5485 p->error_indicator = 1;
5486 D(p->level--);
5487 return NULL;
5488 }
5489 goto done;
5490 }
5491 p->mark = _mark;
5492 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5493 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5494 }
5495 _res = NULL;
5496 done:
5497 D(p->level--);
5498 return _res;
5499}
5500
5501// star_etc:
5502// | '*' param_no_default param_maybe_default* kwds?
5503// | '*' ',' param_maybe_default+ kwds?
5504// | kwds
5505// | invalid_star_etc
5506static StarEtc*
5507star_etc_rule(Parser *p)
5508{
5509 D(p->level++);
5510 if (p->error_indicator) {
5511 D(p->level--);
5512 return NULL;
5513 }
5514 StarEtc* _res = NULL;
5515 int _mark = p->mark;
5516 { // '*' param_no_default param_maybe_default* kwds?
5517 if (p->error_indicator) {
5518 D(p->level--);
5519 return NULL;
5520 }
5521 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5522 Token * _literal;
5523 arg_ty a;
5524 asdl_seq * b;
5525 void *c;
5526 if (
5527 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5528 &&
5529 (a = param_no_default_rule(p)) // param_no_default
5530 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005531 (b = _loop0_66_rule(p)) // param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005532 &&
5533 (c = kwds_rule(p), 1) // kwds?
5534 )
5535 {
5536 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5537 _res = _PyPegen_star_etc ( p , a , b , c );
5538 if (_res == NULL && PyErr_Occurred()) {
5539 p->error_indicator = 1;
5540 D(p->level--);
5541 return NULL;
5542 }
5543 goto done;
5544 }
5545 p->mark = _mark;
5546 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5547 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5548 }
5549 { // '*' ',' param_maybe_default+ kwds?
5550 if (p->error_indicator) {
5551 D(p->level--);
5552 return NULL;
5553 }
5554 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5555 Token * _literal;
5556 Token * _literal_1;
5557 asdl_seq * b;
5558 void *c;
5559 if (
5560 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5561 &&
5562 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5563 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005564 (b = _loop1_67_rule(p)) // param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005565 &&
5566 (c = kwds_rule(p), 1) // kwds?
5567 )
5568 {
5569 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5570 _res = _PyPegen_star_etc ( p , NULL , b , c );
5571 if (_res == NULL && PyErr_Occurred()) {
5572 p->error_indicator = 1;
5573 D(p->level--);
5574 return NULL;
5575 }
5576 goto done;
5577 }
5578 p->mark = _mark;
5579 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5580 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5581 }
5582 { // kwds
5583 if (p->error_indicator) {
5584 D(p->level--);
5585 return NULL;
5586 }
5587 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
5588 arg_ty a;
5589 if (
5590 (a = kwds_rule(p)) // kwds
5591 )
5592 {
5593 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
5594 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
5595 if (_res == NULL && PyErr_Occurred()) {
5596 p->error_indicator = 1;
5597 D(p->level--);
5598 return NULL;
5599 }
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, "kwds"));
5605 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02005606 if (p->call_invalid_rules) { // invalid_star_etc
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005607 if (p->error_indicator) {
5608 D(p->level--);
5609 return NULL;
5610 }
5611 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5612 void *invalid_star_etc_var;
5613 if (
5614 (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
5615 )
5616 {
5617 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5618 _res = invalid_star_etc_var;
5619 goto done;
5620 }
5621 p->mark = _mark;
5622 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5623 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
5624 }
5625 _res = NULL;
5626 done:
5627 D(p->level--);
5628 return _res;
5629}
5630
5631// kwds: '**' param_no_default
5632static arg_ty
5633kwds_rule(Parser *p)
5634{
5635 D(p->level++);
5636 if (p->error_indicator) {
5637 D(p->level--);
5638 return NULL;
5639 }
5640 arg_ty _res = NULL;
5641 int _mark = p->mark;
5642 { // '**' param_no_default
5643 if (p->error_indicator) {
5644 D(p->level--);
5645 return NULL;
5646 }
5647 D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5648 Token * _literal;
5649 arg_ty a;
5650 if (
5651 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
5652 &&
5653 (a = param_no_default_rule(p)) // param_no_default
5654 )
5655 {
5656 D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5657 _res = a;
5658 if (_res == NULL && PyErr_Occurred()) {
5659 p->error_indicator = 1;
5660 D(p->level--);
5661 return NULL;
5662 }
5663 goto done;
5664 }
5665 p->mark = _mark;
5666 D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
5667 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
5668 }
5669 _res = NULL;
5670 done:
5671 D(p->level--);
5672 return _res;
5673}
5674
5675// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
5676static arg_ty
5677param_no_default_rule(Parser *p)
5678{
5679 D(p->level++);
5680 if (p->error_indicator) {
5681 D(p->level--);
5682 return NULL;
5683 }
5684 arg_ty _res = NULL;
5685 int _mark = p->mark;
5686 { // param ',' TYPE_COMMENT?
5687 if (p->error_indicator) {
5688 D(p->level--);
5689 return NULL;
5690 }
5691 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5692 Token * _literal;
5693 arg_ty a;
5694 void *tc;
5695 if (
5696 (a = param_rule(p)) // param
5697 &&
5698 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5699 &&
5700 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5701 )
5702 {
5703 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5704 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5705 if (_res == NULL && PyErr_Occurred()) {
5706 p->error_indicator = 1;
5707 D(p->level--);
5708 return NULL;
5709 }
5710 goto done;
5711 }
5712 p->mark = _mark;
5713 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5714 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
5715 }
5716 { // param TYPE_COMMENT? &')'
5717 if (p->error_indicator) {
5718 D(p->level--);
5719 return NULL;
5720 }
5721 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5722 arg_ty a;
5723 void *tc;
5724 if (
5725 (a = param_rule(p)) // param
5726 &&
5727 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5728 &&
5729 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5730 )
5731 {
5732 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5733 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5734 if (_res == NULL && PyErr_Occurred()) {
5735 p->error_indicator = 1;
5736 D(p->level--);
5737 return NULL;
5738 }
5739 goto done;
5740 }
5741 p->mark = _mark;
5742 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5743 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
5744 }
5745 _res = NULL;
5746 done:
5747 D(p->level--);
5748 return _res;
5749}
5750
5751// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
5752static NameDefaultPair*
5753param_with_default_rule(Parser *p)
5754{
5755 D(p->level++);
5756 if (p->error_indicator) {
5757 D(p->level--);
5758 return NULL;
5759 }
5760 NameDefaultPair* _res = NULL;
5761 int _mark = p->mark;
5762 { // param default ',' TYPE_COMMENT?
5763 if (p->error_indicator) {
5764 D(p->level--);
5765 return NULL;
5766 }
5767 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5768 Token * _literal;
5769 arg_ty a;
5770 expr_ty c;
5771 void *tc;
5772 if (
5773 (a = param_rule(p)) // param
5774 &&
5775 (c = default_rule(p)) // default
5776 &&
5777 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5778 &&
5779 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5780 )
5781 {
5782 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5783 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5784 if (_res == NULL && PyErr_Occurred()) {
5785 p->error_indicator = 1;
5786 D(p->level--);
5787 return NULL;
5788 }
5789 goto done;
5790 }
5791 p->mark = _mark;
5792 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5793 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5794 }
5795 { // param default TYPE_COMMENT? &')'
5796 if (p->error_indicator) {
5797 D(p->level--);
5798 return NULL;
5799 }
5800 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5801 arg_ty a;
5802 expr_ty c;
5803 void *tc;
5804 if (
5805 (a = param_rule(p)) // param
5806 &&
5807 (c = default_rule(p)) // default
5808 &&
5809 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5810 &&
5811 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5812 )
5813 {
5814 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5815 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5816 if (_res == NULL && PyErr_Occurred()) {
5817 p->error_indicator = 1;
5818 D(p->level--);
5819 return NULL;
5820 }
5821 goto done;
5822 }
5823 p->mark = _mark;
5824 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5825 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5826 }
5827 _res = NULL;
5828 done:
5829 D(p->level--);
5830 return _res;
5831}
5832
5833// param_maybe_default:
5834// | param default? ',' TYPE_COMMENT?
5835// | param default? TYPE_COMMENT? &')'
5836static NameDefaultPair*
5837param_maybe_default_rule(Parser *p)
5838{
5839 D(p->level++);
5840 if (p->error_indicator) {
5841 D(p->level--);
5842 return NULL;
5843 }
5844 NameDefaultPair* _res = NULL;
5845 int _mark = p->mark;
5846 { // param default? ',' TYPE_COMMENT?
5847 if (p->error_indicator) {
5848 D(p->level--);
5849 return NULL;
5850 }
5851 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5852 Token * _literal;
5853 arg_ty a;
5854 void *c;
5855 void *tc;
5856 if (
5857 (a = param_rule(p)) // param
5858 &&
5859 (c = default_rule(p), 1) // default?
5860 &&
5861 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5862 &&
5863 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5864 )
5865 {
5866 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5867 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5868 if (_res == NULL && PyErr_Occurred()) {
5869 p->error_indicator = 1;
5870 D(p->level--);
5871 return NULL;
5872 }
5873 goto done;
5874 }
5875 p->mark = _mark;
5876 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5877 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5878 }
5879 { // param default? TYPE_COMMENT? &')'
5880 if (p->error_indicator) {
5881 D(p->level--);
5882 return NULL;
5883 }
5884 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5885 arg_ty a;
5886 void *c;
5887 void *tc;
5888 if (
5889 (a = param_rule(p)) // param
5890 &&
5891 (c = default_rule(p), 1) // default?
5892 &&
5893 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5894 &&
5895 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5896 )
5897 {
5898 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5899 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5900 if (_res == NULL && PyErr_Occurred()) {
5901 p->error_indicator = 1;
5902 D(p->level--);
5903 return NULL;
5904 }
5905 goto done;
5906 }
5907 p->mark = _mark;
5908 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5909 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5910 }
5911 _res = NULL;
5912 done:
5913 D(p->level--);
5914 return _res;
5915}
5916
5917// param: NAME annotation?
5918static arg_ty
5919param_rule(Parser *p)
5920{
5921 D(p->level++);
5922 if (p->error_indicator) {
5923 D(p->level--);
5924 return NULL;
5925 }
5926 arg_ty _res = NULL;
5927 int _mark = p->mark;
5928 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5929 p->error_indicator = 1;
5930 D(p->level--);
5931 return NULL;
5932 }
5933 int _start_lineno = p->tokens[_mark]->lineno;
5934 UNUSED(_start_lineno); // Only used by EXTRA macro
5935 int _start_col_offset = p->tokens[_mark]->col_offset;
5936 UNUSED(_start_col_offset); // Only used by EXTRA macro
5937 { // NAME annotation?
5938 if (p->error_indicator) {
5939 D(p->level--);
5940 return NULL;
5941 }
5942 D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5943 expr_ty a;
5944 void *b;
5945 if (
5946 (a = _PyPegen_name_token(p)) // NAME
5947 &&
5948 (b = annotation_rule(p), 1) // annotation?
5949 )
5950 {
5951 D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5952 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5953 if (_token == NULL) {
5954 D(p->level--);
5955 return NULL;
5956 }
5957 int _end_lineno = _token->end_lineno;
5958 UNUSED(_end_lineno); // Only used by EXTRA macro
5959 int _end_col_offset = _token->end_col_offset;
5960 UNUSED(_end_col_offset); // Only used by EXTRA macro
5961 _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
5962 if (_res == NULL && PyErr_Occurred()) {
5963 p->error_indicator = 1;
5964 D(p->level--);
5965 return NULL;
5966 }
5967 goto done;
5968 }
5969 p->mark = _mark;
5970 D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
5971 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
5972 }
5973 _res = NULL;
5974 done:
5975 D(p->level--);
5976 return _res;
5977}
5978
5979// annotation: ':' expression
5980static expr_ty
5981annotation_rule(Parser *p)
5982{
5983 D(p->level++);
5984 if (p->error_indicator) {
5985 D(p->level--);
5986 return NULL;
5987 }
5988 expr_ty _res = NULL;
5989 int _mark = p->mark;
5990 { // ':' expression
5991 if (p->error_indicator) {
5992 D(p->level--);
5993 return NULL;
5994 }
5995 D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
5996 Token * _literal;
5997 expr_ty a;
5998 if (
5999 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
6000 &&
6001 (a = expression_rule(p)) // expression
6002 )
6003 {
6004 D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
6005 _res = a;
6006 if (_res == NULL && PyErr_Occurred()) {
6007 p->error_indicator = 1;
6008 D(p->level--);
6009 return NULL;
6010 }
6011 goto done;
6012 }
6013 p->mark = _mark;
6014 D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
6015 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
6016 }
6017 _res = NULL;
6018 done:
6019 D(p->level--);
6020 return _res;
6021}
6022
6023// default: '=' expression
6024static expr_ty
6025default_rule(Parser *p)
6026{
6027 D(p->level++);
6028 if (p->error_indicator) {
6029 D(p->level--);
6030 return NULL;
6031 }
6032 expr_ty _res = NULL;
6033 int _mark = p->mark;
6034 { // '=' expression
6035 if (p->error_indicator) {
6036 D(p->level--);
6037 return NULL;
6038 }
6039 D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6040 Token * _literal;
6041 expr_ty a;
6042 if (
6043 (_literal = _PyPegen_expect_token(p, 22)) // token='='
6044 &&
6045 (a = expression_rule(p)) // expression
6046 )
6047 {
6048 D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6049 _res = a;
6050 if (_res == NULL && PyErr_Occurred()) {
6051 p->error_indicator = 1;
6052 D(p->level--);
6053 return NULL;
6054 }
6055 goto done;
6056 }
6057 p->mark = _mark;
6058 D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
6059 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
6060 }
6061 _res = NULL;
6062 done:
6063 D(p->level--);
6064 return _res;
6065}
6066
6067// decorators: (('@' named_expression NEWLINE))+
Pablo Galindoa5634c42020-09-16 19:42:00 +01006068static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006069decorators_rule(Parser *p)
6070{
6071 D(p->level++);
6072 if (p->error_indicator) {
6073 D(p->level--);
6074 return NULL;
6075 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006076 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006077 int _mark = p->mark;
6078 { // (('@' named_expression NEWLINE))+
6079 if (p->error_indicator) {
6080 D(p->level--);
6081 return NULL;
6082 }
6083 D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006084 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006085 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006086 (a = (asdl_expr_seq*)_loop1_68_rule(p)) // (('@' named_expression NEWLINE))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006087 )
6088 {
6089 D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6090 _res = a;
6091 if (_res == NULL && PyErr_Occurred()) {
6092 p->error_indicator = 1;
6093 D(p->level--);
6094 return NULL;
6095 }
6096 goto done;
6097 }
6098 p->mark = _mark;
6099 D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
6100 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6101 }
6102 _res = NULL;
6103 done:
6104 D(p->level--);
6105 return _res;
6106}
6107
6108// class_def: decorators class_def_raw | class_def_raw
6109static stmt_ty
6110class_def_rule(Parser *p)
6111{
6112 D(p->level++);
6113 if (p->error_indicator) {
6114 D(p->level--);
6115 return NULL;
6116 }
6117 stmt_ty _res = NULL;
6118 int _mark = p->mark;
6119 { // decorators class_def_raw
6120 if (p->error_indicator) {
6121 D(p->level--);
6122 return NULL;
6123 }
6124 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006125 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006126 stmt_ty b;
6127 if (
6128 (a = decorators_rule(p)) // decorators
6129 &&
6130 (b = class_def_raw_rule(p)) // class_def_raw
6131 )
6132 {
6133 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6134 _res = _PyPegen_class_def_decorators ( p , a , b );
6135 if (_res == NULL && PyErr_Occurred()) {
6136 p->error_indicator = 1;
6137 D(p->level--);
6138 return NULL;
6139 }
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, "decorators class_def_raw"));
6145 }
6146 { // class_def_raw
6147 if (p->error_indicator) {
6148 D(p->level--);
6149 return NULL;
6150 }
6151 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6152 stmt_ty class_def_raw_var;
6153 if (
6154 (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
6155 )
6156 {
6157 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6158 _res = class_def_raw_var;
6159 goto done;
6160 }
6161 p->mark = _mark;
6162 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6163 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
6164 }
6165 _res = NULL;
6166 done:
6167 D(p->level--);
6168 return _res;
6169}
6170
6171// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
6172static stmt_ty
6173class_def_raw_rule(Parser *p)
6174{
6175 D(p->level++);
6176 if (p->error_indicator) {
6177 D(p->level--);
6178 return NULL;
6179 }
6180 stmt_ty _res = NULL;
6181 int _mark = p->mark;
6182 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6183 p->error_indicator = 1;
6184 D(p->level--);
6185 return NULL;
6186 }
6187 int _start_lineno = p->tokens[_mark]->lineno;
6188 UNUSED(_start_lineno); // Only used by EXTRA macro
6189 int _start_col_offset = p->tokens[_mark]->col_offset;
6190 UNUSED(_start_col_offset); // Only used by EXTRA macro
6191 { // 'class' NAME ['(' arguments? ')'] ':' block
6192 if (p->error_indicator) {
6193 D(p->level--);
6194 return NULL;
6195 }
6196 D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6197 Token * _keyword;
6198 Token * _literal;
6199 expr_ty a;
6200 void *b;
Pablo Galindoa5634c42020-09-16 19:42:00 +01006201 asdl_stmt_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006202 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006203 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006204 &&
6205 (a = _PyPegen_name_token(p)) // NAME
6206 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006207 (b = _tmp_69_rule(p), 1) // ['(' arguments? ')']
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006208 &&
6209 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
6210 &&
6211 (c = block_rule(p)) // block
6212 )
6213 {
6214 D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6215 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6216 if (_token == NULL) {
6217 D(p->level--);
6218 return NULL;
6219 }
6220 int _end_lineno = _token->end_lineno;
6221 UNUSED(_end_lineno); // Only used by EXTRA macro
6222 int _end_col_offset = _token->end_col_offset;
6223 UNUSED(_end_col_offset); // Only used by EXTRA macro
6224 _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 );
6225 if (_res == NULL && PyErr_Occurred()) {
6226 p->error_indicator = 1;
6227 D(p->level--);
6228 return NULL;
6229 }
6230 goto done;
6231 }
6232 p->mark = _mark;
6233 D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
6234 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6235 }
6236 _res = NULL;
6237 done:
6238 D(p->level--);
6239 return _res;
6240}
6241
6242// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
Pablo Galindoa5634c42020-09-16 19:42:00 +01006243static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006244block_rule(Parser *p)
6245{
6246 D(p->level++);
6247 if (p->error_indicator) {
6248 D(p->level--);
6249 return NULL;
6250 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006251 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006252 if (_PyPegen_is_memoized(p, block_type, &_res)) {
6253 D(p->level--);
6254 return _res;
6255 }
6256 int _mark = p->mark;
6257 { // NEWLINE INDENT statements DEDENT
6258 if (p->error_indicator) {
6259 D(p->level--);
6260 return NULL;
6261 }
6262 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006263 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006264 Token * dedent_var;
6265 Token * indent_var;
6266 Token * newline_var;
6267 if (
6268 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
6269 &&
6270 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
6271 &&
6272 (a = statements_rule(p)) // statements
6273 &&
6274 (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
6275 )
6276 {
6277 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6278 _res = a;
6279 if (_res == NULL && PyErr_Occurred()) {
6280 p->error_indicator = 1;
6281 D(p->level--);
6282 return NULL;
6283 }
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, "NEWLINE INDENT statements DEDENT"));
6289 }
6290 { // simple_stmt
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, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006296 asdl_stmt_seq* simple_stmt_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006297 if (
6298 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
6299 )
6300 {
6301 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6302 _res = simple_stmt_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, "simple_stmt"));
6308 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02006309 if (p->call_invalid_rules) { // invalid_block
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006310 if (p->error_indicator) {
6311 D(p->level--);
6312 return NULL;
6313 }
6314 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6315 void *invalid_block_var;
6316 if (
6317 (invalid_block_var = invalid_block_rule(p)) // invalid_block
6318 )
6319 {
6320 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6321 _res = invalid_block_var;
6322 goto done;
6323 }
6324 p->mark = _mark;
6325 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6326 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
6327 }
6328 _res = NULL;
6329 done:
6330 _PyPegen_insert_memo(p, _mark, block_type, _res);
6331 D(p->level--);
6332 return _res;
6333}
6334
6335// expressions_list: ','.star_expression+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +01006336static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006337expressions_list_rule(Parser *p)
6338{
6339 D(p->level++);
6340 if (p->error_indicator) {
6341 D(p->level--);
6342 return NULL;
6343 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006344 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006345 int _mark = p->mark;
6346 { // ','.star_expression+ ','?
6347 if (p->error_indicator) {
6348 D(p->level--);
6349 return NULL;
6350 }
6351 D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6352 void *_opt_var;
6353 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01006354 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006355 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006356 (a = (asdl_expr_seq*)_gather_70_rule(p)) // ','.star_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006357 &&
6358 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6359 )
6360 {
6361 D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6362 _res = a;
6363 if (_res == NULL && PyErr_Occurred()) {
6364 p->error_indicator = 1;
6365 D(p->level--);
6366 return NULL;
6367 }
6368 goto done;
6369 }
6370 p->mark = _mark;
6371 D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ',
6372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?"));
6373 }
6374 _res = NULL;
6375 done:
6376 D(p->level--);
6377 return _res;
6378}
6379
6380// star_expressions:
6381// | star_expression ((',' star_expression))+ ','?
6382// | star_expression ','
6383// | star_expression
6384static expr_ty
6385star_expressions_rule(Parser *p)
6386{
6387 D(p->level++);
6388 if (p->error_indicator) {
6389 D(p->level--);
6390 return NULL;
6391 }
6392 expr_ty _res = NULL;
6393 int _mark = p->mark;
6394 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6395 p->error_indicator = 1;
6396 D(p->level--);
6397 return NULL;
6398 }
6399 int _start_lineno = p->tokens[_mark]->lineno;
6400 UNUSED(_start_lineno); // Only used by EXTRA macro
6401 int _start_col_offset = p->tokens[_mark]->col_offset;
6402 UNUSED(_start_col_offset); // Only used by EXTRA macro
6403 { // star_expression ((',' star_expression))+ ','?
6404 if (p->error_indicator) {
6405 D(p->level--);
6406 return NULL;
6407 }
6408 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6409 void *_opt_var;
6410 UNUSED(_opt_var); // Silence compiler warnings
6411 expr_ty a;
6412 asdl_seq * b;
6413 if (
6414 (a = star_expression_rule(p)) // star_expression
6415 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006416 (b = _loop1_72_rule(p)) // ((',' star_expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006417 &&
6418 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6419 )
6420 {
6421 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6422 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6423 if (_token == NULL) {
6424 D(p->level--);
6425 return NULL;
6426 }
6427 int _end_lineno = _token->end_lineno;
6428 UNUSED(_end_lineno); // Only used by EXTRA macro
6429 int _end_col_offset = _token->end_col_offset;
6430 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006431 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006432 if (_res == NULL && PyErr_Occurred()) {
6433 p->error_indicator = 1;
6434 D(p->level--);
6435 return NULL;
6436 }
6437 goto done;
6438 }
6439 p->mark = _mark;
6440 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6441 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6442 }
6443 { // star_expression ','
6444 if (p->error_indicator) {
6445 D(p->level--);
6446 return NULL;
6447 }
6448 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6449 Token * _literal;
6450 expr_ty a;
6451 if (
6452 (a = star_expression_rule(p)) // star_expression
6453 &&
6454 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6455 )
6456 {
6457 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6458 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6459 if (_token == NULL) {
6460 D(p->level--);
6461 return NULL;
6462 }
6463 int _end_lineno = _token->end_lineno;
6464 UNUSED(_end_lineno); // Only used by EXTRA macro
6465 int _end_col_offset = _token->end_col_offset;
6466 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006467 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006468 if (_res == NULL && PyErr_Occurred()) {
6469 p->error_indicator = 1;
6470 D(p->level--);
6471 return NULL;
6472 }
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 { // star_expression
6480 if (p->error_indicator) {
6481 D(p->level--);
6482 return NULL;
6483 }
6484 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
6485 expr_ty star_expression_var;
6486 if (
6487 (star_expression_var = star_expression_rule(p)) // star_expression
6488 )
6489 {
6490 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
6491 _res = star_expression_var;
6492 goto done;
6493 }
6494 p->mark = _mark;
6495 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6496 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
6497 }
6498 _res = NULL;
6499 done:
6500 D(p->level--);
6501 return _res;
6502}
6503
6504// star_expression: '*' bitwise_or | expression
6505static expr_ty
6506star_expression_rule(Parser *p)
6507{
6508 D(p->level++);
6509 if (p->error_indicator) {
6510 D(p->level--);
6511 return NULL;
6512 }
6513 expr_ty _res = NULL;
6514 if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
6515 D(p->level--);
6516 return _res;
6517 }
6518 int _mark = p->mark;
6519 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6520 p->error_indicator = 1;
6521 D(p->level--);
6522 return NULL;
6523 }
6524 int _start_lineno = p->tokens[_mark]->lineno;
6525 UNUSED(_start_lineno); // Only used by EXTRA macro
6526 int _start_col_offset = p->tokens[_mark]->col_offset;
6527 UNUSED(_start_col_offset); // Only used by EXTRA macro
6528 { // '*' bitwise_or
6529 if (p->error_indicator) {
6530 D(p->level--);
6531 return NULL;
6532 }
6533 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6534 Token * _literal;
6535 expr_ty a;
6536 if (
6537 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6538 &&
6539 (a = bitwise_or_rule(p)) // bitwise_or
6540 )
6541 {
6542 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6543 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6544 if (_token == NULL) {
6545 D(p->level--);
6546 return NULL;
6547 }
6548 int _end_lineno = _token->end_lineno;
6549 UNUSED(_end_lineno); // Only used by EXTRA macro
6550 int _end_col_offset = _token->end_col_offset;
6551 UNUSED(_end_col_offset); // Only used by EXTRA macro
6552 _res = _Py_Starred ( a , Load , EXTRA );
6553 if (_res == NULL && PyErr_Occurred()) {
6554 p->error_indicator = 1;
6555 D(p->level--);
6556 return NULL;
6557 }
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, "'*' bitwise_or"));
6563 }
6564 { // expression
6565 if (p->error_indicator) {
6566 D(p->level--);
6567 return NULL;
6568 }
6569 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6570 expr_ty expression_var;
6571 if (
6572 (expression_var = expression_rule(p)) // expression
6573 )
6574 {
6575 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6576 _res = expression_var;
6577 goto done;
6578 }
6579 p->mark = _mark;
6580 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6581 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6582 }
6583 _res = NULL;
6584 done:
6585 _PyPegen_insert_memo(p, _mark, star_expression_type, _res);
6586 D(p->level--);
6587 return _res;
6588}
6589
6590// star_named_expressions: ','.star_named_expression+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +01006591static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006592star_named_expressions_rule(Parser *p)
6593{
6594 D(p->level++);
6595 if (p->error_indicator) {
6596 D(p->level--);
6597 return NULL;
6598 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006599 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006600 int _mark = p->mark;
6601 { // ','.star_named_expression+ ','?
6602 if (p->error_indicator) {
6603 D(p->level--);
6604 return NULL;
6605 }
6606 D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6607 void *_opt_var;
6608 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01006609 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006610 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006611 (a = (asdl_expr_seq*)_gather_73_rule(p)) // ','.star_named_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006612 &&
6613 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6614 )
6615 {
6616 D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6617 _res = a;
6618 if (_res == NULL && PyErr_Occurred()) {
6619 p->error_indicator = 1;
6620 D(p->level--);
6621 return NULL;
6622 }
6623 goto done;
6624 }
6625 p->mark = _mark;
6626 D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6627 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
6628 }
6629 _res = NULL;
6630 done:
6631 D(p->level--);
6632 return _res;
6633}
6634
6635// star_named_expression: '*' bitwise_or | named_expression
6636static expr_ty
6637star_named_expression_rule(Parser *p)
6638{
6639 D(p->level++);
6640 if (p->error_indicator) {
6641 D(p->level--);
6642 return NULL;
6643 }
6644 expr_ty _res = NULL;
6645 int _mark = p->mark;
6646 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6647 p->error_indicator = 1;
6648 D(p->level--);
6649 return NULL;
6650 }
6651 int _start_lineno = p->tokens[_mark]->lineno;
6652 UNUSED(_start_lineno); // Only used by EXTRA macro
6653 int _start_col_offset = p->tokens[_mark]->col_offset;
6654 UNUSED(_start_col_offset); // Only used by EXTRA macro
6655 { // '*' bitwise_or
6656 if (p->error_indicator) {
6657 D(p->level--);
6658 return NULL;
6659 }
6660 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6661 Token * _literal;
6662 expr_ty a;
6663 if (
6664 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6665 &&
6666 (a = bitwise_or_rule(p)) // bitwise_or
6667 )
6668 {
6669 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6670 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6671 if (_token == NULL) {
6672 D(p->level--);
6673 return NULL;
6674 }
6675 int _end_lineno = _token->end_lineno;
6676 UNUSED(_end_lineno); // Only used by EXTRA macro
6677 int _end_col_offset = _token->end_col_offset;
6678 UNUSED(_end_col_offset); // Only used by EXTRA macro
6679 _res = _Py_Starred ( a , Load , EXTRA );
6680 if (_res == NULL && PyErr_Occurred()) {
6681 p->error_indicator = 1;
6682 D(p->level--);
6683 return NULL;
6684 }
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, "'*' bitwise_or"));
6690 }
6691 { // named_expression
6692 if (p->error_indicator) {
6693 D(p->level--);
6694 return NULL;
6695 }
6696 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
6697 expr_ty named_expression_var;
6698 if (
6699 (named_expression_var = named_expression_rule(p)) // named_expression
6700 )
6701 {
6702 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
6703 _res = named_expression_var;
6704 goto done;
6705 }
6706 p->mark = _mark;
6707 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6708 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
6709 }
6710 _res = NULL;
6711 done:
6712 D(p->level--);
6713 return _res;
6714}
6715
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006716// named_expression: NAME ':=' ~ expression | expression !':=' | invalid_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006717static expr_ty
6718named_expression_rule(Parser *p)
6719{
6720 D(p->level++);
6721 if (p->error_indicator) {
6722 D(p->level--);
6723 return NULL;
6724 }
6725 expr_ty _res = NULL;
6726 int _mark = p->mark;
6727 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6728 p->error_indicator = 1;
6729 D(p->level--);
6730 return NULL;
6731 }
6732 int _start_lineno = p->tokens[_mark]->lineno;
6733 UNUSED(_start_lineno); // Only used by EXTRA macro
6734 int _start_col_offset = p->tokens[_mark]->col_offset;
6735 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006736 { // NAME ':=' ~ expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006737 if (p->error_indicator) {
6738 D(p->level--);
6739 return NULL;
6740 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006741 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
6742 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006743 Token * _literal;
6744 expr_ty a;
6745 expr_ty b;
6746 if (
6747 (a = _PyPegen_name_token(p)) // NAME
6748 &&
6749 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
6750 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006751 (_cut_var = 1)
6752 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006753 (b = expression_rule(p)) // expression
6754 )
6755 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006756 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 +01006757 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6758 if (_token == NULL) {
6759 D(p->level--);
6760 return NULL;
6761 }
6762 int _end_lineno = _token->end_lineno;
6763 UNUSED(_end_lineno); // Only used by EXTRA macro
6764 int _end_col_offset = _token->end_col_offset;
6765 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006766 _res = _Py_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006767 if (_res == NULL && PyErr_Occurred()) {
6768 p->error_indicator = 1;
6769 D(p->level--);
6770 return NULL;
6771 }
6772 goto done;
6773 }
6774 p->mark = _mark;
6775 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006776 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
6777 if (_cut_var) {
6778 D(p->level--);
6779 return NULL;
6780 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006781 }
6782 { // expression !':='
6783 if (p->error_indicator) {
6784 D(p->level--);
6785 return NULL;
6786 }
6787 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6788 expr_ty expression_var;
6789 if (
6790 (expression_var = expression_rule(p)) // expression
6791 &&
6792 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
6793 )
6794 {
6795 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6796 _res = 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, "expression !':='"));
6802 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02006803 if (p->call_invalid_rules) { // invalid_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006804 if (p->error_indicator) {
6805 D(p->level--);
6806 return NULL;
6807 }
6808 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6809 void *invalid_named_expression_var;
6810 if (
6811 (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression
6812 )
6813 {
6814 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6815 _res = invalid_named_expression_var;
6816 goto done;
6817 }
6818 p->mark = _mark;
6819 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6820 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
6821 }
6822 _res = NULL;
6823 done:
6824 D(p->level--);
6825 return _res;
6826}
6827
6828// annotated_rhs: yield_expr | star_expressions
6829static expr_ty
6830annotated_rhs_rule(Parser *p)
6831{
6832 D(p->level++);
6833 if (p->error_indicator) {
6834 D(p->level--);
6835 return NULL;
6836 }
6837 expr_ty _res = NULL;
6838 int _mark = p->mark;
6839 { // yield_expr
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, "yield_expr"));
6845 expr_ty yield_expr_var;
6846 if (
6847 (yield_expr_var = yield_expr_rule(p)) // yield_expr
6848 )
6849 {
6850 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6851 _res = yield_expr_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, "yield_expr"));
6857 }
6858 { // star_expressions
6859 if (p->error_indicator) {
6860 D(p->level--);
6861 return NULL;
6862 }
6863 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6864 expr_ty star_expressions_var;
6865 if (
6866 (star_expressions_var = star_expressions_rule(p)) // star_expressions
6867 )
6868 {
6869 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6870 _res = star_expressions_var;
6871 goto done;
6872 }
6873 p->mark = _mark;
6874 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6875 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
6876 }
6877 _res = NULL;
6878 done:
6879 D(p->level--);
6880 return _res;
6881}
6882
6883// expressions: expression ((',' expression))+ ','? | expression ',' | expression
6884static expr_ty
6885expressions_rule(Parser *p)
6886{
6887 D(p->level++);
6888 if (p->error_indicator) {
6889 D(p->level--);
6890 return NULL;
6891 }
6892 expr_ty _res = NULL;
6893 int _mark = p->mark;
6894 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6895 p->error_indicator = 1;
6896 D(p->level--);
6897 return NULL;
6898 }
6899 int _start_lineno = p->tokens[_mark]->lineno;
6900 UNUSED(_start_lineno); // Only used by EXTRA macro
6901 int _start_col_offset = p->tokens[_mark]->col_offset;
6902 UNUSED(_start_col_offset); // Only used by EXTRA macro
6903 { // expression ((',' expression))+ ','?
6904 if (p->error_indicator) {
6905 D(p->level--);
6906 return NULL;
6907 }
6908 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6909 void *_opt_var;
6910 UNUSED(_opt_var); // Silence compiler warnings
6911 expr_ty a;
6912 asdl_seq * b;
6913 if (
6914 (a = expression_rule(p)) // expression
6915 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006916 (b = _loop1_75_rule(p)) // ((',' expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006917 &&
6918 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6919 )
6920 {
6921 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6922 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6923 if (_token == NULL) {
6924 D(p->level--);
6925 return NULL;
6926 }
6927 int _end_lineno = _token->end_lineno;
6928 UNUSED(_end_lineno); // Only used by EXTRA macro
6929 int _end_col_offset = _token->end_col_offset;
6930 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006931 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006932 if (_res == NULL && PyErr_Occurred()) {
6933 p->error_indicator = 1;
6934 D(p->level--);
6935 return NULL;
6936 }
6937 goto done;
6938 }
6939 p->mark = _mark;
6940 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6941 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
6942 }
6943 { // expression ','
6944 if (p->error_indicator) {
6945 D(p->level--);
6946 return NULL;
6947 }
6948 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
6949 Token * _literal;
6950 expr_ty a;
6951 if (
6952 (a = expression_rule(p)) // expression
6953 &&
6954 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6955 )
6956 {
6957 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
6958 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6959 if (_token == NULL) {
6960 D(p->level--);
6961 return NULL;
6962 }
6963 int _end_lineno = _token->end_lineno;
6964 UNUSED(_end_lineno); // Only used by EXTRA macro
6965 int _end_col_offset = _token->end_col_offset;
6966 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006967 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006968 if (_res == NULL && PyErr_Occurred()) {
6969 p->error_indicator = 1;
6970 D(p->level--);
6971 return NULL;
6972 }
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 { // expression
6980 if (p->error_indicator) {
6981 D(p->level--);
6982 return NULL;
6983 }
6984 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6985 expr_ty expression_var;
6986 if (
6987 (expression_var = expression_rule(p)) // expression
6988 )
6989 {
6990 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6991 _res = expression_var;
6992 goto done;
6993 }
6994 p->mark = _mark;
6995 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6996 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6997 }
6998 _res = NULL;
6999 done:
7000 D(p->level--);
7001 return _res;
7002}
7003
7004// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
7005static expr_ty
7006expression_rule(Parser *p)
7007{
7008 D(p->level++);
7009 if (p->error_indicator) {
7010 D(p->level--);
7011 return NULL;
7012 }
7013 expr_ty _res = NULL;
7014 if (_PyPegen_is_memoized(p, expression_type, &_res)) {
7015 D(p->level--);
7016 return _res;
7017 }
7018 int _mark = p->mark;
7019 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7020 p->error_indicator = 1;
7021 D(p->level--);
7022 return NULL;
7023 }
7024 int _start_lineno = p->tokens[_mark]->lineno;
7025 UNUSED(_start_lineno); // Only used by EXTRA macro
7026 int _start_col_offset = p->tokens[_mark]->col_offset;
7027 UNUSED(_start_col_offset); // Only used by EXTRA macro
7028 { // disjunction 'if' disjunction 'else' expression
7029 if (p->error_indicator) {
7030 D(p->level--);
7031 return NULL;
7032 }
7033 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7034 Token * _keyword;
7035 Token * _keyword_1;
7036 expr_ty a;
7037 expr_ty b;
7038 expr_ty c;
7039 if (
7040 (a = disjunction_rule(p)) // disjunction
7041 &&
7042 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
7043 &&
7044 (b = disjunction_rule(p)) // disjunction
7045 &&
7046 (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else'
7047 &&
7048 (c = expression_rule(p)) // expression
7049 )
7050 {
7051 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7052 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7053 if (_token == NULL) {
7054 D(p->level--);
7055 return NULL;
7056 }
7057 int _end_lineno = _token->end_lineno;
7058 UNUSED(_end_lineno); // Only used by EXTRA macro
7059 int _end_col_offset = _token->end_col_offset;
7060 UNUSED(_end_col_offset); // Only used by EXTRA macro
7061 _res = _Py_IfExp ( b , a , c , EXTRA );
7062 if (_res == NULL && PyErr_Occurred()) {
7063 p->error_indicator = 1;
7064 D(p->level--);
7065 return NULL;
7066 }
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 'if' disjunction 'else' expression"));
7072 }
7073 { // disjunction
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, "disjunction"));
7079 expr_ty disjunction_var;
7080 if (
7081 (disjunction_var = disjunction_rule(p)) // disjunction
7082 )
7083 {
7084 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
7085 _res = disjunction_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, "disjunction"));
7091 }
7092 { // lambdef
7093 if (p->error_indicator) {
7094 D(p->level--);
7095 return NULL;
7096 }
7097 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
7098 expr_ty lambdef_var;
7099 if (
7100 (lambdef_var = lambdef_rule(p)) // lambdef
7101 )
7102 {
7103 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
7104 _res = lambdef_var;
7105 goto done;
7106 }
7107 p->mark = _mark;
7108 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7109 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
7110 }
7111 _res = NULL;
7112 done:
7113 _PyPegen_insert_memo(p, _mark, expression_type, _res);
7114 D(p->level--);
7115 return _res;
7116}
7117
7118// lambdef: 'lambda' lambda_params? ':' expression
7119static expr_ty
7120lambdef_rule(Parser *p)
7121{
7122 D(p->level++);
7123 if (p->error_indicator) {
7124 D(p->level--);
7125 return NULL;
7126 }
7127 expr_ty _res = NULL;
7128 int _mark = p->mark;
7129 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7130 p->error_indicator = 1;
7131 D(p->level--);
7132 return NULL;
7133 }
7134 int _start_lineno = p->tokens[_mark]->lineno;
7135 UNUSED(_start_lineno); // Only used by EXTRA macro
7136 int _start_col_offset = p->tokens[_mark]->col_offset;
7137 UNUSED(_start_col_offset); // Only used by EXTRA macro
7138 { // 'lambda' lambda_params? ':' expression
7139 if (p->error_indicator) {
7140 D(p->level--);
7141 return NULL;
7142 }
7143 D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7144 Token * _keyword;
7145 Token * _literal;
7146 void *a;
7147 expr_ty b;
7148 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007149 (_keyword = _PyPegen_expect_token(p, 525)) // token='lambda'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007150 &&
7151 (a = lambda_params_rule(p), 1) // lambda_params?
7152 &&
7153 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
7154 &&
7155 (b = expression_rule(p)) // expression
7156 )
7157 {
7158 D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7159 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7160 if (_token == NULL) {
7161 D(p->level--);
7162 return NULL;
7163 }
7164 int _end_lineno = _token->end_lineno;
7165 UNUSED(_end_lineno); // Only used by EXTRA macro
7166 int _end_col_offset = _token->end_col_offset;
7167 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03007168 _res = _Py_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007169 if (_res == NULL && PyErr_Occurred()) {
7170 p->error_indicator = 1;
7171 D(p->level--);
7172 return NULL;
7173 }
7174 goto done;
7175 }
7176 p->mark = _mark;
7177 D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
7178 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7179 }
7180 _res = NULL;
7181 done:
7182 D(p->level--);
7183 return _res;
7184}
7185
7186// lambda_params: invalid_lambda_parameters | lambda_parameters
7187static arguments_ty
7188lambda_params_rule(Parser *p)
7189{
7190 D(p->level++);
7191 if (p->error_indicator) {
7192 D(p->level--);
7193 return NULL;
7194 }
7195 arguments_ty _res = NULL;
7196 int _mark = p->mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02007197 if (p->call_invalid_rules) { // invalid_lambda_parameters
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007198 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, "invalid_lambda_parameters"));
7203 void *invalid_lambda_parameters_var;
7204 if (
7205 (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
7206 )
7207 {
7208 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7209 _res = invalid_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, "invalid_lambda_parameters"));
7215 }
7216 { // lambda_parameters
7217 if (p->error_indicator) {
7218 D(p->level--);
7219 return NULL;
7220 }
7221 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7222 arguments_ty lambda_parameters_var;
7223 if (
7224 (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
7225 )
7226 {
7227 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7228 _res = lambda_parameters_var;
7229 goto done;
7230 }
7231 p->mark = _mark;
7232 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7233 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
7234 }
7235 _res = NULL;
7236 done:
7237 D(p->level--);
7238 return _res;
7239}
7240
7241// lambda_parameters:
7242// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7243// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7244// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7245// | lambda_param_with_default+ lambda_star_etc?
7246// | lambda_star_etc
7247static arguments_ty
7248lambda_parameters_rule(Parser *p)
7249{
7250 D(p->level++);
7251 if (p->error_indicator) {
7252 D(p->level--);
7253 return NULL;
7254 }
7255 arguments_ty _res = NULL;
7256 int _mark = p->mark;
7257 { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7258 if (p->error_indicator) {
7259 D(p->level--);
7260 return NULL;
7261 }
7262 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01007263 asdl_arg_seq* a;
7264 asdl_arg_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007265 asdl_seq * c;
7266 void *d;
7267 if (
7268 (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
7269 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01007270 (b = (asdl_arg_seq*)_loop0_76_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007271 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007272 (c = _loop0_77_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007273 &&
7274 (d = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7275 )
7276 {
7277 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?"));
7278 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
7279 if (_res == NULL && PyErr_Occurred()) {
7280 p->error_indicator = 1;
7281 D(p->level--);
7282 return NULL;
7283 }
7284 goto done;
7285 }
7286 p->mark = _mark;
7287 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7288 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
7289 }
7290 { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7291 if (p->error_indicator) {
7292 D(p->level--);
7293 return NULL;
7294 }
7295 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?"));
7296 SlashWithDefault* a;
7297 asdl_seq * b;
7298 void *c;
7299 if (
7300 (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
7301 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007302 (b = _loop0_78_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007303 &&
7304 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7305 )
7306 {
7307 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?"));
7308 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
7309 if (_res == NULL && PyErr_Occurred()) {
7310 p->error_indicator = 1;
7311 D(p->level--);
7312 return NULL;
7313 }
7314 goto done;
7315 }
7316 p->mark = _mark;
7317 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7318 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
7319 }
7320 { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7321 if (p->error_indicator) {
7322 D(p->level--);
7323 return NULL;
7324 }
7325 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01007326 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007327 asdl_seq * b;
7328 void *c;
7329 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007330 (a = (asdl_arg_seq*)_loop1_79_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007331 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007332 (b = _loop0_80_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007333 &&
7334 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7335 )
7336 {
7337 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?"));
7338 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
7339 if (_res == NULL && PyErr_Occurred()) {
7340 p->error_indicator = 1;
7341 D(p->level--);
7342 return NULL;
7343 }
7344 goto done;
7345 }
7346 p->mark = _mark;
7347 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7348 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
7349 }
7350 { // lambda_param_with_default+ lambda_star_etc?
7351 if (p->error_indicator) {
7352 D(p->level--);
7353 return NULL;
7354 }
7355 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7356 asdl_seq * a;
7357 void *b;
7358 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007359 (a = _loop1_81_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007360 &&
7361 (b = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7362 )
7363 {
7364 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7365 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
7366 if (_res == NULL && PyErr_Occurred()) {
7367 p->error_indicator = 1;
7368 D(p->level--);
7369 return NULL;
7370 }
7371 goto done;
7372 }
7373 p->mark = _mark;
7374 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7375 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7376 }
7377 { // lambda_star_etc
7378 if (p->error_indicator) {
7379 D(p->level--);
7380 return NULL;
7381 }
7382 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7383 StarEtc* a;
7384 if (
7385 (a = lambda_star_etc_rule(p)) // lambda_star_etc
7386 )
7387 {
7388 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7389 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
7390 if (_res == NULL && PyErr_Occurred()) {
7391 p->error_indicator = 1;
7392 D(p->level--);
7393 return NULL;
7394 }
7395 goto done;
7396 }
7397 p->mark = _mark;
7398 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7399 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
7400 }
7401 _res = NULL;
7402 done:
7403 D(p->level--);
7404 return _res;
7405}
7406
7407// lambda_slash_no_default:
7408// | lambda_param_no_default+ '/' ','
7409// | lambda_param_no_default+ '/' &':'
Pablo Galindoa5634c42020-09-16 19:42:00 +01007410static asdl_arg_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007411lambda_slash_no_default_rule(Parser *p)
7412{
7413 D(p->level++);
7414 if (p->error_indicator) {
7415 D(p->level--);
7416 return NULL;
7417 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01007418 asdl_arg_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007419 int _mark = p->mark;
7420 { // lambda_param_no_default+ '/' ','
7421 if (p->error_indicator) {
7422 D(p->level--);
7423 return NULL;
7424 }
7425 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7426 Token * _literal;
7427 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +01007428 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007429 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007430 (a = (asdl_arg_seq*)_loop1_82_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007431 &&
7432 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7433 &&
7434 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7435 )
7436 {
7437 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7438 _res = a;
7439 if (_res == NULL && PyErr_Occurred()) {
7440 p->error_indicator = 1;
7441 D(p->level--);
7442 return NULL;
7443 }
7444 goto done;
7445 }
7446 p->mark = _mark;
7447 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7448 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7449 }
7450 { // lambda_param_no_default+ '/' &':'
7451 if (p->error_indicator) {
7452 D(p->level--);
7453 return NULL;
7454 }
7455 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7456 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01007457 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007458 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007459 (a = (asdl_arg_seq*)_loop1_83_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007460 &&
7461 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7462 &&
7463 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7464 )
7465 {
7466 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7467 _res = a;
7468 if (_res == NULL && PyErr_Occurred()) {
7469 p->error_indicator = 1;
7470 D(p->level--);
7471 return NULL;
7472 }
7473 goto done;
7474 }
7475 p->mark = _mark;
7476 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7477 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7478 }
7479 _res = NULL;
7480 done:
7481 D(p->level--);
7482 return _res;
7483}
7484
7485// lambda_slash_with_default:
7486// | lambda_param_no_default* lambda_param_with_default+ '/' ','
7487// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
7488static SlashWithDefault*
7489lambda_slash_with_default_rule(Parser *p)
7490{
7491 D(p->level++);
7492 if (p->error_indicator) {
7493 D(p->level--);
7494 return NULL;
7495 }
7496 SlashWithDefault* _res = NULL;
7497 int _mark = p->mark;
7498 { // lambda_param_no_default* lambda_param_with_default+ '/' ','
7499 if (p->error_indicator) {
7500 D(p->level--);
7501 return NULL;
7502 }
7503 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+ '/' ','"));
7504 Token * _literal;
7505 Token * _literal_1;
7506 asdl_seq * a;
7507 asdl_seq * b;
7508 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007509 (a = _loop0_84_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007510 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007511 (b = _loop1_85_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007512 &&
7513 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7514 &&
7515 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7516 )
7517 {
7518 D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01007519 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007520 if (_res == NULL && PyErr_Occurred()) {
7521 p->error_indicator = 1;
7522 D(p->level--);
7523 return NULL;
7524 }
7525 goto done;
7526 }
7527 p->mark = _mark;
7528 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7529 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
7530 }
7531 { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
7532 if (p->error_indicator) {
7533 D(p->level--);
7534 return NULL;
7535 }
7536 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+ '/' &':'"));
7537 Token * _literal;
7538 asdl_seq * a;
7539 asdl_seq * b;
7540 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007541 (a = _loop0_86_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007542 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007543 (b = _loop1_87_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007544 &&
7545 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7546 &&
7547 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7548 )
7549 {
7550 D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01007551 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007552 if (_res == NULL && PyErr_Occurred()) {
7553 p->error_indicator = 1;
7554 D(p->level--);
7555 return NULL;
7556 }
7557 goto done;
7558 }
7559 p->mark = _mark;
7560 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7561 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
7562 }
7563 _res = NULL;
7564 done:
7565 D(p->level--);
7566 return _res;
7567}
7568
7569// lambda_star_etc:
7570// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7571// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
7572// | lambda_kwds
7573// | invalid_lambda_star_etc
7574static StarEtc*
7575lambda_star_etc_rule(Parser *p)
7576{
7577 D(p->level++);
7578 if (p->error_indicator) {
7579 D(p->level--);
7580 return NULL;
7581 }
7582 StarEtc* _res = NULL;
7583 int _mark = p->mark;
7584 { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7585 if (p->error_indicator) {
7586 D(p->level--);
7587 return NULL;
7588 }
7589 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?"));
7590 Token * _literal;
7591 arg_ty a;
7592 asdl_seq * b;
7593 void *c;
7594 if (
7595 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7596 &&
7597 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7598 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007599 (b = _loop0_88_rule(p)) // lambda_param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007600 &&
7601 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7602 )
7603 {
7604 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?"));
7605 _res = _PyPegen_star_etc ( p , a , b , c );
7606 if (_res == NULL && PyErr_Occurred()) {
7607 p->error_indicator = 1;
7608 D(p->level--);
7609 return NULL;
7610 }
7611 goto done;
7612 }
7613 p->mark = _mark;
7614 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7615 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
7616 }
7617 { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
7618 if (p->error_indicator) {
7619 D(p->level--);
7620 return NULL;
7621 }
7622 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7623 Token * _literal;
7624 Token * _literal_1;
7625 asdl_seq * b;
7626 void *c;
7627 if (
7628 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7629 &&
7630 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7631 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007632 (b = _loop1_89_rule(p)) // lambda_param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007633 &&
7634 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7635 )
7636 {
7637 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7638 _res = _PyPegen_star_etc ( p , NULL , b , c );
7639 if (_res == NULL && PyErr_Occurred()) {
7640 p->error_indicator = 1;
7641 D(p->level--);
7642 return NULL;
7643 }
7644 goto done;
7645 }
7646 p->mark = _mark;
7647 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7648 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7649 }
7650 { // lambda_kwds
7651 if (p->error_indicator) {
7652 D(p->level--);
7653 return NULL;
7654 }
7655 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7656 arg_ty a;
7657 if (
7658 (a = lambda_kwds_rule(p)) // lambda_kwds
7659 )
7660 {
7661 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7662 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
7663 if (_res == NULL && PyErr_Occurred()) {
7664 p->error_indicator = 1;
7665 D(p->level--);
7666 return NULL;
7667 }
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, "lambda_kwds"));
7673 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02007674 if (p->call_invalid_rules) { // invalid_lambda_star_etc
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007675 if (p->error_indicator) {
7676 D(p->level--);
7677 return NULL;
7678 }
7679 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7680 void *invalid_lambda_star_etc_var;
7681 if (
7682 (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
7683 )
7684 {
7685 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7686 _res = invalid_lambda_star_etc_var;
7687 goto done;
7688 }
7689 p->mark = _mark;
7690 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7691 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
7692 }
7693 _res = NULL;
7694 done:
7695 D(p->level--);
7696 return _res;
7697}
7698
7699// lambda_kwds: '**' lambda_param_no_default
7700static arg_ty
7701lambda_kwds_rule(Parser *p)
7702{
7703 D(p->level++);
7704 if (p->error_indicator) {
7705 D(p->level--);
7706 return NULL;
7707 }
7708 arg_ty _res = NULL;
7709 int _mark = p->mark;
7710 { // '**' lambda_param_no_default
7711 if (p->error_indicator) {
7712 D(p->level--);
7713 return NULL;
7714 }
7715 D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7716 Token * _literal;
7717 arg_ty a;
7718 if (
7719 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
7720 &&
7721 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7722 )
7723 {
7724 D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7725 _res = a;
7726 if (_res == NULL && PyErr_Occurred()) {
7727 p->error_indicator = 1;
7728 D(p->level--);
7729 return NULL;
7730 }
7731 goto done;
7732 }
7733 p->mark = _mark;
7734 D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
7735 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
7736 }
7737 _res = NULL;
7738 done:
7739 D(p->level--);
7740 return _res;
7741}
7742
7743// lambda_param_no_default: lambda_param ',' | lambda_param &':'
7744static arg_ty
7745lambda_param_no_default_rule(Parser *p)
7746{
7747 D(p->level++);
7748 if (p->error_indicator) {
7749 D(p->level--);
7750 return NULL;
7751 }
7752 arg_ty _res = NULL;
7753 int _mark = p->mark;
7754 { // lambda_param ','
7755 if (p->error_indicator) {
7756 D(p->level--);
7757 return NULL;
7758 }
7759 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7760 Token * _literal;
7761 arg_ty a;
7762 if (
7763 (a = lambda_param_rule(p)) // lambda_param
7764 &&
7765 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7766 )
7767 {
7768 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7769 _res = a;
7770 if (_res == NULL && PyErr_Occurred()) {
7771 p->error_indicator = 1;
7772 D(p->level--);
7773 return NULL;
7774 }
7775 goto done;
7776 }
7777 p->mark = _mark;
7778 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7779 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
7780 }
7781 { // lambda_param &':'
7782 if (p->error_indicator) {
7783 D(p->level--);
7784 return NULL;
7785 }
7786 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7787 arg_ty a;
7788 if (
7789 (a = lambda_param_rule(p)) // lambda_param
7790 &&
7791 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7792 )
7793 {
7794 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7795 _res = a;
7796 if (_res == NULL && PyErr_Occurred()) {
7797 p->error_indicator = 1;
7798 D(p->level--);
7799 return NULL;
7800 }
7801 goto done;
7802 }
7803 p->mark = _mark;
7804 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7805 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
7806 }
7807 _res = NULL;
7808 done:
7809 D(p->level--);
7810 return _res;
7811}
7812
7813// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
7814static NameDefaultPair*
7815lambda_param_with_default_rule(Parser *p)
7816{
7817 D(p->level++);
7818 if (p->error_indicator) {
7819 D(p->level--);
7820 return NULL;
7821 }
7822 NameDefaultPair* _res = NULL;
7823 int _mark = p->mark;
7824 { // lambda_param default ','
7825 if (p->error_indicator) {
7826 D(p->level--);
7827 return NULL;
7828 }
7829 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7830 Token * _literal;
7831 arg_ty a;
7832 expr_ty c;
7833 if (
7834 (a = lambda_param_rule(p)) // lambda_param
7835 &&
7836 (c = default_rule(p)) // default
7837 &&
7838 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7839 )
7840 {
7841 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7842 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7843 if (_res == NULL && PyErr_Occurred()) {
7844 p->error_indicator = 1;
7845 D(p->level--);
7846 return NULL;
7847 }
7848 goto done;
7849 }
7850 p->mark = _mark;
7851 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7852 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
7853 }
7854 { // lambda_param default &':'
7855 if (p->error_indicator) {
7856 D(p->level--);
7857 return NULL;
7858 }
7859 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7860 arg_ty a;
7861 expr_ty c;
7862 if (
7863 (a = lambda_param_rule(p)) // lambda_param
7864 &&
7865 (c = default_rule(p)) // default
7866 &&
7867 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7868 )
7869 {
7870 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7871 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7872 if (_res == NULL && PyErr_Occurred()) {
7873 p->error_indicator = 1;
7874 D(p->level--);
7875 return NULL;
7876 }
7877 goto done;
7878 }
7879 p->mark = _mark;
7880 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7881 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
7882 }
7883 _res = NULL;
7884 done:
7885 D(p->level--);
7886 return _res;
7887}
7888
7889// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
7890static NameDefaultPair*
7891lambda_param_maybe_default_rule(Parser *p)
7892{
7893 D(p->level++);
7894 if (p->error_indicator) {
7895 D(p->level--);
7896 return NULL;
7897 }
7898 NameDefaultPair* _res = NULL;
7899 int _mark = p->mark;
7900 { // lambda_param default? ','
7901 if (p->error_indicator) {
7902 D(p->level--);
7903 return NULL;
7904 }
7905 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7906 Token * _literal;
7907 arg_ty a;
7908 void *c;
7909 if (
7910 (a = lambda_param_rule(p)) // lambda_param
7911 &&
7912 (c = default_rule(p), 1) // default?
7913 &&
7914 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7915 )
7916 {
7917 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7918 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7919 if (_res == NULL && PyErr_Occurred()) {
7920 p->error_indicator = 1;
7921 D(p->level--);
7922 return NULL;
7923 }
7924 goto done;
7925 }
7926 p->mark = _mark;
7927 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7928 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
7929 }
7930 { // lambda_param default? &':'
7931 if (p->error_indicator) {
7932 D(p->level--);
7933 return NULL;
7934 }
7935 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7936 arg_ty a;
7937 void *c;
7938 if (
7939 (a = lambda_param_rule(p)) // lambda_param
7940 &&
7941 (c = default_rule(p), 1) // default?
7942 &&
7943 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7944 )
7945 {
7946 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7947 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7948 if (_res == NULL && PyErr_Occurred()) {
7949 p->error_indicator = 1;
7950 D(p->level--);
7951 return NULL;
7952 }
7953 goto done;
7954 }
7955 p->mark = _mark;
7956 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7957 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
7958 }
7959 _res = NULL;
7960 done:
7961 D(p->level--);
7962 return _res;
7963}
7964
7965// lambda_param: NAME
7966static arg_ty
7967lambda_param_rule(Parser *p)
7968{
7969 D(p->level++);
7970 if (p->error_indicator) {
7971 D(p->level--);
7972 return NULL;
7973 }
7974 arg_ty _res = NULL;
7975 int _mark = p->mark;
7976 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7977 p->error_indicator = 1;
7978 D(p->level--);
7979 return NULL;
7980 }
7981 int _start_lineno = p->tokens[_mark]->lineno;
7982 UNUSED(_start_lineno); // Only used by EXTRA macro
7983 int _start_col_offset = p->tokens[_mark]->col_offset;
7984 UNUSED(_start_col_offset); // Only used by EXTRA macro
7985 { // NAME
7986 if (p->error_indicator) {
7987 D(p->level--);
7988 return NULL;
7989 }
7990 D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
7991 expr_ty a;
7992 if (
7993 (a = _PyPegen_name_token(p)) // NAME
7994 )
7995 {
7996 D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
7997 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7998 if (_token == NULL) {
7999 D(p->level--);
8000 return NULL;
8001 }
8002 int _end_lineno = _token->end_lineno;
8003 UNUSED(_end_lineno); // Only used by EXTRA macro
8004 int _end_col_offset = _token->end_col_offset;
8005 UNUSED(_end_col_offset); // Only used by EXTRA macro
8006 _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
8007 if (_res == NULL && PyErr_Occurred()) {
8008 p->error_indicator = 1;
8009 D(p->level--);
8010 return NULL;
8011 }
8012 goto done;
8013 }
8014 p->mark = _mark;
8015 D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
8016 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
8017 }
8018 _res = NULL;
8019 done:
8020 D(p->level--);
8021 return _res;
8022}
8023
8024// disjunction: conjunction (('or' conjunction))+ | conjunction
8025static expr_ty
8026disjunction_rule(Parser *p)
8027{
8028 D(p->level++);
8029 if (p->error_indicator) {
8030 D(p->level--);
8031 return NULL;
8032 }
8033 expr_ty _res = NULL;
8034 if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
8035 D(p->level--);
8036 return _res;
8037 }
8038 int _mark = p->mark;
8039 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8040 p->error_indicator = 1;
8041 D(p->level--);
8042 return NULL;
8043 }
8044 int _start_lineno = p->tokens[_mark]->lineno;
8045 UNUSED(_start_lineno); // Only used by EXTRA macro
8046 int _start_col_offset = p->tokens[_mark]->col_offset;
8047 UNUSED(_start_col_offset); // Only used by EXTRA macro
8048 { // conjunction (('or' conjunction))+
8049 if (p->error_indicator) {
8050 D(p->level--);
8051 return NULL;
8052 }
8053 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8054 expr_ty a;
8055 asdl_seq * b;
8056 if (
8057 (a = conjunction_rule(p)) // conjunction
8058 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008059 (b = _loop1_90_rule(p)) // (('or' conjunction))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008060 )
8061 {
8062 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8063 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8064 if (_token == NULL) {
8065 D(p->level--);
8066 return NULL;
8067 }
8068 int _end_lineno = _token->end_lineno;
8069 UNUSED(_end_lineno); // Only used by EXTRA macro
8070 int _end_col_offset = _token->end_col_offset;
8071 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03008072 _res = _Py_BoolOp ( Or , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008073 if (_res == NULL && PyErr_Occurred()) {
8074 p->error_indicator = 1;
8075 D(p->level--);
8076 return NULL;
8077 }
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 (('or' conjunction))+"));
8083 }
8084 { // conjunction
8085 if (p->error_indicator) {
8086 D(p->level--);
8087 return NULL;
8088 }
8089 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
8090 expr_ty conjunction_var;
8091 if (
8092 (conjunction_var = conjunction_rule(p)) // conjunction
8093 )
8094 {
8095 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
8096 _res = conjunction_var;
8097 goto done;
8098 }
8099 p->mark = _mark;
8100 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8101 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
8102 }
8103 _res = NULL;
8104 done:
8105 _PyPegen_insert_memo(p, _mark, disjunction_type, _res);
8106 D(p->level--);
8107 return _res;
8108}
8109
8110// conjunction: inversion (('and' inversion))+ | inversion
8111static expr_ty
8112conjunction_rule(Parser *p)
8113{
8114 D(p->level++);
8115 if (p->error_indicator) {
8116 D(p->level--);
8117 return NULL;
8118 }
8119 expr_ty _res = NULL;
8120 if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
8121 D(p->level--);
8122 return _res;
8123 }
8124 int _mark = p->mark;
8125 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8126 p->error_indicator = 1;
8127 D(p->level--);
8128 return NULL;
8129 }
8130 int _start_lineno = p->tokens[_mark]->lineno;
8131 UNUSED(_start_lineno); // Only used by EXTRA macro
8132 int _start_col_offset = p->tokens[_mark]->col_offset;
8133 UNUSED(_start_col_offset); // Only used by EXTRA macro
8134 { // inversion (('and' inversion))+
8135 if (p->error_indicator) {
8136 D(p->level--);
8137 return NULL;
8138 }
8139 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8140 expr_ty a;
8141 asdl_seq * b;
8142 if (
8143 (a = inversion_rule(p)) // inversion
8144 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008145 (b = _loop1_91_rule(p)) // (('and' inversion))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008146 )
8147 {
8148 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8149 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8150 if (_token == NULL) {
8151 D(p->level--);
8152 return NULL;
8153 }
8154 int _end_lineno = _token->end_lineno;
8155 UNUSED(_end_lineno); // Only used by EXTRA macro
8156 int _end_col_offset = _token->end_col_offset;
8157 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03008158 _res = _Py_BoolOp ( And , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008159 if (_res == NULL && PyErr_Occurred()) {
8160 p->error_indicator = 1;
8161 D(p->level--);
8162 return NULL;
8163 }
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 (('and' inversion))+"));
8169 }
8170 { // inversion
8171 if (p->error_indicator) {
8172 D(p->level--);
8173 return NULL;
8174 }
8175 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
8176 expr_ty inversion_var;
8177 if (
8178 (inversion_var = inversion_rule(p)) // inversion
8179 )
8180 {
8181 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
8182 _res = inversion_var;
8183 goto done;
8184 }
8185 p->mark = _mark;
8186 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8187 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
8188 }
8189 _res = NULL;
8190 done:
8191 _PyPegen_insert_memo(p, _mark, conjunction_type, _res);
8192 D(p->level--);
8193 return _res;
8194}
8195
8196// inversion: 'not' inversion | comparison
8197static expr_ty
8198inversion_rule(Parser *p)
8199{
8200 D(p->level++);
8201 if (p->error_indicator) {
8202 D(p->level--);
8203 return NULL;
8204 }
8205 expr_ty _res = NULL;
8206 if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
8207 D(p->level--);
8208 return _res;
8209 }
8210 int _mark = p->mark;
8211 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8212 p->error_indicator = 1;
8213 D(p->level--);
8214 return NULL;
8215 }
8216 int _start_lineno = p->tokens[_mark]->lineno;
8217 UNUSED(_start_lineno); // Only used by EXTRA macro
8218 int _start_col_offset = p->tokens[_mark]->col_offset;
8219 UNUSED(_start_col_offset); // Only used by EXTRA macro
8220 { // 'not' inversion
8221 if (p->error_indicator) {
8222 D(p->level--);
8223 return NULL;
8224 }
8225 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8226 Token * _keyword;
8227 expr_ty a;
8228 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008229 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008230 &&
8231 (a = inversion_rule(p)) // inversion
8232 )
8233 {
8234 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8235 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8236 if (_token == NULL) {
8237 D(p->level--);
8238 return NULL;
8239 }
8240 int _end_lineno = _token->end_lineno;
8241 UNUSED(_end_lineno); // Only used by EXTRA macro
8242 int _end_col_offset = _token->end_col_offset;
8243 UNUSED(_end_col_offset); // Only used by EXTRA macro
8244 _res = _Py_UnaryOp ( Not , a , EXTRA );
8245 if (_res == NULL && PyErr_Occurred()) {
8246 p->error_indicator = 1;
8247 D(p->level--);
8248 return NULL;
8249 }
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, "'not' inversion"));
8255 }
8256 { // comparison
8257 if (p->error_indicator) {
8258 D(p->level--);
8259 return NULL;
8260 }
8261 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
8262 expr_ty comparison_var;
8263 if (
8264 (comparison_var = comparison_rule(p)) // comparison
8265 )
8266 {
8267 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
8268 _res = comparison_var;
8269 goto done;
8270 }
8271 p->mark = _mark;
8272 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8273 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
8274 }
8275 _res = NULL;
8276 done:
8277 _PyPegen_insert_memo(p, _mark, inversion_type, _res);
8278 D(p->level--);
8279 return _res;
8280}
8281
8282// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
8283static expr_ty
8284comparison_rule(Parser *p)
8285{
8286 D(p->level++);
8287 if (p->error_indicator) {
8288 D(p->level--);
8289 return NULL;
8290 }
8291 expr_ty _res = NULL;
8292 int _mark = p->mark;
8293 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8294 p->error_indicator = 1;
8295 D(p->level--);
8296 return NULL;
8297 }
8298 int _start_lineno = p->tokens[_mark]->lineno;
8299 UNUSED(_start_lineno); // Only used by EXTRA macro
8300 int _start_col_offset = p->tokens[_mark]->col_offset;
8301 UNUSED(_start_col_offset); // Only used by EXTRA macro
8302 { // bitwise_or compare_op_bitwise_or_pair+
8303 if (p->error_indicator) {
8304 D(p->level--);
8305 return NULL;
8306 }
8307 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8308 expr_ty a;
8309 asdl_seq * b;
8310 if (
8311 (a = bitwise_or_rule(p)) // bitwise_or
8312 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008313 (b = _loop1_92_rule(p)) // compare_op_bitwise_or_pair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008314 )
8315 {
8316 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8317 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8318 if (_token == NULL) {
8319 D(p->level--);
8320 return NULL;
8321 }
8322 int _end_lineno = _token->end_lineno;
8323 UNUSED(_end_lineno); // Only used by EXTRA macro
8324 int _end_col_offset = _token->end_col_offset;
8325 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03008326 _res = _Py_Compare ( a , CHECK ( asdl_int_seq * , _PyPegen_get_cmpops ( p , b ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_exprs ( p , b ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008327 if (_res == NULL && PyErr_Occurred()) {
8328 p->error_indicator = 1;
8329 D(p->level--);
8330 return NULL;
8331 }
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 compare_op_bitwise_or_pair+"));
8337 }
8338 { // bitwise_or
8339 if (p->error_indicator) {
8340 D(p->level--);
8341 return NULL;
8342 }
8343 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8344 expr_ty bitwise_or_var;
8345 if (
8346 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
8347 )
8348 {
8349 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8350 _res = bitwise_or_var;
8351 goto done;
8352 }
8353 p->mark = _mark;
8354 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8355 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
8356 }
8357 _res = NULL;
8358 done:
8359 D(p->level--);
8360 return _res;
8361}
8362
8363// compare_op_bitwise_or_pair:
8364// | eq_bitwise_or
8365// | noteq_bitwise_or
8366// | lte_bitwise_or
8367// | lt_bitwise_or
8368// | gte_bitwise_or
8369// | gt_bitwise_or
8370// | notin_bitwise_or
8371// | in_bitwise_or
8372// | isnot_bitwise_or
8373// | is_bitwise_or
8374static CmpopExprPair*
8375compare_op_bitwise_or_pair_rule(Parser *p)
8376{
8377 D(p->level++);
8378 if (p->error_indicator) {
8379 D(p->level--);
8380 return NULL;
8381 }
8382 CmpopExprPair* _res = NULL;
8383 int _mark = p->mark;
8384 { // eq_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, "eq_bitwise_or"));
8390 CmpopExprPair* eq_bitwise_or_var;
8391 if (
8392 (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or
8393 )
8394 {
8395 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8396 _res = eq_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, "eq_bitwise_or"));
8402 }
8403 { // noteq_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, "noteq_bitwise_or"));
8409 CmpopExprPair* noteq_bitwise_or_var;
8410 if (
8411 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or
8412 )
8413 {
8414 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8415 _res = noteq_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, "noteq_bitwise_or"));
8421 }
8422 { // lte_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, "lte_bitwise_or"));
8428 CmpopExprPair* lte_bitwise_or_var;
8429 if (
8430 (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or
8431 )
8432 {
8433 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8434 _res = lte_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, "lte_bitwise_or"));
8440 }
8441 { // lt_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, "lt_bitwise_or"));
8447 CmpopExprPair* lt_bitwise_or_var;
8448 if (
8449 (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or
8450 )
8451 {
8452 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8453 _res = lt_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, "lt_bitwise_or"));
8459 }
8460 { // gte_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, "gte_bitwise_or"));
8466 CmpopExprPair* gte_bitwise_or_var;
8467 if (
8468 (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or
8469 )
8470 {
8471 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8472 _res = gte_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, "gte_bitwise_or"));
8478 }
8479 { // gt_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, "gt_bitwise_or"));
8485 CmpopExprPair* gt_bitwise_or_var;
8486 if (
8487 (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or
8488 )
8489 {
8490 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8491 _res = gt_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, "gt_bitwise_or"));
8497 }
8498 { // notin_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, "notin_bitwise_or"));
8504 CmpopExprPair* notin_bitwise_or_var;
8505 if (
8506 (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or
8507 )
8508 {
8509 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8510 _res = notin_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, "notin_bitwise_or"));
8516 }
8517 { // in_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, "in_bitwise_or"));
8523 CmpopExprPair* in_bitwise_or_var;
8524 if (
8525 (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or
8526 )
8527 {
8528 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8529 _res = in_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, "in_bitwise_or"));
8535 }
8536 { // isnot_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, "isnot_bitwise_or"));
8542 CmpopExprPair* isnot_bitwise_or_var;
8543 if (
8544 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or
8545 )
8546 {
8547 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8548 _res = isnot_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, "isnot_bitwise_or"));
8554 }
8555 { // is_bitwise_or
8556 if (p->error_indicator) {
8557 D(p->level--);
8558 return NULL;
8559 }
8560 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8561 CmpopExprPair* is_bitwise_or_var;
8562 if (
8563 (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or
8564 )
8565 {
8566 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8567 _res = is_bitwise_or_var;
8568 goto done;
8569 }
8570 p->mark = _mark;
8571 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8572 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
8573 }
8574 _res = NULL;
8575 done:
8576 D(p->level--);
8577 return _res;
8578}
8579
8580// eq_bitwise_or: '==' bitwise_or
8581static CmpopExprPair*
8582eq_bitwise_or_rule(Parser *p)
8583{
8584 D(p->level++);
8585 if (p->error_indicator) {
8586 D(p->level--);
8587 return NULL;
8588 }
8589 CmpopExprPair* _res = NULL;
8590 int _mark = p->mark;
8591 { // '==' bitwise_or
8592 if (p->error_indicator) {
8593 D(p->level--);
8594 return NULL;
8595 }
8596 D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8597 Token * _literal;
8598 expr_ty a;
8599 if (
8600 (_literal = _PyPegen_expect_token(p, 27)) // token='=='
8601 &&
8602 (a = bitwise_or_rule(p)) // bitwise_or
8603 )
8604 {
8605 D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8606 _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
8607 if (_res == NULL && PyErr_Occurred()) {
8608 p->error_indicator = 1;
8609 D(p->level--);
8610 return NULL;
8611 }
8612 goto done;
8613 }
8614 p->mark = _mark;
8615 D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8616 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
8617 }
8618 _res = NULL;
8619 done:
8620 D(p->level--);
8621 return _res;
8622}
8623
8624// noteq_bitwise_or: ('!=') bitwise_or
8625static CmpopExprPair*
8626noteq_bitwise_or_rule(Parser *p)
8627{
8628 D(p->level++);
8629 if (p->error_indicator) {
8630 D(p->level--);
8631 return NULL;
8632 }
8633 CmpopExprPair* _res = NULL;
8634 int _mark = p->mark;
8635 { // ('!=') bitwise_or
8636 if (p->error_indicator) {
8637 D(p->level--);
8638 return NULL;
8639 }
8640 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 +03008641 void *_tmp_93_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008642 expr_ty a;
8643 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008644 (_tmp_93_var = _tmp_93_rule(p)) // '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008645 &&
8646 (a = bitwise_or_rule(p)) // bitwise_or
8647 )
8648 {
8649 D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
8650 _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
8651 if (_res == NULL && PyErr_Occurred()) {
8652 p->error_indicator = 1;
8653 D(p->level--);
8654 return NULL;
8655 }
8656 goto done;
8657 }
8658 p->mark = _mark;
8659 D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8660 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
8661 }
8662 _res = NULL;
8663 done:
8664 D(p->level--);
8665 return _res;
8666}
8667
8668// lte_bitwise_or: '<=' bitwise_or
8669static CmpopExprPair*
8670lte_bitwise_or_rule(Parser *p)
8671{
8672 D(p->level++);
8673 if (p->error_indicator) {
8674 D(p->level--);
8675 return NULL;
8676 }
8677 CmpopExprPair* _res = NULL;
8678 int _mark = p->mark;
8679 { // '<=' bitwise_or
8680 if (p->error_indicator) {
8681 D(p->level--);
8682 return NULL;
8683 }
8684 D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8685 Token * _literal;
8686 expr_ty a;
8687 if (
8688 (_literal = _PyPegen_expect_token(p, 29)) // token='<='
8689 &&
8690 (a = bitwise_or_rule(p)) // bitwise_or
8691 )
8692 {
8693 D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8694 _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
8695 if (_res == NULL && PyErr_Occurred()) {
8696 p->error_indicator = 1;
8697 D(p->level--);
8698 return NULL;
8699 }
8700 goto done;
8701 }
8702 p->mark = _mark;
8703 D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8704 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
8705 }
8706 _res = NULL;
8707 done:
8708 D(p->level--);
8709 return _res;
8710}
8711
8712// lt_bitwise_or: '<' bitwise_or
8713static CmpopExprPair*
8714lt_bitwise_or_rule(Parser *p)
8715{
8716 D(p->level++);
8717 if (p->error_indicator) {
8718 D(p->level--);
8719 return NULL;
8720 }
8721 CmpopExprPair* _res = NULL;
8722 int _mark = p->mark;
8723 { // '<' bitwise_or
8724 if (p->error_indicator) {
8725 D(p->level--);
8726 return NULL;
8727 }
8728 D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8729 Token * _literal;
8730 expr_ty a;
8731 if (
8732 (_literal = _PyPegen_expect_token(p, 20)) // token='<'
8733 &&
8734 (a = bitwise_or_rule(p)) // bitwise_or
8735 )
8736 {
8737 D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8738 _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
8739 if (_res == NULL && PyErr_Occurred()) {
8740 p->error_indicator = 1;
8741 D(p->level--);
8742 return NULL;
8743 }
8744 goto done;
8745 }
8746 p->mark = _mark;
8747 D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8748 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
8749 }
8750 _res = NULL;
8751 done:
8752 D(p->level--);
8753 return _res;
8754}
8755
8756// gte_bitwise_or: '>=' bitwise_or
8757static CmpopExprPair*
8758gte_bitwise_or_rule(Parser *p)
8759{
8760 D(p->level++);
8761 if (p->error_indicator) {
8762 D(p->level--);
8763 return NULL;
8764 }
8765 CmpopExprPair* _res = NULL;
8766 int _mark = p->mark;
8767 { // '>=' bitwise_or
8768 if (p->error_indicator) {
8769 D(p->level--);
8770 return NULL;
8771 }
8772 D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8773 Token * _literal;
8774 expr_ty a;
8775 if (
8776 (_literal = _PyPegen_expect_token(p, 30)) // token='>='
8777 &&
8778 (a = bitwise_or_rule(p)) // bitwise_or
8779 )
8780 {
8781 D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8782 _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
8783 if (_res == NULL && PyErr_Occurred()) {
8784 p->error_indicator = 1;
8785 D(p->level--);
8786 return NULL;
8787 }
8788 goto done;
8789 }
8790 p->mark = _mark;
8791 D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8792 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
8793 }
8794 _res = NULL;
8795 done:
8796 D(p->level--);
8797 return _res;
8798}
8799
8800// gt_bitwise_or: '>' bitwise_or
8801static CmpopExprPair*
8802gt_bitwise_or_rule(Parser *p)
8803{
8804 D(p->level++);
8805 if (p->error_indicator) {
8806 D(p->level--);
8807 return NULL;
8808 }
8809 CmpopExprPair* _res = NULL;
8810 int _mark = p->mark;
8811 { // '>' bitwise_or
8812 if (p->error_indicator) {
8813 D(p->level--);
8814 return NULL;
8815 }
8816 D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8817 Token * _literal;
8818 expr_ty a;
8819 if (
8820 (_literal = _PyPegen_expect_token(p, 21)) // token='>'
8821 &&
8822 (a = bitwise_or_rule(p)) // bitwise_or
8823 )
8824 {
8825 D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8826 _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
8827 if (_res == NULL && PyErr_Occurred()) {
8828 p->error_indicator = 1;
8829 D(p->level--);
8830 return NULL;
8831 }
8832 goto done;
8833 }
8834 p->mark = _mark;
8835 D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8836 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
8837 }
8838 _res = NULL;
8839 done:
8840 D(p->level--);
8841 return _res;
8842}
8843
8844// notin_bitwise_or: 'not' 'in' bitwise_or
8845static CmpopExprPair*
8846notin_bitwise_or_rule(Parser *p)
8847{
8848 D(p->level++);
8849 if (p->error_indicator) {
8850 D(p->level--);
8851 return NULL;
8852 }
8853 CmpopExprPair* _res = NULL;
8854 int _mark = p->mark;
8855 { // 'not' 'in' bitwise_or
8856 if (p->error_indicator) {
8857 D(p->level--);
8858 return NULL;
8859 }
8860 D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8861 Token * _keyword;
8862 Token * _keyword_1;
8863 expr_ty a;
8864 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008865 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008866 &&
8867 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
8868 &&
8869 (a = bitwise_or_rule(p)) // bitwise_or
8870 )
8871 {
8872 D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8873 _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
8874 if (_res == NULL && PyErr_Occurred()) {
8875 p->error_indicator = 1;
8876 D(p->level--);
8877 return NULL;
8878 }
8879 goto done;
8880 }
8881 p->mark = _mark;
8882 D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8883 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
8884 }
8885 _res = NULL;
8886 done:
8887 D(p->level--);
8888 return _res;
8889}
8890
8891// in_bitwise_or: 'in' bitwise_or
8892static CmpopExprPair*
8893in_bitwise_or_rule(Parser *p)
8894{
8895 D(p->level++);
8896 if (p->error_indicator) {
8897 D(p->level--);
8898 return NULL;
8899 }
8900 CmpopExprPair* _res = NULL;
8901 int _mark = p->mark;
8902 { // 'in' bitwise_or
8903 if (p->error_indicator) {
8904 D(p->level--);
8905 return NULL;
8906 }
8907 D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8908 Token * _keyword;
8909 expr_ty a;
8910 if (
8911 (_keyword = _PyPegen_expect_token(p, 518)) // token='in'
8912 &&
8913 (a = bitwise_or_rule(p)) // bitwise_or
8914 )
8915 {
8916 D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8917 _res = _PyPegen_cmpop_expr_pair ( p , In , a );
8918 if (_res == NULL && PyErr_Occurred()) {
8919 p->error_indicator = 1;
8920 D(p->level--);
8921 return NULL;
8922 }
8923 goto done;
8924 }
8925 p->mark = _mark;
8926 D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8927 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
8928 }
8929 _res = NULL;
8930 done:
8931 D(p->level--);
8932 return _res;
8933}
8934
8935// isnot_bitwise_or: 'is' 'not' bitwise_or
8936static CmpopExprPair*
8937isnot_bitwise_or_rule(Parser *p)
8938{
8939 D(p->level++);
8940 if (p->error_indicator) {
8941 D(p->level--);
8942 return NULL;
8943 }
8944 CmpopExprPair* _res = NULL;
8945 int _mark = p->mark;
8946 { // 'is' 'not' bitwise_or
8947 if (p->error_indicator) {
8948 D(p->level--);
8949 return NULL;
8950 }
8951 D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8952 Token * _keyword;
8953 Token * _keyword_1;
8954 expr_ty a;
8955 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008956 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008957 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008958 (_keyword_1 = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008959 &&
8960 (a = bitwise_or_rule(p)) // bitwise_or
8961 )
8962 {
8963 D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8964 _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
8965 if (_res == NULL && PyErr_Occurred()) {
8966 p->error_indicator = 1;
8967 D(p->level--);
8968 return NULL;
8969 }
8970 goto done;
8971 }
8972 p->mark = _mark;
8973 D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8974 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
8975 }
8976 _res = NULL;
8977 done:
8978 D(p->level--);
8979 return _res;
8980}
8981
8982// is_bitwise_or: 'is' bitwise_or
8983static CmpopExprPair*
8984is_bitwise_or_rule(Parser *p)
8985{
8986 D(p->level++);
8987 if (p->error_indicator) {
8988 D(p->level--);
8989 return NULL;
8990 }
8991 CmpopExprPair* _res = NULL;
8992 int _mark = p->mark;
8993 { // 'is' bitwise_or
8994 if (p->error_indicator) {
8995 D(p->level--);
8996 return NULL;
8997 }
8998 D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
8999 Token * _keyword;
9000 expr_ty a;
9001 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03009002 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009003 &&
9004 (a = bitwise_or_rule(p)) // bitwise_or
9005 )
9006 {
9007 D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
9008 _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
9009 if (_res == NULL && PyErr_Occurred()) {
9010 p->error_indicator = 1;
9011 D(p->level--);
9012 return NULL;
9013 }
9014 goto done;
9015 }
9016 p->mark = _mark;
9017 D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9018 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
9019 }
9020 _res = NULL;
9021 done:
9022 D(p->level--);
9023 return _res;
9024}
9025
9026// Left-recursive
9027// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
9028static expr_ty bitwise_or_raw(Parser *);
9029static expr_ty
9030bitwise_or_rule(Parser *p)
9031{
9032 D(p->level++);
9033 expr_ty _res = NULL;
9034 if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
9035 D(p->level--);
9036 return _res;
9037 }
9038 int _mark = p->mark;
9039 int _resmark = p->mark;
9040 while (1) {
9041 int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
9042 if (tmpvar_1) {
9043 D(p->level--);
9044 return _res;
9045 }
9046 p->mark = _mark;
9047 void *_raw = bitwise_or_raw(p);
9048 if (_raw == NULL || p->mark <= _resmark)
9049 break;
9050 _resmark = p->mark;
9051 _res = _raw;
9052 }
9053 p->mark = _resmark;
9054 D(p->level--);
9055 return _res;
9056}
9057static expr_ty
9058bitwise_or_raw(Parser *p)
9059{
9060 D(p->level++);
9061 if (p->error_indicator) {
9062 D(p->level--);
9063 return NULL;
9064 }
9065 expr_ty _res = NULL;
9066 int _mark = p->mark;
9067 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9068 p->error_indicator = 1;
9069 D(p->level--);
9070 return NULL;
9071 }
9072 int _start_lineno = p->tokens[_mark]->lineno;
9073 UNUSED(_start_lineno); // Only used by EXTRA macro
9074 int _start_col_offset = p->tokens[_mark]->col_offset;
9075 UNUSED(_start_col_offset); // Only used by EXTRA macro
9076 { // bitwise_or '|' bitwise_xor
9077 if (p->error_indicator) {
9078 D(p->level--);
9079 return NULL;
9080 }
9081 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9082 Token * _literal;
9083 expr_ty a;
9084 expr_ty b;
9085 if (
9086 (a = bitwise_or_rule(p)) // bitwise_or
9087 &&
9088 (_literal = _PyPegen_expect_token(p, 18)) // token='|'
9089 &&
9090 (b = bitwise_xor_rule(p)) // bitwise_xor
9091 )
9092 {
9093 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9094 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9095 if (_token == NULL) {
9096 D(p->level--);
9097 return NULL;
9098 }
9099 int _end_lineno = _token->end_lineno;
9100 UNUSED(_end_lineno); // Only used by EXTRA macro
9101 int _end_col_offset = _token->end_col_offset;
9102 UNUSED(_end_col_offset); // Only used by EXTRA macro
9103 _res = _Py_BinOp ( a , BitOr , b , EXTRA );
9104 if (_res == NULL && PyErr_Occurred()) {
9105 p->error_indicator = 1;
9106 D(p->level--);
9107 return NULL;
9108 }
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_or '|' bitwise_xor"));
9114 }
9115 { // bitwise_xor
9116 if (p->error_indicator) {
9117 D(p->level--);
9118 return NULL;
9119 }
9120 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9121 expr_ty bitwise_xor_var;
9122 if (
9123 (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor
9124 )
9125 {
9126 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9127 _res = bitwise_xor_var;
9128 goto done;
9129 }
9130 p->mark = _mark;
9131 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9132 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
9133 }
9134 _res = NULL;
9135 done:
9136 D(p->level--);
9137 return _res;
9138}
9139
9140// Left-recursive
9141// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
9142static expr_ty bitwise_xor_raw(Parser *);
9143static expr_ty
9144bitwise_xor_rule(Parser *p)
9145{
9146 D(p->level++);
9147 expr_ty _res = NULL;
9148 if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
9149 D(p->level--);
9150 return _res;
9151 }
9152 int _mark = p->mark;
9153 int _resmark = p->mark;
9154 while (1) {
9155 int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
9156 if (tmpvar_2) {
9157 D(p->level--);
9158 return _res;
9159 }
9160 p->mark = _mark;
9161 void *_raw = bitwise_xor_raw(p);
9162 if (_raw == NULL || p->mark <= _resmark)
9163 break;
9164 _resmark = p->mark;
9165 _res = _raw;
9166 }
9167 p->mark = _resmark;
9168 D(p->level--);
9169 return _res;
9170}
9171static expr_ty
9172bitwise_xor_raw(Parser *p)
9173{
9174 D(p->level++);
9175 if (p->error_indicator) {
9176 D(p->level--);
9177 return NULL;
9178 }
9179 expr_ty _res = NULL;
9180 int _mark = p->mark;
9181 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9182 p->error_indicator = 1;
9183 D(p->level--);
9184 return NULL;
9185 }
9186 int _start_lineno = p->tokens[_mark]->lineno;
9187 UNUSED(_start_lineno); // Only used by EXTRA macro
9188 int _start_col_offset = p->tokens[_mark]->col_offset;
9189 UNUSED(_start_col_offset); // Only used by EXTRA macro
9190 { // bitwise_xor '^' bitwise_and
9191 if (p->error_indicator) {
9192 D(p->level--);
9193 return NULL;
9194 }
9195 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9196 Token * _literal;
9197 expr_ty a;
9198 expr_ty b;
9199 if (
9200 (a = bitwise_xor_rule(p)) // bitwise_xor
9201 &&
9202 (_literal = _PyPegen_expect_token(p, 32)) // token='^'
9203 &&
9204 (b = bitwise_and_rule(p)) // bitwise_and
9205 )
9206 {
9207 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9208 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9209 if (_token == NULL) {
9210 D(p->level--);
9211 return NULL;
9212 }
9213 int _end_lineno = _token->end_lineno;
9214 UNUSED(_end_lineno); // Only used by EXTRA macro
9215 int _end_col_offset = _token->end_col_offset;
9216 UNUSED(_end_col_offset); // Only used by EXTRA macro
9217 _res = _Py_BinOp ( a , BitXor , b , EXTRA );
9218 if (_res == NULL && PyErr_Occurred()) {
9219 p->error_indicator = 1;
9220 D(p->level--);
9221 return NULL;
9222 }
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_xor '^' bitwise_and"));
9228 }
9229 { // bitwise_and
9230 if (p->error_indicator) {
9231 D(p->level--);
9232 return NULL;
9233 }
9234 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9235 expr_ty bitwise_and_var;
9236 if (
9237 (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and
9238 )
9239 {
9240 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9241 _res = bitwise_and_var;
9242 goto done;
9243 }
9244 p->mark = _mark;
9245 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9246 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
9247 }
9248 _res = NULL;
9249 done:
9250 D(p->level--);
9251 return _res;
9252}
9253
9254// Left-recursive
9255// bitwise_and: bitwise_and '&' shift_expr | shift_expr
9256static expr_ty bitwise_and_raw(Parser *);
9257static expr_ty
9258bitwise_and_rule(Parser *p)
9259{
9260 D(p->level++);
9261 expr_ty _res = NULL;
9262 if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
9263 D(p->level--);
9264 return _res;
9265 }
9266 int _mark = p->mark;
9267 int _resmark = p->mark;
9268 while (1) {
9269 int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
9270 if (tmpvar_3) {
9271 D(p->level--);
9272 return _res;
9273 }
9274 p->mark = _mark;
9275 void *_raw = bitwise_and_raw(p);
9276 if (_raw == NULL || p->mark <= _resmark)
9277 break;
9278 _resmark = p->mark;
9279 _res = _raw;
9280 }
9281 p->mark = _resmark;
9282 D(p->level--);
9283 return _res;
9284}
9285static expr_ty
9286bitwise_and_raw(Parser *p)
9287{
9288 D(p->level++);
9289 if (p->error_indicator) {
9290 D(p->level--);
9291 return NULL;
9292 }
9293 expr_ty _res = NULL;
9294 int _mark = p->mark;
9295 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9296 p->error_indicator = 1;
9297 D(p->level--);
9298 return NULL;
9299 }
9300 int _start_lineno = p->tokens[_mark]->lineno;
9301 UNUSED(_start_lineno); // Only used by EXTRA macro
9302 int _start_col_offset = p->tokens[_mark]->col_offset;
9303 UNUSED(_start_col_offset); // Only used by EXTRA macro
9304 { // bitwise_and '&' shift_expr
9305 if (p->error_indicator) {
9306 D(p->level--);
9307 return NULL;
9308 }
9309 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9310 Token * _literal;
9311 expr_ty a;
9312 expr_ty b;
9313 if (
9314 (a = bitwise_and_rule(p)) // bitwise_and
9315 &&
9316 (_literal = _PyPegen_expect_token(p, 19)) // token='&'
9317 &&
9318 (b = shift_expr_rule(p)) // shift_expr
9319 )
9320 {
9321 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9322 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9323 if (_token == NULL) {
9324 D(p->level--);
9325 return NULL;
9326 }
9327 int _end_lineno = _token->end_lineno;
9328 UNUSED(_end_lineno); // Only used by EXTRA macro
9329 int _end_col_offset = _token->end_col_offset;
9330 UNUSED(_end_col_offset); // Only used by EXTRA macro
9331 _res = _Py_BinOp ( a , BitAnd , b , EXTRA );
9332 if (_res == NULL && PyErr_Occurred()) {
9333 p->error_indicator = 1;
9334 D(p->level--);
9335 return NULL;
9336 }
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, "bitwise_and '&' shift_expr"));
9342 }
9343 { // shift_expr
9344 if (p->error_indicator) {
9345 D(p->level--);
9346 return NULL;
9347 }
9348 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9349 expr_ty shift_expr_var;
9350 if (
9351 (shift_expr_var = shift_expr_rule(p)) // shift_expr
9352 )
9353 {
9354 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9355 _res = shift_expr_var;
9356 goto done;
9357 }
9358 p->mark = _mark;
9359 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9360 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
9361 }
9362 _res = NULL;
9363 done:
9364 D(p->level--);
9365 return _res;
9366}
9367
9368// Left-recursive
9369// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
9370static expr_ty shift_expr_raw(Parser *);
9371static expr_ty
9372shift_expr_rule(Parser *p)
9373{
9374 D(p->level++);
9375 expr_ty _res = NULL;
9376 if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
9377 D(p->level--);
9378 return _res;
9379 }
9380 int _mark = p->mark;
9381 int _resmark = p->mark;
9382 while (1) {
9383 int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
9384 if (tmpvar_4) {
9385 D(p->level--);
9386 return _res;
9387 }
9388 p->mark = _mark;
9389 void *_raw = shift_expr_raw(p);
9390 if (_raw == NULL || p->mark <= _resmark)
9391 break;
9392 _resmark = p->mark;
9393 _res = _raw;
9394 }
9395 p->mark = _resmark;
9396 D(p->level--);
9397 return _res;
9398}
9399static expr_ty
9400shift_expr_raw(Parser *p)
9401{
9402 D(p->level++);
9403 if (p->error_indicator) {
9404 D(p->level--);
9405 return NULL;
9406 }
9407 expr_ty _res = NULL;
9408 int _mark = p->mark;
9409 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9410 p->error_indicator = 1;
9411 D(p->level--);
9412 return NULL;
9413 }
9414 int _start_lineno = p->tokens[_mark]->lineno;
9415 UNUSED(_start_lineno); // Only used by EXTRA macro
9416 int _start_col_offset = p->tokens[_mark]->col_offset;
9417 UNUSED(_start_col_offset); // Only used by EXTRA macro
9418 { // shift_expr '<<' sum
9419 if (p->error_indicator) {
9420 D(p->level--);
9421 return NULL;
9422 }
9423 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9424 Token * _literal;
9425 expr_ty a;
9426 expr_ty b;
9427 if (
9428 (a = shift_expr_rule(p)) // shift_expr
9429 &&
9430 (_literal = _PyPegen_expect_token(p, 33)) // token='<<'
9431 &&
9432 (b = sum_rule(p)) // sum
9433 )
9434 {
9435 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9436 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9437 if (_token == NULL) {
9438 D(p->level--);
9439 return NULL;
9440 }
9441 int _end_lineno = _token->end_lineno;
9442 UNUSED(_end_lineno); // Only used by EXTRA macro
9443 int _end_col_offset = _token->end_col_offset;
9444 UNUSED(_end_col_offset); // Only used by EXTRA macro
9445 _res = _Py_BinOp ( a , LShift , b , EXTRA );
9446 if (_res == NULL && PyErr_Occurred()) {
9447 p->error_indicator = 1;
9448 D(p->level--);
9449 return NULL;
9450 }
9451 goto done;
9452 }
9453 p->mark = _mark;
9454 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9455 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
9456 }
9457 { // shift_expr '>>' sum
9458 if (p->error_indicator) {
9459 D(p->level--);
9460 return NULL;
9461 }
9462 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9463 Token * _literal;
9464 expr_ty a;
9465 expr_ty b;
9466 if (
9467 (a = shift_expr_rule(p)) // shift_expr
9468 &&
9469 (_literal = _PyPegen_expect_token(p, 34)) // token='>>'
9470 &&
9471 (b = sum_rule(p)) // sum
9472 )
9473 {
9474 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9475 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9476 if (_token == NULL) {
9477 D(p->level--);
9478 return NULL;
9479 }
9480 int _end_lineno = _token->end_lineno;
9481 UNUSED(_end_lineno); // Only used by EXTRA macro
9482 int _end_col_offset = _token->end_col_offset;
9483 UNUSED(_end_col_offset); // Only used by EXTRA macro
9484 _res = _Py_BinOp ( a , RShift , b , EXTRA );
9485 if (_res == NULL && PyErr_Occurred()) {
9486 p->error_indicator = 1;
9487 D(p->level--);
9488 return NULL;
9489 }
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, "shift_expr '>>' sum"));
9495 }
9496 { // sum
9497 if (p->error_indicator) {
9498 D(p->level--);
9499 return NULL;
9500 }
9501 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
9502 expr_ty sum_var;
9503 if (
9504 (sum_var = sum_rule(p)) // sum
9505 )
9506 {
9507 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
9508 _res = sum_var;
9509 goto done;
9510 }
9511 p->mark = _mark;
9512 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9513 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
9514 }
9515 _res = NULL;
9516 done:
9517 D(p->level--);
9518 return _res;
9519}
9520
9521// Left-recursive
9522// sum: sum '+' term | sum '-' term | term
9523static expr_ty sum_raw(Parser *);
9524static expr_ty
9525sum_rule(Parser *p)
9526{
9527 D(p->level++);
9528 expr_ty _res = NULL;
9529 if (_PyPegen_is_memoized(p, sum_type, &_res)) {
9530 D(p->level--);
9531 return _res;
9532 }
9533 int _mark = p->mark;
9534 int _resmark = p->mark;
9535 while (1) {
9536 int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res);
9537 if (tmpvar_5) {
9538 D(p->level--);
9539 return _res;
9540 }
9541 p->mark = _mark;
9542 void *_raw = sum_raw(p);
9543 if (_raw == NULL || p->mark <= _resmark)
9544 break;
9545 _resmark = p->mark;
9546 _res = _raw;
9547 }
9548 p->mark = _resmark;
9549 D(p->level--);
9550 return _res;
9551}
9552static expr_ty
9553sum_raw(Parser *p)
9554{
9555 D(p->level++);
9556 if (p->error_indicator) {
9557 D(p->level--);
9558 return NULL;
9559 }
9560 expr_ty _res = NULL;
9561 int _mark = p->mark;
9562 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9563 p->error_indicator = 1;
9564 D(p->level--);
9565 return NULL;
9566 }
9567 int _start_lineno = p->tokens[_mark]->lineno;
9568 UNUSED(_start_lineno); // Only used by EXTRA macro
9569 int _start_col_offset = p->tokens[_mark]->col_offset;
9570 UNUSED(_start_col_offset); // Only used by EXTRA macro
9571 { // sum '+' term
9572 if (p->error_indicator) {
9573 D(p->level--);
9574 return NULL;
9575 }
9576 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9577 Token * _literal;
9578 expr_ty a;
9579 expr_ty b;
9580 if (
9581 (a = sum_rule(p)) // sum
9582 &&
9583 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9584 &&
9585 (b = term_rule(p)) // term
9586 )
9587 {
9588 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9589 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9590 if (_token == NULL) {
9591 D(p->level--);
9592 return NULL;
9593 }
9594 int _end_lineno = _token->end_lineno;
9595 UNUSED(_end_lineno); // Only used by EXTRA macro
9596 int _end_col_offset = _token->end_col_offset;
9597 UNUSED(_end_col_offset); // Only used by EXTRA macro
9598 _res = _Py_BinOp ( a , Add , b , EXTRA );
9599 if (_res == NULL && PyErr_Occurred()) {
9600 p->error_indicator = 1;
9601 D(p->level--);
9602 return NULL;
9603 }
9604 goto done;
9605 }
9606 p->mark = _mark;
9607 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9608 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
9609 }
9610 { // sum '-' term
9611 if (p->error_indicator) {
9612 D(p->level--);
9613 return NULL;
9614 }
9615 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9616 Token * _literal;
9617 expr_ty a;
9618 expr_ty b;
9619 if (
9620 (a = sum_rule(p)) // sum
9621 &&
9622 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
9623 &&
9624 (b = term_rule(p)) // term
9625 )
9626 {
9627 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9628 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9629 if (_token == NULL) {
9630 D(p->level--);
9631 return NULL;
9632 }
9633 int _end_lineno = _token->end_lineno;
9634 UNUSED(_end_lineno); // Only used by EXTRA macro
9635 int _end_col_offset = _token->end_col_offset;
9636 UNUSED(_end_col_offset); // Only used by EXTRA macro
9637 _res = _Py_BinOp ( a , Sub , b , EXTRA );
9638 if (_res == NULL && PyErr_Occurred()) {
9639 p->error_indicator = 1;
9640 D(p->level--);
9641 return NULL;
9642 }
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, "sum '-' term"));
9648 }
9649 { // term
9650 if (p->error_indicator) {
9651 D(p->level--);
9652 return NULL;
9653 }
9654 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
9655 expr_ty term_var;
9656 if (
9657 (term_var = term_rule(p)) // term
9658 )
9659 {
9660 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
9661 _res = term_var;
9662 goto done;
9663 }
9664 p->mark = _mark;
9665 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9666 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
9667 }
9668 _res = NULL;
9669 done:
9670 D(p->level--);
9671 return _res;
9672}
9673
9674// Left-recursive
9675// term:
9676// | term '*' factor
9677// | term '/' factor
9678// | term '//' factor
9679// | term '%' factor
9680// | term '@' factor
9681// | factor
9682static expr_ty term_raw(Parser *);
9683static expr_ty
9684term_rule(Parser *p)
9685{
9686 D(p->level++);
9687 expr_ty _res = NULL;
9688 if (_PyPegen_is_memoized(p, term_type, &_res)) {
9689 D(p->level--);
9690 return _res;
9691 }
9692 int _mark = p->mark;
9693 int _resmark = p->mark;
9694 while (1) {
9695 int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res);
9696 if (tmpvar_6) {
9697 D(p->level--);
9698 return _res;
9699 }
9700 p->mark = _mark;
9701 void *_raw = term_raw(p);
9702 if (_raw == NULL || p->mark <= _resmark)
9703 break;
9704 _resmark = p->mark;
9705 _res = _raw;
9706 }
9707 p->mark = _resmark;
9708 D(p->level--);
9709 return _res;
9710}
9711static expr_ty
9712term_raw(Parser *p)
9713{
9714 D(p->level++);
9715 if (p->error_indicator) {
9716 D(p->level--);
9717 return NULL;
9718 }
9719 expr_ty _res = NULL;
9720 int _mark = p->mark;
9721 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9722 p->error_indicator = 1;
9723 D(p->level--);
9724 return NULL;
9725 }
9726 int _start_lineno = p->tokens[_mark]->lineno;
9727 UNUSED(_start_lineno); // Only used by EXTRA macro
9728 int _start_col_offset = p->tokens[_mark]->col_offset;
9729 UNUSED(_start_col_offset); // Only used by EXTRA macro
9730 { // term '*' factor
9731 if (p->error_indicator) {
9732 D(p->level--);
9733 return NULL;
9734 }
9735 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9736 Token * _literal;
9737 expr_ty a;
9738 expr_ty b;
9739 if (
9740 (a = term_rule(p)) // term
9741 &&
9742 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
9743 &&
9744 (b = factor_rule(p)) // factor
9745 )
9746 {
9747 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9748 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9749 if (_token == NULL) {
9750 D(p->level--);
9751 return NULL;
9752 }
9753 int _end_lineno = _token->end_lineno;
9754 UNUSED(_end_lineno); // Only used by EXTRA macro
9755 int _end_col_offset = _token->end_col_offset;
9756 UNUSED(_end_col_offset); // Only used by EXTRA macro
9757 _res = _Py_BinOp ( a , Mult , b , EXTRA );
9758 if (_res == NULL && PyErr_Occurred()) {
9759 p->error_indicator = 1;
9760 D(p->level--);
9761 return NULL;
9762 }
9763 goto done;
9764 }
9765 p->mark = _mark;
9766 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9767 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
9768 }
9769 { // term '/' factor
9770 if (p->error_indicator) {
9771 D(p->level--);
9772 return NULL;
9773 }
9774 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9775 Token * _literal;
9776 expr_ty a;
9777 expr_ty b;
9778 if (
9779 (a = term_rule(p)) // term
9780 &&
9781 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
9782 &&
9783 (b = factor_rule(p)) // factor
9784 )
9785 {
9786 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9787 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9788 if (_token == NULL) {
9789 D(p->level--);
9790 return NULL;
9791 }
9792 int _end_lineno = _token->end_lineno;
9793 UNUSED(_end_lineno); // Only used by EXTRA macro
9794 int _end_col_offset = _token->end_col_offset;
9795 UNUSED(_end_col_offset); // Only used by EXTRA macro
9796 _res = _Py_BinOp ( a , Div , b , EXTRA );
9797 if (_res == NULL && PyErr_Occurred()) {
9798 p->error_indicator = 1;
9799 D(p->level--);
9800 return NULL;
9801 }
9802 goto done;
9803 }
9804 p->mark = _mark;
9805 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9806 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
9807 }
9808 { // term '//' factor
9809 if (p->error_indicator) {
9810 D(p->level--);
9811 return NULL;
9812 }
9813 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9814 Token * _literal;
9815 expr_ty a;
9816 expr_ty b;
9817 if (
9818 (a = term_rule(p)) // term
9819 &&
9820 (_literal = _PyPegen_expect_token(p, 47)) // token='//'
9821 &&
9822 (b = factor_rule(p)) // factor
9823 )
9824 {
9825 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9826 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9827 if (_token == NULL) {
9828 D(p->level--);
9829 return NULL;
9830 }
9831 int _end_lineno = _token->end_lineno;
9832 UNUSED(_end_lineno); // Only used by EXTRA macro
9833 int _end_col_offset = _token->end_col_offset;
9834 UNUSED(_end_col_offset); // Only used by EXTRA macro
9835 _res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
9836 if (_res == NULL && PyErr_Occurred()) {
9837 p->error_indicator = 1;
9838 D(p->level--);
9839 return NULL;
9840 }
9841 goto done;
9842 }
9843 p->mark = _mark;
9844 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9845 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
9846 }
9847 { // term '%' factor
9848 if (p->error_indicator) {
9849 D(p->level--);
9850 return NULL;
9851 }
9852 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9853 Token * _literal;
9854 expr_ty a;
9855 expr_ty b;
9856 if (
9857 (a = term_rule(p)) // term
9858 &&
9859 (_literal = _PyPegen_expect_token(p, 24)) // token='%'
9860 &&
9861 (b = factor_rule(p)) // factor
9862 )
9863 {
9864 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9865 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9866 if (_token == NULL) {
9867 D(p->level--);
9868 return NULL;
9869 }
9870 int _end_lineno = _token->end_lineno;
9871 UNUSED(_end_lineno); // Only used by EXTRA macro
9872 int _end_col_offset = _token->end_col_offset;
9873 UNUSED(_end_col_offset); // Only used by EXTRA macro
9874 _res = _Py_BinOp ( a , Mod , b , EXTRA );
9875 if (_res == NULL && PyErr_Occurred()) {
9876 p->error_indicator = 1;
9877 D(p->level--);
9878 return NULL;
9879 }
9880 goto done;
9881 }
9882 p->mark = _mark;
9883 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9884 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
9885 }
9886 { // term '@' factor
9887 if (p->error_indicator) {
9888 D(p->level--);
9889 return NULL;
9890 }
9891 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9892 Token * _literal;
9893 expr_ty a;
9894 expr_ty b;
9895 if (
9896 (a = term_rule(p)) // term
9897 &&
9898 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
9899 &&
9900 (b = factor_rule(p)) // factor
9901 )
9902 {
9903 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9904 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9905 if (_token == NULL) {
9906 D(p->level--);
9907 return NULL;
9908 }
9909 int _end_lineno = _token->end_lineno;
9910 UNUSED(_end_lineno); // Only used by EXTRA macro
9911 int _end_col_offset = _token->end_col_offset;
9912 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03009913 _res = CHECK_VERSION ( expr_ty , 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009914 if (_res == NULL && PyErr_Occurred()) {
9915 p->error_indicator = 1;
9916 D(p->level--);
9917 return NULL;
9918 }
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, "term '@' factor"));
9924 }
9925 { // factor
9926 if (p->error_indicator) {
9927 D(p->level--);
9928 return NULL;
9929 }
9930 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
9931 expr_ty factor_var;
9932 if (
9933 (factor_var = factor_rule(p)) // factor
9934 )
9935 {
9936 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
9937 _res = factor_var;
9938 goto done;
9939 }
9940 p->mark = _mark;
9941 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9942 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
9943 }
9944 _res = NULL;
9945 done:
9946 D(p->level--);
9947 return _res;
9948}
9949
9950// factor: '+' factor | '-' factor | '~' factor | power
9951static expr_ty
9952factor_rule(Parser *p)
9953{
9954 D(p->level++);
9955 if (p->error_indicator) {
9956 D(p->level--);
9957 return NULL;
9958 }
9959 expr_ty _res = NULL;
9960 if (_PyPegen_is_memoized(p, factor_type, &_res)) {
9961 D(p->level--);
9962 return _res;
9963 }
9964 int _mark = p->mark;
9965 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9966 p->error_indicator = 1;
9967 D(p->level--);
9968 return NULL;
9969 }
9970 int _start_lineno = p->tokens[_mark]->lineno;
9971 UNUSED(_start_lineno); // Only used by EXTRA macro
9972 int _start_col_offset = p->tokens[_mark]->col_offset;
9973 UNUSED(_start_col_offset); // Only used by EXTRA macro
9974 { // '+' factor
9975 if (p->error_indicator) {
9976 D(p->level--);
9977 return NULL;
9978 }
9979 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9980 Token * _literal;
9981 expr_ty a;
9982 if (
9983 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9984 &&
9985 (a = factor_rule(p)) // factor
9986 )
9987 {
9988 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9989 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9990 if (_token == NULL) {
9991 D(p->level--);
9992 return NULL;
9993 }
9994 int _end_lineno = _token->end_lineno;
9995 UNUSED(_end_lineno); // Only used by EXTRA macro
9996 int _end_col_offset = _token->end_col_offset;
9997 UNUSED(_end_col_offset); // Only used by EXTRA macro
9998 _res = _Py_UnaryOp ( UAdd , a , EXTRA );
9999 if (_res == NULL && PyErr_Occurred()) {
10000 p->error_indicator = 1;
10001 D(p->level--);
10002 return NULL;
10003 }
10004 goto done;
10005 }
10006 p->mark = _mark;
10007 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10008 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
10009 }
10010 { // '-' factor
10011 if (p->error_indicator) {
10012 D(p->level--);
10013 return NULL;
10014 }
10015 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10016 Token * _literal;
10017 expr_ty a;
10018 if (
10019 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
10020 &&
10021 (a = factor_rule(p)) // factor
10022 )
10023 {
10024 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10025 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10026 if (_token == NULL) {
10027 D(p->level--);
10028 return NULL;
10029 }
10030 int _end_lineno = _token->end_lineno;
10031 UNUSED(_end_lineno); // Only used by EXTRA macro
10032 int _end_col_offset = _token->end_col_offset;
10033 UNUSED(_end_col_offset); // Only used by EXTRA macro
10034 _res = _Py_UnaryOp ( USub , a , EXTRA );
10035 if (_res == NULL && PyErr_Occurred()) {
10036 p->error_indicator = 1;
10037 D(p->level--);
10038 return NULL;
10039 }
10040 goto done;
10041 }
10042 p->mark = _mark;
10043 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10044 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
10045 }
10046 { // '~' factor
10047 if (p->error_indicator) {
10048 D(p->level--);
10049 return NULL;
10050 }
10051 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10052 Token * _literal;
10053 expr_ty a;
10054 if (
10055 (_literal = _PyPegen_expect_token(p, 31)) // token='~'
10056 &&
10057 (a = factor_rule(p)) // factor
10058 )
10059 {
10060 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10061 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10062 if (_token == NULL) {
10063 D(p->level--);
10064 return NULL;
10065 }
10066 int _end_lineno = _token->end_lineno;
10067 UNUSED(_end_lineno); // Only used by EXTRA macro
10068 int _end_col_offset = _token->end_col_offset;
10069 UNUSED(_end_col_offset); // Only used by EXTRA macro
10070 _res = _Py_UnaryOp ( Invert , a , EXTRA );
10071 if (_res == NULL && PyErr_Occurred()) {
10072 p->error_indicator = 1;
10073 D(p->level--);
10074 return NULL;
10075 }
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, "'~' factor"));
10081 }
10082 { // power
10083 if (p->error_indicator) {
10084 D(p->level--);
10085 return NULL;
10086 }
10087 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
10088 expr_ty power_var;
10089 if (
10090 (power_var = power_rule(p)) // power
10091 )
10092 {
10093 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
10094 _res = power_var;
10095 goto done;
10096 }
10097 p->mark = _mark;
10098 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10099 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
10100 }
10101 _res = NULL;
10102 done:
10103 _PyPegen_insert_memo(p, _mark, factor_type, _res);
10104 D(p->level--);
10105 return _res;
10106}
10107
10108// power: await_primary '**' factor | await_primary
10109static expr_ty
10110power_rule(Parser *p)
10111{
10112 D(p->level++);
10113 if (p->error_indicator) {
10114 D(p->level--);
10115 return NULL;
10116 }
10117 expr_ty _res = NULL;
10118 int _mark = p->mark;
10119 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10120 p->error_indicator = 1;
10121 D(p->level--);
10122 return NULL;
10123 }
10124 int _start_lineno = p->tokens[_mark]->lineno;
10125 UNUSED(_start_lineno); // Only used by EXTRA macro
10126 int _start_col_offset = p->tokens[_mark]->col_offset;
10127 UNUSED(_start_col_offset); // Only used by EXTRA macro
10128 { // await_primary '**' factor
10129 if (p->error_indicator) {
10130 D(p->level--);
10131 return NULL;
10132 }
10133 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10134 Token * _literal;
10135 expr_ty a;
10136 expr_ty b;
10137 if (
10138 (a = await_primary_rule(p)) // await_primary
10139 &&
10140 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
10141 &&
10142 (b = factor_rule(p)) // factor
10143 )
10144 {
10145 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10146 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10147 if (_token == NULL) {
10148 D(p->level--);
10149 return NULL;
10150 }
10151 int _end_lineno = _token->end_lineno;
10152 UNUSED(_end_lineno); // Only used by EXTRA macro
10153 int _end_col_offset = _token->end_col_offset;
10154 UNUSED(_end_col_offset); // Only used by EXTRA macro
10155 _res = _Py_BinOp ( a , Pow , b , EXTRA );
10156 if (_res == NULL && PyErr_Occurred()) {
10157 p->error_indicator = 1;
10158 D(p->level--);
10159 return NULL;
10160 }
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 '**' factor"));
10166 }
10167 { // await_primary
10168 if (p->error_indicator) {
10169 D(p->level--);
10170 return NULL;
10171 }
10172 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
10173 expr_ty await_primary_var;
10174 if (
10175 (await_primary_var = await_primary_rule(p)) // await_primary
10176 )
10177 {
10178 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
10179 _res = await_primary_var;
10180 goto done;
10181 }
10182 p->mark = _mark;
10183 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10184 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
10185 }
10186 _res = NULL;
10187 done:
10188 D(p->level--);
10189 return _res;
10190}
10191
10192// await_primary: AWAIT primary | primary
10193static expr_ty
10194await_primary_rule(Parser *p)
10195{
10196 D(p->level++);
10197 if (p->error_indicator) {
10198 D(p->level--);
10199 return NULL;
10200 }
10201 expr_ty _res = NULL;
10202 if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
10203 D(p->level--);
10204 return _res;
10205 }
10206 int _mark = p->mark;
10207 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10208 p->error_indicator = 1;
10209 D(p->level--);
10210 return NULL;
10211 }
10212 int _start_lineno = p->tokens[_mark]->lineno;
10213 UNUSED(_start_lineno); // Only used by EXTRA macro
10214 int _start_col_offset = p->tokens[_mark]->col_offset;
10215 UNUSED(_start_col_offset); // Only used by EXTRA macro
10216 { // AWAIT primary
10217 if (p->error_indicator) {
10218 D(p->level--);
10219 return NULL;
10220 }
10221 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10222 expr_ty a;
10223 Token * await_var;
10224 if (
10225 (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT'
10226 &&
10227 (a = primary_rule(p)) // primary
10228 )
10229 {
10230 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10231 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10232 if (_token == NULL) {
10233 D(p->level--);
10234 return NULL;
10235 }
10236 int _end_lineno = _token->end_lineno;
10237 UNUSED(_end_lineno); // Only used by EXTRA macro
10238 int _end_col_offset = _token->end_col_offset;
10239 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030010240 _res = CHECK_VERSION ( expr_ty , 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010241 if (_res == NULL && PyErr_Occurred()) {
10242 p->error_indicator = 1;
10243 D(p->level--);
10244 return NULL;
10245 }
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, "AWAIT primary"));
10251 }
10252 { // primary
10253 if (p->error_indicator) {
10254 D(p->level--);
10255 return NULL;
10256 }
10257 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
10258 expr_ty primary_var;
10259 if (
10260 (primary_var = primary_rule(p)) // primary
10261 )
10262 {
10263 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
10264 _res = primary_var;
10265 goto done;
10266 }
10267 p->mark = _mark;
10268 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10269 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
10270 }
10271 _res = NULL;
10272 done:
10273 _PyPegen_insert_memo(p, _mark, await_primary_type, _res);
10274 D(p->level--);
10275 return _res;
10276}
10277
10278// Left-recursive
10279// primary:
Lysandros Nikolaou15acc4e2020-10-27 20:54:20 +020010280// | invalid_primary
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010281// | primary '.' NAME
10282// | primary genexp
10283// | primary '(' arguments? ')'
10284// | primary '[' slices ']'
10285// | atom
10286static expr_ty primary_raw(Parser *);
10287static expr_ty
10288primary_rule(Parser *p)
10289{
10290 D(p->level++);
10291 expr_ty _res = NULL;
10292 if (_PyPegen_is_memoized(p, primary_type, &_res)) {
10293 D(p->level--);
10294 return _res;
10295 }
10296 int _mark = p->mark;
10297 int _resmark = p->mark;
10298 while (1) {
10299 int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res);
10300 if (tmpvar_7) {
10301 D(p->level--);
10302 return _res;
10303 }
10304 p->mark = _mark;
10305 void *_raw = primary_raw(p);
10306 if (_raw == NULL || p->mark <= _resmark)
10307 break;
10308 _resmark = p->mark;
10309 _res = _raw;
10310 }
10311 p->mark = _resmark;
10312 D(p->level--);
10313 return _res;
10314}
10315static expr_ty
10316primary_raw(Parser *p)
10317{
10318 D(p->level++);
10319 if (p->error_indicator) {
10320 D(p->level--);
10321 return NULL;
10322 }
10323 expr_ty _res = NULL;
10324 int _mark = p->mark;
10325 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10326 p->error_indicator = 1;
10327 D(p->level--);
10328 return NULL;
10329 }
10330 int _start_lineno = p->tokens[_mark]->lineno;
10331 UNUSED(_start_lineno); // Only used by EXTRA macro
10332 int _start_col_offset = p->tokens[_mark]->col_offset;
10333 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou15acc4e2020-10-27 20:54:20 +020010334 if (p->call_invalid_rules) { // invalid_primary
10335 if (p->error_indicator) {
10336 D(p->level--);
10337 return NULL;
10338 }
10339 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_primary"));
10340 void *invalid_primary_var;
10341 if (
10342 (invalid_primary_var = invalid_primary_rule(p)) // invalid_primary
10343 )
10344 {
10345 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_primary"));
10346 _res = invalid_primary_var;
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, "invalid_primary"));
10352 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010353 { // primary '.' NAME
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 '.' NAME"));
10359 Token * _literal;
10360 expr_ty a;
10361 expr_ty b;
10362 if (
10363 (a = primary_rule(p)) // primary
10364 &&
10365 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
10366 &&
10367 (b = _PyPegen_name_token(p)) // NAME
10368 )
10369 {
10370 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10371 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10372 if (_token == NULL) {
10373 D(p->level--);
10374 return NULL;
10375 }
10376 int _end_lineno = _token->end_lineno;
10377 UNUSED(_end_lineno); // Only used by EXTRA macro
10378 int _end_col_offset = _token->end_col_offset;
10379 UNUSED(_end_col_offset); // Only used by EXTRA macro
10380 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
10381 if (_res == NULL && PyErr_Occurred()) {
10382 p->error_indicator = 1;
10383 D(p->level--);
10384 return NULL;
10385 }
10386 goto done;
10387 }
10388 p->mark = _mark;
10389 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10390 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
10391 }
10392 { // primary genexp
10393 if (p->error_indicator) {
10394 D(p->level--);
10395 return NULL;
10396 }
10397 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10398 expr_ty a;
10399 expr_ty b;
10400 if (
10401 (a = primary_rule(p)) // primary
10402 &&
10403 (b = genexp_rule(p)) // genexp
10404 )
10405 {
10406 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10407 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10408 if (_token == NULL) {
10409 D(p->level--);
10410 return NULL;
10411 }
10412 int _end_lineno = _token->end_lineno;
10413 UNUSED(_end_lineno); // Only used by EXTRA macro
10414 int _end_col_offset = _token->end_col_offset;
10415 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030010416 _res = _Py_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010417 if (_res == NULL && PyErr_Occurred()) {
10418 p->error_indicator = 1;
10419 D(p->level--);
10420 return NULL;
10421 }
10422 goto done;
10423 }
10424 p->mark = _mark;
10425 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10426 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
10427 }
10428 { // primary '(' arguments? ')'
10429 if (p->error_indicator) {
10430 D(p->level--);
10431 return NULL;
10432 }
10433 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10434 Token * _literal;
10435 Token * _literal_1;
10436 expr_ty a;
10437 void *b;
10438 if (
10439 (a = primary_rule(p)) // primary
10440 &&
10441 (_literal = _PyPegen_expect_token(p, 7)) // token='('
10442 &&
10443 (b = arguments_rule(p), 1) // arguments?
10444 &&
10445 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
10446 )
10447 {
10448 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10449 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10450 if (_token == NULL) {
10451 D(p->level--);
10452 return NULL;
10453 }
10454 int _end_lineno = _token->end_lineno;
10455 UNUSED(_end_lineno); // Only used by EXTRA macro
10456 int _end_col_offset = _token->end_col_offset;
10457 UNUSED(_end_col_offset); // Only used by EXTRA macro
10458 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
10459 if (_res == NULL && PyErr_Occurred()) {
10460 p->error_indicator = 1;
10461 D(p->level--);
10462 return NULL;
10463 }
10464 goto done;
10465 }
10466 p->mark = _mark;
10467 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10468 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
10469 }
10470 { // primary '[' slices ']'
10471 if (p->error_indicator) {
10472 D(p->level--);
10473 return NULL;
10474 }
10475 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10476 Token * _literal;
10477 Token * _literal_1;
10478 expr_ty a;
10479 expr_ty b;
10480 if (
10481 (a = primary_rule(p)) // primary
10482 &&
10483 (_literal = _PyPegen_expect_token(p, 9)) // token='['
10484 &&
10485 (b = slices_rule(p)) // slices
10486 &&
10487 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
10488 )
10489 {
10490 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10491 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10492 if (_token == NULL) {
10493 D(p->level--);
10494 return NULL;
10495 }
10496 int _end_lineno = _token->end_lineno;
10497 UNUSED(_end_lineno); // Only used by EXTRA macro
10498 int _end_col_offset = _token->end_col_offset;
10499 UNUSED(_end_col_offset); // Only used by EXTRA macro
10500 _res = _Py_Subscript ( a , b , Load , EXTRA );
10501 if (_res == NULL && PyErr_Occurred()) {
10502 p->error_indicator = 1;
10503 D(p->level--);
10504 return NULL;
10505 }
10506 goto done;
10507 }
10508 p->mark = _mark;
10509 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10510 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
10511 }
10512 { // atom
10513 if (p->error_indicator) {
10514 D(p->level--);
10515 return NULL;
10516 }
10517 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
10518 expr_ty atom_var;
10519 if (
10520 (atom_var = atom_rule(p)) // atom
10521 )
10522 {
10523 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
10524 _res = atom_var;
10525 goto done;
10526 }
10527 p->mark = _mark;
10528 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10529 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
10530 }
10531 _res = NULL;
10532 done:
10533 D(p->level--);
10534 return _res;
10535}
10536
10537// slices: slice !',' | ','.slice+ ','?
10538static expr_ty
10539slices_rule(Parser *p)
10540{
10541 D(p->level++);
10542 if (p->error_indicator) {
10543 D(p->level--);
10544 return NULL;
10545 }
10546 expr_ty _res = NULL;
10547 int _mark = p->mark;
10548 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10549 p->error_indicator = 1;
10550 D(p->level--);
10551 return NULL;
10552 }
10553 int _start_lineno = p->tokens[_mark]->lineno;
10554 UNUSED(_start_lineno); // Only used by EXTRA macro
10555 int _start_col_offset = p->tokens[_mark]->col_offset;
10556 UNUSED(_start_col_offset); // Only used by EXTRA macro
10557 { // slice !','
10558 if (p->error_indicator) {
10559 D(p->level--);
10560 return NULL;
10561 }
10562 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
10563 expr_ty a;
10564 if (
10565 (a = slice_rule(p)) // slice
10566 &&
10567 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
10568 )
10569 {
10570 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
10571 _res = a;
10572 if (_res == NULL && PyErr_Occurred()) {
10573 p->error_indicator = 1;
10574 D(p->level--);
10575 return NULL;
10576 }
10577 goto done;
10578 }
10579 p->mark = _mark;
10580 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10581 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
10582 }
10583 { // ','.slice+ ','?
10584 if (p->error_indicator) {
10585 D(p->level--);
10586 return NULL;
10587 }
10588 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10589 void *_opt_var;
10590 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010010591 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010592 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010010593 (a = (asdl_expr_seq*)_gather_94_rule(p)) // ','.slice+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010594 &&
10595 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
10596 )
10597 {
10598 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10599 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10600 if (_token == NULL) {
10601 D(p->level--);
10602 return NULL;
10603 }
10604 int _end_lineno = _token->end_lineno;
10605 UNUSED(_end_lineno); // Only used by EXTRA macro
10606 int _end_col_offset = _token->end_col_offset;
10607 UNUSED(_end_col_offset); // Only used by EXTRA macro
10608 _res = _Py_Tuple ( a , Load , EXTRA );
10609 if (_res == NULL && PyErr_Occurred()) {
10610 p->error_indicator = 1;
10611 D(p->level--);
10612 return NULL;
10613 }
10614 goto done;
10615 }
10616 p->mark = _mark;
10617 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10618 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?"));
10619 }
10620 _res = NULL;
10621 done:
10622 D(p->level--);
10623 return _res;
10624}
10625
10626// slice: expression? ':' expression? [':' expression?] | expression
10627static expr_ty
10628slice_rule(Parser *p)
10629{
10630 D(p->level++);
10631 if (p->error_indicator) {
10632 D(p->level--);
10633 return NULL;
10634 }
10635 expr_ty _res = NULL;
10636 int _mark = p->mark;
10637 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10638 p->error_indicator = 1;
10639 D(p->level--);
10640 return NULL;
10641 }
10642 int _start_lineno = p->tokens[_mark]->lineno;
10643 UNUSED(_start_lineno); // Only used by EXTRA macro
10644 int _start_col_offset = p->tokens[_mark]->col_offset;
10645 UNUSED(_start_col_offset); // Only used by EXTRA macro
10646 { // expression? ':' expression? [':' expression?]
10647 if (p->error_indicator) {
10648 D(p->level--);
10649 return NULL;
10650 }
10651 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10652 Token * _literal;
10653 void *a;
10654 void *b;
10655 void *c;
10656 if (
10657 (a = expression_rule(p), 1) // expression?
10658 &&
10659 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
10660 &&
10661 (b = expression_rule(p), 1) // expression?
10662 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010663 (c = _tmp_96_rule(p), 1) // [':' expression?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010664 )
10665 {
10666 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10667 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10668 if (_token == NULL) {
10669 D(p->level--);
10670 return NULL;
10671 }
10672 int _end_lineno = _token->end_lineno;
10673 UNUSED(_end_lineno); // Only used by EXTRA macro
10674 int _end_col_offset = _token->end_col_offset;
10675 UNUSED(_end_col_offset); // Only used by EXTRA macro
10676 _res = _Py_Slice ( a , b , c , EXTRA );
10677 if (_res == NULL && PyErr_Occurred()) {
10678 p->error_indicator = 1;
10679 D(p->level--);
10680 return NULL;
10681 }
10682 goto done;
10683 }
10684 p->mark = _mark;
10685 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10686 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10687 }
10688 { // expression
10689 if (p->error_indicator) {
10690 D(p->level--);
10691 return NULL;
10692 }
10693 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
10694 expr_ty a;
10695 if (
10696 (a = expression_rule(p)) // expression
10697 )
10698 {
10699 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
10700 _res = a;
10701 if (_res == NULL && PyErr_Occurred()) {
10702 p->error_indicator = 1;
10703 D(p->level--);
10704 return NULL;
10705 }
10706 goto done;
10707 }
10708 p->mark = _mark;
10709 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10710 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
10711 }
10712 _res = NULL;
10713 done:
10714 D(p->level--);
10715 return _res;
10716}
10717
10718// atom:
10719// | NAME
10720// | 'True'
10721// | 'False'
10722// | 'None'
10723// | &STRING strings
10724// | NUMBER
10725// | &'(' (tuple | group | genexp)
10726// | &'[' (list | listcomp)
10727// | &'{' (dict | set | dictcomp | setcomp)
10728// | '...'
10729static expr_ty
10730atom_rule(Parser *p)
10731{
10732 D(p->level++);
10733 if (p->error_indicator) {
10734 D(p->level--);
10735 return NULL;
10736 }
10737 expr_ty _res = NULL;
10738 int _mark = p->mark;
10739 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10740 p->error_indicator = 1;
10741 D(p->level--);
10742 return NULL;
10743 }
10744 int _start_lineno = p->tokens[_mark]->lineno;
10745 UNUSED(_start_lineno); // Only used by EXTRA macro
10746 int _start_col_offset = p->tokens[_mark]->col_offset;
10747 UNUSED(_start_col_offset); // Only used by EXTRA macro
10748 { // NAME
10749 if (p->error_indicator) {
10750 D(p->level--);
10751 return NULL;
10752 }
10753 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
10754 expr_ty name_var;
10755 if (
10756 (name_var = _PyPegen_name_token(p)) // NAME
10757 )
10758 {
10759 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
10760 _res = name_var;
10761 goto done;
10762 }
10763 p->mark = _mark;
10764 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10765 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
10766 }
10767 { // 'True'
10768 if (p->error_indicator) {
10769 D(p->level--);
10770 return NULL;
10771 }
10772 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
10773 Token * _keyword;
10774 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010775 (_keyword = _PyPegen_expect_token(p, 528)) // token='True'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010776 )
10777 {
10778 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
10779 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10780 if (_token == NULL) {
10781 D(p->level--);
10782 return NULL;
10783 }
10784 int _end_lineno = _token->end_lineno;
10785 UNUSED(_end_lineno); // Only used by EXTRA macro
10786 int _end_col_offset = _token->end_col_offset;
10787 UNUSED(_end_col_offset); // Only used by EXTRA macro
10788 _res = _Py_Constant ( Py_True , NULL , EXTRA );
10789 if (_res == NULL && PyErr_Occurred()) {
10790 p->error_indicator = 1;
10791 D(p->level--);
10792 return NULL;
10793 }
10794 goto done;
10795 }
10796 p->mark = _mark;
10797 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10798 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
10799 }
10800 { // 'False'
10801 if (p->error_indicator) {
10802 D(p->level--);
10803 return NULL;
10804 }
10805 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
10806 Token * _keyword;
10807 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010808 (_keyword = _PyPegen_expect_token(p, 529)) // token='False'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010809 )
10810 {
10811 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
10812 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10813 if (_token == NULL) {
10814 D(p->level--);
10815 return NULL;
10816 }
10817 int _end_lineno = _token->end_lineno;
10818 UNUSED(_end_lineno); // Only used by EXTRA macro
10819 int _end_col_offset = _token->end_col_offset;
10820 UNUSED(_end_col_offset); // Only used by EXTRA macro
10821 _res = _Py_Constant ( Py_False , NULL , EXTRA );
10822 if (_res == NULL && PyErr_Occurred()) {
10823 p->error_indicator = 1;
10824 D(p->level--);
10825 return NULL;
10826 }
10827 goto done;
10828 }
10829 p->mark = _mark;
10830 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10831 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
10832 }
10833 { // 'None'
10834 if (p->error_indicator) {
10835 D(p->level--);
10836 return NULL;
10837 }
10838 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
10839 Token * _keyword;
10840 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010841 (_keyword = _PyPegen_expect_token(p, 530)) // token='None'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010842 )
10843 {
10844 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
10845 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10846 if (_token == NULL) {
10847 D(p->level--);
10848 return NULL;
10849 }
10850 int _end_lineno = _token->end_lineno;
10851 UNUSED(_end_lineno); // Only used by EXTRA macro
10852 int _end_col_offset = _token->end_col_offset;
10853 UNUSED(_end_col_offset); // Only used by EXTRA macro
10854 _res = _Py_Constant ( Py_None , NULL , EXTRA );
10855 if (_res == NULL && PyErr_Occurred()) {
10856 p->error_indicator = 1;
10857 D(p->level--);
10858 return NULL;
10859 }
10860 goto done;
10861 }
10862 p->mark = _mark;
10863 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10864 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
10865 }
10866 { // &STRING strings
10867 if (p->error_indicator) {
10868 D(p->level--);
10869 return NULL;
10870 }
10871 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10872 expr_ty strings_var;
10873 if (
10874 _PyPegen_lookahead(1, _PyPegen_string_token, p)
10875 &&
10876 (strings_var = strings_rule(p)) // strings
10877 )
10878 {
10879 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10880 _res = strings_var;
10881 goto done;
10882 }
10883 p->mark = _mark;
10884 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10885 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings"));
10886 }
10887 { // NUMBER
10888 if (p->error_indicator) {
10889 D(p->level--);
10890 return NULL;
10891 }
10892 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10893 expr_ty number_var;
10894 if (
10895 (number_var = _PyPegen_number_token(p)) // NUMBER
10896 )
10897 {
10898 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10899 _res = number_var;
10900 goto done;
10901 }
10902 p->mark = _mark;
10903 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10904 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
10905 }
10906 { // &'(' (tuple | group | genexp)
10907 if (p->error_indicator) {
10908 D(p->level--);
10909 return NULL;
10910 }
10911 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010912 void *_tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010913 if (
10914 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='('
10915 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010916 (_tmp_97_var = _tmp_97_rule(p)) // tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010917 )
10918 {
10919 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 +030010920 _res = _tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010921 goto done;
10922 }
10923 p->mark = _mark;
10924 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10925 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
10926 }
10927 { // &'[' (list | listcomp)
10928 if (p->error_indicator) {
10929 D(p->level--);
10930 return NULL;
10931 }
10932 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010933 void *_tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010934 if (
10935 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='['
10936 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010937 (_tmp_98_var = _tmp_98_rule(p)) // list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010938 )
10939 {
10940 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010941 _res = _tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010942 goto done;
10943 }
10944 p->mark = _mark;
10945 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10946 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
10947 }
10948 { // &'{' (dict | set | dictcomp | setcomp)
10949 if (p->error_indicator) {
10950 D(p->level--);
10951 return NULL;
10952 }
10953 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 +030010954 void *_tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010955 if (
10956 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{'
10957 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010958 (_tmp_99_var = _tmp_99_rule(p)) // dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010959 )
10960 {
10961 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 +030010962 _res = _tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010963 goto done;
10964 }
10965 p->mark = _mark;
10966 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10967 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
10968 }
10969 { // '...'
10970 if (p->error_indicator) {
10971 D(p->level--);
10972 return NULL;
10973 }
10974 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
10975 Token * _literal;
10976 if (
10977 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
10978 )
10979 {
10980 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
10981 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10982 if (_token == NULL) {
10983 D(p->level--);
10984 return NULL;
10985 }
10986 int _end_lineno = _token->end_lineno;
10987 UNUSED(_end_lineno); // Only used by EXTRA macro
10988 int _end_col_offset = _token->end_col_offset;
10989 UNUSED(_end_col_offset); // Only used by EXTRA macro
10990 _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
10991 if (_res == NULL && PyErr_Occurred()) {
10992 p->error_indicator = 1;
10993 D(p->level--);
10994 return NULL;
10995 }
10996 goto done;
10997 }
10998 p->mark = _mark;
10999 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
11000 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
11001 }
11002 _res = NULL;
11003 done:
11004 D(p->level--);
11005 return _res;
11006}
11007
11008// strings: STRING+
11009static expr_ty
11010strings_rule(Parser *p)
11011{
11012 D(p->level++);
11013 if (p->error_indicator) {
11014 D(p->level--);
11015 return NULL;
11016 }
11017 expr_ty _res = NULL;
11018 if (_PyPegen_is_memoized(p, strings_type, &_res)) {
11019 D(p->level--);
11020 return _res;
11021 }
11022 int _mark = p->mark;
11023 { // STRING+
11024 if (p->error_indicator) {
11025 D(p->level--);
11026 return NULL;
11027 }
11028 D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
11029 asdl_seq * a;
11030 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011031 (a = _loop1_100_rule(p)) // STRING+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011032 )
11033 {
11034 D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
11035 _res = _PyPegen_concatenate_strings ( p , a );
11036 if (_res == NULL && PyErr_Occurred()) {
11037 p->error_indicator = 1;
11038 D(p->level--);
11039 return NULL;
11040 }
11041 goto done;
11042 }
11043 p->mark = _mark;
11044 D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
11045 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
11046 }
11047 _res = NULL;
11048 done:
11049 _PyPegen_insert_memo(p, _mark, strings_type, _res);
11050 D(p->level--);
11051 return _res;
11052}
11053
11054// list: '[' star_named_expressions? ']'
11055static expr_ty
11056list_rule(Parser *p)
11057{
11058 D(p->level++);
11059 if (p->error_indicator) {
11060 D(p->level--);
11061 return NULL;
11062 }
11063 expr_ty _res = NULL;
11064 int _mark = p->mark;
11065 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11066 p->error_indicator = 1;
11067 D(p->level--);
11068 return NULL;
11069 }
11070 int _start_lineno = p->tokens[_mark]->lineno;
11071 UNUSED(_start_lineno); // Only used by EXTRA macro
11072 int _start_col_offset = p->tokens[_mark]->col_offset;
11073 UNUSED(_start_col_offset); // Only used by EXTRA macro
11074 { // '[' star_named_expressions? ']'
11075 if (p->error_indicator) {
11076 D(p->level--);
11077 return NULL;
11078 }
11079 D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11080 Token * _literal;
11081 Token * _literal_1;
11082 void *a;
11083 if (
11084 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11085 &&
11086 (a = star_named_expressions_rule(p), 1) // star_named_expressions?
11087 &&
11088 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11089 )
11090 {
11091 D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11092 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11093 if (_token == NULL) {
11094 D(p->level--);
11095 return NULL;
11096 }
11097 int _end_lineno = _token->end_lineno;
11098 UNUSED(_end_lineno); // Only used by EXTRA macro
11099 int _end_col_offset = _token->end_col_offset;
11100 UNUSED(_end_col_offset); // Only used by EXTRA macro
11101 _res = _Py_List ( a , Load , EXTRA );
11102 if (_res == NULL && PyErr_Occurred()) {
11103 p->error_indicator = 1;
11104 D(p->level--);
11105 return NULL;
11106 }
11107 goto done;
11108 }
11109 p->mark = _mark;
11110 D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
11111 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
11112 }
11113 _res = NULL;
11114 done:
11115 D(p->level--);
11116 return _res;
11117}
11118
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011119// listcomp: '[' named_expression ~ for_if_clauses ']' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011120static expr_ty
11121listcomp_rule(Parser *p)
11122{
11123 D(p->level++);
11124 if (p->error_indicator) {
11125 D(p->level--);
11126 return NULL;
11127 }
11128 expr_ty _res = NULL;
11129 int _mark = p->mark;
11130 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11131 p->error_indicator = 1;
11132 D(p->level--);
11133 return NULL;
11134 }
11135 int _start_lineno = p->tokens[_mark]->lineno;
11136 UNUSED(_start_lineno); // Only used by EXTRA macro
11137 int _start_col_offset = p->tokens[_mark]->col_offset;
11138 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011139 { // '[' named_expression ~ for_if_clauses ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011140 if (p->error_indicator) {
11141 D(p->level--);
11142 return NULL;
11143 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011144 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11145 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011146 Token * _literal;
11147 Token * _literal_1;
11148 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011149 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011150 if (
11151 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11152 &&
11153 (a = named_expression_rule(p)) // named_expression
11154 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011155 (_cut_var = 1)
11156 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011157 (b = for_if_clauses_rule(p)) // for_if_clauses
11158 &&
11159 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11160 )
11161 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011162 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 +010011163 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11164 if (_token == NULL) {
11165 D(p->level--);
11166 return NULL;
11167 }
11168 int _end_lineno = _token->end_lineno;
11169 UNUSED(_end_lineno); // Only used by EXTRA macro
11170 int _end_col_offset = _token->end_col_offset;
11171 UNUSED(_end_col_offset); // Only used by EXTRA macro
11172 _res = _Py_ListComp ( a , b , EXTRA );
11173 if (_res == NULL && PyErr_Occurred()) {
11174 p->error_indicator = 1;
11175 D(p->level--);
11176 return NULL;
11177 }
11178 goto done;
11179 }
11180 p->mark = _mark;
11181 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011182 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11183 if (_cut_var) {
11184 D(p->level--);
11185 return NULL;
11186 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011187 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011188 if (p->call_invalid_rules) { // invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011189 if (p->error_indicator) {
11190 D(p->level--);
11191 return NULL;
11192 }
11193 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11194 void *invalid_comprehension_var;
11195 if (
11196 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11197 )
11198 {
11199 D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11200 _res = invalid_comprehension_var;
11201 goto done;
11202 }
11203 p->mark = _mark;
11204 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
11205 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11206 }
11207 _res = NULL;
11208 done:
11209 D(p->level--);
11210 return _res;
11211}
11212
11213// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
11214static expr_ty
11215tuple_rule(Parser *p)
11216{
11217 D(p->level++);
11218 if (p->error_indicator) {
11219 D(p->level--);
11220 return NULL;
11221 }
11222 expr_ty _res = NULL;
11223 int _mark = p->mark;
11224 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11225 p->error_indicator = 1;
11226 D(p->level--);
11227 return NULL;
11228 }
11229 int _start_lineno = p->tokens[_mark]->lineno;
11230 UNUSED(_start_lineno); // Only used by EXTRA macro
11231 int _start_col_offset = p->tokens[_mark]->col_offset;
11232 UNUSED(_start_col_offset); // Only used by EXTRA macro
11233 { // '(' [star_named_expression ',' star_named_expressions?] ')'
11234 if (p->error_indicator) {
11235 D(p->level--);
11236 return NULL;
11237 }
11238 D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11239 Token * _literal;
11240 Token * _literal_1;
11241 void *a;
11242 if (
11243 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11244 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011245 (a = _tmp_101_rule(p), 1) // [star_named_expression ',' star_named_expressions?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011246 &&
11247 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11248 )
11249 {
11250 D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11251 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11252 if (_token == NULL) {
11253 D(p->level--);
11254 return NULL;
11255 }
11256 int _end_lineno = _token->end_lineno;
11257 UNUSED(_end_lineno); // Only used by EXTRA macro
11258 int _end_col_offset = _token->end_col_offset;
11259 UNUSED(_end_col_offset); // Only used by EXTRA macro
11260 _res = _Py_Tuple ( a , Load , EXTRA );
11261 if (_res == NULL && PyErr_Occurred()) {
11262 p->error_indicator = 1;
11263 D(p->level--);
11264 return NULL;
11265 }
11266 goto done;
11267 }
11268 p->mark = _mark;
11269 D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
11270 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11271 }
11272 _res = NULL;
11273 done:
11274 D(p->level--);
11275 return _res;
11276}
11277
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011278// group: '(' (yield_expr | named_expression) ')' | invalid_group
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011279static expr_ty
11280group_rule(Parser *p)
11281{
11282 D(p->level++);
11283 if (p->error_indicator) {
11284 D(p->level--);
11285 return NULL;
11286 }
11287 expr_ty _res = NULL;
11288 int _mark = p->mark;
11289 { // '(' (yield_expr | named_expression) ')'
11290 if (p->error_indicator) {
11291 D(p->level--);
11292 return NULL;
11293 }
11294 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11295 Token * _literal;
11296 Token * _literal_1;
11297 void *a;
11298 if (
11299 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11300 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011301 (a = _tmp_102_rule(p)) // yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011302 &&
11303 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11304 )
11305 {
11306 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11307 _res = a;
11308 if (_res == NULL && PyErr_Occurred()) {
11309 p->error_indicator = 1;
11310 D(p->level--);
11311 return NULL;
11312 }
11313 goto done;
11314 }
11315 p->mark = _mark;
11316 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11317 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11318 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011319 if (p->call_invalid_rules) { // invalid_group
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011320 if (p->error_indicator) {
11321 D(p->level--);
11322 return NULL;
11323 }
11324 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11325 void *invalid_group_var;
11326 if (
11327 (invalid_group_var = invalid_group_rule(p)) // invalid_group
11328 )
11329 {
11330 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11331 _res = invalid_group_var;
11332 goto done;
11333 }
11334 p->mark = _mark;
11335 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11336 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
11337 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011338 _res = NULL;
11339 done:
11340 D(p->level--);
11341 return _res;
11342}
11343
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011344// genexp: '(' expression ~ for_if_clauses ')' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011345static expr_ty
11346genexp_rule(Parser *p)
11347{
11348 D(p->level++);
11349 if (p->error_indicator) {
11350 D(p->level--);
11351 return NULL;
11352 }
11353 expr_ty _res = NULL;
11354 int _mark = p->mark;
11355 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11356 p->error_indicator = 1;
11357 D(p->level--);
11358 return NULL;
11359 }
11360 int _start_lineno = p->tokens[_mark]->lineno;
11361 UNUSED(_start_lineno); // Only used by EXTRA macro
11362 int _start_col_offset = p->tokens[_mark]->col_offset;
11363 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011364 { // '(' expression ~ for_if_clauses ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011365 if (p->error_indicator) {
11366 D(p->level--);
11367 return NULL;
11368 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011369 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11370 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011371 Token * _literal;
11372 Token * _literal_1;
11373 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011374 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011375 if (
11376 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11377 &&
11378 (a = expression_rule(p)) // expression
11379 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011380 (_cut_var = 1)
11381 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011382 (b = for_if_clauses_rule(p)) // for_if_clauses
11383 &&
11384 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11385 )
11386 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011387 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 +010011388 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11389 if (_token == NULL) {
11390 D(p->level--);
11391 return NULL;
11392 }
11393 int _end_lineno = _token->end_lineno;
11394 UNUSED(_end_lineno); // Only used by EXTRA macro
11395 int _end_col_offset = _token->end_col_offset;
11396 UNUSED(_end_col_offset); // Only used by EXTRA macro
11397 _res = _Py_GeneratorExp ( a , b , EXTRA );
11398 if (_res == NULL && PyErr_Occurred()) {
11399 p->error_indicator = 1;
11400 D(p->level--);
11401 return NULL;
11402 }
11403 goto done;
11404 }
11405 p->mark = _mark;
11406 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011407 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11408 if (_cut_var) {
11409 D(p->level--);
11410 return NULL;
11411 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011412 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011413 if (p->call_invalid_rules) { // invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011414 if (p->error_indicator) {
11415 D(p->level--);
11416 return NULL;
11417 }
11418 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11419 void *invalid_comprehension_var;
11420 if (
11421 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11422 )
11423 {
11424 D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11425 _res = invalid_comprehension_var;
11426 goto done;
11427 }
11428 p->mark = _mark;
11429 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
11430 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11431 }
11432 _res = NULL;
11433 done:
11434 D(p->level--);
11435 return _res;
11436}
11437
11438// set: '{' expressions_list '}'
11439static expr_ty
11440set_rule(Parser *p)
11441{
11442 D(p->level++);
11443 if (p->error_indicator) {
11444 D(p->level--);
11445 return NULL;
11446 }
11447 expr_ty _res = NULL;
11448 int _mark = p->mark;
11449 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11450 p->error_indicator = 1;
11451 D(p->level--);
11452 return NULL;
11453 }
11454 int _start_lineno = p->tokens[_mark]->lineno;
11455 UNUSED(_start_lineno); // Only used by EXTRA macro
11456 int _start_col_offset = p->tokens[_mark]->col_offset;
11457 UNUSED(_start_col_offset); // Only used by EXTRA macro
11458 { // '{' expressions_list '}'
11459 if (p->error_indicator) {
11460 D(p->level--);
11461 return NULL;
11462 }
11463 D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11464 Token * _literal;
11465 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011466 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011467 if (
11468 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11469 &&
11470 (a = expressions_list_rule(p)) // expressions_list
11471 &&
11472 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11473 )
11474 {
11475 D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11476 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11477 if (_token == NULL) {
11478 D(p->level--);
11479 return NULL;
11480 }
11481 int _end_lineno = _token->end_lineno;
11482 UNUSED(_end_lineno); // Only used by EXTRA macro
11483 int _end_col_offset = _token->end_col_offset;
11484 UNUSED(_end_col_offset); // Only used by EXTRA macro
11485 _res = _Py_Set ( a , EXTRA );
11486 if (_res == NULL && PyErr_Occurred()) {
11487 p->error_indicator = 1;
11488 D(p->level--);
11489 return NULL;
11490 }
11491 goto done;
11492 }
11493 p->mark = _mark;
11494 D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
11495 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'"));
11496 }
11497 _res = NULL;
11498 done:
11499 D(p->level--);
11500 return _res;
11501}
11502
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011503// setcomp: '{' expression ~ for_if_clauses '}' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011504static expr_ty
11505setcomp_rule(Parser *p)
11506{
11507 D(p->level++);
11508 if (p->error_indicator) {
11509 D(p->level--);
11510 return NULL;
11511 }
11512 expr_ty _res = NULL;
11513 int _mark = p->mark;
11514 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11515 p->error_indicator = 1;
11516 D(p->level--);
11517 return NULL;
11518 }
11519 int _start_lineno = p->tokens[_mark]->lineno;
11520 UNUSED(_start_lineno); // Only used by EXTRA macro
11521 int _start_col_offset = p->tokens[_mark]->col_offset;
11522 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011523 { // '{' expression ~ for_if_clauses '}'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011524 if (p->error_indicator) {
11525 D(p->level--);
11526 return NULL;
11527 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011528 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11529 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011530 Token * _literal;
11531 Token * _literal_1;
11532 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011533 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011534 if (
11535 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11536 &&
11537 (a = expression_rule(p)) // expression
11538 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011539 (_cut_var = 1)
11540 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011541 (b = for_if_clauses_rule(p)) // for_if_clauses
11542 &&
11543 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11544 )
11545 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011546 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 +010011547 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11548 if (_token == NULL) {
11549 D(p->level--);
11550 return NULL;
11551 }
11552 int _end_lineno = _token->end_lineno;
11553 UNUSED(_end_lineno); // Only used by EXTRA macro
11554 int _end_col_offset = _token->end_col_offset;
11555 UNUSED(_end_col_offset); // Only used by EXTRA macro
11556 _res = _Py_SetComp ( a , b , EXTRA );
11557 if (_res == NULL && PyErr_Occurred()) {
11558 p->error_indicator = 1;
11559 D(p->level--);
11560 return NULL;
11561 }
11562 goto done;
11563 }
11564 p->mark = _mark;
11565 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011566 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11567 if (_cut_var) {
11568 D(p->level--);
11569 return NULL;
11570 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011571 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011572 if (p->call_invalid_rules) { // invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011573 if (p->error_indicator) {
11574 D(p->level--);
11575 return NULL;
11576 }
11577 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11578 void *invalid_comprehension_var;
11579 if (
11580 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11581 )
11582 {
11583 D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11584 _res = invalid_comprehension_var;
11585 goto done;
11586 }
11587 p->mark = _mark;
11588 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
11589 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11590 }
11591 _res = NULL;
11592 done:
11593 D(p->level--);
11594 return _res;
11595}
11596
11597// dict: '{' double_starred_kvpairs? '}'
11598static expr_ty
11599dict_rule(Parser *p)
11600{
11601 D(p->level++);
11602 if (p->error_indicator) {
11603 D(p->level--);
11604 return NULL;
11605 }
11606 expr_ty _res = NULL;
11607 int _mark = p->mark;
11608 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11609 p->error_indicator = 1;
11610 D(p->level--);
11611 return NULL;
11612 }
11613 int _start_lineno = p->tokens[_mark]->lineno;
11614 UNUSED(_start_lineno); // Only used by EXTRA macro
11615 int _start_col_offset = p->tokens[_mark]->col_offset;
11616 UNUSED(_start_col_offset); // Only used by EXTRA macro
11617 { // '{' double_starred_kvpairs? '}'
11618 if (p->error_indicator) {
11619 D(p->level--);
11620 return NULL;
11621 }
11622 D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11623 Token * _literal;
11624 Token * _literal_1;
11625 void *a;
11626 if (
11627 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11628 &&
11629 (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs?
11630 &&
11631 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11632 )
11633 {
11634 D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11635 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11636 if (_token == NULL) {
11637 D(p->level--);
11638 return NULL;
11639 }
11640 int _end_lineno = _token->end_lineno;
11641 UNUSED(_end_lineno); // Only used by EXTRA macro
11642 int _end_col_offset = _token->end_col_offset;
11643 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030011644 _res = _Py_Dict ( CHECK ( asdl_expr_seq * , _PyPegen_get_keys ( p , a ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_values ( p , a ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011645 if (_res == NULL && PyErr_Occurred()) {
11646 p->error_indicator = 1;
11647 D(p->level--);
11648 return NULL;
11649 }
11650 goto done;
11651 }
11652 p->mark = _mark;
11653 D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
11654 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11655 }
11656 _res = NULL;
11657 done:
11658 D(p->level--);
11659 return _res;
11660}
11661
11662// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
11663static expr_ty
11664dictcomp_rule(Parser *p)
11665{
11666 D(p->level++);
11667 if (p->error_indicator) {
11668 D(p->level--);
11669 return NULL;
11670 }
11671 expr_ty _res = NULL;
11672 int _mark = p->mark;
11673 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11674 p->error_indicator = 1;
11675 D(p->level--);
11676 return NULL;
11677 }
11678 int _start_lineno = p->tokens[_mark]->lineno;
11679 UNUSED(_start_lineno); // Only used by EXTRA macro
11680 int _start_col_offset = p->tokens[_mark]->col_offset;
11681 UNUSED(_start_col_offset); // Only used by EXTRA macro
11682 { // '{' kvpair for_if_clauses '}'
11683 if (p->error_indicator) {
11684 D(p->level--);
11685 return NULL;
11686 }
11687 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11688 Token * _literal;
11689 Token * _literal_1;
11690 KeyValuePair* a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011691 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011692 if (
11693 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11694 &&
11695 (a = kvpair_rule(p)) // kvpair
11696 &&
11697 (b = for_if_clauses_rule(p)) // for_if_clauses
11698 &&
11699 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11700 )
11701 {
11702 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11703 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11704 if (_token == NULL) {
11705 D(p->level--);
11706 return NULL;
11707 }
11708 int _end_lineno = _token->end_lineno;
11709 UNUSED(_end_lineno); // Only used by EXTRA macro
11710 int _end_col_offset = _token->end_col_offset;
11711 UNUSED(_end_col_offset); // Only used by EXTRA macro
11712 _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
11713 if (_res == NULL && PyErr_Occurred()) {
11714 p->error_indicator = 1;
11715 D(p->level--);
11716 return NULL;
11717 }
11718 goto done;
11719 }
11720 p->mark = _mark;
11721 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11722 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11723 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011724 if (p->call_invalid_rules) { // invalid_dict_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011725 if (p->error_indicator) {
11726 D(p->level--);
11727 return NULL;
11728 }
11729 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11730 void *invalid_dict_comprehension_var;
11731 if (
11732 (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
11733 )
11734 {
11735 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11736 _res = invalid_dict_comprehension_var;
11737 goto done;
11738 }
11739 p->mark = _mark;
11740 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11741 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
11742 }
11743 _res = NULL;
11744 done:
11745 D(p->level--);
11746 return _res;
11747}
11748
11749// double_starred_kvpairs: ','.double_starred_kvpair+ ','?
11750static asdl_seq*
11751double_starred_kvpairs_rule(Parser *p)
11752{
11753 D(p->level++);
11754 if (p->error_indicator) {
11755 D(p->level--);
11756 return NULL;
11757 }
11758 asdl_seq* _res = NULL;
11759 int _mark = p->mark;
11760 { // ','.double_starred_kvpair+ ','?
11761 if (p->error_indicator) {
11762 D(p->level--);
11763 return NULL;
11764 }
11765 D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11766 void *_opt_var;
11767 UNUSED(_opt_var); // Silence compiler warnings
11768 asdl_seq * a;
11769 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011770 (a = _gather_103_rule(p)) // ','.double_starred_kvpair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011771 &&
11772 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
11773 )
11774 {
11775 D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11776 _res = a;
11777 if (_res == NULL && PyErr_Occurred()) {
11778 p->error_indicator = 1;
11779 D(p->level--);
11780 return NULL;
11781 }
11782 goto done;
11783 }
11784 p->mark = _mark;
11785 D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
11786 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11787 }
11788 _res = NULL;
11789 done:
11790 D(p->level--);
11791 return _res;
11792}
11793
11794// double_starred_kvpair: '**' bitwise_or | kvpair
11795static KeyValuePair*
11796double_starred_kvpair_rule(Parser *p)
11797{
11798 D(p->level++);
11799 if (p->error_indicator) {
11800 D(p->level--);
11801 return NULL;
11802 }
11803 KeyValuePair* _res = NULL;
11804 int _mark = p->mark;
11805 { // '**' bitwise_or
11806 if (p->error_indicator) {
11807 D(p->level--);
11808 return NULL;
11809 }
11810 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11811 Token * _literal;
11812 expr_ty a;
11813 if (
11814 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
11815 &&
11816 (a = bitwise_or_rule(p)) // bitwise_or
11817 )
11818 {
11819 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11820 _res = _PyPegen_key_value_pair ( p , NULL , a );
11821 if (_res == NULL && PyErr_Occurred()) {
11822 p->error_indicator = 1;
11823 D(p->level--);
11824 return NULL;
11825 }
11826 goto done;
11827 }
11828 p->mark = _mark;
11829 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11830 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
11831 }
11832 { // kvpair
11833 if (p->error_indicator) {
11834 D(p->level--);
11835 return NULL;
11836 }
11837 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
11838 KeyValuePair* kvpair_var;
11839 if (
11840 (kvpair_var = kvpair_rule(p)) // kvpair
11841 )
11842 {
11843 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
11844 _res = kvpair_var;
11845 goto done;
11846 }
11847 p->mark = _mark;
11848 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11849 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
11850 }
11851 _res = NULL;
11852 done:
11853 D(p->level--);
11854 return _res;
11855}
11856
11857// kvpair: expression ':' expression
11858static KeyValuePair*
11859kvpair_rule(Parser *p)
11860{
11861 D(p->level++);
11862 if (p->error_indicator) {
11863 D(p->level--);
11864 return NULL;
11865 }
11866 KeyValuePair* _res = NULL;
11867 int _mark = p->mark;
11868 { // expression ':' expression
11869 if (p->error_indicator) {
11870 D(p->level--);
11871 return NULL;
11872 }
11873 D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11874 Token * _literal;
11875 expr_ty a;
11876 expr_ty b;
11877 if (
11878 (a = expression_rule(p)) // expression
11879 &&
11880 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
11881 &&
11882 (b = expression_rule(p)) // expression
11883 )
11884 {
11885 D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11886 _res = _PyPegen_key_value_pair ( p , a , b );
11887 if (_res == NULL && PyErr_Occurred()) {
11888 p->error_indicator = 1;
11889 D(p->level--);
11890 return NULL;
11891 }
11892 goto done;
11893 }
11894 p->mark = _mark;
11895 D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11896 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
11897 }
11898 _res = NULL;
11899 done:
11900 D(p->level--);
11901 return _res;
11902}
11903
11904// for_if_clauses: for_if_clause+
Pablo Galindoa5634c42020-09-16 19:42:00 +010011905static asdl_comprehension_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011906for_if_clauses_rule(Parser *p)
11907{
11908 D(p->level++);
11909 if (p->error_indicator) {
11910 D(p->level--);
11911 return NULL;
11912 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010011913 asdl_comprehension_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011914 int _mark = p->mark;
11915 { // for_if_clause+
11916 if (p->error_indicator) {
11917 D(p->level--);
11918 return NULL;
11919 }
11920 D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010011921 asdl_comprehension_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011922 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010011923 (a = (asdl_comprehension_seq*)_loop1_105_rule(p)) // for_if_clause+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011924 )
11925 {
11926 D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010011927 _res = a;
11928 if (_res == NULL && PyErr_Occurred()) {
11929 p->error_indicator = 1;
11930 D(p->level--);
11931 return NULL;
11932 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011933 goto done;
11934 }
11935 p->mark = _mark;
11936 D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
11937 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
11938 }
11939 _res = NULL;
11940 done:
11941 D(p->level--);
11942 return _res;
11943}
11944
11945// for_if_clause:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011946// | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11947// | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11948// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011949static comprehension_ty
11950for_if_clause_rule(Parser *p)
11951{
11952 D(p->level++);
11953 if (p->error_indicator) {
11954 D(p->level--);
11955 return NULL;
11956 }
11957 comprehension_ty _res = NULL;
11958 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011959 { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011960 if (p->error_indicator) {
11961 D(p->level--);
11962 return NULL;
11963 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011964 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11965 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011966 Token * _keyword;
11967 Token * _keyword_1;
11968 expr_ty a;
11969 Token * async_var;
11970 expr_ty b;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011971 asdl_expr_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011972 if (
11973 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
11974 &&
11975 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11976 &&
11977 (a = star_targets_rule(p)) // star_targets
11978 &&
11979 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11980 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011981 (_cut_var = 1)
11982 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011983 (b = disjunction_rule(p)) // disjunction
11984 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +010011985 (c = (asdl_expr_seq*)_loop0_106_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011986 )
11987 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011988 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030011989 _res = CHECK_VERSION ( comprehension_ty , 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011990 if (_res == NULL && PyErr_Occurred()) {
11991 p->error_indicator = 1;
11992 D(p->level--);
11993 return NULL;
11994 }
11995 goto done;
11996 }
11997 p->mark = _mark;
11998 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011999 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
12000 if (_cut_var) {
12001 D(p->level--);
12002 return NULL;
12003 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012004 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012005 { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012006 if (p->error_indicator) {
12007 D(p->level--);
12008 return NULL;
12009 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012010 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
12011 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012012 Token * _keyword;
12013 Token * _keyword_1;
12014 expr_ty a;
12015 expr_ty b;
Pablo Galindoa5634c42020-09-16 19:42:00 +010012016 asdl_expr_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012017 if (
12018 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
12019 &&
12020 (a = star_targets_rule(p)) // star_targets
12021 &&
12022 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
12023 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012024 (_cut_var = 1)
12025 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012026 (b = disjunction_rule(p)) // disjunction
12027 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +010012028 (c = (asdl_expr_seq*)_loop0_107_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012029 )
12030 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012031 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 +010012032 _res = _Py_comprehension ( a , b , c , 0 , p -> arena );
12033 if (_res == NULL && PyErr_Occurred()) {
12034 p->error_indicator = 1;
12035 D(p->level--);
12036 return NULL;
12037 }
12038 goto done;
12039 }
12040 p->mark = _mark;
12041 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012042 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
12043 if (_cut_var) {
12044 D(p->level--);
12045 return NULL;
12046 }
12047 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012048 if (p->call_invalid_rules) { // invalid_for_target
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012049 if (p->error_indicator) {
12050 D(p->level--);
12051 return NULL;
12052 }
12053 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12054 void *invalid_for_target_var;
12055 if (
12056 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
12057 )
12058 {
12059 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12060 _res = invalid_for_target_var;
12061 goto done;
12062 }
12063 p->mark = _mark;
12064 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
12065 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012066 }
12067 _res = NULL;
12068 done:
12069 D(p->level--);
12070 return _res;
12071}
12072
12073// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
12074static expr_ty
12075yield_expr_rule(Parser *p)
12076{
12077 D(p->level++);
12078 if (p->error_indicator) {
12079 D(p->level--);
12080 return NULL;
12081 }
12082 expr_ty _res = NULL;
12083 int _mark = p->mark;
12084 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12085 p->error_indicator = 1;
12086 D(p->level--);
12087 return NULL;
12088 }
12089 int _start_lineno = p->tokens[_mark]->lineno;
12090 UNUSED(_start_lineno); // Only used by EXTRA macro
12091 int _start_col_offset = p->tokens[_mark]->col_offset;
12092 UNUSED(_start_col_offset); // Only used by EXTRA macro
12093 { // 'yield' 'from' expression
12094 if (p->error_indicator) {
12095 D(p->level--);
12096 return NULL;
12097 }
12098 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12099 Token * _keyword;
12100 Token * _keyword_1;
12101 expr_ty a;
12102 if (
12103 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12104 &&
12105 (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from'
12106 &&
12107 (a = expression_rule(p)) // expression
12108 )
12109 {
12110 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12111 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12112 if (_token == NULL) {
12113 D(p->level--);
12114 return NULL;
12115 }
12116 int _end_lineno = _token->end_lineno;
12117 UNUSED(_end_lineno); // Only used by EXTRA macro
12118 int _end_col_offset = _token->end_col_offset;
12119 UNUSED(_end_col_offset); // Only used by EXTRA macro
12120 _res = _Py_YieldFrom ( a , EXTRA );
12121 if (_res == NULL && PyErr_Occurred()) {
12122 p->error_indicator = 1;
12123 D(p->level--);
12124 return NULL;
12125 }
12126 goto done;
12127 }
12128 p->mark = _mark;
12129 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12130 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
12131 }
12132 { // 'yield' star_expressions?
12133 if (p->error_indicator) {
12134 D(p->level--);
12135 return NULL;
12136 }
12137 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12138 Token * _keyword;
12139 void *a;
12140 if (
12141 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12142 &&
12143 (a = star_expressions_rule(p), 1) // star_expressions?
12144 )
12145 {
12146 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12147 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12148 if (_token == NULL) {
12149 D(p->level--);
12150 return NULL;
12151 }
12152 int _end_lineno = _token->end_lineno;
12153 UNUSED(_end_lineno); // Only used by EXTRA macro
12154 int _end_col_offset = _token->end_col_offset;
12155 UNUSED(_end_col_offset); // Only used by EXTRA macro
12156 _res = _Py_Yield ( a , EXTRA );
12157 if (_res == NULL && PyErr_Occurred()) {
12158 p->error_indicator = 1;
12159 D(p->level--);
12160 return NULL;
12161 }
12162 goto done;
12163 }
12164 p->mark = _mark;
12165 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12166 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
12167 }
12168 _res = NULL;
12169 done:
12170 D(p->level--);
12171 return _res;
12172}
12173
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012174// arguments: args ','? &')' | invalid_arguments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012175static expr_ty
12176arguments_rule(Parser *p)
12177{
12178 D(p->level++);
12179 if (p->error_indicator) {
12180 D(p->level--);
12181 return NULL;
12182 }
12183 expr_ty _res = NULL;
12184 if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
12185 D(p->level--);
12186 return _res;
12187 }
12188 int _mark = p->mark;
12189 { // args ','? &')'
12190 if (p->error_indicator) {
12191 D(p->level--);
12192 return NULL;
12193 }
12194 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12195 void *_opt_var;
12196 UNUSED(_opt_var); // Silence compiler warnings
12197 expr_ty a;
12198 if (
12199 (a = args_rule(p)) // args
12200 &&
12201 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12202 &&
12203 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
12204 )
12205 {
12206 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12207 _res = a;
12208 if (_res == NULL && PyErr_Occurred()) {
12209 p->error_indicator = 1;
12210 D(p->level--);
12211 return NULL;
12212 }
12213 goto done;
12214 }
12215 p->mark = _mark;
12216 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12217 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
12218 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012219 if (p->call_invalid_rules) { // invalid_arguments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012220 if (p->error_indicator) {
12221 D(p->level--);
12222 return NULL;
12223 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012224 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
12225 void *invalid_arguments_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012226 if (
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012227 (invalid_arguments_var = invalid_arguments_rule(p)) // invalid_arguments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012228 )
12229 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012230 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
12231 _res = invalid_arguments_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012232 goto done;
12233 }
12234 p->mark = _mark;
12235 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012236 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arguments"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012237 }
12238 _res = NULL;
12239 done:
12240 _PyPegen_insert_memo(p, _mark, arguments_type, _res);
12241 D(p->level--);
12242 return _res;
12243}
12244
Pablo Galindo4a97b152020-09-02 17:44:19 +010012245// args: ','.(starred_expression | named_expression !'=')+ [',' kwargs] | kwargs
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012246static expr_ty
12247args_rule(Parser *p)
12248{
12249 D(p->level++);
12250 if (p->error_indicator) {
12251 D(p->level--);
12252 return NULL;
12253 }
12254 expr_ty _res = NULL;
12255 int _mark = p->mark;
12256 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12257 p->error_indicator = 1;
12258 D(p->level--);
12259 return NULL;
12260 }
12261 int _start_lineno = p->tokens[_mark]->lineno;
12262 UNUSED(_start_lineno); // Only used by EXTRA macro
12263 int _start_col_offset = p->tokens[_mark]->col_offset;
12264 UNUSED(_start_col_offset); // Only used by EXTRA macro
Pablo Galindo4a97b152020-09-02 17:44:19 +010012265 { // ','.(starred_expression | named_expression !'=')+ [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012266 if (p->error_indicator) {
12267 D(p->level--);
12268 return NULL;
12269 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010012270 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010012271 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012272 void *b;
12273 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010012274 (a = (asdl_expr_seq*)_gather_108_rule(p)) // ','.(starred_expression | named_expression !'=')+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012275 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012276 (b = _tmp_110_rule(p), 1) // [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012277 )
12278 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010012279 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
Pablo Galindo315a61f2020-09-03 15:29:32 +010012280 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12281 if (_token == NULL) {
12282 D(p->level--);
12283 return NULL;
12284 }
12285 int _end_lineno = _token->end_lineno;
12286 UNUSED(_end_lineno); // Only used by EXTRA macro
12287 int _end_col_offset = _token->end_col_offset;
12288 UNUSED(_end_col_offset); // Only used by EXTRA macro
12289 _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012290 if (_res == NULL && PyErr_Occurred()) {
12291 p->error_indicator = 1;
12292 D(p->level--);
12293 return NULL;
12294 }
12295 goto done;
12296 }
12297 p->mark = _mark;
12298 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010012299 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012300 }
12301 { // kwargs
12302 if (p->error_indicator) {
12303 D(p->level--);
12304 return NULL;
12305 }
12306 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
12307 asdl_seq* a;
12308 if (
12309 (a = kwargs_rule(p)) // kwargs
12310 )
12311 {
12312 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
12313 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12314 if (_token == NULL) {
12315 D(p->level--);
12316 return NULL;
12317 }
12318 int _end_lineno = _token->end_lineno;
12319 UNUSED(_end_lineno); // Only used by EXTRA macro
12320 int _end_col_offset = _token->end_col_offset;
12321 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012322 _res = _Py_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( asdl_expr_seq * , _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( asdl_keyword_seq * , _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012323 if (_res == NULL && PyErr_Occurred()) {
12324 p->error_indicator = 1;
12325 D(p->level--);
12326 return NULL;
12327 }
12328 goto done;
12329 }
12330 p->mark = _mark;
12331 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12332 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
12333 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012334 _res = NULL;
12335 done:
12336 D(p->level--);
12337 return _res;
12338}
12339
12340// kwargs:
12341// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12342// | ','.kwarg_or_starred+
12343// | ','.kwarg_or_double_starred+
12344static asdl_seq*
12345kwargs_rule(Parser *p)
12346{
12347 D(p->level++);
12348 if (p->error_indicator) {
12349 D(p->level--);
12350 return NULL;
12351 }
12352 asdl_seq* _res = NULL;
12353 int _mark = p->mark;
12354 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12355 if (p->error_indicator) {
12356 D(p->level--);
12357 return NULL;
12358 }
12359 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12360 Token * _literal;
12361 asdl_seq * a;
12362 asdl_seq * b;
12363 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012364 (a = _gather_111_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012365 &&
12366 (_literal = _PyPegen_expect_token(p, 12)) // token=','
12367 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012368 (b = _gather_113_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012369 )
12370 {
12371 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12372 _res = _PyPegen_join_sequences ( p , a , b );
12373 if (_res == NULL && PyErr_Occurred()) {
12374 p->error_indicator = 1;
12375 D(p->level--);
12376 return NULL;
12377 }
12378 goto done;
12379 }
12380 p->mark = _mark;
12381 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12382 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12383 }
12384 { // ','.kwarg_or_starred+
12385 if (p->error_indicator) {
12386 D(p->level--);
12387 return NULL;
12388 }
12389 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012390 asdl_seq * _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012391 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012392 (_gather_115_var = _gather_115_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012393 )
12394 {
12395 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012396 _res = _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012397 goto done;
12398 }
12399 p->mark = _mark;
12400 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12401 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
12402 }
12403 { // ','.kwarg_or_double_starred+
12404 if (p->error_indicator) {
12405 D(p->level--);
12406 return NULL;
12407 }
12408 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012409 asdl_seq * _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012410 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012411 (_gather_117_var = _gather_117_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012412 )
12413 {
12414 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012415 _res = _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012416 goto done;
12417 }
12418 p->mark = _mark;
12419 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12420 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
12421 }
12422 _res = NULL;
12423 done:
12424 D(p->level--);
12425 return _res;
12426}
12427
12428// starred_expression: '*' expression
12429static expr_ty
12430starred_expression_rule(Parser *p)
12431{
12432 D(p->level++);
12433 if (p->error_indicator) {
12434 D(p->level--);
12435 return NULL;
12436 }
12437 expr_ty _res = NULL;
12438 int _mark = p->mark;
12439 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12440 p->error_indicator = 1;
12441 D(p->level--);
12442 return NULL;
12443 }
12444 int _start_lineno = p->tokens[_mark]->lineno;
12445 UNUSED(_start_lineno); // Only used by EXTRA macro
12446 int _start_col_offset = p->tokens[_mark]->col_offset;
12447 UNUSED(_start_col_offset); // Only used by EXTRA macro
12448 { // '*' expression
12449 if (p->error_indicator) {
12450 D(p->level--);
12451 return NULL;
12452 }
12453 D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12454 Token * _literal;
12455 expr_ty a;
12456 if (
12457 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12458 &&
12459 (a = expression_rule(p)) // expression
12460 )
12461 {
12462 D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12463 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12464 if (_token == NULL) {
12465 D(p->level--);
12466 return NULL;
12467 }
12468 int _end_lineno = _token->end_lineno;
12469 UNUSED(_end_lineno); // Only used by EXTRA macro
12470 int _end_col_offset = _token->end_col_offset;
12471 UNUSED(_end_col_offset); // Only used by EXTRA macro
12472 _res = _Py_Starred ( a , Load , EXTRA );
12473 if (_res == NULL && PyErr_Occurred()) {
12474 p->error_indicator = 1;
12475 D(p->level--);
12476 return NULL;
12477 }
12478 goto done;
12479 }
12480 p->mark = _mark;
12481 D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
12482 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
12483 }
12484 _res = NULL;
12485 done:
12486 D(p->level--);
12487 return _res;
12488}
12489
12490// kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg
12491static KeywordOrStarred*
12492kwarg_or_starred_rule(Parser *p)
12493{
12494 D(p->level++);
12495 if (p->error_indicator) {
12496 D(p->level--);
12497 return NULL;
12498 }
12499 KeywordOrStarred* _res = NULL;
12500 int _mark = p->mark;
12501 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12502 p->error_indicator = 1;
12503 D(p->level--);
12504 return NULL;
12505 }
12506 int _start_lineno = p->tokens[_mark]->lineno;
12507 UNUSED(_start_lineno); // Only used by EXTRA macro
12508 int _start_col_offset = p->tokens[_mark]->col_offset;
12509 UNUSED(_start_col_offset); // Only used by EXTRA macro
12510 { // NAME '=' expression
12511 if (p->error_indicator) {
12512 D(p->level--);
12513 return NULL;
12514 }
12515 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12516 Token * _literal;
12517 expr_ty a;
12518 expr_ty b;
12519 if (
12520 (a = _PyPegen_name_token(p)) // NAME
12521 &&
12522 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12523 &&
12524 (b = expression_rule(p)) // expression
12525 )
12526 {
12527 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12528 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12529 if (_token == NULL) {
12530 D(p->level--);
12531 return NULL;
12532 }
12533 int _end_lineno = _token->end_lineno;
12534 UNUSED(_end_lineno); // Only used by EXTRA macro
12535 int _end_col_offset = _token->end_col_offset;
12536 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012537 _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012538 if (_res == NULL && PyErr_Occurred()) {
12539 p->error_indicator = 1;
12540 D(p->level--);
12541 return NULL;
12542 }
12543 goto done;
12544 }
12545 p->mark = _mark;
12546 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12547 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12548 }
12549 { // starred_expression
12550 if (p->error_indicator) {
12551 D(p->level--);
12552 return NULL;
12553 }
12554 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12555 expr_ty a;
12556 if (
12557 (a = starred_expression_rule(p)) // starred_expression
12558 )
12559 {
12560 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12561 _res = _PyPegen_keyword_or_starred ( p , a , 0 );
12562 if (_res == NULL && PyErr_Occurred()) {
12563 p->error_indicator = 1;
12564 D(p->level--);
12565 return NULL;
12566 }
12567 goto done;
12568 }
12569 p->mark = _mark;
12570 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12571 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
12572 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012573 if (p->call_invalid_rules) { // invalid_kwarg
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012574 if (p->error_indicator) {
12575 D(p->level--);
12576 return NULL;
12577 }
12578 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12579 void *invalid_kwarg_var;
12580 if (
12581 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12582 )
12583 {
12584 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12585 _res = invalid_kwarg_var;
12586 goto done;
12587 }
12588 p->mark = _mark;
12589 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12590 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12591 }
12592 _res = NULL;
12593 done:
12594 D(p->level--);
12595 return _res;
12596}
12597
12598// kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg
12599static KeywordOrStarred*
12600kwarg_or_double_starred_rule(Parser *p)
12601{
12602 D(p->level++);
12603 if (p->error_indicator) {
12604 D(p->level--);
12605 return NULL;
12606 }
12607 KeywordOrStarred* _res = NULL;
12608 int _mark = p->mark;
12609 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12610 p->error_indicator = 1;
12611 D(p->level--);
12612 return NULL;
12613 }
12614 int _start_lineno = p->tokens[_mark]->lineno;
12615 UNUSED(_start_lineno); // Only used by EXTRA macro
12616 int _start_col_offset = p->tokens[_mark]->col_offset;
12617 UNUSED(_start_col_offset); // Only used by EXTRA macro
12618 { // NAME '=' expression
12619 if (p->error_indicator) {
12620 D(p->level--);
12621 return NULL;
12622 }
12623 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12624 Token * _literal;
12625 expr_ty a;
12626 expr_ty b;
12627 if (
12628 (a = _PyPegen_name_token(p)) // NAME
12629 &&
12630 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12631 &&
12632 (b = expression_rule(p)) // expression
12633 )
12634 {
12635 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12636 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12637 if (_token == NULL) {
12638 D(p->level--);
12639 return NULL;
12640 }
12641 int _end_lineno = _token->end_lineno;
12642 UNUSED(_end_lineno); // Only used by EXTRA macro
12643 int _end_col_offset = _token->end_col_offset;
12644 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012645 _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012646 if (_res == NULL && PyErr_Occurred()) {
12647 p->error_indicator = 1;
12648 D(p->level--);
12649 return NULL;
12650 }
12651 goto done;
12652 }
12653 p->mark = _mark;
12654 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12655 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12656 }
12657 { // '**' expression
12658 if (p->error_indicator) {
12659 D(p->level--);
12660 return NULL;
12661 }
12662 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12663 Token * _literal;
12664 expr_ty a;
12665 if (
12666 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
12667 &&
12668 (a = expression_rule(p)) // expression
12669 )
12670 {
12671 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12672 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12673 if (_token == NULL) {
12674 D(p->level--);
12675 return NULL;
12676 }
12677 int _end_lineno = _token->end_lineno;
12678 UNUSED(_end_lineno); // Only used by EXTRA macro
12679 int _end_col_offset = _token->end_col_offset;
12680 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012681 _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012682 if (_res == NULL && PyErr_Occurred()) {
12683 p->error_indicator = 1;
12684 D(p->level--);
12685 return NULL;
12686 }
12687 goto done;
12688 }
12689 p->mark = _mark;
12690 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12691 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
12692 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012693 if (p->call_invalid_rules) { // invalid_kwarg
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012694 if (p->error_indicator) {
12695 D(p->level--);
12696 return NULL;
12697 }
12698 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12699 void *invalid_kwarg_var;
12700 if (
12701 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12702 )
12703 {
12704 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12705 _res = invalid_kwarg_var;
12706 goto done;
12707 }
12708 p->mark = _mark;
12709 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12710 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12711 }
12712 _res = NULL;
12713 done:
12714 D(p->level--);
12715 return _res;
12716}
12717
12718// star_targets: star_target !',' | star_target ((',' star_target))* ','?
12719static expr_ty
12720star_targets_rule(Parser *p)
12721{
12722 D(p->level++);
12723 if (p->error_indicator) {
12724 D(p->level--);
12725 return NULL;
12726 }
12727 expr_ty _res = NULL;
12728 int _mark = p->mark;
12729 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12730 p->error_indicator = 1;
12731 D(p->level--);
12732 return NULL;
12733 }
12734 int _start_lineno = p->tokens[_mark]->lineno;
12735 UNUSED(_start_lineno); // Only used by EXTRA macro
12736 int _start_col_offset = p->tokens[_mark]->col_offset;
12737 UNUSED(_start_col_offset); // Only used by EXTRA macro
12738 { // star_target !','
12739 if (p->error_indicator) {
12740 D(p->level--);
12741 return NULL;
12742 }
12743 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12744 expr_ty a;
12745 if (
12746 (a = star_target_rule(p)) // star_target
12747 &&
12748 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
12749 )
12750 {
12751 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12752 _res = a;
12753 if (_res == NULL && PyErr_Occurred()) {
12754 p->error_indicator = 1;
12755 D(p->level--);
12756 return NULL;
12757 }
12758 goto done;
12759 }
12760 p->mark = _mark;
12761 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12762 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
12763 }
12764 { // star_target ((',' star_target))* ','?
12765 if (p->error_indicator) {
12766 D(p->level--);
12767 return NULL;
12768 }
12769 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12770 void *_opt_var;
12771 UNUSED(_opt_var); // Silence compiler warnings
12772 expr_ty a;
12773 asdl_seq * b;
12774 if (
12775 (a = star_target_rule(p)) // star_target
12776 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012777 (b = _loop0_119_rule(p)) // ((',' star_target))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012778 &&
12779 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12780 )
12781 {
12782 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12783 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12784 if (_token == NULL) {
12785 D(p->level--);
12786 return NULL;
12787 }
12788 int _end_lineno = _token->end_lineno;
12789 UNUSED(_end_lineno); // Only used by EXTRA macro
12790 int _end_col_offset = _token->end_col_offset;
12791 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012792 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012793 if (_res == NULL && PyErr_Occurred()) {
12794 p->error_indicator = 1;
12795 D(p->level--);
12796 return NULL;
12797 }
12798 goto done;
12799 }
12800 p->mark = _mark;
12801 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12802 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
12803 }
12804 _res = NULL;
12805 done:
12806 D(p->level--);
12807 return _res;
12808}
12809
12810// star_targets_seq: ','.star_target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010012811static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012812star_targets_seq_rule(Parser *p)
12813{
12814 D(p->level++);
12815 if (p->error_indicator) {
12816 D(p->level--);
12817 return NULL;
12818 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010012819 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012820 int _mark = p->mark;
12821 { // ','.star_target+ ','?
12822 if (p->error_indicator) {
12823 D(p->level--);
12824 return NULL;
12825 }
12826 D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12827 void *_opt_var;
12828 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010012829 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012830 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010012831 (a = (asdl_expr_seq*)_gather_120_rule(p)) // ','.star_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012832 &&
12833 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12834 )
12835 {
12836 D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12837 _res = a;
12838 if (_res == NULL && PyErr_Occurred()) {
12839 p->error_indicator = 1;
12840 D(p->level--);
12841 return NULL;
12842 }
12843 goto done;
12844 }
12845 p->mark = _mark;
12846 D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ',
12847 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
12848 }
12849 _res = NULL;
12850 done:
12851 D(p->level--);
12852 return _res;
12853}
12854
12855// star_target:
12856// | '*' (!'*' star_target)
12857// | t_primary '.' NAME !t_lookahead
12858// | t_primary '[' slices ']' !t_lookahead
12859// | star_atom
12860static expr_ty
12861star_target_rule(Parser *p)
12862{
12863 D(p->level++);
12864 if (p->error_indicator) {
12865 D(p->level--);
12866 return NULL;
12867 }
12868 expr_ty _res = NULL;
12869 if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
12870 D(p->level--);
12871 return _res;
12872 }
12873 int _mark = p->mark;
12874 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12875 p->error_indicator = 1;
12876 D(p->level--);
12877 return NULL;
12878 }
12879 int _start_lineno = p->tokens[_mark]->lineno;
12880 UNUSED(_start_lineno); // Only used by EXTRA macro
12881 int _start_col_offset = p->tokens[_mark]->col_offset;
12882 UNUSED(_start_col_offset); // Only used by EXTRA macro
12883 { // '*' (!'*' star_target)
12884 if (p->error_indicator) {
12885 D(p->level--);
12886 return NULL;
12887 }
12888 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12889 Token * _literal;
12890 void *a;
12891 if (
12892 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12893 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012894 (a = _tmp_122_rule(p)) // !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012895 )
12896 {
12897 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12898 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12899 if (_token == NULL) {
12900 D(p->level--);
12901 return NULL;
12902 }
12903 int _end_lineno = _token->end_lineno;
12904 UNUSED(_end_lineno); // Only used by EXTRA macro
12905 int _end_col_offset = _token->end_col_offset;
12906 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012907 _res = _Py_Starred ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012908 if (_res == NULL && PyErr_Occurred()) {
12909 p->error_indicator = 1;
12910 D(p->level--);
12911 return NULL;
12912 }
12913 goto done;
12914 }
12915 p->mark = _mark;
12916 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12917 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
12918 }
12919 { // t_primary '.' NAME !t_lookahead
12920 if (p->error_indicator) {
12921 D(p->level--);
12922 return NULL;
12923 }
12924 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12925 Token * _literal;
12926 expr_ty a;
12927 expr_ty b;
12928 if (
12929 (a = t_primary_rule(p)) // t_primary
12930 &&
12931 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
12932 &&
12933 (b = _PyPegen_name_token(p)) // NAME
12934 &&
12935 _PyPegen_lookahead(0, t_lookahead_rule, p)
12936 )
12937 {
12938 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12939 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12940 if (_token == NULL) {
12941 D(p->level--);
12942 return NULL;
12943 }
12944 int _end_lineno = _token->end_lineno;
12945 UNUSED(_end_lineno); // Only used by EXTRA macro
12946 int _end_col_offset = _token->end_col_offset;
12947 UNUSED(_end_col_offset); // Only used by EXTRA macro
12948 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
12949 if (_res == NULL && PyErr_Occurred()) {
12950 p->error_indicator = 1;
12951 D(p->level--);
12952 return NULL;
12953 }
12954 goto done;
12955 }
12956 p->mark = _mark;
12957 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12958 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12959 }
12960 { // t_primary '[' slices ']' !t_lookahead
12961 if (p->error_indicator) {
12962 D(p->level--);
12963 return NULL;
12964 }
12965 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12966 Token * _literal;
12967 Token * _literal_1;
12968 expr_ty a;
12969 expr_ty b;
12970 if (
12971 (a = t_primary_rule(p)) // t_primary
12972 &&
12973 (_literal = _PyPegen_expect_token(p, 9)) // token='['
12974 &&
12975 (b = slices_rule(p)) // slices
12976 &&
12977 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
12978 &&
12979 _PyPegen_lookahead(0, t_lookahead_rule, p)
12980 )
12981 {
12982 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12983 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12984 if (_token == NULL) {
12985 D(p->level--);
12986 return NULL;
12987 }
12988 int _end_lineno = _token->end_lineno;
12989 UNUSED(_end_lineno); // Only used by EXTRA macro
12990 int _end_col_offset = _token->end_col_offset;
12991 UNUSED(_end_col_offset); // Only used by EXTRA macro
12992 _res = _Py_Subscript ( a , b , Store , EXTRA );
12993 if (_res == NULL && PyErr_Occurred()) {
12994 p->error_indicator = 1;
12995 D(p->level--);
12996 return NULL;
12997 }
12998 goto done;
12999 }
13000 p->mark = _mark;
13001 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
13002 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13003 }
13004 { // star_atom
13005 if (p->error_indicator) {
13006 D(p->level--);
13007 return NULL;
13008 }
13009 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
13010 expr_ty star_atom_var;
13011 if (
13012 (star_atom_var = star_atom_rule(p)) // star_atom
13013 )
13014 {
13015 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
13016 _res = star_atom_var;
13017 goto done;
13018 }
13019 p->mark = _mark;
13020 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
13021 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
13022 }
13023 _res = NULL;
13024 done:
13025 _PyPegen_insert_memo(p, _mark, star_target_type, _res);
13026 D(p->level--);
13027 return _res;
13028}
13029
13030// star_atom:
13031// | NAME
13032// | '(' star_target ')'
13033// | '(' star_targets_seq? ')'
13034// | '[' star_targets_seq? ']'
13035static expr_ty
13036star_atom_rule(Parser *p)
13037{
13038 D(p->level++);
13039 if (p->error_indicator) {
13040 D(p->level--);
13041 return NULL;
13042 }
13043 expr_ty _res = NULL;
13044 int _mark = p->mark;
13045 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13046 p->error_indicator = 1;
13047 D(p->level--);
13048 return NULL;
13049 }
13050 int _start_lineno = p->tokens[_mark]->lineno;
13051 UNUSED(_start_lineno); // Only used by EXTRA macro
13052 int _start_col_offset = p->tokens[_mark]->col_offset;
13053 UNUSED(_start_col_offset); // Only used by EXTRA macro
13054 { // NAME
13055 if (p->error_indicator) {
13056 D(p->level--);
13057 return NULL;
13058 }
13059 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13060 expr_ty a;
13061 if (
13062 (a = _PyPegen_name_token(p)) // NAME
13063 )
13064 {
13065 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13066 _res = _PyPegen_set_expr_context ( p , a , Store );
13067 if (_res == NULL && PyErr_Occurred()) {
13068 p->error_indicator = 1;
13069 D(p->level--);
13070 return NULL;
13071 }
13072 goto done;
13073 }
13074 p->mark = _mark;
13075 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13076 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13077 }
13078 { // '(' star_target ')'
13079 if (p->error_indicator) {
13080 D(p->level--);
13081 return NULL;
13082 }
13083 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13084 Token * _literal;
13085 Token * _literal_1;
13086 expr_ty a;
13087 if (
13088 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13089 &&
13090 (a = star_target_rule(p)) // star_target
13091 &&
13092 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13093 )
13094 {
13095 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13096 _res = _PyPegen_set_expr_context ( p , a , Store );
13097 if (_res == NULL && PyErr_Occurred()) {
13098 p->error_indicator = 1;
13099 D(p->level--);
13100 return NULL;
13101 }
13102 goto done;
13103 }
13104 p->mark = _mark;
13105 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13106 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'"));
13107 }
13108 { // '(' star_targets_seq? ')'
13109 if (p->error_indicator) {
13110 D(p->level--);
13111 return NULL;
13112 }
13113 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13114 Token * _literal;
13115 Token * _literal_1;
13116 void *a;
13117 if (
13118 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13119 &&
13120 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13121 &&
13122 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13123 )
13124 {
13125 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13126 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13127 if (_token == NULL) {
13128 D(p->level--);
13129 return NULL;
13130 }
13131 int _end_lineno = _token->end_lineno;
13132 UNUSED(_end_lineno); // Only used by EXTRA macro
13133 int _end_col_offset = _token->end_col_offset;
13134 UNUSED(_end_col_offset); // Only used by EXTRA macro
13135 _res = _Py_Tuple ( a , Store , EXTRA );
13136 if (_res == NULL && PyErr_Occurred()) {
13137 p->error_indicator = 1;
13138 D(p->level--);
13139 return NULL;
13140 }
13141 goto done;
13142 }
13143 p->mark = _mark;
13144 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13145 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'"));
13146 }
13147 { // '[' star_targets_seq? ']'
13148 if (p->error_indicator) {
13149 D(p->level--);
13150 return NULL;
13151 }
13152 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13153 Token * _literal;
13154 Token * _literal_1;
13155 void *a;
13156 if (
13157 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13158 &&
13159 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13160 &&
13161 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13162 )
13163 {
13164 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13165 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13166 if (_token == NULL) {
13167 D(p->level--);
13168 return NULL;
13169 }
13170 int _end_lineno = _token->end_lineno;
13171 UNUSED(_end_lineno); // Only used by EXTRA macro
13172 int _end_col_offset = _token->end_col_offset;
13173 UNUSED(_end_col_offset); // Only used by EXTRA macro
13174 _res = _Py_List ( a , Store , EXTRA );
13175 if (_res == NULL && PyErr_Occurred()) {
13176 p->error_indicator = 1;
13177 D(p->level--);
13178 return NULL;
13179 }
13180 goto done;
13181 }
13182 p->mark = _mark;
13183 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13184 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'"));
13185 }
13186 _res = NULL;
13187 done:
13188 D(p->level--);
13189 return _res;
13190}
13191
13192// single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
13193static expr_ty
13194single_target_rule(Parser *p)
13195{
13196 D(p->level++);
13197 if (p->error_indicator) {
13198 D(p->level--);
13199 return NULL;
13200 }
13201 expr_ty _res = NULL;
13202 int _mark = p->mark;
13203 { // single_subscript_attribute_target
13204 if (p->error_indicator) {
13205 D(p->level--);
13206 return NULL;
13207 }
13208 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13209 expr_ty single_subscript_attribute_target_var;
13210 if (
13211 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
13212 )
13213 {
13214 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13215 _res = single_subscript_attribute_target_var;
13216 goto done;
13217 }
13218 p->mark = _mark;
13219 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13220 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
13221 }
13222 { // NAME
13223 if (p->error_indicator) {
13224 D(p->level--);
13225 return NULL;
13226 }
13227 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13228 expr_ty a;
13229 if (
13230 (a = _PyPegen_name_token(p)) // NAME
13231 )
13232 {
13233 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13234 _res = _PyPegen_set_expr_context ( p , a , Store );
13235 if (_res == NULL && PyErr_Occurred()) {
13236 p->error_indicator = 1;
13237 D(p->level--);
13238 return NULL;
13239 }
13240 goto done;
13241 }
13242 p->mark = _mark;
13243 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13244 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13245 }
13246 { // '(' single_target ')'
13247 if (p->error_indicator) {
13248 D(p->level--);
13249 return NULL;
13250 }
13251 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13252 Token * _literal;
13253 Token * _literal_1;
13254 expr_ty a;
13255 if (
13256 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13257 &&
13258 (a = single_target_rule(p)) // single_target
13259 &&
13260 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13261 )
13262 {
13263 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13264 _res = a;
13265 if (_res == NULL && PyErr_Occurred()) {
13266 p->error_indicator = 1;
13267 D(p->level--);
13268 return NULL;
13269 }
13270 goto done;
13271 }
13272 p->mark = _mark;
13273 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13274 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
13275 }
13276 _res = NULL;
13277 done:
13278 D(p->level--);
13279 return _res;
13280}
13281
13282// single_subscript_attribute_target:
13283// | t_primary '.' NAME !t_lookahead
13284// | t_primary '[' slices ']' !t_lookahead
13285static expr_ty
13286single_subscript_attribute_target_rule(Parser *p)
13287{
13288 D(p->level++);
13289 if (p->error_indicator) {
13290 D(p->level--);
13291 return NULL;
13292 }
13293 expr_ty _res = NULL;
13294 int _mark = p->mark;
13295 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13296 p->error_indicator = 1;
13297 D(p->level--);
13298 return NULL;
13299 }
13300 int _start_lineno = p->tokens[_mark]->lineno;
13301 UNUSED(_start_lineno); // Only used by EXTRA macro
13302 int _start_col_offset = p->tokens[_mark]->col_offset;
13303 UNUSED(_start_col_offset); // Only used by EXTRA macro
13304 { // t_primary '.' NAME !t_lookahead
13305 if (p->error_indicator) {
13306 D(p->level--);
13307 return NULL;
13308 }
13309 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13310 Token * _literal;
13311 expr_ty a;
13312 expr_ty b;
13313 if (
13314 (a = t_primary_rule(p)) // t_primary
13315 &&
13316 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13317 &&
13318 (b = _PyPegen_name_token(p)) // NAME
13319 &&
13320 _PyPegen_lookahead(0, t_lookahead_rule, p)
13321 )
13322 {
13323 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13324 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13325 if (_token == NULL) {
13326 D(p->level--);
13327 return NULL;
13328 }
13329 int _end_lineno = _token->end_lineno;
13330 UNUSED(_end_lineno); // Only used by EXTRA macro
13331 int _end_col_offset = _token->end_col_offset;
13332 UNUSED(_end_col_offset); // Only used by EXTRA macro
13333 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13334 if (_res == NULL && PyErr_Occurred()) {
13335 p->error_indicator = 1;
13336 D(p->level--);
13337 return NULL;
13338 }
13339 goto done;
13340 }
13341 p->mark = _mark;
13342 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13343 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13344 }
13345 { // t_primary '[' slices ']' !t_lookahead
13346 if (p->error_indicator) {
13347 D(p->level--);
13348 return NULL;
13349 }
13350 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13351 Token * _literal;
13352 Token * _literal_1;
13353 expr_ty a;
13354 expr_ty b;
13355 if (
13356 (a = t_primary_rule(p)) // t_primary
13357 &&
13358 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13359 &&
13360 (b = slices_rule(p)) // slices
13361 &&
13362 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13363 &&
13364 _PyPegen_lookahead(0, t_lookahead_rule, p)
13365 )
13366 {
13367 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13368 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13369 if (_token == NULL) {
13370 D(p->level--);
13371 return NULL;
13372 }
13373 int _end_lineno = _token->end_lineno;
13374 UNUSED(_end_lineno); // Only used by EXTRA macro
13375 int _end_col_offset = _token->end_col_offset;
13376 UNUSED(_end_col_offset); // Only used by EXTRA macro
13377 _res = _Py_Subscript ( a , b , Store , EXTRA );
13378 if (_res == NULL && PyErr_Occurred()) {
13379 p->error_indicator = 1;
13380 D(p->level--);
13381 return NULL;
13382 }
13383 goto done;
13384 }
13385 p->mark = _mark;
13386 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13387 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13388 }
13389 _res = NULL;
13390 done:
13391 D(p->level--);
13392 return _res;
13393}
13394
13395// del_targets: ','.del_target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010013396static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013397del_targets_rule(Parser *p)
13398{
13399 D(p->level++);
13400 if (p->error_indicator) {
13401 D(p->level--);
13402 return NULL;
13403 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010013404 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013405 int _mark = p->mark;
13406 { // ','.del_target+ ','?
13407 if (p->error_indicator) {
13408 D(p->level--);
13409 return NULL;
13410 }
13411 D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13412 void *_opt_var;
13413 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010013414 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013415 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010013416 (a = (asdl_expr_seq*)_gather_123_rule(p)) // ','.del_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013417 &&
13418 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13419 )
13420 {
13421 D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13422 _res = a;
13423 if (_res == NULL && PyErr_Occurred()) {
13424 p->error_indicator = 1;
13425 D(p->level--);
13426 return NULL;
13427 }
13428 goto done;
13429 }
13430 p->mark = _mark;
13431 D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
13432 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
13433 }
13434 _res = NULL;
13435 done:
13436 D(p->level--);
13437 return _res;
13438}
13439
13440// del_target:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013441// | t_primary '.' NAME !t_lookahead
13442// | t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013443// | del_t_atom
13444static expr_ty
13445del_target_rule(Parser *p)
13446{
13447 D(p->level++);
13448 if (p->error_indicator) {
13449 D(p->level--);
13450 return NULL;
13451 }
13452 expr_ty _res = NULL;
13453 if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
13454 D(p->level--);
13455 return _res;
13456 }
13457 int _mark = p->mark;
13458 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13459 p->error_indicator = 1;
13460 D(p->level--);
13461 return NULL;
13462 }
13463 int _start_lineno = p->tokens[_mark]->lineno;
13464 UNUSED(_start_lineno); // Only used by EXTRA macro
13465 int _start_col_offset = p->tokens[_mark]->col_offset;
13466 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013467 { // t_primary '.' NAME !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013468 if (p->error_indicator) {
13469 D(p->level--);
13470 return NULL;
13471 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013472 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 +010013473 Token * _literal;
13474 expr_ty a;
13475 expr_ty b;
13476 if (
13477 (a = t_primary_rule(p)) // t_primary
13478 &&
13479 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13480 &&
13481 (b = _PyPegen_name_token(p)) // NAME
13482 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013483 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013484 )
13485 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013486 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 +010013487 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13488 if (_token == NULL) {
13489 D(p->level--);
13490 return NULL;
13491 }
13492 int _end_lineno = _token->end_lineno;
13493 UNUSED(_end_lineno); // Only used by EXTRA macro
13494 int _end_col_offset = _token->end_col_offset;
13495 UNUSED(_end_col_offset); // Only used by EXTRA macro
13496 _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
13497 if (_res == NULL && PyErr_Occurred()) {
13498 p->error_indicator = 1;
13499 D(p->level--);
13500 return NULL;
13501 }
13502 goto done;
13503 }
13504 p->mark = _mark;
13505 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013506 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013507 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013508 { // t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013509 if (p->error_indicator) {
13510 D(p->level--);
13511 return NULL;
13512 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013513 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 +010013514 Token * _literal;
13515 Token * _literal_1;
13516 expr_ty a;
13517 expr_ty b;
13518 if (
13519 (a = t_primary_rule(p)) // t_primary
13520 &&
13521 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13522 &&
13523 (b = slices_rule(p)) // slices
13524 &&
13525 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13526 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013527 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013528 )
13529 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013530 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 +010013531 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13532 if (_token == NULL) {
13533 D(p->level--);
13534 return NULL;
13535 }
13536 int _end_lineno = _token->end_lineno;
13537 UNUSED(_end_lineno); // Only used by EXTRA macro
13538 int _end_col_offset = _token->end_col_offset;
13539 UNUSED(_end_col_offset); // Only used by EXTRA macro
13540 _res = _Py_Subscript ( a , b , Del , EXTRA );
13541 if (_res == NULL && PyErr_Occurred()) {
13542 p->error_indicator = 1;
13543 D(p->level--);
13544 return NULL;
13545 }
13546 goto done;
13547 }
13548 p->mark = _mark;
13549 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013550 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013551 }
13552 { // del_t_atom
13553 if (p->error_indicator) {
13554 D(p->level--);
13555 return NULL;
13556 }
13557 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13558 expr_ty del_t_atom_var;
13559 if (
13560 (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom
13561 )
13562 {
13563 D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13564 _res = del_t_atom_var;
13565 goto done;
13566 }
13567 p->mark = _mark;
13568 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
13569 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
13570 }
13571 _res = NULL;
13572 done:
13573 _PyPegen_insert_memo(p, _mark, del_target_type, _res);
13574 D(p->level--);
13575 return _res;
13576}
13577
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013578// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013579static expr_ty
13580del_t_atom_rule(Parser *p)
13581{
13582 D(p->level++);
13583 if (p->error_indicator) {
13584 D(p->level--);
13585 return NULL;
13586 }
13587 expr_ty _res = NULL;
13588 int _mark = p->mark;
13589 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13590 p->error_indicator = 1;
13591 D(p->level--);
13592 return NULL;
13593 }
13594 int _start_lineno = p->tokens[_mark]->lineno;
13595 UNUSED(_start_lineno); // Only used by EXTRA macro
13596 int _start_col_offset = p->tokens[_mark]->col_offset;
13597 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013598 { // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013599 if (p->error_indicator) {
13600 D(p->level--);
13601 return NULL;
13602 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013603 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013604 expr_ty a;
13605 if (
13606 (a = _PyPegen_name_token(p)) // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013607 )
13608 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013609 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 +010013610 _res = _PyPegen_set_expr_context ( p , a , Del );
13611 if (_res == NULL && PyErr_Occurred()) {
13612 p->error_indicator = 1;
13613 D(p->level--);
13614 return NULL;
13615 }
13616 goto done;
13617 }
13618 p->mark = _mark;
13619 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013620 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013621 }
13622 { // '(' del_target ')'
13623 if (p->error_indicator) {
13624 D(p->level--);
13625 return NULL;
13626 }
13627 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13628 Token * _literal;
13629 Token * _literal_1;
13630 expr_ty a;
13631 if (
13632 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13633 &&
13634 (a = del_target_rule(p)) // del_target
13635 &&
13636 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13637 )
13638 {
13639 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13640 _res = _PyPegen_set_expr_context ( p , a , Del );
13641 if (_res == NULL && PyErr_Occurred()) {
13642 p->error_indicator = 1;
13643 D(p->level--);
13644 return NULL;
13645 }
13646 goto done;
13647 }
13648 p->mark = _mark;
13649 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13650 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
13651 }
13652 { // '(' del_targets? ')'
13653 if (p->error_indicator) {
13654 D(p->level--);
13655 return NULL;
13656 }
13657 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13658 Token * _literal;
13659 Token * _literal_1;
13660 void *a;
13661 if (
13662 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13663 &&
13664 (a = del_targets_rule(p), 1) // del_targets?
13665 &&
13666 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13667 )
13668 {
13669 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13670 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13671 if (_token == NULL) {
13672 D(p->level--);
13673 return NULL;
13674 }
13675 int _end_lineno = _token->end_lineno;
13676 UNUSED(_end_lineno); // Only used by EXTRA macro
13677 int _end_col_offset = _token->end_col_offset;
13678 UNUSED(_end_col_offset); // Only used by EXTRA macro
13679 _res = _Py_Tuple ( a , Del , EXTRA );
13680 if (_res == NULL && PyErr_Occurred()) {
13681 p->error_indicator = 1;
13682 D(p->level--);
13683 return NULL;
13684 }
13685 goto done;
13686 }
13687 p->mark = _mark;
13688 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13689 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
13690 }
13691 { // '[' del_targets? ']'
13692 if (p->error_indicator) {
13693 D(p->level--);
13694 return NULL;
13695 }
13696 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13697 Token * _literal;
13698 Token * _literal_1;
13699 void *a;
13700 if (
13701 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13702 &&
13703 (a = del_targets_rule(p), 1) // del_targets?
13704 &&
13705 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13706 )
13707 {
13708 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13709 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13710 if (_token == NULL) {
13711 D(p->level--);
13712 return NULL;
13713 }
13714 int _end_lineno = _token->end_lineno;
13715 UNUSED(_end_lineno); // Only used by EXTRA macro
13716 int _end_col_offset = _token->end_col_offset;
13717 UNUSED(_end_col_offset); // Only used by EXTRA macro
13718 _res = _Py_List ( a , Del , EXTRA );
13719 if (_res == NULL && PyErr_Occurred()) {
13720 p->error_indicator = 1;
13721 D(p->level--);
13722 return NULL;
13723 }
13724 goto done;
13725 }
13726 p->mark = _mark;
13727 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13728 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
13729 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013730 _res = NULL;
13731 done:
13732 D(p->level--);
13733 return _res;
13734}
13735
13736// targets: ','.target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010013737static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013738targets_rule(Parser *p)
13739{
13740 D(p->level++);
13741 if (p->error_indicator) {
13742 D(p->level--);
13743 return NULL;
13744 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010013745 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013746 int _mark = p->mark;
13747 { // ','.target+ ','?
13748 if (p->error_indicator) {
13749 D(p->level--);
13750 return NULL;
13751 }
13752 D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13753 void *_opt_var;
13754 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010013755 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013756 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010013757 (a = (asdl_expr_seq*)_gather_125_rule(p)) // ','.target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013758 &&
13759 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13760 )
13761 {
13762 D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13763 _res = a;
13764 if (_res == NULL && PyErr_Occurred()) {
13765 p->error_indicator = 1;
13766 D(p->level--);
13767 return NULL;
13768 }
13769 goto done;
13770 }
13771 p->mark = _mark;
13772 D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ',
13773 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?"));
13774 }
13775 _res = NULL;
13776 done:
13777 D(p->level--);
13778 return _res;
13779}
13780
13781// target:
13782// | t_primary '.' NAME !t_lookahead
13783// | t_primary '[' slices ']' !t_lookahead
13784// | t_atom
13785static expr_ty
13786target_rule(Parser *p)
13787{
13788 D(p->level++);
13789 if (p->error_indicator) {
13790 D(p->level--);
13791 return NULL;
13792 }
13793 expr_ty _res = NULL;
13794 if (_PyPegen_is_memoized(p, target_type, &_res)) {
13795 D(p->level--);
13796 return _res;
13797 }
13798 int _mark = p->mark;
13799 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13800 p->error_indicator = 1;
13801 D(p->level--);
13802 return NULL;
13803 }
13804 int _start_lineno = p->tokens[_mark]->lineno;
13805 UNUSED(_start_lineno); // Only used by EXTRA macro
13806 int _start_col_offset = p->tokens[_mark]->col_offset;
13807 UNUSED(_start_col_offset); // Only used by EXTRA macro
13808 { // t_primary '.' NAME !t_lookahead
13809 if (p->error_indicator) {
13810 D(p->level--);
13811 return NULL;
13812 }
13813 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13814 Token * _literal;
13815 expr_ty a;
13816 expr_ty b;
13817 if (
13818 (a = t_primary_rule(p)) // t_primary
13819 &&
13820 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13821 &&
13822 (b = _PyPegen_name_token(p)) // NAME
13823 &&
13824 _PyPegen_lookahead(0, t_lookahead_rule, p)
13825 )
13826 {
13827 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13828 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13829 if (_token == NULL) {
13830 D(p->level--);
13831 return NULL;
13832 }
13833 int _end_lineno = _token->end_lineno;
13834 UNUSED(_end_lineno); // Only used by EXTRA macro
13835 int _end_col_offset = _token->end_col_offset;
13836 UNUSED(_end_col_offset); // Only used by EXTRA macro
13837 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13838 if (_res == NULL && PyErr_Occurred()) {
13839 p->error_indicator = 1;
13840 D(p->level--);
13841 return NULL;
13842 }
13843 goto done;
13844 }
13845 p->mark = _mark;
13846 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13847 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13848 }
13849 { // t_primary '[' slices ']' !t_lookahead
13850 if (p->error_indicator) {
13851 D(p->level--);
13852 return NULL;
13853 }
13854 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13855 Token * _literal;
13856 Token * _literal_1;
13857 expr_ty a;
13858 expr_ty b;
13859 if (
13860 (a = t_primary_rule(p)) // t_primary
13861 &&
13862 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13863 &&
13864 (b = slices_rule(p)) // slices
13865 &&
13866 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13867 &&
13868 _PyPegen_lookahead(0, t_lookahead_rule, p)
13869 )
13870 {
13871 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13872 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13873 if (_token == NULL) {
13874 D(p->level--);
13875 return NULL;
13876 }
13877 int _end_lineno = _token->end_lineno;
13878 UNUSED(_end_lineno); // Only used by EXTRA macro
13879 int _end_col_offset = _token->end_col_offset;
13880 UNUSED(_end_col_offset); // Only used by EXTRA macro
13881 _res = _Py_Subscript ( a , b , Store , EXTRA );
13882 if (_res == NULL && PyErr_Occurred()) {
13883 p->error_indicator = 1;
13884 D(p->level--);
13885 return NULL;
13886 }
13887 goto done;
13888 }
13889 p->mark = _mark;
13890 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13891 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13892 }
13893 { // t_atom
13894 if (p->error_indicator) {
13895 D(p->level--);
13896 return NULL;
13897 }
13898 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom"));
13899 expr_ty t_atom_var;
13900 if (
13901 (t_atom_var = t_atom_rule(p)) // t_atom
13902 )
13903 {
13904 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom"));
13905 _res = t_atom_var;
13906 goto done;
13907 }
13908 p->mark = _mark;
13909 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13910 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom"));
13911 }
13912 _res = NULL;
13913 done:
13914 _PyPegen_insert_memo(p, _mark, target_type, _res);
13915 D(p->level--);
13916 return _res;
13917}
13918
13919// Left-recursive
13920// t_primary:
13921// | t_primary '.' NAME &t_lookahead
13922// | t_primary '[' slices ']' &t_lookahead
13923// | t_primary genexp &t_lookahead
13924// | t_primary '(' arguments? ')' &t_lookahead
13925// | atom &t_lookahead
13926static expr_ty t_primary_raw(Parser *);
13927static expr_ty
13928t_primary_rule(Parser *p)
13929{
13930 D(p->level++);
13931 expr_ty _res = NULL;
13932 if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
13933 D(p->level--);
13934 return _res;
13935 }
13936 int _mark = p->mark;
13937 int _resmark = p->mark;
13938 while (1) {
13939 int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
13940 if (tmpvar_8) {
13941 D(p->level--);
13942 return _res;
13943 }
13944 p->mark = _mark;
13945 void *_raw = t_primary_raw(p);
13946 if (_raw == NULL || p->mark <= _resmark)
13947 break;
13948 _resmark = p->mark;
13949 _res = _raw;
13950 }
13951 p->mark = _resmark;
13952 D(p->level--);
13953 return _res;
13954}
13955static expr_ty
13956t_primary_raw(Parser *p)
13957{
13958 D(p->level++);
13959 if (p->error_indicator) {
13960 D(p->level--);
13961 return NULL;
13962 }
13963 expr_ty _res = NULL;
13964 int _mark = p->mark;
13965 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13966 p->error_indicator = 1;
13967 D(p->level--);
13968 return NULL;
13969 }
13970 int _start_lineno = p->tokens[_mark]->lineno;
13971 UNUSED(_start_lineno); // Only used by EXTRA macro
13972 int _start_col_offset = p->tokens[_mark]->col_offset;
13973 UNUSED(_start_col_offset); // Only used by EXTRA macro
13974 { // t_primary '.' NAME &t_lookahead
13975 if (p->error_indicator) {
13976 D(p->level--);
13977 return NULL;
13978 }
13979 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13980 Token * _literal;
13981 expr_ty a;
13982 expr_ty b;
13983 if (
13984 (a = t_primary_rule(p)) // t_primary
13985 &&
13986 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13987 &&
13988 (b = _PyPegen_name_token(p)) // NAME
13989 &&
13990 _PyPegen_lookahead(1, t_lookahead_rule, p)
13991 )
13992 {
13993 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13994 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13995 if (_token == NULL) {
13996 D(p->level--);
13997 return NULL;
13998 }
13999 int _end_lineno = _token->end_lineno;
14000 UNUSED(_end_lineno); // Only used by EXTRA macro
14001 int _end_col_offset = _token->end_col_offset;
14002 UNUSED(_end_col_offset); // Only used by EXTRA macro
14003 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
14004 if (_res == NULL && PyErr_Occurred()) {
14005 p->error_indicator = 1;
14006 D(p->level--);
14007 return NULL;
14008 }
14009 goto done;
14010 }
14011 p->mark = _mark;
14012 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14013 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
14014 }
14015 { // t_primary '[' slices ']' &t_lookahead
14016 if (p->error_indicator) {
14017 D(p->level--);
14018 return NULL;
14019 }
14020 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14021 Token * _literal;
14022 Token * _literal_1;
14023 expr_ty a;
14024 expr_ty b;
14025 if (
14026 (a = t_primary_rule(p)) // t_primary
14027 &&
14028 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14029 &&
14030 (b = slices_rule(p)) // slices
14031 &&
14032 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14033 &&
14034 _PyPegen_lookahead(1, t_lookahead_rule, p)
14035 )
14036 {
14037 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14038 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14039 if (_token == NULL) {
14040 D(p->level--);
14041 return NULL;
14042 }
14043 int _end_lineno = _token->end_lineno;
14044 UNUSED(_end_lineno); // Only used by EXTRA macro
14045 int _end_col_offset = _token->end_col_offset;
14046 UNUSED(_end_col_offset); // Only used by EXTRA macro
14047 _res = _Py_Subscript ( a , b , Load , EXTRA );
14048 if (_res == NULL && PyErr_Occurred()) {
14049 p->error_indicator = 1;
14050 D(p->level--);
14051 return NULL;
14052 }
14053 goto done;
14054 }
14055 p->mark = _mark;
14056 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14057 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14058 }
14059 { // t_primary genexp &t_lookahead
14060 if (p->error_indicator) {
14061 D(p->level--);
14062 return NULL;
14063 }
14064 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14065 expr_ty a;
14066 expr_ty b;
14067 if (
14068 (a = t_primary_rule(p)) // t_primary
14069 &&
14070 (b = genexp_rule(p)) // genexp
14071 &&
14072 _PyPegen_lookahead(1, t_lookahead_rule, p)
14073 )
14074 {
14075 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14076 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14077 if (_token == NULL) {
14078 D(p->level--);
14079 return NULL;
14080 }
14081 int _end_lineno = _token->end_lineno;
14082 UNUSED(_end_lineno); // Only used by EXTRA macro
14083 int _end_col_offset = _token->end_col_offset;
14084 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030014085 _res = _Py_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014086 if (_res == NULL && PyErr_Occurred()) {
14087 p->error_indicator = 1;
14088 D(p->level--);
14089 return NULL;
14090 }
14091 goto done;
14092 }
14093 p->mark = _mark;
14094 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14095 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
14096 }
14097 { // t_primary '(' arguments? ')' &t_lookahead
14098 if (p->error_indicator) {
14099 D(p->level--);
14100 return NULL;
14101 }
14102 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14103 Token * _literal;
14104 Token * _literal_1;
14105 expr_ty a;
14106 void *b;
14107 if (
14108 (a = t_primary_rule(p)) // t_primary
14109 &&
14110 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14111 &&
14112 (b = arguments_rule(p), 1) // arguments?
14113 &&
14114 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14115 &&
14116 _PyPegen_lookahead(1, t_lookahead_rule, p)
14117 )
14118 {
14119 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14120 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14121 if (_token == NULL) {
14122 D(p->level--);
14123 return NULL;
14124 }
14125 int _end_lineno = _token->end_lineno;
14126 UNUSED(_end_lineno); // Only used by EXTRA macro
14127 int _end_col_offset = _token->end_col_offset;
14128 UNUSED(_end_col_offset); // Only used by EXTRA macro
14129 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
14130 if (_res == NULL && PyErr_Occurred()) {
14131 p->error_indicator = 1;
14132 D(p->level--);
14133 return NULL;
14134 }
14135 goto done;
14136 }
14137 p->mark = _mark;
14138 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14139 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14140 }
14141 { // atom &t_lookahead
14142 if (p->error_indicator) {
14143 D(p->level--);
14144 return NULL;
14145 }
14146 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14147 expr_ty a;
14148 if (
14149 (a = atom_rule(p)) // atom
14150 &&
14151 _PyPegen_lookahead(1, t_lookahead_rule, p)
14152 )
14153 {
14154 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14155 _res = a;
14156 if (_res == NULL && PyErr_Occurred()) {
14157 p->error_indicator = 1;
14158 D(p->level--);
14159 return NULL;
14160 }
14161 goto done;
14162 }
14163 p->mark = _mark;
14164 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14165 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
14166 }
14167 _res = NULL;
14168 done:
14169 D(p->level--);
14170 return _res;
14171}
14172
14173// t_lookahead: '(' | '[' | '.'
14174static void *
14175t_lookahead_rule(Parser *p)
14176{
14177 D(p->level++);
14178 if (p->error_indicator) {
14179 D(p->level--);
14180 return NULL;
14181 }
14182 void * _res = NULL;
14183 int _mark = p->mark;
14184 { // '('
14185 if (p->error_indicator) {
14186 D(p->level--);
14187 return NULL;
14188 }
14189 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
14190 Token * _literal;
14191 if (
14192 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14193 )
14194 {
14195 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
14196 _res = _literal;
14197 goto done;
14198 }
14199 p->mark = _mark;
14200 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14201 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
14202 }
14203 { // '['
14204 if (p->error_indicator) {
14205 D(p->level--);
14206 return NULL;
14207 }
14208 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
14209 Token * _literal;
14210 if (
14211 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14212 )
14213 {
14214 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
14215 _res = _literal;
14216 goto done;
14217 }
14218 p->mark = _mark;
14219 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14220 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
14221 }
14222 { // '.'
14223 if (p->error_indicator) {
14224 D(p->level--);
14225 return NULL;
14226 }
14227 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
14228 Token * _literal;
14229 if (
14230 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
14231 )
14232 {
14233 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
14234 _res = _literal;
14235 goto done;
14236 }
14237 p->mark = _mark;
14238 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14239 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
14240 }
14241 _res = NULL;
14242 done:
14243 D(p->level--);
14244 return _res;
14245}
14246
14247// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
14248static expr_ty
14249t_atom_rule(Parser *p)
14250{
14251 D(p->level++);
14252 if (p->error_indicator) {
14253 D(p->level--);
14254 return NULL;
14255 }
14256 expr_ty _res = NULL;
14257 int _mark = p->mark;
14258 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
14259 p->error_indicator = 1;
14260 D(p->level--);
14261 return NULL;
14262 }
14263 int _start_lineno = p->tokens[_mark]->lineno;
14264 UNUSED(_start_lineno); // Only used by EXTRA macro
14265 int _start_col_offset = p->tokens[_mark]->col_offset;
14266 UNUSED(_start_col_offset); // Only used by EXTRA macro
14267 { // NAME
14268 if (p->error_indicator) {
14269 D(p->level--);
14270 return NULL;
14271 }
14272 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
14273 expr_ty a;
14274 if (
14275 (a = _PyPegen_name_token(p)) // NAME
14276 )
14277 {
14278 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
14279 _res = _PyPegen_set_expr_context ( p , a , Store );
14280 if (_res == NULL && PyErr_Occurred()) {
14281 p->error_indicator = 1;
14282 D(p->level--);
14283 return NULL;
14284 }
14285 goto done;
14286 }
14287 p->mark = _mark;
14288 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14289 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
14290 }
14291 { // '(' target ')'
14292 if (p->error_indicator) {
14293 D(p->level--);
14294 return NULL;
14295 }
14296 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14297 Token * _literal;
14298 Token * _literal_1;
14299 expr_ty a;
14300 if (
14301 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14302 &&
14303 (a = target_rule(p)) // target
14304 &&
14305 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14306 )
14307 {
14308 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14309 _res = _PyPegen_set_expr_context ( p , a , Store );
14310 if (_res == NULL && PyErr_Occurred()) {
14311 p->error_indicator = 1;
14312 D(p->level--);
14313 return NULL;
14314 }
14315 goto done;
14316 }
14317 p->mark = _mark;
14318 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14319 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'"));
14320 }
14321 { // '(' targets? ')'
14322 if (p->error_indicator) {
14323 D(p->level--);
14324 return NULL;
14325 }
14326 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14327 Token * _literal;
14328 Token * _literal_1;
14329 void *b;
14330 if (
14331 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14332 &&
14333 (b = targets_rule(p), 1) // targets?
14334 &&
14335 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14336 )
14337 {
14338 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14339 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14340 if (_token == NULL) {
14341 D(p->level--);
14342 return NULL;
14343 }
14344 int _end_lineno = _token->end_lineno;
14345 UNUSED(_end_lineno); // Only used by EXTRA macro
14346 int _end_col_offset = _token->end_col_offset;
14347 UNUSED(_end_col_offset); // Only used by EXTRA macro
14348 _res = _Py_Tuple ( b , Store , EXTRA );
14349 if (_res == NULL && PyErr_Occurred()) {
14350 p->error_indicator = 1;
14351 D(p->level--);
14352 return NULL;
14353 }
14354 goto done;
14355 }
14356 p->mark = _mark;
14357 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14358 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'"));
14359 }
14360 { // '[' targets? ']'
14361 if (p->error_indicator) {
14362 D(p->level--);
14363 return NULL;
14364 }
14365 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14366 Token * _literal;
14367 Token * _literal_1;
14368 void *b;
14369 if (
14370 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14371 &&
14372 (b = targets_rule(p), 1) // targets?
14373 &&
14374 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14375 )
14376 {
14377 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14378 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14379 if (_token == NULL) {
14380 D(p->level--);
14381 return NULL;
14382 }
14383 int _end_lineno = _token->end_lineno;
14384 UNUSED(_end_lineno); // Only used by EXTRA macro
14385 int _end_col_offset = _token->end_col_offset;
14386 UNUSED(_end_col_offset); // Only used by EXTRA macro
14387 _res = _Py_List ( b , Store , EXTRA );
14388 if (_res == NULL && PyErr_Occurred()) {
14389 p->error_indicator = 1;
14390 D(p->level--);
14391 return NULL;
14392 }
14393 goto done;
14394 }
14395 p->mark = _mark;
14396 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14397 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'"));
14398 }
14399 _res = NULL;
14400 done:
14401 D(p->level--);
14402 return _res;
14403}
14404
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014405// invalid_arguments:
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014406// | args ',' '*'
14407// | expression for_if_clauses ',' [args | expression for_if_clauses]
14408// | args for_if_clauses
14409// | args ',' expression for_if_clauses
14410// | args ',' args
14411static void *
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014412invalid_arguments_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014413{
14414 D(p->level++);
14415 if (p->error_indicator) {
14416 D(p->level--);
14417 return NULL;
14418 }
14419 void * _res = NULL;
14420 int _mark = p->mark;
14421 { // args ',' '*'
14422 if (p->error_indicator) {
14423 D(p->level--);
14424 return NULL;
14425 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014426 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014427 Token * _literal;
14428 Token * _literal_1;
14429 expr_ty args_var;
14430 if (
14431 (args_var = args_rule(p)) // args
14432 &&
14433 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14434 &&
14435 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
14436 )
14437 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014438 D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014439 _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
14440 if (_res == NULL && PyErr_Occurred()) {
14441 p->error_indicator = 1;
14442 D(p->level--);
14443 return NULL;
14444 }
14445 goto done;
14446 }
14447 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014448 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014449 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'"));
14450 }
14451 { // expression for_if_clauses ',' [args | expression for_if_clauses]
14452 if (p->error_indicator) {
14453 D(p->level--);
14454 return NULL;
14455 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014456 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014457 Token * _literal;
14458 void *_opt_var;
14459 UNUSED(_opt_var); // Silence compiler warnings
14460 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014461 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014462 if (
14463 (a = expression_rule(p)) // expression
14464 &&
14465 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14466 &&
14467 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14468 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014469 (_opt_var = _tmp_127_rule(p), 1) // [args | expression for_if_clauses]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014470 )
14471 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014472 D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014473 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14474 if (_res == NULL && PyErr_Occurred()) {
14475 p->error_indicator = 1;
14476 D(p->level--);
14477 return NULL;
14478 }
14479 goto done;
14480 }
14481 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014482 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014483 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14484 }
14485 { // args for_if_clauses
14486 if (p->error_indicator) {
14487 D(p->level--);
14488 return NULL;
14489 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014490 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014491 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014492 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014493 if (
14494 (a = args_rule(p)) // args
14495 &&
14496 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14497 )
14498 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014499 D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014500 _res = _PyPegen_nonparen_genexp_in_call ( p , a );
14501 if (_res == NULL && PyErr_Occurred()) {
14502 p->error_indicator = 1;
14503 D(p->level--);
14504 return NULL;
14505 }
14506 goto done;
14507 }
14508 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014509 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014510 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
14511 }
14512 { // args ',' expression for_if_clauses
14513 if (p->error_indicator) {
14514 D(p->level--);
14515 return NULL;
14516 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014517 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014518 Token * _literal;
14519 expr_ty a;
14520 expr_ty args_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014521 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014522 if (
14523 (args_var = args_rule(p)) // args
14524 &&
14525 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14526 &&
14527 (a = expression_rule(p)) // expression
14528 &&
14529 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14530 )
14531 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014532 D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014533 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14534 if (_res == NULL && PyErr_Occurred()) {
14535 p->error_indicator = 1;
14536 D(p->level--);
14537 return NULL;
14538 }
14539 goto done;
14540 }
14541 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014542 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014543 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
14544 }
14545 { // args ',' args
14546 if (p->error_indicator) {
14547 D(p->level--);
14548 return NULL;
14549 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014550 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014551 Token * _literal;
14552 expr_ty a;
14553 expr_ty args_var;
14554 if (
14555 (a = args_rule(p)) // args
14556 &&
14557 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14558 &&
14559 (args_var = args_rule(p)) // args
14560 )
14561 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014562 D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014563 _res = _PyPegen_arguments_parsing_error ( p , a );
14564 if (_res == NULL && PyErr_Occurred()) {
14565 p->error_indicator = 1;
14566 D(p->level--);
14567 return NULL;
14568 }
14569 goto done;
14570 }
14571 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014572 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014573 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
14574 }
14575 _res = NULL;
14576 done:
14577 D(p->level--);
14578 return _res;
14579}
14580
14581// invalid_kwarg: expression '='
14582static void *
14583invalid_kwarg_rule(Parser *p)
14584{
14585 D(p->level++);
14586 if (p->error_indicator) {
14587 D(p->level--);
14588 return NULL;
14589 }
14590 void * _res = NULL;
14591 int _mark = p->mark;
14592 { // expression '='
14593 if (p->error_indicator) {
14594 D(p->level--);
14595 return NULL;
14596 }
14597 D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='"));
14598 Token * _literal;
14599 expr_ty a;
14600 if (
14601 (a = expression_rule(p)) // expression
14602 &&
14603 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14604 )
14605 {
14606 D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='"));
14607 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" );
14608 if (_res == NULL && PyErr_Occurred()) {
14609 p->error_indicator = 1;
14610 D(p->level--);
14611 return NULL;
14612 }
14613 goto done;
14614 }
14615 p->mark = _mark;
14616 D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
14617 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='"));
14618 }
14619 _res = NULL;
14620 done:
14621 D(p->level--);
14622 return _res;
14623}
14624
14625// invalid_named_expression: expression ':=' expression
14626static void *
14627invalid_named_expression_rule(Parser *p)
14628{
14629 D(p->level++);
14630 if (p->error_indicator) {
14631 D(p->level--);
14632 return NULL;
14633 }
14634 void * _res = NULL;
14635 int _mark = p->mark;
14636 { // expression ':=' expression
14637 if (p->error_indicator) {
14638 D(p->level--);
14639 return NULL;
14640 }
14641 D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14642 Token * _literal;
14643 expr_ty a;
14644 expr_ty expression_var;
14645 if (
14646 (a = expression_rule(p)) // expression
14647 &&
14648 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
14649 &&
14650 (expression_var = expression_rule(p)) // expression
14651 )
14652 {
14653 D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14654 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
14655 if (_res == NULL && PyErr_Occurred()) {
14656 p->error_indicator = 1;
14657 D(p->level--);
14658 return NULL;
14659 }
14660 goto done;
14661 }
14662 p->mark = _mark;
14663 D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
14664 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
14665 }
14666 _res = NULL;
14667 done:
14668 D(p->level--);
14669 return _res;
14670}
14671
14672// invalid_assignment:
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014673// | invalid_ann_assign_target ':' expression
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014674// | star_named_expression ',' star_named_expressions* ':' expression
14675// | expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014676// | ((star_targets '='))* star_expressions '='
14677// | ((star_targets '='))* yield_expr '='
14678// | star_expressions augassign (yield_expr | star_expressions)
14679static void *
14680invalid_assignment_rule(Parser *p)
14681{
14682 D(p->level++);
14683 if (p->error_indicator) {
14684 D(p->level--);
14685 return NULL;
14686 }
14687 void * _res = NULL;
14688 int _mark = p->mark;
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014689 { // invalid_ann_assign_target ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014690 if (p->error_indicator) {
14691 D(p->level--);
14692 return NULL;
14693 }
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014694 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 +010014695 Token * _literal;
14696 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014697 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014698 if (
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014699 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014700 &&
14701 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014702 &&
14703 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014704 )
14705 {
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014706 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
14707 _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 +010014708 if (_res == NULL && PyErr_Occurred()) {
14709 p->error_indicator = 1;
14710 D(p->level--);
14711 return NULL;
14712 }
14713 goto done;
14714 }
14715 p->mark = _mark;
14716 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014717 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014718 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014719 { // star_named_expression ',' star_named_expressions* ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014720 if (p->error_indicator) {
14721 D(p->level--);
14722 return NULL;
14723 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014724 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 +010014725 Token * _literal;
14726 Token * _literal_1;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014727 asdl_seq * _loop0_128_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014728 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014729 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014730 if (
14731 (a = star_named_expression_rule(p)) // star_named_expression
14732 &&
14733 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14734 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014735 (_loop0_128_var = _loop0_128_rule(p)) // star_named_expressions*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014736 &&
14737 (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014738 &&
14739 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014740 )
14741 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014742 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 +010014743 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
14744 if (_res == NULL && PyErr_Occurred()) {
14745 p->error_indicator = 1;
14746 D(p->level--);
14747 return NULL;
14748 }
14749 goto done;
14750 }
14751 p->mark = _mark;
14752 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014753 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014754 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014755 { // expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014756 if (p->error_indicator) {
14757 D(p->level--);
14758 return NULL;
14759 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014760 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014761 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014762 expr_ty a;
14763 expr_ty expression_var;
14764 if (
14765 (a = expression_rule(p)) // expression
14766 &&
14767 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
14768 &&
14769 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014770 )
14771 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014772 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 +010014773 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
14774 if (_res == NULL && PyErr_Occurred()) {
14775 p->error_indicator = 1;
14776 D(p->level--);
14777 return NULL;
14778 }
14779 goto done;
14780 }
14781 p->mark = _mark;
14782 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014783 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014784 }
14785 { // ((star_targets '='))* star_expressions '='
14786 if (p->error_indicator) {
14787 D(p->level--);
14788 return NULL;
14789 }
14790 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14791 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014792 asdl_seq * _loop0_129_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014793 expr_ty a;
14794 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014795 (_loop0_129_var = _loop0_129_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014796 &&
14797 (a = star_expressions_rule(p)) // star_expressions
14798 &&
14799 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14800 )
14801 {
14802 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 +030014803 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014804 if (_res == NULL && PyErr_Occurred()) {
14805 p->error_indicator = 1;
14806 D(p->level--);
14807 return NULL;
14808 }
14809 goto done;
14810 }
14811 p->mark = _mark;
14812 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14813 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14814 }
14815 { // ((star_targets '='))* yield_expr '='
14816 if (p->error_indicator) {
14817 D(p->level--);
14818 return NULL;
14819 }
14820 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14821 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014822 asdl_seq * _loop0_130_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014823 expr_ty a;
14824 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014825 (_loop0_130_var = _loop0_130_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014826 &&
14827 (a = yield_expr_rule(p)) // yield_expr
14828 &&
14829 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14830 )
14831 {
14832 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14833 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
14834 if (_res == NULL && PyErr_Occurred()) {
14835 p->error_indicator = 1;
14836 D(p->level--);
14837 return NULL;
14838 }
14839 goto done;
14840 }
14841 p->mark = _mark;
14842 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14843 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14844 }
14845 { // star_expressions augassign (yield_expr | star_expressions)
14846 if (p->error_indicator) {
14847 D(p->level--);
14848 return NULL;
14849 }
14850 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010014851 void *_tmp_131_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014852 expr_ty a;
14853 AugOperator* augassign_var;
14854 if (
14855 (a = star_expressions_rule(p)) // star_expressions
14856 &&
14857 (augassign_var = augassign_rule(p)) // augassign
14858 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014859 (_tmp_131_var = _tmp_131_rule(p)) // yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014860 )
14861 {
14862 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14863 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
14864 if (_res == NULL && PyErr_Occurred()) {
14865 p->error_indicator = 1;
14866 D(p->level--);
14867 return NULL;
14868 }
14869 goto done;
14870 }
14871 p->mark = _mark;
14872 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14873 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14874 }
14875 _res = NULL;
14876 done:
14877 D(p->level--);
14878 return _res;
14879}
14880
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014881// invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
14882static expr_ty
14883invalid_ann_assign_target_rule(Parser *p)
14884{
14885 D(p->level++);
14886 if (p->error_indicator) {
14887 D(p->level--);
14888 return NULL;
14889 }
14890 expr_ty _res = NULL;
14891 int _mark = p->mark;
14892 { // list
14893 if (p->error_indicator) {
14894 D(p->level--);
14895 return NULL;
14896 }
14897 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
14898 expr_ty list_var;
14899 if (
14900 (list_var = list_rule(p)) // list
14901 )
14902 {
14903 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
14904 _res = list_var;
14905 goto done;
14906 }
14907 p->mark = _mark;
14908 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14909 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
14910 }
14911 { // tuple
14912 if (p->error_indicator) {
14913 D(p->level--);
14914 return NULL;
14915 }
14916 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
14917 expr_ty tuple_var;
14918 if (
14919 (tuple_var = tuple_rule(p)) // tuple
14920 )
14921 {
14922 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
14923 _res = tuple_var;
14924 goto done;
14925 }
14926 p->mark = _mark;
14927 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14928 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
14929 }
14930 { // '(' invalid_ann_assign_target ')'
14931 if (p->error_indicator) {
14932 D(p->level--);
14933 return NULL;
14934 }
14935 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14936 Token * _literal;
14937 Token * _literal_1;
14938 expr_ty a;
14939 if (
14940 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14941 &&
14942 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
14943 &&
14944 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14945 )
14946 {
14947 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14948 _res = a;
14949 if (_res == NULL && PyErr_Occurred()) {
14950 p->error_indicator = 1;
14951 D(p->level--);
14952 return NULL;
14953 }
14954 goto done;
14955 }
14956 p->mark = _mark;
14957 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14958 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14959 }
14960 _res = NULL;
14961 done:
14962 D(p->level--);
14963 return _res;
14964}
14965
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014966// invalid_del_stmt: 'del' star_expressions
14967static void *
14968invalid_del_stmt_rule(Parser *p)
14969{
14970 D(p->level++);
14971 if (p->error_indicator) {
14972 D(p->level--);
14973 return NULL;
14974 }
14975 void * _res = NULL;
14976 int _mark = p->mark;
14977 { // 'del' star_expressions
14978 if (p->error_indicator) {
14979 D(p->level--);
14980 return NULL;
14981 }
14982 D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
14983 Token * _keyword;
14984 expr_ty a;
14985 if (
14986 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
14987 &&
14988 (a = star_expressions_rule(p)) // star_expressions
14989 )
14990 {
14991 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 +030014992 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014993 if (_res == NULL && PyErr_Occurred()) {
14994 p->error_indicator = 1;
14995 D(p->level--);
14996 return NULL;
14997 }
14998 goto done;
14999 }
15000 p->mark = _mark;
15001 D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
15002 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
15003 }
15004 _res = NULL;
15005 done:
15006 D(p->level--);
15007 return _res;
15008}
15009
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015010// invalid_block: NEWLINE !INDENT
15011static void *
15012invalid_block_rule(Parser *p)
15013{
15014 D(p->level++);
15015 if (p->error_indicator) {
15016 D(p->level--);
15017 return NULL;
15018 }
15019 void * _res = NULL;
15020 int _mark = p->mark;
15021 { // NEWLINE !INDENT
15022 if (p->error_indicator) {
15023 D(p->level--);
15024 return NULL;
15025 }
15026 D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
15027 Token * newline_var;
15028 if (
15029 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15030 &&
15031 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
15032 )
15033 {
15034 D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
15035 _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
15036 if (_res == NULL && PyErr_Occurred()) {
15037 p->error_indicator = 1;
15038 D(p->level--);
15039 return NULL;
15040 }
15041 goto done;
15042 }
15043 p->mark = _mark;
15044 D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
15045 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
15046 }
15047 _res = NULL;
15048 done:
15049 D(p->level--);
15050 return _res;
15051}
15052
Lysandros Nikolaou15acc4e2020-10-27 20:54:20 +020015053// Left-recursive
15054// invalid_primary: primary '{'
15055static void *
15056invalid_primary_rule(Parser *p)
15057{
15058 D(p->level++);
15059 if (p->error_indicator) {
15060 D(p->level--);
15061 return NULL;
15062 }
15063 void * _res = NULL;
15064 int _mark = p->mark;
15065 { // primary '{'
15066 if (p->error_indicator) {
15067 D(p->level--);
15068 return NULL;
15069 }
15070 D(fprintf(stderr, "%*c> invalid_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '{'"));
15071 Token * a;
15072 expr_ty primary_var;
15073 if (
15074 (primary_var = primary_rule(p)) // primary
15075 &&
15076 (a = _PyPegen_expect_token(p, 25)) // token='{'
15077 )
15078 {
15079 D(fprintf(stderr, "%*c+ invalid_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '{'"));
15080 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "invalid syntax" );
15081 if (_res == NULL && PyErr_Occurred()) {
15082 p->error_indicator = 1;
15083 D(p->level--);
15084 return NULL;
15085 }
15086 goto done;
15087 }
15088 p->mark = _mark;
15089 D(fprintf(stderr, "%*c%s invalid_primary[%d-%d]: %s failed!\n", p->level, ' ',
15090 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '{'"));
15091 }
15092 _res = NULL;
15093 done:
15094 D(p->level--);
15095 return _res;
15096}
15097
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015098// invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses
15099static void *
15100invalid_comprehension_rule(Parser *p)
15101{
15102 D(p->level++);
15103 if (p->error_indicator) {
15104 D(p->level--);
15105 return NULL;
15106 }
15107 void * _res = NULL;
15108 int _mark = p->mark;
15109 { // ('[' | '(' | '{') starred_expression for_if_clauses
15110 if (p->error_indicator) {
15111 D(p->level--);
15112 return NULL;
15113 }
15114 D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010015115 void *_tmp_132_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015116 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015117 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015118 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015119 (_tmp_132_var = _tmp_132_rule(p)) // '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015120 &&
15121 (a = starred_expression_rule(p)) // starred_expression
15122 &&
15123 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15124 )
15125 {
15126 D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15127 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in 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_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15137 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15138 }
15139 _res = NULL;
15140 done:
15141 D(p->level--);
15142 return _res;
15143}
15144
15145// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
15146static void *
15147invalid_dict_comprehension_rule(Parser *p)
15148{
15149 D(p->level++);
15150 if (p->error_indicator) {
15151 D(p->level--);
15152 return NULL;
15153 }
15154 void * _res = NULL;
15155 int _mark = p->mark;
15156 { // '{' '**' bitwise_or for_if_clauses '}'
15157 if (p->error_indicator) {
15158 D(p->level--);
15159 return NULL;
15160 }
15161 D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15162 Token * _literal;
15163 Token * _literal_1;
15164 Token * a;
15165 expr_ty bitwise_or_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015166 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015167 if (
15168 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
15169 &&
15170 (a = _PyPegen_expect_token(p, 35)) // token='**'
15171 &&
15172 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
15173 &&
15174 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15175 &&
15176 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
15177 )
15178 {
15179 D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15180 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
15181 if (_res == NULL && PyErr_Occurred()) {
15182 p->error_indicator = 1;
15183 D(p->level--);
15184 return NULL;
15185 }
15186 goto done;
15187 }
15188 p->mark = _mark;
15189 D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15190 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15191 }
15192 _res = NULL;
15193 done:
15194 D(p->level--);
15195 return _res;
15196}
15197
15198// invalid_parameters:
15199// | param_no_default* (slash_with_default | param_with_default+) param_no_default
15200static void *
15201invalid_parameters_rule(Parser *p)
15202{
15203 D(p->level++);
15204 if (p->error_indicator) {
15205 D(p->level--);
15206 return NULL;
15207 }
15208 void * _res = NULL;
15209 int _mark = p->mark;
15210 { // param_no_default* (slash_with_default | param_with_default+) param_no_default
15211 if (p->error_indicator) {
15212 D(p->level--);
15213 return NULL;
15214 }
15215 D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010015216 asdl_seq * _loop0_133_var;
15217 void *_tmp_134_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015218 arg_ty param_no_default_var;
15219 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015220 (_loop0_133_var = _loop0_133_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015221 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015222 (_tmp_134_var = _tmp_134_rule(p)) // slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015223 &&
15224 (param_no_default_var = param_no_default_rule(p)) // param_no_default
15225 )
15226 {
15227 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"));
15228 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15229 if (_res == NULL && PyErr_Occurred()) {
15230 p->error_indicator = 1;
15231 D(p->level--);
15232 return NULL;
15233 }
15234 goto done;
15235 }
15236 p->mark = _mark;
15237 D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15238 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
15239 }
15240 _res = NULL;
15241 done:
15242 D(p->level--);
15243 return _res;
15244}
15245
15246// invalid_lambda_parameters:
15247// | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15248static void *
15249invalid_lambda_parameters_rule(Parser *p)
15250{
15251 D(p->level++);
15252 if (p->error_indicator) {
15253 D(p->level--);
15254 return NULL;
15255 }
15256 void * _res = NULL;
15257 int _mark = p->mark;
15258 { // lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15259 if (p->error_indicator) {
15260 D(p->level--);
15261 return NULL;
15262 }
15263 D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010015264 asdl_seq * _loop0_135_var;
15265 void *_tmp_136_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015266 arg_ty lambda_param_no_default_var;
15267 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015268 (_loop0_135_var = _loop0_135_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015269 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015270 (_tmp_136_var = _tmp_136_rule(p)) // lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015271 &&
15272 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
15273 )
15274 {
15275 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"));
15276 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15277 if (_res == NULL && PyErr_Occurred()) {
15278 p->error_indicator = 1;
15279 D(p->level--);
15280 return NULL;
15281 }
15282 goto done;
15283 }
15284 p->mark = _mark;
15285 D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15286 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
15287 }
15288 _res = NULL;
15289 done:
15290 D(p->level--);
15291 return _res;
15292}
15293
15294// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT
15295static void *
15296invalid_star_etc_rule(Parser *p)
15297{
15298 D(p->level++);
15299 if (p->error_indicator) {
15300 D(p->level--);
15301 return NULL;
15302 }
15303 void * _res = NULL;
15304 int _mark = p->mark;
15305 { // '*' (')' | ',' (')' | '**'))
15306 if (p->error_indicator) {
15307 D(p->level--);
15308 return NULL;
15309 }
15310 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15311 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015312 void *_tmp_137_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015313 if (
15314 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15315 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015316 (_tmp_137_var = _tmp_137_rule(p)) // ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015317 )
15318 {
15319 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15320 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15321 if (_res == NULL && PyErr_Occurred()) {
15322 p->error_indicator = 1;
15323 D(p->level--);
15324 return NULL;
15325 }
15326 goto done;
15327 }
15328 p->mark = _mark;
15329 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15330 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15331 }
15332 { // '*' ',' TYPE_COMMENT
15333 if (p->error_indicator) {
15334 D(p->level--);
15335 return NULL;
15336 }
15337 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15338 Token * _literal;
15339 Token * _literal_1;
15340 Token * type_comment_var;
15341 if (
15342 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15343 &&
15344 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
15345 &&
15346 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15347 )
15348 {
15349 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15350 _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
15351 if (_res == NULL && PyErr_Occurred()) {
15352 p->error_indicator = 1;
15353 D(p->level--);
15354 return NULL;
15355 }
15356 goto done;
15357 }
15358 p->mark = _mark;
15359 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15360 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15361 }
15362 _res = NULL;
15363 done:
15364 D(p->level--);
15365 return _res;
15366}
15367
15368// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**'))
15369static void *
15370invalid_lambda_star_etc_rule(Parser *p)
15371{
15372 D(p->level++);
15373 if (p->error_indicator) {
15374 D(p->level--);
15375 return NULL;
15376 }
15377 void * _res = NULL;
15378 int _mark = p->mark;
15379 { // '*' (':' | ',' (':' | '**'))
15380 if (p->error_indicator) {
15381 D(p->level--);
15382 return NULL;
15383 }
15384 D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15385 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015386 void *_tmp_138_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015387 if (
15388 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15389 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015390 (_tmp_138_var = _tmp_138_rule(p)) // ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015391 )
15392 {
15393 D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15394 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
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_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15404 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15405 }
15406 _res = NULL;
15407 done:
15408 D(p->level--);
15409 return _res;
15410}
15411
15412// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15413static void *
15414invalid_double_type_comments_rule(Parser *p)
15415{
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;
15423 { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15424 if (p->error_indicator) {
15425 D(p->level--);
15426 return NULL;
15427 }
15428 D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15429 Token * indent_var;
15430 Token * newline_var;
15431 Token * newline_var_1;
15432 Token * type_comment_var;
15433 Token * type_comment_var_1;
15434 if (
15435 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15436 &&
15437 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15438 &&
15439 (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15440 &&
15441 (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15442 &&
15443 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
15444 )
15445 {
15446 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"));
15447 _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
15448 if (_res == NULL && PyErr_Occurred()) {
15449 p->error_indicator = 1;
15450 D(p->level--);
15451 return NULL;
15452 }
15453 goto done;
15454 }
15455 p->mark = _mark;
15456 D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
15457 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15458 }
15459 _res = NULL;
15460 done:
15461 D(p->level--);
15462 return _res;
15463}
15464
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015465// invalid_with_item: expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015466static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015467invalid_with_item_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015468{
15469 D(p->level++);
15470 if (p->error_indicator) {
15471 D(p->level--);
15472 return NULL;
15473 }
15474 void * _res = NULL;
15475 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015476 { // expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015477 if (p->error_indicator) {
15478 D(p->level--);
15479 return NULL;
15480 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015481 D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression"));
15482 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015483 expr_ty a;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015484 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015485 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015486 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015487 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015488 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
15489 &&
15490 (a = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015491 )
15492 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015493 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 +030015494 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015495 if (_res == NULL && PyErr_Occurred()) {
15496 p->error_indicator = 1;
15497 D(p->level--);
15498 return NULL;
15499 }
15500 goto done;
15501 }
15502 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015503 D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
15504 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression"));
15505 }
15506 _res = NULL;
15507 done:
15508 D(p->level--);
15509 return _res;
15510}
15511
15512// invalid_for_target: ASYNC? 'for' star_expressions
15513static void *
15514invalid_for_target_rule(Parser *p)
15515{
15516 D(p->level++);
15517 if (p->error_indicator) {
15518 D(p->level--);
15519 return NULL;
15520 }
15521 void * _res = NULL;
15522 int _mark = p->mark;
15523 { // ASYNC? 'for' star_expressions
15524 if (p->error_indicator) {
15525 D(p->level--);
15526 return NULL;
15527 }
15528 D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
15529 Token * _keyword;
15530 void *_opt_var;
15531 UNUSED(_opt_var); // Silence compiler warnings
15532 expr_ty a;
15533 if (
15534 (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
15535 &&
15536 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
15537 &&
15538 (a = star_expressions_rule(p)) // star_expressions
15539 )
15540 {
15541 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 +030015542 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015543 if (_res == NULL && PyErr_Occurred()) {
15544 p->error_indicator = 1;
15545 D(p->level--);
15546 return NULL;
15547 }
15548 goto done;
15549 }
15550 p->mark = _mark;
15551 D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
15552 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions"));
15553 }
15554 _res = NULL;
15555 done:
15556 D(p->level--);
15557 return _res;
15558}
15559
15560// invalid_group: '(' starred_expression ')'
15561static void *
15562invalid_group_rule(Parser *p)
15563{
15564 D(p->level++);
15565 if (p->error_indicator) {
15566 D(p->level--);
15567 return NULL;
15568 }
15569 void * _res = NULL;
15570 int _mark = p->mark;
15571 { // '(' starred_expression ')'
15572 if (p->error_indicator) {
15573 D(p->level--);
15574 return NULL;
15575 }
15576 D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15577 Token * _literal;
15578 Token * _literal_1;
15579 expr_ty a;
15580 if (
15581 (_literal = _PyPegen_expect_token(p, 7)) // token='('
15582 &&
15583 (a = starred_expression_rule(p)) // starred_expression
15584 &&
15585 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
15586 )
15587 {
15588 D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15589 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "can't use starred expression here" );
15590 if (_res == NULL && PyErr_Occurred()) {
15591 p->error_indicator = 1;
15592 D(p->level--);
15593 return NULL;
15594 }
15595 goto done;
15596 }
15597 p->mark = _mark;
15598 D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
15599 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015600 }
15601 _res = NULL;
15602 done:
15603 D(p->level--);
15604 return _res;
15605}
15606
15607// invalid_import_from_targets: import_from_as_names ','
15608static void *
15609invalid_import_from_targets_rule(Parser *p)
15610{
15611 D(p->level++);
15612 if (p->error_indicator) {
15613 D(p->level--);
15614 return NULL;
15615 }
15616 void * _res = NULL;
15617 int _mark = p->mark;
15618 { // import_from_as_names ','
15619 if (p->error_indicator) {
15620 D(p->level--);
15621 return NULL;
15622 }
15623 D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15624 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015625 asdl_alias_seq* import_from_as_names_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015626 if (
15627 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
15628 &&
15629 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15630 )
15631 {
15632 D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15633 _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
15634 if (_res == NULL && PyErr_Occurred()) {
15635 p->error_indicator = 1;
15636 D(p->level--);
15637 return NULL;
15638 }
15639 goto done;
15640 }
15641 p->mark = _mark;
15642 D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
15643 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','"));
15644 }
15645 _res = NULL;
15646 done:
15647 D(p->level--);
15648 return _res;
15649}
15650
15651// _loop0_1: NEWLINE
15652static asdl_seq *
15653_loop0_1_rule(Parser *p)
15654{
15655 D(p->level++);
15656 if (p->error_indicator) {
15657 D(p->level--);
15658 return NULL;
15659 }
15660 void *_res = NULL;
15661 int _mark = p->mark;
15662 int _start_mark = p->mark;
15663 void **_children = PyMem_Malloc(sizeof(void *));
15664 if (!_children) {
15665 p->error_indicator = 1;
15666 PyErr_NoMemory();
15667 D(p->level--);
15668 return NULL;
15669 }
15670 ssize_t _children_capacity = 1;
15671 ssize_t _n = 0;
15672 { // NEWLINE
15673 if (p->error_indicator) {
15674 D(p->level--);
15675 return NULL;
15676 }
15677 D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15678 Token * newline_var;
15679 while (
15680 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15681 )
15682 {
15683 _res = newline_var;
15684 if (_n == _children_capacity) {
15685 _children_capacity *= 2;
15686 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15687 if (!_new_children) {
15688 p->error_indicator = 1;
15689 PyErr_NoMemory();
15690 D(p->level--);
15691 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015692 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015693 _children = _new_children;
15694 }
15695 _children[_n++] = _res;
15696 _mark = p->mark;
15697 }
15698 p->mark = _mark;
15699 D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
15700 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15701 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015702 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015703 if (!_seq) {
15704 PyMem_Free(_children);
15705 p->error_indicator = 1;
15706 PyErr_NoMemory();
15707 D(p->level--);
15708 return NULL;
15709 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015710 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015711 PyMem_Free(_children);
15712 _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq);
15713 D(p->level--);
15714 return _seq;
15715}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015716
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015717// _loop0_2: NEWLINE
15718static asdl_seq *
15719_loop0_2_rule(Parser *p)
15720{
15721 D(p->level++);
15722 if (p->error_indicator) {
15723 D(p->level--);
15724 return NULL;
15725 }
15726 void *_res = NULL;
15727 int _mark = p->mark;
15728 int _start_mark = p->mark;
15729 void **_children = PyMem_Malloc(sizeof(void *));
15730 if (!_children) {
15731 p->error_indicator = 1;
15732 PyErr_NoMemory();
15733 D(p->level--);
15734 return NULL;
15735 }
15736 ssize_t _children_capacity = 1;
15737 ssize_t _n = 0;
15738 { // NEWLINE
15739 if (p->error_indicator) {
15740 D(p->level--);
15741 return NULL;
15742 }
15743 D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15744 Token * newline_var;
15745 while (
15746 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15747 )
15748 {
15749 _res = newline_var;
15750 if (_n == _children_capacity) {
15751 _children_capacity *= 2;
15752 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15753 if (!_new_children) {
15754 p->error_indicator = 1;
15755 PyErr_NoMemory();
15756 D(p->level--);
15757 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015758 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015759 _children = _new_children;
15760 }
15761 _children[_n++] = _res;
15762 _mark = p->mark;
15763 }
15764 p->mark = _mark;
15765 D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
15766 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15767 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015768 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015769 if (!_seq) {
15770 PyMem_Free(_children);
15771 p->error_indicator = 1;
15772 PyErr_NoMemory();
15773 D(p->level--);
15774 return NULL;
15775 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015776 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015777 PyMem_Free(_children);
15778 _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq);
15779 D(p->level--);
15780 return _seq;
15781}
15782
15783// _loop0_4: ',' expression
15784static asdl_seq *
15785_loop0_4_rule(Parser *p)
15786{
15787 D(p->level++);
15788 if (p->error_indicator) {
15789 D(p->level--);
15790 return NULL;
15791 }
15792 void *_res = NULL;
15793 int _mark = p->mark;
15794 int _start_mark = p->mark;
15795 void **_children = PyMem_Malloc(sizeof(void *));
15796 if (!_children) {
15797 p->error_indicator = 1;
15798 PyErr_NoMemory();
15799 D(p->level--);
15800 return NULL;
15801 }
15802 ssize_t _children_capacity = 1;
15803 ssize_t _n = 0;
15804 { // ',' expression
15805 if (p->error_indicator) {
15806 D(p->level--);
15807 return NULL;
15808 }
15809 D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15810 Token * _literal;
15811 expr_ty elem;
15812 while (
15813 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15814 &&
15815 (elem = expression_rule(p)) // expression
15816 )
15817 {
15818 _res = elem;
15819 if (_res == NULL && PyErr_Occurred()) {
15820 p->error_indicator = 1;
15821 PyMem_Free(_children);
15822 D(p->level--);
15823 return NULL;
15824 }
15825 if (_n == _children_capacity) {
15826 _children_capacity *= 2;
15827 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15828 if (!_new_children) {
15829 p->error_indicator = 1;
15830 PyErr_NoMemory();
15831 D(p->level--);
15832 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015833 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015834 _children = _new_children;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015835 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015836 _children[_n++] = _res;
15837 _mark = p->mark;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015838 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015839 p->mark = _mark;
15840 D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
15841 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015842 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015843 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015844 if (!_seq) {
15845 PyMem_Free(_children);
15846 p->error_indicator = 1;
15847 PyErr_NoMemory();
15848 D(p->level--);
15849 return NULL;
15850 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015851 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015852 PyMem_Free(_children);
15853 _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
15854 D(p->level--);
15855 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015856}
15857
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015858// _gather_3: expression _loop0_4
15859static asdl_seq *
15860_gather_3_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015861{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015862 D(p->level++);
15863 if (p->error_indicator) {
15864 D(p->level--);
15865 return NULL;
15866 }
15867 asdl_seq * _res = NULL;
15868 int _mark = p->mark;
15869 { // expression _loop0_4
15870 if (p->error_indicator) {
15871 D(p->level--);
15872 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015873 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015874 D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15875 expr_ty elem;
15876 asdl_seq * seq;
15877 if (
15878 (elem = expression_rule(p)) // expression
15879 &&
15880 (seq = _loop0_4_rule(p)) // _loop0_4
15881 )
15882 {
15883 D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15884 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15885 goto done;
15886 }
15887 p->mark = _mark;
15888 D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ',
15889 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015890 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015891 _res = NULL;
15892 done:
15893 D(p->level--);
15894 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015895}
15896
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015897// _loop0_6: ',' expression
15898static asdl_seq *
15899_loop0_6_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015900{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015901 D(p->level++);
15902 if (p->error_indicator) {
15903 D(p->level--);
15904 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015905 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015906 void *_res = NULL;
15907 int _mark = p->mark;
15908 int _start_mark = p->mark;
15909 void **_children = PyMem_Malloc(sizeof(void *));
15910 if (!_children) {
15911 p->error_indicator = 1;
15912 PyErr_NoMemory();
15913 D(p->level--);
15914 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015915 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015916 ssize_t _children_capacity = 1;
15917 ssize_t _n = 0;
15918 { // ',' expression
15919 if (p->error_indicator) {
15920 D(p->level--);
15921 return NULL;
15922 }
15923 D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15924 Token * _literal;
15925 expr_ty elem;
15926 while (
15927 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15928 &&
15929 (elem = expression_rule(p)) // expression
15930 )
15931 {
15932 _res = elem;
15933 if (_res == NULL && PyErr_Occurred()) {
15934 p->error_indicator = 1;
15935 PyMem_Free(_children);
15936 D(p->level--);
15937 return NULL;
15938 }
15939 if (_n == _children_capacity) {
15940 _children_capacity *= 2;
15941 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15942 if (!_new_children) {
15943 p->error_indicator = 1;
15944 PyErr_NoMemory();
15945 D(p->level--);
15946 return NULL;
15947 }
15948 _children = _new_children;
15949 }
15950 _children[_n++] = _res;
15951 _mark = p->mark;
15952 }
15953 p->mark = _mark;
15954 D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
15955 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
15956 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015957 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015958 if (!_seq) {
15959 PyMem_Free(_children);
15960 p->error_indicator = 1;
15961 PyErr_NoMemory();
15962 D(p->level--);
15963 return NULL;
15964 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015965 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015966 PyMem_Free(_children);
15967 _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
15968 D(p->level--);
15969 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015970}
15971
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015972// _gather_5: expression _loop0_6
15973static asdl_seq *
15974_gather_5_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015975{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015976 D(p->level++);
15977 if (p->error_indicator) {
15978 D(p->level--);
15979 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015980 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015981 asdl_seq * _res = NULL;
15982 int _mark = p->mark;
15983 { // expression _loop0_6
15984 if (p->error_indicator) {
15985 D(p->level--);
15986 return NULL;
15987 }
15988 D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15989 expr_ty elem;
15990 asdl_seq * seq;
15991 if (
15992 (elem = expression_rule(p)) // expression
15993 &&
15994 (seq = _loop0_6_rule(p)) // _loop0_6
15995 )
15996 {
15997 D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15998 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15999 goto done;
16000 }
16001 p->mark = _mark;
16002 D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ',
16003 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6"));
16004 }
16005 _res = NULL;
16006 done:
16007 D(p->level--);
16008 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016009}
16010
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016011// _loop0_8: ',' expression
16012static asdl_seq *
16013_loop0_8_rule(Parser *p)
16014{
16015 D(p->level++);
16016 if (p->error_indicator) {
16017 D(p->level--);
16018 return NULL;
16019 }
16020 void *_res = NULL;
16021 int _mark = p->mark;
16022 int _start_mark = p->mark;
16023 void **_children = PyMem_Malloc(sizeof(void *));
16024 if (!_children) {
16025 p->error_indicator = 1;
16026 PyErr_NoMemory();
16027 D(p->level--);
16028 return NULL;
16029 }
16030 ssize_t _children_capacity = 1;
16031 ssize_t _n = 0;
16032 { // ',' expression
16033 if (p->error_indicator) {
16034 D(p->level--);
16035 return NULL;
16036 }
16037 D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
16038 Token * _literal;
16039 expr_ty elem;
16040 while (
16041 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16042 &&
16043 (elem = expression_rule(p)) // expression
16044 )
16045 {
16046 _res = elem;
16047 if (_res == NULL && PyErr_Occurred()) {
16048 p->error_indicator = 1;
16049 PyMem_Free(_children);
16050 D(p->level--);
16051 return NULL;
16052 }
16053 if (_n == _children_capacity) {
16054 _children_capacity *= 2;
16055 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16056 if (!_new_children) {
16057 p->error_indicator = 1;
16058 PyErr_NoMemory();
16059 D(p->level--);
16060 return NULL;
16061 }
16062 _children = _new_children;
16063 }
16064 _children[_n++] = _res;
16065 _mark = p->mark;
16066 }
16067 p->mark = _mark;
16068 D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
16069 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16070 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016071 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016072 if (!_seq) {
16073 PyMem_Free(_children);
16074 p->error_indicator = 1;
16075 PyErr_NoMemory();
16076 D(p->level--);
16077 return NULL;
16078 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016079 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016080 PyMem_Free(_children);
16081 _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
16082 D(p->level--);
16083 return _seq;
16084}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016085
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016086// _gather_7: expression _loop0_8
16087static asdl_seq *
16088_gather_7_rule(Parser *p)
16089{
16090 D(p->level++);
16091 if (p->error_indicator) {
16092 D(p->level--);
16093 return NULL;
16094 }
16095 asdl_seq * _res = NULL;
16096 int _mark = p->mark;
16097 { // expression _loop0_8
16098 if (p->error_indicator) {
16099 D(p->level--);
16100 return NULL;
16101 }
16102 D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16103 expr_ty elem;
16104 asdl_seq * seq;
16105 if (
16106 (elem = expression_rule(p)) // expression
16107 &&
16108 (seq = _loop0_8_rule(p)) // _loop0_8
16109 )
16110 {
16111 D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16112 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16113 goto done;
16114 }
16115 p->mark = _mark;
16116 D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ',
16117 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8"));
16118 }
16119 _res = NULL;
16120 done:
16121 D(p->level--);
16122 return _res;
16123}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016125// _loop0_10: ',' expression
16126static asdl_seq *
16127_loop0_10_rule(Parser *p)
16128{
16129 D(p->level++);
16130 if (p->error_indicator) {
16131 D(p->level--);
16132 return NULL;
16133 }
16134 void *_res = NULL;
16135 int _mark = p->mark;
16136 int _start_mark = p->mark;
16137 void **_children = PyMem_Malloc(sizeof(void *));
16138 if (!_children) {
16139 p->error_indicator = 1;
16140 PyErr_NoMemory();
16141 D(p->level--);
16142 return NULL;
16143 }
16144 ssize_t _children_capacity = 1;
16145 ssize_t _n = 0;
16146 { // ',' expression
16147 if (p->error_indicator) {
16148 D(p->level--);
16149 return NULL;
16150 }
16151 D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
16152 Token * _literal;
16153 expr_ty elem;
16154 while (
16155 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16156 &&
16157 (elem = expression_rule(p)) // expression
16158 )
16159 {
16160 _res = elem;
16161 if (_res == NULL && PyErr_Occurred()) {
16162 p->error_indicator = 1;
16163 PyMem_Free(_children);
16164 D(p->level--);
16165 return NULL;
16166 }
16167 if (_n == _children_capacity) {
16168 _children_capacity *= 2;
16169 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16170 if (!_new_children) {
16171 p->error_indicator = 1;
16172 PyErr_NoMemory();
16173 D(p->level--);
16174 return NULL;
16175 }
16176 _children = _new_children;
16177 }
16178 _children[_n++] = _res;
16179 _mark = p->mark;
16180 }
16181 p->mark = _mark;
16182 D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
16183 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16184 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016185 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016186 if (!_seq) {
16187 PyMem_Free(_children);
16188 p->error_indicator = 1;
16189 PyErr_NoMemory();
16190 D(p->level--);
16191 return NULL;
16192 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016193 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016194 PyMem_Free(_children);
16195 _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
16196 D(p->level--);
16197 return _seq;
16198}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016199
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016200// _gather_9: expression _loop0_10
16201static asdl_seq *
16202_gather_9_rule(Parser *p)
16203{
16204 D(p->level++);
16205 if (p->error_indicator) {
16206 D(p->level--);
16207 return NULL;
16208 }
16209 asdl_seq * _res = NULL;
16210 int _mark = p->mark;
16211 { // expression _loop0_10
16212 if (p->error_indicator) {
16213 D(p->level--);
16214 return NULL;
16215 }
16216 D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16217 expr_ty elem;
16218 asdl_seq * seq;
16219 if (
16220 (elem = expression_rule(p)) // expression
16221 &&
16222 (seq = _loop0_10_rule(p)) // _loop0_10
16223 )
16224 {
16225 D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16226 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16227 goto done;
16228 }
16229 p->mark = _mark;
16230 D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ',
16231 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10"));
16232 }
16233 _res = NULL;
16234 done:
16235 D(p->level--);
16236 return _res;
16237}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016238
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016239// _loop1_11: statement
16240static asdl_seq *
16241_loop1_11_rule(Parser *p)
16242{
16243 D(p->level++);
16244 if (p->error_indicator) {
16245 D(p->level--);
16246 return NULL;
16247 }
16248 void *_res = NULL;
16249 int _mark = p->mark;
16250 int _start_mark = p->mark;
16251 void **_children = PyMem_Malloc(sizeof(void *));
16252 if (!_children) {
16253 p->error_indicator = 1;
16254 PyErr_NoMemory();
16255 D(p->level--);
16256 return NULL;
16257 }
16258 ssize_t _children_capacity = 1;
16259 ssize_t _n = 0;
16260 { // statement
16261 if (p->error_indicator) {
16262 D(p->level--);
16263 return NULL;
16264 }
16265 D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010016266 asdl_stmt_seq* statement_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016267 while (
16268 (statement_var = statement_rule(p)) // statement
16269 )
16270 {
16271 _res = statement_var;
16272 if (_n == _children_capacity) {
16273 _children_capacity *= 2;
16274 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16275 if (!_new_children) {
16276 p->error_indicator = 1;
16277 PyErr_NoMemory();
16278 D(p->level--);
16279 return NULL;
16280 }
16281 _children = _new_children;
16282 }
16283 _children[_n++] = _res;
16284 _mark = p->mark;
16285 }
16286 p->mark = _mark;
16287 D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ',
16288 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
16289 }
16290 if (_n == 0 || p->error_indicator) {
16291 PyMem_Free(_children);
16292 D(p->level--);
16293 return NULL;
16294 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016295 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016296 if (!_seq) {
16297 PyMem_Free(_children);
16298 p->error_indicator = 1;
16299 PyErr_NoMemory();
16300 D(p->level--);
16301 return NULL;
16302 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016303 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016304 PyMem_Free(_children);
16305 _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
16306 D(p->level--);
16307 return _seq;
16308}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016309
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016310// _loop0_13: ';' small_stmt
16311static asdl_seq *
16312_loop0_13_rule(Parser *p)
16313{
16314 D(p->level++);
16315 if (p->error_indicator) {
16316 D(p->level--);
16317 return NULL;
16318 }
16319 void *_res = NULL;
16320 int _mark = p->mark;
16321 int _start_mark = p->mark;
16322 void **_children = PyMem_Malloc(sizeof(void *));
16323 if (!_children) {
16324 p->error_indicator = 1;
16325 PyErr_NoMemory();
16326 D(p->level--);
16327 return NULL;
16328 }
16329 ssize_t _children_capacity = 1;
16330 ssize_t _n = 0;
16331 { // ';' small_stmt
16332 if (p->error_indicator) {
16333 D(p->level--);
16334 return NULL;
16335 }
16336 D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt"));
16337 Token * _literal;
16338 stmt_ty elem;
16339 while (
16340 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
16341 &&
16342 (elem = small_stmt_rule(p)) // small_stmt
16343 )
16344 {
16345 _res = elem;
16346 if (_res == NULL && PyErr_Occurred()) {
16347 p->error_indicator = 1;
16348 PyMem_Free(_children);
16349 D(p->level--);
16350 return NULL;
16351 }
16352 if (_n == _children_capacity) {
16353 _children_capacity *= 2;
16354 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16355 if (!_new_children) {
16356 p->error_indicator = 1;
16357 PyErr_NoMemory();
16358 D(p->level--);
16359 return NULL;
16360 }
16361 _children = _new_children;
16362 }
16363 _children[_n++] = _res;
16364 _mark = p->mark;
16365 }
16366 p->mark = _mark;
16367 D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
16368 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt"));
16369 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016370 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016371 if (!_seq) {
16372 PyMem_Free(_children);
16373 p->error_indicator = 1;
16374 PyErr_NoMemory();
16375 D(p->level--);
16376 return NULL;
16377 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016378 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016379 PyMem_Free(_children);
16380 _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
16381 D(p->level--);
16382 return _seq;
16383}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016384
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016385// _gather_12: small_stmt _loop0_13
16386static asdl_seq *
16387_gather_12_rule(Parser *p)
16388{
16389 D(p->level++);
16390 if (p->error_indicator) {
16391 D(p->level--);
16392 return NULL;
16393 }
16394 asdl_seq * _res = NULL;
16395 int _mark = p->mark;
16396 { // small_stmt _loop0_13
16397 if (p->error_indicator) {
16398 D(p->level--);
16399 return NULL;
16400 }
16401 D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16402 stmt_ty elem;
16403 asdl_seq * seq;
16404 if (
16405 (elem = small_stmt_rule(p)) // small_stmt
16406 &&
16407 (seq = _loop0_13_rule(p)) // _loop0_13
16408 )
16409 {
16410 D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16411 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16412 goto done;
16413 }
16414 p->mark = _mark;
16415 D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ',
16416 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13"));
16417 }
16418 _res = NULL;
16419 done:
16420 D(p->level--);
16421 return _res;
16422}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016423
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016424// _tmp_14: 'import' | 'from'
16425static void *
16426_tmp_14_rule(Parser *p)
16427{
16428 D(p->level++);
16429 if (p->error_indicator) {
16430 D(p->level--);
16431 return NULL;
16432 }
16433 void * _res = NULL;
16434 int _mark = p->mark;
16435 { // 'import'
16436 if (p->error_indicator) {
16437 D(p->level--);
16438 return NULL;
16439 }
16440 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
16441 Token * _keyword;
16442 if (
16443 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
16444 )
16445 {
16446 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
16447 _res = _keyword;
16448 goto done;
16449 }
16450 p->mark = _mark;
16451 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16452 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
16453 }
16454 { // 'from'
16455 if (p->error_indicator) {
16456 D(p->level--);
16457 return NULL;
16458 }
16459 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
16460 Token * _keyword;
16461 if (
16462 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
16463 )
16464 {
16465 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
16466 _res = _keyword;
16467 goto done;
16468 }
16469 p->mark = _mark;
16470 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16471 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
16472 }
16473 _res = NULL;
16474 done:
16475 D(p->level--);
16476 return _res;
16477}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016478
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016479// _tmp_15: 'def' | '@' | ASYNC
16480static void *
16481_tmp_15_rule(Parser *p)
16482{
16483 D(p->level++);
16484 if (p->error_indicator) {
16485 D(p->level--);
16486 return NULL;
16487 }
16488 void * _res = NULL;
16489 int _mark = p->mark;
16490 { // 'def'
16491 if (p->error_indicator) {
16492 D(p->level--);
16493 return NULL;
16494 }
16495 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
16496 Token * _keyword;
16497 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016498 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016499 )
16500 {
16501 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
16502 _res = _keyword;
16503 goto done;
16504 }
16505 p->mark = _mark;
16506 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16507 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
16508 }
16509 { // '@'
16510 if (p->error_indicator) {
16511 D(p->level--);
16512 return NULL;
16513 }
16514 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16515 Token * _literal;
16516 if (
16517 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16518 )
16519 {
16520 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16521 _res = _literal;
16522 goto done;
16523 }
16524 p->mark = _mark;
16525 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16526 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16527 }
16528 { // ASYNC
16529 if (p->error_indicator) {
16530 D(p->level--);
16531 return NULL;
16532 }
16533 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16534 Token * async_var;
16535 if (
16536 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16537 )
16538 {
16539 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16540 _res = async_var;
16541 goto done;
16542 }
16543 p->mark = _mark;
16544 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16545 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16546 }
16547 _res = NULL;
16548 done:
16549 D(p->level--);
16550 return _res;
16551}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016552
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016553// _tmp_16: 'class' | '@'
16554static void *
16555_tmp_16_rule(Parser *p)
16556{
16557 D(p->level++);
16558 if (p->error_indicator) {
16559 D(p->level--);
16560 return NULL;
16561 }
16562 void * _res = NULL;
16563 int _mark = p->mark;
16564 { // 'class'
16565 if (p->error_indicator) {
16566 D(p->level--);
16567 return NULL;
16568 }
16569 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
16570 Token * _keyword;
16571 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016572 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016573 )
16574 {
16575 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
16576 _res = _keyword;
16577 goto done;
16578 }
16579 p->mark = _mark;
16580 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16581 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
16582 }
16583 { // '@'
16584 if (p->error_indicator) {
16585 D(p->level--);
16586 return NULL;
16587 }
16588 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16589 Token * _literal;
16590 if (
16591 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16592 )
16593 {
16594 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16595 _res = _literal;
16596 goto done;
16597 }
16598 p->mark = _mark;
16599 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16600 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16601 }
16602 _res = NULL;
16603 done:
16604 D(p->level--);
16605 return _res;
16606}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016607
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016608// _tmp_17: 'with' | ASYNC
16609static void *
16610_tmp_17_rule(Parser *p)
16611{
16612 D(p->level++);
16613 if (p->error_indicator) {
16614 D(p->level--);
16615 return NULL;
16616 }
16617 void * _res = NULL;
16618 int _mark = p->mark;
16619 { // 'with'
16620 if (p->error_indicator) {
16621 D(p->level--);
16622 return NULL;
16623 }
16624 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
16625 Token * _keyword;
16626 if (
16627 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
16628 )
16629 {
16630 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
16631 _res = _keyword;
16632 goto done;
16633 }
16634 p->mark = _mark;
16635 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16636 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
16637 }
16638 { // ASYNC
16639 if (p->error_indicator) {
16640 D(p->level--);
16641 return NULL;
16642 }
16643 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16644 Token * async_var;
16645 if (
16646 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16647 )
16648 {
16649 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16650 _res = async_var;
16651 goto done;
16652 }
16653 p->mark = _mark;
16654 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16655 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16656 }
16657 _res = NULL;
16658 done:
16659 D(p->level--);
16660 return _res;
16661}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016662
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016663// _tmp_18: 'for' | ASYNC
16664static void *
16665_tmp_18_rule(Parser *p)
16666{
16667 D(p->level++);
16668 if (p->error_indicator) {
16669 D(p->level--);
16670 return NULL;
16671 }
16672 void * _res = NULL;
16673 int _mark = p->mark;
16674 { // 'for'
16675 if (p->error_indicator) {
16676 D(p->level--);
16677 return NULL;
16678 }
16679 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
16680 Token * _keyword;
16681 if (
16682 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
16683 )
16684 {
16685 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
16686 _res = _keyword;
16687 goto done;
16688 }
16689 p->mark = _mark;
16690 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16691 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
16692 }
16693 { // ASYNC
16694 if (p->error_indicator) {
16695 D(p->level--);
16696 return NULL;
16697 }
16698 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16699 Token * async_var;
16700 if (
16701 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16702 )
16703 {
16704 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16705 _res = async_var;
16706 goto done;
16707 }
16708 p->mark = _mark;
16709 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16710 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16711 }
16712 _res = NULL;
16713 done:
16714 D(p->level--);
16715 return _res;
16716}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016717
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016718// _tmp_19: '=' annotated_rhs
16719static void *
16720_tmp_19_rule(Parser *p)
16721{
16722 D(p->level++);
16723 if (p->error_indicator) {
16724 D(p->level--);
16725 return NULL;
16726 }
16727 void * _res = NULL;
16728 int _mark = p->mark;
16729 { // '=' annotated_rhs
16730 if (p->error_indicator) {
16731 D(p->level--);
16732 return NULL;
16733 }
16734 D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16735 Token * _literal;
16736 expr_ty d;
16737 if (
16738 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16739 &&
16740 (d = annotated_rhs_rule(p)) // annotated_rhs
16741 )
16742 {
16743 D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16744 _res = d;
16745 if (_res == NULL && PyErr_Occurred()) {
16746 p->error_indicator = 1;
16747 D(p->level--);
16748 return NULL;
16749 }
16750 goto done;
16751 }
16752 p->mark = _mark;
16753 D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ',
16754 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16755 }
16756 _res = NULL;
16757 done:
16758 D(p->level--);
16759 return _res;
16760}
16761
16762// _tmp_20: '(' single_target ')' | single_subscript_attribute_target
16763static void *
16764_tmp_20_rule(Parser *p)
16765{
16766 D(p->level++);
16767 if (p->error_indicator) {
16768 D(p->level--);
16769 return NULL;
16770 }
16771 void * _res = NULL;
16772 int _mark = p->mark;
16773 { // '(' single_target ')'
16774 if (p->error_indicator) {
16775 D(p->level--);
16776 return NULL;
16777 }
16778 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16779 Token * _literal;
16780 Token * _literal_1;
16781 expr_ty b;
16782 if (
16783 (_literal = _PyPegen_expect_token(p, 7)) // token='('
16784 &&
16785 (b = single_target_rule(p)) // single_target
16786 &&
16787 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
16788 )
16789 {
16790 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16791 _res = b;
16792 if (_res == NULL && PyErr_Occurred()) {
16793 p->error_indicator = 1;
16794 D(p->level--);
16795 return NULL;
16796 }
16797 goto done;
16798 }
16799 p->mark = _mark;
16800 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16801 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
16802 }
16803 { // single_subscript_attribute_target
16804 if (p->error_indicator) {
16805 D(p->level--);
16806 return NULL;
16807 }
16808 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16809 expr_ty single_subscript_attribute_target_var;
16810 if (
16811 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
16812 )
16813 {
16814 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16815 _res = single_subscript_attribute_target_var;
16816 goto done;
16817 }
16818 p->mark = _mark;
16819 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16820 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
16821 }
16822 _res = NULL;
16823 done:
16824 D(p->level--);
16825 return _res;
16826}
16827
16828// _tmp_21: '=' annotated_rhs
16829static void *
16830_tmp_21_rule(Parser *p)
16831{
16832 D(p->level++);
16833 if (p->error_indicator) {
16834 D(p->level--);
16835 return NULL;
16836 }
16837 void * _res = NULL;
16838 int _mark = p->mark;
16839 { // '=' annotated_rhs
16840 if (p->error_indicator) {
16841 D(p->level--);
16842 return NULL;
16843 }
16844 D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16845 Token * _literal;
16846 expr_ty d;
16847 if (
16848 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16849 &&
16850 (d = annotated_rhs_rule(p)) // annotated_rhs
16851 )
16852 {
16853 D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16854 _res = d;
16855 if (_res == NULL && PyErr_Occurred()) {
16856 p->error_indicator = 1;
16857 D(p->level--);
16858 return NULL;
16859 }
16860 goto done;
16861 }
16862 p->mark = _mark;
16863 D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ',
16864 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16865 }
16866 _res = NULL;
16867 done:
16868 D(p->level--);
16869 return _res;
16870}
16871
16872// _loop1_22: (star_targets '=')
16873static asdl_seq *
16874_loop1_22_rule(Parser *p)
16875{
16876 D(p->level++);
16877 if (p->error_indicator) {
16878 D(p->level--);
16879 return NULL;
16880 }
16881 void *_res = NULL;
16882 int _mark = p->mark;
16883 int _start_mark = p->mark;
16884 void **_children = PyMem_Malloc(sizeof(void *));
16885 if (!_children) {
16886 p->error_indicator = 1;
16887 PyErr_NoMemory();
16888 D(p->level--);
16889 return NULL;
16890 }
16891 ssize_t _children_capacity = 1;
16892 ssize_t _n = 0;
16893 { // (star_targets '=')
16894 if (p->error_indicator) {
16895 D(p->level--);
16896 return NULL;
16897 }
16898 D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010016899 void *_tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016900 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010016901 (_tmp_139_var = _tmp_139_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016902 )
16903 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010016904 _res = _tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016905 if (_n == _children_capacity) {
16906 _children_capacity *= 2;
16907 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16908 if (!_new_children) {
16909 p->error_indicator = 1;
16910 PyErr_NoMemory();
16911 D(p->level--);
16912 return NULL;
16913 }
16914 _children = _new_children;
16915 }
16916 _children[_n++] = _res;
16917 _mark = p->mark;
16918 }
16919 p->mark = _mark;
16920 D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ',
16921 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
16922 }
16923 if (_n == 0 || p->error_indicator) {
16924 PyMem_Free(_children);
16925 D(p->level--);
16926 return NULL;
16927 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016928 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016929 if (!_seq) {
16930 PyMem_Free(_children);
16931 p->error_indicator = 1;
16932 PyErr_NoMemory();
16933 D(p->level--);
16934 return NULL;
16935 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016936 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016937 PyMem_Free(_children);
16938 _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
16939 D(p->level--);
16940 return _seq;
16941}
16942
16943// _tmp_23: yield_expr | star_expressions
16944static void *
16945_tmp_23_rule(Parser *p)
16946{
16947 D(p->level++);
16948 if (p->error_indicator) {
16949 D(p->level--);
16950 return NULL;
16951 }
16952 void * _res = NULL;
16953 int _mark = p->mark;
16954 { // yield_expr
16955 if (p->error_indicator) {
16956 D(p->level--);
16957 return NULL;
16958 }
16959 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16960 expr_ty yield_expr_var;
16961 if (
16962 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16963 )
16964 {
16965 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16966 _res = yield_expr_var;
16967 goto done;
16968 }
16969 p->mark = _mark;
16970 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16971 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16972 }
16973 { // star_expressions
16974 if (p->error_indicator) {
16975 D(p->level--);
16976 return NULL;
16977 }
16978 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16979 expr_ty star_expressions_var;
16980 if (
16981 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16982 )
16983 {
16984 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16985 _res = star_expressions_var;
16986 goto done;
16987 }
16988 p->mark = _mark;
16989 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16990 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16991 }
16992 _res = NULL;
16993 done:
16994 D(p->level--);
16995 return _res;
16996}
16997
16998// _tmp_24: yield_expr | star_expressions
16999static void *
17000_tmp_24_rule(Parser *p)
17001{
17002 D(p->level++);
17003 if (p->error_indicator) {
17004 D(p->level--);
17005 return NULL;
17006 }
17007 void * _res = NULL;
17008 int _mark = p->mark;
17009 { // yield_expr
17010 if (p->error_indicator) {
17011 D(p->level--);
17012 return NULL;
17013 }
17014 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
17015 expr_ty yield_expr_var;
17016 if (
17017 (yield_expr_var = yield_expr_rule(p)) // yield_expr
17018 )
17019 {
17020 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
17021 _res = yield_expr_var;
17022 goto done;
17023 }
17024 p->mark = _mark;
17025 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
17026 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
17027 }
17028 { // star_expressions
17029 if (p->error_indicator) {
17030 D(p->level--);
17031 return NULL;
17032 }
17033 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
17034 expr_ty star_expressions_var;
17035 if (
17036 (star_expressions_var = star_expressions_rule(p)) // star_expressions
17037 )
17038 {
17039 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
17040 _res = star_expressions_var;
17041 goto done;
17042 }
17043 p->mark = _mark;
17044 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
17045 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
17046 }
17047 _res = NULL;
17048 done:
17049 D(p->level--);
17050 return _res;
17051}
17052
17053// _loop0_26: ',' NAME
17054static asdl_seq *
17055_loop0_26_rule(Parser *p)
17056{
17057 D(p->level++);
17058 if (p->error_indicator) {
17059 D(p->level--);
17060 return NULL;
17061 }
17062 void *_res = NULL;
17063 int _mark = p->mark;
17064 int _start_mark = p->mark;
17065 void **_children = PyMem_Malloc(sizeof(void *));
17066 if (!_children) {
17067 p->error_indicator = 1;
17068 PyErr_NoMemory();
17069 D(p->level--);
17070 return NULL;
17071 }
17072 ssize_t _children_capacity = 1;
17073 ssize_t _n = 0;
17074 { // ',' NAME
17075 if (p->error_indicator) {
17076 D(p->level--);
17077 return NULL;
17078 }
17079 D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17080 Token * _literal;
17081 expr_ty elem;
17082 while (
17083 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17084 &&
17085 (elem = _PyPegen_name_token(p)) // NAME
17086 )
17087 {
17088 _res = elem;
17089 if (_res == NULL && PyErr_Occurred()) {
17090 p->error_indicator = 1;
17091 PyMem_Free(_children);
17092 D(p->level--);
17093 return NULL;
17094 }
17095 if (_n == _children_capacity) {
17096 _children_capacity *= 2;
17097 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17098 if (!_new_children) {
17099 p->error_indicator = 1;
17100 PyErr_NoMemory();
17101 D(p->level--);
17102 return NULL;
17103 }
17104 _children = _new_children;
17105 }
17106 _children[_n++] = _res;
17107 _mark = p->mark;
17108 }
17109 p->mark = _mark;
17110 D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
17111 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17112 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017113 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017114 if (!_seq) {
17115 PyMem_Free(_children);
17116 p->error_indicator = 1;
17117 PyErr_NoMemory();
17118 D(p->level--);
17119 return NULL;
17120 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017121 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017122 PyMem_Free(_children);
17123 _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
17124 D(p->level--);
17125 return _seq;
17126}
17127
17128// _gather_25: NAME _loop0_26
17129static asdl_seq *
17130_gather_25_rule(Parser *p)
17131{
17132 D(p->level++);
17133 if (p->error_indicator) {
17134 D(p->level--);
17135 return NULL;
17136 }
17137 asdl_seq * _res = NULL;
17138 int _mark = p->mark;
17139 { // NAME _loop0_26
17140 if (p->error_indicator) {
17141 D(p->level--);
17142 return NULL;
17143 }
17144 D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17145 expr_ty elem;
17146 asdl_seq * seq;
17147 if (
17148 (elem = _PyPegen_name_token(p)) // NAME
17149 &&
17150 (seq = _loop0_26_rule(p)) // _loop0_26
17151 )
17152 {
17153 D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17154 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17155 goto done;
17156 }
17157 p->mark = _mark;
17158 D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ',
17159 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26"));
17160 }
17161 _res = NULL;
17162 done:
17163 D(p->level--);
17164 return _res;
17165}
17166
17167// _loop0_28: ',' NAME
17168static asdl_seq *
17169_loop0_28_rule(Parser *p)
17170{
17171 D(p->level++);
17172 if (p->error_indicator) {
17173 D(p->level--);
17174 return NULL;
17175 }
17176 void *_res = NULL;
17177 int _mark = p->mark;
17178 int _start_mark = p->mark;
17179 void **_children = PyMem_Malloc(sizeof(void *));
17180 if (!_children) {
17181 p->error_indicator = 1;
17182 PyErr_NoMemory();
17183 D(p->level--);
17184 return NULL;
17185 }
17186 ssize_t _children_capacity = 1;
17187 ssize_t _n = 0;
17188 { // ',' NAME
17189 if (p->error_indicator) {
17190 D(p->level--);
17191 return NULL;
17192 }
17193 D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17194 Token * _literal;
17195 expr_ty elem;
17196 while (
17197 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17198 &&
17199 (elem = _PyPegen_name_token(p)) // NAME
17200 )
17201 {
17202 _res = elem;
17203 if (_res == NULL && PyErr_Occurred()) {
17204 p->error_indicator = 1;
17205 PyMem_Free(_children);
17206 D(p->level--);
17207 return NULL;
17208 }
17209 if (_n == _children_capacity) {
17210 _children_capacity *= 2;
17211 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17212 if (!_new_children) {
17213 p->error_indicator = 1;
17214 PyErr_NoMemory();
17215 D(p->level--);
17216 return NULL;
17217 }
17218 _children = _new_children;
17219 }
17220 _children[_n++] = _res;
17221 _mark = p->mark;
17222 }
17223 p->mark = _mark;
17224 D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
17225 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17226 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017227 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017228 if (!_seq) {
17229 PyMem_Free(_children);
17230 p->error_indicator = 1;
17231 PyErr_NoMemory();
17232 D(p->level--);
17233 return NULL;
17234 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017235 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017236 PyMem_Free(_children);
17237 _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
17238 D(p->level--);
17239 return _seq;
17240}
17241
17242// _gather_27: NAME _loop0_28
17243static asdl_seq *
17244_gather_27_rule(Parser *p)
17245{
17246 D(p->level++);
17247 if (p->error_indicator) {
17248 D(p->level--);
17249 return NULL;
17250 }
17251 asdl_seq * _res = NULL;
17252 int _mark = p->mark;
17253 { // NAME _loop0_28
17254 if (p->error_indicator) {
17255 D(p->level--);
17256 return NULL;
17257 }
17258 D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17259 expr_ty elem;
17260 asdl_seq * seq;
17261 if (
17262 (elem = _PyPegen_name_token(p)) // NAME
17263 &&
17264 (seq = _loop0_28_rule(p)) // _loop0_28
17265 )
17266 {
17267 D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17268 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17269 goto done;
17270 }
17271 p->mark = _mark;
17272 D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ',
17273 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28"));
17274 }
17275 _res = NULL;
17276 done:
17277 D(p->level--);
17278 return _res;
17279}
17280
17281// _tmp_29: ',' expression
17282static void *
17283_tmp_29_rule(Parser *p)
17284{
17285 D(p->level++);
17286 if (p->error_indicator) {
17287 D(p->level--);
17288 return NULL;
17289 }
17290 void * _res = NULL;
17291 int _mark = p->mark;
17292 { // ',' expression
17293 if (p->error_indicator) {
17294 D(p->level--);
17295 return NULL;
17296 }
17297 D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
17298 Token * _literal;
17299 expr_ty z;
17300 if (
17301 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17302 &&
17303 (z = expression_rule(p)) // expression
17304 )
17305 {
17306 D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
17307 _res = z;
17308 if (_res == NULL && PyErr_Occurred()) {
17309 p->error_indicator = 1;
17310 D(p->level--);
17311 return NULL;
17312 }
17313 goto done;
17314 }
17315 p->mark = _mark;
17316 D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ',
17317 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
17318 }
17319 _res = NULL;
17320 done:
17321 D(p->level--);
17322 return _res;
17323}
17324
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017325// _tmp_30: ';' | NEWLINE
17326static void *
17327_tmp_30_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017328{
17329 D(p->level++);
17330 if (p->error_indicator) {
17331 D(p->level--);
17332 return NULL;
17333 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017334 void * _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017335 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017336 { // ';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017337 if (p->error_indicator) {
17338 D(p->level--);
17339 return NULL;
17340 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017341 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
17342 Token * _literal;
17343 if (
17344 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017345 )
17346 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017347 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
17348 _res = _literal;
17349 goto done;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017350 }
17351 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017352 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17353 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017354 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017355 { // NEWLINE
17356 if (p->error_indicator) {
17357 D(p->level--);
17358 return NULL;
17359 }
17360 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17361 Token * newline_var;
17362 if (
17363 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
17364 )
17365 {
17366 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17367 _res = newline_var;
17368 goto done;
17369 }
17370 p->mark = _mark;
17371 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017373 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017374 _res = NULL;
17375 done:
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017376 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017377 return _res;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017378}
17379
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017380// _loop0_31: ('.' | '...')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017381static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017382_loop0_31_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017383{
17384 D(p->level++);
17385 if (p->error_indicator) {
17386 D(p->level--);
17387 return NULL;
17388 }
17389 void *_res = NULL;
17390 int _mark = p->mark;
17391 int _start_mark = p->mark;
17392 void **_children = PyMem_Malloc(sizeof(void *));
17393 if (!_children) {
17394 p->error_indicator = 1;
17395 PyErr_NoMemory();
17396 D(p->level--);
17397 return NULL;
17398 }
17399 ssize_t _children_capacity = 1;
17400 ssize_t _n = 0;
17401 { // ('.' | '...')
17402 if (p->error_indicator) {
17403 D(p->level--);
17404 return NULL;
17405 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017406 D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017407 void *_tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017408 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017409 (_tmp_140_var = _tmp_140_rule(p)) // '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017410 )
17411 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017412 _res = _tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017413 if (_n == _children_capacity) {
17414 _children_capacity *= 2;
17415 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17416 if (!_new_children) {
17417 p->error_indicator = 1;
17418 PyErr_NoMemory();
17419 D(p->level--);
17420 return NULL;
17421 }
17422 _children = _new_children;
17423 }
17424 _children[_n++] = _res;
17425 _mark = p->mark;
17426 }
17427 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017428 D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
17429 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17430 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017431 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017432 if (!_seq) {
17433 PyMem_Free(_children);
17434 p->error_indicator = 1;
17435 PyErr_NoMemory();
17436 D(p->level--);
17437 return NULL;
17438 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017439 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017440 PyMem_Free(_children);
17441 _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
17442 D(p->level--);
17443 return _seq;
17444}
17445
17446// _loop1_32: ('.' | '...')
17447static asdl_seq *
17448_loop1_32_rule(Parser *p)
17449{
17450 D(p->level++);
17451 if (p->error_indicator) {
17452 D(p->level--);
17453 return NULL;
17454 }
17455 void *_res = NULL;
17456 int _mark = p->mark;
17457 int _start_mark = p->mark;
17458 void **_children = PyMem_Malloc(sizeof(void *));
17459 if (!_children) {
17460 p->error_indicator = 1;
17461 PyErr_NoMemory();
17462 D(p->level--);
17463 return NULL;
17464 }
17465 ssize_t _children_capacity = 1;
17466 ssize_t _n = 0;
17467 { // ('.' | '...')
17468 if (p->error_indicator) {
17469 D(p->level--);
17470 return NULL;
17471 }
17472 D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017473 void *_tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017474 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017475 (_tmp_141_var = _tmp_141_rule(p)) // '.' | '...'
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017476 )
17477 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017478 _res = _tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017479 if (_n == _children_capacity) {
17480 _children_capacity *= 2;
17481 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17482 if (!_new_children) {
17483 p->error_indicator = 1;
17484 PyErr_NoMemory();
17485 D(p->level--);
17486 return NULL;
17487 }
17488 _children = _new_children;
17489 }
17490 _children[_n++] = _res;
17491 _mark = p->mark;
17492 }
17493 p->mark = _mark;
17494 D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017495 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17496 }
17497 if (_n == 0 || p->error_indicator) {
17498 PyMem_Free(_children);
17499 D(p->level--);
17500 return NULL;
17501 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017502 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017503 if (!_seq) {
17504 PyMem_Free(_children);
17505 p->error_indicator = 1;
17506 PyErr_NoMemory();
17507 D(p->level--);
17508 return NULL;
17509 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017510 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017511 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017512 _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017513 D(p->level--);
17514 return _seq;
17515}
17516
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017517// _loop0_34: ',' import_from_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017518static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017519_loop0_34_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017520{
17521 D(p->level++);
17522 if (p->error_indicator) {
17523 D(p->level--);
17524 return NULL;
17525 }
17526 void *_res = NULL;
17527 int _mark = p->mark;
17528 int _start_mark = p->mark;
17529 void **_children = PyMem_Malloc(sizeof(void *));
17530 if (!_children) {
17531 p->error_indicator = 1;
17532 PyErr_NoMemory();
17533 D(p->level--);
17534 return NULL;
17535 }
17536 ssize_t _children_capacity = 1;
17537 ssize_t _n = 0;
17538 { // ',' import_from_as_name
17539 if (p->error_indicator) {
17540 D(p->level--);
17541 return NULL;
17542 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017543 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 +010017544 Token * _literal;
17545 alias_ty elem;
17546 while (
17547 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17548 &&
17549 (elem = import_from_as_name_rule(p)) // import_from_as_name
17550 )
17551 {
17552 _res = elem;
17553 if (_res == NULL && PyErr_Occurred()) {
17554 p->error_indicator = 1;
17555 PyMem_Free(_children);
17556 D(p->level--);
17557 return NULL;
17558 }
17559 if (_n == _children_capacity) {
17560 _children_capacity *= 2;
17561 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17562 if (!_new_children) {
17563 p->error_indicator = 1;
17564 PyErr_NoMemory();
17565 D(p->level--);
17566 return NULL;
17567 }
17568 _children = _new_children;
17569 }
17570 _children[_n++] = _res;
17571 _mark = p->mark;
17572 }
17573 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017574 D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017575 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
17576 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017577 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017578 if (!_seq) {
17579 PyMem_Free(_children);
17580 p->error_indicator = 1;
17581 PyErr_NoMemory();
17582 D(p->level--);
17583 return NULL;
17584 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017585 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017586 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017587 _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017588 D(p->level--);
17589 return _seq;
17590}
17591
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017592// _gather_33: import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017593static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017594_gather_33_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017595{
17596 D(p->level++);
17597 if (p->error_indicator) {
17598 D(p->level--);
17599 return NULL;
17600 }
17601 asdl_seq * _res = NULL;
17602 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017603 { // import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017604 if (p->error_indicator) {
17605 D(p->level--);
17606 return NULL;
17607 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017608 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 +010017609 alias_ty elem;
17610 asdl_seq * seq;
17611 if (
17612 (elem = import_from_as_name_rule(p)) // import_from_as_name
17613 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017614 (seq = _loop0_34_rule(p)) // _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017615 )
17616 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017617 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 +010017618 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17619 goto done;
17620 }
17621 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017622 D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ',
17623 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017624 }
17625 _res = NULL;
17626 done:
17627 D(p->level--);
17628 return _res;
17629}
17630
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017631// _tmp_35: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017632static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017633_tmp_35_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017634{
17635 D(p->level++);
17636 if (p->error_indicator) {
17637 D(p->level--);
17638 return NULL;
17639 }
17640 void * _res = NULL;
17641 int _mark = p->mark;
17642 { // 'as' NAME
17643 if (p->error_indicator) {
17644 D(p->level--);
17645 return NULL;
17646 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017647 D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017648 Token * _keyword;
17649 expr_ty z;
17650 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017651 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017652 &&
17653 (z = _PyPegen_name_token(p)) // NAME
17654 )
17655 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017656 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 +010017657 _res = z;
17658 if (_res == NULL && PyErr_Occurred()) {
17659 p->error_indicator = 1;
17660 D(p->level--);
17661 return NULL;
17662 }
17663 goto done;
17664 }
17665 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017666 D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017667 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17668 }
17669 _res = NULL;
17670 done:
17671 D(p->level--);
17672 return _res;
17673}
17674
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017675// _loop0_37: ',' dotted_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017676static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017677_loop0_37_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017678{
17679 D(p->level++);
17680 if (p->error_indicator) {
17681 D(p->level--);
17682 return NULL;
17683 }
17684 void *_res = NULL;
17685 int _mark = p->mark;
17686 int _start_mark = p->mark;
17687 void **_children = PyMem_Malloc(sizeof(void *));
17688 if (!_children) {
17689 p->error_indicator = 1;
17690 PyErr_NoMemory();
17691 D(p->level--);
17692 return NULL;
17693 }
17694 ssize_t _children_capacity = 1;
17695 ssize_t _n = 0;
17696 { // ',' dotted_as_name
17697 if (p->error_indicator) {
17698 D(p->level--);
17699 return NULL;
17700 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017701 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 +010017702 Token * _literal;
17703 alias_ty elem;
17704 while (
17705 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17706 &&
17707 (elem = dotted_as_name_rule(p)) // dotted_as_name
17708 )
17709 {
17710 _res = elem;
17711 if (_res == NULL && PyErr_Occurred()) {
17712 p->error_indicator = 1;
17713 PyMem_Free(_children);
17714 D(p->level--);
17715 return NULL;
17716 }
17717 if (_n == _children_capacity) {
17718 _children_capacity *= 2;
17719 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17720 if (!_new_children) {
17721 p->error_indicator = 1;
17722 PyErr_NoMemory();
17723 D(p->level--);
17724 return NULL;
17725 }
17726 _children = _new_children;
17727 }
17728 _children[_n++] = _res;
17729 _mark = p->mark;
17730 }
17731 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017732 D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017733 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
17734 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017735 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017736 if (!_seq) {
17737 PyMem_Free(_children);
17738 p->error_indicator = 1;
17739 PyErr_NoMemory();
17740 D(p->level--);
17741 return NULL;
17742 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017743 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017744 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017745 _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017746 D(p->level--);
17747 return _seq;
17748}
17749
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017750// _gather_36: dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017751static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017752_gather_36_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017753{
17754 D(p->level++);
17755 if (p->error_indicator) {
17756 D(p->level--);
17757 return NULL;
17758 }
17759 asdl_seq * _res = NULL;
17760 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017761 { // dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017762 if (p->error_indicator) {
17763 D(p->level--);
17764 return NULL;
17765 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017766 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 +010017767 alias_ty elem;
17768 asdl_seq * seq;
17769 if (
17770 (elem = dotted_as_name_rule(p)) // dotted_as_name
17771 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017772 (seq = _loop0_37_rule(p)) // _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017773 )
17774 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017775 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 +010017776 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17777 goto done;
17778 }
17779 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017780 D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ',
17781 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017782 }
17783 _res = NULL;
17784 done:
17785 D(p->level--);
17786 return _res;
17787}
17788
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017789// _tmp_38: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017790static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017791_tmp_38_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017792{
17793 D(p->level++);
17794 if (p->error_indicator) {
17795 D(p->level--);
17796 return NULL;
17797 }
17798 void * _res = NULL;
17799 int _mark = p->mark;
17800 { // 'as' NAME
17801 if (p->error_indicator) {
17802 D(p->level--);
17803 return NULL;
17804 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017805 D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017806 Token * _keyword;
17807 expr_ty z;
17808 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017809 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017810 &&
17811 (z = _PyPegen_name_token(p)) // NAME
17812 )
17813 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017814 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 +010017815 _res = z;
17816 if (_res == NULL && PyErr_Occurred()) {
17817 p->error_indicator = 1;
17818 D(p->level--);
17819 return NULL;
17820 }
17821 goto done;
17822 }
17823 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017824 D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017825 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17826 }
17827 _res = NULL;
17828 done:
17829 D(p->level--);
17830 return _res;
17831}
17832
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017833// _loop0_40: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017834static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017835_loop0_40_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017836{
17837 D(p->level++);
17838 if (p->error_indicator) {
17839 D(p->level--);
17840 return NULL;
17841 }
17842 void *_res = NULL;
17843 int _mark = p->mark;
17844 int _start_mark = p->mark;
17845 void **_children = PyMem_Malloc(sizeof(void *));
17846 if (!_children) {
17847 p->error_indicator = 1;
17848 PyErr_NoMemory();
17849 D(p->level--);
17850 return NULL;
17851 }
17852 ssize_t _children_capacity = 1;
17853 ssize_t _n = 0;
17854 { // ',' with_item
17855 if (p->error_indicator) {
17856 D(p->level--);
17857 return NULL;
17858 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017859 D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017860 Token * _literal;
17861 withitem_ty elem;
17862 while (
17863 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17864 &&
17865 (elem = with_item_rule(p)) // with_item
17866 )
17867 {
17868 _res = elem;
17869 if (_res == NULL && PyErr_Occurred()) {
17870 p->error_indicator = 1;
17871 PyMem_Free(_children);
17872 D(p->level--);
17873 return NULL;
17874 }
17875 if (_n == _children_capacity) {
17876 _children_capacity *= 2;
17877 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17878 if (!_new_children) {
17879 p->error_indicator = 1;
17880 PyErr_NoMemory();
17881 D(p->level--);
17882 return NULL;
17883 }
17884 _children = _new_children;
17885 }
17886 _children[_n++] = _res;
17887 _mark = p->mark;
17888 }
17889 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017890 D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017891 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17892 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017893 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017894 if (!_seq) {
17895 PyMem_Free(_children);
17896 p->error_indicator = 1;
17897 PyErr_NoMemory();
17898 D(p->level--);
17899 return NULL;
17900 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017901 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017902 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017903 _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017904 D(p->level--);
17905 return _seq;
17906}
17907
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017908// _gather_39: with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017909static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017910_gather_39_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017911{
17912 D(p->level++);
17913 if (p->error_indicator) {
17914 D(p->level--);
17915 return NULL;
17916 }
17917 asdl_seq * _res = NULL;
17918 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017919 { // with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017920 if (p->error_indicator) {
17921 D(p->level--);
17922 return NULL;
17923 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017924 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 +010017925 withitem_ty elem;
17926 asdl_seq * seq;
17927 if (
17928 (elem = with_item_rule(p)) // with_item
17929 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017930 (seq = _loop0_40_rule(p)) // _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017931 )
17932 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017933 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 +010017934 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17935 goto done;
17936 }
17937 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017938 D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ',
17939 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017940 }
17941 _res = NULL;
17942 done:
17943 D(p->level--);
17944 return _res;
17945}
17946
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017947// _loop0_42: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017948static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017949_loop0_42_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017950{
17951 D(p->level++);
17952 if (p->error_indicator) {
17953 D(p->level--);
17954 return NULL;
17955 }
17956 void *_res = NULL;
17957 int _mark = p->mark;
17958 int _start_mark = p->mark;
17959 void **_children = PyMem_Malloc(sizeof(void *));
17960 if (!_children) {
17961 p->error_indicator = 1;
17962 PyErr_NoMemory();
17963 D(p->level--);
17964 return NULL;
17965 }
17966 ssize_t _children_capacity = 1;
17967 ssize_t _n = 0;
17968 { // ',' with_item
17969 if (p->error_indicator) {
17970 D(p->level--);
17971 return NULL;
17972 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017973 D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017974 Token * _literal;
17975 withitem_ty elem;
17976 while (
17977 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17978 &&
17979 (elem = with_item_rule(p)) // with_item
17980 )
17981 {
17982 _res = elem;
17983 if (_res == NULL && PyErr_Occurred()) {
17984 p->error_indicator = 1;
17985 PyMem_Free(_children);
17986 D(p->level--);
17987 return NULL;
17988 }
17989 if (_n == _children_capacity) {
17990 _children_capacity *= 2;
17991 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17992 if (!_new_children) {
17993 p->error_indicator = 1;
17994 PyErr_NoMemory();
17995 D(p->level--);
17996 return NULL;
17997 }
17998 _children = _new_children;
17999 }
18000 _children[_n++] = _res;
18001 _mark = p->mark;
18002 }
18003 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018004 D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018005 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18006 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018007 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018008 if (!_seq) {
18009 PyMem_Free(_children);
18010 p->error_indicator = 1;
18011 PyErr_NoMemory();
18012 D(p->level--);
18013 return NULL;
18014 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018015 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018016 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018017 _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018018 D(p->level--);
18019 return _seq;
18020}
18021
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018022// _gather_41: with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018023static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018024_gather_41_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018025{
18026 D(p->level++);
18027 if (p->error_indicator) {
18028 D(p->level--);
18029 return NULL;
18030 }
18031 asdl_seq * _res = NULL;
18032 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018033 { // with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018034 if (p->error_indicator) {
18035 D(p->level--);
18036 return NULL;
18037 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018038 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 +010018039 withitem_ty elem;
18040 asdl_seq * seq;
18041 if (
18042 (elem = with_item_rule(p)) // with_item
18043 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018044 (seq = _loop0_42_rule(p)) // _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018045 )
18046 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018047 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 +010018048 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18049 goto done;
18050 }
18051 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018052 D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
18053 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018054 }
18055 _res = NULL;
18056 done:
18057 D(p->level--);
18058 return _res;
18059}
18060
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018061// _loop0_44: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018062static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018063_loop0_44_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018064{
18065 D(p->level++);
18066 if (p->error_indicator) {
18067 D(p->level--);
18068 return NULL;
18069 }
18070 void *_res = NULL;
18071 int _mark = p->mark;
18072 int _start_mark = p->mark;
18073 void **_children = PyMem_Malloc(sizeof(void *));
18074 if (!_children) {
18075 p->error_indicator = 1;
18076 PyErr_NoMemory();
18077 D(p->level--);
18078 return NULL;
18079 }
18080 ssize_t _children_capacity = 1;
18081 ssize_t _n = 0;
18082 { // ',' with_item
18083 if (p->error_indicator) {
18084 D(p->level--);
18085 return NULL;
18086 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018087 D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018088 Token * _literal;
18089 withitem_ty elem;
18090 while (
18091 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18092 &&
18093 (elem = with_item_rule(p)) // with_item
18094 )
18095 {
18096 _res = elem;
18097 if (_res == NULL && PyErr_Occurred()) {
18098 p->error_indicator = 1;
18099 PyMem_Free(_children);
18100 D(p->level--);
18101 return NULL;
18102 }
18103 if (_n == _children_capacity) {
18104 _children_capacity *= 2;
18105 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18106 if (!_new_children) {
18107 p->error_indicator = 1;
18108 PyErr_NoMemory();
18109 D(p->level--);
18110 return NULL;
18111 }
18112 _children = _new_children;
18113 }
18114 _children[_n++] = _res;
18115 _mark = p->mark;
18116 }
18117 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018118 D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018119 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18120 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018121 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018122 if (!_seq) {
18123 PyMem_Free(_children);
18124 p->error_indicator = 1;
18125 PyErr_NoMemory();
18126 D(p->level--);
18127 return NULL;
18128 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018129 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018130 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018131 _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018132 D(p->level--);
18133 return _seq;
18134}
18135
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018136// _gather_43: with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018137static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018138_gather_43_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018139{
18140 D(p->level++);
18141 if (p->error_indicator) {
18142 D(p->level--);
18143 return NULL;
18144 }
18145 asdl_seq * _res = NULL;
18146 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018147 { // with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018148 if (p->error_indicator) {
18149 D(p->level--);
18150 return NULL;
18151 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018152 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 +010018153 withitem_ty elem;
18154 asdl_seq * seq;
18155 if (
18156 (elem = with_item_rule(p)) // with_item
18157 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018158 (seq = _loop0_44_rule(p)) // _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018159 )
18160 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018161 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 +010018162 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18163 goto done;
18164 }
18165 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018166 D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ',
18167 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018168 }
18169 _res = NULL;
18170 done:
18171 D(p->level--);
18172 return _res;
18173}
18174
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018175// _loop0_46: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018176static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018177_loop0_46_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018178{
18179 D(p->level++);
18180 if (p->error_indicator) {
18181 D(p->level--);
18182 return NULL;
18183 }
18184 void *_res = NULL;
18185 int _mark = p->mark;
18186 int _start_mark = p->mark;
18187 void **_children = PyMem_Malloc(sizeof(void *));
18188 if (!_children) {
18189 p->error_indicator = 1;
18190 PyErr_NoMemory();
18191 D(p->level--);
18192 return NULL;
18193 }
18194 ssize_t _children_capacity = 1;
18195 ssize_t _n = 0;
18196 { // ',' with_item
18197 if (p->error_indicator) {
18198 D(p->level--);
18199 return NULL;
18200 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018201 D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018202 Token * _literal;
18203 withitem_ty elem;
18204 while (
18205 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18206 &&
18207 (elem = with_item_rule(p)) // with_item
18208 )
18209 {
18210 _res = elem;
18211 if (_res == NULL && PyErr_Occurred()) {
18212 p->error_indicator = 1;
18213 PyMem_Free(_children);
18214 D(p->level--);
18215 return NULL;
18216 }
18217 if (_n == _children_capacity) {
18218 _children_capacity *= 2;
18219 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18220 if (!_new_children) {
18221 p->error_indicator = 1;
18222 PyErr_NoMemory();
18223 D(p->level--);
18224 return NULL;
18225 }
18226 _children = _new_children;
18227 }
18228 _children[_n++] = _res;
18229 _mark = p->mark;
18230 }
18231 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018232 D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018233 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18234 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018235 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018236 if (!_seq) {
18237 PyMem_Free(_children);
18238 p->error_indicator = 1;
18239 PyErr_NoMemory();
18240 D(p->level--);
18241 return NULL;
18242 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018243 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018244 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018245 _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018246 D(p->level--);
18247 return _seq;
18248}
18249
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018250// _gather_45: with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018251static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018252_gather_45_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018253{
18254 D(p->level++);
18255 if (p->error_indicator) {
18256 D(p->level--);
18257 return NULL;
18258 }
18259 asdl_seq * _res = NULL;
18260 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018261 { // with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018262 if (p->error_indicator) {
18263 D(p->level--);
18264 return NULL;
18265 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018266 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 +010018267 withitem_ty elem;
18268 asdl_seq * seq;
18269 if (
18270 (elem = with_item_rule(p)) // with_item
18271 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018272 (seq = _loop0_46_rule(p)) // _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018273 )
18274 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018275 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 +010018276 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18277 goto done;
18278 }
18279 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018280 D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
18281 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018282 }
18283 _res = NULL;
18284 done:
18285 D(p->level--);
18286 return _res;
18287}
18288
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018289// _tmp_47: ',' | ')' | ':'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018290static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018291_tmp_47_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018292{
18293 D(p->level++);
18294 if (p->error_indicator) {
18295 D(p->level--);
18296 return NULL;
18297 }
18298 void * _res = NULL;
18299 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018300 { // ','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018301 if (p->error_indicator) {
18302 D(p->level--);
18303 return NULL;
18304 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018305 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
18306 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018307 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018308 (_literal = _PyPegen_expect_token(p, 12)) // token=','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018309 )
18310 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018311 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
18312 _res = _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018313 goto done;
18314 }
18315 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018316 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18317 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
18318 }
18319 { // ')'
18320 if (p->error_indicator) {
18321 D(p->level--);
18322 return NULL;
18323 }
18324 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
18325 Token * _literal;
18326 if (
18327 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
18328 )
18329 {
18330 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
18331 _res = _literal;
18332 goto done;
18333 }
18334 p->mark = _mark;
18335 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18336 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
18337 }
18338 { // ':'
18339 if (p->error_indicator) {
18340 D(p->level--);
18341 return NULL;
18342 }
18343 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
18344 Token * _literal;
18345 if (
18346 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
18347 )
18348 {
18349 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
18350 _res = _literal;
18351 goto done;
18352 }
18353 p->mark = _mark;
18354 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18355 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018356 }
18357 _res = NULL;
18358 done:
18359 D(p->level--);
18360 return _res;
18361}
18362
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018363// _loop1_48: except_block
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018364static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018365_loop1_48_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018366{
18367 D(p->level++);
18368 if (p->error_indicator) {
18369 D(p->level--);
18370 return NULL;
18371 }
18372 void *_res = NULL;
18373 int _mark = p->mark;
18374 int _start_mark = p->mark;
18375 void **_children = PyMem_Malloc(sizeof(void *));
18376 if (!_children) {
18377 p->error_indicator = 1;
18378 PyErr_NoMemory();
18379 D(p->level--);
18380 return NULL;
18381 }
18382 ssize_t _children_capacity = 1;
18383 ssize_t _n = 0;
18384 { // except_block
18385 if (p->error_indicator) {
18386 D(p->level--);
18387 return NULL;
18388 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018389 D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018390 excepthandler_ty except_block_var;
18391 while (
18392 (except_block_var = except_block_rule(p)) // except_block
18393 )
18394 {
18395 _res = except_block_var;
18396 if (_n == _children_capacity) {
18397 _children_capacity *= 2;
18398 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18399 if (!_new_children) {
18400 p->error_indicator = 1;
18401 PyErr_NoMemory();
18402 D(p->level--);
18403 return NULL;
18404 }
18405 _children = _new_children;
18406 }
18407 _children[_n++] = _res;
18408 _mark = p->mark;
18409 }
18410 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018411 D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018412 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
18413 }
18414 if (_n == 0 || p->error_indicator) {
18415 PyMem_Free(_children);
18416 D(p->level--);
18417 return NULL;
18418 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018419 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018420 if (!_seq) {
18421 PyMem_Free(_children);
18422 p->error_indicator = 1;
18423 PyErr_NoMemory();
18424 D(p->level--);
18425 return NULL;
18426 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018427 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018428 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018429 _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018430 D(p->level--);
18431 return _seq;
18432}
18433
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018434// _tmp_49: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018435static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018436_tmp_49_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018437{
18438 D(p->level++);
18439 if (p->error_indicator) {
18440 D(p->level--);
18441 return NULL;
18442 }
18443 void * _res = NULL;
18444 int _mark = p->mark;
18445 { // 'as' NAME
18446 if (p->error_indicator) {
18447 D(p->level--);
18448 return NULL;
18449 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018450 D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018451 Token * _keyword;
18452 expr_ty z;
18453 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018454 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018455 &&
18456 (z = _PyPegen_name_token(p)) // NAME
18457 )
18458 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018459 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 +010018460 _res = z;
18461 if (_res == NULL && PyErr_Occurred()) {
18462 p->error_indicator = 1;
18463 D(p->level--);
18464 return NULL;
18465 }
18466 goto done;
18467 }
18468 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018469 D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018470 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
18471 }
18472 _res = NULL;
18473 done:
18474 D(p->level--);
18475 return _res;
18476}
18477
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018478// _tmp_50: 'from' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018479static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018480_tmp_50_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018481{
18482 D(p->level++);
18483 if (p->error_indicator) {
18484 D(p->level--);
18485 return NULL;
18486 }
18487 void * _res = NULL;
18488 int _mark = p->mark;
18489 { // 'from' expression
18490 if (p->error_indicator) {
18491 D(p->level--);
18492 return NULL;
18493 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018494 D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018495 Token * _keyword;
18496 expr_ty z;
18497 if (
18498 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
18499 &&
18500 (z = expression_rule(p)) // expression
18501 )
18502 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018503 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 +010018504 _res = z;
18505 if (_res == NULL && PyErr_Occurred()) {
18506 p->error_indicator = 1;
18507 D(p->level--);
18508 return NULL;
18509 }
18510 goto done;
18511 }
18512 p->mark = _mark;
18513 D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018514 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018515 }
18516 _res = NULL;
18517 done:
18518 D(p->level--);
18519 return _res;
18520}
18521
18522// _tmp_51: '->' expression
18523static void *
18524_tmp_51_rule(Parser *p)
18525{
18526 D(p->level++);
18527 if (p->error_indicator) {
18528 D(p->level--);
18529 return NULL;
18530 }
18531 void * _res = NULL;
18532 int _mark = p->mark;
18533 { // '->' expression
18534 if (p->error_indicator) {
18535 D(p->level--);
18536 return NULL;
18537 }
18538 D(fprintf(stderr, "%*c> _tmp_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18539 Token * _literal;
18540 expr_ty z;
18541 if (
18542 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18543 &&
18544 (z = expression_rule(p)) // expression
18545 )
18546 {
18547 D(fprintf(stderr, "%*c+ _tmp_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18548 _res = z;
18549 if (_res == NULL && PyErr_Occurred()) {
18550 p->error_indicator = 1;
18551 D(p->level--);
18552 return NULL;
18553 }
18554 goto done;
18555 }
18556 p->mark = _mark;
18557 D(fprintf(stderr, "%*c%s _tmp_51[%d-%d]: %s failed!\n", p->level, ' ',
18558 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18559 }
18560 _res = NULL;
18561 done:
18562 D(p->level--);
18563 return _res;
18564}
18565
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018566// _tmp_52: '->' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018567static void *
18568_tmp_52_rule(Parser *p)
18569{
18570 D(p->level++);
18571 if (p->error_indicator) {
18572 D(p->level--);
18573 return NULL;
18574 }
18575 void * _res = NULL;
18576 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018577 { // '->' expression
18578 if (p->error_indicator) {
18579 D(p->level--);
18580 return NULL;
18581 }
18582 D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18583 Token * _literal;
18584 expr_ty z;
18585 if (
18586 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18587 &&
18588 (z = expression_rule(p)) // expression
18589 )
18590 {
18591 D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18592 _res = z;
18593 if (_res == NULL && PyErr_Occurred()) {
18594 p->error_indicator = 1;
18595 D(p->level--);
18596 return NULL;
18597 }
18598 goto done;
18599 }
18600 p->mark = _mark;
18601 D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ',
18602 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18603 }
18604 _res = NULL;
18605 done:
18606 D(p->level--);
18607 return _res;
18608}
18609
18610// _tmp_53: NEWLINE INDENT
18611static void *
18612_tmp_53_rule(Parser *p)
18613{
18614 D(p->level++);
18615 if (p->error_indicator) {
18616 D(p->level--);
18617 return NULL;
18618 }
18619 void * _res = NULL;
18620 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018621 { // NEWLINE INDENT
18622 if (p->error_indicator) {
18623 D(p->level--);
18624 return NULL;
18625 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018626 D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018627 Token * indent_var;
18628 Token * newline_var;
18629 if (
18630 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
18631 &&
18632 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
18633 )
18634 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018635 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 +010018636 _res = _PyPegen_dummy_name(p, newline_var, indent_var);
18637 goto done;
18638 }
18639 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018640 D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018641 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
18642 }
18643 _res = NULL;
18644 done:
18645 D(p->level--);
18646 return _res;
18647}
18648
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018649// _loop0_54: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018650static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018651_loop0_54_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018652{
18653 D(p->level++);
18654 if (p->error_indicator) {
18655 D(p->level--);
18656 return NULL;
18657 }
18658 void *_res = NULL;
18659 int _mark = p->mark;
18660 int _start_mark = p->mark;
18661 void **_children = PyMem_Malloc(sizeof(void *));
18662 if (!_children) {
18663 p->error_indicator = 1;
18664 PyErr_NoMemory();
18665 D(p->level--);
18666 return NULL;
18667 }
18668 ssize_t _children_capacity = 1;
18669 ssize_t _n = 0;
18670 { // param_no_default
18671 if (p->error_indicator) {
18672 D(p->level--);
18673 return NULL;
18674 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018675 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 +010018676 arg_ty param_no_default_var;
18677 while (
18678 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18679 )
18680 {
18681 _res = param_no_default_var;
18682 if (_n == _children_capacity) {
18683 _children_capacity *= 2;
18684 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18685 if (!_new_children) {
18686 p->error_indicator = 1;
18687 PyErr_NoMemory();
18688 D(p->level--);
18689 return NULL;
18690 }
18691 _children = _new_children;
18692 }
18693 _children[_n++] = _res;
18694 _mark = p->mark;
18695 }
18696 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018697 D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018698 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018699 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018700 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018701 if (!_seq) {
18702 PyMem_Free(_children);
18703 p->error_indicator = 1;
18704 PyErr_NoMemory();
18705 D(p->level--);
18706 return NULL;
18707 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018708 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018709 PyMem_Free(_children);
18710 _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq);
18711 D(p->level--);
18712 return _seq;
18713}
18714
18715// _loop0_55: param_with_default
18716static asdl_seq *
18717_loop0_55_rule(Parser *p)
18718{
18719 D(p->level++);
18720 if (p->error_indicator) {
18721 D(p->level--);
18722 return NULL;
18723 }
18724 void *_res = NULL;
18725 int _mark = p->mark;
18726 int _start_mark = p->mark;
18727 void **_children = PyMem_Malloc(sizeof(void *));
18728 if (!_children) {
18729 p->error_indicator = 1;
18730 PyErr_NoMemory();
18731 D(p->level--);
18732 return NULL;
18733 }
18734 ssize_t _children_capacity = 1;
18735 ssize_t _n = 0;
18736 { // param_with_default
18737 if (p->error_indicator) {
18738 D(p->level--);
18739 return NULL;
18740 }
18741 D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18742 NameDefaultPair* param_with_default_var;
18743 while (
18744 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18745 )
18746 {
18747 _res = param_with_default_var;
18748 if (_n == _children_capacity) {
18749 _children_capacity *= 2;
18750 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18751 if (!_new_children) {
18752 p->error_indicator = 1;
18753 PyErr_NoMemory();
18754 D(p->level--);
18755 return NULL;
18756 }
18757 _children = _new_children;
18758 }
18759 _children[_n++] = _res;
18760 _mark = p->mark;
18761 }
18762 p->mark = _mark;
18763 D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ',
18764 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18765 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018766 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018767 if (!_seq) {
18768 PyMem_Free(_children);
18769 p->error_indicator = 1;
18770 PyErr_NoMemory();
18771 D(p->level--);
18772 return NULL;
18773 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018774 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018775 PyMem_Free(_children);
18776 _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq);
18777 D(p->level--);
18778 return _seq;
18779}
18780
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018781// _loop0_56: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018782static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018783_loop0_56_rule(Parser *p)
18784{
18785 D(p->level++);
18786 if (p->error_indicator) {
18787 D(p->level--);
18788 return NULL;
18789 }
18790 void *_res = NULL;
18791 int _mark = p->mark;
18792 int _start_mark = p->mark;
18793 void **_children = PyMem_Malloc(sizeof(void *));
18794 if (!_children) {
18795 p->error_indicator = 1;
18796 PyErr_NoMemory();
18797 D(p->level--);
18798 return NULL;
18799 }
18800 ssize_t _children_capacity = 1;
18801 ssize_t _n = 0;
18802 { // param_with_default
18803 if (p->error_indicator) {
18804 D(p->level--);
18805 return NULL;
18806 }
18807 D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18808 NameDefaultPair* param_with_default_var;
18809 while (
18810 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18811 )
18812 {
18813 _res = param_with_default_var;
18814 if (_n == _children_capacity) {
18815 _children_capacity *= 2;
18816 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18817 if (!_new_children) {
18818 p->error_indicator = 1;
18819 PyErr_NoMemory();
18820 D(p->level--);
18821 return NULL;
18822 }
18823 _children = _new_children;
18824 }
18825 _children[_n++] = _res;
18826 _mark = p->mark;
18827 }
18828 p->mark = _mark;
18829 D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ',
18830 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18831 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018832 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018833 if (!_seq) {
18834 PyMem_Free(_children);
18835 p->error_indicator = 1;
18836 PyErr_NoMemory();
18837 D(p->level--);
18838 return NULL;
18839 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018840 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018841 PyMem_Free(_children);
18842 _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq);
18843 D(p->level--);
18844 return _seq;
18845}
18846
18847// _loop1_57: param_no_default
18848static asdl_seq *
18849_loop1_57_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018850{
18851 D(p->level++);
18852 if (p->error_indicator) {
18853 D(p->level--);
18854 return NULL;
18855 }
18856 void *_res = NULL;
18857 int _mark = p->mark;
18858 int _start_mark = p->mark;
18859 void **_children = PyMem_Malloc(sizeof(void *));
18860 if (!_children) {
18861 p->error_indicator = 1;
18862 PyErr_NoMemory();
18863 D(p->level--);
18864 return NULL;
18865 }
18866 ssize_t _children_capacity = 1;
18867 ssize_t _n = 0;
18868 { // param_no_default
18869 if (p->error_indicator) {
18870 D(p->level--);
18871 return NULL;
18872 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018873 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 +010018874 arg_ty param_no_default_var;
18875 while (
18876 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18877 )
18878 {
18879 _res = param_no_default_var;
18880 if (_n == _children_capacity) {
18881 _children_capacity *= 2;
18882 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18883 if (!_new_children) {
18884 p->error_indicator = 1;
18885 PyErr_NoMemory();
18886 D(p->level--);
18887 return NULL;
18888 }
18889 _children = _new_children;
18890 }
18891 _children[_n++] = _res;
18892 _mark = p->mark;
18893 }
18894 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018895 D(fprintf(stderr, "%*c%s _loop1_57[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018896 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
18897 }
18898 if (_n == 0 || p->error_indicator) {
18899 PyMem_Free(_children);
18900 D(p->level--);
18901 return NULL;
18902 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018903 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018904 if (!_seq) {
18905 PyMem_Free(_children);
18906 p->error_indicator = 1;
18907 PyErr_NoMemory();
18908 D(p->level--);
18909 return NULL;
18910 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018911 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018912 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018913 _PyPegen_insert_memo(p, _start_mark, _loop1_57_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018914 D(p->level--);
18915 return _seq;
18916}
18917
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018918// _loop0_58: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018919static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018920_loop0_58_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018921{
18922 D(p->level++);
18923 if (p->error_indicator) {
18924 D(p->level--);
18925 return NULL;
18926 }
18927 void *_res = NULL;
18928 int _mark = p->mark;
18929 int _start_mark = p->mark;
18930 void **_children = PyMem_Malloc(sizeof(void *));
18931 if (!_children) {
18932 p->error_indicator = 1;
18933 PyErr_NoMemory();
18934 D(p->level--);
18935 return NULL;
18936 }
18937 ssize_t _children_capacity = 1;
18938 ssize_t _n = 0;
18939 { // param_with_default
18940 if (p->error_indicator) {
18941 D(p->level--);
18942 return NULL;
18943 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018944 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 +010018945 NameDefaultPair* param_with_default_var;
18946 while (
18947 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18948 )
18949 {
18950 _res = param_with_default_var;
18951 if (_n == _children_capacity) {
18952 _children_capacity *= 2;
18953 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18954 if (!_new_children) {
18955 p->error_indicator = 1;
18956 PyErr_NoMemory();
18957 D(p->level--);
18958 return NULL;
18959 }
18960 _children = _new_children;
18961 }
18962 _children[_n++] = _res;
18963 _mark = p->mark;
18964 }
18965 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018966 D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018967 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18968 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018969 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018970 if (!_seq) {
18971 PyMem_Free(_children);
18972 p->error_indicator = 1;
18973 PyErr_NoMemory();
18974 D(p->level--);
18975 return NULL;
18976 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018977 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018978 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018979 _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018980 D(p->level--);
18981 return _seq;
18982}
18983
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018984// _loop1_59: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018985static asdl_seq *
18986_loop1_59_rule(Parser *p)
18987{
18988 D(p->level++);
18989 if (p->error_indicator) {
18990 D(p->level--);
18991 return NULL;
18992 }
18993 void *_res = NULL;
18994 int _mark = p->mark;
18995 int _start_mark = p->mark;
18996 void **_children = PyMem_Malloc(sizeof(void *));
18997 if (!_children) {
18998 p->error_indicator = 1;
18999 PyErr_NoMemory();
19000 D(p->level--);
19001 return NULL;
19002 }
19003 ssize_t _children_capacity = 1;
19004 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019005 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019006 if (p->error_indicator) {
19007 D(p->level--);
19008 return NULL;
19009 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019010 D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
19011 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019012 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019013 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019014 )
19015 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019016 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019017 if (_n == _children_capacity) {
19018 _children_capacity *= 2;
19019 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19020 if (!_new_children) {
19021 p->error_indicator = 1;
19022 PyErr_NoMemory();
19023 D(p->level--);
19024 return NULL;
19025 }
19026 _children = _new_children;
19027 }
19028 _children[_n++] = _res;
19029 _mark = p->mark;
19030 }
19031 p->mark = _mark;
19032 D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019033 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019034 }
19035 if (_n == 0 || p->error_indicator) {
19036 PyMem_Free(_children);
19037 D(p->level--);
19038 return NULL;
19039 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019040 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019041 if (!_seq) {
19042 PyMem_Free(_children);
19043 p->error_indicator = 1;
19044 PyErr_NoMemory();
19045 D(p->level--);
19046 return NULL;
19047 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019048 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019049 PyMem_Free(_children);
19050 _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq);
19051 D(p->level--);
19052 return _seq;
19053}
19054
19055// _loop1_60: param_no_default
19056static asdl_seq *
19057_loop1_60_rule(Parser *p)
19058{
19059 D(p->level++);
19060 if (p->error_indicator) {
19061 D(p->level--);
19062 return NULL;
19063 }
19064 void *_res = NULL;
19065 int _mark = p->mark;
19066 int _start_mark = p->mark;
19067 void **_children = PyMem_Malloc(sizeof(void *));
19068 if (!_children) {
19069 p->error_indicator = 1;
19070 PyErr_NoMemory();
19071 D(p->level--);
19072 return NULL;
19073 }
19074 ssize_t _children_capacity = 1;
19075 ssize_t _n = 0;
19076 { // param_no_default
19077 if (p->error_indicator) {
19078 D(p->level--);
19079 return NULL;
19080 }
19081 D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19082 arg_ty param_no_default_var;
19083 while (
19084 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19085 )
19086 {
19087 _res = param_no_default_var;
19088 if (_n == _children_capacity) {
19089 _children_capacity *= 2;
19090 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19091 if (!_new_children) {
19092 p->error_indicator = 1;
19093 PyErr_NoMemory();
19094 D(p->level--);
19095 return NULL;
19096 }
19097 _children = _new_children;
19098 }
19099 _children[_n++] = _res;
19100 _mark = p->mark;
19101 }
19102 p->mark = _mark;
19103 D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ',
19104 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19105 }
19106 if (_n == 0 || p->error_indicator) {
19107 PyMem_Free(_children);
19108 D(p->level--);
19109 return NULL;
19110 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019111 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019112 if (!_seq) {
19113 PyMem_Free(_children);
19114 p->error_indicator = 1;
19115 PyErr_NoMemory();
19116 D(p->level--);
19117 return NULL;
19118 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019119 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019120 PyMem_Free(_children);
19121 _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq);
19122 D(p->level--);
19123 return _seq;
19124}
19125
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019126// _loop1_61: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019127static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019128_loop1_61_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019129{
19130 D(p->level++);
19131 if (p->error_indicator) {
19132 D(p->level--);
19133 return NULL;
19134 }
19135 void *_res = NULL;
19136 int _mark = p->mark;
19137 int _start_mark = p->mark;
19138 void **_children = PyMem_Malloc(sizeof(void *));
19139 if (!_children) {
19140 p->error_indicator = 1;
19141 PyErr_NoMemory();
19142 D(p->level--);
19143 return NULL;
19144 }
19145 ssize_t _children_capacity = 1;
19146 ssize_t _n = 0;
19147 { // param_no_default
19148 if (p->error_indicator) {
19149 D(p->level--);
19150 return NULL;
19151 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019152 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 +010019153 arg_ty param_no_default_var;
19154 while (
19155 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19156 )
19157 {
19158 _res = param_no_default_var;
19159 if (_n == _children_capacity) {
19160 _children_capacity *= 2;
19161 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19162 if (!_new_children) {
19163 p->error_indicator = 1;
19164 PyErr_NoMemory();
19165 D(p->level--);
19166 return NULL;
19167 }
19168 _children = _new_children;
19169 }
19170 _children[_n++] = _res;
19171 _mark = p->mark;
19172 }
19173 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019174 D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019175 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19176 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019177 if (_n == 0 || p->error_indicator) {
19178 PyMem_Free(_children);
19179 D(p->level--);
19180 return NULL;
19181 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019182 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019183 if (!_seq) {
19184 PyMem_Free(_children);
19185 p->error_indicator = 1;
19186 PyErr_NoMemory();
19187 D(p->level--);
19188 return NULL;
19189 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019190 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019191 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019192 _PyPegen_insert_memo(p, _start_mark, _loop1_61_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019193 D(p->level--);
19194 return _seq;
19195}
19196
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019197// _loop0_62: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019198static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019199_loop0_62_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019200{
19201 D(p->level++);
19202 if (p->error_indicator) {
19203 D(p->level--);
19204 return NULL;
19205 }
19206 void *_res = NULL;
19207 int _mark = p->mark;
19208 int _start_mark = p->mark;
19209 void **_children = PyMem_Malloc(sizeof(void *));
19210 if (!_children) {
19211 p->error_indicator = 1;
19212 PyErr_NoMemory();
19213 D(p->level--);
19214 return NULL;
19215 }
19216 ssize_t _children_capacity = 1;
19217 ssize_t _n = 0;
19218 { // param_no_default
19219 if (p->error_indicator) {
19220 D(p->level--);
19221 return NULL;
19222 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019223 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 +010019224 arg_ty param_no_default_var;
19225 while (
19226 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19227 )
19228 {
19229 _res = param_no_default_var;
19230 if (_n == _children_capacity) {
19231 _children_capacity *= 2;
19232 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19233 if (!_new_children) {
19234 p->error_indicator = 1;
19235 PyErr_NoMemory();
19236 D(p->level--);
19237 return NULL;
19238 }
19239 _children = _new_children;
19240 }
19241 _children[_n++] = _res;
19242 _mark = p->mark;
19243 }
19244 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019245 D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019246 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19247 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019248 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019249 if (!_seq) {
19250 PyMem_Free(_children);
19251 p->error_indicator = 1;
19252 PyErr_NoMemory();
19253 D(p->level--);
19254 return NULL;
19255 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019256 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019257 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019258 _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019259 D(p->level--);
19260 return _seq;
19261}
19262
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019263// _loop1_63: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019264static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019265_loop1_63_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019266{
19267 D(p->level++);
19268 if (p->error_indicator) {
19269 D(p->level--);
19270 return NULL;
19271 }
19272 void *_res = NULL;
19273 int _mark = p->mark;
19274 int _start_mark = p->mark;
19275 void **_children = PyMem_Malloc(sizeof(void *));
19276 if (!_children) {
19277 p->error_indicator = 1;
19278 PyErr_NoMemory();
19279 D(p->level--);
19280 return NULL;
19281 }
19282 ssize_t _children_capacity = 1;
19283 ssize_t _n = 0;
19284 { // param_with_default
19285 if (p->error_indicator) {
19286 D(p->level--);
19287 return NULL;
19288 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019289 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 +010019290 NameDefaultPair* param_with_default_var;
19291 while (
19292 (param_with_default_var = param_with_default_rule(p)) // param_with_default
19293 )
19294 {
19295 _res = param_with_default_var;
19296 if (_n == _children_capacity) {
19297 _children_capacity *= 2;
19298 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19299 if (!_new_children) {
19300 p->error_indicator = 1;
19301 PyErr_NoMemory();
19302 D(p->level--);
19303 return NULL;
19304 }
19305 _children = _new_children;
19306 }
19307 _children[_n++] = _res;
19308 _mark = p->mark;
19309 }
19310 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019311 D(fprintf(stderr, "%*c%s _loop1_63[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019312 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
19313 }
19314 if (_n == 0 || p->error_indicator) {
19315 PyMem_Free(_children);
19316 D(p->level--);
19317 return NULL;
19318 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019319 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019320 if (!_seq) {
19321 PyMem_Free(_children);
19322 p->error_indicator = 1;
19323 PyErr_NoMemory();
19324 D(p->level--);
19325 return NULL;
19326 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019327 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019328 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019329 _PyPegen_insert_memo(p, _start_mark, _loop1_63_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019330 D(p->level--);
19331 return _seq;
19332}
19333
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019334// _loop0_64: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019335static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019336_loop0_64_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019337{
19338 D(p->level++);
19339 if (p->error_indicator) {
19340 D(p->level--);
19341 return NULL;
19342 }
19343 void *_res = NULL;
19344 int _mark = p->mark;
19345 int _start_mark = p->mark;
19346 void **_children = PyMem_Malloc(sizeof(void *));
19347 if (!_children) {
19348 p->error_indicator = 1;
19349 PyErr_NoMemory();
19350 D(p->level--);
19351 return NULL;
19352 }
19353 ssize_t _children_capacity = 1;
19354 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019355 { // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019356 if (p->error_indicator) {
19357 D(p->level--);
19358 return NULL;
19359 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019360 D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19361 arg_ty param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019362 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019363 (param_no_default_var = param_no_default_rule(p)) // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019364 )
19365 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019366 _res = param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019367 if (_n == _children_capacity) {
19368 _children_capacity *= 2;
19369 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19370 if (!_new_children) {
19371 p->error_indicator = 1;
19372 PyErr_NoMemory();
19373 D(p->level--);
19374 return NULL;
19375 }
19376 _children = _new_children;
19377 }
19378 _children[_n++] = _res;
19379 _mark = p->mark;
19380 }
19381 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019382 D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ',
19383 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019384 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019385 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019386 if (!_seq) {
19387 PyMem_Free(_children);
19388 p->error_indicator = 1;
19389 PyErr_NoMemory();
19390 D(p->level--);
19391 return NULL;
19392 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019393 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019394 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019395 _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019396 D(p->level--);
19397 return _seq;
19398}
19399
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019400// _loop1_65: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019401static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019402_loop1_65_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019403{
19404 D(p->level++);
19405 if (p->error_indicator) {
19406 D(p->level--);
19407 return NULL;
19408 }
19409 void *_res = NULL;
19410 int _mark = p->mark;
19411 int _start_mark = p->mark;
19412 void **_children = PyMem_Malloc(sizeof(void *));
19413 if (!_children) {
19414 p->error_indicator = 1;
19415 PyErr_NoMemory();
19416 D(p->level--);
19417 return NULL;
19418 }
19419 ssize_t _children_capacity = 1;
19420 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019421 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019422 if (p->error_indicator) {
19423 D(p->level--);
19424 return NULL;
19425 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019426 D(fprintf(stderr, "%*c> _loop1_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
19427 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019428 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019429 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019430 )
19431 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019432 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019433 if (_n == _children_capacity) {
19434 _children_capacity *= 2;
19435 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19436 if (!_new_children) {
19437 p->error_indicator = 1;
19438 PyErr_NoMemory();
19439 D(p->level--);
19440 return NULL;
19441 }
19442 _children = _new_children;
19443 }
19444 _children[_n++] = _res;
19445 _mark = p->mark;
19446 }
19447 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019448 D(fprintf(stderr, "%*c%s _loop1_65[%d-%d]: %s failed!\n", p->level, ' ',
19449 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019450 }
19451 if (_n == 0 || p->error_indicator) {
19452 PyMem_Free(_children);
19453 D(p->level--);
19454 return NULL;
19455 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019456 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019457 if (!_seq) {
19458 PyMem_Free(_children);
19459 p->error_indicator = 1;
19460 PyErr_NoMemory();
19461 D(p->level--);
19462 return NULL;
19463 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019464 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019465 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019466 _PyPegen_insert_memo(p, _start_mark, _loop1_65_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019467 D(p->level--);
19468 return _seq;
19469}
19470
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019471// _loop0_66: param_maybe_default
19472static asdl_seq *
19473_loop0_66_rule(Parser *p)
19474{
19475 D(p->level++);
19476 if (p->error_indicator) {
19477 D(p->level--);
19478 return NULL;
19479 }
19480 void *_res = NULL;
19481 int _mark = p->mark;
19482 int _start_mark = p->mark;
19483 void **_children = PyMem_Malloc(sizeof(void *));
19484 if (!_children) {
19485 p->error_indicator = 1;
19486 PyErr_NoMemory();
19487 D(p->level--);
19488 return NULL;
19489 }
19490 ssize_t _children_capacity = 1;
19491 ssize_t _n = 0;
19492 { // param_maybe_default
19493 if (p->error_indicator) {
19494 D(p->level--);
19495 return NULL;
19496 }
19497 D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19498 NameDefaultPair* param_maybe_default_var;
19499 while (
19500 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19501 )
19502 {
19503 _res = param_maybe_default_var;
19504 if (_n == _children_capacity) {
19505 _children_capacity *= 2;
19506 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19507 if (!_new_children) {
19508 p->error_indicator = 1;
19509 PyErr_NoMemory();
19510 D(p->level--);
19511 return NULL;
19512 }
19513 _children = _new_children;
19514 }
19515 _children[_n++] = _res;
19516 _mark = p->mark;
19517 }
19518 p->mark = _mark;
19519 D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ',
19520 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19521 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019522 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019523 if (!_seq) {
19524 PyMem_Free(_children);
19525 p->error_indicator = 1;
19526 PyErr_NoMemory();
19527 D(p->level--);
19528 return NULL;
19529 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019530 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019531 PyMem_Free(_children);
19532 _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq);
19533 D(p->level--);
19534 return _seq;
19535}
19536
19537// _loop1_67: param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019538static asdl_seq *
19539_loop1_67_rule(Parser *p)
19540{
19541 D(p->level++);
19542 if (p->error_indicator) {
19543 D(p->level--);
19544 return NULL;
19545 }
19546 void *_res = NULL;
19547 int _mark = p->mark;
19548 int _start_mark = p->mark;
19549 void **_children = PyMem_Malloc(sizeof(void *));
19550 if (!_children) {
19551 p->error_indicator = 1;
19552 PyErr_NoMemory();
19553 D(p->level--);
19554 return NULL;
19555 }
19556 ssize_t _children_capacity = 1;
19557 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019558 { // param_maybe_default
19559 if (p->error_indicator) {
19560 D(p->level--);
19561 return NULL;
19562 }
19563 D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19564 NameDefaultPair* param_maybe_default_var;
19565 while (
19566 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19567 )
19568 {
19569 _res = param_maybe_default_var;
19570 if (_n == _children_capacity) {
19571 _children_capacity *= 2;
19572 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19573 if (!_new_children) {
19574 p->error_indicator = 1;
19575 PyErr_NoMemory();
19576 D(p->level--);
19577 return NULL;
19578 }
19579 _children = _new_children;
19580 }
19581 _children[_n++] = _res;
19582 _mark = p->mark;
19583 }
19584 p->mark = _mark;
19585 D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ',
19586 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19587 }
19588 if (_n == 0 || p->error_indicator) {
19589 PyMem_Free(_children);
19590 D(p->level--);
19591 return NULL;
19592 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019593 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019594 if (!_seq) {
19595 PyMem_Free(_children);
19596 p->error_indicator = 1;
19597 PyErr_NoMemory();
19598 D(p->level--);
19599 return NULL;
19600 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019601 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019602 PyMem_Free(_children);
19603 _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq);
19604 D(p->level--);
19605 return _seq;
19606}
19607
19608// _loop1_68: ('@' named_expression NEWLINE)
19609static asdl_seq *
19610_loop1_68_rule(Parser *p)
19611{
19612 D(p->level++);
19613 if (p->error_indicator) {
19614 D(p->level--);
19615 return NULL;
19616 }
19617 void *_res = NULL;
19618 int _mark = p->mark;
19619 int _start_mark = p->mark;
19620 void **_children = PyMem_Malloc(sizeof(void *));
19621 if (!_children) {
19622 p->error_indicator = 1;
19623 PyErr_NoMemory();
19624 D(p->level--);
19625 return NULL;
19626 }
19627 ssize_t _children_capacity = 1;
19628 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019629 { // ('@' named_expression NEWLINE)
19630 if (p->error_indicator) {
19631 D(p->level--);
19632 return NULL;
19633 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019634 D(fprintf(stderr, "%*c> _loop1_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019635 void *_tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019636 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019637 (_tmp_142_var = _tmp_142_rule(p)) // '@' named_expression NEWLINE
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019638 )
19639 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019640 _res = _tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019641 if (_n == _children_capacity) {
19642 _children_capacity *= 2;
19643 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19644 if (!_new_children) {
19645 p->error_indicator = 1;
19646 PyErr_NoMemory();
19647 D(p->level--);
19648 return NULL;
19649 }
19650 _children = _new_children;
19651 }
19652 _children[_n++] = _res;
19653 _mark = p->mark;
19654 }
19655 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019656 D(fprintf(stderr, "%*c%s _loop1_68[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019657 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
19658 }
19659 if (_n == 0 || p->error_indicator) {
19660 PyMem_Free(_children);
19661 D(p->level--);
19662 return NULL;
19663 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019664 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019665 if (!_seq) {
19666 PyMem_Free(_children);
19667 p->error_indicator = 1;
19668 PyErr_NoMemory();
19669 D(p->level--);
19670 return NULL;
19671 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019672 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019673 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019674 _PyPegen_insert_memo(p, _start_mark, _loop1_68_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019675 D(p->level--);
19676 return _seq;
19677}
19678
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019679// _tmp_69: '(' arguments? ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019680static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019681_tmp_69_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019682{
19683 D(p->level++);
19684 if (p->error_indicator) {
19685 D(p->level--);
19686 return NULL;
19687 }
19688 void * _res = NULL;
19689 int _mark = p->mark;
19690 { // '(' arguments? ')'
19691 if (p->error_indicator) {
19692 D(p->level--);
19693 return NULL;
19694 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019695 D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019696 Token * _literal;
19697 Token * _literal_1;
19698 void *z;
19699 if (
19700 (_literal = _PyPegen_expect_token(p, 7)) // token='('
19701 &&
19702 (z = arguments_rule(p), 1) // arguments?
19703 &&
19704 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
19705 )
19706 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019707 D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019708 _res = z;
19709 if (_res == NULL && PyErr_Occurred()) {
19710 p->error_indicator = 1;
19711 D(p->level--);
19712 return NULL;
19713 }
19714 goto done;
19715 }
19716 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019717 D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019718 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
19719 }
19720 _res = NULL;
19721 done:
19722 D(p->level--);
19723 return _res;
19724}
19725
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019726// _loop0_71: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019727static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019728_loop0_71_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019729{
19730 D(p->level++);
19731 if (p->error_indicator) {
19732 D(p->level--);
19733 return NULL;
19734 }
19735 void *_res = NULL;
19736 int _mark = p->mark;
19737 int _start_mark = p->mark;
19738 void **_children = PyMem_Malloc(sizeof(void *));
19739 if (!_children) {
19740 p->error_indicator = 1;
19741 PyErr_NoMemory();
19742 D(p->level--);
19743 return NULL;
19744 }
19745 ssize_t _children_capacity = 1;
19746 ssize_t _n = 0;
19747 { // ',' star_expression
19748 if (p->error_indicator) {
19749 D(p->level--);
19750 return NULL;
19751 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019752 D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019753 Token * _literal;
19754 expr_ty elem;
19755 while (
19756 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19757 &&
19758 (elem = star_expression_rule(p)) // star_expression
19759 )
19760 {
19761 _res = elem;
19762 if (_res == NULL && PyErr_Occurred()) {
19763 p->error_indicator = 1;
19764 PyMem_Free(_children);
19765 D(p->level--);
19766 return NULL;
19767 }
19768 if (_n == _children_capacity) {
19769 _children_capacity *= 2;
19770 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19771 if (!_new_children) {
19772 p->error_indicator = 1;
19773 PyErr_NoMemory();
19774 D(p->level--);
19775 return NULL;
19776 }
19777 _children = _new_children;
19778 }
19779 _children[_n++] = _res;
19780 _mark = p->mark;
19781 }
19782 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019783 D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019784 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
19785 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019786 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019787 if (!_seq) {
19788 PyMem_Free(_children);
19789 p->error_indicator = 1;
19790 PyErr_NoMemory();
19791 D(p->level--);
19792 return NULL;
19793 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019794 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019795 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019796 _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019797 D(p->level--);
19798 return _seq;
19799}
19800
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019801// _gather_70: star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019802static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019803_gather_70_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019804{
19805 D(p->level++);
19806 if (p->error_indicator) {
19807 D(p->level--);
19808 return NULL;
19809 }
19810 asdl_seq * _res = NULL;
19811 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019812 { // star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019813 if (p->error_indicator) {
19814 D(p->level--);
19815 return NULL;
19816 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019817 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 +010019818 expr_ty elem;
19819 asdl_seq * seq;
19820 if (
19821 (elem = star_expression_rule(p)) // star_expression
19822 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019823 (seq = _loop0_71_rule(p)) // _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019824 )
19825 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019826 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 +010019827 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19828 goto done;
19829 }
19830 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019831 D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ',
19832 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_71"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019833 }
19834 _res = NULL;
19835 done:
19836 D(p->level--);
19837 return _res;
19838}
19839
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019840// _loop1_72: (',' star_expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019841static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019842_loop1_72_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019843{
19844 D(p->level++);
19845 if (p->error_indicator) {
19846 D(p->level--);
19847 return NULL;
19848 }
19849 void *_res = NULL;
19850 int _mark = p->mark;
19851 int _start_mark = p->mark;
19852 void **_children = PyMem_Malloc(sizeof(void *));
19853 if (!_children) {
19854 p->error_indicator = 1;
19855 PyErr_NoMemory();
19856 D(p->level--);
19857 return NULL;
19858 }
19859 ssize_t _children_capacity = 1;
19860 ssize_t _n = 0;
19861 { // (',' star_expression)
19862 if (p->error_indicator) {
19863 D(p->level--);
19864 return NULL;
19865 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019866 D(fprintf(stderr, "%*c> _loop1_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019867 void *_tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019868 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019869 (_tmp_143_var = _tmp_143_rule(p)) // ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019870 )
19871 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019872 _res = _tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019873 if (_n == _children_capacity) {
19874 _children_capacity *= 2;
19875 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19876 if (!_new_children) {
19877 p->error_indicator = 1;
19878 PyErr_NoMemory();
19879 D(p->level--);
19880 return NULL;
19881 }
19882 _children = _new_children;
19883 }
19884 _children[_n++] = _res;
19885 _mark = p->mark;
19886 }
19887 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019888 D(fprintf(stderr, "%*c%s _loop1_72[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019889 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
19890 }
19891 if (_n == 0 || p->error_indicator) {
19892 PyMem_Free(_children);
19893 D(p->level--);
19894 return NULL;
19895 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019896 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019897 if (!_seq) {
19898 PyMem_Free(_children);
19899 p->error_indicator = 1;
19900 PyErr_NoMemory();
19901 D(p->level--);
19902 return NULL;
19903 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019904 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019905 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019906 _PyPegen_insert_memo(p, _start_mark, _loop1_72_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019907 D(p->level--);
19908 return _seq;
19909}
19910
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019911// _loop0_74: ',' star_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019912static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019913_loop0_74_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019914{
19915 D(p->level++);
19916 if (p->error_indicator) {
19917 D(p->level--);
19918 return NULL;
19919 }
19920 void *_res = NULL;
19921 int _mark = p->mark;
19922 int _start_mark = p->mark;
19923 void **_children = PyMem_Malloc(sizeof(void *));
19924 if (!_children) {
19925 p->error_indicator = 1;
19926 PyErr_NoMemory();
19927 D(p->level--);
19928 return NULL;
19929 }
19930 ssize_t _children_capacity = 1;
19931 ssize_t _n = 0;
19932 { // ',' star_named_expression
19933 if (p->error_indicator) {
19934 D(p->level--);
19935 return NULL;
19936 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019937 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 +010019938 Token * _literal;
19939 expr_ty elem;
19940 while (
19941 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19942 &&
19943 (elem = star_named_expression_rule(p)) // star_named_expression
19944 )
19945 {
19946 _res = elem;
19947 if (_res == NULL && PyErr_Occurred()) {
19948 p->error_indicator = 1;
19949 PyMem_Free(_children);
19950 D(p->level--);
19951 return NULL;
19952 }
19953 if (_n == _children_capacity) {
19954 _children_capacity *= 2;
19955 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19956 if (!_new_children) {
19957 p->error_indicator = 1;
19958 PyErr_NoMemory();
19959 D(p->level--);
19960 return NULL;
19961 }
19962 _children = _new_children;
19963 }
19964 _children[_n++] = _res;
19965 _mark = p->mark;
19966 }
19967 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019968 D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019969 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
19970 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019971 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019972 if (!_seq) {
19973 PyMem_Free(_children);
19974 p->error_indicator = 1;
19975 PyErr_NoMemory();
19976 D(p->level--);
19977 return NULL;
19978 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019979 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019980 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019981 _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019982 D(p->level--);
19983 return _seq;
19984}
19985
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019986// _gather_73: star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019987static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019988_gather_73_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019989{
19990 D(p->level++);
19991 if (p->error_indicator) {
19992 D(p->level--);
19993 return NULL;
19994 }
19995 asdl_seq * _res = NULL;
19996 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019997 { // star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019998 if (p->error_indicator) {
19999 D(p->level--);
20000 return NULL;
20001 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020002 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 +010020003 expr_ty elem;
20004 asdl_seq * seq;
20005 if (
20006 (elem = star_named_expression_rule(p)) // star_named_expression
20007 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020008 (seq = _loop0_74_rule(p)) // _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020009 )
20010 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020011 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 +010020012 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
20013 goto done;
20014 }
20015 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020016 D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ',
20017 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_74"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020018 }
20019 _res = NULL;
20020 done:
20021 D(p->level--);
20022 return _res;
20023}
20024
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020025// _loop1_75: (',' expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020026static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020027_loop1_75_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020028{
20029 D(p->level++);
20030 if (p->error_indicator) {
20031 D(p->level--);
20032 return NULL;
20033 }
20034 void *_res = NULL;
20035 int _mark = p->mark;
20036 int _start_mark = p->mark;
20037 void **_children = PyMem_Malloc(sizeof(void *));
20038 if (!_children) {
20039 p->error_indicator = 1;
20040 PyErr_NoMemory();
20041 D(p->level--);
20042 return NULL;
20043 }
20044 ssize_t _children_capacity = 1;
20045 ssize_t _n = 0;
20046 { // (',' expression)
20047 if (p->error_indicator) {
20048 D(p->level--);
20049 return NULL;
20050 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020051 D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010020052 void *_tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020053 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010020054 (_tmp_144_var = _tmp_144_rule(p)) // ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020055 )
20056 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010020057 _res = _tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020058 if (_n == _children_capacity) {
20059 _children_capacity *= 2;
20060 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20061 if (!_new_children) {
20062 p->error_indicator = 1;
20063 PyErr_NoMemory();
20064 D(p->level--);
20065 return NULL;
20066 }
20067 _children = _new_children;
20068 }
20069 _children[_n++] = _res;
20070 _mark = p->mark;
20071 }
20072 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020073 D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020074 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
20075 }
20076 if (_n == 0 || p->error_indicator) {
20077 PyMem_Free(_children);
20078 D(p->level--);
20079 return NULL;
20080 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020081 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020082 if (!_seq) {
20083 PyMem_Free(_children);
20084 p->error_indicator = 1;
20085 PyErr_NoMemory();
20086 D(p->level--);
20087 return NULL;
20088 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020089 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020090 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020091 _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020092 D(p->level--);
20093 return _seq;
20094}
20095
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020096// _loop0_76: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020097static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020098_loop0_76_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020099{
20100 D(p->level++);
20101 if (p->error_indicator) {
20102 D(p->level--);
20103 return NULL;
20104 }
20105 void *_res = NULL;
20106 int _mark = p->mark;
20107 int _start_mark = p->mark;
20108 void **_children = PyMem_Malloc(sizeof(void *));
20109 if (!_children) {
20110 p->error_indicator = 1;
20111 PyErr_NoMemory();
20112 D(p->level--);
20113 return NULL;
20114 }
20115 ssize_t _children_capacity = 1;
20116 ssize_t _n = 0;
20117 { // lambda_param_no_default
20118 if (p->error_indicator) {
20119 D(p->level--);
20120 return NULL;
20121 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020122 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 +010020123 arg_ty lambda_param_no_default_var;
20124 while (
20125 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20126 )
20127 {
20128 _res = lambda_param_no_default_var;
20129 if (_n == _children_capacity) {
20130 _children_capacity *= 2;
20131 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20132 if (!_new_children) {
20133 p->error_indicator = 1;
20134 PyErr_NoMemory();
20135 D(p->level--);
20136 return NULL;
20137 }
20138 _children = _new_children;
20139 }
20140 _children[_n++] = _res;
20141 _mark = p->mark;
20142 }
20143 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020144 D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020145 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020146 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020147 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020148 if (!_seq) {
20149 PyMem_Free(_children);
20150 p->error_indicator = 1;
20151 PyErr_NoMemory();
20152 D(p->level--);
20153 return NULL;
20154 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020155 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020156 PyMem_Free(_children);
20157 _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq);
20158 D(p->level--);
20159 return _seq;
20160}
20161
20162// _loop0_77: lambda_param_with_default
20163static asdl_seq *
20164_loop0_77_rule(Parser *p)
20165{
20166 D(p->level++);
20167 if (p->error_indicator) {
20168 D(p->level--);
20169 return NULL;
20170 }
20171 void *_res = NULL;
20172 int _mark = p->mark;
20173 int _start_mark = p->mark;
20174 void **_children = PyMem_Malloc(sizeof(void *));
20175 if (!_children) {
20176 p->error_indicator = 1;
20177 PyErr_NoMemory();
20178 D(p->level--);
20179 return NULL;
20180 }
20181 ssize_t _children_capacity = 1;
20182 ssize_t _n = 0;
20183 { // lambda_param_with_default
20184 if (p->error_indicator) {
20185 D(p->level--);
20186 return NULL;
20187 }
20188 D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20189 NameDefaultPair* lambda_param_with_default_var;
20190 while (
20191 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20192 )
20193 {
20194 _res = lambda_param_with_default_var;
20195 if (_n == _children_capacity) {
20196 _children_capacity *= 2;
20197 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20198 if (!_new_children) {
20199 p->error_indicator = 1;
20200 PyErr_NoMemory();
20201 D(p->level--);
20202 return NULL;
20203 }
20204 _children = _new_children;
20205 }
20206 _children[_n++] = _res;
20207 _mark = p->mark;
20208 }
20209 p->mark = _mark;
20210 D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ',
20211 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20212 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020213 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020214 if (!_seq) {
20215 PyMem_Free(_children);
20216 p->error_indicator = 1;
20217 PyErr_NoMemory();
20218 D(p->level--);
20219 return NULL;
20220 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020221 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020222 PyMem_Free(_children);
20223 _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq);
20224 D(p->level--);
20225 return _seq;
20226}
20227
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020228// _loop0_78: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020229static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020230_loop0_78_rule(Parser *p)
20231{
20232 D(p->level++);
20233 if (p->error_indicator) {
20234 D(p->level--);
20235 return NULL;
20236 }
20237 void *_res = NULL;
20238 int _mark = p->mark;
20239 int _start_mark = p->mark;
20240 void **_children = PyMem_Malloc(sizeof(void *));
20241 if (!_children) {
20242 p->error_indicator = 1;
20243 PyErr_NoMemory();
20244 D(p->level--);
20245 return NULL;
20246 }
20247 ssize_t _children_capacity = 1;
20248 ssize_t _n = 0;
20249 { // lambda_param_with_default
20250 if (p->error_indicator) {
20251 D(p->level--);
20252 return NULL;
20253 }
20254 D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20255 NameDefaultPair* lambda_param_with_default_var;
20256 while (
20257 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20258 )
20259 {
20260 _res = lambda_param_with_default_var;
20261 if (_n == _children_capacity) {
20262 _children_capacity *= 2;
20263 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20264 if (!_new_children) {
20265 p->error_indicator = 1;
20266 PyErr_NoMemory();
20267 D(p->level--);
20268 return NULL;
20269 }
20270 _children = _new_children;
20271 }
20272 _children[_n++] = _res;
20273 _mark = p->mark;
20274 }
20275 p->mark = _mark;
20276 D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
20277 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20278 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020279 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020280 if (!_seq) {
20281 PyMem_Free(_children);
20282 p->error_indicator = 1;
20283 PyErr_NoMemory();
20284 D(p->level--);
20285 return NULL;
20286 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020287 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020288 PyMem_Free(_children);
20289 _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
20290 D(p->level--);
20291 return _seq;
20292}
20293
20294// _loop1_79: lambda_param_no_default
20295static asdl_seq *
20296_loop1_79_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020297{
20298 D(p->level++);
20299 if (p->error_indicator) {
20300 D(p->level--);
20301 return NULL;
20302 }
20303 void *_res = NULL;
20304 int _mark = p->mark;
20305 int _start_mark = p->mark;
20306 void **_children = PyMem_Malloc(sizeof(void *));
20307 if (!_children) {
20308 p->error_indicator = 1;
20309 PyErr_NoMemory();
20310 D(p->level--);
20311 return NULL;
20312 }
20313 ssize_t _children_capacity = 1;
20314 ssize_t _n = 0;
20315 { // lambda_param_no_default
20316 if (p->error_indicator) {
20317 D(p->level--);
20318 return NULL;
20319 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020320 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 +010020321 arg_ty lambda_param_no_default_var;
20322 while (
20323 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20324 )
20325 {
20326 _res = lambda_param_no_default_var;
20327 if (_n == _children_capacity) {
20328 _children_capacity *= 2;
20329 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20330 if (!_new_children) {
20331 p->error_indicator = 1;
20332 PyErr_NoMemory();
20333 D(p->level--);
20334 return NULL;
20335 }
20336 _children = _new_children;
20337 }
20338 _children[_n++] = _res;
20339 _mark = p->mark;
20340 }
20341 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020342 D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020343 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20344 }
20345 if (_n == 0 || p->error_indicator) {
20346 PyMem_Free(_children);
20347 D(p->level--);
20348 return NULL;
20349 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020350 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020351 if (!_seq) {
20352 PyMem_Free(_children);
20353 p->error_indicator = 1;
20354 PyErr_NoMemory();
20355 D(p->level--);
20356 return NULL;
20357 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020358 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020359 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020360 _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020361 D(p->level--);
20362 return _seq;
20363}
20364
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020365// _loop0_80: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020366static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020367_loop0_80_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020368{
20369 D(p->level++);
20370 if (p->error_indicator) {
20371 D(p->level--);
20372 return NULL;
20373 }
20374 void *_res = NULL;
20375 int _mark = p->mark;
20376 int _start_mark = p->mark;
20377 void **_children = PyMem_Malloc(sizeof(void *));
20378 if (!_children) {
20379 p->error_indicator = 1;
20380 PyErr_NoMemory();
20381 D(p->level--);
20382 return NULL;
20383 }
20384 ssize_t _children_capacity = 1;
20385 ssize_t _n = 0;
20386 { // lambda_param_with_default
20387 if (p->error_indicator) {
20388 D(p->level--);
20389 return NULL;
20390 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020391 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 +010020392 NameDefaultPair* lambda_param_with_default_var;
20393 while (
20394 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20395 )
20396 {
20397 _res = lambda_param_with_default_var;
20398 if (_n == _children_capacity) {
20399 _children_capacity *= 2;
20400 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20401 if (!_new_children) {
20402 p->error_indicator = 1;
20403 PyErr_NoMemory();
20404 D(p->level--);
20405 return NULL;
20406 }
20407 _children = _new_children;
20408 }
20409 _children[_n++] = _res;
20410 _mark = p->mark;
20411 }
20412 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020413 D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020414 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20415 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020416 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020417 if (!_seq) {
20418 PyMem_Free(_children);
20419 p->error_indicator = 1;
20420 PyErr_NoMemory();
20421 D(p->level--);
20422 return NULL;
20423 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020424 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020425 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020426 _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020427 D(p->level--);
20428 return _seq;
20429}
20430
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020431// _loop1_81: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020432static asdl_seq *
20433_loop1_81_rule(Parser *p)
20434{
20435 D(p->level++);
20436 if (p->error_indicator) {
20437 D(p->level--);
20438 return NULL;
20439 }
20440 void *_res = NULL;
20441 int _mark = p->mark;
20442 int _start_mark = p->mark;
20443 void **_children = PyMem_Malloc(sizeof(void *));
20444 if (!_children) {
20445 p->error_indicator = 1;
20446 PyErr_NoMemory();
20447 D(p->level--);
20448 return NULL;
20449 }
20450 ssize_t _children_capacity = 1;
20451 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020452 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020453 if (p->error_indicator) {
20454 D(p->level--);
20455 return NULL;
20456 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020457 D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20458 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020459 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020460 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020461 )
20462 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020463 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020464 if (_n == _children_capacity) {
20465 _children_capacity *= 2;
20466 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20467 if (!_new_children) {
20468 p->error_indicator = 1;
20469 PyErr_NoMemory();
20470 D(p->level--);
20471 return NULL;
20472 }
20473 _children = _new_children;
20474 }
20475 _children[_n++] = _res;
20476 _mark = p->mark;
20477 }
20478 p->mark = _mark;
20479 D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020480 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020481 }
20482 if (_n == 0 || p->error_indicator) {
20483 PyMem_Free(_children);
20484 D(p->level--);
20485 return NULL;
20486 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020487 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020488 if (!_seq) {
20489 PyMem_Free(_children);
20490 p->error_indicator = 1;
20491 PyErr_NoMemory();
20492 D(p->level--);
20493 return NULL;
20494 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020495 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020496 PyMem_Free(_children);
20497 _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
20498 D(p->level--);
20499 return _seq;
20500}
20501
20502// _loop1_82: lambda_param_no_default
20503static asdl_seq *
20504_loop1_82_rule(Parser *p)
20505{
20506 D(p->level++);
20507 if (p->error_indicator) {
20508 D(p->level--);
20509 return NULL;
20510 }
20511 void *_res = NULL;
20512 int _mark = p->mark;
20513 int _start_mark = p->mark;
20514 void **_children = PyMem_Malloc(sizeof(void *));
20515 if (!_children) {
20516 p->error_indicator = 1;
20517 PyErr_NoMemory();
20518 D(p->level--);
20519 return NULL;
20520 }
20521 ssize_t _children_capacity = 1;
20522 ssize_t _n = 0;
20523 { // lambda_param_no_default
20524 if (p->error_indicator) {
20525 D(p->level--);
20526 return NULL;
20527 }
20528 D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20529 arg_ty lambda_param_no_default_var;
20530 while (
20531 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20532 )
20533 {
20534 _res = lambda_param_no_default_var;
20535 if (_n == _children_capacity) {
20536 _children_capacity *= 2;
20537 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20538 if (!_new_children) {
20539 p->error_indicator = 1;
20540 PyErr_NoMemory();
20541 D(p->level--);
20542 return NULL;
20543 }
20544 _children = _new_children;
20545 }
20546 _children[_n++] = _res;
20547 _mark = p->mark;
20548 }
20549 p->mark = _mark;
20550 D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ',
20551 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20552 }
20553 if (_n == 0 || p->error_indicator) {
20554 PyMem_Free(_children);
20555 D(p->level--);
20556 return NULL;
20557 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020558 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020559 if (!_seq) {
20560 PyMem_Free(_children);
20561 p->error_indicator = 1;
20562 PyErr_NoMemory();
20563 D(p->level--);
20564 return NULL;
20565 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020566 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020567 PyMem_Free(_children);
20568 _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq);
20569 D(p->level--);
20570 return _seq;
20571}
20572
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020573// _loop1_83: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020574static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020575_loop1_83_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020576{
20577 D(p->level++);
20578 if (p->error_indicator) {
20579 D(p->level--);
20580 return NULL;
20581 }
20582 void *_res = NULL;
20583 int _mark = p->mark;
20584 int _start_mark = p->mark;
20585 void **_children = PyMem_Malloc(sizeof(void *));
20586 if (!_children) {
20587 p->error_indicator = 1;
20588 PyErr_NoMemory();
20589 D(p->level--);
20590 return NULL;
20591 }
20592 ssize_t _children_capacity = 1;
20593 ssize_t _n = 0;
20594 { // lambda_param_no_default
20595 if (p->error_indicator) {
20596 D(p->level--);
20597 return NULL;
20598 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020599 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 +010020600 arg_ty lambda_param_no_default_var;
20601 while (
20602 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20603 )
20604 {
20605 _res = lambda_param_no_default_var;
20606 if (_n == _children_capacity) {
20607 _children_capacity *= 2;
20608 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20609 if (!_new_children) {
20610 p->error_indicator = 1;
20611 PyErr_NoMemory();
20612 D(p->level--);
20613 return NULL;
20614 }
20615 _children = _new_children;
20616 }
20617 _children[_n++] = _res;
20618 _mark = p->mark;
20619 }
20620 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020621 D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020622 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20623 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020624 if (_n == 0 || p->error_indicator) {
20625 PyMem_Free(_children);
20626 D(p->level--);
20627 return NULL;
20628 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020629 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020630 if (!_seq) {
20631 PyMem_Free(_children);
20632 p->error_indicator = 1;
20633 PyErr_NoMemory();
20634 D(p->level--);
20635 return NULL;
20636 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020637 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020638 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020639 _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020640 D(p->level--);
20641 return _seq;
20642}
20643
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020644// _loop0_84: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020645static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020646_loop0_84_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020647{
20648 D(p->level++);
20649 if (p->error_indicator) {
20650 D(p->level--);
20651 return NULL;
20652 }
20653 void *_res = NULL;
20654 int _mark = p->mark;
20655 int _start_mark = p->mark;
20656 void **_children = PyMem_Malloc(sizeof(void *));
20657 if (!_children) {
20658 p->error_indicator = 1;
20659 PyErr_NoMemory();
20660 D(p->level--);
20661 return NULL;
20662 }
20663 ssize_t _children_capacity = 1;
20664 ssize_t _n = 0;
20665 { // lambda_param_no_default
20666 if (p->error_indicator) {
20667 D(p->level--);
20668 return NULL;
20669 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020670 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 +010020671 arg_ty lambda_param_no_default_var;
20672 while (
20673 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20674 )
20675 {
20676 _res = lambda_param_no_default_var;
20677 if (_n == _children_capacity) {
20678 _children_capacity *= 2;
20679 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20680 if (!_new_children) {
20681 p->error_indicator = 1;
20682 PyErr_NoMemory();
20683 D(p->level--);
20684 return NULL;
20685 }
20686 _children = _new_children;
20687 }
20688 _children[_n++] = _res;
20689 _mark = p->mark;
20690 }
20691 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020692 D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020693 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20694 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020695 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020696 if (!_seq) {
20697 PyMem_Free(_children);
20698 p->error_indicator = 1;
20699 PyErr_NoMemory();
20700 D(p->level--);
20701 return NULL;
20702 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020703 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020704 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020705 _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020706 D(p->level--);
20707 return _seq;
20708}
20709
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020710// _loop1_85: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020711static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020712_loop1_85_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020713{
20714 D(p->level++);
20715 if (p->error_indicator) {
20716 D(p->level--);
20717 return NULL;
20718 }
20719 void *_res = NULL;
20720 int _mark = p->mark;
20721 int _start_mark = p->mark;
20722 void **_children = PyMem_Malloc(sizeof(void *));
20723 if (!_children) {
20724 p->error_indicator = 1;
20725 PyErr_NoMemory();
20726 D(p->level--);
20727 return NULL;
20728 }
20729 ssize_t _children_capacity = 1;
20730 ssize_t _n = 0;
20731 { // lambda_param_with_default
20732 if (p->error_indicator) {
20733 D(p->level--);
20734 return NULL;
20735 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020736 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 +010020737 NameDefaultPair* lambda_param_with_default_var;
20738 while (
20739 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20740 )
20741 {
20742 _res = lambda_param_with_default_var;
20743 if (_n == _children_capacity) {
20744 _children_capacity *= 2;
20745 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20746 if (!_new_children) {
20747 p->error_indicator = 1;
20748 PyErr_NoMemory();
20749 D(p->level--);
20750 return NULL;
20751 }
20752 _children = _new_children;
20753 }
20754 _children[_n++] = _res;
20755 _mark = p->mark;
20756 }
20757 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020758 D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020759 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20760 }
20761 if (_n == 0 || p->error_indicator) {
20762 PyMem_Free(_children);
20763 D(p->level--);
20764 return NULL;
20765 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020766 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020767 if (!_seq) {
20768 PyMem_Free(_children);
20769 p->error_indicator = 1;
20770 PyErr_NoMemory();
20771 D(p->level--);
20772 return NULL;
20773 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020774 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020775 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020776 _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020777 D(p->level--);
20778 return _seq;
20779}
20780
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020781// _loop0_86: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020782static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020783_loop0_86_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020784{
20785 D(p->level++);
20786 if (p->error_indicator) {
20787 D(p->level--);
20788 return NULL;
20789 }
20790 void *_res = NULL;
20791 int _mark = p->mark;
20792 int _start_mark = p->mark;
20793 void **_children = PyMem_Malloc(sizeof(void *));
20794 if (!_children) {
20795 p->error_indicator = 1;
20796 PyErr_NoMemory();
20797 D(p->level--);
20798 return NULL;
20799 }
20800 ssize_t _children_capacity = 1;
20801 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020802 { // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020803 if (p->error_indicator) {
20804 D(p->level--);
20805 return NULL;
20806 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020807 D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20808 arg_ty lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020809 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020810 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020811 )
20812 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020813 _res = lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020814 if (_n == _children_capacity) {
20815 _children_capacity *= 2;
20816 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20817 if (!_new_children) {
20818 p->error_indicator = 1;
20819 PyErr_NoMemory();
20820 D(p->level--);
20821 return NULL;
20822 }
20823 _children = _new_children;
20824 }
20825 _children[_n++] = _res;
20826 _mark = p->mark;
20827 }
20828 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020829 D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
20830 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020831 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020832 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020833 if (!_seq) {
20834 PyMem_Free(_children);
20835 p->error_indicator = 1;
20836 PyErr_NoMemory();
20837 D(p->level--);
20838 return NULL;
20839 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020840 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020841 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020842 _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020843 D(p->level--);
20844 return _seq;
20845}
20846
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020847// _loop1_87: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020848static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020849_loop1_87_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020850{
20851 D(p->level++);
20852 if (p->error_indicator) {
20853 D(p->level--);
20854 return NULL;
20855 }
20856 void *_res = NULL;
20857 int _mark = p->mark;
20858 int _start_mark = p->mark;
20859 void **_children = PyMem_Malloc(sizeof(void *));
20860 if (!_children) {
20861 p->error_indicator = 1;
20862 PyErr_NoMemory();
20863 D(p->level--);
20864 return NULL;
20865 }
20866 ssize_t _children_capacity = 1;
20867 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020868 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020869 if (p->error_indicator) {
20870 D(p->level--);
20871 return NULL;
20872 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020873 D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20874 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020875 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020876 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020877 )
20878 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020879 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020880 if (_n == _children_capacity) {
20881 _children_capacity *= 2;
20882 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20883 if (!_new_children) {
20884 p->error_indicator = 1;
20885 PyErr_NoMemory();
20886 D(p->level--);
20887 return NULL;
20888 }
20889 _children = _new_children;
20890 }
20891 _children[_n++] = _res;
20892 _mark = p->mark;
20893 }
20894 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020895 D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ',
20896 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020897 }
20898 if (_n == 0 || p->error_indicator) {
20899 PyMem_Free(_children);
20900 D(p->level--);
20901 return NULL;
20902 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020903 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020904 if (!_seq) {
20905 PyMem_Free(_children);
20906 p->error_indicator = 1;
20907 PyErr_NoMemory();
20908 D(p->level--);
20909 return NULL;
20910 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020911 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020912 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020913 _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020914 D(p->level--);
20915 return _seq;
20916}
20917
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020918// _loop0_88: lambda_param_maybe_default
20919static asdl_seq *
20920_loop0_88_rule(Parser *p)
20921{
20922 D(p->level++);
20923 if (p->error_indicator) {
20924 D(p->level--);
20925 return NULL;
20926 }
20927 void *_res = NULL;
20928 int _mark = p->mark;
20929 int _start_mark = p->mark;
20930 void **_children = PyMem_Malloc(sizeof(void *));
20931 if (!_children) {
20932 p->error_indicator = 1;
20933 PyErr_NoMemory();
20934 D(p->level--);
20935 return NULL;
20936 }
20937 ssize_t _children_capacity = 1;
20938 ssize_t _n = 0;
20939 { // lambda_param_maybe_default
20940 if (p->error_indicator) {
20941 D(p->level--);
20942 return NULL;
20943 }
20944 D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20945 NameDefaultPair* lambda_param_maybe_default_var;
20946 while (
20947 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20948 )
20949 {
20950 _res = lambda_param_maybe_default_var;
20951 if (_n == _children_capacity) {
20952 _children_capacity *= 2;
20953 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20954 if (!_new_children) {
20955 p->error_indicator = 1;
20956 PyErr_NoMemory();
20957 D(p->level--);
20958 return NULL;
20959 }
20960 _children = _new_children;
20961 }
20962 _children[_n++] = _res;
20963 _mark = p->mark;
20964 }
20965 p->mark = _mark;
20966 D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ',
20967 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20968 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020969 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020970 if (!_seq) {
20971 PyMem_Free(_children);
20972 p->error_indicator = 1;
20973 PyErr_NoMemory();
20974 D(p->level--);
20975 return NULL;
20976 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020977 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020978 PyMem_Free(_children);
20979 _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq);
20980 D(p->level--);
20981 return _seq;
20982}
20983
20984// _loop1_89: lambda_param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020985static asdl_seq *
20986_loop1_89_rule(Parser *p)
20987{
20988 D(p->level++);
20989 if (p->error_indicator) {
20990 D(p->level--);
20991 return NULL;
20992 }
20993 void *_res = NULL;
20994 int _mark = p->mark;
20995 int _start_mark = p->mark;
20996 void **_children = PyMem_Malloc(sizeof(void *));
20997 if (!_children) {
20998 p->error_indicator = 1;
20999 PyErr_NoMemory();
21000 D(p->level--);
21001 return NULL;
21002 }
21003 ssize_t _children_capacity = 1;
21004 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021005 { // lambda_param_maybe_default
21006 if (p->error_indicator) {
21007 D(p->level--);
21008 return NULL;
21009 }
21010 D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
21011 NameDefaultPair* lambda_param_maybe_default_var;
21012 while (
21013 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
21014 )
21015 {
21016 _res = lambda_param_maybe_default_var;
21017 if (_n == _children_capacity) {
21018 _children_capacity *= 2;
21019 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21020 if (!_new_children) {
21021 p->error_indicator = 1;
21022 PyErr_NoMemory();
21023 D(p->level--);
21024 return NULL;
21025 }
21026 _children = _new_children;
21027 }
21028 _children[_n++] = _res;
21029 _mark = p->mark;
21030 }
21031 p->mark = _mark;
21032 D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ',
21033 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
21034 }
21035 if (_n == 0 || p->error_indicator) {
21036 PyMem_Free(_children);
21037 D(p->level--);
21038 return NULL;
21039 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021040 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021041 if (!_seq) {
21042 PyMem_Free(_children);
21043 p->error_indicator = 1;
21044 PyErr_NoMemory();
21045 D(p->level--);
21046 return NULL;
21047 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021048 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021049 PyMem_Free(_children);
21050 _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
21051 D(p->level--);
21052 return _seq;
21053}
21054
21055// _loop1_90: ('or' conjunction)
21056static asdl_seq *
21057_loop1_90_rule(Parser *p)
21058{
21059 D(p->level++);
21060 if (p->error_indicator) {
21061 D(p->level--);
21062 return NULL;
21063 }
21064 void *_res = NULL;
21065 int _mark = p->mark;
21066 int _start_mark = p->mark;
21067 void **_children = PyMem_Malloc(sizeof(void *));
21068 if (!_children) {
21069 p->error_indicator = 1;
21070 PyErr_NoMemory();
21071 D(p->level--);
21072 return NULL;
21073 }
21074 ssize_t _children_capacity = 1;
21075 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021076 { // ('or' conjunction)
21077 if (p->error_indicator) {
21078 D(p->level--);
21079 return NULL;
21080 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021081 D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021082 void *_tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021083 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021084 (_tmp_145_var = _tmp_145_rule(p)) // 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021085 )
21086 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021087 _res = _tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021088 if (_n == _children_capacity) {
21089 _children_capacity *= 2;
21090 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21091 if (!_new_children) {
21092 p->error_indicator = 1;
21093 PyErr_NoMemory();
21094 D(p->level--);
21095 return NULL;
21096 }
21097 _children = _new_children;
21098 }
21099 _children[_n++] = _res;
21100 _mark = p->mark;
21101 }
21102 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021103 D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021104 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
21105 }
21106 if (_n == 0 || p->error_indicator) {
21107 PyMem_Free(_children);
21108 D(p->level--);
21109 return NULL;
21110 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021111 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021112 if (!_seq) {
21113 PyMem_Free(_children);
21114 p->error_indicator = 1;
21115 PyErr_NoMemory();
21116 D(p->level--);
21117 return NULL;
21118 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021119 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021120 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021121 _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021122 D(p->level--);
21123 return _seq;
21124}
21125
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021126// _loop1_91: ('and' inversion)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021127static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021128_loop1_91_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021129{
21130 D(p->level++);
21131 if (p->error_indicator) {
21132 D(p->level--);
21133 return NULL;
21134 }
21135 void *_res = NULL;
21136 int _mark = p->mark;
21137 int _start_mark = p->mark;
21138 void **_children = PyMem_Malloc(sizeof(void *));
21139 if (!_children) {
21140 p->error_indicator = 1;
21141 PyErr_NoMemory();
21142 D(p->level--);
21143 return NULL;
21144 }
21145 ssize_t _children_capacity = 1;
21146 ssize_t _n = 0;
21147 { // ('and' inversion)
21148 if (p->error_indicator) {
21149 D(p->level--);
21150 return NULL;
21151 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021152 D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021153 void *_tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021154 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021155 (_tmp_146_var = _tmp_146_rule(p)) // 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021156 )
21157 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021158 _res = _tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021159 if (_n == _children_capacity) {
21160 _children_capacity *= 2;
21161 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21162 if (!_new_children) {
21163 p->error_indicator = 1;
21164 PyErr_NoMemory();
21165 D(p->level--);
21166 return NULL;
21167 }
21168 _children = _new_children;
21169 }
21170 _children[_n++] = _res;
21171 _mark = p->mark;
21172 }
21173 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021174 D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021175 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
21176 }
21177 if (_n == 0 || p->error_indicator) {
21178 PyMem_Free(_children);
21179 D(p->level--);
21180 return NULL;
21181 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021182 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021183 if (!_seq) {
21184 PyMem_Free(_children);
21185 p->error_indicator = 1;
21186 PyErr_NoMemory();
21187 D(p->level--);
21188 return NULL;
21189 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021190 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021191 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021192 _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021193 D(p->level--);
21194 return _seq;
21195}
21196
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021197// _loop1_92: compare_op_bitwise_or_pair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021198static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021199_loop1_92_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021200{
21201 D(p->level++);
21202 if (p->error_indicator) {
21203 D(p->level--);
21204 return NULL;
21205 }
21206 void *_res = NULL;
21207 int _mark = p->mark;
21208 int _start_mark = p->mark;
21209 void **_children = PyMem_Malloc(sizeof(void *));
21210 if (!_children) {
21211 p->error_indicator = 1;
21212 PyErr_NoMemory();
21213 D(p->level--);
21214 return NULL;
21215 }
21216 ssize_t _children_capacity = 1;
21217 ssize_t _n = 0;
21218 { // compare_op_bitwise_or_pair
21219 if (p->error_indicator) {
21220 D(p->level--);
21221 return NULL;
21222 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021223 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 +010021224 CmpopExprPair* compare_op_bitwise_or_pair_var;
21225 while (
21226 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
21227 )
21228 {
21229 _res = compare_op_bitwise_or_pair_var;
21230 if (_n == _children_capacity) {
21231 _children_capacity *= 2;
21232 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21233 if (!_new_children) {
21234 p->error_indicator = 1;
21235 PyErr_NoMemory();
21236 D(p->level--);
21237 return NULL;
21238 }
21239 _children = _new_children;
21240 }
21241 _children[_n++] = _res;
21242 _mark = p->mark;
21243 }
21244 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021245 D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021246 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
21247 }
21248 if (_n == 0 || p->error_indicator) {
21249 PyMem_Free(_children);
21250 D(p->level--);
21251 return NULL;
21252 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021253 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021254 if (!_seq) {
21255 PyMem_Free(_children);
21256 p->error_indicator = 1;
21257 PyErr_NoMemory();
21258 D(p->level--);
21259 return NULL;
21260 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021261 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021262 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021263 _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021264 D(p->level--);
21265 return _seq;
21266}
21267
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021268// _tmp_93: '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021269static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021270_tmp_93_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021271{
21272 D(p->level++);
21273 if (p->error_indicator) {
21274 D(p->level--);
21275 return NULL;
21276 }
21277 void * _res = NULL;
21278 int _mark = p->mark;
21279 { // '!='
21280 if (p->error_indicator) {
21281 D(p->level--);
21282 return NULL;
21283 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021284 D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021285 Token * tok;
21286 if (
21287 (tok = _PyPegen_expect_token(p, 28)) // token='!='
21288 )
21289 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021290 D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo06f8c332020-10-30 23:48:42 +000021291 _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021292 if (_res == NULL && PyErr_Occurred()) {
21293 p->error_indicator = 1;
21294 D(p->level--);
21295 return NULL;
21296 }
21297 goto done;
21298 }
21299 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021300 D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021301 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
21302 }
21303 _res = NULL;
21304 done:
21305 D(p->level--);
21306 return _res;
21307}
21308
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021309// _loop0_95: ',' slice
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021310static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021311_loop0_95_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021312{
21313 D(p->level++);
21314 if (p->error_indicator) {
21315 D(p->level--);
21316 return NULL;
21317 }
21318 void *_res = NULL;
21319 int _mark = p->mark;
21320 int _start_mark = p->mark;
21321 void **_children = PyMem_Malloc(sizeof(void *));
21322 if (!_children) {
21323 p->error_indicator = 1;
21324 PyErr_NoMemory();
21325 D(p->level--);
21326 return NULL;
21327 }
21328 ssize_t _children_capacity = 1;
21329 ssize_t _n = 0;
21330 { // ',' slice
21331 if (p->error_indicator) {
21332 D(p->level--);
21333 return NULL;
21334 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021335 D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021336 Token * _literal;
21337 expr_ty elem;
21338 while (
21339 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21340 &&
21341 (elem = slice_rule(p)) // slice
21342 )
21343 {
21344 _res = elem;
21345 if (_res == NULL && PyErr_Occurred()) {
21346 p->error_indicator = 1;
21347 PyMem_Free(_children);
21348 D(p->level--);
21349 return NULL;
21350 }
21351 if (_n == _children_capacity) {
21352 _children_capacity *= 2;
21353 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21354 if (!_new_children) {
21355 p->error_indicator = 1;
21356 PyErr_NoMemory();
21357 D(p->level--);
21358 return NULL;
21359 }
21360 _children = _new_children;
21361 }
21362 _children[_n++] = _res;
21363 _mark = p->mark;
21364 }
21365 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021366 D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021367 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
21368 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021369 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021370 if (!_seq) {
21371 PyMem_Free(_children);
21372 p->error_indicator = 1;
21373 PyErr_NoMemory();
21374 D(p->level--);
21375 return NULL;
21376 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021377 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021378 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021379 _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021380 D(p->level--);
21381 return _seq;
21382}
21383
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021384// _gather_94: slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021385static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021386_gather_94_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021387{
21388 D(p->level++);
21389 if (p->error_indicator) {
21390 D(p->level--);
21391 return NULL;
21392 }
21393 asdl_seq * _res = NULL;
21394 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021395 { // slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021396 if (p->error_indicator) {
21397 D(p->level--);
21398 return NULL;
21399 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021400 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 +010021401 expr_ty elem;
21402 asdl_seq * seq;
21403 if (
21404 (elem = slice_rule(p)) // slice
21405 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021406 (seq = _loop0_95_rule(p)) // _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021407 )
21408 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021409 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 +010021410 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21411 goto done;
21412 }
21413 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021414 D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ',
21415 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_95"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021416 }
21417 _res = NULL;
21418 done:
21419 D(p->level--);
21420 return _res;
21421}
21422
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021423// _tmp_96: ':' expression?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021424static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021425_tmp_96_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021426{
21427 D(p->level++);
21428 if (p->error_indicator) {
21429 D(p->level--);
21430 return NULL;
21431 }
21432 void * _res = NULL;
21433 int _mark = p->mark;
21434 { // ':' expression?
21435 if (p->error_indicator) {
21436 D(p->level--);
21437 return NULL;
21438 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021439 D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021440 Token * _literal;
21441 void *d;
21442 if (
21443 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
21444 &&
21445 (d = expression_rule(p), 1) // expression?
21446 )
21447 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021448 D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021449 _res = d;
21450 if (_res == NULL && PyErr_Occurred()) {
21451 p->error_indicator = 1;
21452 D(p->level--);
21453 return NULL;
21454 }
21455 goto done;
21456 }
21457 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021458 D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021459 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
21460 }
21461 _res = NULL;
21462 done:
21463 D(p->level--);
21464 return _res;
21465}
21466
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021467// _tmp_97: tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021468static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021469_tmp_97_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021470{
21471 D(p->level++);
21472 if (p->error_indicator) {
21473 D(p->level--);
21474 return NULL;
21475 }
21476 void * _res = NULL;
21477 int _mark = p->mark;
21478 { // tuple
21479 if (p->error_indicator) {
21480 D(p->level--);
21481 return NULL;
21482 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021483 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021484 expr_ty tuple_var;
21485 if (
21486 (tuple_var = tuple_rule(p)) // tuple
21487 )
21488 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021489 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021490 _res = tuple_var;
21491 goto done;
21492 }
21493 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021494 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021495 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
21496 }
21497 { // group
21498 if (p->error_indicator) {
21499 D(p->level--);
21500 return NULL;
21501 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021502 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021503 expr_ty group_var;
21504 if (
21505 (group_var = group_rule(p)) // group
21506 )
21507 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021508 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021509 _res = group_var;
21510 goto done;
21511 }
21512 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021513 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021514 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
21515 }
21516 { // genexp
21517 if (p->error_indicator) {
21518 D(p->level--);
21519 return NULL;
21520 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021521 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021522 expr_ty genexp_var;
21523 if (
21524 (genexp_var = genexp_rule(p)) // genexp
21525 )
21526 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021527 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021528 _res = genexp_var;
21529 goto done;
21530 }
21531 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021532 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021533 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
21534 }
21535 _res = NULL;
21536 done:
21537 D(p->level--);
21538 return _res;
21539}
21540
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021541// _tmp_98: list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021542static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021543_tmp_98_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021544{
21545 D(p->level++);
21546 if (p->error_indicator) {
21547 D(p->level--);
21548 return NULL;
21549 }
21550 void * _res = NULL;
21551 int _mark = p->mark;
21552 { // list
21553 if (p->error_indicator) {
21554 D(p->level--);
21555 return NULL;
21556 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021557 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021558 expr_ty list_var;
21559 if (
21560 (list_var = list_rule(p)) // list
21561 )
21562 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021563 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021564 _res = list_var;
21565 goto done;
21566 }
21567 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021568 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021569 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
21570 }
21571 { // listcomp
21572 if (p->error_indicator) {
21573 D(p->level--);
21574 return NULL;
21575 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021576 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021577 expr_ty listcomp_var;
21578 if (
21579 (listcomp_var = listcomp_rule(p)) // listcomp
21580 )
21581 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021582 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021583 _res = listcomp_var;
21584 goto done;
21585 }
21586 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021587 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021588 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
21589 }
21590 _res = NULL;
21591 done:
21592 D(p->level--);
21593 return _res;
21594}
21595
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021596// _tmp_99: dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021597static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021598_tmp_99_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021599{
21600 D(p->level++);
21601 if (p->error_indicator) {
21602 D(p->level--);
21603 return NULL;
21604 }
21605 void * _res = NULL;
21606 int _mark = p->mark;
21607 { // dict
21608 if (p->error_indicator) {
21609 D(p->level--);
21610 return NULL;
21611 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021612 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021613 expr_ty dict_var;
21614 if (
21615 (dict_var = dict_rule(p)) // dict
21616 )
21617 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021618 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021619 _res = dict_var;
21620 goto done;
21621 }
21622 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021623 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021624 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
21625 }
21626 { // set
21627 if (p->error_indicator) {
21628 D(p->level--);
21629 return NULL;
21630 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021631 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021632 expr_ty set_var;
21633 if (
21634 (set_var = set_rule(p)) // set
21635 )
21636 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021637 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021638 _res = set_var;
21639 goto done;
21640 }
21641 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021642 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021643 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
21644 }
21645 { // dictcomp
21646 if (p->error_indicator) {
21647 D(p->level--);
21648 return NULL;
21649 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021650 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021651 expr_ty dictcomp_var;
21652 if (
21653 (dictcomp_var = dictcomp_rule(p)) // dictcomp
21654 )
21655 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021656 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021657 _res = dictcomp_var;
21658 goto done;
21659 }
21660 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021661 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021662 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
21663 }
21664 { // setcomp
21665 if (p->error_indicator) {
21666 D(p->level--);
21667 return NULL;
21668 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021669 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021670 expr_ty setcomp_var;
21671 if (
21672 (setcomp_var = setcomp_rule(p)) // setcomp
21673 )
21674 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021675 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021676 _res = setcomp_var;
21677 goto done;
21678 }
21679 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021680 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021681 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
21682 }
21683 _res = NULL;
21684 done:
21685 D(p->level--);
21686 return _res;
21687}
21688
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021689// _loop1_100: STRING
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021690static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021691_loop1_100_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021692{
21693 D(p->level++);
21694 if (p->error_indicator) {
21695 D(p->level--);
21696 return NULL;
21697 }
21698 void *_res = NULL;
21699 int _mark = p->mark;
21700 int _start_mark = p->mark;
21701 void **_children = PyMem_Malloc(sizeof(void *));
21702 if (!_children) {
21703 p->error_indicator = 1;
21704 PyErr_NoMemory();
21705 D(p->level--);
21706 return NULL;
21707 }
21708 ssize_t _children_capacity = 1;
21709 ssize_t _n = 0;
21710 { // STRING
21711 if (p->error_indicator) {
21712 D(p->level--);
21713 return NULL;
21714 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021715 D(fprintf(stderr, "%*c> _loop1_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021716 expr_ty string_var;
21717 while (
21718 (string_var = _PyPegen_string_token(p)) // STRING
21719 )
21720 {
21721 _res = string_var;
21722 if (_n == _children_capacity) {
21723 _children_capacity *= 2;
21724 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21725 if (!_new_children) {
21726 p->error_indicator = 1;
21727 PyErr_NoMemory();
21728 D(p->level--);
21729 return NULL;
21730 }
21731 _children = _new_children;
21732 }
21733 _children[_n++] = _res;
21734 _mark = p->mark;
21735 }
21736 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021737 D(fprintf(stderr, "%*c%s _loop1_100[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021738 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
21739 }
21740 if (_n == 0 || p->error_indicator) {
21741 PyMem_Free(_children);
21742 D(p->level--);
21743 return NULL;
21744 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021745 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021746 if (!_seq) {
21747 PyMem_Free(_children);
21748 p->error_indicator = 1;
21749 PyErr_NoMemory();
21750 D(p->level--);
21751 return NULL;
21752 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021753 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021754 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021755 _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021756 D(p->level--);
21757 return _seq;
21758}
21759
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021760// _tmp_101: star_named_expression ',' star_named_expressions?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021761static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021762_tmp_101_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021763{
21764 D(p->level++);
21765 if (p->error_indicator) {
21766 D(p->level--);
21767 return NULL;
21768 }
21769 void * _res = NULL;
21770 int _mark = p->mark;
21771 { // star_named_expression ',' star_named_expressions?
21772 if (p->error_indicator) {
21773 D(p->level--);
21774 return NULL;
21775 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021776 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 +010021777 Token * _literal;
21778 expr_ty y;
21779 void *z;
21780 if (
21781 (y = star_named_expression_rule(p)) // star_named_expression
21782 &&
21783 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21784 &&
21785 (z = star_named_expressions_rule(p), 1) // star_named_expressions?
21786 )
21787 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021788 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 +010021789 _res = _PyPegen_seq_insert_in_front ( p , y , z );
21790 if (_res == NULL && PyErr_Occurred()) {
21791 p->error_indicator = 1;
21792 D(p->level--);
21793 return NULL;
21794 }
21795 goto done;
21796 }
21797 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021798 D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021799 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
21800 }
21801 _res = NULL;
21802 done:
21803 D(p->level--);
21804 return _res;
21805}
21806
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021807// _tmp_102: yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021808static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021809_tmp_102_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021810{
21811 D(p->level++);
21812 if (p->error_indicator) {
21813 D(p->level--);
21814 return NULL;
21815 }
21816 void * _res = NULL;
21817 int _mark = p->mark;
21818 { // yield_expr
21819 if (p->error_indicator) {
21820 D(p->level--);
21821 return NULL;
21822 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021823 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021824 expr_ty yield_expr_var;
21825 if (
21826 (yield_expr_var = yield_expr_rule(p)) // yield_expr
21827 )
21828 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021829 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 +010021830 _res = yield_expr_var;
21831 goto done;
21832 }
21833 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021834 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021835 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
21836 }
21837 { // named_expression
21838 if (p->error_indicator) {
21839 D(p->level--);
21840 return NULL;
21841 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021842 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021843 expr_ty named_expression_var;
21844 if (
21845 (named_expression_var = named_expression_rule(p)) // named_expression
21846 )
21847 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021848 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 +010021849 _res = named_expression_var;
21850 goto done;
21851 }
21852 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021853 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021854 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
21855 }
21856 _res = NULL;
21857 done:
21858 D(p->level--);
21859 return _res;
21860}
21861
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021862// _loop0_104: ',' double_starred_kvpair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021863static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021864_loop0_104_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021865{
21866 D(p->level++);
21867 if (p->error_indicator) {
21868 D(p->level--);
21869 return NULL;
21870 }
21871 void *_res = NULL;
21872 int _mark = p->mark;
21873 int _start_mark = p->mark;
21874 void **_children = PyMem_Malloc(sizeof(void *));
21875 if (!_children) {
21876 p->error_indicator = 1;
21877 PyErr_NoMemory();
21878 D(p->level--);
21879 return NULL;
21880 }
21881 ssize_t _children_capacity = 1;
21882 ssize_t _n = 0;
21883 { // ',' double_starred_kvpair
21884 if (p->error_indicator) {
21885 D(p->level--);
21886 return NULL;
21887 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021888 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 +010021889 Token * _literal;
21890 KeyValuePair* elem;
21891 while (
21892 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21893 &&
21894 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21895 )
21896 {
21897 _res = elem;
21898 if (_res == NULL && PyErr_Occurred()) {
21899 p->error_indicator = 1;
21900 PyMem_Free(_children);
21901 D(p->level--);
21902 return NULL;
21903 }
21904 if (_n == _children_capacity) {
21905 _children_capacity *= 2;
21906 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21907 if (!_new_children) {
21908 p->error_indicator = 1;
21909 PyErr_NoMemory();
21910 D(p->level--);
21911 return NULL;
21912 }
21913 _children = _new_children;
21914 }
21915 _children[_n++] = _res;
21916 _mark = p->mark;
21917 }
21918 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021919 D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021920 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
21921 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021922 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021923 if (!_seq) {
21924 PyMem_Free(_children);
21925 p->error_indicator = 1;
21926 PyErr_NoMemory();
21927 D(p->level--);
21928 return NULL;
21929 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021930 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021931 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021932 _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021933 D(p->level--);
21934 return _seq;
21935}
21936
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021937// _gather_103: double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021938static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021939_gather_103_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021940{
21941 D(p->level++);
21942 if (p->error_indicator) {
21943 D(p->level--);
21944 return NULL;
21945 }
21946 asdl_seq * _res = NULL;
21947 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021948 { // double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021949 if (p->error_indicator) {
21950 D(p->level--);
21951 return NULL;
21952 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021953 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 +010021954 KeyValuePair* elem;
21955 asdl_seq * seq;
21956 if (
21957 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21958 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021959 (seq = _loop0_104_rule(p)) // _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021960 )
21961 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021962 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 +010021963 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21964 goto done;
21965 }
21966 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021967 D(fprintf(stderr, "%*c%s _gather_103[%d-%d]: %s failed!\n", p->level, ' ',
21968 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_104"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021969 }
21970 _res = NULL;
21971 done:
21972 D(p->level--);
21973 return _res;
21974}
21975
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021976// _loop1_105: for_if_clause
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021977static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021978_loop1_105_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021979{
21980 D(p->level++);
21981 if (p->error_indicator) {
21982 D(p->level--);
21983 return NULL;
21984 }
21985 void *_res = NULL;
21986 int _mark = p->mark;
21987 int _start_mark = p->mark;
21988 void **_children = PyMem_Malloc(sizeof(void *));
21989 if (!_children) {
21990 p->error_indicator = 1;
21991 PyErr_NoMemory();
21992 D(p->level--);
21993 return NULL;
21994 }
21995 ssize_t _children_capacity = 1;
21996 ssize_t _n = 0;
21997 { // for_if_clause
21998 if (p->error_indicator) {
21999 D(p->level--);
22000 return NULL;
22001 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022002 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 +010022003 comprehension_ty for_if_clause_var;
22004 while (
22005 (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
22006 )
22007 {
22008 _res = for_if_clause_var;
22009 if (_n == _children_capacity) {
22010 _children_capacity *= 2;
22011 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22012 if (!_new_children) {
22013 p->error_indicator = 1;
22014 PyErr_NoMemory();
22015 D(p->level--);
22016 return NULL;
22017 }
22018 _children = _new_children;
22019 }
22020 _children[_n++] = _res;
22021 _mark = p->mark;
22022 }
22023 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022024 D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022025 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
22026 }
22027 if (_n == 0 || p->error_indicator) {
22028 PyMem_Free(_children);
22029 D(p->level--);
22030 return NULL;
22031 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022032 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022033 if (!_seq) {
22034 PyMem_Free(_children);
22035 p->error_indicator = 1;
22036 PyErr_NoMemory();
22037 D(p->level--);
22038 return NULL;
22039 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022040 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022041 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022042 _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022043 D(p->level--);
22044 return _seq;
22045}
22046
22047// _loop0_106: ('if' disjunction)
22048static asdl_seq *
22049_loop0_106_rule(Parser *p)
22050{
22051 D(p->level++);
22052 if (p->error_indicator) {
22053 D(p->level--);
22054 return NULL;
22055 }
22056 void *_res = NULL;
22057 int _mark = p->mark;
22058 int _start_mark = p->mark;
22059 void **_children = PyMem_Malloc(sizeof(void *));
22060 if (!_children) {
22061 p->error_indicator = 1;
22062 PyErr_NoMemory();
22063 D(p->level--);
22064 return NULL;
22065 }
22066 ssize_t _children_capacity = 1;
22067 ssize_t _n = 0;
22068 { // ('if' disjunction)
22069 if (p->error_indicator) {
22070 D(p->level--);
22071 return NULL;
22072 }
22073 D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010022074 void *_tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022075 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022076 (_tmp_147_var = _tmp_147_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022077 )
22078 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022079 _res = _tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022080 if (_n == _children_capacity) {
22081 _children_capacity *= 2;
22082 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22083 if (!_new_children) {
22084 p->error_indicator = 1;
22085 PyErr_NoMemory();
22086 D(p->level--);
22087 return NULL;
22088 }
22089 _children = _new_children;
22090 }
22091 _children[_n++] = _res;
22092 _mark = p->mark;
22093 }
22094 p->mark = _mark;
22095 D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ',
22096 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
22097 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022098 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022099 if (!_seq) {
22100 PyMem_Free(_children);
22101 p->error_indicator = 1;
22102 PyErr_NoMemory();
22103 D(p->level--);
22104 return NULL;
22105 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022106 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022107 PyMem_Free(_children);
22108 _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq);
22109 D(p->level--);
22110 return _seq;
22111}
22112
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022113// _loop0_107: ('if' disjunction)
22114static asdl_seq *
22115_loop0_107_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022116{
22117 D(p->level++);
22118 if (p->error_indicator) {
22119 D(p->level--);
22120 return NULL;
22121 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022122 void *_res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022123 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022124 int _start_mark = p->mark;
22125 void **_children = PyMem_Malloc(sizeof(void *));
22126 if (!_children) {
22127 p->error_indicator = 1;
22128 PyErr_NoMemory();
22129 D(p->level--);
22130 return NULL;
22131 }
22132 ssize_t _children_capacity = 1;
22133 ssize_t _n = 0;
22134 { // ('if' disjunction)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022135 if (p->error_indicator) {
22136 D(p->level--);
22137 return NULL;
22138 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022139 D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010022140 void *_tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022141 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022142 (_tmp_148_var = _tmp_148_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022143 )
22144 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022145 _res = _tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022146 if (_n == _children_capacity) {
22147 _children_capacity *= 2;
22148 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22149 if (!_new_children) {
22150 p->error_indicator = 1;
22151 PyErr_NoMemory();
22152 D(p->level--);
22153 return NULL;
22154 }
22155 _children = _new_children;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022156 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022157 _children[_n++] = _res;
22158 _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022159 }
22160 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022161 D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ',
22162 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022163 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022164 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022165 if (!_seq) {
22166 PyMem_Free(_children);
22167 p->error_indicator = 1;
22168 PyErr_NoMemory();
22169 D(p->level--);
22170 return NULL;
22171 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022172 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022173 PyMem_Free(_children);
22174 _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022175 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022176 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022177}
22178
Pablo Galindo4a97b152020-09-02 17:44:19 +010022179// _loop0_109: ',' (starred_expression | named_expression !'=')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022180static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022181_loop0_109_rule(Parser *p)
22182{
22183 D(p->level++);
22184 if (p->error_indicator) {
22185 D(p->level--);
22186 return NULL;
22187 }
22188 void *_res = NULL;
22189 int _mark = p->mark;
22190 int _start_mark = p->mark;
22191 void **_children = PyMem_Malloc(sizeof(void *));
22192 if (!_children) {
22193 p->error_indicator = 1;
22194 PyErr_NoMemory();
22195 D(p->level--);
22196 return NULL;
22197 }
22198 ssize_t _children_capacity = 1;
22199 ssize_t _n = 0;
22200 { // ',' (starred_expression | named_expression !'=')
22201 if (p->error_indicator) {
22202 D(p->level--);
22203 return NULL;
22204 }
22205 D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22206 Token * _literal;
22207 void *elem;
22208 while (
22209 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22210 &&
22211 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22212 )
22213 {
22214 _res = elem;
22215 if (_res == NULL && PyErr_Occurred()) {
22216 p->error_indicator = 1;
22217 PyMem_Free(_children);
22218 D(p->level--);
22219 return NULL;
22220 }
22221 if (_n == _children_capacity) {
22222 _children_capacity *= 2;
22223 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22224 if (!_new_children) {
22225 p->error_indicator = 1;
22226 PyErr_NoMemory();
22227 D(p->level--);
22228 return NULL;
22229 }
22230 _children = _new_children;
22231 }
22232 _children[_n++] = _res;
22233 _mark = p->mark;
22234 }
22235 p->mark = _mark;
22236 D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ',
22237 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22238 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022239 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022240 if (!_seq) {
22241 PyMem_Free(_children);
22242 p->error_indicator = 1;
22243 PyErr_NoMemory();
22244 D(p->level--);
22245 return NULL;
22246 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022247 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022248 PyMem_Free(_children);
22249 _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq);
22250 D(p->level--);
22251 return _seq;
22252}
22253
22254// _gather_108: (starred_expression | named_expression !'=') _loop0_109
22255static asdl_seq *
22256_gather_108_rule(Parser *p)
22257{
22258 D(p->level++);
22259 if (p->error_indicator) {
22260 D(p->level--);
22261 return NULL;
22262 }
22263 asdl_seq * _res = NULL;
22264 int _mark = p->mark;
22265 { // (starred_expression | named_expression !'=') _loop0_109
22266 if (p->error_indicator) {
22267 D(p->level--);
22268 return NULL;
22269 }
22270 D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22271 void *elem;
22272 asdl_seq * seq;
22273 if (
22274 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22275 &&
22276 (seq = _loop0_109_rule(p)) // _loop0_109
22277 )
22278 {
22279 D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22280 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22281 goto done;
22282 }
22283 p->mark = _mark;
22284 D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n", p->level, ' ',
22285 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22286 }
22287 _res = NULL;
22288 done:
22289 D(p->level--);
22290 return _res;
22291}
22292
22293// _tmp_110: ',' kwargs
22294static void *
22295_tmp_110_rule(Parser *p)
22296{
22297 D(p->level++);
22298 if (p->error_indicator) {
22299 D(p->level--);
22300 return NULL;
22301 }
22302 void * _res = NULL;
22303 int _mark = p->mark;
22304 { // ',' kwargs
22305 if (p->error_indicator) {
22306 D(p->level--);
22307 return NULL;
22308 }
22309 D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22310 Token * _literal;
22311 asdl_seq* k;
22312 if (
22313 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22314 &&
22315 (k = kwargs_rule(p)) // kwargs
22316 )
22317 {
22318 D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22319 _res = k;
22320 if (_res == NULL && PyErr_Occurred()) {
22321 p->error_indicator = 1;
22322 D(p->level--);
22323 return NULL;
22324 }
22325 goto done;
22326 }
22327 p->mark = _mark;
22328 D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ',
22329 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
22330 }
22331 _res = NULL;
22332 done:
22333 D(p->level--);
22334 return _res;
22335}
22336
22337// _loop0_112: ',' kwarg_or_starred
22338static asdl_seq *
22339_loop0_112_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022340{
22341 D(p->level++);
22342 if (p->error_indicator) {
22343 D(p->level--);
22344 return NULL;
22345 }
22346 void *_res = NULL;
22347 int _mark = p->mark;
22348 int _start_mark = p->mark;
22349 void **_children = PyMem_Malloc(sizeof(void *));
22350 if (!_children) {
22351 p->error_indicator = 1;
22352 PyErr_NoMemory();
22353 D(p->level--);
22354 return NULL;
22355 }
22356 ssize_t _children_capacity = 1;
22357 ssize_t _n = 0;
22358 { // ',' kwarg_or_starred
22359 if (p->error_indicator) {
22360 D(p->level--);
22361 return NULL;
22362 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022363 D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022364 Token * _literal;
22365 KeywordOrStarred* elem;
22366 while (
22367 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22368 &&
22369 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22370 )
22371 {
22372 _res = elem;
22373 if (_res == NULL && PyErr_Occurred()) {
22374 p->error_indicator = 1;
22375 PyMem_Free(_children);
22376 D(p->level--);
22377 return NULL;
22378 }
22379 if (_n == _children_capacity) {
22380 _children_capacity *= 2;
22381 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22382 if (!_new_children) {
22383 p->error_indicator = 1;
22384 PyErr_NoMemory();
22385 D(p->level--);
22386 return NULL;
22387 }
22388 _children = _new_children;
22389 }
22390 _children[_n++] = _res;
22391 _mark = p->mark;
22392 }
22393 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022394 D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022395 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22396 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022397 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022398 if (!_seq) {
22399 PyMem_Free(_children);
22400 p->error_indicator = 1;
22401 PyErr_NoMemory();
22402 D(p->level--);
22403 return NULL;
22404 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022405 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022406 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022407 _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022408 D(p->level--);
22409 return _seq;
22410}
22411
Pablo Galindo4a97b152020-09-02 17:44:19 +010022412// _gather_111: kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022413static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022414_gather_111_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022415{
22416 D(p->level++);
22417 if (p->error_indicator) {
22418 D(p->level--);
22419 return NULL;
22420 }
22421 asdl_seq * _res = NULL;
22422 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022423 { // kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022424 if (p->error_indicator) {
22425 D(p->level--);
22426 return NULL;
22427 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022428 D(fprintf(stderr, "%*c> _gather_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_112"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022429 KeywordOrStarred* elem;
22430 asdl_seq * seq;
22431 if (
22432 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22433 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022434 (seq = _loop0_112_rule(p)) // _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022435 )
22436 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022437 D(fprintf(stderr, "%*c+ _gather_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_112"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022438 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22439 goto done;
22440 }
22441 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022442 D(fprintf(stderr, "%*c%s _gather_111[%d-%d]: %s failed!\n", p->level, ' ',
22443 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_112"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022444 }
22445 _res = NULL;
22446 done:
22447 D(p->level--);
22448 return _res;
22449}
22450
Pablo Galindo4a97b152020-09-02 17:44:19 +010022451// _loop0_114: ',' kwarg_or_double_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022452static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022453_loop0_114_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022454{
22455 D(p->level++);
22456 if (p->error_indicator) {
22457 D(p->level--);
22458 return NULL;
22459 }
22460 void *_res = NULL;
22461 int _mark = p->mark;
22462 int _start_mark = p->mark;
22463 void **_children = PyMem_Malloc(sizeof(void *));
22464 if (!_children) {
22465 p->error_indicator = 1;
22466 PyErr_NoMemory();
22467 D(p->level--);
22468 return NULL;
22469 }
22470 ssize_t _children_capacity = 1;
22471 ssize_t _n = 0;
22472 { // ',' kwarg_or_double_starred
22473 if (p->error_indicator) {
22474 D(p->level--);
22475 return NULL;
22476 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022477 D(fprintf(stderr, "%*c> _loop0_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022478 Token * _literal;
22479 KeywordOrStarred* elem;
22480 while (
22481 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22482 &&
22483 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22484 )
22485 {
22486 _res = elem;
22487 if (_res == NULL && PyErr_Occurred()) {
22488 p->error_indicator = 1;
22489 PyMem_Free(_children);
22490 D(p->level--);
22491 return NULL;
22492 }
22493 if (_n == _children_capacity) {
22494 _children_capacity *= 2;
22495 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22496 if (!_new_children) {
22497 p->error_indicator = 1;
22498 PyErr_NoMemory();
22499 D(p->level--);
22500 return NULL;
22501 }
22502 _children = _new_children;
22503 }
22504 _children[_n++] = _res;
22505 _mark = p->mark;
22506 }
22507 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022508 D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022509 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22510 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022511 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022512 if (!_seq) {
22513 PyMem_Free(_children);
22514 p->error_indicator = 1;
22515 PyErr_NoMemory();
22516 D(p->level--);
22517 return NULL;
22518 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022519 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022520 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022521 _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022522 D(p->level--);
22523 return _seq;
22524}
22525
Pablo Galindo4a97b152020-09-02 17:44:19 +010022526// _gather_113: kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022527static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022528_gather_113_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022529{
22530 D(p->level++);
22531 if (p->error_indicator) {
22532 D(p->level--);
22533 return NULL;
22534 }
22535 asdl_seq * _res = NULL;
22536 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022537 { // kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022538 if (p->error_indicator) {
22539 D(p->level--);
22540 return NULL;
22541 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022542 D(fprintf(stderr, "%*c> _gather_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_114"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022543 KeywordOrStarred* elem;
22544 asdl_seq * seq;
22545 if (
22546 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22547 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022548 (seq = _loop0_114_rule(p)) // _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022549 )
22550 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022551 D(fprintf(stderr, "%*c+ _gather_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_114"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022552 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22553 goto done;
22554 }
22555 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022556 D(fprintf(stderr, "%*c%s _gather_113[%d-%d]: %s failed!\n", p->level, ' ',
22557 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_114"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022558 }
22559 _res = NULL;
22560 done:
22561 D(p->level--);
22562 return _res;
22563}
22564
Pablo Galindo4a97b152020-09-02 17:44:19 +010022565// _loop0_116: ',' kwarg_or_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022566static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022567_loop0_116_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022568{
22569 D(p->level++);
22570 if (p->error_indicator) {
22571 D(p->level--);
22572 return NULL;
22573 }
22574 void *_res = NULL;
22575 int _mark = p->mark;
22576 int _start_mark = p->mark;
22577 void **_children = PyMem_Malloc(sizeof(void *));
22578 if (!_children) {
22579 p->error_indicator = 1;
22580 PyErr_NoMemory();
22581 D(p->level--);
22582 return NULL;
22583 }
22584 ssize_t _children_capacity = 1;
22585 ssize_t _n = 0;
22586 { // ',' kwarg_or_starred
22587 if (p->error_indicator) {
22588 D(p->level--);
22589 return NULL;
22590 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022591 D(fprintf(stderr, "%*c> _loop0_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022592 Token * _literal;
22593 KeywordOrStarred* elem;
22594 while (
22595 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22596 &&
22597 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22598 )
22599 {
22600 _res = elem;
22601 if (_res == NULL && PyErr_Occurred()) {
22602 p->error_indicator = 1;
22603 PyMem_Free(_children);
22604 D(p->level--);
22605 return NULL;
22606 }
22607 if (_n == _children_capacity) {
22608 _children_capacity *= 2;
22609 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22610 if (!_new_children) {
22611 p->error_indicator = 1;
22612 PyErr_NoMemory();
22613 D(p->level--);
22614 return NULL;
22615 }
22616 _children = _new_children;
22617 }
22618 _children[_n++] = _res;
22619 _mark = p->mark;
22620 }
22621 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022622 D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022623 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22624 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022625 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022626 if (!_seq) {
22627 PyMem_Free(_children);
22628 p->error_indicator = 1;
22629 PyErr_NoMemory();
22630 D(p->level--);
22631 return NULL;
22632 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022633 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022634 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022635 _PyPegen_insert_memo(p, _start_mark, _loop0_116_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022636 D(p->level--);
22637 return _seq;
22638}
22639
Pablo Galindo4a97b152020-09-02 17:44:19 +010022640// _gather_115: kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022641static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022642_gather_115_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022643{
22644 D(p->level++);
22645 if (p->error_indicator) {
22646 D(p->level--);
22647 return NULL;
22648 }
22649 asdl_seq * _res = NULL;
22650 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022651 { // kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022652 if (p->error_indicator) {
22653 D(p->level--);
22654 return NULL;
22655 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022656 D(fprintf(stderr, "%*c> _gather_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_116"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022657 KeywordOrStarred* elem;
22658 asdl_seq * seq;
22659 if (
22660 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22661 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022662 (seq = _loop0_116_rule(p)) // _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022663 )
22664 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022665 D(fprintf(stderr, "%*c+ _gather_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_116"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022666 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22667 goto done;
22668 }
22669 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022670 D(fprintf(stderr, "%*c%s _gather_115[%d-%d]: %s failed!\n", p->level, ' ',
22671 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_116"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022672 }
22673 _res = NULL;
22674 done:
22675 D(p->level--);
22676 return _res;
22677}
22678
Pablo Galindo4a97b152020-09-02 17:44:19 +010022679// _loop0_118: ',' kwarg_or_double_starred
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022680static asdl_seq *
22681_loop0_118_rule(Parser *p)
22682{
22683 D(p->level++);
22684 if (p->error_indicator) {
22685 D(p->level--);
22686 return NULL;
22687 }
22688 void *_res = NULL;
22689 int _mark = p->mark;
22690 int _start_mark = p->mark;
22691 void **_children = PyMem_Malloc(sizeof(void *));
22692 if (!_children) {
22693 p->error_indicator = 1;
22694 PyErr_NoMemory();
22695 D(p->level--);
22696 return NULL;
22697 }
22698 ssize_t _children_capacity = 1;
22699 ssize_t _n = 0;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022700 { // ',' kwarg_or_double_starred
22701 if (p->error_indicator) {
22702 D(p->level--);
22703 return NULL;
22704 }
22705 D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
22706 Token * _literal;
22707 KeywordOrStarred* elem;
22708 while (
22709 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22710 &&
22711 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22712 )
22713 {
22714 _res = elem;
22715 if (_res == NULL && PyErr_Occurred()) {
22716 p->error_indicator = 1;
22717 PyMem_Free(_children);
22718 D(p->level--);
22719 return NULL;
22720 }
22721 if (_n == _children_capacity) {
22722 _children_capacity *= 2;
22723 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22724 if (!_new_children) {
22725 p->error_indicator = 1;
22726 PyErr_NoMemory();
22727 D(p->level--);
22728 return NULL;
22729 }
22730 _children = _new_children;
22731 }
22732 _children[_n++] = _res;
22733 _mark = p->mark;
22734 }
22735 p->mark = _mark;
22736 D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ',
22737 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22738 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022739 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022740 if (!_seq) {
22741 PyMem_Free(_children);
22742 p->error_indicator = 1;
22743 PyErr_NoMemory();
22744 D(p->level--);
22745 return NULL;
22746 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022747 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022748 PyMem_Free(_children);
22749 _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq);
22750 D(p->level--);
22751 return _seq;
22752}
22753
22754// _gather_117: kwarg_or_double_starred _loop0_118
22755static asdl_seq *
22756_gather_117_rule(Parser *p)
22757{
22758 D(p->level++);
22759 if (p->error_indicator) {
22760 D(p->level--);
22761 return NULL;
22762 }
22763 asdl_seq * _res = NULL;
22764 int _mark = p->mark;
22765 { // kwarg_or_double_starred _loop0_118
22766 if (p->error_indicator) {
22767 D(p->level--);
22768 return NULL;
22769 }
22770 D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22771 KeywordOrStarred* elem;
22772 asdl_seq * seq;
22773 if (
22774 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22775 &&
22776 (seq = _loop0_118_rule(p)) // _loop0_118
22777 )
22778 {
22779 D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22780 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22781 goto done;
22782 }
22783 p->mark = _mark;
22784 D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ',
22785 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22786 }
22787 _res = NULL;
22788 done:
22789 D(p->level--);
22790 return _res;
22791}
22792
22793// _loop0_119: (',' star_target)
22794static asdl_seq *
22795_loop0_119_rule(Parser *p)
22796{
22797 D(p->level++);
22798 if (p->error_indicator) {
22799 D(p->level--);
22800 return NULL;
22801 }
22802 void *_res = NULL;
22803 int _mark = p->mark;
22804 int _start_mark = p->mark;
22805 void **_children = PyMem_Malloc(sizeof(void *));
22806 if (!_children) {
22807 p->error_indicator = 1;
22808 PyErr_NoMemory();
22809 D(p->level--);
22810 return NULL;
22811 }
22812 ssize_t _children_capacity = 1;
22813 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022814 { // (',' star_target)
22815 if (p->error_indicator) {
22816 D(p->level--);
22817 return NULL;
22818 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022819 D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
22820 void *_tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022821 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022822 (_tmp_150_var = _tmp_150_rule(p)) // ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022823 )
22824 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022825 _res = _tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022826 if (_n == _children_capacity) {
22827 _children_capacity *= 2;
22828 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22829 if (!_new_children) {
22830 p->error_indicator = 1;
22831 PyErr_NoMemory();
22832 D(p->level--);
22833 return NULL;
22834 }
22835 _children = _new_children;
22836 }
22837 _children[_n++] = _res;
22838 _mark = p->mark;
22839 }
22840 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022841 D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022842 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
22843 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022844 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022845 if (!_seq) {
22846 PyMem_Free(_children);
22847 p->error_indicator = 1;
22848 PyErr_NoMemory();
22849 D(p->level--);
22850 return NULL;
22851 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022852 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022853 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022854 _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022855 D(p->level--);
22856 return _seq;
22857}
22858
Pablo Galindo4a97b152020-09-02 17:44:19 +010022859// _loop0_121: ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022860static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022861_loop0_121_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022862{
22863 D(p->level++);
22864 if (p->error_indicator) {
22865 D(p->level--);
22866 return NULL;
22867 }
22868 void *_res = NULL;
22869 int _mark = p->mark;
22870 int _start_mark = p->mark;
22871 void **_children = PyMem_Malloc(sizeof(void *));
22872 if (!_children) {
22873 p->error_indicator = 1;
22874 PyErr_NoMemory();
22875 D(p->level--);
22876 return NULL;
22877 }
22878 ssize_t _children_capacity = 1;
22879 ssize_t _n = 0;
22880 { // ',' star_target
22881 if (p->error_indicator) {
22882 D(p->level--);
22883 return NULL;
22884 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022885 D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022886 Token * _literal;
22887 expr_ty elem;
22888 while (
22889 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22890 &&
22891 (elem = star_target_rule(p)) // star_target
22892 )
22893 {
22894 _res = elem;
22895 if (_res == NULL && PyErr_Occurred()) {
22896 p->error_indicator = 1;
22897 PyMem_Free(_children);
22898 D(p->level--);
22899 return NULL;
22900 }
22901 if (_n == _children_capacity) {
22902 _children_capacity *= 2;
22903 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22904 if (!_new_children) {
22905 p->error_indicator = 1;
22906 PyErr_NoMemory();
22907 D(p->level--);
22908 return NULL;
22909 }
22910 _children = _new_children;
22911 }
22912 _children[_n++] = _res;
22913 _mark = p->mark;
22914 }
22915 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022916 D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022917 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
22918 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022919 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022920 if (!_seq) {
22921 PyMem_Free(_children);
22922 p->error_indicator = 1;
22923 PyErr_NoMemory();
22924 D(p->level--);
22925 return NULL;
22926 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022927 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022928 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022929 _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022930 D(p->level--);
22931 return _seq;
22932}
22933
Pablo Galindo4a97b152020-09-02 17:44:19 +010022934// _gather_120: star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022935static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022936_gather_120_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022937{
22938 D(p->level++);
22939 if (p->error_indicator) {
22940 D(p->level--);
22941 return NULL;
22942 }
22943 asdl_seq * _res = NULL;
22944 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022945 { // star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022946 if (p->error_indicator) {
22947 D(p->level--);
22948 return NULL;
22949 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022950 D(fprintf(stderr, "%*c> _gather_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_121"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022951 expr_ty elem;
22952 asdl_seq * seq;
22953 if (
22954 (elem = star_target_rule(p)) // star_target
22955 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022956 (seq = _loop0_121_rule(p)) // _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022957 )
22958 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022959 D(fprintf(stderr, "%*c+ _gather_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_121"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022960 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22961 goto done;
22962 }
22963 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022964 D(fprintf(stderr, "%*c%s _gather_120[%d-%d]: %s failed!\n", p->level, ' ',
22965 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_121"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022966 }
22967 _res = NULL;
22968 done:
22969 D(p->level--);
22970 return _res;
22971}
22972
Pablo Galindo4a97b152020-09-02 17:44:19 +010022973// _tmp_122: !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022974static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022975_tmp_122_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022976{
22977 D(p->level++);
22978 if (p->error_indicator) {
22979 D(p->level--);
22980 return NULL;
22981 }
22982 void * _res = NULL;
22983 int _mark = p->mark;
22984 { // !'*' star_target
22985 if (p->error_indicator) {
22986 D(p->level--);
22987 return NULL;
22988 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022989 D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022990 expr_ty star_target_var;
22991 if (
22992 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
22993 &&
22994 (star_target_var = star_target_rule(p)) // star_target
22995 )
22996 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022997 D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022998 _res = star_target_var;
22999 goto done;
23000 }
23001 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023002 D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023003 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
23004 }
23005 _res = NULL;
23006 done:
23007 D(p->level--);
23008 return _res;
23009}
23010
Pablo Galindo4a97b152020-09-02 17:44:19 +010023011// _loop0_124: ',' del_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023012static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023013_loop0_124_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023014{
23015 D(p->level++);
23016 if (p->error_indicator) {
23017 D(p->level--);
23018 return NULL;
23019 }
23020 void *_res = NULL;
23021 int _mark = p->mark;
23022 int _start_mark = p->mark;
23023 void **_children = PyMem_Malloc(sizeof(void *));
23024 if (!_children) {
23025 p->error_indicator = 1;
23026 PyErr_NoMemory();
23027 D(p->level--);
23028 return NULL;
23029 }
23030 ssize_t _children_capacity = 1;
23031 ssize_t _n = 0;
23032 { // ',' del_target
23033 if (p->error_indicator) {
23034 D(p->level--);
23035 return NULL;
23036 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023037 D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023038 Token * _literal;
23039 expr_ty elem;
23040 while (
23041 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23042 &&
23043 (elem = del_target_rule(p)) // del_target
23044 )
23045 {
23046 _res = elem;
23047 if (_res == NULL && PyErr_Occurred()) {
23048 p->error_indicator = 1;
23049 PyMem_Free(_children);
23050 D(p->level--);
23051 return NULL;
23052 }
23053 if (_n == _children_capacity) {
23054 _children_capacity *= 2;
23055 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23056 if (!_new_children) {
23057 p->error_indicator = 1;
23058 PyErr_NoMemory();
23059 D(p->level--);
23060 return NULL;
23061 }
23062 _children = _new_children;
23063 }
23064 _children[_n++] = _res;
23065 _mark = p->mark;
23066 }
23067 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023068 D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023069 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
23070 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023071 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023072 if (!_seq) {
23073 PyMem_Free(_children);
23074 p->error_indicator = 1;
23075 PyErr_NoMemory();
23076 D(p->level--);
23077 return NULL;
23078 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023079 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023080 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023081 _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023082 D(p->level--);
23083 return _seq;
23084}
23085
Pablo Galindo4a97b152020-09-02 17:44:19 +010023086// _gather_123: del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023087static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023088_gather_123_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023089{
23090 D(p->level++);
23091 if (p->error_indicator) {
23092 D(p->level--);
23093 return NULL;
23094 }
23095 asdl_seq * _res = NULL;
23096 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023097 { // del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023098 if (p->error_indicator) {
23099 D(p->level--);
23100 return NULL;
23101 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023102 D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_124"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023103 expr_ty elem;
23104 asdl_seq * seq;
23105 if (
23106 (elem = del_target_rule(p)) // del_target
23107 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023108 (seq = _loop0_124_rule(p)) // _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023109 )
23110 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023111 D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_124"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023112 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23113 goto done;
23114 }
23115 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023116 D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ',
23117 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_124"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023118 }
23119 _res = NULL;
23120 done:
23121 D(p->level--);
23122 return _res;
23123}
23124
Pablo Galindo4a97b152020-09-02 17:44:19 +010023125// _loop0_126: ',' target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023126static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023127_loop0_126_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023128{
23129 D(p->level++);
23130 if (p->error_indicator) {
23131 D(p->level--);
23132 return NULL;
23133 }
23134 void *_res = NULL;
23135 int _mark = p->mark;
23136 int _start_mark = p->mark;
23137 void **_children = PyMem_Malloc(sizeof(void *));
23138 if (!_children) {
23139 p->error_indicator = 1;
23140 PyErr_NoMemory();
23141 D(p->level--);
23142 return NULL;
23143 }
23144 ssize_t _children_capacity = 1;
23145 ssize_t _n = 0;
23146 { // ',' target
23147 if (p->error_indicator) {
23148 D(p->level--);
23149 return NULL;
23150 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023151 D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023152 Token * _literal;
23153 expr_ty elem;
23154 while (
23155 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23156 &&
23157 (elem = target_rule(p)) // target
23158 )
23159 {
23160 _res = elem;
23161 if (_res == NULL && PyErr_Occurred()) {
23162 p->error_indicator = 1;
23163 PyMem_Free(_children);
23164 D(p->level--);
23165 return NULL;
23166 }
23167 if (_n == _children_capacity) {
23168 _children_capacity *= 2;
23169 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23170 if (!_new_children) {
23171 p->error_indicator = 1;
23172 PyErr_NoMemory();
23173 D(p->level--);
23174 return NULL;
23175 }
23176 _children = _new_children;
23177 }
23178 _children[_n++] = _res;
23179 _mark = p->mark;
23180 }
23181 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023182 D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023183 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target"));
23184 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023185 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023186 if (!_seq) {
23187 PyMem_Free(_children);
23188 p->error_indicator = 1;
23189 PyErr_NoMemory();
23190 D(p->level--);
23191 return NULL;
23192 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023193 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023194 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023195 _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023196 D(p->level--);
23197 return _seq;
23198}
23199
Pablo Galindo4a97b152020-09-02 17:44:19 +010023200// _gather_125: target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023201static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023202_gather_125_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023203{
23204 D(p->level++);
23205 if (p->error_indicator) {
23206 D(p->level--);
23207 return NULL;
23208 }
23209 asdl_seq * _res = NULL;
23210 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023211 { // target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023212 if (p->error_indicator) {
23213 D(p->level--);
23214 return NULL;
23215 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023216 D(fprintf(stderr, "%*c> _gather_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_126"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023217 expr_ty elem;
23218 asdl_seq * seq;
23219 if (
23220 (elem = target_rule(p)) // target
23221 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023222 (seq = _loop0_126_rule(p)) // _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023223 )
23224 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023225 D(fprintf(stderr, "%*c+ _gather_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_126"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023226 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23227 goto done;
23228 }
23229 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023230 D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ',
23231 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_126"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023232 }
23233 _res = NULL;
23234 done:
23235 D(p->level--);
23236 return _res;
23237}
23238
Pablo Galindo4a97b152020-09-02 17:44:19 +010023239// _tmp_127: args | expression for_if_clauses
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023240static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023241_tmp_127_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023242{
23243 D(p->level++);
23244 if (p->error_indicator) {
23245 D(p->level--);
23246 return NULL;
23247 }
23248 void * _res = NULL;
23249 int _mark = p->mark;
23250 { // args
23251 if (p->error_indicator) {
23252 D(p->level--);
23253 return NULL;
23254 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023255 D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023256 expr_ty args_var;
23257 if (
23258 (args_var = args_rule(p)) // args
23259 )
23260 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023261 D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023262 _res = args_var;
23263 goto done;
23264 }
23265 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023266 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023267 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
23268 }
23269 { // expression for_if_clauses
23270 if (p->error_indicator) {
23271 D(p->level--);
23272 return NULL;
23273 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023274 D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023275 expr_ty expression_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010023276 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023277 if (
23278 (expression_var = expression_rule(p)) // expression
23279 &&
23280 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
23281 )
23282 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023283 D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023284 _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
23285 goto done;
23286 }
23287 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023288 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023289 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
23290 }
23291 _res = NULL;
23292 done:
23293 D(p->level--);
23294 return _res;
23295}
23296
Pablo Galindo4a97b152020-09-02 17:44:19 +010023297// _loop0_128: star_named_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023298static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023299_loop0_128_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023300{
23301 D(p->level++);
23302 if (p->error_indicator) {
23303 D(p->level--);
23304 return NULL;
23305 }
23306 void *_res = NULL;
23307 int _mark = p->mark;
23308 int _start_mark = p->mark;
23309 void **_children = PyMem_Malloc(sizeof(void *));
23310 if (!_children) {
23311 p->error_indicator = 1;
23312 PyErr_NoMemory();
23313 D(p->level--);
23314 return NULL;
23315 }
23316 ssize_t _children_capacity = 1;
23317 ssize_t _n = 0;
23318 { // star_named_expressions
23319 if (p->error_indicator) {
23320 D(p->level--);
23321 return NULL;
23322 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023323 D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010023324 asdl_expr_seq* star_named_expressions_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023325 while (
23326 (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions
23327 )
23328 {
23329 _res = star_named_expressions_var;
23330 if (_n == _children_capacity) {
23331 _children_capacity *= 2;
23332 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23333 if (!_new_children) {
23334 p->error_indicator = 1;
23335 PyErr_NoMemory();
23336 D(p->level--);
23337 return NULL;
23338 }
23339 _children = _new_children;
23340 }
23341 _children[_n++] = _res;
23342 _mark = p->mark;
23343 }
23344 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023345 D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010023346 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023347 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023348 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023349 if (!_seq) {
23350 PyMem_Free(_children);
23351 p->error_indicator = 1;
23352 PyErr_NoMemory();
23353 D(p->level--);
23354 return NULL;
23355 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023356 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023357 PyMem_Free(_children);
23358 _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023359 D(p->level--);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023360 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023361}
23362
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023363// _loop0_129: (star_targets '=')
23364static asdl_seq *
23365_loop0_129_rule(Parser *p)
23366{
23367 D(p->level++);
23368 if (p->error_indicator) {
23369 D(p->level--);
23370 return NULL;
23371 }
23372 void *_res = NULL;
23373 int _mark = p->mark;
23374 int _start_mark = p->mark;
23375 void **_children = PyMem_Malloc(sizeof(void *));
23376 if (!_children) {
23377 p->error_indicator = 1;
23378 PyErr_NoMemory();
23379 D(p->level--);
23380 return NULL;
23381 }
23382 ssize_t _children_capacity = 1;
23383 ssize_t _n = 0;
23384 { // (star_targets '=')
23385 if (p->error_indicator) {
23386 D(p->level--);
23387 return NULL;
23388 }
23389 D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010023390 void *_tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023391 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023392 (_tmp_151_var = _tmp_151_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023393 )
23394 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023395 _res = _tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023396 if (_n == _children_capacity) {
23397 _children_capacity *= 2;
23398 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23399 if (!_new_children) {
23400 p->error_indicator = 1;
23401 PyErr_NoMemory();
23402 D(p->level--);
23403 return NULL;
23404 }
23405 _children = _new_children;
23406 }
23407 _children[_n++] = _res;
23408 _mark = p->mark;
23409 }
23410 p->mark = _mark;
23411 D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
23412 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23413 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023414 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023415 if (!_seq) {
23416 PyMem_Free(_children);
23417 p->error_indicator = 1;
23418 PyErr_NoMemory();
23419 D(p->level--);
23420 return NULL;
23421 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023422 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023423 PyMem_Free(_children);
23424 _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq);
23425 D(p->level--);
23426 return _seq;
23427}
23428
Pablo Galindo4a97b152020-09-02 17:44:19 +010023429// _loop0_130: (star_targets '=')
23430static asdl_seq *
23431_loop0_130_rule(Parser *p)
23432{
23433 D(p->level++);
23434 if (p->error_indicator) {
23435 D(p->level--);
23436 return NULL;
23437 }
23438 void *_res = NULL;
23439 int _mark = p->mark;
23440 int _start_mark = p->mark;
23441 void **_children = PyMem_Malloc(sizeof(void *));
23442 if (!_children) {
23443 p->error_indicator = 1;
23444 PyErr_NoMemory();
23445 D(p->level--);
23446 return NULL;
23447 }
23448 ssize_t _children_capacity = 1;
23449 ssize_t _n = 0;
23450 { // (star_targets '=')
23451 if (p->error_indicator) {
23452 D(p->level--);
23453 return NULL;
23454 }
23455 D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
23456 void *_tmp_152_var;
23457 while (
23458 (_tmp_152_var = _tmp_152_rule(p)) // star_targets '='
23459 )
23460 {
23461 _res = _tmp_152_var;
23462 if (_n == _children_capacity) {
23463 _children_capacity *= 2;
23464 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23465 if (!_new_children) {
23466 p->error_indicator = 1;
23467 PyErr_NoMemory();
23468 D(p->level--);
23469 return NULL;
23470 }
23471 _children = _new_children;
23472 }
23473 _children[_n++] = _res;
23474 _mark = p->mark;
23475 }
23476 p->mark = _mark;
23477 D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ',
23478 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23479 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023480 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023481 if (!_seq) {
23482 PyMem_Free(_children);
23483 p->error_indicator = 1;
23484 PyErr_NoMemory();
23485 D(p->level--);
23486 return NULL;
23487 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023488 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023489 PyMem_Free(_children);
23490 _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq);
23491 D(p->level--);
23492 return _seq;
23493}
23494
23495// _tmp_131: yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023496static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023497_tmp_131_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023498{
23499 D(p->level++);
23500 if (p->error_indicator) {
23501 D(p->level--);
23502 return NULL;
23503 }
23504 void * _res = NULL;
23505 int _mark = p->mark;
23506 { // yield_expr
23507 if (p->error_indicator) {
23508 D(p->level--);
23509 return NULL;
23510 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023511 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023512 expr_ty yield_expr_var;
23513 if (
23514 (yield_expr_var = yield_expr_rule(p)) // yield_expr
23515 )
23516 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023517 D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023518 _res = yield_expr_var;
23519 goto done;
23520 }
23521 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023522 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023523 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
23524 }
23525 { // star_expressions
23526 if (p->error_indicator) {
23527 D(p->level--);
23528 return NULL;
23529 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023530 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023531 expr_ty star_expressions_var;
23532 if (
23533 (star_expressions_var = star_expressions_rule(p)) // star_expressions
23534 )
23535 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023536 D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023537 _res = star_expressions_var;
23538 goto done;
23539 }
23540 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023541 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023542 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
23543 }
23544 _res = NULL;
23545 done:
23546 D(p->level--);
23547 return _res;
23548}
23549
Pablo Galindo4a97b152020-09-02 17:44:19 +010023550// _tmp_132: '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023551static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023552_tmp_132_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023553{
23554 D(p->level++);
23555 if (p->error_indicator) {
23556 D(p->level--);
23557 return NULL;
23558 }
23559 void * _res = NULL;
23560 int _mark = p->mark;
23561 { // '['
23562 if (p->error_indicator) {
23563 D(p->level--);
23564 return NULL;
23565 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023566 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023567 Token * _literal;
23568 if (
23569 (_literal = _PyPegen_expect_token(p, 9)) // token='['
23570 )
23571 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023572 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023573 _res = _literal;
23574 goto done;
23575 }
23576 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023577 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023578 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
23579 }
23580 { // '('
23581 if (p->error_indicator) {
23582 D(p->level--);
23583 return NULL;
23584 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023585 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023586 Token * _literal;
23587 if (
23588 (_literal = _PyPegen_expect_token(p, 7)) // token='('
23589 )
23590 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023591 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023592 _res = _literal;
23593 goto done;
23594 }
23595 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023596 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023597 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
23598 }
23599 { // '{'
23600 if (p->error_indicator) {
23601 D(p->level--);
23602 return NULL;
23603 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023604 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023605 Token * _literal;
23606 if (
23607 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
23608 )
23609 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023610 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023611 _res = _literal;
23612 goto done;
23613 }
23614 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023615 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023616 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
23617 }
23618 _res = NULL;
23619 done:
23620 D(p->level--);
23621 return _res;
23622}
23623
Pablo Galindo4a97b152020-09-02 17:44:19 +010023624// _loop0_133: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023625static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023626_loop0_133_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023627{
23628 D(p->level++);
23629 if (p->error_indicator) {
23630 D(p->level--);
23631 return NULL;
23632 }
23633 void *_res = NULL;
23634 int _mark = p->mark;
23635 int _start_mark = p->mark;
23636 void **_children = PyMem_Malloc(sizeof(void *));
23637 if (!_children) {
23638 p->error_indicator = 1;
23639 PyErr_NoMemory();
23640 D(p->level--);
23641 return NULL;
23642 }
23643 ssize_t _children_capacity = 1;
23644 ssize_t _n = 0;
23645 { // param_no_default
23646 if (p->error_indicator) {
23647 D(p->level--);
23648 return NULL;
23649 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023650 D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023651 arg_ty param_no_default_var;
23652 while (
23653 (param_no_default_var = param_no_default_rule(p)) // param_no_default
23654 )
23655 {
23656 _res = param_no_default_var;
23657 if (_n == _children_capacity) {
23658 _children_capacity *= 2;
23659 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23660 if (!_new_children) {
23661 p->error_indicator = 1;
23662 PyErr_NoMemory();
23663 D(p->level--);
23664 return NULL;
23665 }
23666 _children = _new_children;
23667 }
23668 _children[_n++] = _res;
23669 _mark = p->mark;
23670 }
23671 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023672 D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023673 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
23674 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023675 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023676 if (!_seq) {
23677 PyMem_Free(_children);
23678 p->error_indicator = 1;
23679 PyErr_NoMemory();
23680 D(p->level--);
23681 return NULL;
23682 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023683 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023684 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023685 _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023686 D(p->level--);
23687 return _seq;
23688}
23689
Pablo Galindo4a97b152020-09-02 17:44:19 +010023690// _tmp_134: slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023691static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023692_tmp_134_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023693{
23694 D(p->level++);
23695 if (p->error_indicator) {
23696 D(p->level--);
23697 return NULL;
23698 }
23699 void * _res = NULL;
23700 int _mark = p->mark;
23701 { // slash_with_default
23702 if (p->error_indicator) {
23703 D(p->level--);
23704 return NULL;
23705 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023706 D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023707 SlashWithDefault* slash_with_default_var;
23708 if (
23709 (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default
23710 )
23711 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023712 D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023713 _res = slash_with_default_var;
23714 goto done;
23715 }
23716 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023717 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023718 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
23719 }
23720 { // param_with_default+
23721 if (p->error_indicator) {
23722 D(p->level--);
23723 return NULL;
23724 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023725 D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23726 asdl_seq * _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023727 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023728 (_loop1_153_var = _loop1_153_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023729 )
23730 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023731 D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23732 _res = _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023733 goto done;
23734 }
23735 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023736 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023737 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
23738 }
23739 _res = NULL;
23740 done:
23741 D(p->level--);
23742 return _res;
23743}
23744
Pablo Galindo4a97b152020-09-02 17:44:19 +010023745// _loop0_135: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023746static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023747_loop0_135_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023748{
23749 D(p->level++);
23750 if (p->error_indicator) {
23751 D(p->level--);
23752 return NULL;
23753 }
23754 void *_res = NULL;
23755 int _mark = p->mark;
23756 int _start_mark = p->mark;
23757 void **_children = PyMem_Malloc(sizeof(void *));
23758 if (!_children) {
23759 p->error_indicator = 1;
23760 PyErr_NoMemory();
23761 D(p->level--);
23762 return NULL;
23763 }
23764 ssize_t _children_capacity = 1;
23765 ssize_t _n = 0;
23766 { // lambda_param_no_default
23767 if (p->error_indicator) {
23768 D(p->level--);
23769 return NULL;
23770 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023771 D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023772 arg_ty lambda_param_no_default_var;
23773 while (
23774 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
23775 )
23776 {
23777 _res = lambda_param_no_default_var;
23778 if (_n == _children_capacity) {
23779 _children_capacity *= 2;
23780 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23781 if (!_new_children) {
23782 p->error_indicator = 1;
23783 PyErr_NoMemory();
23784 D(p->level--);
23785 return NULL;
23786 }
23787 _children = _new_children;
23788 }
23789 _children[_n++] = _res;
23790 _mark = p->mark;
23791 }
23792 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023793 D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023794 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
23795 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023796 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023797 if (!_seq) {
23798 PyMem_Free(_children);
23799 p->error_indicator = 1;
23800 PyErr_NoMemory();
23801 D(p->level--);
23802 return NULL;
23803 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023804 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023805 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023806 _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023807 D(p->level--);
23808 return _seq;
23809}
23810
Pablo Galindo4a97b152020-09-02 17:44:19 +010023811// _tmp_136: lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023812static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023813_tmp_136_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023814{
23815 D(p->level++);
23816 if (p->error_indicator) {
23817 D(p->level--);
23818 return NULL;
23819 }
23820 void * _res = NULL;
23821 int _mark = p->mark;
23822 { // lambda_slash_with_default
23823 if (p->error_indicator) {
23824 D(p->level--);
23825 return NULL;
23826 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023827 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023828 SlashWithDefault* lambda_slash_with_default_var;
23829 if (
23830 (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
23831 )
23832 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023833 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023834 _res = lambda_slash_with_default_var;
23835 goto done;
23836 }
23837 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023838 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023839 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
23840 }
23841 { // lambda_param_with_default+
23842 if (p->error_indicator) {
23843 D(p->level--);
23844 return NULL;
23845 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023846 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23847 asdl_seq * _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023848 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023849 (_loop1_154_var = _loop1_154_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023850 )
23851 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023852 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23853 _res = _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023854 goto done;
23855 }
23856 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023857 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023858 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
23859 }
23860 _res = NULL;
23861 done:
23862 D(p->level--);
23863 return _res;
23864}
23865
Pablo Galindo4a97b152020-09-02 17:44:19 +010023866// _tmp_137: ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023867static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023868_tmp_137_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023869{
23870 D(p->level++);
23871 if (p->error_indicator) {
23872 D(p->level--);
23873 return NULL;
23874 }
23875 void * _res = NULL;
23876 int _mark = p->mark;
23877 { // ')'
23878 if (p->error_indicator) {
23879 D(p->level--);
23880 return NULL;
23881 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023882 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023883 Token * _literal;
23884 if (
23885 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
23886 )
23887 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023888 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023889 _res = _literal;
23890 goto done;
23891 }
23892 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023893 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023894 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
23895 }
23896 { // ',' (')' | '**')
23897 if (p->error_indicator) {
23898 D(p->level--);
23899 return NULL;
23900 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023901 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023902 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023903 void *_tmp_155_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023904 if (
23905 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23906 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023907 (_tmp_155_var = _tmp_155_rule(p)) // ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023908 )
23909 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023910 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
23911 _res = _PyPegen_dummy_name(p, _literal, _tmp_155_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023912 goto done;
23913 }
23914 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023915 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023916 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
23917 }
23918 _res = NULL;
23919 done:
23920 D(p->level--);
23921 return _res;
23922}
23923
Pablo Galindo4a97b152020-09-02 17:44:19 +010023924// _tmp_138: ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023925static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023926_tmp_138_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023927{
23928 D(p->level++);
23929 if (p->error_indicator) {
23930 D(p->level--);
23931 return NULL;
23932 }
23933 void * _res = NULL;
23934 int _mark = p->mark;
23935 { // ':'
23936 if (p->error_indicator) {
23937 D(p->level--);
23938 return NULL;
23939 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023940 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023941 Token * _literal;
23942 if (
23943 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
23944 )
23945 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023946 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023947 _res = _literal;
23948 goto done;
23949 }
23950 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023951 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023952 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
23953 }
23954 { // ',' (':' | '**')
23955 if (p->error_indicator) {
23956 D(p->level--);
23957 return NULL;
23958 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023959 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023960 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023961 void *_tmp_156_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023962 if (
23963 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23964 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023965 (_tmp_156_var = _tmp_156_rule(p)) // ':' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023966 )
23967 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023968 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
23969 _res = _PyPegen_dummy_name(p, _literal, _tmp_156_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023970 goto done;
23971 }
23972 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023973 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023974 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
23975 }
23976 _res = NULL;
23977 done:
23978 D(p->level--);
23979 return _res;
23980}
23981
Pablo Galindo4a97b152020-09-02 17:44:19 +010023982// _tmp_139: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023983static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023984_tmp_139_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023985{
23986 D(p->level++);
23987 if (p->error_indicator) {
23988 D(p->level--);
23989 return NULL;
23990 }
23991 void * _res = NULL;
23992 int _mark = p->mark;
23993 { // star_targets '='
23994 if (p->error_indicator) {
23995 D(p->level--);
23996 return NULL;
23997 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023998 D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023999 Token * _literal;
24000 expr_ty z;
24001 if (
24002 (z = star_targets_rule(p)) // star_targets
24003 &&
24004 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24005 )
24006 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024007 D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024008 _res = z;
24009 if (_res == NULL && PyErr_Occurred()) {
24010 p->error_indicator = 1;
24011 D(p->level--);
24012 return NULL;
24013 }
24014 goto done;
24015 }
24016 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024017 D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024018 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24019 }
24020 _res = NULL;
24021 done:
24022 D(p->level--);
24023 return _res;
24024}
24025
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024026// _tmp_140: '.' | '...'
24027static void *
24028_tmp_140_rule(Parser *p)
24029{
24030 D(p->level++);
24031 if (p->error_indicator) {
24032 D(p->level--);
24033 return NULL;
24034 }
24035 void * _res = NULL;
24036 int _mark = p->mark;
24037 { // '.'
24038 if (p->error_indicator) {
24039 D(p->level--);
24040 return NULL;
24041 }
24042 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
24043 Token * _literal;
24044 if (
24045 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
24046 )
24047 {
24048 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
24049 _res = _literal;
24050 goto done;
24051 }
24052 p->mark = _mark;
24053 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
24054 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
24055 }
24056 { // '...'
24057 if (p->error_indicator) {
24058 D(p->level--);
24059 return NULL;
24060 }
24061 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
24062 Token * _literal;
24063 if (
24064 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
24065 )
24066 {
24067 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
24068 _res = _literal;
24069 goto done;
24070 }
24071 p->mark = _mark;
24072 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
24073 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
24074 }
24075 _res = NULL;
24076 done:
24077 D(p->level--);
24078 return _res;
24079}
24080
Pablo Galindo4a97b152020-09-02 17:44:19 +010024081// _tmp_141: '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024082static void *
24083_tmp_141_rule(Parser *p)
24084{
24085 D(p->level++);
24086 if (p->error_indicator) {
24087 D(p->level--);
24088 return NULL;
24089 }
24090 void * _res = NULL;
24091 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024092 { // '.'
24093 if (p->error_indicator) {
24094 D(p->level--);
24095 return NULL;
24096 }
24097 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
24098 Token * _literal;
24099 if (
24100 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
24101 )
24102 {
24103 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
24104 _res = _literal;
24105 goto done;
24106 }
24107 p->mark = _mark;
24108 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24109 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
24110 }
24111 { // '...'
24112 if (p->error_indicator) {
24113 D(p->level--);
24114 return NULL;
24115 }
24116 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
24117 Token * _literal;
24118 if (
24119 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
24120 )
24121 {
24122 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
24123 _res = _literal;
24124 goto done;
24125 }
24126 p->mark = _mark;
24127 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24128 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
24129 }
24130 _res = NULL;
24131 done:
24132 D(p->level--);
24133 return _res;
24134}
24135
24136// _tmp_142: '@' named_expression NEWLINE
24137static void *
24138_tmp_142_rule(Parser *p)
24139{
24140 D(p->level++);
24141 if (p->error_indicator) {
24142 D(p->level--);
24143 return NULL;
24144 }
24145 void * _res = NULL;
24146 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024147 { // '@' named_expression NEWLINE
24148 if (p->error_indicator) {
24149 D(p->level--);
24150 return NULL;
24151 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024152 D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024153 Token * _literal;
24154 expr_ty f;
24155 Token * newline_var;
24156 if (
24157 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
24158 &&
24159 (f = named_expression_rule(p)) // named_expression
24160 &&
24161 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
24162 )
24163 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024164 D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024165 _res = f;
24166 if (_res == NULL && PyErr_Occurred()) {
24167 p->error_indicator = 1;
24168 D(p->level--);
24169 return NULL;
24170 }
24171 goto done;
24172 }
24173 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024174 D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024175 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
24176 }
24177 _res = NULL;
24178 done:
24179 D(p->level--);
24180 return _res;
24181}
24182
Pablo Galindo4a97b152020-09-02 17:44:19 +010024183// _tmp_143: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024184static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024185_tmp_143_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024186{
24187 D(p->level++);
24188 if (p->error_indicator) {
24189 D(p->level--);
24190 return NULL;
24191 }
24192 void * _res = NULL;
24193 int _mark = p->mark;
24194 { // ',' star_expression
24195 if (p->error_indicator) {
24196 D(p->level--);
24197 return NULL;
24198 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024199 D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024200 Token * _literal;
24201 expr_ty c;
24202 if (
24203 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24204 &&
24205 (c = star_expression_rule(p)) // star_expression
24206 )
24207 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024208 D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024209 _res = c;
24210 if (_res == NULL && PyErr_Occurred()) {
24211 p->error_indicator = 1;
24212 D(p->level--);
24213 return NULL;
24214 }
24215 goto done;
24216 }
24217 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024218 D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024219 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
24220 }
24221 _res = NULL;
24222 done:
24223 D(p->level--);
24224 return _res;
24225}
24226
Pablo Galindo4a97b152020-09-02 17:44:19 +010024227// _tmp_144: ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024228static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024229_tmp_144_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024230{
24231 D(p->level++);
24232 if (p->error_indicator) {
24233 D(p->level--);
24234 return NULL;
24235 }
24236 void * _res = NULL;
24237 int _mark = p->mark;
24238 { // ',' expression
24239 if (p->error_indicator) {
24240 D(p->level--);
24241 return NULL;
24242 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024243 D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024244 Token * _literal;
24245 expr_ty c;
24246 if (
24247 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24248 &&
24249 (c = expression_rule(p)) // expression
24250 )
24251 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024252 D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024253 _res = c;
24254 if (_res == NULL && PyErr_Occurred()) {
24255 p->error_indicator = 1;
24256 D(p->level--);
24257 return NULL;
24258 }
24259 goto done;
24260 }
24261 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024262 D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024263 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
24264 }
24265 _res = NULL;
24266 done:
24267 D(p->level--);
24268 return _res;
24269}
24270
Pablo Galindo4a97b152020-09-02 17:44:19 +010024271// _tmp_145: 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024272static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024273_tmp_145_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024274{
24275 D(p->level++);
24276 if (p->error_indicator) {
24277 D(p->level--);
24278 return NULL;
24279 }
24280 void * _res = NULL;
24281 int _mark = p->mark;
24282 { // 'or' conjunction
24283 if (p->error_indicator) {
24284 D(p->level--);
24285 return NULL;
24286 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024287 D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024288 Token * _keyword;
24289 expr_ty c;
24290 if (
24291 (_keyword = _PyPegen_expect_token(p, 531)) // token='or'
24292 &&
24293 (c = conjunction_rule(p)) // conjunction
24294 )
24295 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024296 D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024297 _res = c;
24298 if (_res == NULL && PyErr_Occurred()) {
24299 p->error_indicator = 1;
24300 D(p->level--);
24301 return NULL;
24302 }
24303 goto done;
24304 }
24305 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024306 D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024307 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
24308 }
24309 _res = NULL;
24310 done:
24311 D(p->level--);
24312 return _res;
24313}
24314
Pablo Galindo4a97b152020-09-02 17:44:19 +010024315// _tmp_146: 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024316static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024317_tmp_146_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024318{
24319 D(p->level++);
24320 if (p->error_indicator) {
24321 D(p->level--);
24322 return NULL;
24323 }
24324 void * _res = NULL;
24325 int _mark = p->mark;
24326 { // 'and' inversion
24327 if (p->error_indicator) {
24328 D(p->level--);
24329 return NULL;
24330 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024331 D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024332 Token * _keyword;
24333 expr_ty c;
24334 if (
24335 (_keyword = _PyPegen_expect_token(p, 532)) // token='and'
24336 &&
24337 (c = inversion_rule(p)) // inversion
24338 )
24339 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024340 D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024341 _res = c;
24342 if (_res == NULL && PyErr_Occurred()) {
24343 p->error_indicator = 1;
24344 D(p->level--);
24345 return NULL;
24346 }
24347 goto done;
24348 }
24349 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024350 D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010024351 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024352 }
24353 _res = NULL;
24354 done:
24355 D(p->level--);
24356 return _res;
24357}
24358
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024359// _tmp_147: 'if' disjunction
24360static void *
24361_tmp_147_rule(Parser *p)
24362{
24363 D(p->level++);
24364 if (p->error_indicator) {
24365 D(p->level--);
24366 return NULL;
24367 }
24368 void * _res = NULL;
24369 int _mark = p->mark;
24370 { // 'if' disjunction
24371 if (p->error_indicator) {
24372 D(p->level--);
24373 return NULL;
24374 }
24375 D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24376 Token * _keyword;
24377 expr_ty z;
24378 if (
24379 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24380 &&
24381 (z = disjunction_rule(p)) // disjunction
24382 )
24383 {
24384 D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24385 _res = z;
24386 if (_res == NULL && PyErr_Occurred()) {
24387 p->error_indicator = 1;
24388 D(p->level--);
24389 return NULL;
24390 }
24391 goto done;
24392 }
24393 p->mark = _mark;
24394 D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
24395 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24396 }
24397 _res = NULL;
24398 done:
24399 D(p->level--);
24400 return _res;
24401}
24402
Pablo Galindo4a97b152020-09-02 17:44:19 +010024403// _tmp_148: 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024404static void *
24405_tmp_148_rule(Parser *p)
24406{
24407 D(p->level++);
24408 if (p->error_indicator) {
24409 D(p->level--);
24410 return NULL;
24411 }
24412 void * _res = NULL;
24413 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024414 { // 'if' disjunction
24415 if (p->error_indicator) {
24416 D(p->level--);
24417 return NULL;
24418 }
24419 D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24420 Token * _keyword;
24421 expr_ty z;
24422 if (
24423 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24424 &&
24425 (z = disjunction_rule(p)) // disjunction
24426 )
24427 {
24428 D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24429 _res = z;
24430 if (_res == NULL && PyErr_Occurred()) {
24431 p->error_indicator = 1;
24432 D(p->level--);
24433 return NULL;
24434 }
24435 goto done;
24436 }
24437 p->mark = _mark;
24438 D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
24439 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24440 }
24441 _res = NULL;
24442 done:
24443 D(p->level--);
24444 return _res;
24445}
24446
24447// _tmp_149: starred_expression | named_expression !'='
24448static void *
24449_tmp_149_rule(Parser *p)
24450{
24451 D(p->level++);
24452 if (p->error_indicator) {
24453 D(p->level--);
24454 return NULL;
24455 }
24456 void * _res = NULL;
24457 int _mark = p->mark;
24458 { // starred_expression
24459 if (p->error_indicator) {
24460 D(p->level--);
24461 return NULL;
24462 }
24463 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24464 expr_ty starred_expression_var;
24465 if (
24466 (starred_expression_var = starred_expression_rule(p)) // starred_expression
24467 )
24468 {
24469 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24470 _res = starred_expression_var;
24471 goto done;
24472 }
24473 p->mark = _mark;
24474 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
24476 }
24477 { // named_expression !'='
24478 if (p->error_indicator) {
24479 D(p->level--);
24480 return NULL;
24481 }
24482 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24483 expr_ty named_expression_var;
24484 if (
24485 (named_expression_var = named_expression_rule(p)) // named_expression
24486 &&
24487 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
24488 )
24489 {
24490 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24491 _res = named_expression_var;
24492 goto done;
24493 }
24494 p->mark = _mark;
24495 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24496 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='"));
24497 }
24498 _res = NULL;
24499 done:
24500 D(p->level--);
24501 return _res;
24502}
24503
24504// _tmp_150: ',' star_target
24505static void *
24506_tmp_150_rule(Parser *p)
24507{
24508 D(p->level++);
24509 if (p->error_indicator) {
24510 D(p->level--);
24511 return NULL;
24512 }
24513 void * _res = NULL;
24514 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024515 { // ',' star_target
24516 if (p->error_indicator) {
24517 D(p->level--);
24518 return NULL;
24519 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024520 D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024521 Token * _literal;
24522 expr_ty c;
24523 if (
24524 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24525 &&
24526 (c = star_target_rule(p)) // star_target
24527 )
24528 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024529 D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024530 _res = c;
24531 if (_res == NULL && PyErr_Occurred()) {
24532 p->error_indicator = 1;
24533 D(p->level--);
24534 return NULL;
24535 }
24536 goto done;
24537 }
24538 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024539 D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030024540 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024541 }
24542 _res = NULL;
24543 done:
24544 D(p->level--);
24545 return _res;
24546}
24547
Pablo Galindo4a97b152020-09-02 17:44:19 +010024548// _tmp_151: star_targets '='
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024549static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024550_tmp_151_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024551{
24552 D(p->level++);
24553 if (p->error_indicator) {
24554 D(p->level--);
24555 return NULL;
24556 }
24557 void * _res = NULL;
24558 int _mark = p->mark;
24559 { // star_targets '='
24560 if (p->error_indicator) {
24561 D(p->level--);
24562 return NULL;
24563 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024564 D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024565 Token * _literal;
24566 expr_ty star_targets_var;
24567 if (
24568 (star_targets_var = star_targets_rule(p)) // star_targets
24569 &&
24570 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24571 )
24572 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024573 D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024574 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24575 goto done;
24576 }
24577 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024578 D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024579 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24580 }
24581 _res = NULL;
24582 done:
24583 D(p->level--);
24584 return _res;
24585}
24586
Pablo Galindo4a97b152020-09-02 17:44:19 +010024587// _tmp_152: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024588static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024589_tmp_152_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024590{
24591 D(p->level++);
24592 if (p->error_indicator) {
24593 D(p->level--);
24594 return NULL;
24595 }
24596 void * _res = NULL;
24597 int _mark = p->mark;
24598 { // star_targets '='
24599 if (p->error_indicator) {
24600 D(p->level--);
24601 return NULL;
24602 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024603 D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024604 Token * _literal;
24605 expr_ty star_targets_var;
24606 if (
24607 (star_targets_var = star_targets_rule(p)) // star_targets
24608 &&
24609 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24610 )
24611 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024612 D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024613 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24614 goto done;
24615 }
24616 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024617 D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024618 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24619 }
24620 _res = NULL;
24621 done:
24622 D(p->level--);
24623 return _res;
24624}
24625
Pablo Galindo4a97b152020-09-02 17:44:19 +010024626// _loop1_153: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024627static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024628_loop1_153_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024629{
24630 D(p->level++);
24631 if (p->error_indicator) {
24632 D(p->level--);
24633 return NULL;
24634 }
24635 void *_res = NULL;
24636 int _mark = p->mark;
24637 int _start_mark = p->mark;
24638 void **_children = PyMem_Malloc(sizeof(void *));
24639 if (!_children) {
24640 p->error_indicator = 1;
24641 PyErr_NoMemory();
24642 D(p->level--);
24643 return NULL;
24644 }
24645 ssize_t _children_capacity = 1;
24646 ssize_t _n = 0;
24647 { // param_with_default
24648 if (p->error_indicator) {
24649 D(p->level--);
24650 return NULL;
24651 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024652 D(fprintf(stderr, "%*c> _loop1_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024653 NameDefaultPair* param_with_default_var;
24654 while (
24655 (param_with_default_var = param_with_default_rule(p)) // param_with_default
24656 )
24657 {
24658 _res = param_with_default_var;
24659 if (_n == _children_capacity) {
24660 _children_capacity *= 2;
24661 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24662 if (!_new_children) {
24663 p->error_indicator = 1;
24664 PyErr_NoMemory();
24665 D(p->level--);
24666 return NULL;
24667 }
24668 _children = _new_children;
24669 }
24670 _children[_n++] = _res;
24671 _mark = p->mark;
24672 }
24673 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024674 D(fprintf(stderr, "%*c%s _loop1_153[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024675 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
24676 }
24677 if (_n == 0 || p->error_indicator) {
24678 PyMem_Free(_children);
24679 D(p->level--);
24680 return NULL;
24681 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024682 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024683 if (!_seq) {
24684 PyMem_Free(_children);
24685 p->error_indicator = 1;
24686 PyErr_NoMemory();
24687 D(p->level--);
24688 return NULL;
24689 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024690 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024691 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024692 _PyPegen_insert_memo(p, _start_mark, _loop1_153_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024693 D(p->level--);
24694 return _seq;
24695}
24696
Pablo Galindo4a97b152020-09-02 17:44:19 +010024697// _loop1_154: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024698static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024699_loop1_154_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024700{
24701 D(p->level++);
24702 if (p->error_indicator) {
24703 D(p->level--);
24704 return NULL;
24705 }
24706 void *_res = NULL;
24707 int _mark = p->mark;
24708 int _start_mark = p->mark;
24709 void **_children = PyMem_Malloc(sizeof(void *));
24710 if (!_children) {
24711 p->error_indicator = 1;
24712 PyErr_NoMemory();
24713 D(p->level--);
24714 return NULL;
24715 }
24716 ssize_t _children_capacity = 1;
24717 ssize_t _n = 0;
24718 { // lambda_param_with_default
24719 if (p->error_indicator) {
24720 D(p->level--);
24721 return NULL;
24722 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024723 D(fprintf(stderr, "%*c> _loop1_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024724 NameDefaultPair* lambda_param_with_default_var;
24725 while (
24726 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
24727 )
24728 {
24729 _res = lambda_param_with_default_var;
24730 if (_n == _children_capacity) {
24731 _children_capacity *= 2;
24732 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24733 if (!_new_children) {
24734 p->error_indicator = 1;
24735 PyErr_NoMemory();
24736 D(p->level--);
24737 return NULL;
24738 }
24739 _children = _new_children;
24740 }
24741 _children[_n++] = _res;
24742 _mark = p->mark;
24743 }
24744 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024745 D(fprintf(stderr, "%*c%s _loop1_154[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024746 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
24747 }
24748 if (_n == 0 || p->error_indicator) {
24749 PyMem_Free(_children);
24750 D(p->level--);
24751 return NULL;
24752 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024753 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024754 if (!_seq) {
24755 PyMem_Free(_children);
24756 p->error_indicator = 1;
24757 PyErr_NoMemory();
24758 D(p->level--);
24759 return NULL;
24760 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024761 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024762 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024763 _PyPegen_insert_memo(p, _start_mark, _loop1_154_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024764 D(p->level--);
24765 return _seq;
24766}
24767
Pablo Galindo4a97b152020-09-02 17:44:19 +010024768// _tmp_155: ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024769static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024770_tmp_155_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024771{
24772 D(p->level++);
24773 if (p->error_indicator) {
24774 D(p->level--);
24775 return NULL;
24776 }
24777 void * _res = NULL;
24778 int _mark = p->mark;
24779 { // ')'
24780 if (p->error_indicator) {
24781 D(p->level--);
24782 return NULL;
24783 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024784 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024785 Token * _literal;
24786 if (
24787 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
24788 )
24789 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024790 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024791 _res = _literal;
24792 goto done;
24793 }
24794 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024795 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024796 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
24797 }
24798 { // '**'
24799 if (p->error_indicator) {
24800 D(p->level--);
24801 return NULL;
24802 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024803 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024804 Token * _literal;
24805 if (
24806 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24807 )
24808 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024809 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024810 _res = _literal;
24811 goto done;
24812 }
24813 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024814 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024815 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24816 }
24817 _res = NULL;
24818 done:
24819 D(p->level--);
24820 return _res;
24821}
24822
Pablo Galindo4a97b152020-09-02 17:44:19 +010024823// _tmp_156: ':' | '**'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024824static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024825_tmp_156_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024826{
24827 D(p->level++);
24828 if (p->error_indicator) {
24829 D(p->level--);
24830 return NULL;
24831 }
24832 void * _res = NULL;
24833 int _mark = p->mark;
24834 { // ':'
24835 if (p->error_indicator) {
24836 D(p->level--);
24837 return NULL;
24838 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024839 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024840 Token * _literal;
24841 if (
24842 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
24843 )
24844 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024845 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024846 _res = _literal;
24847 goto done;
24848 }
24849 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024850 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024851 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024852 }
24853 { // '**'
24854 if (p->error_indicator) {
24855 D(p->level--);
24856 return NULL;
24857 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024858 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024859 Token * _literal;
24860 if (
24861 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24862 )
24863 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024864 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024865 _res = _literal;
24866 goto done;
24867 }
24868 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024869 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024870 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24871 }
24872 _res = NULL;
24873 done:
24874 D(p->level--);
24875 return _res;
24876}
24877
24878void *
24879_PyPegen_parse(Parser *p)
24880{
24881 // Initialize keywords
24882 p->keywords = reserved_keywords;
24883 p->n_keyword_lists = n_keyword_lists;
24884
24885 // Run parser
24886 void *result = NULL;
24887 if (p->start_rule == Py_file_input) {
24888 result = file_rule(p);
24889 } else if (p->start_rule == Py_single_input) {
24890 result = interactive_rule(p);
24891 } else if (p->start_rule == Py_eval_input) {
24892 result = eval_rule(p);
24893 } else if (p->start_rule == Py_func_type_input) {
24894 result = func_type_rule(p);
24895 } else if (p->start_rule == Py_fstring_input) {
24896 result = fstring_rule(p);
24897 }
24898
24899 return result;
24900}
24901
24902// The end