blob: a235c251fc9ac985815e8d0afcca058c3359ab05 [file] [log] [blame]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001// @generated by pegen.py from ./Grammar/python.gram
2#include "pegen.h"
Guido van Rossumf70e43a1991-02-19 12:39:46 +00003
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004#if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
Guido van Rossum86bea461997-04-29 21:03:06 +00005extern int Py_DebugFlag;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006#define D(x) if (Py_DebugFlag) x;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00007#else
8#define D(x)
9#endif
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010static const int n_keyword_lists = 9;
11static KeywordToken *reserved_keywords[] = {
12 NULL,
13 NULL,
14 (KeywordToken[]) {
15 {"if", 510},
16 {"in", 518},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017 {"as", 520},
18 {"is", 527},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019 {"or", 531},
20 {NULL, -1},
21 },
22 (KeywordToken[]) {
23 {"del", 503},
24 {"try", 511},
25 {"for", 517},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030026 {"def", 523},
27 {"not", 526},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010028 {"and", 532},
29 {NULL, -1},
30 },
31 (KeywordToken[]) {
32 {"pass", 502},
33 {"from", 514},
34 {"elif", 515},
35 {"else", 516},
36 {"with", 519},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030037 {"True", 528},
38 {"None", 530},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010039 {NULL, -1},
40 },
41 (KeywordToken[]) {
42 {"raise", 501},
43 {"yield", 504},
44 {"break", 506},
45 {"while", 512},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030046 {"class", 524},
47 {"False", 529},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010048 {NULL, -1},
49 },
50 (KeywordToken[]) {
51 {"return", 500},
52 {"assert", 505},
53 {"global", 508},
54 {"import", 513},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030055 {"except", 521},
56 {"lambda", 525},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010057 {NULL, -1},
58 },
59 (KeywordToken[]) {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030060 {"finally", 522},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010061 {NULL, -1},
62 },
63 (KeywordToken[]) {
64 {"continue", 507},
65 {"nonlocal", 509},
66 {NULL, -1},
67 },
68};
69#define file_type 1000
70#define interactive_type 1001
71#define eval_type 1002
72#define func_type_type 1003
73#define fstring_type 1004
74#define type_expressions_type 1005
75#define statements_type 1006
76#define statement_type 1007
77#define statement_newline_type 1008
78#define simple_stmt_type 1009
79#define small_stmt_type 1010
80#define compound_stmt_type 1011
81#define assignment_type 1012
82#define augassign_type 1013
83#define global_stmt_type 1014
84#define nonlocal_stmt_type 1015
85#define yield_stmt_type 1016
86#define assert_stmt_type 1017
87#define del_stmt_type 1018
88#define import_stmt_type 1019
89#define import_name_type 1020
90#define import_from_type 1021
91#define import_from_targets_type 1022
92#define import_from_as_names_type 1023
93#define import_from_as_name_type 1024
94#define dotted_as_names_type 1025
95#define dotted_as_name_type 1026
96#define dotted_name_type 1027 // Left-recursive
97#define if_stmt_type 1028
98#define elif_stmt_type 1029
99#define else_block_type 1030
100#define while_stmt_type 1031
101#define for_stmt_type 1032
102#define with_stmt_type 1033
103#define with_item_type 1034
104#define try_stmt_type 1035
105#define except_block_type 1036
106#define finally_block_type 1037
107#define return_stmt_type 1038
108#define raise_stmt_type 1039
109#define function_def_type 1040
110#define function_def_raw_type 1041
111#define func_type_comment_type 1042
112#define params_type 1043
113#define parameters_type 1044
114#define slash_no_default_type 1045
115#define slash_with_default_type 1046
116#define star_etc_type 1047
117#define kwds_type 1048
118#define param_no_default_type 1049
119#define param_with_default_type 1050
120#define param_maybe_default_type 1051
121#define param_type 1052
122#define annotation_type 1053
123#define default_type 1054
124#define decorators_type 1055
125#define class_def_type 1056
126#define class_def_raw_type 1057
127#define block_type 1058
128#define expressions_list_type 1059
129#define star_expressions_type 1060
130#define star_expression_type 1061
131#define star_named_expressions_type 1062
132#define star_named_expression_type 1063
133#define named_expression_type 1064
134#define annotated_rhs_type 1065
135#define expressions_type 1066
136#define expression_type 1067
137#define lambdef_type 1068
138#define lambda_params_type 1069
139#define lambda_parameters_type 1070
140#define lambda_slash_no_default_type 1071
141#define lambda_slash_with_default_type 1072
142#define lambda_star_etc_type 1073
143#define lambda_kwds_type 1074
144#define lambda_param_no_default_type 1075
145#define lambda_param_with_default_type 1076
146#define lambda_param_maybe_default_type 1077
147#define lambda_param_type 1078
148#define disjunction_type 1079
149#define conjunction_type 1080
150#define inversion_type 1081
151#define comparison_type 1082
152#define compare_op_bitwise_or_pair_type 1083
153#define eq_bitwise_or_type 1084
154#define noteq_bitwise_or_type 1085
155#define lte_bitwise_or_type 1086
156#define lt_bitwise_or_type 1087
157#define gte_bitwise_or_type 1088
158#define gt_bitwise_or_type 1089
159#define notin_bitwise_or_type 1090
160#define in_bitwise_or_type 1091
161#define isnot_bitwise_or_type 1092
162#define is_bitwise_or_type 1093
163#define bitwise_or_type 1094 // Left-recursive
164#define bitwise_xor_type 1095 // Left-recursive
165#define bitwise_and_type 1096 // Left-recursive
166#define shift_expr_type 1097 // Left-recursive
167#define sum_type 1098 // Left-recursive
168#define term_type 1099 // Left-recursive
169#define factor_type 1100
170#define power_type 1101
171#define await_primary_type 1102
172#define primary_type 1103 // Left-recursive
173#define slices_type 1104
174#define slice_type 1105
175#define atom_type 1106
176#define strings_type 1107
177#define list_type 1108
178#define listcomp_type 1109
179#define tuple_type 1110
180#define group_type 1111
181#define genexp_type 1112
182#define set_type 1113
183#define setcomp_type 1114
184#define dict_type 1115
185#define dictcomp_type 1116
186#define double_starred_kvpairs_type 1117
187#define double_starred_kvpair_type 1118
188#define kvpair_type 1119
189#define for_if_clauses_type 1120
190#define for_if_clause_type 1121
191#define yield_expr_type 1122
192#define arguments_type 1123
193#define args_type 1124
194#define kwargs_type 1125
195#define starred_expression_type 1126
196#define kwarg_or_starred_type 1127
197#define kwarg_or_double_starred_type 1128
198#define star_targets_type 1129
199#define star_targets_seq_type 1130
200#define star_target_type 1131
201#define star_atom_type 1132
202#define single_target_type 1133
203#define single_subscript_attribute_target_type 1134
204#define del_targets_type 1135
205#define del_target_type 1136
206#define del_t_atom_type 1137
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300207#define targets_type 1138
208#define target_type 1139
209#define t_primary_type 1140 // Left-recursive
210#define t_lookahead_type 1141
211#define t_atom_type 1142
212#define incorrect_arguments_type 1143
213#define invalid_kwarg_type 1144
214#define invalid_named_expression_type 1145
215#define invalid_assignment_type 1146
216#define invalid_del_stmt_type 1147
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100217#define invalid_block_type 1148
218#define invalid_comprehension_type 1149
219#define invalid_dict_comprehension_type 1150
220#define invalid_parameters_type 1151
221#define invalid_lambda_parameters_type 1152
222#define invalid_star_etc_type 1153
223#define invalid_lambda_star_etc_type 1154
224#define invalid_double_type_comments_type 1155
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300225#define invalid_with_item_type 1156
226#define invalid_for_target_type 1157
227#define invalid_group_type 1158
228#define invalid_import_from_targets_type 1159
229#define _loop0_1_type 1160
230#define _loop0_2_type 1161
231#define _loop0_4_type 1162
232#define _gather_3_type 1163
233#define _loop0_6_type 1164
234#define _gather_5_type 1165
235#define _loop0_8_type 1166
236#define _gather_7_type 1167
237#define _loop0_10_type 1168
238#define _gather_9_type 1169
239#define _loop1_11_type 1170
240#define _loop0_13_type 1171
241#define _gather_12_type 1172
242#define _tmp_14_type 1173
243#define _tmp_15_type 1174
244#define _tmp_16_type 1175
245#define _tmp_17_type 1176
246#define _tmp_18_type 1177
247#define _tmp_19_type 1178
248#define _tmp_20_type 1179
249#define _tmp_21_type 1180
250#define _loop1_22_type 1181
251#define _tmp_23_type 1182
252#define _tmp_24_type 1183
253#define _loop0_26_type 1184
254#define _gather_25_type 1185
255#define _loop0_28_type 1186
256#define _gather_27_type 1187
257#define _tmp_29_type 1188
258#define _tmp_30_type 1189
259#define _loop0_31_type 1190
260#define _loop1_32_type 1191
261#define _loop0_34_type 1192
262#define _gather_33_type 1193
263#define _tmp_35_type 1194
264#define _loop0_37_type 1195
265#define _gather_36_type 1196
266#define _tmp_38_type 1197
267#define _loop0_40_type 1198
268#define _gather_39_type 1199
269#define _loop0_42_type 1200
270#define _gather_41_type 1201
271#define _loop0_44_type 1202
272#define _gather_43_type 1203
273#define _loop0_46_type 1204
274#define _gather_45_type 1205
275#define _tmp_47_type 1206
276#define _loop1_48_type 1207
277#define _tmp_49_type 1208
278#define _tmp_50_type 1209
279#define _tmp_51_type 1210
280#define _tmp_52_type 1211
281#define _tmp_53_type 1212
282#define _loop0_54_type 1213
283#define _loop0_55_type 1214
284#define _loop0_56_type 1215
285#define _loop1_57_type 1216
286#define _loop0_58_type 1217
287#define _loop1_59_type 1218
288#define _loop1_60_type 1219
289#define _loop1_61_type 1220
290#define _loop0_62_type 1221
291#define _loop1_63_type 1222
292#define _loop0_64_type 1223
293#define _loop1_65_type 1224
294#define _loop0_66_type 1225
295#define _loop1_67_type 1226
296#define _loop1_68_type 1227
297#define _tmp_69_type 1228
298#define _loop0_71_type 1229
299#define _gather_70_type 1230
300#define _loop1_72_type 1231
301#define _loop0_74_type 1232
302#define _gather_73_type 1233
303#define _loop1_75_type 1234
304#define _loop0_76_type 1235
305#define _loop0_77_type 1236
306#define _loop0_78_type 1237
307#define _loop1_79_type 1238
308#define _loop0_80_type 1239
309#define _loop1_81_type 1240
310#define _loop1_82_type 1241
311#define _loop1_83_type 1242
312#define _loop0_84_type 1243
313#define _loop1_85_type 1244
314#define _loop0_86_type 1245
315#define _loop1_87_type 1246
316#define _loop0_88_type 1247
317#define _loop1_89_type 1248
318#define _loop1_90_type 1249
319#define _loop1_91_type 1250
320#define _loop1_92_type 1251
321#define _tmp_93_type 1252
322#define _loop0_95_type 1253
323#define _gather_94_type 1254
324#define _tmp_96_type 1255
325#define _tmp_97_type 1256
326#define _tmp_98_type 1257
327#define _tmp_99_type 1258
328#define _loop1_100_type 1259
329#define _tmp_101_type 1260
330#define _tmp_102_type 1261
331#define _loop0_104_type 1262
332#define _gather_103_type 1263
333#define _loop1_105_type 1264
334#define _loop0_106_type 1265
335#define _loop0_107_type 1266
336#define _tmp_108_type 1267
337#define _tmp_109_type 1268
338#define _loop0_111_type 1269
339#define _gather_110_type 1270
340#define _loop0_113_type 1271
341#define _gather_112_type 1272
342#define _loop0_115_type 1273
343#define _gather_114_type 1274
344#define _loop0_117_type 1275
345#define _gather_116_type 1276
346#define _loop0_118_type 1277
347#define _loop0_120_type 1278
348#define _gather_119_type 1279
349#define _tmp_121_type 1280
350#define _loop0_123_type 1281
351#define _gather_122_type 1282
352#define _loop0_125_type 1283
353#define _gather_124_type 1284
354#define _tmp_126_type 1285
355#define _loop0_127_type 1286
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300356#define _loop0_128_type 1287
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300357#define _loop0_129_type 1288
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300358#define _tmp_130_type 1289
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300359#define _tmp_131_type 1290
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300360#define _loop0_132_type 1291
361#define _tmp_133_type 1292
362#define _loop0_134_type 1293
363#define _tmp_135_type 1294
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300364#define _tmp_136_type 1295
365#define _tmp_137_type 1296
366#define _tmp_138_type 1297
367#define _tmp_139_type 1298
368#define _tmp_140_type 1299
369#define _tmp_141_type 1300
370#define _tmp_142_type 1301
371#define _tmp_143_type 1302
372#define _tmp_144_type 1303
373#define _tmp_145_type 1304
374#define _tmp_146_type 1305
375#define _tmp_147_type 1306
376#define _tmp_148_type 1307
377#define _tmp_149_type 1308
378#define _tmp_150_type 1309
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300379#define _loop1_151_type 1310
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300380#define _loop1_152_type 1311
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300381#define _tmp_153_type 1312
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300382#define _tmp_154_type 1313
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100383
384static mod_ty file_rule(Parser *p);
385static mod_ty interactive_rule(Parser *p);
386static mod_ty eval_rule(Parser *p);
387static mod_ty func_type_rule(Parser *p);
388static expr_ty fstring_rule(Parser *p);
389static asdl_seq* type_expressions_rule(Parser *p);
390static asdl_seq* statements_rule(Parser *p);
391static asdl_seq* statement_rule(Parser *p);
392static asdl_seq* statement_newline_rule(Parser *p);
393static asdl_seq* simple_stmt_rule(Parser *p);
394static stmt_ty small_stmt_rule(Parser *p);
395static stmt_ty compound_stmt_rule(Parser *p);
396static stmt_ty assignment_rule(Parser *p);
397static AugOperator* augassign_rule(Parser *p);
398static stmt_ty global_stmt_rule(Parser *p);
399static stmt_ty nonlocal_stmt_rule(Parser *p);
400static stmt_ty yield_stmt_rule(Parser *p);
401static stmt_ty assert_stmt_rule(Parser *p);
402static stmt_ty del_stmt_rule(Parser *p);
403static stmt_ty import_stmt_rule(Parser *p);
404static stmt_ty import_name_rule(Parser *p);
405static stmt_ty import_from_rule(Parser *p);
406static asdl_seq* import_from_targets_rule(Parser *p);
407static asdl_seq* import_from_as_names_rule(Parser *p);
408static alias_ty import_from_as_name_rule(Parser *p);
409static asdl_seq* dotted_as_names_rule(Parser *p);
410static alias_ty dotted_as_name_rule(Parser *p);
411static expr_ty dotted_name_rule(Parser *p);
412static stmt_ty if_stmt_rule(Parser *p);
413static stmt_ty elif_stmt_rule(Parser *p);
414static asdl_seq* else_block_rule(Parser *p);
415static stmt_ty while_stmt_rule(Parser *p);
416static stmt_ty for_stmt_rule(Parser *p);
417static stmt_ty with_stmt_rule(Parser *p);
418static withitem_ty with_item_rule(Parser *p);
419static stmt_ty try_stmt_rule(Parser *p);
420static excepthandler_ty except_block_rule(Parser *p);
421static asdl_seq* finally_block_rule(Parser *p);
422static stmt_ty return_stmt_rule(Parser *p);
423static stmt_ty raise_stmt_rule(Parser *p);
424static stmt_ty function_def_rule(Parser *p);
425static stmt_ty function_def_raw_rule(Parser *p);
426static Token* func_type_comment_rule(Parser *p);
427static arguments_ty params_rule(Parser *p);
428static arguments_ty parameters_rule(Parser *p);
429static asdl_seq* slash_no_default_rule(Parser *p);
430static SlashWithDefault* slash_with_default_rule(Parser *p);
431static StarEtc* star_etc_rule(Parser *p);
432static arg_ty kwds_rule(Parser *p);
433static arg_ty param_no_default_rule(Parser *p);
434static NameDefaultPair* param_with_default_rule(Parser *p);
435static NameDefaultPair* param_maybe_default_rule(Parser *p);
436static arg_ty param_rule(Parser *p);
437static expr_ty annotation_rule(Parser *p);
438static expr_ty default_rule(Parser *p);
439static asdl_seq* decorators_rule(Parser *p);
440static stmt_ty class_def_rule(Parser *p);
441static stmt_ty class_def_raw_rule(Parser *p);
442static asdl_seq* block_rule(Parser *p);
443static asdl_seq* expressions_list_rule(Parser *p);
444static expr_ty star_expressions_rule(Parser *p);
445static expr_ty star_expression_rule(Parser *p);
446static asdl_seq* star_named_expressions_rule(Parser *p);
447static expr_ty star_named_expression_rule(Parser *p);
448static expr_ty named_expression_rule(Parser *p);
449static expr_ty annotated_rhs_rule(Parser *p);
450static expr_ty expressions_rule(Parser *p);
451static expr_ty expression_rule(Parser *p);
452static expr_ty lambdef_rule(Parser *p);
453static arguments_ty lambda_params_rule(Parser *p);
454static arguments_ty lambda_parameters_rule(Parser *p);
455static asdl_seq* lambda_slash_no_default_rule(Parser *p);
456static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
457static StarEtc* lambda_star_etc_rule(Parser *p);
458static arg_ty lambda_kwds_rule(Parser *p);
459static arg_ty lambda_param_no_default_rule(Parser *p);
460static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
461static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
462static arg_ty lambda_param_rule(Parser *p);
463static expr_ty disjunction_rule(Parser *p);
464static expr_ty conjunction_rule(Parser *p);
465static expr_ty inversion_rule(Parser *p);
466static expr_ty comparison_rule(Parser *p);
467static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
468static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
469static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
470static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
471static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
472static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
473static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
474static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
475static CmpopExprPair* in_bitwise_or_rule(Parser *p);
476static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
477static CmpopExprPair* is_bitwise_or_rule(Parser *p);
478static expr_ty bitwise_or_rule(Parser *p);
479static expr_ty bitwise_xor_rule(Parser *p);
480static expr_ty bitwise_and_rule(Parser *p);
481static expr_ty shift_expr_rule(Parser *p);
482static expr_ty sum_rule(Parser *p);
483static expr_ty term_rule(Parser *p);
484static expr_ty factor_rule(Parser *p);
485static expr_ty power_rule(Parser *p);
486static expr_ty await_primary_rule(Parser *p);
487static expr_ty primary_rule(Parser *p);
488static expr_ty slices_rule(Parser *p);
489static expr_ty slice_rule(Parser *p);
490static expr_ty atom_rule(Parser *p);
491static expr_ty strings_rule(Parser *p);
492static expr_ty list_rule(Parser *p);
493static expr_ty listcomp_rule(Parser *p);
494static expr_ty tuple_rule(Parser *p);
495static expr_ty group_rule(Parser *p);
496static expr_ty genexp_rule(Parser *p);
497static expr_ty set_rule(Parser *p);
498static expr_ty setcomp_rule(Parser *p);
499static expr_ty dict_rule(Parser *p);
500static expr_ty dictcomp_rule(Parser *p);
501static asdl_seq* double_starred_kvpairs_rule(Parser *p);
502static KeyValuePair* double_starred_kvpair_rule(Parser *p);
503static KeyValuePair* kvpair_rule(Parser *p);
504static asdl_seq* for_if_clauses_rule(Parser *p);
505static comprehension_ty for_if_clause_rule(Parser *p);
506static expr_ty yield_expr_rule(Parser *p);
507static expr_ty arguments_rule(Parser *p);
508static expr_ty args_rule(Parser *p);
509static asdl_seq* kwargs_rule(Parser *p);
510static expr_ty starred_expression_rule(Parser *p);
511static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
512static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
513static expr_ty star_targets_rule(Parser *p);
514static asdl_seq* star_targets_seq_rule(Parser *p);
515static expr_ty star_target_rule(Parser *p);
516static expr_ty star_atom_rule(Parser *p);
517static expr_ty single_target_rule(Parser *p);
518static expr_ty single_subscript_attribute_target_rule(Parser *p);
519static asdl_seq* del_targets_rule(Parser *p);
520static expr_ty del_target_rule(Parser *p);
521static expr_ty del_t_atom_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100522static asdl_seq* targets_rule(Parser *p);
523static expr_ty target_rule(Parser *p);
524static expr_ty t_primary_rule(Parser *p);
525static void *t_lookahead_rule(Parser *p);
526static expr_ty t_atom_rule(Parser *p);
527static void *incorrect_arguments_rule(Parser *p);
528static void *invalid_kwarg_rule(Parser *p);
529static void *invalid_named_expression_rule(Parser *p);
530static void *invalid_assignment_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300531static void *invalid_del_stmt_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100532static void *invalid_block_rule(Parser *p);
533static void *invalid_comprehension_rule(Parser *p);
534static void *invalid_dict_comprehension_rule(Parser *p);
535static void *invalid_parameters_rule(Parser *p);
536static void *invalid_lambda_parameters_rule(Parser *p);
537static void *invalid_star_etc_rule(Parser *p);
538static void *invalid_lambda_star_etc_rule(Parser *p);
539static void *invalid_double_type_comments_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300540static void *invalid_with_item_rule(Parser *p);
541static void *invalid_for_target_rule(Parser *p);
542static void *invalid_group_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100543static void *invalid_import_from_targets_rule(Parser *p);
544static asdl_seq *_loop0_1_rule(Parser *p);
545static asdl_seq *_loop0_2_rule(Parser *p);
546static asdl_seq *_loop0_4_rule(Parser *p);
547static asdl_seq *_gather_3_rule(Parser *p);
548static asdl_seq *_loop0_6_rule(Parser *p);
549static asdl_seq *_gather_5_rule(Parser *p);
550static asdl_seq *_loop0_8_rule(Parser *p);
551static asdl_seq *_gather_7_rule(Parser *p);
552static asdl_seq *_loop0_10_rule(Parser *p);
553static asdl_seq *_gather_9_rule(Parser *p);
554static asdl_seq *_loop1_11_rule(Parser *p);
555static asdl_seq *_loop0_13_rule(Parser *p);
556static asdl_seq *_gather_12_rule(Parser *p);
557static void *_tmp_14_rule(Parser *p);
558static void *_tmp_15_rule(Parser *p);
559static void *_tmp_16_rule(Parser *p);
560static void *_tmp_17_rule(Parser *p);
561static void *_tmp_18_rule(Parser *p);
562static void *_tmp_19_rule(Parser *p);
563static void *_tmp_20_rule(Parser *p);
564static void *_tmp_21_rule(Parser *p);
565static asdl_seq *_loop1_22_rule(Parser *p);
566static void *_tmp_23_rule(Parser *p);
567static void *_tmp_24_rule(Parser *p);
568static asdl_seq *_loop0_26_rule(Parser *p);
569static asdl_seq *_gather_25_rule(Parser *p);
570static asdl_seq *_loop0_28_rule(Parser *p);
571static asdl_seq *_gather_27_rule(Parser *p);
572static void *_tmp_29_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300573static void *_tmp_30_rule(Parser *p);
574static asdl_seq *_loop0_31_rule(Parser *p);
575static asdl_seq *_loop1_32_rule(Parser *p);
576static asdl_seq *_loop0_34_rule(Parser *p);
577static asdl_seq *_gather_33_rule(Parser *p);
578static void *_tmp_35_rule(Parser *p);
579static asdl_seq *_loop0_37_rule(Parser *p);
580static asdl_seq *_gather_36_rule(Parser *p);
581static void *_tmp_38_rule(Parser *p);
582static asdl_seq *_loop0_40_rule(Parser *p);
583static asdl_seq *_gather_39_rule(Parser *p);
584static asdl_seq *_loop0_42_rule(Parser *p);
585static asdl_seq *_gather_41_rule(Parser *p);
586static asdl_seq *_loop0_44_rule(Parser *p);
587static asdl_seq *_gather_43_rule(Parser *p);
588static asdl_seq *_loop0_46_rule(Parser *p);
589static asdl_seq *_gather_45_rule(Parser *p);
590static void *_tmp_47_rule(Parser *p);
591static asdl_seq *_loop1_48_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100592static void *_tmp_49_rule(Parser *p);
593static void *_tmp_50_rule(Parser *p);
594static void *_tmp_51_rule(Parser *p);
595static void *_tmp_52_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300596static void *_tmp_53_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100597static asdl_seq *_loop0_54_rule(Parser *p);
598static asdl_seq *_loop0_55_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300599static asdl_seq *_loop0_56_rule(Parser *p);
600static asdl_seq *_loop1_57_rule(Parser *p);
601static asdl_seq *_loop0_58_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100602static asdl_seq *_loop1_59_rule(Parser *p);
603static asdl_seq *_loop1_60_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300604static asdl_seq *_loop1_61_rule(Parser *p);
605static asdl_seq *_loop0_62_rule(Parser *p);
606static asdl_seq *_loop1_63_rule(Parser *p);
607static asdl_seq *_loop0_64_rule(Parser *p);
608static asdl_seq *_loop1_65_rule(Parser *p);
609static asdl_seq *_loop0_66_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100610static asdl_seq *_loop1_67_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300611static asdl_seq *_loop1_68_rule(Parser *p);
612static void *_tmp_69_rule(Parser *p);
613static asdl_seq *_loop0_71_rule(Parser *p);
614static asdl_seq *_gather_70_rule(Parser *p);
615static asdl_seq *_loop1_72_rule(Parser *p);
616static asdl_seq *_loop0_74_rule(Parser *p);
617static asdl_seq *_gather_73_rule(Parser *p);
618static asdl_seq *_loop1_75_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100619static asdl_seq *_loop0_76_rule(Parser *p);
620static asdl_seq *_loop0_77_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300621static asdl_seq *_loop0_78_rule(Parser *p);
622static asdl_seq *_loop1_79_rule(Parser *p);
623static asdl_seq *_loop0_80_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100624static asdl_seq *_loop1_81_rule(Parser *p);
625static asdl_seq *_loop1_82_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300626static asdl_seq *_loop1_83_rule(Parser *p);
627static asdl_seq *_loop0_84_rule(Parser *p);
628static asdl_seq *_loop1_85_rule(Parser *p);
629static asdl_seq *_loop0_86_rule(Parser *p);
630static asdl_seq *_loop1_87_rule(Parser *p);
631static asdl_seq *_loop0_88_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100632static asdl_seq *_loop1_89_rule(Parser *p);
633static asdl_seq *_loop1_90_rule(Parser *p);
634static asdl_seq *_loop1_91_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300635static asdl_seq *_loop1_92_rule(Parser *p);
636static void *_tmp_93_rule(Parser *p);
637static asdl_seq *_loop0_95_rule(Parser *p);
638static asdl_seq *_gather_94_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100639static void *_tmp_96_rule(Parser *p);
640static void *_tmp_97_rule(Parser *p);
641static void *_tmp_98_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300642static void *_tmp_99_rule(Parser *p);
643static asdl_seq *_loop1_100_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100644static void *_tmp_101_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300645static void *_tmp_102_rule(Parser *p);
646static asdl_seq *_loop0_104_rule(Parser *p);
647static asdl_seq *_gather_103_rule(Parser *p);
648static asdl_seq *_loop1_105_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100649static asdl_seq *_loop0_106_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300650static asdl_seq *_loop0_107_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100651static void *_tmp_108_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300652static void *_tmp_109_rule(Parser *p);
653static asdl_seq *_loop0_111_rule(Parser *p);
654static asdl_seq *_gather_110_rule(Parser *p);
655static asdl_seq *_loop0_113_rule(Parser *p);
656static asdl_seq *_gather_112_rule(Parser *p);
657static asdl_seq *_loop0_115_rule(Parser *p);
658static asdl_seq *_gather_114_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100659static asdl_seq *_loop0_117_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300660static asdl_seq *_gather_116_rule(Parser *p);
661static asdl_seq *_loop0_118_rule(Parser *p);
662static asdl_seq *_loop0_120_rule(Parser *p);
663static asdl_seq *_gather_119_rule(Parser *p);
664static void *_tmp_121_rule(Parser *p);
665static asdl_seq *_loop0_123_rule(Parser *p);
666static asdl_seq *_gather_122_rule(Parser *p);
667static asdl_seq *_loop0_125_rule(Parser *p);
668static asdl_seq *_gather_124_rule(Parser *p);
669static void *_tmp_126_rule(Parser *p);
670static asdl_seq *_loop0_127_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300671static asdl_seq *_loop0_128_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100672static asdl_seq *_loop0_129_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300673static void *_tmp_130_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100674static void *_tmp_131_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300675static asdl_seq *_loop0_132_rule(Parser *p);
676static void *_tmp_133_rule(Parser *p);
677static asdl_seq *_loop0_134_rule(Parser *p);
678static void *_tmp_135_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100679static void *_tmp_136_rule(Parser *p);
680static void *_tmp_137_rule(Parser *p);
681static void *_tmp_138_rule(Parser *p);
682static void *_tmp_139_rule(Parser *p);
683static void *_tmp_140_rule(Parser *p);
684static void *_tmp_141_rule(Parser *p);
685static void *_tmp_142_rule(Parser *p);
686static void *_tmp_143_rule(Parser *p);
687static void *_tmp_144_rule(Parser *p);
688static void *_tmp_145_rule(Parser *p);
689static void *_tmp_146_rule(Parser *p);
690static void *_tmp_147_rule(Parser *p);
691static void *_tmp_148_rule(Parser *p);
692static void *_tmp_149_rule(Parser *p);
693static void *_tmp_150_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300694static asdl_seq *_loop1_151_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100695static asdl_seq *_loop1_152_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300696static void *_tmp_153_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100697static void *_tmp_154_rule(Parser *p);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000698
699
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100700// file: statements? $
701static mod_ty
702file_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000703{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100704 D(p->level++);
705 if (p->error_indicator) {
706 D(p->level--);
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000707 return NULL;
708 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100709 mod_ty _res = NULL;
710 int _mark = p->mark;
711 { // statements? $
712 if (p->error_indicator) {
713 D(p->level--);
714 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000715 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100716 D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $"));
717 void *a;
718 Token * endmarker_var;
719 if (
720 (a = statements_rule(p), 1) // statements?
721 &&
722 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
723 )
724 {
725 D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $"));
726 _res = _PyPegen_make_module ( p , a );
727 if (_res == NULL && PyErr_Occurred()) {
728 p->error_indicator = 1;
729 D(p->level--);
730 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000731 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100732 goto done;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000733 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100734 p->mark = _mark;
735 D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ',
736 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000737 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100738 _res = NULL;
739 done:
740 D(p->level--);
741 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000742}
743
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100744// interactive: statement_newline
745static mod_ty
746interactive_rule(Parser *p)
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000747{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100748 D(p->level++);
749 if (p->error_indicator) {
750 D(p->level--);
751 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000752 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100753 mod_ty _res = NULL;
754 int _mark = p->mark;
755 { // statement_newline
756 if (p->error_indicator) {
757 D(p->level--);
758 return NULL;
759 }
760 D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline"));
761 asdl_seq* a;
762 if (
763 (a = statement_newline_rule(p)) // statement_newline
764 )
765 {
766 D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline"));
767 _res = Interactive ( a , p -> arena );
768 if (_res == NULL && PyErr_Occurred()) {
769 p->error_indicator = 1;
770 D(p->level--);
771 return NULL;
772 }
773 goto done;
774 }
775 p->mark = _mark;
776 D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ',
777 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline"));
778 }
779 _res = NULL;
780 done:
781 D(p->level--);
782 return _res;
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000783}
784
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100785// eval: expressions NEWLINE* $
786static mod_ty
787eval_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000788{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100789 D(p->level++);
790 if (p->error_indicator) {
791 D(p->level--);
792 return NULL;
793 }
794 mod_ty _res = NULL;
795 int _mark = p->mark;
796 { // expressions NEWLINE* $
797 if (p->error_indicator) {
798 D(p->level--);
799 return NULL;
800 }
801 D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
802 asdl_seq * _loop0_1_var;
803 expr_ty a;
804 Token * endmarker_var;
805 if (
806 (a = expressions_rule(p)) // expressions
807 &&
808 (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE*
809 &&
810 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
811 )
812 {
813 D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
814 _res = Expression ( a , p -> arena );
815 if (_res == NULL && PyErr_Occurred()) {
816 p->error_indicator = 1;
817 D(p->level--);
818 return NULL;
819 }
820 goto done;
821 }
822 p->mark = _mark;
823 D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ',
824 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $"));
825 }
826 _res = NULL;
827 done:
828 D(p->level--);
829 return _res;
830}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000831
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100832// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
833static mod_ty
834func_type_rule(Parser *p)
835{
836 D(p->level++);
837 if (p->error_indicator) {
838 D(p->level--);
839 return NULL;
840 }
841 mod_ty _res = NULL;
842 int _mark = p->mark;
843 { // '(' type_expressions? ')' '->' expression NEWLINE* $
844 if (p->error_indicator) {
845 D(p->level--);
846 return NULL;
847 }
848 D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
849 Token * _literal;
850 Token * _literal_1;
851 Token * _literal_2;
852 asdl_seq * _loop0_2_var;
853 void *a;
854 expr_ty b;
855 Token * endmarker_var;
856 if (
857 (_literal = _PyPegen_expect_token(p, 7)) // token='('
858 &&
859 (a = type_expressions_rule(p), 1) // type_expressions?
860 &&
861 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
862 &&
863 (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->'
864 &&
865 (b = expression_rule(p)) // expression
866 &&
867 (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE*
868 &&
869 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
870 )
871 {
872 D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
873 _res = FunctionType ( a , b , p -> arena );
874 if (_res == NULL && PyErr_Occurred()) {
875 p->error_indicator = 1;
876 D(p->level--);
877 return NULL;
878 }
879 goto done;
880 }
881 p->mark = _mark;
882 D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ',
883 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
884 }
885 _res = NULL;
886 done:
887 D(p->level--);
888 return _res;
889}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000890
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100891// fstring: star_expressions
892static expr_ty
893fstring_rule(Parser *p)
894{
895 D(p->level++);
896 if (p->error_indicator) {
897 D(p->level--);
898 return NULL;
899 }
900 expr_ty _res = NULL;
901 int _mark = p->mark;
902 { // star_expressions
903 if (p->error_indicator) {
904 D(p->level--);
905 return NULL;
906 }
907 D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
908 expr_ty star_expressions_var;
909 if (
910 (star_expressions_var = star_expressions_rule(p)) // star_expressions
911 )
912 {
913 D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
914 _res = star_expressions_var;
915 goto done;
916 }
917 p->mark = _mark;
918 D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ',
919 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
920 }
921 _res = NULL;
922 done:
923 D(p->level--);
924 return _res;
925}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000926
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100927// type_expressions:
928// | ','.expression+ ',' '*' expression ',' '**' expression
929// | ','.expression+ ',' '*' expression
930// | ','.expression+ ',' '**' expression
931// | '*' expression ',' '**' expression
932// | '*' expression
933// | '**' expression
934// | ','.expression+
935static asdl_seq*
936type_expressions_rule(Parser *p)
937{
938 D(p->level++);
939 if (p->error_indicator) {
940 D(p->level--);
941 return NULL;
942 }
943 asdl_seq* _res = NULL;
944 int _mark = p->mark;
945 { // ','.expression+ ',' '*' expression ',' '**' expression
946 if (p->error_indicator) {
947 D(p->level--);
948 return NULL;
949 }
950 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
951 Token * _literal;
952 Token * _literal_1;
953 Token * _literal_2;
954 Token * _literal_3;
955 asdl_seq * a;
956 expr_ty b;
957 expr_ty c;
958 if (
959 (a = _gather_3_rule(p)) // ','.expression+
960 &&
961 (_literal = _PyPegen_expect_token(p, 12)) // token=','
962 &&
963 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
964 &&
965 (b = expression_rule(p)) // expression
966 &&
967 (_literal_2 = _PyPegen_expect_token(p, 12)) // token=','
968 &&
969 (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**'
970 &&
971 (c = expression_rule(p)) // expression
972 )
973 {
974 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
975 _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
976 if (_res == NULL && PyErr_Occurred()) {
977 p->error_indicator = 1;
978 D(p->level--);
979 return NULL;
980 }
981 goto done;
982 }
983 p->mark = _mark;
984 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
985 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
986 }
987 { // ','.expression+ ',' '*' expression
988 if (p->error_indicator) {
989 D(p->level--);
990 return NULL;
991 }
992 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
993 Token * _literal;
994 Token * _literal_1;
995 asdl_seq * a;
996 expr_ty b;
997 if (
998 (a = _gather_5_rule(p)) // ','.expression+
999 &&
1000 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1001 &&
1002 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
1003 &&
1004 (b = expression_rule(p)) // expression
1005 )
1006 {
1007 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
1008 _res = _PyPegen_seq_append_to_end ( p , a , b );
1009 if (_res == NULL && PyErr_Occurred()) {
1010 p->error_indicator = 1;
1011 D(p->level--);
1012 return NULL;
1013 }
1014 goto done;
1015 }
1016 p->mark = _mark;
1017 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1018 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
1019 }
1020 { // ','.expression+ ',' '**' expression
1021 if (p->error_indicator) {
1022 D(p->level--);
1023 return NULL;
1024 }
1025 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
1026 Token * _literal;
1027 Token * _literal_1;
1028 asdl_seq * a;
1029 expr_ty b;
1030 if (
1031 (a = _gather_7_rule(p)) // ','.expression+
1032 &&
1033 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1034 &&
1035 (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**'
1036 &&
1037 (b = expression_rule(p)) // expression
1038 )
1039 {
1040 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
1041 _res = _PyPegen_seq_append_to_end ( p , a , b );
1042 if (_res == NULL && PyErr_Occurred()) {
1043 p->error_indicator = 1;
1044 D(p->level--);
1045 return NULL;
1046 }
1047 goto done;
1048 }
1049 p->mark = _mark;
1050 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1051 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
1052 }
1053 { // '*' expression ',' '**' expression
1054 if (p->error_indicator) {
1055 D(p->level--);
1056 return NULL;
1057 }
1058 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
1059 Token * _literal;
1060 Token * _literal_1;
1061 Token * _literal_2;
1062 expr_ty a;
1063 expr_ty b;
1064 if (
1065 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1066 &&
1067 (a = expression_rule(p)) // expression
1068 &&
1069 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
1070 &&
1071 (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**'
1072 &&
1073 (b = expression_rule(p)) // expression
1074 )
1075 {
1076 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
1077 _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b );
1078 if (_res == NULL && PyErr_Occurred()) {
1079 p->error_indicator = 1;
1080 D(p->level--);
1081 return NULL;
1082 }
1083 goto done;
1084 }
1085 p->mark = _mark;
1086 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1087 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
1088 }
1089 { // '*' expression
1090 if (p->error_indicator) {
1091 D(p->level--);
1092 return NULL;
1093 }
1094 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
1095 Token * _literal;
1096 expr_ty a;
1097 if (
1098 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1099 &&
1100 (a = expression_rule(p)) // expression
1101 )
1102 {
1103 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
1104 _res = _PyPegen_singleton_seq ( p , a );
1105 if (_res == NULL && PyErr_Occurred()) {
1106 p->error_indicator = 1;
1107 D(p->level--);
1108 return NULL;
1109 }
1110 goto done;
1111 }
1112 p->mark = _mark;
1113 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1114 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
1115 }
1116 { // '**' expression
1117 if (p->error_indicator) {
1118 D(p->level--);
1119 return NULL;
1120 }
1121 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
1122 Token * _literal;
1123 expr_ty a;
1124 if (
1125 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
1126 &&
1127 (a = expression_rule(p)) // expression
1128 )
1129 {
1130 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
1131 _res = _PyPegen_singleton_seq ( p , a );
1132 if (_res == NULL && PyErr_Occurred()) {
1133 p->error_indicator = 1;
1134 D(p->level--);
1135 return NULL;
1136 }
1137 goto done;
1138 }
1139 p->mark = _mark;
1140 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1141 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
1142 }
1143 { // ','.expression+
1144 if (p->error_indicator) {
1145 D(p->level--);
1146 return NULL;
1147 }
1148 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
1149 asdl_seq * _gather_9_var;
1150 if (
1151 (_gather_9_var = _gather_9_rule(p)) // ','.expression+
1152 )
1153 {
1154 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
1155 _res = _gather_9_var;
1156 goto done;
1157 }
1158 p->mark = _mark;
1159 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1160 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
1161 }
1162 _res = NULL;
1163 done:
1164 D(p->level--);
1165 return _res;
1166}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001167
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001168// statements: statement+
1169static asdl_seq*
1170statements_rule(Parser *p)
1171{
1172 D(p->level++);
1173 if (p->error_indicator) {
1174 D(p->level--);
1175 return NULL;
1176 }
1177 asdl_seq* _res = NULL;
1178 int _mark = p->mark;
1179 { // statement+
1180 if (p->error_indicator) {
1181 D(p->level--);
1182 return NULL;
1183 }
1184 D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
1185 asdl_seq * a;
1186 if (
1187 (a = _loop1_11_rule(p)) // statement+
1188 )
1189 {
1190 D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
1191 _res = _PyPegen_seq_flatten ( p , a );
1192 if (_res == NULL && PyErr_Occurred()) {
1193 p->error_indicator = 1;
1194 D(p->level--);
1195 return NULL;
1196 }
1197 goto done;
1198 }
1199 p->mark = _mark;
1200 D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ',
1201 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+"));
1202 }
1203 _res = NULL;
1204 done:
1205 D(p->level--);
1206 return _res;
1207}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001208
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001209// statement: compound_stmt | simple_stmt
1210static asdl_seq*
1211statement_rule(Parser *p)
1212{
1213 D(p->level++);
1214 if (p->error_indicator) {
1215 D(p->level--);
1216 return NULL;
1217 }
1218 asdl_seq* _res = NULL;
1219 int _mark = p->mark;
1220 { // compound_stmt
1221 if (p->error_indicator) {
1222 D(p->level--);
1223 return NULL;
1224 }
1225 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
1226 stmt_ty a;
1227 if (
1228 (a = compound_stmt_rule(p)) // compound_stmt
1229 )
1230 {
1231 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
1232 _res = _PyPegen_singleton_seq ( p , a );
1233 if (_res == NULL && PyErr_Occurred()) {
1234 p->error_indicator = 1;
1235 D(p->level--);
1236 return NULL;
1237 }
1238 goto done;
1239 }
1240 p->mark = _mark;
1241 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1242 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt"));
1243 }
1244 { // simple_stmt
1245 if (p->error_indicator) {
1246 D(p->level--);
1247 return NULL;
1248 }
1249 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1250 asdl_seq* simple_stmt_var;
1251 if (
1252 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
1253 )
1254 {
1255 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1256 _res = simple_stmt_var;
1257 goto done;
1258 }
1259 p->mark = _mark;
1260 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1261 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1262 }
1263 _res = NULL;
1264 done:
1265 D(p->level--);
1266 return _res;
1267}
1268
1269// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
1270static asdl_seq*
1271statement_newline_rule(Parser *p)
1272{
1273 D(p->level++);
1274 if (p->error_indicator) {
1275 D(p->level--);
1276 return NULL;
1277 }
1278 asdl_seq* _res = NULL;
1279 int _mark = p->mark;
1280 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1281 p->error_indicator = 1;
1282 D(p->level--);
1283 return NULL;
1284 }
1285 int _start_lineno = p->tokens[_mark]->lineno;
1286 UNUSED(_start_lineno); // Only used by EXTRA macro
1287 int _start_col_offset = p->tokens[_mark]->col_offset;
1288 UNUSED(_start_col_offset); // Only used by EXTRA macro
1289 { // compound_stmt NEWLINE
1290 if (p->error_indicator) {
1291 D(p->level--);
1292 return NULL;
1293 }
1294 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
1295 stmt_ty a;
1296 Token * newline_var;
1297 if (
1298 (a = compound_stmt_rule(p)) // compound_stmt
1299 &&
1300 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1301 )
1302 {
1303 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
1304 _res = _PyPegen_singleton_seq ( p , a );
1305 if (_res == NULL && PyErr_Occurred()) {
1306 p->error_indicator = 1;
1307 D(p->level--);
1308 return NULL;
1309 }
1310 goto done;
1311 }
1312 p->mark = _mark;
1313 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1314 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE"));
1315 }
1316 { // simple_stmt
1317 if (p->error_indicator) {
1318 D(p->level--);
1319 return NULL;
1320 }
1321 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1322 asdl_seq* simple_stmt_var;
1323 if (
1324 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
1325 )
1326 {
1327 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1328 _res = simple_stmt_var;
1329 goto done;
1330 }
1331 p->mark = _mark;
1332 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1333 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1334 }
1335 { // NEWLINE
1336 if (p->error_indicator) {
1337 D(p->level--);
1338 return NULL;
1339 }
1340 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1341 Token * newline_var;
1342 if (
1343 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1344 )
1345 {
1346 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1347 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1348 if (_token == NULL) {
1349 D(p->level--);
1350 return NULL;
1351 }
1352 int _end_lineno = _token->end_lineno;
1353 UNUSED(_end_lineno); // Only used by EXTRA macro
1354 int _end_col_offset = _token->end_col_offset;
1355 UNUSED(_end_col_offset); // Only used by EXTRA macro
1356 _res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
1357 if (_res == NULL && PyErr_Occurred()) {
1358 p->error_indicator = 1;
1359 D(p->level--);
1360 return NULL;
1361 }
1362 goto done;
1363 }
1364 p->mark = _mark;
1365 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1366 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
1367 }
1368 { // $
1369 if (p->error_indicator) {
1370 D(p->level--);
1371 return NULL;
1372 }
1373 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$"));
1374 Token * endmarker_var;
1375 if (
1376 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
1377 )
1378 {
1379 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
1380 _res = _PyPegen_interactive_exit ( p );
1381 if (_res == NULL && PyErr_Occurred()) {
1382 p->error_indicator = 1;
1383 D(p->level--);
1384 return NULL;
1385 }
1386 goto done;
1387 }
1388 p->mark = _mark;
1389 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1390 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$"));
1391 }
1392 _res = NULL;
1393 done:
1394 D(p->level--);
1395 return _res;
1396}
1397
1398// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
1399static asdl_seq*
1400simple_stmt_rule(Parser *p)
1401{
1402 D(p->level++);
1403 if (p->error_indicator) {
1404 D(p->level--);
1405 return NULL;
1406 }
1407 asdl_seq* _res = NULL;
1408 int _mark = p->mark;
1409 { // small_stmt !';' NEWLINE
1410 if (p->error_indicator) {
1411 D(p->level--);
1412 return NULL;
1413 }
1414 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
1415 stmt_ty a;
1416 Token * newline_var;
1417 if (
1418 (a = small_stmt_rule(p)) // small_stmt
1419 &&
1420 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';'
1421 &&
1422 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1423 )
1424 {
1425 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
1426 _res = _PyPegen_singleton_seq ( p , a );
1427 if (_res == NULL && PyErr_Occurred()) {
1428 p->error_indicator = 1;
1429 D(p->level--);
1430 return NULL;
1431 }
1432 goto done;
1433 }
1434 p->mark = _mark;
1435 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1436 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt !';' NEWLINE"));
1437 }
1438 { // ';'.small_stmt+ ';'? NEWLINE
1439 if (p->error_indicator) {
1440 D(p->level--);
1441 return NULL;
1442 }
1443 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1444 void *_opt_var;
1445 UNUSED(_opt_var); // Silence compiler warnings
1446 asdl_seq * a;
1447 Token * newline_var;
1448 if (
1449 (a = _gather_12_rule(p)) // ';'.small_stmt+
1450 &&
1451 (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'?
1452 &&
1453 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1454 )
1455 {
1456 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1457 _res = a;
1458 if (_res == NULL && PyErr_Occurred()) {
1459 p->error_indicator = 1;
1460 D(p->level--);
1461 return NULL;
1462 }
1463 goto done;
1464 }
1465 p->mark = _mark;
1466 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1467 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1468 }
1469 _res = NULL;
1470 done:
1471 D(p->level--);
1472 return _res;
1473}
1474
1475// small_stmt:
1476// | assignment
1477// | star_expressions
1478// | &'return' return_stmt
1479// | &('import' | 'from') import_stmt
1480// | &'raise' raise_stmt
1481// | 'pass'
1482// | &'del' del_stmt
1483// | &'yield' yield_stmt
1484// | &'assert' assert_stmt
1485// | 'break'
1486// | 'continue'
1487// | &'global' global_stmt
1488// | &'nonlocal' nonlocal_stmt
1489static stmt_ty
1490small_stmt_rule(Parser *p)
1491{
1492 D(p->level++);
1493 if (p->error_indicator) {
1494 D(p->level--);
1495 return NULL;
1496 }
1497 stmt_ty _res = NULL;
1498 if (_PyPegen_is_memoized(p, small_stmt_type, &_res)) {
1499 D(p->level--);
1500 return _res;
1501 }
1502 int _mark = p->mark;
1503 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1504 p->error_indicator = 1;
1505 D(p->level--);
1506 return NULL;
1507 }
1508 int _start_lineno = p->tokens[_mark]->lineno;
1509 UNUSED(_start_lineno); // Only used by EXTRA macro
1510 int _start_col_offset = p->tokens[_mark]->col_offset;
1511 UNUSED(_start_col_offset); // Only used by EXTRA macro
1512 { // assignment
1513 if (p->error_indicator) {
1514 D(p->level--);
1515 return NULL;
1516 }
1517 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment"));
1518 stmt_ty assignment_var;
1519 if (
1520 (assignment_var = assignment_rule(p)) // assignment
1521 )
1522 {
1523 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment"));
1524 _res = assignment_var;
1525 goto done;
1526 }
1527 p->mark = _mark;
1528 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1529 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment"));
1530 }
1531 { // star_expressions
1532 if (p->error_indicator) {
1533 D(p->level--);
1534 return NULL;
1535 }
1536 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1537 expr_ty e;
1538 if (
1539 (e = star_expressions_rule(p)) // star_expressions
1540 )
1541 {
1542 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1543 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1544 if (_token == NULL) {
1545 D(p->level--);
1546 return NULL;
1547 }
1548 int _end_lineno = _token->end_lineno;
1549 UNUSED(_end_lineno); // Only used by EXTRA macro
1550 int _end_col_offset = _token->end_col_offset;
1551 UNUSED(_end_col_offset); // Only used by EXTRA macro
1552 _res = _Py_Expr ( e , EXTRA );
1553 if (_res == NULL && PyErr_Occurred()) {
1554 p->error_indicator = 1;
1555 D(p->level--);
1556 return NULL;
1557 }
1558 goto done;
1559 }
1560 p->mark = _mark;
1561 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1562 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
1563 }
1564 { // &'return' return_stmt
1565 if (p->error_indicator) {
1566 D(p->level--);
1567 return NULL;
1568 }
1569 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1570 stmt_ty return_stmt_var;
1571 if (
1572 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return'
1573 &&
1574 (return_stmt_var = return_stmt_rule(p)) // return_stmt
1575 )
1576 {
1577 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1578 _res = return_stmt_var;
1579 goto done;
1580 }
1581 p->mark = _mark;
1582 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1583 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt"));
1584 }
1585 { // &('import' | 'from') import_stmt
1586 if (p->error_indicator) {
1587 D(p->level--);
1588 return NULL;
1589 }
1590 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1591 stmt_ty import_stmt_var;
1592 if (
1593 _PyPegen_lookahead(1, _tmp_14_rule, p)
1594 &&
1595 (import_stmt_var = import_stmt_rule(p)) // import_stmt
1596 )
1597 {
1598 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1599 _res = import_stmt_var;
1600 goto done;
1601 }
1602 p->mark = _mark;
1603 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1604 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt"));
1605 }
1606 { // &'raise' raise_stmt
1607 if (p->error_indicator) {
1608 D(p->level--);
1609 return NULL;
1610 }
1611 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1612 stmt_ty raise_stmt_var;
1613 if (
1614 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise'
1615 &&
1616 (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt
1617 )
1618 {
1619 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1620 _res = raise_stmt_var;
1621 goto done;
1622 }
1623 p->mark = _mark;
1624 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1625 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt"));
1626 }
1627 { // 'pass'
1628 if (p->error_indicator) {
1629 D(p->level--);
1630 return NULL;
1631 }
1632 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'"));
1633 Token * _keyword;
1634 if (
1635 (_keyword = _PyPegen_expect_token(p, 502)) // token='pass'
1636 )
1637 {
1638 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'"));
1639 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1640 if (_token == NULL) {
1641 D(p->level--);
1642 return NULL;
1643 }
1644 int _end_lineno = _token->end_lineno;
1645 UNUSED(_end_lineno); // Only used by EXTRA macro
1646 int _end_col_offset = _token->end_col_offset;
1647 UNUSED(_end_col_offset); // Only used by EXTRA macro
1648 _res = _Py_Pass ( EXTRA );
1649 if (_res == NULL && PyErr_Occurred()) {
1650 p->error_indicator = 1;
1651 D(p->level--);
1652 return NULL;
1653 }
1654 goto done;
1655 }
1656 p->mark = _mark;
1657 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1658 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'"));
1659 }
1660 { // &'del' del_stmt
1661 if (p->error_indicator) {
1662 D(p->level--);
1663 return NULL;
1664 }
1665 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1666 stmt_ty del_stmt_var;
1667 if (
1668 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del'
1669 &&
1670 (del_stmt_var = del_stmt_rule(p)) // del_stmt
1671 )
1672 {
1673 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1674 _res = del_stmt_var;
1675 goto done;
1676 }
1677 p->mark = _mark;
1678 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1679 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt"));
1680 }
1681 { // &'yield' yield_stmt
1682 if (p->error_indicator) {
1683 D(p->level--);
1684 return NULL;
1685 }
1686 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1687 stmt_ty yield_stmt_var;
1688 if (
1689 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield'
1690 &&
1691 (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt
1692 )
1693 {
1694 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1695 _res = yield_stmt_var;
1696 goto done;
1697 }
1698 p->mark = _mark;
1699 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1700 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt"));
1701 }
1702 { // &'assert' assert_stmt
1703 if (p->error_indicator) {
1704 D(p->level--);
1705 return NULL;
1706 }
1707 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1708 stmt_ty assert_stmt_var;
1709 if (
1710 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert'
1711 &&
1712 (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt
1713 )
1714 {
1715 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1716 _res = assert_stmt_var;
1717 goto done;
1718 }
1719 p->mark = _mark;
1720 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1721 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt"));
1722 }
1723 { // 'break'
1724 if (p->error_indicator) {
1725 D(p->level--);
1726 return NULL;
1727 }
1728 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'"));
1729 Token * _keyword;
1730 if (
1731 (_keyword = _PyPegen_expect_token(p, 506)) // token='break'
1732 )
1733 {
1734 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'"));
1735 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1736 if (_token == NULL) {
1737 D(p->level--);
1738 return NULL;
1739 }
1740 int _end_lineno = _token->end_lineno;
1741 UNUSED(_end_lineno); // Only used by EXTRA macro
1742 int _end_col_offset = _token->end_col_offset;
1743 UNUSED(_end_col_offset); // Only used by EXTRA macro
1744 _res = _Py_Break ( EXTRA );
1745 if (_res == NULL && PyErr_Occurred()) {
1746 p->error_indicator = 1;
1747 D(p->level--);
1748 return NULL;
1749 }
1750 goto done;
1751 }
1752 p->mark = _mark;
1753 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1754 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'"));
1755 }
1756 { // 'continue'
1757 if (p->error_indicator) {
1758 D(p->level--);
1759 return NULL;
1760 }
1761 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'"));
1762 Token * _keyword;
1763 if (
1764 (_keyword = _PyPegen_expect_token(p, 507)) // token='continue'
1765 )
1766 {
1767 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'"));
1768 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1769 if (_token == NULL) {
1770 D(p->level--);
1771 return NULL;
1772 }
1773 int _end_lineno = _token->end_lineno;
1774 UNUSED(_end_lineno); // Only used by EXTRA macro
1775 int _end_col_offset = _token->end_col_offset;
1776 UNUSED(_end_col_offset); // Only used by EXTRA macro
1777 _res = _Py_Continue ( EXTRA );
1778 if (_res == NULL && PyErr_Occurred()) {
1779 p->error_indicator = 1;
1780 D(p->level--);
1781 return NULL;
1782 }
1783 goto done;
1784 }
1785 p->mark = _mark;
1786 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1787 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'"));
1788 }
1789 { // &'global' global_stmt
1790 if (p->error_indicator) {
1791 D(p->level--);
1792 return NULL;
1793 }
1794 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1795 stmt_ty global_stmt_var;
1796 if (
1797 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global'
1798 &&
1799 (global_stmt_var = global_stmt_rule(p)) // global_stmt
1800 )
1801 {
1802 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1803 _res = global_stmt_var;
1804 goto done;
1805 }
1806 p->mark = _mark;
1807 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1808 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt"));
1809 }
1810 { // &'nonlocal' nonlocal_stmt
1811 if (p->error_indicator) {
1812 D(p->level--);
1813 return NULL;
1814 }
1815 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1816 stmt_ty nonlocal_stmt_var;
1817 if (
1818 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal'
1819 &&
1820 (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt
1821 )
1822 {
1823 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1824 _res = nonlocal_stmt_var;
1825 goto done;
1826 }
1827 p->mark = _mark;
1828 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1829 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1830 }
1831 _res = NULL;
1832 done:
1833 _PyPegen_insert_memo(p, _mark, small_stmt_type, _res);
1834 D(p->level--);
1835 return _res;
1836}
1837
1838// compound_stmt:
1839// | &('def' | '@' | ASYNC) function_def
1840// | &'if' if_stmt
1841// | &('class' | '@') class_def
1842// | &('with' | ASYNC) with_stmt
1843// | &('for' | ASYNC) for_stmt
1844// | &'try' try_stmt
1845// | &'while' while_stmt
1846static stmt_ty
1847compound_stmt_rule(Parser *p)
1848{
1849 D(p->level++);
1850 if (p->error_indicator) {
1851 D(p->level--);
1852 return NULL;
1853 }
1854 stmt_ty _res = NULL;
1855 int _mark = p->mark;
1856 { // &('def' | '@' | ASYNC) function_def
1857 if (p->error_indicator) {
1858 D(p->level--);
1859 return NULL;
1860 }
1861 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1862 stmt_ty function_def_var;
1863 if (
1864 _PyPegen_lookahead(1, _tmp_15_rule, p)
1865 &&
1866 (function_def_var = function_def_rule(p)) // function_def
1867 )
1868 {
1869 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1870 _res = function_def_var;
1871 goto done;
1872 }
1873 p->mark = _mark;
1874 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1875 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1876 }
1877 { // &'if' if_stmt
1878 if (p->error_indicator) {
1879 D(p->level--);
1880 return NULL;
1881 }
1882 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1883 stmt_ty if_stmt_var;
1884 if (
1885 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if'
1886 &&
1887 (if_stmt_var = if_stmt_rule(p)) // if_stmt
1888 )
1889 {
1890 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1891 _res = if_stmt_var;
1892 goto done;
1893 }
1894 p->mark = _mark;
1895 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1896 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt"));
1897 }
1898 { // &('class' | '@') class_def
1899 if (p->error_indicator) {
1900 D(p->level--);
1901 return NULL;
1902 }
1903 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1904 stmt_ty class_def_var;
1905 if (
1906 _PyPegen_lookahead(1, _tmp_16_rule, p)
1907 &&
1908 (class_def_var = class_def_rule(p)) // class_def
1909 )
1910 {
1911 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1912 _res = class_def_var;
1913 goto done;
1914 }
1915 p->mark = _mark;
1916 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1917 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def"));
1918 }
1919 { // &('with' | ASYNC) with_stmt
1920 if (p->error_indicator) {
1921 D(p->level--);
1922 return NULL;
1923 }
1924 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1925 stmt_ty with_stmt_var;
1926 if (
1927 _PyPegen_lookahead(1, _tmp_17_rule, p)
1928 &&
1929 (with_stmt_var = with_stmt_rule(p)) // with_stmt
1930 )
1931 {
1932 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1933 _res = with_stmt_var;
1934 goto done;
1935 }
1936 p->mark = _mark;
1937 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1938 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1939 }
1940 { // &('for' | ASYNC) for_stmt
1941 if (p->error_indicator) {
1942 D(p->level--);
1943 return NULL;
1944 }
1945 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1946 stmt_ty for_stmt_var;
1947 if (
1948 _PyPegen_lookahead(1, _tmp_18_rule, p)
1949 &&
1950 (for_stmt_var = for_stmt_rule(p)) // for_stmt
1951 )
1952 {
1953 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1954 _res = for_stmt_var;
1955 goto done;
1956 }
1957 p->mark = _mark;
1958 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1959 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1960 }
1961 { // &'try' try_stmt
1962 if (p->error_indicator) {
1963 D(p->level--);
1964 return NULL;
1965 }
1966 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1967 stmt_ty try_stmt_var;
1968 if (
1969 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try'
1970 &&
1971 (try_stmt_var = try_stmt_rule(p)) // try_stmt
1972 )
1973 {
1974 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1975 _res = try_stmt_var;
1976 goto done;
1977 }
1978 p->mark = _mark;
1979 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1980 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt"));
1981 }
1982 { // &'while' while_stmt
1983 if (p->error_indicator) {
1984 D(p->level--);
1985 return NULL;
1986 }
1987 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
1988 stmt_ty while_stmt_var;
1989 if (
1990 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while'
1991 &&
1992 (while_stmt_var = while_stmt_rule(p)) // while_stmt
1993 )
1994 {
1995 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
1996 _res = while_stmt_var;
1997 goto done;
1998 }
1999 p->mark = _mark;
2000 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2001 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt"));
2002 }
2003 _res = NULL;
2004 done:
2005 D(p->level--);
2006 return _res;
2007}
2008
2009// assignment:
2010// | NAME ':' expression ['=' annotated_rhs]
2011// | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2012// | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002013// | single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002014// | invalid_assignment
2015static stmt_ty
2016assignment_rule(Parser *p)
2017{
2018 D(p->level++);
2019 if (p->error_indicator) {
2020 D(p->level--);
2021 return NULL;
2022 }
2023 stmt_ty _res = NULL;
2024 int _mark = p->mark;
2025 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2026 p->error_indicator = 1;
2027 D(p->level--);
2028 return NULL;
2029 }
2030 int _start_lineno = p->tokens[_mark]->lineno;
2031 UNUSED(_start_lineno); // Only used by EXTRA macro
2032 int _start_col_offset = p->tokens[_mark]->col_offset;
2033 UNUSED(_start_col_offset); // Only used by EXTRA macro
2034 { // NAME ':' expression ['=' annotated_rhs]
2035 if (p->error_indicator) {
2036 D(p->level--);
2037 return NULL;
2038 }
2039 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2040 Token * _literal;
2041 expr_ty a;
2042 expr_ty b;
2043 void *c;
2044 if (
2045 (a = _PyPegen_name_token(p)) // NAME
2046 &&
2047 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2048 &&
2049 (b = expression_rule(p)) // expression
2050 &&
2051 (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs]
2052 )
2053 {
2054 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2055 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2056 if (_token == NULL) {
2057 D(p->level--);
2058 return NULL;
2059 }
2060 int _end_lineno = _token->end_lineno;
2061 UNUSED(_end_lineno); // Only used by EXTRA macro
2062 int _end_col_offset = _token->end_col_offset;
2063 UNUSED(_end_col_offset); // Only used by EXTRA macro
2064 _res = CHECK_VERSION ( 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
2065 if (_res == NULL && PyErr_Occurred()) {
2066 p->error_indicator = 1;
2067 D(p->level--);
2068 return NULL;
2069 }
2070 goto done;
2071 }
2072 p->mark = _mark;
2073 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2074 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2075 }
2076 { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2077 if (p->error_indicator) {
2078 D(p->level--);
2079 return NULL;
2080 }
2081 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2082 Token * _literal;
2083 void *a;
2084 expr_ty b;
2085 void *c;
2086 if (
2087 (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
2088 &&
2089 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2090 &&
2091 (b = expression_rule(p)) // expression
2092 &&
2093 (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs]
2094 )
2095 {
2096 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2097 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2098 if (_token == NULL) {
2099 D(p->level--);
2100 return NULL;
2101 }
2102 int _end_lineno = _token->end_lineno;
2103 UNUSED(_end_lineno); // Only used by EXTRA macro
2104 int _end_col_offset = _token->end_col_offset;
2105 UNUSED(_end_col_offset); // Only used by EXTRA macro
2106 _res = CHECK_VERSION ( 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) );
2107 if (_res == NULL && PyErr_Occurred()) {
2108 p->error_indicator = 1;
2109 D(p->level--);
2110 return NULL;
2111 }
2112 goto done;
2113 }
2114 p->mark = _mark;
2115 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2116 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2117 }
2118 { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
2119 if (p->error_indicator) {
2120 D(p->level--);
2121 return NULL;
2122 }
2123 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2124 asdl_seq * a;
2125 void *b;
2126 void *tc;
2127 if (
2128 (a = _loop1_22_rule(p)) // ((star_targets '='))+
2129 &&
2130 (b = _tmp_23_rule(p)) // yield_expr | star_expressions
2131 &&
2132 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
2133 &&
2134 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
2135 )
2136 {
2137 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2138 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2139 if (_token == NULL) {
2140 D(p->level--);
2141 return NULL;
2142 }
2143 int _end_lineno = _token->end_lineno;
2144 UNUSED(_end_lineno); // Only used by EXTRA macro
2145 int _end_col_offset = _token->end_col_offset;
2146 UNUSED(_end_col_offset); // Only used by EXTRA macro
2147 _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
2148 if (_res == NULL && PyErr_Occurred()) {
2149 p->error_indicator = 1;
2150 D(p->level--);
2151 return NULL;
2152 }
2153 goto done;
2154 }
2155 p->mark = _mark;
2156 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2157 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2158 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002159 { // single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002160 if (p->error_indicator) {
2161 D(p->level--);
2162 return NULL;
2163 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002164 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2165 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002166 expr_ty a;
2167 AugOperator* b;
2168 void *c;
2169 if (
2170 (a = single_target_rule(p)) // single_target
2171 &&
2172 (b = augassign_rule(p)) // augassign
2173 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002174 (_cut_var = 1)
2175 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002176 (c = _tmp_24_rule(p)) // yield_expr | star_expressions
2177 )
2178 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002179 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 +01002180 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2181 if (_token == NULL) {
2182 D(p->level--);
2183 return NULL;
2184 }
2185 int _end_lineno = _token->end_lineno;
2186 UNUSED(_end_lineno); // Only used by EXTRA macro
2187 int _end_col_offset = _token->end_col_offset;
2188 UNUSED(_end_col_offset); // Only used by EXTRA macro
2189 _res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
2190 if (_res == NULL && PyErr_Occurred()) {
2191 p->error_indicator = 1;
2192 D(p->level--);
2193 return NULL;
2194 }
2195 goto done;
2196 }
2197 p->mark = _mark;
2198 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002199 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2200 if (_cut_var) {
2201 D(p->level--);
2202 return NULL;
2203 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002204 }
2205 { // invalid_assignment
2206 if (p->error_indicator) {
2207 D(p->level--);
2208 return NULL;
2209 }
2210 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2211 void *invalid_assignment_var;
2212 if (
2213 (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment
2214 )
2215 {
2216 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2217 _res = invalid_assignment_var;
2218 goto done;
2219 }
2220 p->mark = _mark;
2221 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2222 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment"));
2223 }
2224 _res = NULL;
2225 done:
2226 D(p->level--);
2227 return _res;
2228}
2229
2230// augassign:
2231// | '+='
2232// | '-='
2233// | '*='
2234// | '@='
2235// | '/='
2236// | '%='
2237// | '&='
2238// | '|='
2239// | '^='
2240// | '<<='
2241// | '>>='
2242// | '**='
2243// | '//='
2244static AugOperator*
2245augassign_rule(Parser *p)
2246{
2247 D(p->level++);
2248 if (p->error_indicator) {
2249 D(p->level--);
2250 return NULL;
2251 }
2252 AugOperator* _res = NULL;
2253 int _mark = p->mark;
2254 { // '+='
2255 if (p->error_indicator) {
2256 D(p->level--);
2257 return NULL;
2258 }
2259 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='"));
2260 Token * _literal;
2261 if (
2262 (_literal = _PyPegen_expect_token(p, 36)) // token='+='
2263 )
2264 {
2265 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
2266 _res = _PyPegen_augoperator ( p , Add );
2267 if (_res == NULL && PyErr_Occurred()) {
2268 p->error_indicator = 1;
2269 D(p->level--);
2270 return NULL;
2271 }
2272 goto done;
2273 }
2274 p->mark = _mark;
2275 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2276 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='"));
2277 }
2278 { // '-='
2279 if (p->error_indicator) {
2280 D(p->level--);
2281 return NULL;
2282 }
2283 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='"));
2284 Token * _literal;
2285 if (
2286 (_literal = _PyPegen_expect_token(p, 37)) // token='-='
2287 )
2288 {
2289 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
2290 _res = _PyPegen_augoperator ( p , Sub );
2291 if (_res == NULL && PyErr_Occurred()) {
2292 p->error_indicator = 1;
2293 D(p->level--);
2294 return NULL;
2295 }
2296 goto done;
2297 }
2298 p->mark = _mark;
2299 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2300 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='"));
2301 }
2302 { // '*='
2303 if (p->error_indicator) {
2304 D(p->level--);
2305 return NULL;
2306 }
2307 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='"));
2308 Token * _literal;
2309 if (
2310 (_literal = _PyPegen_expect_token(p, 38)) // token='*='
2311 )
2312 {
2313 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
2314 _res = _PyPegen_augoperator ( p , Mult );
2315 if (_res == NULL && PyErr_Occurred()) {
2316 p->error_indicator = 1;
2317 D(p->level--);
2318 return NULL;
2319 }
2320 goto done;
2321 }
2322 p->mark = _mark;
2323 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2324 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='"));
2325 }
2326 { // '@='
2327 if (p->error_indicator) {
2328 D(p->level--);
2329 return NULL;
2330 }
2331 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='"));
2332 Token * _literal;
2333 if (
2334 (_literal = _PyPegen_expect_token(p, 50)) // token='@='
2335 )
2336 {
2337 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
2338 _res = CHECK_VERSION ( 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
2339 if (_res == NULL && PyErr_Occurred()) {
2340 p->error_indicator = 1;
2341 D(p->level--);
2342 return NULL;
2343 }
2344 goto done;
2345 }
2346 p->mark = _mark;
2347 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2348 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='"));
2349 }
2350 { // '/='
2351 if (p->error_indicator) {
2352 D(p->level--);
2353 return NULL;
2354 }
2355 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='"));
2356 Token * _literal;
2357 if (
2358 (_literal = _PyPegen_expect_token(p, 39)) // token='/='
2359 )
2360 {
2361 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
2362 _res = _PyPegen_augoperator ( p , Div );
2363 if (_res == NULL && PyErr_Occurred()) {
2364 p->error_indicator = 1;
2365 D(p->level--);
2366 return NULL;
2367 }
2368 goto done;
2369 }
2370 p->mark = _mark;
2371 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='"));
2373 }
2374 { // '%='
2375 if (p->error_indicator) {
2376 D(p->level--);
2377 return NULL;
2378 }
2379 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='"));
2380 Token * _literal;
2381 if (
2382 (_literal = _PyPegen_expect_token(p, 40)) // token='%='
2383 )
2384 {
2385 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
2386 _res = _PyPegen_augoperator ( p , Mod );
2387 if (_res == NULL && PyErr_Occurred()) {
2388 p->error_indicator = 1;
2389 D(p->level--);
2390 return NULL;
2391 }
2392 goto done;
2393 }
2394 p->mark = _mark;
2395 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2396 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='"));
2397 }
2398 { // '&='
2399 if (p->error_indicator) {
2400 D(p->level--);
2401 return NULL;
2402 }
2403 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='"));
2404 Token * _literal;
2405 if (
2406 (_literal = _PyPegen_expect_token(p, 41)) // token='&='
2407 )
2408 {
2409 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
2410 _res = _PyPegen_augoperator ( p , BitAnd );
2411 if (_res == NULL && PyErr_Occurred()) {
2412 p->error_indicator = 1;
2413 D(p->level--);
2414 return NULL;
2415 }
2416 goto done;
2417 }
2418 p->mark = _mark;
2419 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2420 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='"));
2421 }
2422 { // '|='
2423 if (p->error_indicator) {
2424 D(p->level--);
2425 return NULL;
2426 }
2427 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='"));
2428 Token * _literal;
2429 if (
2430 (_literal = _PyPegen_expect_token(p, 42)) // token='|='
2431 )
2432 {
2433 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
2434 _res = _PyPegen_augoperator ( p , BitOr );
2435 if (_res == NULL && PyErr_Occurred()) {
2436 p->error_indicator = 1;
2437 D(p->level--);
2438 return NULL;
2439 }
2440 goto done;
2441 }
2442 p->mark = _mark;
2443 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2444 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='"));
2445 }
2446 { // '^='
2447 if (p->error_indicator) {
2448 D(p->level--);
2449 return NULL;
2450 }
2451 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='"));
2452 Token * _literal;
2453 if (
2454 (_literal = _PyPegen_expect_token(p, 43)) // token='^='
2455 )
2456 {
2457 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
2458 _res = _PyPegen_augoperator ( p , BitXor );
2459 if (_res == NULL && PyErr_Occurred()) {
2460 p->error_indicator = 1;
2461 D(p->level--);
2462 return NULL;
2463 }
2464 goto done;
2465 }
2466 p->mark = _mark;
2467 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2468 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='"));
2469 }
2470 { // '<<='
2471 if (p->error_indicator) {
2472 D(p->level--);
2473 return NULL;
2474 }
2475 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='"));
2476 Token * _literal;
2477 if (
2478 (_literal = _PyPegen_expect_token(p, 44)) // token='<<='
2479 )
2480 {
2481 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
2482 _res = _PyPegen_augoperator ( p , LShift );
2483 if (_res == NULL && PyErr_Occurred()) {
2484 p->error_indicator = 1;
2485 D(p->level--);
2486 return NULL;
2487 }
2488 goto done;
2489 }
2490 p->mark = _mark;
2491 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2492 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='"));
2493 }
2494 { // '>>='
2495 if (p->error_indicator) {
2496 D(p->level--);
2497 return NULL;
2498 }
2499 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='"));
2500 Token * _literal;
2501 if (
2502 (_literal = _PyPegen_expect_token(p, 45)) // token='>>='
2503 )
2504 {
2505 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
2506 _res = _PyPegen_augoperator ( p , RShift );
2507 if (_res == NULL && PyErr_Occurred()) {
2508 p->error_indicator = 1;
2509 D(p->level--);
2510 return NULL;
2511 }
2512 goto done;
2513 }
2514 p->mark = _mark;
2515 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2516 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='"));
2517 }
2518 { // '**='
2519 if (p->error_indicator) {
2520 D(p->level--);
2521 return NULL;
2522 }
2523 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='"));
2524 Token * _literal;
2525 if (
2526 (_literal = _PyPegen_expect_token(p, 46)) // token='**='
2527 )
2528 {
2529 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
2530 _res = _PyPegen_augoperator ( p , Pow );
2531 if (_res == NULL && PyErr_Occurred()) {
2532 p->error_indicator = 1;
2533 D(p->level--);
2534 return NULL;
2535 }
2536 goto done;
2537 }
2538 p->mark = _mark;
2539 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2540 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='"));
2541 }
2542 { // '//='
2543 if (p->error_indicator) {
2544 D(p->level--);
2545 return NULL;
2546 }
2547 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='"));
2548 Token * _literal;
2549 if (
2550 (_literal = _PyPegen_expect_token(p, 48)) // token='//='
2551 )
2552 {
2553 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
2554 _res = _PyPegen_augoperator ( p , FloorDiv );
2555 if (_res == NULL && PyErr_Occurred()) {
2556 p->error_indicator = 1;
2557 D(p->level--);
2558 return NULL;
2559 }
2560 goto done;
2561 }
2562 p->mark = _mark;
2563 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2564 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='"));
2565 }
2566 _res = NULL;
2567 done:
2568 D(p->level--);
2569 return _res;
2570}
2571
2572// global_stmt: 'global' ','.NAME+
2573static stmt_ty
2574global_stmt_rule(Parser *p)
2575{
2576 D(p->level++);
2577 if (p->error_indicator) {
2578 D(p->level--);
2579 return NULL;
2580 }
2581 stmt_ty _res = NULL;
2582 int _mark = p->mark;
2583 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2584 p->error_indicator = 1;
2585 D(p->level--);
2586 return NULL;
2587 }
2588 int _start_lineno = p->tokens[_mark]->lineno;
2589 UNUSED(_start_lineno); // Only used by EXTRA macro
2590 int _start_col_offset = p->tokens[_mark]->col_offset;
2591 UNUSED(_start_col_offset); // Only used by EXTRA macro
2592 { // 'global' ','.NAME+
2593 if (p->error_indicator) {
2594 D(p->level--);
2595 return NULL;
2596 }
2597 D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2598 Token * _keyword;
2599 asdl_seq * a;
2600 if (
2601 (_keyword = _PyPegen_expect_token(p, 508)) // token='global'
2602 &&
2603 (a = _gather_25_rule(p)) // ','.NAME+
2604 )
2605 {
2606 D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2607 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2608 if (_token == NULL) {
2609 D(p->level--);
2610 return NULL;
2611 }
2612 int _end_lineno = _token->end_lineno;
2613 UNUSED(_end_lineno); // Only used by EXTRA macro
2614 int _end_col_offset = _token->end_col_offset;
2615 UNUSED(_end_col_offset); // Only used by EXTRA macro
2616 _res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2617 if (_res == NULL && PyErr_Occurred()) {
2618 p->error_indicator = 1;
2619 D(p->level--);
2620 return NULL;
2621 }
2622 goto done;
2623 }
2624 p->mark = _mark;
2625 D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2626 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
2627 }
2628 _res = NULL;
2629 done:
2630 D(p->level--);
2631 return _res;
2632}
2633
2634// nonlocal_stmt: 'nonlocal' ','.NAME+
2635static stmt_ty
2636nonlocal_stmt_rule(Parser *p)
2637{
2638 D(p->level++);
2639 if (p->error_indicator) {
2640 D(p->level--);
2641 return NULL;
2642 }
2643 stmt_ty _res = NULL;
2644 int _mark = p->mark;
2645 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2646 p->error_indicator = 1;
2647 D(p->level--);
2648 return NULL;
2649 }
2650 int _start_lineno = p->tokens[_mark]->lineno;
2651 UNUSED(_start_lineno); // Only used by EXTRA macro
2652 int _start_col_offset = p->tokens[_mark]->col_offset;
2653 UNUSED(_start_col_offset); // Only used by EXTRA macro
2654 { // 'nonlocal' ','.NAME+
2655 if (p->error_indicator) {
2656 D(p->level--);
2657 return NULL;
2658 }
2659 D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2660 Token * _keyword;
2661 asdl_seq * a;
2662 if (
2663 (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal'
2664 &&
2665 (a = _gather_27_rule(p)) // ','.NAME+
2666 )
2667 {
2668 D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2669 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2670 if (_token == NULL) {
2671 D(p->level--);
2672 return NULL;
2673 }
2674 int _end_lineno = _token->end_lineno;
2675 UNUSED(_end_lineno); // Only used by EXTRA macro
2676 int _end_col_offset = _token->end_col_offset;
2677 UNUSED(_end_col_offset); // Only used by EXTRA macro
2678 _res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2679 if (_res == NULL && PyErr_Occurred()) {
2680 p->error_indicator = 1;
2681 D(p->level--);
2682 return NULL;
2683 }
2684 goto done;
2685 }
2686 p->mark = _mark;
2687 D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2688 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
2689 }
2690 _res = NULL;
2691 done:
2692 D(p->level--);
2693 return _res;
2694}
2695
2696// yield_stmt: yield_expr
2697static stmt_ty
2698yield_stmt_rule(Parser *p)
2699{
2700 D(p->level++);
2701 if (p->error_indicator) {
2702 D(p->level--);
2703 return NULL;
2704 }
2705 stmt_ty _res = NULL;
2706 int _mark = p->mark;
2707 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2708 p->error_indicator = 1;
2709 D(p->level--);
2710 return NULL;
2711 }
2712 int _start_lineno = p->tokens[_mark]->lineno;
2713 UNUSED(_start_lineno); // Only used by EXTRA macro
2714 int _start_col_offset = p->tokens[_mark]->col_offset;
2715 UNUSED(_start_col_offset); // Only used by EXTRA macro
2716 { // yield_expr
2717 if (p->error_indicator) {
2718 D(p->level--);
2719 return NULL;
2720 }
2721 D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2722 expr_ty y;
2723 if (
2724 (y = yield_expr_rule(p)) // yield_expr
2725 )
2726 {
2727 D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2728 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2729 if (_token == NULL) {
2730 D(p->level--);
2731 return NULL;
2732 }
2733 int _end_lineno = _token->end_lineno;
2734 UNUSED(_end_lineno); // Only used by EXTRA macro
2735 int _end_col_offset = _token->end_col_offset;
2736 UNUSED(_end_col_offset); // Only used by EXTRA macro
2737 _res = _Py_Expr ( y , EXTRA );
2738 if (_res == NULL && PyErr_Occurred()) {
2739 p->error_indicator = 1;
2740 D(p->level--);
2741 return NULL;
2742 }
2743 goto done;
2744 }
2745 p->mark = _mark;
2746 D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2747 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
2748 }
2749 _res = NULL;
2750 done:
2751 D(p->level--);
2752 return _res;
2753}
2754
2755// assert_stmt: 'assert' expression [',' expression]
2756static stmt_ty
2757assert_stmt_rule(Parser *p)
2758{
2759 D(p->level++);
2760 if (p->error_indicator) {
2761 D(p->level--);
2762 return NULL;
2763 }
2764 stmt_ty _res = NULL;
2765 int _mark = p->mark;
2766 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2767 p->error_indicator = 1;
2768 D(p->level--);
2769 return NULL;
2770 }
2771 int _start_lineno = p->tokens[_mark]->lineno;
2772 UNUSED(_start_lineno); // Only used by EXTRA macro
2773 int _start_col_offset = p->tokens[_mark]->col_offset;
2774 UNUSED(_start_col_offset); // Only used by EXTRA macro
2775 { // 'assert' expression [',' expression]
2776 if (p->error_indicator) {
2777 D(p->level--);
2778 return NULL;
2779 }
2780 D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2781 Token * _keyword;
2782 expr_ty a;
2783 void *b;
2784 if (
2785 (_keyword = _PyPegen_expect_token(p, 505)) // token='assert'
2786 &&
2787 (a = expression_rule(p)) // expression
2788 &&
2789 (b = _tmp_29_rule(p), 1) // [',' expression]
2790 )
2791 {
2792 D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2793 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2794 if (_token == NULL) {
2795 D(p->level--);
2796 return NULL;
2797 }
2798 int _end_lineno = _token->end_lineno;
2799 UNUSED(_end_lineno); // Only used by EXTRA macro
2800 int _end_col_offset = _token->end_col_offset;
2801 UNUSED(_end_col_offset); // Only used by EXTRA macro
2802 _res = _Py_Assert ( a , b , EXTRA );
2803 if (_res == NULL && PyErr_Occurred()) {
2804 p->error_indicator = 1;
2805 D(p->level--);
2806 return NULL;
2807 }
2808 goto done;
2809 }
2810 p->mark = _mark;
2811 D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2812 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
2813 }
2814 _res = NULL;
2815 done:
2816 D(p->level--);
2817 return _res;
2818}
2819
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002820// del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002821static stmt_ty
2822del_stmt_rule(Parser *p)
2823{
2824 D(p->level++);
2825 if (p->error_indicator) {
2826 D(p->level--);
2827 return NULL;
2828 }
2829 stmt_ty _res = NULL;
2830 int _mark = p->mark;
2831 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2832 p->error_indicator = 1;
2833 D(p->level--);
2834 return NULL;
2835 }
2836 int _start_lineno = p->tokens[_mark]->lineno;
2837 UNUSED(_start_lineno); // Only used by EXTRA macro
2838 int _start_col_offset = p->tokens[_mark]->col_offset;
2839 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002840 { // 'del' del_targets &(';' | NEWLINE)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002841 if (p->error_indicator) {
2842 D(p->level--);
2843 return NULL;
2844 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002845 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 +01002846 Token * _keyword;
2847 asdl_seq* a;
2848 if (
2849 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
2850 &&
2851 (a = del_targets_rule(p)) // del_targets
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002852 &&
2853 _PyPegen_lookahead(1, _tmp_30_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002854 )
2855 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002856 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 +01002857 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2858 if (_token == NULL) {
2859 D(p->level--);
2860 return NULL;
2861 }
2862 int _end_lineno = _token->end_lineno;
2863 UNUSED(_end_lineno); // Only used by EXTRA macro
2864 int _end_col_offset = _token->end_col_offset;
2865 UNUSED(_end_col_offset); // Only used by EXTRA macro
2866 _res = _Py_Delete ( a , EXTRA );
2867 if (_res == NULL && PyErr_Occurred()) {
2868 p->error_indicator = 1;
2869 D(p->level--);
2870 return NULL;
2871 }
2872 goto done;
2873 }
2874 p->mark = _mark;
2875 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002876 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
2877 }
2878 { // invalid_del_stmt
2879 if (p->error_indicator) {
2880 D(p->level--);
2881 return NULL;
2882 }
2883 D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2884 void *invalid_del_stmt_var;
2885 if (
2886 (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt
2887 )
2888 {
2889 D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2890 _res = invalid_del_stmt_var;
2891 goto done;
2892 }
2893 p->mark = _mark;
2894 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2895 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002896 }
2897 _res = NULL;
2898 done:
2899 D(p->level--);
2900 return _res;
2901}
2902
2903// import_stmt: import_name | import_from
2904static stmt_ty
2905import_stmt_rule(Parser *p)
2906{
2907 D(p->level++);
2908 if (p->error_indicator) {
2909 D(p->level--);
2910 return NULL;
2911 }
2912 stmt_ty _res = NULL;
2913 int _mark = p->mark;
2914 { // import_name
2915 if (p->error_indicator) {
2916 D(p->level--);
2917 return NULL;
2918 }
2919 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name"));
2920 stmt_ty import_name_var;
2921 if (
2922 (import_name_var = import_name_rule(p)) // import_name
2923 )
2924 {
2925 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name"));
2926 _res = import_name_var;
2927 goto done;
2928 }
2929 p->mark = _mark;
2930 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2931 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name"));
2932 }
2933 { // import_from
2934 if (p->error_indicator) {
2935 D(p->level--);
2936 return NULL;
2937 }
2938 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from"));
2939 stmt_ty import_from_var;
2940 if (
2941 (import_from_var = import_from_rule(p)) // import_from
2942 )
2943 {
2944 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from"));
2945 _res = import_from_var;
2946 goto done;
2947 }
2948 p->mark = _mark;
2949 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2950 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from"));
2951 }
2952 _res = NULL;
2953 done:
2954 D(p->level--);
2955 return _res;
2956}
2957
2958// import_name: 'import' dotted_as_names
2959static stmt_ty
2960import_name_rule(Parser *p)
2961{
2962 D(p->level++);
2963 if (p->error_indicator) {
2964 D(p->level--);
2965 return NULL;
2966 }
2967 stmt_ty _res = NULL;
2968 int _mark = p->mark;
2969 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2970 p->error_indicator = 1;
2971 D(p->level--);
2972 return NULL;
2973 }
2974 int _start_lineno = p->tokens[_mark]->lineno;
2975 UNUSED(_start_lineno); // Only used by EXTRA macro
2976 int _start_col_offset = p->tokens[_mark]->col_offset;
2977 UNUSED(_start_col_offset); // Only used by EXTRA macro
2978 { // 'import' dotted_as_names
2979 if (p->error_indicator) {
2980 D(p->level--);
2981 return NULL;
2982 }
2983 D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
2984 Token * _keyword;
2985 asdl_seq* a;
2986 if (
2987 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
2988 &&
2989 (a = dotted_as_names_rule(p)) // dotted_as_names
2990 )
2991 {
2992 D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
2993 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2994 if (_token == NULL) {
2995 D(p->level--);
2996 return NULL;
2997 }
2998 int _end_lineno = _token->end_lineno;
2999 UNUSED(_end_lineno); // Only used by EXTRA macro
3000 int _end_col_offset = _token->end_col_offset;
3001 UNUSED(_end_col_offset); // Only used by EXTRA macro
3002 _res = _Py_Import ( a , EXTRA );
3003 if (_res == NULL && PyErr_Occurred()) {
3004 p->error_indicator = 1;
3005 D(p->level--);
3006 return NULL;
3007 }
3008 goto done;
3009 }
3010 p->mark = _mark;
3011 D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ',
3012 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names"));
3013 }
3014 _res = NULL;
3015 done:
3016 D(p->level--);
3017 return _res;
3018}
3019
3020// import_from:
3021// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3022// | 'from' (('.' | '...'))+ 'import' import_from_targets
3023static stmt_ty
3024import_from_rule(Parser *p)
3025{
3026 D(p->level++);
3027 if (p->error_indicator) {
3028 D(p->level--);
3029 return NULL;
3030 }
3031 stmt_ty _res = NULL;
3032 int _mark = p->mark;
3033 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3034 p->error_indicator = 1;
3035 D(p->level--);
3036 return NULL;
3037 }
3038 int _start_lineno = p->tokens[_mark]->lineno;
3039 UNUSED(_start_lineno); // Only used by EXTRA macro
3040 int _start_col_offset = p->tokens[_mark]->col_offset;
3041 UNUSED(_start_col_offset); // Only used by EXTRA macro
3042 { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3043 if (p->error_indicator) {
3044 D(p->level--);
3045 return NULL;
3046 }
3047 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3048 Token * _keyword;
3049 Token * _keyword_1;
3050 asdl_seq * a;
3051 expr_ty b;
3052 asdl_seq* c;
3053 if (
3054 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3055 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003056 (a = _loop0_31_rule(p)) // (('.' | '...'))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003057 &&
3058 (b = dotted_name_rule(p)) // dotted_name
3059 &&
3060 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3061 &&
3062 (c = import_from_targets_rule(p)) // import_from_targets
3063 )
3064 {
3065 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3066 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3067 if (_token == NULL) {
3068 D(p->level--);
3069 return NULL;
3070 }
3071 int _end_lineno = _token->end_lineno;
3072 UNUSED(_end_lineno); // Only used by EXTRA macro
3073 int _end_col_offset = _token->end_col_offset;
3074 UNUSED(_end_col_offset); // Only used by EXTRA macro
3075 _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
3076 if (_res == NULL && PyErr_Occurred()) {
3077 p->error_indicator = 1;
3078 D(p->level--);
3079 return NULL;
3080 }
3081 goto done;
3082 }
3083 p->mark = _mark;
3084 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3085 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3086 }
3087 { // 'from' (('.' | '...'))+ 'import' import_from_targets
3088 if (p->error_indicator) {
3089 D(p->level--);
3090 return NULL;
3091 }
3092 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3093 Token * _keyword;
3094 Token * _keyword_1;
3095 asdl_seq * a;
3096 asdl_seq* b;
3097 if (
3098 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3099 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003100 (a = _loop1_32_rule(p)) // (('.' | '...'))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003101 &&
3102 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3103 &&
3104 (b = import_from_targets_rule(p)) // import_from_targets
3105 )
3106 {
3107 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3108 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3109 if (_token == NULL) {
3110 D(p->level--);
3111 return NULL;
3112 }
3113 int _end_lineno = _token->end_lineno;
3114 UNUSED(_end_lineno); // Only used by EXTRA macro
3115 int _end_col_offset = _token->end_col_offset;
3116 UNUSED(_end_col_offset); // Only used by EXTRA macro
3117 _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
3118 if (_res == NULL && PyErr_Occurred()) {
3119 p->error_indicator = 1;
3120 D(p->level--);
3121 return NULL;
3122 }
3123 goto done;
3124 }
3125 p->mark = _mark;
3126 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3127 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3128 }
3129 _res = NULL;
3130 done:
3131 D(p->level--);
3132 return _res;
3133}
3134
3135// import_from_targets:
3136// | '(' import_from_as_names ','? ')'
3137// | import_from_as_names !','
3138// | '*'
3139// | invalid_import_from_targets
3140static asdl_seq*
3141import_from_targets_rule(Parser *p)
3142{
3143 D(p->level++);
3144 if (p->error_indicator) {
3145 D(p->level--);
3146 return NULL;
3147 }
3148 asdl_seq* _res = NULL;
3149 int _mark = p->mark;
3150 { // '(' import_from_as_names ','? ')'
3151 if (p->error_indicator) {
3152 D(p->level--);
3153 return NULL;
3154 }
3155 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3156 Token * _literal;
3157 Token * _literal_1;
3158 void *_opt_var;
3159 UNUSED(_opt_var); // Silence compiler warnings
3160 asdl_seq* a;
3161 if (
3162 (_literal = _PyPegen_expect_token(p, 7)) // token='('
3163 &&
3164 (a = import_from_as_names_rule(p)) // import_from_as_names
3165 &&
3166 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
3167 &&
3168 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
3169 )
3170 {
3171 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3172 _res = a;
3173 if (_res == NULL && PyErr_Occurred()) {
3174 p->error_indicator = 1;
3175 D(p->level--);
3176 return NULL;
3177 }
3178 goto done;
3179 }
3180 p->mark = _mark;
3181 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3182 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3183 }
3184 { // import_from_as_names !','
3185 if (p->error_indicator) {
3186 D(p->level--);
3187 return NULL;
3188 }
3189 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
3190 asdl_seq* import_from_as_names_var;
3191 if (
3192 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
3193 &&
3194 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
3195 )
3196 {
3197 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
3198 _res = import_from_as_names_var;
3199 goto done;
3200 }
3201 p->mark = _mark;
3202 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3203 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','"));
3204 }
3205 { // '*'
3206 if (p->error_indicator) {
3207 D(p->level--);
3208 return NULL;
3209 }
3210 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
3211 Token * _literal;
3212 if (
3213 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
3214 )
3215 {
3216 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
3217 _res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
3218 if (_res == NULL && PyErr_Occurred()) {
3219 p->error_indicator = 1;
3220 D(p->level--);
3221 return NULL;
3222 }
3223 goto done;
3224 }
3225 p->mark = _mark;
3226 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3227 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
3228 }
3229 { // invalid_import_from_targets
3230 if (p->error_indicator) {
3231 D(p->level--);
3232 return NULL;
3233 }
3234 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3235 void *invalid_import_from_targets_var;
3236 if (
3237 (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets
3238 )
3239 {
3240 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3241 _res = invalid_import_from_targets_var;
3242 goto done;
3243 }
3244 p->mark = _mark;
3245 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3246 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets"));
3247 }
3248 _res = NULL;
3249 done:
3250 D(p->level--);
3251 return _res;
3252}
3253
3254// import_from_as_names: ','.import_from_as_name+
3255static asdl_seq*
3256import_from_as_names_rule(Parser *p)
3257{
3258 D(p->level++);
3259 if (p->error_indicator) {
3260 D(p->level--);
3261 return NULL;
3262 }
3263 asdl_seq* _res = NULL;
3264 int _mark = p->mark;
3265 { // ','.import_from_as_name+
3266 if (p->error_indicator) {
3267 D(p->level--);
3268 return NULL;
3269 }
3270 D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
3271 asdl_seq * a;
3272 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003273 (a = _gather_33_rule(p)) // ','.import_from_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003274 )
3275 {
3276 D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
3277 _res = a;
3278 if (_res == NULL && PyErr_Occurred()) {
3279 p->error_indicator = 1;
3280 D(p->level--);
3281 return NULL;
3282 }
3283 goto done;
3284 }
3285 p->mark = _mark;
3286 D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3287 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+"));
3288 }
3289 _res = NULL;
3290 done:
3291 D(p->level--);
3292 return _res;
3293}
3294
3295// import_from_as_name: NAME ['as' NAME]
3296static alias_ty
3297import_from_as_name_rule(Parser *p)
3298{
3299 D(p->level++);
3300 if (p->error_indicator) {
3301 D(p->level--);
3302 return NULL;
3303 }
3304 alias_ty _res = NULL;
3305 int _mark = p->mark;
3306 { // NAME ['as' NAME]
3307 if (p->error_indicator) {
3308 D(p->level--);
3309 return NULL;
3310 }
3311 D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3312 expr_ty a;
3313 void *b;
3314 if (
3315 (a = _PyPegen_name_token(p)) // NAME
3316 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003317 (b = _tmp_35_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003318 )
3319 {
3320 D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3321 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3322 if (_res == NULL && PyErr_Occurred()) {
3323 p->error_indicator = 1;
3324 D(p->level--);
3325 return NULL;
3326 }
3327 goto done;
3328 }
3329 p->mark = _mark;
3330 D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3331 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]"));
3332 }
3333 _res = NULL;
3334 done:
3335 D(p->level--);
3336 return _res;
3337}
3338
3339// dotted_as_names: ','.dotted_as_name+
3340static asdl_seq*
3341dotted_as_names_rule(Parser *p)
3342{
3343 D(p->level++);
3344 if (p->error_indicator) {
3345 D(p->level--);
3346 return NULL;
3347 }
3348 asdl_seq* _res = NULL;
3349 int _mark = p->mark;
3350 { // ','.dotted_as_name+
3351 if (p->error_indicator) {
3352 D(p->level--);
3353 return NULL;
3354 }
3355 D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
3356 asdl_seq * a;
3357 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003358 (a = _gather_36_rule(p)) // ','.dotted_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003359 )
3360 {
3361 D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
3362 _res = a;
3363 if (_res == NULL && PyErr_Occurred()) {
3364 p->error_indicator = 1;
3365 D(p->level--);
3366 return NULL;
3367 }
3368 goto done;
3369 }
3370 p->mark = _mark;
3371 D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+"));
3373 }
3374 _res = NULL;
3375 done:
3376 D(p->level--);
3377 return _res;
3378}
3379
3380// dotted_as_name: dotted_name ['as' NAME]
3381static alias_ty
3382dotted_as_name_rule(Parser *p)
3383{
3384 D(p->level++);
3385 if (p->error_indicator) {
3386 D(p->level--);
3387 return NULL;
3388 }
3389 alias_ty _res = NULL;
3390 int _mark = p->mark;
3391 { // dotted_name ['as' NAME]
3392 if (p->error_indicator) {
3393 D(p->level--);
3394 return NULL;
3395 }
3396 D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3397 expr_ty a;
3398 void *b;
3399 if (
3400 (a = dotted_name_rule(p)) // dotted_name
3401 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003402 (b = _tmp_38_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003403 )
3404 {
3405 D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3406 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3407 if (_res == NULL && PyErr_Occurred()) {
3408 p->error_indicator = 1;
3409 D(p->level--);
3410 return NULL;
3411 }
3412 goto done;
3413 }
3414 p->mark = _mark;
3415 D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3416 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]"));
3417 }
3418 _res = NULL;
3419 done:
3420 D(p->level--);
3421 return _res;
3422}
3423
3424// Left-recursive
3425// dotted_name: dotted_name '.' NAME | NAME
3426static expr_ty dotted_name_raw(Parser *);
3427static expr_ty
3428dotted_name_rule(Parser *p)
3429{
3430 D(p->level++);
3431 expr_ty _res = NULL;
3432 if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) {
3433 D(p->level--);
3434 return _res;
3435 }
3436 int _mark = p->mark;
3437 int _resmark = p->mark;
3438 while (1) {
3439 int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res);
3440 if (tmpvar_0) {
3441 D(p->level--);
3442 return _res;
3443 }
3444 p->mark = _mark;
3445 void *_raw = dotted_name_raw(p);
3446 if (_raw == NULL || p->mark <= _resmark)
3447 break;
3448 _resmark = p->mark;
3449 _res = _raw;
3450 }
3451 p->mark = _resmark;
3452 D(p->level--);
3453 return _res;
3454}
3455static expr_ty
3456dotted_name_raw(Parser *p)
3457{
3458 D(p->level++);
3459 if (p->error_indicator) {
3460 D(p->level--);
3461 return NULL;
3462 }
3463 expr_ty _res = NULL;
3464 int _mark = p->mark;
3465 { // dotted_name '.' NAME
3466 if (p->error_indicator) {
3467 D(p->level--);
3468 return NULL;
3469 }
3470 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3471 Token * _literal;
3472 expr_ty a;
3473 expr_ty b;
3474 if (
3475 (a = dotted_name_rule(p)) // dotted_name
3476 &&
3477 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
3478 &&
3479 (b = _PyPegen_name_token(p)) // NAME
3480 )
3481 {
3482 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3483 _res = _PyPegen_join_names_with_dot ( p , a , b );
3484 if (_res == NULL && PyErr_Occurred()) {
3485 p->error_indicator = 1;
3486 D(p->level--);
3487 return NULL;
3488 }
3489 goto done;
3490 }
3491 p->mark = _mark;
3492 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3493 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME"));
3494 }
3495 { // NAME
3496 if (p->error_indicator) {
3497 D(p->level--);
3498 return NULL;
3499 }
3500 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
3501 expr_ty name_var;
3502 if (
3503 (name_var = _PyPegen_name_token(p)) // NAME
3504 )
3505 {
3506 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
3507 _res = name_var;
3508 goto done;
3509 }
3510 p->mark = _mark;
3511 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3512 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
3513 }
3514 _res = NULL;
3515 done:
3516 D(p->level--);
3517 return _res;
3518}
3519
3520// if_stmt:
3521// | 'if' named_expression ':' block elif_stmt
3522// | 'if' named_expression ':' block else_block?
3523static stmt_ty
3524if_stmt_rule(Parser *p)
3525{
3526 D(p->level++);
3527 if (p->error_indicator) {
3528 D(p->level--);
3529 return NULL;
3530 }
3531 stmt_ty _res = NULL;
3532 int _mark = p->mark;
3533 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3534 p->error_indicator = 1;
3535 D(p->level--);
3536 return NULL;
3537 }
3538 int _start_lineno = p->tokens[_mark]->lineno;
3539 UNUSED(_start_lineno); // Only used by EXTRA macro
3540 int _start_col_offset = p->tokens[_mark]->col_offset;
3541 UNUSED(_start_col_offset); // Only used by EXTRA macro
3542 { // 'if' named_expression ':' block elif_stmt
3543 if (p->error_indicator) {
3544 D(p->level--);
3545 return NULL;
3546 }
3547 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3548 Token * _keyword;
3549 Token * _literal;
3550 expr_ty a;
3551 asdl_seq* b;
3552 stmt_ty c;
3553 if (
3554 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3555 &&
3556 (a = named_expression_rule(p)) // named_expression
3557 &&
3558 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3559 &&
3560 (b = block_rule(p)) // block
3561 &&
3562 (c = elif_stmt_rule(p)) // elif_stmt
3563 )
3564 {
3565 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3566 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3567 if (_token == NULL) {
3568 D(p->level--);
3569 return NULL;
3570 }
3571 int _end_lineno = _token->end_lineno;
3572 UNUSED(_end_lineno); // Only used by EXTRA macro
3573 int _end_col_offset = _token->end_col_offset;
3574 UNUSED(_end_col_offset); // Only used by EXTRA macro
3575 _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
3576 if (_res == NULL && PyErr_Occurred()) {
3577 p->error_indicator = 1;
3578 D(p->level--);
3579 return NULL;
3580 }
3581 goto done;
3582 }
3583 p->mark = _mark;
3584 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3585 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3586 }
3587 { // 'if' named_expression ':' block else_block?
3588 if (p->error_indicator) {
3589 D(p->level--);
3590 return NULL;
3591 }
3592 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3593 Token * _keyword;
3594 Token * _literal;
3595 expr_ty a;
3596 asdl_seq* b;
3597 void *c;
3598 if (
3599 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3600 &&
3601 (a = named_expression_rule(p)) // named_expression
3602 &&
3603 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3604 &&
3605 (b = block_rule(p)) // block
3606 &&
3607 (c = else_block_rule(p), 1) // else_block?
3608 )
3609 {
3610 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3611 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3612 if (_token == NULL) {
3613 D(p->level--);
3614 return NULL;
3615 }
3616 int _end_lineno = _token->end_lineno;
3617 UNUSED(_end_lineno); // Only used by EXTRA macro
3618 int _end_col_offset = _token->end_col_offset;
3619 UNUSED(_end_col_offset); // Only used by EXTRA macro
3620 _res = _Py_If ( a , b , c , EXTRA );
3621 if (_res == NULL && PyErr_Occurred()) {
3622 p->error_indicator = 1;
3623 D(p->level--);
3624 return NULL;
3625 }
3626 goto done;
3627 }
3628 p->mark = _mark;
3629 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3630 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?"));
3631 }
3632 _res = NULL;
3633 done:
3634 D(p->level--);
3635 return _res;
3636}
3637
3638// elif_stmt:
3639// | 'elif' named_expression ':' block elif_stmt
3640// | 'elif' named_expression ':' block else_block?
3641static stmt_ty
3642elif_stmt_rule(Parser *p)
3643{
3644 D(p->level++);
3645 if (p->error_indicator) {
3646 D(p->level--);
3647 return NULL;
3648 }
3649 stmt_ty _res = NULL;
3650 int _mark = p->mark;
3651 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3652 p->error_indicator = 1;
3653 D(p->level--);
3654 return NULL;
3655 }
3656 int _start_lineno = p->tokens[_mark]->lineno;
3657 UNUSED(_start_lineno); // Only used by EXTRA macro
3658 int _start_col_offset = p->tokens[_mark]->col_offset;
3659 UNUSED(_start_col_offset); // Only used by EXTRA macro
3660 { // 'elif' named_expression ':' block elif_stmt
3661 if (p->error_indicator) {
3662 D(p->level--);
3663 return NULL;
3664 }
3665 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3666 Token * _keyword;
3667 Token * _literal;
3668 expr_ty a;
3669 asdl_seq* b;
3670 stmt_ty c;
3671 if (
3672 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3673 &&
3674 (a = named_expression_rule(p)) // named_expression
3675 &&
3676 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3677 &&
3678 (b = block_rule(p)) // block
3679 &&
3680 (c = elif_stmt_rule(p)) // elif_stmt
3681 )
3682 {
3683 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3684 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3685 if (_token == NULL) {
3686 D(p->level--);
3687 return NULL;
3688 }
3689 int _end_lineno = _token->end_lineno;
3690 UNUSED(_end_lineno); // Only used by EXTRA macro
3691 int _end_col_offset = _token->end_col_offset;
3692 UNUSED(_end_col_offset); // Only used by EXTRA macro
3693 _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
3694 if (_res == NULL && PyErr_Occurred()) {
3695 p->error_indicator = 1;
3696 D(p->level--);
3697 return NULL;
3698 }
3699 goto done;
3700 }
3701 p->mark = _mark;
3702 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3703 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3704 }
3705 { // 'elif' named_expression ':' block else_block?
3706 if (p->error_indicator) {
3707 D(p->level--);
3708 return NULL;
3709 }
3710 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3711 Token * _keyword;
3712 Token * _literal;
3713 expr_ty a;
3714 asdl_seq* b;
3715 void *c;
3716 if (
3717 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3718 &&
3719 (a = named_expression_rule(p)) // named_expression
3720 &&
3721 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3722 &&
3723 (b = block_rule(p)) // block
3724 &&
3725 (c = else_block_rule(p), 1) // else_block?
3726 )
3727 {
3728 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3729 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3730 if (_token == NULL) {
3731 D(p->level--);
3732 return NULL;
3733 }
3734 int _end_lineno = _token->end_lineno;
3735 UNUSED(_end_lineno); // Only used by EXTRA macro
3736 int _end_col_offset = _token->end_col_offset;
3737 UNUSED(_end_col_offset); // Only used by EXTRA macro
3738 _res = _Py_If ( a , b , c , EXTRA );
3739 if (_res == NULL && PyErr_Occurred()) {
3740 p->error_indicator = 1;
3741 D(p->level--);
3742 return NULL;
3743 }
3744 goto done;
3745 }
3746 p->mark = _mark;
3747 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3748 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3749 }
3750 _res = NULL;
3751 done:
3752 D(p->level--);
3753 return _res;
3754}
3755
3756// else_block: 'else' ':' block
3757static asdl_seq*
3758else_block_rule(Parser *p)
3759{
3760 D(p->level++);
3761 if (p->error_indicator) {
3762 D(p->level--);
3763 return NULL;
3764 }
3765 asdl_seq* _res = NULL;
3766 int _mark = p->mark;
3767 { // 'else' ':' block
3768 if (p->error_indicator) {
3769 D(p->level--);
3770 return NULL;
3771 }
3772 D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3773 Token * _keyword;
3774 Token * _literal;
3775 asdl_seq* b;
3776 if (
3777 (_keyword = _PyPegen_expect_token(p, 516)) // token='else'
3778 &&
3779 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3780 &&
3781 (b = block_rule(p)) // block
3782 )
3783 {
3784 D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3785 _res = b;
3786 if (_res == NULL && PyErr_Occurred()) {
3787 p->error_indicator = 1;
3788 D(p->level--);
3789 return NULL;
3790 }
3791 goto done;
3792 }
3793 p->mark = _mark;
3794 D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
3795 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block"));
3796 }
3797 _res = NULL;
3798 done:
3799 D(p->level--);
3800 return _res;
3801}
3802
3803// while_stmt: 'while' named_expression ':' block else_block?
3804static stmt_ty
3805while_stmt_rule(Parser *p)
3806{
3807 D(p->level++);
3808 if (p->error_indicator) {
3809 D(p->level--);
3810 return NULL;
3811 }
3812 stmt_ty _res = NULL;
3813 int _mark = p->mark;
3814 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3815 p->error_indicator = 1;
3816 D(p->level--);
3817 return NULL;
3818 }
3819 int _start_lineno = p->tokens[_mark]->lineno;
3820 UNUSED(_start_lineno); // Only used by EXTRA macro
3821 int _start_col_offset = p->tokens[_mark]->col_offset;
3822 UNUSED(_start_col_offset); // Only used by EXTRA macro
3823 { // 'while' named_expression ':' block else_block?
3824 if (p->error_indicator) {
3825 D(p->level--);
3826 return NULL;
3827 }
3828 D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3829 Token * _keyword;
3830 Token * _literal;
3831 expr_ty a;
3832 asdl_seq* b;
3833 void *c;
3834 if (
3835 (_keyword = _PyPegen_expect_token(p, 512)) // token='while'
3836 &&
3837 (a = named_expression_rule(p)) // named_expression
3838 &&
3839 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3840 &&
3841 (b = block_rule(p)) // block
3842 &&
3843 (c = else_block_rule(p), 1) // else_block?
3844 )
3845 {
3846 D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3847 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3848 if (_token == NULL) {
3849 D(p->level--);
3850 return NULL;
3851 }
3852 int _end_lineno = _token->end_lineno;
3853 UNUSED(_end_lineno); // Only used by EXTRA macro
3854 int _end_col_offset = _token->end_col_offset;
3855 UNUSED(_end_col_offset); // Only used by EXTRA macro
3856 _res = _Py_While ( a , b , c , EXTRA );
3857 if (_res == NULL && PyErr_Occurred()) {
3858 p->error_indicator = 1;
3859 D(p->level--);
3860 return NULL;
3861 }
3862 goto done;
3863 }
3864 p->mark = _mark;
3865 D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3866 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?"));
3867 }
3868 _res = NULL;
3869 done:
3870 D(p->level--);
3871 return _res;
3872}
3873
3874// for_stmt:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003875// | 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3876// | ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3877// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003878static stmt_ty
3879for_stmt_rule(Parser *p)
3880{
3881 D(p->level++);
3882 if (p->error_indicator) {
3883 D(p->level--);
3884 return NULL;
3885 }
3886 stmt_ty _res = NULL;
3887 int _mark = p->mark;
3888 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3889 p->error_indicator = 1;
3890 D(p->level--);
3891 return NULL;
3892 }
3893 int _start_lineno = p->tokens[_mark]->lineno;
3894 UNUSED(_start_lineno); // Only used by EXTRA macro
3895 int _start_col_offset = p->tokens[_mark]->col_offset;
3896 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003897 { // 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003898 if (p->error_indicator) {
3899 D(p->level--);
3900 return NULL;
3901 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003902 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?"));
3903 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003904 Token * _keyword;
3905 Token * _keyword_1;
3906 Token * _literal;
3907 asdl_seq* b;
3908 void *el;
3909 expr_ty ex;
3910 expr_ty t;
3911 void *tc;
3912 if (
3913 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3914 &&
3915 (t = star_targets_rule(p)) // star_targets
3916 &&
3917 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3918 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003919 (_cut_var = 1)
3920 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003921 (ex = star_expressions_rule(p)) // star_expressions
3922 &&
3923 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3924 &&
3925 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
3926 &&
3927 (b = block_rule(p)) // block
3928 &&
3929 (el = else_block_rule(p), 1) // else_block?
3930 )
3931 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003932 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 +01003933 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3934 if (_token == NULL) {
3935 D(p->level--);
3936 return NULL;
3937 }
3938 int _end_lineno = _token->end_lineno;
3939 UNUSED(_end_lineno); // Only used by EXTRA macro
3940 int _end_col_offset = _token->end_col_offset;
3941 UNUSED(_end_col_offset); // Only used by EXTRA macro
3942 _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
3943 if (_res == NULL && PyErr_Occurred()) {
3944 p->error_indicator = 1;
3945 D(p->level--);
3946 return NULL;
3947 }
3948 goto done;
3949 }
3950 p->mark = _mark;
3951 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003952 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
3953 if (_cut_var) {
3954 D(p->level--);
3955 return NULL;
3956 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003957 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003958 { // ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003959 if (p->error_indicator) {
3960 D(p->level--);
3961 return NULL;
3962 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003963 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?"));
3964 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003965 Token * _keyword;
3966 Token * _keyword_1;
3967 Token * _literal;
3968 Token * async_var;
3969 asdl_seq* b;
3970 void *el;
3971 expr_ty ex;
3972 expr_ty t;
3973 void *tc;
3974 if (
3975 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
3976 &&
3977 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3978 &&
3979 (t = star_targets_rule(p)) // star_targets
3980 &&
3981 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3982 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003983 (_cut_var = 1)
3984 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003985 (ex = star_expressions_rule(p)) // star_expressions
3986 &&
3987 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3988 &&
3989 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
3990 &&
3991 (b = block_rule(p)) // block
3992 &&
3993 (el = else_block_rule(p), 1) // else_block?
3994 )
3995 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003996 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 +01003997 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3998 if (_token == NULL) {
3999 D(p->level--);
4000 return NULL;
4001 }
4002 int _end_lineno = _token->end_lineno;
4003 UNUSED(_end_lineno); // Only used by EXTRA macro
4004 int _end_col_offset = _token->end_col_offset;
4005 UNUSED(_end_col_offset); // Only used by EXTRA macro
4006 _res = CHECK_VERSION ( 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
4007 if (_res == NULL && PyErr_Occurred()) {
4008 p->error_indicator = 1;
4009 D(p->level--);
4010 return NULL;
4011 }
4012 goto done;
4013 }
4014 p->mark = _mark;
4015 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004016 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
4017 if (_cut_var) {
4018 D(p->level--);
4019 return NULL;
4020 }
4021 }
4022 { // invalid_for_target
4023 if (p->error_indicator) {
4024 D(p->level--);
4025 return NULL;
4026 }
4027 D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4028 void *invalid_for_target_var;
4029 if (
4030 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
4031 )
4032 {
4033 D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4034 _res = invalid_for_target_var;
4035 goto done;
4036 }
4037 p->mark = _mark;
4038 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4039 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004040 }
4041 _res = NULL;
4042 done:
4043 D(p->level--);
4044 return _res;
4045}
4046
4047// with_stmt:
4048// | 'with' '(' ','.with_item+ ','? ')' ':' block
4049// | 'with' ','.with_item+ ':' TYPE_COMMENT? block
4050// | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4051// | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4052static stmt_ty
4053with_stmt_rule(Parser *p)
4054{
4055 D(p->level++);
4056 if (p->error_indicator) {
4057 D(p->level--);
4058 return NULL;
4059 }
4060 stmt_ty _res = NULL;
4061 int _mark = p->mark;
4062 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4063 p->error_indicator = 1;
4064 D(p->level--);
4065 return NULL;
4066 }
4067 int _start_lineno = p->tokens[_mark]->lineno;
4068 UNUSED(_start_lineno); // Only used by EXTRA macro
4069 int _start_col_offset = p->tokens[_mark]->col_offset;
4070 UNUSED(_start_col_offset); // Only used by EXTRA macro
4071 { // 'with' '(' ','.with_item+ ','? ')' ':' block
4072 if (p->error_indicator) {
4073 D(p->level--);
4074 return NULL;
4075 }
4076 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4077 Token * _keyword;
4078 Token * _literal;
4079 Token * _literal_1;
4080 Token * _literal_2;
4081 void *_opt_var;
4082 UNUSED(_opt_var); // Silence compiler warnings
4083 asdl_seq * a;
4084 asdl_seq* b;
4085 if (
4086 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4087 &&
4088 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4089 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004090 (a = _gather_39_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004091 &&
4092 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4093 &&
4094 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4095 &&
4096 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4097 &&
4098 (b = block_rule(p)) // block
4099 )
4100 {
4101 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4102 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4103 if (_token == NULL) {
4104 D(p->level--);
4105 return NULL;
4106 }
4107 int _end_lineno = _token->end_lineno;
4108 UNUSED(_end_lineno); // Only used by EXTRA macro
4109 int _end_col_offset = _token->end_col_offset;
4110 UNUSED(_end_col_offset); // Only used by EXTRA macro
4111 _res = _Py_With ( a , b , NULL , EXTRA );
4112 if (_res == NULL && PyErr_Occurred()) {
4113 p->error_indicator = 1;
4114 D(p->level--);
4115 return NULL;
4116 }
4117 goto done;
4118 }
4119 p->mark = _mark;
4120 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4121 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4122 }
4123 { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
4124 if (p->error_indicator) {
4125 D(p->level--);
4126 return NULL;
4127 }
4128 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4129 Token * _keyword;
4130 Token * _literal;
4131 asdl_seq * a;
4132 asdl_seq* b;
4133 void *tc;
4134 if (
4135 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4136 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004137 (a = _gather_41_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004138 &&
4139 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4140 &&
4141 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4142 &&
4143 (b = block_rule(p)) // block
4144 )
4145 {
4146 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4147 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4148 if (_token == NULL) {
4149 D(p->level--);
4150 return NULL;
4151 }
4152 int _end_lineno = _token->end_lineno;
4153 UNUSED(_end_lineno); // Only used by EXTRA macro
4154 int _end_col_offset = _token->end_col_offset;
4155 UNUSED(_end_col_offset); // Only used by EXTRA macro
4156 _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4157 if (_res == NULL && PyErr_Occurred()) {
4158 p->error_indicator = 1;
4159 D(p->level--);
4160 return NULL;
4161 }
4162 goto done;
4163 }
4164 p->mark = _mark;
4165 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4166 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4167 }
4168 { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4169 if (p->error_indicator) {
4170 D(p->level--);
4171 return NULL;
4172 }
4173 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4174 Token * _keyword;
4175 Token * _literal;
4176 Token * _literal_1;
4177 Token * _literal_2;
4178 void *_opt_var;
4179 UNUSED(_opt_var); // Silence compiler warnings
4180 asdl_seq * a;
4181 Token * async_var;
4182 asdl_seq* b;
4183 if (
4184 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4185 &&
4186 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4187 &&
4188 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4189 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004190 (a = _gather_43_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004191 &&
4192 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4193 &&
4194 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4195 &&
4196 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4197 &&
4198 (b = block_rule(p)) // block
4199 )
4200 {
4201 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4202 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4203 if (_token == NULL) {
4204 D(p->level--);
4205 return NULL;
4206 }
4207 int _end_lineno = _token->end_lineno;
4208 UNUSED(_end_lineno); // Only used by EXTRA macro
4209 int _end_col_offset = _token->end_col_offset;
4210 UNUSED(_end_col_offset); // Only used by EXTRA macro
4211 _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) );
4212 if (_res == NULL && PyErr_Occurred()) {
4213 p->error_indicator = 1;
4214 D(p->level--);
4215 return NULL;
4216 }
4217 goto done;
4218 }
4219 p->mark = _mark;
4220 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4221 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4222 }
4223 { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4224 if (p->error_indicator) {
4225 D(p->level--);
4226 return NULL;
4227 }
4228 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4229 Token * _keyword;
4230 Token * _literal;
4231 asdl_seq * a;
4232 Token * async_var;
4233 asdl_seq* b;
4234 void *tc;
4235 if (
4236 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4237 &&
4238 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4239 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004240 (a = _gather_45_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004241 &&
4242 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4243 &&
4244 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4245 &&
4246 (b = block_rule(p)) // block
4247 )
4248 {
4249 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4250 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4251 if (_token == NULL) {
4252 D(p->level--);
4253 return NULL;
4254 }
4255 int _end_lineno = _token->end_lineno;
4256 UNUSED(_end_lineno); // Only used by EXTRA macro
4257 int _end_col_offset = _token->end_col_offset;
4258 UNUSED(_end_col_offset); // Only used by EXTRA macro
4259 _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
4260 if (_res == NULL && PyErr_Occurred()) {
4261 p->error_indicator = 1;
4262 D(p->level--);
4263 return NULL;
4264 }
4265 goto done;
4266 }
4267 p->mark = _mark;
4268 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4269 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4270 }
4271 _res = NULL;
4272 done:
4273 D(p->level--);
4274 return _res;
4275}
4276
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004277// with_item: expression 'as' target &(',' | ')' | ':') | invalid_with_item | expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004278static withitem_ty
4279with_item_rule(Parser *p)
4280{
4281 D(p->level++);
4282 if (p->error_indicator) {
4283 D(p->level--);
4284 return NULL;
4285 }
4286 withitem_ty _res = NULL;
4287 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004288 { // expression 'as' target &(',' | ')' | ':')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004289 if (p->error_indicator) {
4290 D(p->level--);
4291 return NULL;
4292 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004293 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4294 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004295 expr_ty e;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004296 expr_ty t;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004297 if (
4298 (e = expression_rule(p)) // expression
4299 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004300 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
4301 &&
4302 (t = target_rule(p)) // target
4303 &&
4304 _PyPegen_lookahead(1, _tmp_47_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004305 )
4306 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004307 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4308 _res = _Py_withitem ( e , t , p -> arena );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004309 if (_res == NULL && PyErr_Occurred()) {
4310 p->error_indicator = 1;
4311 D(p->level--);
4312 return NULL;
4313 }
4314 goto done;
4315 }
4316 p->mark = _mark;
4317 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004318 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4319 }
4320 { // invalid_with_item
4321 if (p->error_indicator) {
4322 D(p->level--);
4323 return NULL;
4324 }
4325 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4326 void *invalid_with_item_var;
4327 if (
4328 (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item
4329 )
4330 {
4331 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4332 _res = invalid_with_item_var;
4333 goto done;
4334 }
4335 p->mark = _mark;
4336 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4337 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
4338 }
4339 { // expression
4340 if (p->error_indicator) {
4341 D(p->level--);
4342 return NULL;
4343 }
4344 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
4345 expr_ty e;
4346 if (
4347 (e = expression_rule(p)) // expression
4348 )
4349 {
4350 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
4351 _res = _Py_withitem ( e , NULL , p -> arena );
4352 if (_res == NULL && PyErr_Occurred()) {
4353 p->error_indicator = 1;
4354 D(p->level--);
4355 return NULL;
4356 }
4357 goto done;
4358 }
4359 p->mark = _mark;
4360 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4361 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004362 }
4363 _res = NULL;
4364 done:
4365 D(p->level--);
4366 return _res;
4367}
4368
4369// try_stmt:
4370// | 'try' ':' block finally_block
4371// | 'try' ':' block except_block+ else_block? finally_block?
4372static stmt_ty
4373try_stmt_rule(Parser *p)
4374{
4375 D(p->level++);
4376 if (p->error_indicator) {
4377 D(p->level--);
4378 return NULL;
4379 }
4380 stmt_ty _res = NULL;
4381 int _mark = p->mark;
4382 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4383 p->error_indicator = 1;
4384 D(p->level--);
4385 return NULL;
4386 }
4387 int _start_lineno = p->tokens[_mark]->lineno;
4388 UNUSED(_start_lineno); // Only used by EXTRA macro
4389 int _start_col_offset = p->tokens[_mark]->col_offset;
4390 UNUSED(_start_col_offset); // Only used by EXTRA macro
4391 { // 'try' ':' block finally_block
4392 if (p->error_indicator) {
4393 D(p->level--);
4394 return NULL;
4395 }
4396 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4397 Token * _keyword;
4398 Token * _literal;
4399 asdl_seq* b;
4400 asdl_seq* f;
4401 if (
4402 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4403 &&
4404 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4405 &&
4406 (b = block_rule(p)) // block
4407 &&
4408 (f = finally_block_rule(p)) // finally_block
4409 )
4410 {
4411 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4412 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4413 if (_token == NULL) {
4414 D(p->level--);
4415 return NULL;
4416 }
4417 int _end_lineno = _token->end_lineno;
4418 UNUSED(_end_lineno); // Only used by EXTRA macro
4419 int _end_col_offset = _token->end_col_offset;
4420 UNUSED(_end_col_offset); // Only used by EXTRA macro
4421 _res = _Py_Try ( b , NULL , NULL , f , EXTRA );
4422 if (_res == NULL && PyErr_Occurred()) {
4423 p->error_indicator = 1;
4424 D(p->level--);
4425 return NULL;
4426 }
4427 goto done;
4428 }
4429 p->mark = _mark;
4430 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4431 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block finally_block"));
4432 }
4433 { // 'try' ':' block except_block+ else_block? finally_block?
4434 if (p->error_indicator) {
4435 D(p->level--);
4436 return NULL;
4437 }
4438 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4439 Token * _keyword;
4440 Token * _literal;
4441 asdl_seq* b;
4442 void *el;
4443 asdl_seq * ex;
4444 void *f;
4445 if (
4446 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4447 &&
4448 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4449 &&
4450 (b = block_rule(p)) // block
4451 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004452 (ex = _loop1_48_rule(p)) // except_block+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004453 &&
4454 (el = else_block_rule(p), 1) // else_block?
4455 &&
4456 (f = finally_block_rule(p), 1) // finally_block?
4457 )
4458 {
4459 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4460 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4461 if (_token == NULL) {
4462 D(p->level--);
4463 return NULL;
4464 }
4465 int _end_lineno = _token->end_lineno;
4466 UNUSED(_end_lineno); // Only used by EXTRA macro
4467 int _end_col_offset = _token->end_col_offset;
4468 UNUSED(_end_col_offset); // Only used by EXTRA macro
4469 _res = _Py_Try ( b , ex , el , f , EXTRA );
4470 if (_res == NULL && PyErr_Occurred()) {
4471 p->error_indicator = 1;
4472 D(p->level--);
4473 return NULL;
4474 }
4475 goto done;
4476 }
4477 p->mark = _mark;
4478 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4479 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4480 }
4481 _res = NULL;
4482 done:
4483 D(p->level--);
4484 return _res;
4485}
4486
4487// except_block: 'except' expression ['as' NAME] ':' block | 'except' ':' block
4488static excepthandler_ty
4489except_block_rule(Parser *p)
4490{
4491 D(p->level++);
4492 if (p->error_indicator) {
4493 D(p->level--);
4494 return NULL;
4495 }
4496 excepthandler_ty _res = NULL;
4497 int _mark = p->mark;
4498 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4499 p->error_indicator = 1;
4500 D(p->level--);
4501 return NULL;
4502 }
4503 int _start_lineno = p->tokens[_mark]->lineno;
4504 UNUSED(_start_lineno); // Only used by EXTRA macro
4505 int _start_col_offset = p->tokens[_mark]->col_offset;
4506 UNUSED(_start_col_offset); // Only used by EXTRA macro
4507 { // 'except' expression ['as' NAME] ':' block
4508 if (p->error_indicator) {
4509 D(p->level--);
4510 return NULL;
4511 }
4512 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4513 Token * _keyword;
4514 Token * _literal;
4515 asdl_seq* b;
4516 expr_ty e;
4517 void *t;
4518 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004519 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004520 &&
4521 (e = expression_rule(p)) // expression
4522 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004523 (t = _tmp_49_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004524 &&
4525 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4526 &&
4527 (b = block_rule(p)) // block
4528 )
4529 {
4530 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4531 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4532 if (_token == NULL) {
4533 D(p->level--);
4534 return NULL;
4535 }
4536 int _end_lineno = _token->end_lineno;
4537 UNUSED(_end_lineno); // Only used by EXTRA macro
4538 int _end_col_offset = _token->end_col_offset;
4539 UNUSED(_end_col_offset); // Only used by EXTRA macro
4540 _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
4541 if (_res == NULL && PyErr_Occurred()) {
4542 p->error_indicator = 1;
4543 D(p->level--);
4544 return NULL;
4545 }
4546 goto done;
4547 }
4548 p->mark = _mark;
4549 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4550 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4551 }
4552 { // 'except' ':' block
4553 if (p->error_indicator) {
4554 D(p->level--);
4555 return NULL;
4556 }
4557 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4558 Token * _keyword;
4559 Token * _literal;
4560 asdl_seq* b;
4561 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004562 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004563 &&
4564 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4565 &&
4566 (b = block_rule(p)) // block
4567 )
4568 {
4569 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4570 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4571 if (_token == NULL) {
4572 D(p->level--);
4573 return NULL;
4574 }
4575 int _end_lineno = _token->end_lineno;
4576 UNUSED(_end_lineno); // Only used by EXTRA macro
4577 int _end_col_offset = _token->end_col_offset;
4578 UNUSED(_end_col_offset); // Only used by EXTRA macro
4579 _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
4580 if (_res == NULL && PyErr_Occurred()) {
4581 p->error_indicator = 1;
4582 D(p->level--);
4583 return NULL;
4584 }
4585 goto done;
4586 }
4587 p->mark = _mark;
4588 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4589 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
4590 }
4591 _res = NULL;
4592 done:
4593 D(p->level--);
4594 return _res;
4595}
4596
4597// finally_block: 'finally' ':' block
4598static asdl_seq*
4599finally_block_rule(Parser *p)
4600{
4601 D(p->level++);
4602 if (p->error_indicator) {
4603 D(p->level--);
4604 return NULL;
4605 }
4606 asdl_seq* _res = NULL;
4607 int _mark = p->mark;
4608 { // 'finally' ':' block
4609 if (p->error_indicator) {
4610 D(p->level--);
4611 return NULL;
4612 }
4613 D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4614 Token * _keyword;
4615 Token * _literal;
4616 asdl_seq* a;
4617 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004618 (_keyword = _PyPegen_expect_token(p, 522)) // token='finally'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004619 &&
4620 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4621 &&
4622 (a = block_rule(p)) // block
4623 )
4624 {
4625 D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4626 _res = a;
4627 if (_res == NULL && PyErr_Occurred()) {
4628 p->error_indicator = 1;
4629 D(p->level--);
4630 return NULL;
4631 }
4632 goto done;
4633 }
4634 p->mark = _mark;
4635 D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
4636 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block"));
4637 }
4638 _res = NULL;
4639 done:
4640 D(p->level--);
4641 return _res;
4642}
4643
4644// return_stmt: 'return' star_expressions?
4645static stmt_ty
4646return_stmt_rule(Parser *p)
4647{
4648 D(p->level++);
4649 if (p->error_indicator) {
4650 D(p->level--);
4651 return NULL;
4652 }
4653 stmt_ty _res = NULL;
4654 int _mark = p->mark;
4655 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4656 p->error_indicator = 1;
4657 D(p->level--);
4658 return NULL;
4659 }
4660 int _start_lineno = p->tokens[_mark]->lineno;
4661 UNUSED(_start_lineno); // Only used by EXTRA macro
4662 int _start_col_offset = p->tokens[_mark]->col_offset;
4663 UNUSED(_start_col_offset); // Only used by EXTRA macro
4664 { // 'return' star_expressions?
4665 if (p->error_indicator) {
4666 D(p->level--);
4667 return NULL;
4668 }
4669 D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4670 Token * _keyword;
4671 void *a;
4672 if (
4673 (_keyword = _PyPegen_expect_token(p, 500)) // token='return'
4674 &&
4675 (a = star_expressions_rule(p), 1) // star_expressions?
4676 )
4677 {
4678 D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4679 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4680 if (_token == NULL) {
4681 D(p->level--);
4682 return NULL;
4683 }
4684 int _end_lineno = _token->end_lineno;
4685 UNUSED(_end_lineno); // Only used by EXTRA macro
4686 int _end_col_offset = _token->end_col_offset;
4687 UNUSED(_end_col_offset); // Only used by EXTRA macro
4688 _res = _Py_Return ( a , EXTRA );
4689 if (_res == NULL && PyErr_Occurred()) {
4690 p->error_indicator = 1;
4691 D(p->level--);
4692 return NULL;
4693 }
4694 goto done;
4695 }
4696 p->mark = _mark;
4697 D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4698 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
4699 }
4700 _res = NULL;
4701 done:
4702 D(p->level--);
4703 return _res;
4704}
4705
4706// raise_stmt: 'raise' expression ['from' expression] | 'raise'
4707static stmt_ty
4708raise_stmt_rule(Parser *p)
4709{
4710 D(p->level++);
4711 if (p->error_indicator) {
4712 D(p->level--);
4713 return NULL;
4714 }
4715 stmt_ty _res = NULL;
4716 int _mark = p->mark;
4717 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4718 p->error_indicator = 1;
4719 D(p->level--);
4720 return NULL;
4721 }
4722 int _start_lineno = p->tokens[_mark]->lineno;
4723 UNUSED(_start_lineno); // Only used by EXTRA macro
4724 int _start_col_offset = p->tokens[_mark]->col_offset;
4725 UNUSED(_start_col_offset); // Only used by EXTRA macro
4726 { // 'raise' expression ['from' expression]
4727 if (p->error_indicator) {
4728 D(p->level--);
4729 return NULL;
4730 }
4731 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4732 Token * _keyword;
4733 expr_ty a;
4734 void *b;
4735 if (
4736 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4737 &&
4738 (a = expression_rule(p)) // expression
4739 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004740 (b = _tmp_50_rule(p), 1) // ['from' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004741 )
4742 {
4743 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4744 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4745 if (_token == NULL) {
4746 D(p->level--);
4747 return NULL;
4748 }
4749 int _end_lineno = _token->end_lineno;
4750 UNUSED(_end_lineno); // Only used by EXTRA macro
4751 int _end_col_offset = _token->end_col_offset;
4752 UNUSED(_end_col_offset); // Only used by EXTRA macro
4753 _res = _Py_Raise ( a , b , EXTRA );
4754 if (_res == NULL && PyErr_Occurred()) {
4755 p->error_indicator = 1;
4756 D(p->level--);
4757 return NULL;
4758 }
4759 goto done;
4760 }
4761 p->mark = _mark;
4762 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4763 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
4764 }
4765 { // 'raise'
4766 if (p->error_indicator) {
4767 D(p->level--);
4768 return NULL;
4769 }
4770 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
4771 Token * _keyword;
4772 if (
4773 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4774 )
4775 {
4776 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
4777 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4778 if (_token == NULL) {
4779 D(p->level--);
4780 return NULL;
4781 }
4782 int _end_lineno = _token->end_lineno;
4783 UNUSED(_end_lineno); // Only used by EXTRA macro
4784 int _end_col_offset = _token->end_col_offset;
4785 UNUSED(_end_col_offset); // Only used by EXTRA macro
4786 _res = _Py_Raise ( NULL , NULL , EXTRA );
4787 if (_res == NULL && PyErr_Occurred()) {
4788 p->error_indicator = 1;
4789 D(p->level--);
4790 return NULL;
4791 }
4792 goto done;
4793 }
4794 p->mark = _mark;
4795 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4796 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
4797 }
4798 _res = NULL;
4799 done:
4800 D(p->level--);
4801 return _res;
4802}
4803
4804// function_def: decorators function_def_raw | function_def_raw
4805static stmt_ty
4806function_def_rule(Parser *p)
4807{
4808 D(p->level++);
4809 if (p->error_indicator) {
4810 D(p->level--);
4811 return NULL;
4812 }
4813 stmt_ty _res = NULL;
4814 int _mark = p->mark;
4815 { // decorators function_def_raw
4816 if (p->error_indicator) {
4817 D(p->level--);
4818 return NULL;
4819 }
4820 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4821 asdl_seq* d;
4822 stmt_ty f;
4823 if (
4824 (d = decorators_rule(p)) // decorators
4825 &&
4826 (f = function_def_raw_rule(p)) // function_def_raw
4827 )
4828 {
4829 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4830 _res = _PyPegen_function_def_decorators ( p , d , f );
4831 if (_res == NULL && PyErr_Occurred()) {
4832 p->error_indicator = 1;
4833 D(p->level--);
4834 return NULL;
4835 }
4836 goto done;
4837 }
4838 p->mark = _mark;
4839 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4840 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
4841 }
4842 { // function_def_raw
4843 if (p->error_indicator) {
4844 D(p->level--);
4845 return NULL;
4846 }
4847 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4848 stmt_ty function_def_raw_var;
4849 if (
4850 (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
4851 )
4852 {
4853 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4854 _res = function_def_raw_var;
4855 goto done;
4856 }
4857 p->mark = _mark;
4858 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4859 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
4860 }
4861 _res = NULL;
4862 done:
4863 D(p->level--);
4864 return _res;
4865}
4866
4867// function_def_raw:
4868// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4869// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4870static stmt_ty
4871function_def_raw_rule(Parser *p)
4872{
4873 D(p->level++);
4874 if (p->error_indicator) {
4875 D(p->level--);
4876 return NULL;
4877 }
4878 stmt_ty _res = NULL;
4879 int _mark = p->mark;
4880 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4881 p->error_indicator = 1;
4882 D(p->level--);
4883 return NULL;
4884 }
4885 int _start_lineno = p->tokens[_mark]->lineno;
4886 UNUSED(_start_lineno); // Only used by EXTRA macro
4887 int _start_col_offset = p->tokens[_mark]->col_offset;
4888 UNUSED(_start_col_offset); // Only used by EXTRA macro
4889 { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4890 if (p->error_indicator) {
4891 D(p->level--);
4892 return NULL;
4893 }
4894 D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4895 Token * _keyword;
4896 Token * _literal;
4897 Token * _literal_1;
4898 Token * _literal_2;
4899 void *a;
4900 asdl_seq* b;
4901 expr_ty n;
4902 void *params;
4903 void *tc;
4904 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004905 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004906 &&
4907 (n = _PyPegen_name_token(p)) // NAME
4908 &&
4909 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4910 &&
4911 (params = params_rule(p), 1) // params?
4912 &&
4913 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4914 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004915 (a = _tmp_51_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004916 &&
4917 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4918 &&
4919 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4920 &&
4921 (b = block_rule(p)) // block
4922 )
4923 {
4924 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"));
4925 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4926 if (_token == NULL) {
4927 D(p->level--);
4928 return NULL;
4929 }
4930 int _end_lineno = _token->end_lineno;
4931 UNUSED(_end_lineno); // Only used by EXTRA macro
4932 int _end_col_offset = _token->end_col_offset;
4933 UNUSED(_end_col_offset); // Only used by EXTRA macro
4934 _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4935 if (_res == NULL && PyErr_Occurred()) {
4936 p->error_indicator = 1;
4937 D(p->level--);
4938 return NULL;
4939 }
4940 goto done;
4941 }
4942 p->mark = _mark;
4943 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
4944 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4945 }
4946 { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4947 if (p->error_indicator) {
4948 D(p->level--);
4949 return NULL;
4950 }
4951 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"));
4952 Token * _keyword;
4953 Token * _literal;
4954 Token * _literal_1;
4955 Token * _literal_2;
4956 void *a;
4957 Token * async_var;
4958 asdl_seq* b;
4959 expr_ty n;
4960 void *params;
4961 void *tc;
4962 if (
4963 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4964 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004965 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004966 &&
4967 (n = _PyPegen_name_token(p)) // NAME
4968 &&
4969 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4970 &&
4971 (params = params_rule(p), 1) // params?
4972 &&
4973 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4974 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004975 (a = _tmp_52_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004976 &&
4977 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4978 &&
4979 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4980 &&
4981 (b = block_rule(p)) // block
4982 )
4983 {
4984 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"));
4985 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4986 if (_token == NULL) {
4987 D(p->level--);
4988 return NULL;
4989 }
4990 int _end_lineno = _token->end_lineno;
4991 UNUSED(_end_lineno); // Only used by EXTRA macro
4992 int _end_col_offset = _token->end_col_offset;
4993 UNUSED(_end_col_offset); // Only used by EXTRA macro
4994 _res = CHECK_VERSION ( 5 , "Async functions are" , _Py_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
4995 if (_res == NULL && PyErr_Occurred()) {
4996 p->error_indicator = 1;
4997 D(p->level--);
4998 return NULL;
4999 }
5000 goto done;
5001 }
5002 p->mark = _mark;
5003 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
5004 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
5005 }
5006 _res = NULL;
5007 done:
5008 D(p->level--);
5009 return _res;
5010}
5011
5012// func_type_comment:
5013// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5014// | invalid_double_type_comments
5015// | TYPE_COMMENT
5016static Token*
5017func_type_comment_rule(Parser *p)
5018{
5019 D(p->level++);
5020 if (p->error_indicator) {
5021 D(p->level--);
5022 return NULL;
5023 }
5024 Token* _res = NULL;
5025 int _mark = p->mark;
5026 { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5027 if (p->error_indicator) {
5028 D(p->level--);
5029 return NULL;
5030 }
5031 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5032 Token * newline_var;
5033 Token * t;
5034 if (
5035 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
5036 &&
5037 (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5038 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005039 _PyPegen_lookahead(1, _tmp_53_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005040 )
5041 {
5042 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5043 _res = t;
5044 if (_res == NULL && PyErr_Occurred()) {
5045 p->error_indicator = 1;
5046 D(p->level--);
5047 return NULL;
5048 }
5049 goto done;
5050 }
5051 p->mark = _mark;
5052 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5053 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5054 }
5055 { // invalid_double_type_comments
5056 if (p->error_indicator) {
5057 D(p->level--);
5058 return NULL;
5059 }
5060 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5061 void *invalid_double_type_comments_var;
5062 if (
5063 (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
5064 )
5065 {
5066 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5067 _res = invalid_double_type_comments_var;
5068 goto done;
5069 }
5070 p->mark = _mark;
5071 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5072 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
5073 }
5074 { // TYPE_COMMENT
5075 if (p->error_indicator) {
5076 D(p->level--);
5077 return NULL;
5078 }
5079 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5080 Token * type_comment_var;
5081 if (
5082 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5083 )
5084 {
5085 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5086 _res = type_comment_var;
5087 goto done;
5088 }
5089 p->mark = _mark;
5090 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5091 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
5092 }
5093 _res = NULL;
5094 done:
5095 D(p->level--);
5096 return _res;
5097}
5098
5099// params: invalid_parameters | parameters
5100static arguments_ty
5101params_rule(Parser *p)
5102{
5103 D(p->level++);
5104 if (p->error_indicator) {
5105 D(p->level--);
5106 return NULL;
5107 }
5108 arguments_ty _res = NULL;
5109 int _mark = p->mark;
5110 { // invalid_parameters
5111 if (p->error_indicator) {
5112 D(p->level--);
5113 return NULL;
5114 }
5115 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5116 void *invalid_parameters_var;
5117 if (
5118 (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
5119 )
5120 {
5121 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5122 _res = invalid_parameters_var;
5123 goto done;
5124 }
5125 p->mark = _mark;
5126 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5127 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
5128 }
5129 { // parameters
5130 if (p->error_indicator) {
5131 D(p->level--);
5132 return NULL;
5133 }
5134 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
5135 arguments_ty parameters_var;
5136 if (
5137 (parameters_var = parameters_rule(p)) // parameters
5138 )
5139 {
5140 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
5141 _res = parameters_var;
5142 goto done;
5143 }
5144 p->mark = _mark;
5145 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5146 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
5147 }
5148 _res = NULL;
5149 done:
5150 D(p->level--);
5151 return _res;
5152}
5153
5154// parameters:
5155// | slash_no_default param_no_default* param_with_default* star_etc?
5156// | slash_with_default param_with_default* star_etc?
5157// | param_no_default+ param_with_default* star_etc?
5158// | param_with_default+ star_etc?
5159// | star_etc
5160static arguments_ty
5161parameters_rule(Parser *p)
5162{
5163 D(p->level++);
5164 if (p->error_indicator) {
5165 D(p->level--);
5166 return NULL;
5167 }
5168 arguments_ty _res = NULL;
5169 int _mark = p->mark;
5170 { // slash_no_default param_no_default* param_with_default* star_etc?
5171 if (p->error_indicator) {
5172 D(p->level--);
5173 return NULL;
5174 }
5175 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?"));
5176 asdl_seq* a;
5177 asdl_seq * b;
5178 asdl_seq * c;
5179 void *d;
5180 if (
5181 (a = slash_no_default_rule(p)) // slash_no_default
5182 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005183 (b = _loop0_54_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005184 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005185 (c = _loop0_55_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005186 &&
5187 (d = star_etc_rule(p), 1) // star_etc?
5188 )
5189 {
5190 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?"));
5191 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
5192 if (_res == NULL && PyErr_Occurred()) {
5193 p->error_indicator = 1;
5194 D(p->level--);
5195 return NULL;
5196 }
5197 goto done;
5198 }
5199 p->mark = _mark;
5200 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5201 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
5202 }
5203 { // slash_with_default param_with_default* star_etc?
5204 if (p->error_indicator) {
5205 D(p->level--);
5206 return NULL;
5207 }
5208 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5209 SlashWithDefault* a;
5210 asdl_seq * b;
5211 void *c;
5212 if (
5213 (a = slash_with_default_rule(p)) // slash_with_default
5214 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005215 (b = _loop0_56_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005216 &&
5217 (c = star_etc_rule(p), 1) // star_etc?
5218 )
5219 {
5220 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5221 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
5222 if (_res == NULL && PyErr_Occurred()) {
5223 p->error_indicator = 1;
5224 D(p->level--);
5225 return NULL;
5226 }
5227 goto done;
5228 }
5229 p->mark = _mark;
5230 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5231 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5232 }
5233 { // param_no_default+ param_with_default* star_etc?
5234 if (p->error_indicator) {
5235 D(p->level--);
5236 return NULL;
5237 }
5238 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5239 asdl_seq * a;
5240 asdl_seq * b;
5241 void *c;
5242 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005243 (a = _loop1_57_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005244 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005245 (b = _loop0_58_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005246 &&
5247 (c = star_etc_rule(p), 1) // star_etc?
5248 )
5249 {
5250 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5251 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
5252 if (_res == NULL && PyErr_Occurred()) {
5253 p->error_indicator = 1;
5254 D(p->level--);
5255 return NULL;
5256 }
5257 goto done;
5258 }
5259 p->mark = _mark;
5260 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5261 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5262 }
5263 { // param_with_default+ star_etc?
5264 if (p->error_indicator) {
5265 D(p->level--);
5266 return NULL;
5267 }
5268 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5269 asdl_seq * a;
5270 void *b;
5271 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005272 (a = _loop1_59_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005273 &&
5274 (b = star_etc_rule(p), 1) // star_etc?
5275 )
5276 {
5277 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5278 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
5279 if (_res == NULL && PyErr_Occurred()) {
5280 p->error_indicator = 1;
5281 D(p->level--);
5282 return NULL;
5283 }
5284 goto done;
5285 }
5286 p->mark = _mark;
5287 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5288 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
5289 }
5290 { // star_etc
5291 if (p->error_indicator) {
5292 D(p->level--);
5293 return NULL;
5294 }
5295 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
5296 StarEtc* a;
5297 if (
5298 (a = star_etc_rule(p)) // star_etc
5299 )
5300 {
5301 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
5302 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
5303 if (_res == NULL && PyErr_Occurred()) {
5304 p->error_indicator = 1;
5305 D(p->level--);
5306 return NULL;
5307 }
5308 goto done;
5309 }
5310 p->mark = _mark;
5311 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5312 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
5313 }
5314 _res = NULL;
5315 done:
5316 D(p->level--);
5317 return _res;
5318}
5319
5320// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
5321static asdl_seq*
5322slash_no_default_rule(Parser *p)
5323{
5324 D(p->level++);
5325 if (p->error_indicator) {
5326 D(p->level--);
5327 return NULL;
5328 }
5329 asdl_seq* _res = NULL;
5330 int _mark = p->mark;
5331 { // param_no_default+ '/' ','
5332 if (p->error_indicator) {
5333 D(p->level--);
5334 return NULL;
5335 }
5336 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5337 Token * _literal;
5338 Token * _literal_1;
5339 asdl_seq * a;
5340 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005341 (a = _loop1_60_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005342 &&
5343 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5344 &&
5345 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5346 )
5347 {
5348 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5349 _res = a;
5350 if (_res == NULL && PyErr_Occurred()) {
5351 p->error_indicator = 1;
5352 D(p->level--);
5353 return NULL;
5354 }
5355 goto done;
5356 }
5357 p->mark = _mark;
5358 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5359 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
5360 }
5361 { // param_no_default+ '/' &')'
5362 if (p->error_indicator) {
5363 D(p->level--);
5364 return NULL;
5365 }
5366 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5367 Token * _literal;
5368 asdl_seq * a;
5369 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005370 (a = _loop1_61_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005371 &&
5372 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5373 &&
5374 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5375 )
5376 {
5377 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5378 _res = a;
5379 if (_res == NULL && PyErr_Occurred()) {
5380 p->error_indicator = 1;
5381 D(p->level--);
5382 return NULL;
5383 }
5384 goto done;
5385 }
5386 p->mark = _mark;
5387 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5388 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
5389 }
5390 _res = NULL;
5391 done:
5392 D(p->level--);
5393 return _res;
5394}
5395
5396// slash_with_default:
5397// | param_no_default* param_with_default+ '/' ','
5398// | param_no_default* param_with_default+ '/' &')'
5399static SlashWithDefault*
5400slash_with_default_rule(Parser *p)
5401{
5402 D(p->level++);
5403 if (p->error_indicator) {
5404 D(p->level--);
5405 return NULL;
5406 }
5407 SlashWithDefault* _res = NULL;
5408 int _mark = p->mark;
5409 { // param_no_default* param_with_default+ '/' ','
5410 if (p->error_indicator) {
5411 D(p->level--);
5412 return NULL;
5413 }
5414 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5415 Token * _literal;
5416 Token * _literal_1;
5417 asdl_seq * a;
5418 asdl_seq * b;
5419 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005420 (a = _loop0_62_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005421 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005422 (b = _loop1_63_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005423 &&
5424 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5425 &&
5426 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5427 )
5428 {
5429 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5430 _res = _PyPegen_slash_with_default ( p , a , b );
5431 if (_res == NULL && PyErr_Occurred()) {
5432 p->error_indicator = 1;
5433 D(p->level--);
5434 return NULL;
5435 }
5436 goto done;
5437 }
5438 p->mark = _mark;
5439 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5440 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5441 }
5442 { // param_no_default* param_with_default+ '/' &')'
5443 if (p->error_indicator) {
5444 D(p->level--);
5445 return NULL;
5446 }
5447 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5448 Token * _literal;
5449 asdl_seq * a;
5450 asdl_seq * b;
5451 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005452 (a = _loop0_64_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005453 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005454 (b = _loop1_65_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005455 &&
5456 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5457 &&
5458 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5459 )
5460 {
5461 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5462 _res = _PyPegen_slash_with_default ( p , a , b );
5463 if (_res == NULL && PyErr_Occurred()) {
5464 p->error_indicator = 1;
5465 D(p->level--);
5466 return NULL;
5467 }
5468 goto done;
5469 }
5470 p->mark = _mark;
5471 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5472 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5473 }
5474 _res = NULL;
5475 done:
5476 D(p->level--);
5477 return _res;
5478}
5479
5480// star_etc:
5481// | '*' param_no_default param_maybe_default* kwds?
5482// | '*' ',' param_maybe_default+ kwds?
5483// | kwds
5484// | invalid_star_etc
5485static StarEtc*
5486star_etc_rule(Parser *p)
5487{
5488 D(p->level++);
5489 if (p->error_indicator) {
5490 D(p->level--);
5491 return NULL;
5492 }
5493 StarEtc* _res = NULL;
5494 int _mark = p->mark;
5495 { // '*' param_no_default param_maybe_default* kwds?
5496 if (p->error_indicator) {
5497 D(p->level--);
5498 return NULL;
5499 }
5500 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5501 Token * _literal;
5502 arg_ty a;
5503 asdl_seq * b;
5504 void *c;
5505 if (
5506 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5507 &&
5508 (a = param_no_default_rule(p)) // param_no_default
5509 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005510 (b = _loop0_66_rule(p)) // param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005511 &&
5512 (c = kwds_rule(p), 1) // kwds?
5513 )
5514 {
5515 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5516 _res = _PyPegen_star_etc ( p , a , b , c );
5517 if (_res == NULL && PyErr_Occurred()) {
5518 p->error_indicator = 1;
5519 D(p->level--);
5520 return NULL;
5521 }
5522 goto done;
5523 }
5524 p->mark = _mark;
5525 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5526 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5527 }
5528 { // '*' ',' param_maybe_default+ kwds?
5529 if (p->error_indicator) {
5530 D(p->level--);
5531 return NULL;
5532 }
5533 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5534 Token * _literal;
5535 Token * _literal_1;
5536 asdl_seq * b;
5537 void *c;
5538 if (
5539 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5540 &&
5541 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5542 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005543 (b = _loop1_67_rule(p)) // param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005544 &&
5545 (c = kwds_rule(p), 1) // kwds?
5546 )
5547 {
5548 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5549 _res = _PyPegen_star_etc ( p , NULL , b , c );
5550 if (_res == NULL && PyErr_Occurred()) {
5551 p->error_indicator = 1;
5552 D(p->level--);
5553 return NULL;
5554 }
5555 goto done;
5556 }
5557 p->mark = _mark;
5558 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5559 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5560 }
5561 { // kwds
5562 if (p->error_indicator) {
5563 D(p->level--);
5564 return NULL;
5565 }
5566 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
5567 arg_ty a;
5568 if (
5569 (a = kwds_rule(p)) // kwds
5570 )
5571 {
5572 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
5573 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
5574 if (_res == NULL && PyErr_Occurred()) {
5575 p->error_indicator = 1;
5576 D(p->level--);
5577 return NULL;
5578 }
5579 goto done;
5580 }
5581 p->mark = _mark;
5582 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5583 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
5584 }
5585 { // invalid_star_etc
5586 if (p->error_indicator) {
5587 D(p->level--);
5588 return NULL;
5589 }
5590 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5591 void *invalid_star_etc_var;
5592 if (
5593 (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
5594 )
5595 {
5596 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5597 _res = invalid_star_etc_var;
5598 goto done;
5599 }
5600 p->mark = _mark;
5601 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5602 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
5603 }
5604 _res = NULL;
5605 done:
5606 D(p->level--);
5607 return _res;
5608}
5609
5610// kwds: '**' param_no_default
5611static arg_ty
5612kwds_rule(Parser *p)
5613{
5614 D(p->level++);
5615 if (p->error_indicator) {
5616 D(p->level--);
5617 return NULL;
5618 }
5619 arg_ty _res = NULL;
5620 int _mark = p->mark;
5621 { // '**' param_no_default
5622 if (p->error_indicator) {
5623 D(p->level--);
5624 return NULL;
5625 }
5626 D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5627 Token * _literal;
5628 arg_ty a;
5629 if (
5630 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
5631 &&
5632 (a = param_no_default_rule(p)) // param_no_default
5633 )
5634 {
5635 D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5636 _res = a;
5637 if (_res == NULL && PyErr_Occurred()) {
5638 p->error_indicator = 1;
5639 D(p->level--);
5640 return NULL;
5641 }
5642 goto done;
5643 }
5644 p->mark = _mark;
5645 D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
5646 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
5647 }
5648 _res = NULL;
5649 done:
5650 D(p->level--);
5651 return _res;
5652}
5653
5654// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
5655static arg_ty
5656param_no_default_rule(Parser *p)
5657{
5658 D(p->level++);
5659 if (p->error_indicator) {
5660 D(p->level--);
5661 return NULL;
5662 }
5663 arg_ty _res = NULL;
5664 int _mark = p->mark;
5665 { // param ',' TYPE_COMMENT?
5666 if (p->error_indicator) {
5667 D(p->level--);
5668 return NULL;
5669 }
5670 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5671 Token * _literal;
5672 arg_ty a;
5673 void *tc;
5674 if (
5675 (a = param_rule(p)) // param
5676 &&
5677 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5678 &&
5679 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5680 )
5681 {
5682 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5683 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5684 if (_res == NULL && PyErr_Occurred()) {
5685 p->error_indicator = 1;
5686 D(p->level--);
5687 return NULL;
5688 }
5689 goto done;
5690 }
5691 p->mark = _mark;
5692 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5693 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
5694 }
5695 { // param TYPE_COMMENT? &')'
5696 if (p->error_indicator) {
5697 D(p->level--);
5698 return NULL;
5699 }
5700 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5701 arg_ty a;
5702 void *tc;
5703 if (
5704 (a = param_rule(p)) // param
5705 &&
5706 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5707 &&
5708 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5709 )
5710 {
5711 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5712 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5713 if (_res == NULL && PyErr_Occurred()) {
5714 p->error_indicator = 1;
5715 D(p->level--);
5716 return NULL;
5717 }
5718 goto done;
5719 }
5720 p->mark = _mark;
5721 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5722 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
5723 }
5724 _res = NULL;
5725 done:
5726 D(p->level--);
5727 return _res;
5728}
5729
5730// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
5731static NameDefaultPair*
5732param_with_default_rule(Parser *p)
5733{
5734 D(p->level++);
5735 if (p->error_indicator) {
5736 D(p->level--);
5737 return NULL;
5738 }
5739 NameDefaultPair* _res = NULL;
5740 int _mark = p->mark;
5741 { // param default ',' TYPE_COMMENT?
5742 if (p->error_indicator) {
5743 D(p->level--);
5744 return NULL;
5745 }
5746 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5747 Token * _literal;
5748 arg_ty a;
5749 expr_ty c;
5750 void *tc;
5751 if (
5752 (a = param_rule(p)) // param
5753 &&
5754 (c = default_rule(p)) // default
5755 &&
5756 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5757 &&
5758 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5759 )
5760 {
5761 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5762 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5763 if (_res == NULL && PyErr_Occurred()) {
5764 p->error_indicator = 1;
5765 D(p->level--);
5766 return NULL;
5767 }
5768 goto done;
5769 }
5770 p->mark = _mark;
5771 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5772 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5773 }
5774 { // param default TYPE_COMMENT? &')'
5775 if (p->error_indicator) {
5776 D(p->level--);
5777 return NULL;
5778 }
5779 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5780 arg_ty a;
5781 expr_ty c;
5782 void *tc;
5783 if (
5784 (a = param_rule(p)) // param
5785 &&
5786 (c = default_rule(p)) // default
5787 &&
5788 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5789 &&
5790 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5791 )
5792 {
5793 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5794 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5795 if (_res == NULL && PyErr_Occurred()) {
5796 p->error_indicator = 1;
5797 D(p->level--);
5798 return NULL;
5799 }
5800 goto done;
5801 }
5802 p->mark = _mark;
5803 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5804 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5805 }
5806 _res = NULL;
5807 done:
5808 D(p->level--);
5809 return _res;
5810}
5811
5812// param_maybe_default:
5813// | param default? ',' TYPE_COMMENT?
5814// | param default? TYPE_COMMENT? &')'
5815static NameDefaultPair*
5816param_maybe_default_rule(Parser *p)
5817{
5818 D(p->level++);
5819 if (p->error_indicator) {
5820 D(p->level--);
5821 return NULL;
5822 }
5823 NameDefaultPair* _res = NULL;
5824 int _mark = p->mark;
5825 { // param default? ',' TYPE_COMMENT?
5826 if (p->error_indicator) {
5827 D(p->level--);
5828 return NULL;
5829 }
5830 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5831 Token * _literal;
5832 arg_ty a;
5833 void *c;
5834 void *tc;
5835 if (
5836 (a = param_rule(p)) // param
5837 &&
5838 (c = default_rule(p), 1) // default?
5839 &&
5840 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5841 &&
5842 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5843 )
5844 {
5845 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5846 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5847 if (_res == NULL && PyErr_Occurred()) {
5848 p->error_indicator = 1;
5849 D(p->level--);
5850 return NULL;
5851 }
5852 goto done;
5853 }
5854 p->mark = _mark;
5855 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5856 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5857 }
5858 { // param default? TYPE_COMMENT? &')'
5859 if (p->error_indicator) {
5860 D(p->level--);
5861 return NULL;
5862 }
5863 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5864 arg_ty a;
5865 void *c;
5866 void *tc;
5867 if (
5868 (a = param_rule(p)) // param
5869 &&
5870 (c = default_rule(p), 1) // default?
5871 &&
5872 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5873 &&
5874 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5875 )
5876 {
5877 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5878 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5879 if (_res == NULL && PyErr_Occurred()) {
5880 p->error_indicator = 1;
5881 D(p->level--);
5882 return NULL;
5883 }
5884 goto done;
5885 }
5886 p->mark = _mark;
5887 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5888 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5889 }
5890 _res = NULL;
5891 done:
5892 D(p->level--);
5893 return _res;
5894}
5895
5896// param: NAME annotation?
5897static arg_ty
5898param_rule(Parser *p)
5899{
5900 D(p->level++);
5901 if (p->error_indicator) {
5902 D(p->level--);
5903 return NULL;
5904 }
5905 arg_ty _res = NULL;
5906 int _mark = p->mark;
5907 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5908 p->error_indicator = 1;
5909 D(p->level--);
5910 return NULL;
5911 }
5912 int _start_lineno = p->tokens[_mark]->lineno;
5913 UNUSED(_start_lineno); // Only used by EXTRA macro
5914 int _start_col_offset = p->tokens[_mark]->col_offset;
5915 UNUSED(_start_col_offset); // Only used by EXTRA macro
5916 { // NAME annotation?
5917 if (p->error_indicator) {
5918 D(p->level--);
5919 return NULL;
5920 }
5921 D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5922 expr_ty a;
5923 void *b;
5924 if (
5925 (a = _PyPegen_name_token(p)) // NAME
5926 &&
5927 (b = annotation_rule(p), 1) // annotation?
5928 )
5929 {
5930 D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5931 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5932 if (_token == NULL) {
5933 D(p->level--);
5934 return NULL;
5935 }
5936 int _end_lineno = _token->end_lineno;
5937 UNUSED(_end_lineno); // Only used by EXTRA macro
5938 int _end_col_offset = _token->end_col_offset;
5939 UNUSED(_end_col_offset); // Only used by EXTRA macro
5940 _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
5941 if (_res == NULL && PyErr_Occurred()) {
5942 p->error_indicator = 1;
5943 D(p->level--);
5944 return NULL;
5945 }
5946 goto done;
5947 }
5948 p->mark = _mark;
5949 D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
5950 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
5951 }
5952 _res = NULL;
5953 done:
5954 D(p->level--);
5955 return _res;
5956}
5957
5958// annotation: ':' expression
5959static expr_ty
5960annotation_rule(Parser *p)
5961{
5962 D(p->level++);
5963 if (p->error_indicator) {
5964 D(p->level--);
5965 return NULL;
5966 }
5967 expr_ty _res = NULL;
5968 int _mark = p->mark;
5969 { // ':' expression
5970 if (p->error_indicator) {
5971 D(p->level--);
5972 return NULL;
5973 }
5974 D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
5975 Token * _literal;
5976 expr_ty a;
5977 if (
5978 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
5979 &&
5980 (a = expression_rule(p)) // expression
5981 )
5982 {
5983 D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
5984 _res = a;
5985 if (_res == NULL && PyErr_Occurred()) {
5986 p->error_indicator = 1;
5987 D(p->level--);
5988 return NULL;
5989 }
5990 goto done;
5991 }
5992 p->mark = _mark;
5993 D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
5994 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
5995 }
5996 _res = NULL;
5997 done:
5998 D(p->level--);
5999 return _res;
6000}
6001
6002// default: '=' expression
6003static expr_ty
6004default_rule(Parser *p)
6005{
6006 D(p->level++);
6007 if (p->error_indicator) {
6008 D(p->level--);
6009 return NULL;
6010 }
6011 expr_ty _res = NULL;
6012 int _mark = p->mark;
6013 { // '=' expression
6014 if (p->error_indicator) {
6015 D(p->level--);
6016 return NULL;
6017 }
6018 D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6019 Token * _literal;
6020 expr_ty a;
6021 if (
6022 (_literal = _PyPegen_expect_token(p, 22)) // token='='
6023 &&
6024 (a = expression_rule(p)) // expression
6025 )
6026 {
6027 D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6028 _res = a;
6029 if (_res == NULL && PyErr_Occurred()) {
6030 p->error_indicator = 1;
6031 D(p->level--);
6032 return NULL;
6033 }
6034 goto done;
6035 }
6036 p->mark = _mark;
6037 D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
6038 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
6039 }
6040 _res = NULL;
6041 done:
6042 D(p->level--);
6043 return _res;
6044}
6045
6046// decorators: (('@' named_expression NEWLINE))+
6047static asdl_seq*
6048decorators_rule(Parser *p)
6049{
6050 D(p->level++);
6051 if (p->error_indicator) {
6052 D(p->level--);
6053 return NULL;
6054 }
6055 asdl_seq* _res = NULL;
6056 int _mark = p->mark;
6057 { // (('@' named_expression NEWLINE))+
6058 if (p->error_indicator) {
6059 D(p->level--);
6060 return NULL;
6061 }
6062 D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6063 asdl_seq * a;
6064 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006065 (a = _loop1_68_rule(p)) // (('@' named_expression NEWLINE))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006066 )
6067 {
6068 D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6069 _res = a;
6070 if (_res == NULL && PyErr_Occurred()) {
6071 p->error_indicator = 1;
6072 D(p->level--);
6073 return NULL;
6074 }
6075 goto done;
6076 }
6077 p->mark = _mark;
6078 D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
6079 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6080 }
6081 _res = NULL;
6082 done:
6083 D(p->level--);
6084 return _res;
6085}
6086
6087// class_def: decorators class_def_raw | class_def_raw
6088static stmt_ty
6089class_def_rule(Parser *p)
6090{
6091 D(p->level++);
6092 if (p->error_indicator) {
6093 D(p->level--);
6094 return NULL;
6095 }
6096 stmt_ty _res = NULL;
6097 int _mark = p->mark;
6098 { // decorators class_def_raw
6099 if (p->error_indicator) {
6100 D(p->level--);
6101 return NULL;
6102 }
6103 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6104 asdl_seq* a;
6105 stmt_ty b;
6106 if (
6107 (a = decorators_rule(p)) // decorators
6108 &&
6109 (b = class_def_raw_rule(p)) // class_def_raw
6110 )
6111 {
6112 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6113 _res = _PyPegen_class_def_decorators ( p , a , b );
6114 if (_res == NULL && PyErr_Occurred()) {
6115 p->error_indicator = 1;
6116 D(p->level--);
6117 return NULL;
6118 }
6119 goto done;
6120 }
6121 p->mark = _mark;
6122 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6123 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
6124 }
6125 { // class_def_raw
6126 if (p->error_indicator) {
6127 D(p->level--);
6128 return NULL;
6129 }
6130 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6131 stmt_ty class_def_raw_var;
6132 if (
6133 (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
6134 )
6135 {
6136 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6137 _res = class_def_raw_var;
6138 goto done;
6139 }
6140 p->mark = _mark;
6141 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6142 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
6143 }
6144 _res = NULL;
6145 done:
6146 D(p->level--);
6147 return _res;
6148}
6149
6150// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
6151static stmt_ty
6152class_def_raw_rule(Parser *p)
6153{
6154 D(p->level++);
6155 if (p->error_indicator) {
6156 D(p->level--);
6157 return NULL;
6158 }
6159 stmt_ty _res = NULL;
6160 int _mark = p->mark;
6161 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6162 p->error_indicator = 1;
6163 D(p->level--);
6164 return NULL;
6165 }
6166 int _start_lineno = p->tokens[_mark]->lineno;
6167 UNUSED(_start_lineno); // Only used by EXTRA macro
6168 int _start_col_offset = p->tokens[_mark]->col_offset;
6169 UNUSED(_start_col_offset); // Only used by EXTRA macro
6170 { // 'class' NAME ['(' arguments? ')'] ':' block
6171 if (p->error_indicator) {
6172 D(p->level--);
6173 return NULL;
6174 }
6175 D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6176 Token * _keyword;
6177 Token * _literal;
6178 expr_ty a;
6179 void *b;
6180 asdl_seq* c;
6181 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006182 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006183 &&
6184 (a = _PyPegen_name_token(p)) // NAME
6185 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006186 (b = _tmp_69_rule(p), 1) // ['(' arguments? ')']
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006187 &&
6188 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
6189 &&
6190 (c = block_rule(p)) // block
6191 )
6192 {
6193 D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6194 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6195 if (_token == NULL) {
6196 D(p->level--);
6197 return NULL;
6198 }
6199 int _end_lineno = _token->end_lineno;
6200 UNUSED(_end_lineno); // Only used by EXTRA macro
6201 int _end_col_offset = _token->end_col_offset;
6202 UNUSED(_end_col_offset); // Only used by EXTRA macro
6203 _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 );
6204 if (_res == NULL && PyErr_Occurred()) {
6205 p->error_indicator = 1;
6206 D(p->level--);
6207 return NULL;
6208 }
6209 goto done;
6210 }
6211 p->mark = _mark;
6212 D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
6213 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6214 }
6215 _res = NULL;
6216 done:
6217 D(p->level--);
6218 return _res;
6219}
6220
6221// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
6222static asdl_seq*
6223block_rule(Parser *p)
6224{
6225 D(p->level++);
6226 if (p->error_indicator) {
6227 D(p->level--);
6228 return NULL;
6229 }
6230 asdl_seq* _res = NULL;
6231 if (_PyPegen_is_memoized(p, block_type, &_res)) {
6232 D(p->level--);
6233 return _res;
6234 }
6235 int _mark = p->mark;
6236 { // NEWLINE INDENT statements DEDENT
6237 if (p->error_indicator) {
6238 D(p->level--);
6239 return NULL;
6240 }
6241 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6242 asdl_seq* a;
6243 Token * dedent_var;
6244 Token * indent_var;
6245 Token * newline_var;
6246 if (
6247 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
6248 &&
6249 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
6250 &&
6251 (a = statements_rule(p)) // statements
6252 &&
6253 (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
6254 )
6255 {
6256 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6257 _res = a;
6258 if (_res == NULL && PyErr_Occurred()) {
6259 p->error_indicator = 1;
6260 D(p->level--);
6261 return NULL;
6262 }
6263 goto done;
6264 }
6265 p->mark = _mark;
6266 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6267 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6268 }
6269 { // simple_stmt
6270 if (p->error_indicator) {
6271 D(p->level--);
6272 return NULL;
6273 }
6274 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6275 asdl_seq* simple_stmt_var;
6276 if (
6277 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
6278 )
6279 {
6280 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6281 _res = simple_stmt_var;
6282 goto done;
6283 }
6284 p->mark = _mark;
6285 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6286 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
6287 }
6288 { // invalid_block
6289 if (p->error_indicator) {
6290 D(p->level--);
6291 return NULL;
6292 }
6293 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6294 void *invalid_block_var;
6295 if (
6296 (invalid_block_var = invalid_block_rule(p)) // invalid_block
6297 )
6298 {
6299 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6300 _res = invalid_block_var;
6301 goto done;
6302 }
6303 p->mark = _mark;
6304 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6305 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
6306 }
6307 _res = NULL;
6308 done:
6309 _PyPegen_insert_memo(p, _mark, block_type, _res);
6310 D(p->level--);
6311 return _res;
6312}
6313
6314// expressions_list: ','.star_expression+ ','?
6315static asdl_seq*
6316expressions_list_rule(Parser *p)
6317{
6318 D(p->level++);
6319 if (p->error_indicator) {
6320 D(p->level--);
6321 return NULL;
6322 }
6323 asdl_seq* _res = NULL;
6324 int _mark = p->mark;
6325 { // ','.star_expression+ ','?
6326 if (p->error_indicator) {
6327 D(p->level--);
6328 return NULL;
6329 }
6330 D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6331 void *_opt_var;
6332 UNUSED(_opt_var); // Silence compiler warnings
6333 asdl_seq * a;
6334 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006335 (a = _gather_70_rule(p)) // ','.star_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006336 &&
6337 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6338 )
6339 {
6340 D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6341 _res = a;
6342 if (_res == NULL && PyErr_Occurred()) {
6343 p->error_indicator = 1;
6344 D(p->level--);
6345 return NULL;
6346 }
6347 goto done;
6348 }
6349 p->mark = _mark;
6350 D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ',
6351 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?"));
6352 }
6353 _res = NULL;
6354 done:
6355 D(p->level--);
6356 return _res;
6357}
6358
6359// star_expressions:
6360// | star_expression ((',' star_expression))+ ','?
6361// | star_expression ','
6362// | star_expression
6363static expr_ty
6364star_expressions_rule(Parser *p)
6365{
6366 D(p->level++);
6367 if (p->error_indicator) {
6368 D(p->level--);
6369 return NULL;
6370 }
6371 expr_ty _res = NULL;
6372 int _mark = p->mark;
6373 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6374 p->error_indicator = 1;
6375 D(p->level--);
6376 return NULL;
6377 }
6378 int _start_lineno = p->tokens[_mark]->lineno;
6379 UNUSED(_start_lineno); // Only used by EXTRA macro
6380 int _start_col_offset = p->tokens[_mark]->col_offset;
6381 UNUSED(_start_col_offset); // Only used by EXTRA macro
6382 { // star_expression ((',' star_expression))+ ','?
6383 if (p->error_indicator) {
6384 D(p->level--);
6385 return NULL;
6386 }
6387 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6388 void *_opt_var;
6389 UNUSED(_opt_var); // Silence compiler warnings
6390 expr_ty a;
6391 asdl_seq * b;
6392 if (
6393 (a = star_expression_rule(p)) // star_expression
6394 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006395 (b = _loop1_72_rule(p)) // ((',' star_expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006396 &&
6397 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6398 )
6399 {
6400 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6401 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6402 if (_token == NULL) {
6403 D(p->level--);
6404 return NULL;
6405 }
6406 int _end_lineno = _token->end_lineno;
6407 UNUSED(_end_lineno); // Only used by EXTRA macro
6408 int _end_col_offset = _token->end_col_offset;
6409 UNUSED(_end_col_offset); // Only used by EXTRA macro
6410 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
6411 if (_res == NULL && PyErr_Occurred()) {
6412 p->error_indicator = 1;
6413 D(p->level--);
6414 return NULL;
6415 }
6416 goto done;
6417 }
6418 p->mark = _mark;
6419 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6420 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6421 }
6422 { // star_expression ','
6423 if (p->error_indicator) {
6424 D(p->level--);
6425 return NULL;
6426 }
6427 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6428 Token * _literal;
6429 expr_ty a;
6430 if (
6431 (a = star_expression_rule(p)) // star_expression
6432 &&
6433 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6434 )
6435 {
6436 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6437 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6438 if (_token == NULL) {
6439 D(p->level--);
6440 return NULL;
6441 }
6442 int _end_lineno = _token->end_lineno;
6443 UNUSED(_end_lineno); // Only used by EXTRA macro
6444 int _end_col_offset = _token->end_col_offset;
6445 UNUSED(_end_col_offset); // Only used by EXTRA macro
6446 _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
6447 if (_res == NULL && PyErr_Occurred()) {
6448 p->error_indicator = 1;
6449 D(p->level--);
6450 return NULL;
6451 }
6452 goto done;
6453 }
6454 p->mark = _mark;
6455 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6456 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','"));
6457 }
6458 { // star_expression
6459 if (p->error_indicator) {
6460 D(p->level--);
6461 return NULL;
6462 }
6463 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
6464 expr_ty star_expression_var;
6465 if (
6466 (star_expression_var = star_expression_rule(p)) // star_expression
6467 )
6468 {
6469 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
6470 _res = star_expression_var;
6471 goto done;
6472 }
6473 p->mark = _mark;
6474 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
6476 }
6477 _res = NULL;
6478 done:
6479 D(p->level--);
6480 return _res;
6481}
6482
6483// star_expression: '*' bitwise_or | expression
6484static expr_ty
6485star_expression_rule(Parser *p)
6486{
6487 D(p->level++);
6488 if (p->error_indicator) {
6489 D(p->level--);
6490 return NULL;
6491 }
6492 expr_ty _res = NULL;
6493 if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
6494 D(p->level--);
6495 return _res;
6496 }
6497 int _mark = p->mark;
6498 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6499 p->error_indicator = 1;
6500 D(p->level--);
6501 return NULL;
6502 }
6503 int _start_lineno = p->tokens[_mark]->lineno;
6504 UNUSED(_start_lineno); // Only used by EXTRA macro
6505 int _start_col_offset = p->tokens[_mark]->col_offset;
6506 UNUSED(_start_col_offset); // Only used by EXTRA macro
6507 { // '*' bitwise_or
6508 if (p->error_indicator) {
6509 D(p->level--);
6510 return NULL;
6511 }
6512 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6513 Token * _literal;
6514 expr_ty a;
6515 if (
6516 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6517 &&
6518 (a = bitwise_or_rule(p)) // bitwise_or
6519 )
6520 {
6521 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6522 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6523 if (_token == NULL) {
6524 D(p->level--);
6525 return NULL;
6526 }
6527 int _end_lineno = _token->end_lineno;
6528 UNUSED(_end_lineno); // Only used by EXTRA macro
6529 int _end_col_offset = _token->end_col_offset;
6530 UNUSED(_end_col_offset); // Only used by EXTRA macro
6531 _res = _Py_Starred ( a , Load , EXTRA );
6532 if (_res == NULL && PyErr_Occurred()) {
6533 p->error_indicator = 1;
6534 D(p->level--);
6535 return NULL;
6536 }
6537 goto done;
6538 }
6539 p->mark = _mark;
6540 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6541 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6542 }
6543 { // expression
6544 if (p->error_indicator) {
6545 D(p->level--);
6546 return NULL;
6547 }
6548 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6549 expr_ty expression_var;
6550 if (
6551 (expression_var = expression_rule(p)) // expression
6552 )
6553 {
6554 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6555 _res = expression_var;
6556 goto done;
6557 }
6558 p->mark = _mark;
6559 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6560 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6561 }
6562 _res = NULL;
6563 done:
6564 _PyPegen_insert_memo(p, _mark, star_expression_type, _res);
6565 D(p->level--);
6566 return _res;
6567}
6568
6569// star_named_expressions: ','.star_named_expression+ ','?
6570static asdl_seq*
6571star_named_expressions_rule(Parser *p)
6572{
6573 D(p->level++);
6574 if (p->error_indicator) {
6575 D(p->level--);
6576 return NULL;
6577 }
6578 asdl_seq* _res = NULL;
6579 int _mark = p->mark;
6580 { // ','.star_named_expression+ ','?
6581 if (p->error_indicator) {
6582 D(p->level--);
6583 return NULL;
6584 }
6585 D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6586 void *_opt_var;
6587 UNUSED(_opt_var); // Silence compiler warnings
6588 asdl_seq * a;
6589 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006590 (a = _gather_73_rule(p)) // ','.star_named_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006591 &&
6592 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6593 )
6594 {
6595 D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6596 _res = a;
6597 if (_res == NULL && PyErr_Occurred()) {
6598 p->error_indicator = 1;
6599 D(p->level--);
6600 return NULL;
6601 }
6602 goto done;
6603 }
6604 p->mark = _mark;
6605 D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6606 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
6607 }
6608 _res = NULL;
6609 done:
6610 D(p->level--);
6611 return _res;
6612}
6613
6614// star_named_expression: '*' bitwise_or | named_expression
6615static expr_ty
6616star_named_expression_rule(Parser *p)
6617{
6618 D(p->level++);
6619 if (p->error_indicator) {
6620 D(p->level--);
6621 return NULL;
6622 }
6623 expr_ty _res = NULL;
6624 int _mark = p->mark;
6625 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6626 p->error_indicator = 1;
6627 D(p->level--);
6628 return NULL;
6629 }
6630 int _start_lineno = p->tokens[_mark]->lineno;
6631 UNUSED(_start_lineno); // Only used by EXTRA macro
6632 int _start_col_offset = p->tokens[_mark]->col_offset;
6633 UNUSED(_start_col_offset); // Only used by EXTRA macro
6634 { // '*' bitwise_or
6635 if (p->error_indicator) {
6636 D(p->level--);
6637 return NULL;
6638 }
6639 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6640 Token * _literal;
6641 expr_ty a;
6642 if (
6643 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6644 &&
6645 (a = bitwise_or_rule(p)) // bitwise_or
6646 )
6647 {
6648 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6649 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6650 if (_token == NULL) {
6651 D(p->level--);
6652 return NULL;
6653 }
6654 int _end_lineno = _token->end_lineno;
6655 UNUSED(_end_lineno); // Only used by EXTRA macro
6656 int _end_col_offset = _token->end_col_offset;
6657 UNUSED(_end_col_offset); // Only used by EXTRA macro
6658 _res = _Py_Starred ( a , Load , EXTRA );
6659 if (_res == NULL && PyErr_Occurred()) {
6660 p->error_indicator = 1;
6661 D(p->level--);
6662 return NULL;
6663 }
6664 goto done;
6665 }
6666 p->mark = _mark;
6667 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6668 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6669 }
6670 { // named_expression
6671 if (p->error_indicator) {
6672 D(p->level--);
6673 return NULL;
6674 }
6675 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
6676 expr_ty named_expression_var;
6677 if (
6678 (named_expression_var = named_expression_rule(p)) // named_expression
6679 )
6680 {
6681 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
6682 _res = named_expression_var;
6683 goto done;
6684 }
6685 p->mark = _mark;
6686 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6687 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
6688 }
6689 _res = NULL;
6690 done:
6691 D(p->level--);
6692 return _res;
6693}
6694
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006695// named_expression: NAME ':=' ~ expression | expression !':=' | invalid_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006696static expr_ty
6697named_expression_rule(Parser *p)
6698{
6699 D(p->level++);
6700 if (p->error_indicator) {
6701 D(p->level--);
6702 return NULL;
6703 }
6704 expr_ty _res = NULL;
6705 int _mark = p->mark;
6706 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6707 p->error_indicator = 1;
6708 D(p->level--);
6709 return NULL;
6710 }
6711 int _start_lineno = p->tokens[_mark]->lineno;
6712 UNUSED(_start_lineno); // Only used by EXTRA macro
6713 int _start_col_offset = p->tokens[_mark]->col_offset;
6714 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006715 { // NAME ':=' ~ expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006716 if (p->error_indicator) {
6717 D(p->level--);
6718 return NULL;
6719 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006720 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
6721 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006722 Token * _literal;
6723 expr_ty a;
6724 expr_ty b;
6725 if (
6726 (a = _PyPegen_name_token(p)) // NAME
6727 &&
6728 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
6729 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006730 (_cut_var = 1)
6731 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006732 (b = expression_rule(p)) // expression
6733 )
6734 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006735 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 +01006736 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6737 if (_token == NULL) {
6738 D(p->level--);
6739 return NULL;
6740 }
6741 int _end_lineno = _token->end_lineno;
6742 UNUSED(_end_lineno); // Only used by EXTRA macro
6743 int _end_col_offset = _token->end_col_offset;
6744 UNUSED(_end_col_offset); // Only used by EXTRA macro
6745 _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
6746 if (_res == NULL && PyErr_Occurred()) {
6747 p->error_indicator = 1;
6748 D(p->level--);
6749 return NULL;
6750 }
6751 goto done;
6752 }
6753 p->mark = _mark;
6754 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006755 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
6756 if (_cut_var) {
6757 D(p->level--);
6758 return NULL;
6759 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006760 }
6761 { // expression !':='
6762 if (p->error_indicator) {
6763 D(p->level--);
6764 return NULL;
6765 }
6766 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6767 expr_ty expression_var;
6768 if (
6769 (expression_var = expression_rule(p)) // expression
6770 &&
6771 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
6772 )
6773 {
6774 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6775 _res = expression_var;
6776 goto done;
6777 }
6778 p->mark = _mark;
6779 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6780 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
6781 }
6782 { // invalid_named_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, "invalid_named_expression"));
6788 void *invalid_named_expression_var;
6789 if (
6790 (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression
6791 )
6792 {
6793 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6794 _res = invalid_named_expression_var;
6795 goto done;
6796 }
6797 p->mark = _mark;
6798 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6799 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
6800 }
6801 _res = NULL;
6802 done:
6803 D(p->level--);
6804 return _res;
6805}
6806
6807// annotated_rhs: yield_expr | star_expressions
6808static expr_ty
6809annotated_rhs_rule(Parser *p)
6810{
6811 D(p->level++);
6812 if (p->error_indicator) {
6813 D(p->level--);
6814 return NULL;
6815 }
6816 expr_ty _res = NULL;
6817 int _mark = p->mark;
6818 { // yield_expr
6819 if (p->error_indicator) {
6820 D(p->level--);
6821 return NULL;
6822 }
6823 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6824 expr_ty yield_expr_var;
6825 if (
6826 (yield_expr_var = yield_expr_rule(p)) // yield_expr
6827 )
6828 {
6829 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6830 _res = yield_expr_var;
6831 goto done;
6832 }
6833 p->mark = _mark;
6834 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6835 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
6836 }
6837 { // star_expressions
6838 if (p->error_indicator) {
6839 D(p->level--);
6840 return NULL;
6841 }
6842 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6843 expr_ty star_expressions_var;
6844 if (
6845 (star_expressions_var = star_expressions_rule(p)) // star_expressions
6846 )
6847 {
6848 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6849 _res = star_expressions_var;
6850 goto done;
6851 }
6852 p->mark = _mark;
6853 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6854 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
6855 }
6856 _res = NULL;
6857 done:
6858 D(p->level--);
6859 return _res;
6860}
6861
6862// expressions: expression ((',' expression))+ ','? | expression ',' | expression
6863static expr_ty
6864expressions_rule(Parser *p)
6865{
6866 D(p->level++);
6867 if (p->error_indicator) {
6868 D(p->level--);
6869 return NULL;
6870 }
6871 expr_ty _res = NULL;
6872 int _mark = p->mark;
6873 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6874 p->error_indicator = 1;
6875 D(p->level--);
6876 return NULL;
6877 }
6878 int _start_lineno = p->tokens[_mark]->lineno;
6879 UNUSED(_start_lineno); // Only used by EXTRA macro
6880 int _start_col_offset = p->tokens[_mark]->col_offset;
6881 UNUSED(_start_col_offset); // Only used by EXTRA macro
6882 { // expression ((',' expression))+ ','?
6883 if (p->error_indicator) {
6884 D(p->level--);
6885 return NULL;
6886 }
6887 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6888 void *_opt_var;
6889 UNUSED(_opt_var); // Silence compiler warnings
6890 expr_ty a;
6891 asdl_seq * b;
6892 if (
6893 (a = expression_rule(p)) // expression
6894 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006895 (b = _loop1_75_rule(p)) // ((',' expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006896 &&
6897 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6898 )
6899 {
6900 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6901 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6902 if (_token == NULL) {
6903 D(p->level--);
6904 return NULL;
6905 }
6906 int _end_lineno = _token->end_lineno;
6907 UNUSED(_end_lineno); // Only used by EXTRA macro
6908 int _end_col_offset = _token->end_col_offset;
6909 UNUSED(_end_col_offset); // Only used by EXTRA macro
6910 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
6911 if (_res == NULL && PyErr_Occurred()) {
6912 p->error_indicator = 1;
6913 D(p->level--);
6914 return NULL;
6915 }
6916 goto done;
6917 }
6918 p->mark = _mark;
6919 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6920 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
6921 }
6922 { // expression ','
6923 if (p->error_indicator) {
6924 D(p->level--);
6925 return NULL;
6926 }
6927 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
6928 Token * _literal;
6929 expr_ty a;
6930 if (
6931 (a = expression_rule(p)) // expression
6932 &&
6933 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6934 )
6935 {
6936 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
6937 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6938 if (_token == NULL) {
6939 D(p->level--);
6940 return NULL;
6941 }
6942 int _end_lineno = _token->end_lineno;
6943 UNUSED(_end_lineno); // Only used by EXTRA macro
6944 int _end_col_offset = _token->end_col_offset;
6945 UNUSED(_end_col_offset); // Only used by EXTRA macro
6946 _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
6947 if (_res == NULL && PyErr_Occurred()) {
6948 p->error_indicator = 1;
6949 D(p->level--);
6950 return NULL;
6951 }
6952 goto done;
6953 }
6954 p->mark = _mark;
6955 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6956 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
6957 }
6958 { // expression
6959 if (p->error_indicator) {
6960 D(p->level--);
6961 return NULL;
6962 }
6963 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6964 expr_ty expression_var;
6965 if (
6966 (expression_var = expression_rule(p)) // expression
6967 )
6968 {
6969 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6970 _res = expression_var;
6971 goto done;
6972 }
6973 p->mark = _mark;
6974 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6975 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6976 }
6977 _res = NULL;
6978 done:
6979 D(p->level--);
6980 return _res;
6981}
6982
6983// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
6984static expr_ty
6985expression_rule(Parser *p)
6986{
6987 D(p->level++);
6988 if (p->error_indicator) {
6989 D(p->level--);
6990 return NULL;
6991 }
6992 expr_ty _res = NULL;
6993 if (_PyPegen_is_memoized(p, expression_type, &_res)) {
6994 D(p->level--);
6995 return _res;
6996 }
6997 int _mark = p->mark;
6998 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6999 p->error_indicator = 1;
7000 D(p->level--);
7001 return NULL;
7002 }
7003 int _start_lineno = p->tokens[_mark]->lineno;
7004 UNUSED(_start_lineno); // Only used by EXTRA macro
7005 int _start_col_offset = p->tokens[_mark]->col_offset;
7006 UNUSED(_start_col_offset); // Only used by EXTRA macro
7007 { // disjunction 'if' disjunction 'else' expression
7008 if (p->error_indicator) {
7009 D(p->level--);
7010 return NULL;
7011 }
7012 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7013 Token * _keyword;
7014 Token * _keyword_1;
7015 expr_ty a;
7016 expr_ty b;
7017 expr_ty c;
7018 if (
7019 (a = disjunction_rule(p)) // disjunction
7020 &&
7021 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
7022 &&
7023 (b = disjunction_rule(p)) // disjunction
7024 &&
7025 (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else'
7026 &&
7027 (c = expression_rule(p)) // expression
7028 )
7029 {
7030 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7031 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7032 if (_token == NULL) {
7033 D(p->level--);
7034 return NULL;
7035 }
7036 int _end_lineno = _token->end_lineno;
7037 UNUSED(_end_lineno); // Only used by EXTRA macro
7038 int _end_col_offset = _token->end_col_offset;
7039 UNUSED(_end_col_offset); // Only used by EXTRA macro
7040 _res = _Py_IfExp ( b , a , c , EXTRA );
7041 if (_res == NULL && PyErr_Occurred()) {
7042 p->error_indicator = 1;
7043 D(p->level--);
7044 return NULL;
7045 }
7046 goto done;
7047 }
7048 p->mark = _mark;
7049 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7050 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7051 }
7052 { // disjunction
7053 if (p->error_indicator) {
7054 D(p->level--);
7055 return NULL;
7056 }
7057 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
7058 expr_ty disjunction_var;
7059 if (
7060 (disjunction_var = disjunction_rule(p)) // disjunction
7061 )
7062 {
7063 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
7064 _res = disjunction_var;
7065 goto done;
7066 }
7067 p->mark = _mark;
7068 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7069 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
7070 }
7071 { // lambdef
7072 if (p->error_indicator) {
7073 D(p->level--);
7074 return NULL;
7075 }
7076 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
7077 expr_ty lambdef_var;
7078 if (
7079 (lambdef_var = lambdef_rule(p)) // lambdef
7080 )
7081 {
7082 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
7083 _res = lambdef_var;
7084 goto done;
7085 }
7086 p->mark = _mark;
7087 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7088 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
7089 }
7090 _res = NULL;
7091 done:
7092 _PyPegen_insert_memo(p, _mark, expression_type, _res);
7093 D(p->level--);
7094 return _res;
7095}
7096
7097// lambdef: 'lambda' lambda_params? ':' expression
7098static expr_ty
7099lambdef_rule(Parser *p)
7100{
7101 D(p->level++);
7102 if (p->error_indicator) {
7103 D(p->level--);
7104 return NULL;
7105 }
7106 expr_ty _res = NULL;
7107 int _mark = p->mark;
7108 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7109 p->error_indicator = 1;
7110 D(p->level--);
7111 return NULL;
7112 }
7113 int _start_lineno = p->tokens[_mark]->lineno;
7114 UNUSED(_start_lineno); // Only used by EXTRA macro
7115 int _start_col_offset = p->tokens[_mark]->col_offset;
7116 UNUSED(_start_col_offset); // Only used by EXTRA macro
7117 { // 'lambda' lambda_params? ':' expression
7118 if (p->error_indicator) {
7119 D(p->level--);
7120 return NULL;
7121 }
7122 D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7123 Token * _keyword;
7124 Token * _literal;
7125 void *a;
7126 expr_ty b;
7127 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007128 (_keyword = _PyPegen_expect_token(p, 525)) // token='lambda'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007129 &&
7130 (a = lambda_params_rule(p), 1) // lambda_params?
7131 &&
7132 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
7133 &&
7134 (b = expression_rule(p)) // expression
7135 )
7136 {
7137 D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7138 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7139 if (_token == NULL) {
7140 D(p->level--);
7141 return NULL;
7142 }
7143 int _end_lineno = _token->end_lineno;
7144 UNUSED(_end_lineno); // Only used by EXTRA macro
7145 int _end_col_offset = _token->end_col_offset;
7146 UNUSED(_end_col_offset); // Only used by EXTRA macro
7147 _res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
7148 if (_res == NULL && PyErr_Occurred()) {
7149 p->error_indicator = 1;
7150 D(p->level--);
7151 return NULL;
7152 }
7153 goto done;
7154 }
7155 p->mark = _mark;
7156 D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
7157 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7158 }
7159 _res = NULL;
7160 done:
7161 D(p->level--);
7162 return _res;
7163}
7164
7165// lambda_params: invalid_lambda_parameters | lambda_parameters
7166static arguments_ty
7167lambda_params_rule(Parser *p)
7168{
7169 D(p->level++);
7170 if (p->error_indicator) {
7171 D(p->level--);
7172 return NULL;
7173 }
7174 arguments_ty _res = NULL;
7175 int _mark = p->mark;
7176 { // invalid_lambda_parameters
7177 if (p->error_indicator) {
7178 D(p->level--);
7179 return NULL;
7180 }
7181 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7182 void *invalid_lambda_parameters_var;
7183 if (
7184 (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
7185 )
7186 {
7187 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7188 _res = invalid_lambda_parameters_var;
7189 goto done;
7190 }
7191 p->mark = _mark;
7192 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7193 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
7194 }
7195 { // lambda_parameters
7196 if (p->error_indicator) {
7197 D(p->level--);
7198 return NULL;
7199 }
7200 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7201 arguments_ty lambda_parameters_var;
7202 if (
7203 (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
7204 )
7205 {
7206 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7207 _res = lambda_parameters_var;
7208 goto done;
7209 }
7210 p->mark = _mark;
7211 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7212 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
7213 }
7214 _res = NULL;
7215 done:
7216 D(p->level--);
7217 return _res;
7218}
7219
7220// lambda_parameters:
7221// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7222// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7223// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7224// | lambda_param_with_default+ lambda_star_etc?
7225// | lambda_star_etc
7226static arguments_ty
7227lambda_parameters_rule(Parser *p)
7228{
7229 D(p->level++);
7230 if (p->error_indicator) {
7231 D(p->level--);
7232 return NULL;
7233 }
7234 arguments_ty _res = NULL;
7235 int _mark = p->mark;
7236 { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7237 if (p->error_indicator) {
7238 D(p->level--);
7239 return NULL;
7240 }
7241 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?"));
7242 asdl_seq* a;
7243 asdl_seq * b;
7244 asdl_seq * c;
7245 void *d;
7246 if (
7247 (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
7248 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007249 (b = _loop0_76_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007250 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007251 (c = _loop0_77_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007252 &&
7253 (d = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7254 )
7255 {
7256 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?"));
7257 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
7258 if (_res == NULL && PyErr_Occurred()) {
7259 p->error_indicator = 1;
7260 D(p->level--);
7261 return NULL;
7262 }
7263 goto done;
7264 }
7265 p->mark = _mark;
7266 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7267 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
7268 }
7269 { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7270 if (p->error_indicator) {
7271 D(p->level--);
7272 return NULL;
7273 }
7274 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?"));
7275 SlashWithDefault* a;
7276 asdl_seq * b;
7277 void *c;
7278 if (
7279 (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
7280 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007281 (b = _loop0_78_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007282 &&
7283 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7284 )
7285 {
7286 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?"));
7287 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
7288 if (_res == NULL && PyErr_Occurred()) {
7289 p->error_indicator = 1;
7290 D(p->level--);
7291 return NULL;
7292 }
7293 goto done;
7294 }
7295 p->mark = _mark;
7296 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7297 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
7298 }
7299 { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7300 if (p->error_indicator) {
7301 D(p->level--);
7302 return NULL;
7303 }
7304 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?"));
7305 asdl_seq * a;
7306 asdl_seq * b;
7307 void *c;
7308 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007309 (a = _loop1_79_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007310 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007311 (b = _loop0_80_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007312 &&
7313 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7314 )
7315 {
7316 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?"));
7317 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
7318 if (_res == NULL && PyErr_Occurred()) {
7319 p->error_indicator = 1;
7320 D(p->level--);
7321 return NULL;
7322 }
7323 goto done;
7324 }
7325 p->mark = _mark;
7326 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7327 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
7328 }
7329 { // lambda_param_with_default+ lambda_star_etc?
7330 if (p->error_indicator) {
7331 D(p->level--);
7332 return NULL;
7333 }
7334 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7335 asdl_seq * a;
7336 void *b;
7337 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007338 (a = _loop1_81_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007339 &&
7340 (b = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7341 )
7342 {
7343 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7344 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
7345 if (_res == NULL && PyErr_Occurred()) {
7346 p->error_indicator = 1;
7347 D(p->level--);
7348 return NULL;
7349 }
7350 goto done;
7351 }
7352 p->mark = _mark;
7353 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7354 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7355 }
7356 { // lambda_star_etc
7357 if (p->error_indicator) {
7358 D(p->level--);
7359 return NULL;
7360 }
7361 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7362 StarEtc* a;
7363 if (
7364 (a = lambda_star_etc_rule(p)) // lambda_star_etc
7365 )
7366 {
7367 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7368 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
7369 if (_res == NULL && PyErr_Occurred()) {
7370 p->error_indicator = 1;
7371 D(p->level--);
7372 return NULL;
7373 }
7374 goto done;
7375 }
7376 p->mark = _mark;
7377 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7378 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
7379 }
7380 _res = NULL;
7381 done:
7382 D(p->level--);
7383 return _res;
7384}
7385
7386// lambda_slash_no_default:
7387// | lambda_param_no_default+ '/' ','
7388// | lambda_param_no_default+ '/' &':'
7389static asdl_seq*
7390lambda_slash_no_default_rule(Parser *p)
7391{
7392 D(p->level++);
7393 if (p->error_indicator) {
7394 D(p->level--);
7395 return NULL;
7396 }
7397 asdl_seq* _res = NULL;
7398 int _mark = p->mark;
7399 { // lambda_param_no_default+ '/' ','
7400 if (p->error_indicator) {
7401 D(p->level--);
7402 return NULL;
7403 }
7404 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7405 Token * _literal;
7406 Token * _literal_1;
7407 asdl_seq * a;
7408 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007409 (a = _loop1_82_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007410 &&
7411 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7412 &&
7413 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7414 )
7415 {
7416 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7417 _res = a;
7418 if (_res == NULL && PyErr_Occurred()) {
7419 p->error_indicator = 1;
7420 D(p->level--);
7421 return NULL;
7422 }
7423 goto done;
7424 }
7425 p->mark = _mark;
7426 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7427 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7428 }
7429 { // lambda_param_no_default+ '/' &':'
7430 if (p->error_indicator) {
7431 D(p->level--);
7432 return NULL;
7433 }
7434 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7435 Token * _literal;
7436 asdl_seq * a;
7437 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007438 (a = _loop1_83_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007439 &&
7440 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7441 &&
7442 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7443 )
7444 {
7445 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7446 _res = a;
7447 if (_res == NULL && PyErr_Occurred()) {
7448 p->error_indicator = 1;
7449 D(p->level--);
7450 return NULL;
7451 }
7452 goto done;
7453 }
7454 p->mark = _mark;
7455 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7456 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7457 }
7458 _res = NULL;
7459 done:
7460 D(p->level--);
7461 return _res;
7462}
7463
7464// lambda_slash_with_default:
7465// | lambda_param_no_default* lambda_param_with_default+ '/' ','
7466// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
7467static SlashWithDefault*
7468lambda_slash_with_default_rule(Parser *p)
7469{
7470 D(p->level++);
7471 if (p->error_indicator) {
7472 D(p->level--);
7473 return NULL;
7474 }
7475 SlashWithDefault* _res = NULL;
7476 int _mark = p->mark;
7477 { // lambda_param_no_default* lambda_param_with_default+ '/' ','
7478 if (p->error_indicator) {
7479 D(p->level--);
7480 return NULL;
7481 }
7482 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+ '/' ','"));
7483 Token * _literal;
7484 Token * _literal_1;
7485 asdl_seq * a;
7486 asdl_seq * b;
7487 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007488 (a = _loop0_84_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007489 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007490 (b = _loop1_85_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007491 &&
7492 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7493 &&
7494 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7495 )
7496 {
7497 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+ '/' ','"));
7498 _res = _PyPegen_slash_with_default ( p , a , b );
7499 if (_res == NULL && PyErr_Occurred()) {
7500 p->error_indicator = 1;
7501 D(p->level--);
7502 return NULL;
7503 }
7504 goto done;
7505 }
7506 p->mark = _mark;
7507 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7508 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
7509 }
7510 { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
7511 if (p->error_indicator) {
7512 D(p->level--);
7513 return NULL;
7514 }
7515 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+ '/' &':'"));
7516 Token * _literal;
7517 asdl_seq * a;
7518 asdl_seq * b;
7519 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007520 (a = _loop0_86_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007521 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007522 (b = _loop1_87_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007523 &&
7524 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7525 &&
7526 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7527 )
7528 {
7529 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+ '/' &':'"));
7530 _res = _PyPegen_slash_with_default ( p , a , b );
7531 if (_res == NULL && PyErr_Occurred()) {
7532 p->error_indicator = 1;
7533 D(p->level--);
7534 return NULL;
7535 }
7536 goto done;
7537 }
7538 p->mark = _mark;
7539 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7540 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
7541 }
7542 _res = NULL;
7543 done:
7544 D(p->level--);
7545 return _res;
7546}
7547
7548// lambda_star_etc:
7549// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7550// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
7551// | lambda_kwds
7552// | invalid_lambda_star_etc
7553static StarEtc*
7554lambda_star_etc_rule(Parser *p)
7555{
7556 D(p->level++);
7557 if (p->error_indicator) {
7558 D(p->level--);
7559 return NULL;
7560 }
7561 StarEtc* _res = NULL;
7562 int _mark = p->mark;
7563 { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7564 if (p->error_indicator) {
7565 D(p->level--);
7566 return NULL;
7567 }
7568 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?"));
7569 Token * _literal;
7570 arg_ty a;
7571 asdl_seq * b;
7572 void *c;
7573 if (
7574 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7575 &&
7576 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7577 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007578 (b = _loop0_88_rule(p)) // lambda_param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007579 &&
7580 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7581 )
7582 {
7583 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?"));
7584 _res = _PyPegen_star_etc ( p , a , b , c );
7585 if (_res == NULL && PyErr_Occurred()) {
7586 p->error_indicator = 1;
7587 D(p->level--);
7588 return NULL;
7589 }
7590 goto done;
7591 }
7592 p->mark = _mark;
7593 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7594 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
7595 }
7596 { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
7597 if (p->error_indicator) {
7598 D(p->level--);
7599 return NULL;
7600 }
7601 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7602 Token * _literal;
7603 Token * _literal_1;
7604 asdl_seq * b;
7605 void *c;
7606 if (
7607 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7608 &&
7609 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7610 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007611 (b = _loop1_89_rule(p)) // lambda_param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007612 &&
7613 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7614 )
7615 {
7616 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7617 _res = _PyPegen_star_etc ( p , NULL , b , c );
7618 if (_res == NULL && PyErr_Occurred()) {
7619 p->error_indicator = 1;
7620 D(p->level--);
7621 return NULL;
7622 }
7623 goto done;
7624 }
7625 p->mark = _mark;
7626 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7627 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7628 }
7629 { // lambda_kwds
7630 if (p->error_indicator) {
7631 D(p->level--);
7632 return NULL;
7633 }
7634 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7635 arg_ty a;
7636 if (
7637 (a = lambda_kwds_rule(p)) // lambda_kwds
7638 )
7639 {
7640 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7641 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
7642 if (_res == NULL && PyErr_Occurred()) {
7643 p->error_indicator = 1;
7644 D(p->level--);
7645 return NULL;
7646 }
7647 goto done;
7648 }
7649 p->mark = _mark;
7650 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7651 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
7652 }
7653 { // invalid_lambda_star_etc
7654 if (p->error_indicator) {
7655 D(p->level--);
7656 return NULL;
7657 }
7658 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7659 void *invalid_lambda_star_etc_var;
7660 if (
7661 (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
7662 )
7663 {
7664 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7665 _res = invalid_lambda_star_etc_var;
7666 goto done;
7667 }
7668 p->mark = _mark;
7669 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7670 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
7671 }
7672 _res = NULL;
7673 done:
7674 D(p->level--);
7675 return _res;
7676}
7677
7678// lambda_kwds: '**' lambda_param_no_default
7679static arg_ty
7680lambda_kwds_rule(Parser *p)
7681{
7682 D(p->level++);
7683 if (p->error_indicator) {
7684 D(p->level--);
7685 return NULL;
7686 }
7687 arg_ty _res = NULL;
7688 int _mark = p->mark;
7689 { // '**' lambda_param_no_default
7690 if (p->error_indicator) {
7691 D(p->level--);
7692 return NULL;
7693 }
7694 D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7695 Token * _literal;
7696 arg_ty a;
7697 if (
7698 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
7699 &&
7700 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7701 )
7702 {
7703 D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7704 _res = a;
7705 if (_res == NULL && PyErr_Occurred()) {
7706 p->error_indicator = 1;
7707 D(p->level--);
7708 return NULL;
7709 }
7710 goto done;
7711 }
7712 p->mark = _mark;
7713 D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
7714 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
7715 }
7716 _res = NULL;
7717 done:
7718 D(p->level--);
7719 return _res;
7720}
7721
7722// lambda_param_no_default: lambda_param ',' | lambda_param &':'
7723static arg_ty
7724lambda_param_no_default_rule(Parser *p)
7725{
7726 D(p->level++);
7727 if (p->error_indicator) {
7728 D(p->level--);
7729 return NULL;
7730 }
7731 arg_ty _res = NULL;
7732 int _mark = p->mark;
7733 { // lambda_param ','
7734 if (p->error_indicator) {
7735 D(p->level--);
7736 return NULL;
7737 }
7738 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7739 Token * _literal;
7740 arg_ty a;
7741 if (
7742 (a = lambda_param_rule(p)) // lambda_param
7743 &&
7744 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7745 )
7746 {
7747 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7748 _res = a;
7749 if (_res == NULL && PyErr_Occurred()) {
7750 p->error_indicator = 1;
7751 D(p->level--);
7752 return NULL;
7753 }
7754 goto done;
7755 }
7756 p->mark = _mark;
7757 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7758 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
7759 }
7760 { // lambda_param &':'
7761 if (p->error_indicator) {
7762 D(p->level--);
7763 return NULL;
7764 }
7765 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7766 arg_ty a;
7767 if (
7768 (a = lambda_param_rule(p)) // lambda_param
7769 &&
7770 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7771 )
7772 {
7773 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7774 _res = a;
7775 if (_res == NULL && PyErr_Occurred()) {
7776 p->error_indicator = 1;
7777 D(p->level--);
7778 return NULL;
7779 }
7780 goto done;
7781 }
7782 p->mark = _mark;
7783 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7784 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
7785 }
7786 _res = NULL;
7787 done:
7788 D(p->level--);
7789 return _res;
7790}
7791
7792// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
7793static NameDefaultPair*
7794lambda_param_with_default_rule(Parser *p)
7795{
7796 D(p->level++);
7797 if (p->error_indicator) {
7798 D(p->level--);
7799 return NULL;
7800 }
7801 NameDefaultPair* _res = NULL;
7802 int _mark = p->mark;
7803 { // lambda_param default ','
7804 if (p->error_indicator) {
7805 D(p->level--);
7806 return NULL;
7807 }
7808 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7809 Token * _literal;
7810 arg_ty a;
7811 expr_ty c;
7812 if (
7813 (a = lambda_param_rule(p)) // lambda_param
7814 &&
7815 (c = default_rule(p)) // default
7816 &&
7817 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7818 )
7819 {
7820 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7821 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7822 if (_res == NULL && PyErr_Occurred()) {
7823 p->error_indicator = 1;
7824 D(p->level--);
7825 return NULL;
7826 }
7827 goto done;
7828 }
7829 p->mark = _mark;
7830 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7831 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
7832 }
7833 { // lambda_param default &':'
7834 if (p->error_indicator) {
7835 D(p->level--);
7836 return NULL;
7837 }
7838 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7839 arg_ty a;
7840 expr_ty c;
7841 if (
7842 (a = lambda_param_rule(p)) // lambda_param
7843 &&
7844 (c = default_rule(p)) // default
7845 &&
7846 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7847 )
7848 {
7849 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7850 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7851 if (_res == NULL && PyErr_Occurred()) {
7852 p->error_indicator = 1;
7853 D(p->level--);
7854 return NULL;
7855 }
7856 goto done;
7857 }
7858 p->mark = _mark;
7859 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7860 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
7861 }
7862 _res = NULL;
7863 done:
7864 D(p->level--);
7865 return _res;
7866}
7867
7868// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
7869static NameDefaultPair*
7870lambda_param_maybe_default_rule(Parser *p)
7871{
7872 D(p->level++);
7873 if (p->error_indicator) {
7874 D(p->level--);
7875 return NULL;
7876 }
7877 NameDefaultPair* _res = NULL;
7878 int _mark = p->mark;
7879 { // lambda_param default? ','
7880 if (p->error_indicator) {
7881 D(p->level--);
7882 return NULL;
7883 }
7884 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7885 Token * _literal;
7886 arg_ty a;
7887 void *c;
7888 if (
7889 (a = lambda_param_rule(p)) // lambda_param
7890 &&
7891 (c = default_rule(p), 1) // default?
7892 &&
7893 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7894 )
7895 {
7896 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7897 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7898 if (_res == NULL && PyErr_Occurred()) {
7899 p->error_indicator = 1;
7900 D(p->level--);
7901 return NULL;
7902 }
7903 goto done;
7904 }
7905 p->mark = _mark;
7906 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7907 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
7908 }
7909 { // lambda_param default? &':'
7910 if (p->error_indicator) {
7911 D(p->level--);
7912 return NULL;
7913 }
7914 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7915 arg_ty a;
7916 void *c;
7917 if (
7918 (a = lambda_param_rule(p)) // lambda_param
7919 &&
7920 (c = default_rule(p), 1) // default?
7921 &&
7922 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7923 )
7924 {
7925 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7926 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7927 if (_res == NULL && PyErr_Occurred()) {
7928 p->error_indicator = 1;
7929 D(p->level--);
7930 return NULL;
7931 }
7932 goto done;
7933 }
7934 p->mark = _mark;
7935 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7936 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
7937 }
7938 _res = NULL;
7939 done:
7940 D(p->level--);
7941 return _res;
7942}
7943
7944// lambda_param: NAME
7945static arg_ty
7946lambda_param_rule(Parser *p)
7947{
7948 D(p->level++);
7949 if (p->error_indicator) {
7950 D(p->level--);
7951 return NULL;
7952 }
7953 arg_ty _res = NULL;
7954 int _mark = p->mark;
7955 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7956 p->error_indicator = 1;
7957 D(p->level--);
7958 return NULL;
7959 }
7960 int _start_lineno = p->tokens[_mark]->lineno;
7961 UNUSED(_start_lineno); // Only used by EXTRA macro
7962 int _start_col_offset = p->tokens[_mark]->col_offset;
7963 UNUSED(_start_col_offset); // Only used by EXTRA macro
7964 { // NAME
7965 if (p->error_indicator) {
7966 D(p->level--);
7967 return NULL;
7968 }
7969 D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
7970 expr_ty a;
7971 if (
7972 (a = _PyPegen_name_token(p)) // NAME
7973 )
7974 {
7975 D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
7976 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7977 if (_token == NULL) {
7978 D(p->level--);
7979 return NULL;
7980 }
7981 int _end_lineno = _token->end_lineno;
7982 UNUSED(_end_lineno); // Only used by EXTRA macro
7983 int _end_col_offset = _token->end_col_offset;
7984 UNUSED(_end_col_offset); // Only used by EXTRA macro
7985 _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
7986 if (_res == NULL && PyErr_Occurred()) {
7987 p->error_indicator = 1;
7988 D(p->level--);
7989 return NULL;
7990 }
7991 goto done;
7992 }
7993 p->mark = _mark;
7994 D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
7995 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
7996 }
7997 _res = NULL;
7998 done:
7999 D(p->level--);
8000 return _res;
8001}
8002
8003// disjunction: conjunction (('or' conjunction))+ | conjunction
8004static expr_ty
8005disjunction_rule(Parser *p)
8006{
8007 D(p->level++);
8008 if (p->error_indicator) {
8009 D(p->level--);
8010 return NULL;
8011 }
8012 expr_ty _res = NULL;
8013 if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
8014 D(p->level--);
8015 return _res;
8016 }
8017 int _mark = p->mark;
8018 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8019 p->error_indicator = 1;
8020 D(p->level--);
8021 return NULL;
8022 }
8023 int _start_lineno = p->tokens[_mark]->lineno;
8024 UNUSED(_start_lineno); // Only used by EXTRA macro
8025 int _start_col_offset = p->tokens[_mark]->col_offset;
8026 UNUSED(_start_col_offset); // Only used by EXTRA macro
8027 { // conjunction (('or' conjunction))+
8028 if (p->error_indicator) {
8029 D(p->level--);
8030 return NULL;
8031 }
8032 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8033 expr_ty a;
8034 asdl_seq * b;
8035 if (
8036 (a = conjunction_rule(p)) // conjunction
8037 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008038 (b = _loop1_90_rule(p)) // (('or' conjunction))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008039 )
8040 {
8041 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8042 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8043 if (_token == NULL) {
8044 D(p->level--);
8045 return NULL;
8046 }
8047 int _end_lineno = _token->end_lineno;
8048 UNUSED(_end_lineno); // Only used by EXTRA macro
8049 int _end_col_offset = _token->end_col_offset;
8050 UNUSED(_end_col_offset); // Only used by EXTRA macro
8051 _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
8052 if (_res == NULL && PyErr_Occurred()) {
8053 p->error_indicator = 1;
8054 D(p->level--);
8055 return NULL;
8056 }
8057 goto done;
8058 }
8059 p->mark = _mark;
8060 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8061 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+"));
8062 }
8063 { // conjunction
8064 if (p->error_indicator) {
8065 D(p->level--);
8066 return NULL;
8067 }
8068 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
8069 expr_ty conjunction_var;
8070 if (
8071 (conjunction_var = conjunction_rule(p)) // conjunction
8072 )
8073 {
8074 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
8075 _res = conjunction_var;
8076 goto done;
8077 }
8078 p->mark = _mark;
8079 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8080 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
8081 }
8082 _res = NULL;
8083 done:
8084 _PyPegen_insert_memo(p, _mark, disjunction_type, _res);
8085 D(p->level--);
8086 return _res;
8087}
8088
8089// conjunction: inversion (('and' inversion))+ | inversion
8090static expr_ty
8091conjunction_rule(Parser *p)
8092{
8093 D(p->level++);
8094 if (p->error_indicator) {
8095 D(p->level--);
8096 return NULL;
8097 }
8098 expr_ty _res = NULL;
8099 if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
8100 D(p->level--);
8101 return _res;
8102 }
8103 int _mark = p->mark;
8104 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8105 p->error_indicator = 1;
8106 D(p->level--);
8107 return NULL;
8108 }
8109 int _start_lineno = p->tokens[_mark]->lineno;
8110 UNUSED(_start_lineno); // Only used by EXTRA macro
8111 int _start_col_offset = p->tokens[_mark]->col_offset;
8112 UNUSED(_start_col_offset); // Only used by EXTRA macro
8113 { // inversion (('and' inversion))+
8114 if (p->error_indicator) {
8115 D(p->level--);
8116 return NULL;
8117 }
8118 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8119 expr_ty a;
8120 asdl_seq * b;
8121 if (
8122 (a = inversion_rule(p)) // inversion
8123 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008124 (b = _loop1_91_rule(p)) // (('and' inversion))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008125 )
8126 {
8127 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8128 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8129 if (_token == NULL) {
8130 D(p->level--);
8131 return NULL;
8132 }
8133 int _end_lineno = _token->end_lineno;
8134 UNUSED(_end_lineno); // Only used by EXTRA macro
8135 int _end_col_offset = _token->end_col_offset;
8136 UNUSED(_end_col_offset); // Only used by EXTRA macro
8137 _res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
8138 if (_res == NULL && PyErr_Occurred()) {
8139 p->error_indicator = 1;
8140 D(p->level--);
8141 return NULL;
8142 }
8143 goto done;
8144 }
8145 p->mark = _mark;
8146 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8147 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+"));
8148 }
8149 { // inversion
8150 if (p->error_indicator) {
8151 D(p->level--);
8152 return NULL;
8153 }
8154 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
8155 expr_ty inversion_var;
8156 if (
8157 (inversion_var = inversion_rule(p)) // inversion
8158 )
8159 {
8160 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
8161 _res = inversion_var;
8162 goto done;
8163 }
8164 p->mark = _mark;
8165 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8166 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
8167 }
8168 _res = NULL;
8169 done:
8170 _PyPegen_insert_memo(p, _mark, conjunction_type, _res);
8171 D(p->level--);
8172 return _res;
8173}
8174
8175// inversion: 'not' inversion | comparison
8176static expr_ty
8177inversion_rule(Parser *p)
8178{
8179 D(p->level++);
8180 if (p->error_indicator) {
8181 D(p->level--);
8182 return NULL;
8183 }
8184 expr_ty _res = NULL;
8185 if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
8186 D(p->level--);
8187 return _res;
8188 }
8189 int _mark = p->mark;
8190 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8191 p->error_indicator = 1;
8192 D(p->level--);
8193 return NULL;
8194 }
8195 int _start_lineno = p->tokens[_mark]->lineno;
8196 UNUSED(_start_lineno); // Only used by EXTRA macro
8197 int _start_col_offset = p->tokens[_mark]->col_offset;
8198 UNUSED(_start_col_offset); // Only used by EXTRA macro
8199 { // 'not' inversion
8200 if (p->error_indicator) {
8201 D(p->level--);
8202 return NULL;
8203 }
8204 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8205 Token * _keyword;
8206 expr_ty a;
8207 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008208 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008209 &&
8210 (a = inversion_rule(p)) // inversion
8211 )
8212 {
8213 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8214 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8215 if (_token == NULL) {
8216 D(p->level--);
8217 return NULL;
8218 }
8219 int _end_lineno = _token->end_lineno;
8220 UNUSED(_end_lineno); // Only used by EXTRA macro
8221 int _end_col_offset = _token->end_col_offset;
8222 UNUSED(_end_col_offset); // Only used by EXTRA macro
8223 _res = _Py_UnaryOp ( Not , a , EXTRA );
8224 if (_res == NULL && PyErr_Occurred()) {
8225 p->error_indicator = 1;
8226 D(p->level--);
8227 return NULL;
8228 }
8229 goto done;
8230 }
8231 p->mark = _mark;
8232 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8233 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion"));
8234 }
8235 { // comparison
8236 if (p->error_indicator) {
8237 D(p->level--);
8238 return NULL;
8239 }
8240 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
8241 expr_ty comparison_var;
8242 if (
8243 (comparison_var = comparison_rule(p)) // comparison
8244 )
8245 {
8246 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
8247 _res = comparison_var;
8248 goto done;
8249 }
8250 p->mark = _mark;
8251 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8252 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
8253 }
8254 _res = NULL;
8255 done:
8256 _PyPegen_insert_memo(p, _mark, inversion_type, _res);
8257 D(p->level--);
8258 return _res;
8259}
8260
8261// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
8262static expr_ty
8263comparison_rule(Parser *p)
8264{
8265 D(p->level++);
8266 if (p->error_indicator) {
8267 D(p->level--);
8268 return NULL;
8269 }
8270 expr_ty _res = NULL;
8271 int _mark = p->mark;
8272 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8273 p->error_indicator = 1;
8274 D(p->level--);
8275 return NULL;
8276 }
8277 int _start_lineno = p->tokens[_mark]->lineno;
8278 UNUSED(_start_lineno); // Only used by EXTRA macro
8279 int _start_col_offset = p->tokens[_mark]->col_offset;
8280 UNUSED(_start_col_offset); // Only used by EXTRA macro
8281 { // bitwise_or compare_op_bitwise_or_pair+
8282 if (p->error_indicator) {
8283 D(p->level--);
8284 return NULL;
8285 }
8286 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8287 expr_ty a;
8288 asdl_seq * b;
8289 if (
8290 (a = bitwise_or_rule(p)) // bitwise_or
8291 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008292 (b = _loop1_92_rule(p)) // compare_op_bitwise_or_pair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008293 )
8294 {
8295 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8296 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8297 if (_token == NULL) {
8298 D(p->level--);
8299 return NULL;
8300 }
8301 int _end_lineno = _token->end_lineno;
8302 UNUSED(_end_lineno); // Only used by EXTRA macro
8303 int _end_col_offset = _token->end_col_offset;
8304 UNUSED(_end_col_offset); // Only used by EXTRA macro
8305 _res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA );
8306 if (_res == NULL && PyErr_Occurred()) {
8307 p->error_indicator = 1;
8308 D(p->level--);
8309 return NULL;
8310 }
8311 goto done;
8312 }
8313 p->mark = _mark;
8314 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8315 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8316 }
8317 { // bitwise_or
8318 if (p->error_indicator) {
8319 D(p->level--);
8320 return NULL;
8321 }
8322 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8323 expr_ty bitwise_or_var;
8324 if (
8325 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
8326 )
8327 {
8328 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8329 _res = bitwise_or_var;
8330 goto done;
8331 }
8332 p->mark = _mark;
8333 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8334 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
8335 }
8336 _res = NULL;
8337 done:
8338 D(p->level--);
8339 return _res;
8340}
8341
8342// compare_op_bitwise_or_pair:
8343// | eq_bitwise_or
8344// | noteq_bitwise_or
8345// | lte_bitwise_or
8346// | lt_bitwise_or
8347// | gte_bitwise_or
8348// | gt_bitwise_or
8349// | notin_bitwise_or
8350// | in_bitwise_or
8351// | isnot_bitwise_or
8352// | is_bitwise_or
8353static CmpopExprPair*
8354compare_op_bitwise_or_pair_rule(Parser *p)
8355{
8356 D(p->level++);
8357 if (p->error_indicator) {
8358 D(p->level--);
8359 return NULL;
8360 }
8361 CmpopExprPair* _res = NULL;
8362 int _mark = p->mark;
8363 { // eq_bitwise_or
8364 if (p->error_indicator) {
8365 D(p->level--);
8366 return NULL;
8367 }
8368 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8369 CmpopExprPair* eq_bitwise_or_var;
8370 if (
8371 (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or
8372 )
8373 {
8374 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8375 _res = eq_bitwise_or_var;
8376 goto done;
8377 }
8378 p->mark = _mark;
8379 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8380 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or"));
8381 }
8382 { // noteq_bitwise_or
8383 if (p->error_indicator) {
8384 D(p->level--);
8385 return NULL;
8386 }
8387 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8388 CmpopExprPair* noteq_bitwise_or_var;
8389 if (
8390 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or
8391 )
8392 {
8393 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8394 _res = noteq_bitwise_or_var;
8395 goto done;
8396 }
8397 p->mark = _mark;
8398 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8399 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or"));
8400 }
8401 { // lte_bitwise_or
8402 if (p->error_indicator) {
8403 D(p->level--);
8404 return NULL;
8405 }
8406 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8407 CmpopExprPair* lte_bitwise_or_var;
8408 if (
8409 (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or
8410 )
8411 {
8412 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8413 _res = lte_bitwise_or_var;
8414 goto done;
8415 }
8416 p->mark = _mark;
8417 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8418 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or"));
8419 }
8420 { // lt_bitwise_or
8421 if (p->error_indicator) {
8422 D(p->level--);
8423 return NULL;
8424 }
8425 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8426 CmpopExprPair* lt_bitwise_or_var;
8427 if (
8428 (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or
8429 )
8430 {
8431 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8432 _res = lt_bitwise_or_var;
8433 goto done;
8434 }
8435 p->mark = _mark;
8436 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8437 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or"));
8438 }
8439 { // gte_bitwise_or
8440 if (p->error_indicator) {
8441 D(p->level--);
8442 return NULL;
8443 }
8444 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8445 CmpopExprPair* gte_bitwise_or_var;
8446 if (
8447 (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or
8448 )
8449 {
8450 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8451 _res = gte_bitwise_or_var;
8452 goto done;
8453 }
8454 p->mark = _mark;
8455 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8456 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or"));
8457 }
8458 { // gt_bitwise_or
8459 if (p->error_indicator) {
8460 D(p->level--);
8461 return NULL;
8462 }
8463 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8464 CmpopExprPair* gt_bitwise_or_var;
8465 if (
8466 (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or
8467 )
8468 {
8469 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8470 _res = gt_bitwise_or_var;
8471 goto done;
8472 }
8473 p->mark = _mark;
8474 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or"));
8476 }
8477 { // notin_bitwise_or
8478 if (p->error_indicator) {
8479 D(p->level--);
8480 return NULL;
8481 }
8482 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8483 CmpopExprPair* notin_bitwise_or_var;
8484 if (
8485 (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or
8486 )
8487 {
8488 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8489 _res = notin_bitwise_or_var;
8490 goto done;
8491 }
8492 p->mark = _mark;
8493 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8494 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or"));
8495 }
8496 { // in_bitwise_or
8497 if (p->error_indicator) {
8498 D(p->level--);
8499 return NULL;
8500 }
8501 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8502 CmpopExprPair* in_bitwise_or_var;
8503 if (
8504 (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or
8505 )
8506 {
8507 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8508 _res = in_bitwise_or_var;
8509 goto done;
8510 }
8511 p->mark = _mark;
8512 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8513 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or"));
8514 }
8515 { // isnot_bitwise_or
8516 if (p->error_indicator) {
8517 D(p->level--);
8518 return NULL;
8519 }
8520 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8521 CmpopExprPair* isnot_bitwise_or_var;
8522 if (
8523 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or
8524 )
8525 {
8526 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8527 _res = isnot_bitwise_or_var;
8528 goto done;
8529 }
8530 p->mark = _mark;
8531 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8532 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or"));
8533 }
8534 { // is_bitwise_or
8535 if (p->error_indicator) {
8536 D(p->level--);
8537 return NULL;
8538 }
8539 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8540 CmpopExprPair* is_bitwise_or_var;
8541 if (
8542 (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or
8543 )
8544 {
8545 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8546 _res = is_bitwise_or_var;
8547 goto done;
8548 }
8549 p->mark = _mark;
8550 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8551 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
8552 }
8553 _res = NULL;
8554 done:
8555 D(p->level--);
8556 return _res;
8557}
8558
8559// eq_bitwise_or: '==' bitwise_or
8560static CmpopExprPair*
8561eq_bitwise_or_rule(Parser *p)
8562{
8563 D(p->level++);
8564 if (p->error_indicator) {
8565 D(p->level--);
8566 return NULL;
8567 }
8568 CmpopExprPair* _res = NULL;
8569 int _mark = p->mark;
8570 { // '==' bitwise_or
8571 if (p->error_indicator) {
8572 D(p->level--);
8573 return NULL;
8574 }
8575 D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8576 Token * _literal;
8577 expr_ty a;
8578 if (
8579 (_literal = _PyPegen_expect_token(p, 27)) // token='=='
8580 &&
8581 (a = bitwise_or_rule(p)) // bitwise_or
8582 )
8583 {
8584 D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8585 _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
8586 if (_res == NULL && PyErr_Occurred()) {
8587 p->error_indicator = 1;
8588 D(p->level--);
8589 return NULL;
8590 }
8591 goto done;
8592 }
8593 p->mark = _mark;
8594 D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8595 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
8596 }
8597 _res = NULL;
8598 done:
8599 D(p->level--);
8600 return _res;
8601}
8602
8603// noteq_bitwise_or: ('!=') bitwise_or
8604static CmpopExprPair*
8605noteq_bitwise_or_rule(Parser *p)
8606{
8607 D(p->level++);
8608 if (p->error_indicator) {
8609 D(p->level--);
8610 return NULL;
8611 }
8612 CmpopExprPair* _res = NULL;
8613 int _mark = p->mark;
8614 { // ('!=') bitwise_or
8615 if (p->error_indicator) {
8616 D(p->level--);
8617 return NULL;
8618 }
8619 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 +03008620 void *_tmp_93_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008621 expr_ty a;
8622 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008623 (_tmp_93_var = _tmp_93_rule(p)) // '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008624 &&
8625 (a = bitwise_or_rule(p)) // bitwise_or
8626 )
8627 {
8628 D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
8629 _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
8630 if (_res == NULL && PyErr_Occurred()) {
8631 p->error_indicator = 1;
8632 D(p->level--);
8633 return NULL;
8634 }
8635 goto done;
8636 }
8637 p->mark = _mark;
8638 D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8639 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
8640 }
8641 _res = NULL;
8642 done:
8643 D(p->level--);
8644 return _res;
8645}
8646
8647// lte_bitwise_or: '<=' bitwise_or
8648static CmpopExprPair*
8649lte_bitwise_or_rule(Parser *p)
8650{
8651 D(p->level++);
8652 if (p->error_indicator) {
8653 D(p->level--);
8654 return NULL;
8655 }
8656 CmpopExprPair* _res = NULL;
8657 int _mark = p->mark;
8658 { // '<=' bitwise_or
8659 if (p->error_indicator) {
8660 D(p->level--);
8661 return NULL;
8662 }
8663 D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8664 Token * _literal;
8665 expr_ty a;
8666 if (
8667 (_literal = _PyPegen_expect_token(p, 29)) // token='<='
8668 &&
8669 (a = bitwise_or_rule(p)) // bitwise_or
8670 )
8671 {
8672 D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8673 _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
8674 if (_res == NULL && PyErr_Occurred()) {
8675 p->error_indicator = 1;
8676 D(p->level--);
8677 return NULL;
8678 }
8679 goto done;
8680 }
8681 p->mark = _mark;
8682 D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8683 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
8684 }
8685 _res = NULL;
8686 done:
8687 D(p->level--);
8688 return _res;
8689}
8690
8691// lt_bitwise_or: '<' bitwise_or
8692static CmpopExprPair*
8693lt_bitwise_or_rule(Parser *p)
8694{
8695 D(p->level++);
8696 if (p->error_indicator) {
8697 D(p->level--);
8698 return NULL;
8699 }
8700 CmpopExprPair* _res = NULL;
8701 int _mark = p->mark;
8702 { // '<' bitwise_or
8703 if (p->error_indicator) {
8704 D(p->level--);
8705 return NULL;
8706 }
8707 D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8708 Token * _literal;
8709 expr_ty a;
8710 if (
8711 (_literal = _PyPegen_expect_token(p, 20)) // token='<'
8712 &&
8713 (a = bitwise_or_rule(p)) // bitwise_or
8714 )
8715 {
8716 D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8717 _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
8718 if (_res == NULL && PyErr_Occurred()) {
8719 p->error_indicator = 1;
8720 D(p->level--);
8721 return NULL;
8722 }
8723 goto done;
8724 }
8725 p->mark = _mark;
8726 D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8727 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
8728 }
8729 _res = NULL;
8730 done:
8731 D(p->level--);
8732 return _res;
8733}
8734
8735// gte_bitwise_or: '>=' bitwise_or
8736static CmpopExprPair*
8737gte_bitwise_or_rule(Parser *p)
8738{
8739 D(p->level++);
8740 if (p->error_indicator) {
8741 D(p->level--);
8742 return NULL;
8743 }
8744 CmpopExprPair* _res = NULL;
8745 int _mark = p->mark;
8746 { // '>=' bitwise_or
8747 if (p->error_indicator) {
8748 D(p->level--);
8749 return NULL;
8750 }
8751 D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8752 Token * _literal;
8753 expr_ty a;
8754 if (
8755 (_literal = _PyPegen_expect_token(p, 30)) // token='>='
8756 &&
8757 (a = bitwise_or_rule(p)) // bitwise_or
8758 )
8759 {
8760 D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8761 _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
8762 if (_res == NULL && PyErr_Occurred()) {
8763 p->error_indicator = 1;
8764 D(p->level--);
8765 return NULL;
8766 }
8767 goto done;
8768 }
8769 p->mark = _mark;
8770 D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8771 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
8772 }
8773 _res = NULL;
8774 done:
8775 D(p->level--);
8776 return _res;
8777}
8778
8779// gt_bitwise_or: '>' bitwise_or
8780static CmpopExprPair*
8781gt_bitwise_or_rule(Parser *p)
8782{
8783 D(p->level++);
8784 if (p->error_indicator) {
8785 D(p->level--);
8786 return NULL;
8787 }
8788 CmpopExprPair* _res = NULL;
8789 int _mark = p->mark;
8790 { // '>' bitwise_or
8791 if (p->error_indicator) {
8792 D(p->level--);
8793 return NULL;
8794 }
8795 D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8796 Token * _literal;
8797 expr_ty a;
8798 if (
8799 (_literal = _PyPegen_expect_token(p, 21)) // token='>'
8800 &&
8801 (a = bitwise_or_rule(p)) // bitwise_or
8802 )
8803 {
8804 D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8805 _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
8806 if (_res == NULL && PyErr_Occurred()) {
8807 p->error_indicator = 1;
8808 D(p->level--);
8809 return NULL;
8810 }
8811 goto done;
8812 }
8813 p->mark = _mark;
8814 D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8815 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
8816 }
8817 _res = NULL;
8818 done:
8819 D(p->level--);
8820 return _res;
8821}
8822
8823// notin_bitwise_or: 'not' 'in' bitwise_or
8824static CmpopExprPair*
8825notin_bitwise_or_rule(Parser *p)
8826{
8827 D(p->level++);
8828 if (p->error_indicator) {
8829 D(p->level--);
8830 return NULL;
8831 }
8832 CmpopExprPair* _res = NULL;
8833 int _mark = p->mark;
8834 { // 'not' 'in' bitwise_or
8835 if (p->error_indicator) {
8836 D(p->level--);
8837 return NULL;
8838 }
8839 D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8840 Token * _keyword;
8841 Token * _keyword_1;
8842 expr_ty a;
8843 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008844 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008845 &&
8846 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
8847 &&
8848 (a = bitwise_or_rule(p)) // bitwise_or
8849 )
8850 {
8851 D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8852 _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
8853 if (_res == NULL && PyErr_Occurred()) {
8854 p->error_indicator = 1;
8855 D(p->level--);
8856 return NULL;
8857 }
8858 goto done;
8859 }
8860 p->mark = _mark;
8861 D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8862 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
8863 }
8864 _res = NULL;
8865 done:
8866 D(p->level--);
8867 return _res;
8868}
8869
8870// in_bitwise_or: 'in' bitwise_or
8871static CmpopExprPair*
8872in_bitwise_or_rule(Parser *p)
8873{
8874 D(p->level++);
8875 if (p->error_indicator) {
8876 D(p->level--);
8877 return NULL;
8878 }
8879 CmpopExprPair* _res = NULL;
8880 int _mark = p->mark;
8881 { // 'in' bitwise_or
8882 if (p->error_indicator) {
8883 D(p->level--);
8884 return NULL;
8885 }
8886 D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8887 Token * _keyword;
8888 expr_ty a;
8889 if (
8890 (_keyword = _PyPegen_expect_token(p, 518)) // token='in'
8891 &&
8892 (a = bitwise_or_rule(p)) // bitwise_or
8893 )
8894 {
8895 D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8896 _res = _PyPegen_cmpop_expr_pair ( p , In , a );
8897 if (_res == NULL && PyErr_Occurred()) {
8898 p->error_indicator = 1;
8899 D(p->level--);
8900 return NULL;
8901 }
8902 goto done;
8903 }
8904 p->mark = _mark;
8905 D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8906 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
8907 }
8908 _res = NULL;
8909 done:
8910 D(p->level--);
8911 return _res;
8912}
8913
8914// isnot_bitwise_or: 'is' 'not' bitwise_or
8915static CmpopExprPair*
8916isnot_bitwise_or_rule(Parser *p)
8917{
8918 D(p->level++);
8919 if (p->error_indicator) {
8920 D(p->level--);
8921 return NULL;
8922 }
8923 CmpopExprPair* _res = NULL;
8924 int _mark = p->mark;
8925 { // 'is' 'not' bitwise_or
8926 if (p->error_indicator) {
8927 D(p->level--);
8928 return NULL;
8929 }
8930 D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8931 Token * _keyword;
8932 Token * _keyword_1;
8933 expr_ty a;
8934 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008935 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008936 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008937 (_keyword_1 = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008938 &&
8939 (a = bitwise_or_rule(p)) // bitwise_or
8940 )
8941 {
8942 D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8943 _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
8944 if (_res == NULL && PyErr_Occurred()) {
8945 p->error_indicator = 1;
8946 D(p->level--);
8947 return NULL;
8948 }
8949 goto done;
8950 }
8951 p->mark = _mark;
8952 D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8953 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
8954 }
8955 _res = NULL;
8956 done:
8957 D(p->level--);
8958 return _res;
8959}
8960
8961// is_bitwise_or: 'is' bitwise_or
8962static CmpopExprPair*
8963is_bitwise_or_rule(Parser *p)
8964{
8965 D(p->level++);
8966 if (p->error_indicator) {
8967 D(p->level--);
8968 return NULL;
8969 }
8970 CmpopExprPair* _res = NULL;
8971 int _mark = p->mark;
8972 { // 'is' bitwise_or
8973 if (p->error_indicator) {
8974 D(p->level--);
8975 return NULL;
8976 }
8977 D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
8978 Token * _keyword;
8979 expr_ty a;
8980 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008981 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008982 &&
8983 (a = bitwise_or_rule(p)) // bitwise_or
8984 )
8985 {
8986 D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
8987 _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
8988 if (_res == NULL && PyErr_Occurred()) {
8989 p->error_indicator = 1;
8990 D(p->level--);
8991 return NULL;
8992 }
8993 goto done;
8994 }
8995 p->mark = _mark;
8996 D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8997 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
8998 }
8999 _res = NULL;
9000 done:
9001 D(p->level--);
9002 return _res;
9003}
9004
9005// Left-recursive
9006// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
9007static expr_ty bitwise_or_raw(Parser *);
9008static expr_ty
9009bitwise_or_rule(Parser *p)
9010{
9011 D(p->level++);
9012 expr_ty _res = NULL;
9013 if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
9014 D(p->level--);
9015 return _res;
9016 }
9017 int _mark = p->mark;
9018 int _resmark = p->mark;
9019 while (1) {
9020 int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
9021 if (tmpvar_1) {
9022 D(p->level--);
9023 return _res;
9024 }
9025 p->mark = _mark;
9026 void *_raw = bitwise_or_raw(p);
9027 if (_raw == NULL || p->mark <= _resmark)
9028 break;
9029 _resmark = p->mark;
9030 _res = _raw;
9031 }
9032 p->mark = _resmark;
9033 D(p->level--);
9034 return _res;
9035}
9036static expr_ty
9037bitwise_or_raw(Parser *p)
9038{
9039 D(p->level++);
9040 if (p->error_indicator) {
9041 D(p->level--);
9042 return NULL;
9043 }
9044 expr_ty _res = NULL;
9045 int _mark = p->mark;
9046 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9047 p->error_indicator = 1;
9048 D(p->level--);
9049 return NULL;
9050 }
9051 int _start_lineno = p->tokens[_mark]->lineno;
9052 UNUSED(_start_lineno); // Only used by EXTRA macro
9053 int _start_col_offset = p->tokens[_mark]->col_offset;
9054 UNUSED(_start_col_offset); // Only used by EXTRA macro
9055 { // bitwise_or '|' bitwise_xor
9056 if (p->error_indicator) {
9057 D(p->level--);
9058 return NULL;
9059 }
9060 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9061 Token * _literal;
9062 expr_ty a;
9063 expr_ty b;
9064 if (
9065 (a = bitwise_or_rule(p)) // bitwise_or
9066 &&
9067 (_literal = _PyPegen_expect_token(p, 18)) // token='|'
9068 &&
9069 (b = bitwise_xor_rule(p)) // bitwise_xor
9070 )
9071 {
9072 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9073 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9074 if (_token == NULL) {
9075 D(p->level--);
9076 return NULL;
9077 }
9078 int _end_lineno = _token->end_lineno;
9079 UNUSED(_end_lineno); // Only used by EXTRA macro
9080 int _end_col_offset = _token->end_col_offset;
9081 UNUSED(_end_col_offset); // Only used by EXTRA macro
9082 _res = _Py_BinOp ( a , BitOr , b , EXTRA );
9083 if (_res == NULL && PyErr_Occurred()) {
9084 p->error_indicator = 1;
9085 D(p->level--);
9086 return NULL;
9087 }
9088 goto done;
9089 }
9090 p->mark = _mark;
9091 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9092 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9093 }
9094 { // bitwise_xor
9095 if (p->error_indicator) {
9096 D(p->level--);
9097 return NULL;
9098 }
9099 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9100 expr_ty bitwise_xor_var;
9101 if (
9102 (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor
9103 )
9104 {
9105 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9106 _res = bitwise_xor_var;
9107 goto done;
9108 }
9109 p->mark = _mark;
9110 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9111 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
9112 }
9113 _res = NULL;
9114 done:
9115 D(p->level--);
9116 return _res;
9117}
9118
9119// Left-recursive
9120// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
9121static expr_ty bitwise_xor_raw(Parser *);
9122static expr_ty
9123bitwise_xor_rule(Parser *p)
9124{
9125 D(p->level++);
9126 expr_ty _res = NULL;
9127 if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
9128 D(p->level--);
9129 return _res;
9130 }
9131 int _mark = p->mark;
9132 int _resmark = p->mark;
9133 while (1) {
9134 int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
9135 if (tmpvar_2) {
9136 D(p->level--);
9137 return _res;
9138 }
9139 p->mark = _mark;
9140 void *_raw = bitwise_xor_raw(p);
9141 if (_raw == NULL || p->mark <= _resmark)
9142 break;
9143 _resmark = p->mark;
9144 _res = _raw;
9145 }
9146 p->mark = _resmark;
9147 D(p->level--);
9148 return _res;
9149}
9150static expr_ty
9151bitwise_xor_raw(Parser *p)
9152{
9153 D(p->level++);
9154 if (p->error_indicator) {
9155 D(p->level--);
9156 return NULL;
9157 }
9158 expr_ty _res = NULL;
9159 int _mark = p->mark;
9160 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9161 p->error_indicator = 1;
9162 D(p->level--);
9163 return NULL;
9164 }
9165 int _start_lineno = p->tokens[_mark]->lineno;
9166 UNUSED(_start_lineno); // Only used by EXTRA macro
9167 int _start_col_offset = p->tokens[_mark]->col_offset;
9168 UNUSED(_start_col_offset); // Only used by EXTRA macro
9169 { // bitwise_xor '^' bitwise_and
9170 if (p->error_indicator) {
9171 D(p->level--);
9172 return NULL;
9173 }
9174 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9175 Token * _literal;
9176 expr_ty a;
9177 expr_ty b;
9178 if (
9179 (a = bitwise_xor_rule(p)) // bitwise_xor
9180 &&
9181 (_literal = _PyPegen_expect_token(p, 32)) // token='^'
9182 &&
9183 (b = bitwise_and_rule(p)) // bitwise_and
9184 )
9185 {
9186 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9187 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9188 if (_token == NULL) {
9189 D(p->level--);
9190 return NULL;
9191 }
9192 int _end_lineno = _token->end_lineno;
9193 UNUSED(_end_lineno); // Only used by EXTRA macro
9194 int _end_col_offset = _token->end_col_offset;
9195 UNUSED(_end_col_offset); // Only used by EXTRA macro
9196 _res = _Py_BinOp ( a , BitXor , b , EXTRA );
9197 if (_res == NULL && PyErr_Occurred()) {
9198 p->error_indicator = 1;
9199 D(p->level--);
9200 return NULL;
9201 }
9202 goto done;
9203 }
9204 p->mark = _mark;
9205 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9206 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9207 }
9208 { // bitwise_and
9209 if (p->error_indicator) {
9210 D(p->level--);
9211 return NULL;
9212 }
9213 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9214 expr_ty bitwise_and_var;
9215 if (
9216 (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and
9217 )
9218 {
9219 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9220 _res = bitwise_and_var;
9221 goto done;
9222 }
9223 p->mark = _mark;
9224 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9225 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
9226 }
9227 _res = NULL;
9228 done:
9229 D(p->level--);
9230 return _res;
9231}
9232
9233// Left-recursive
9234// bitwise_and: bitwise_and '&' shift_expr | shift_expr
9235static expr_ty bitwise_and_raw(Parser *);
9236static expr_ty
9237bitwise_and_rule(Parser *p)
9238{
9239 D(p->level++);
9240 expr_ty _res = NULL;
9241 if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
9242 D(p->level--);
9243 return _res;
9244 }
9245 int _mark = p->mark;
9246 int _resmark = p->mark;
9247 while (1) {
9248 int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
9249 if (tmpvar_3) {
9250 D(p->level--);
9251 return _res;
9252 }
9253 p->mark = _mark;
9254 void *_raw = bitwise_and_raw(p);
9255 if (_raw == NULL || p->mark <= _resmark)
9256 break;
9257 _resmark = p->mark;
9258 _res = _raw;
9259 }
9260 p->mark = _resmark;
9261 D(p->level--);
9262 return _res;
9263}
9264static expr_ty
9265bitwise_and_raw(Parser *p)
9266{
9267 D(p->level++);
9268 if (p->error_indicator) {
9269 D(p->level--);
9270 return NULL;
9271 }
9272 expr_ty _res = NULL;
9273 int _mark = p->mark;
9274 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9275 p->error_indicator = 1;
9276 D(p->level--);
9277 return NULL;
9278 }
9279 int _start_lineno = p->tokens[_mark]->lineno;
9280 UNUSED(_start_lineno); // Only used by EXTRA macro
9281 int _start_col_offset = p->tokens[_mark]->col_offset;
9282 UNUSED(_start_col_offset); // Only used by EXTRA macro
9283 { // bitwise_and '&' shift_expr
9284 if (p->error_indicator) {
9285 D(p->level--);
9286 return NULL;
9287 }
9288 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9289 Token * _literal;
9290 expr_ty a;
9291 expr_ty b;
9292 if (
9293 (a = bitwise_and_rule(p)) // bitwise_and
9294 &&
9295 (_literal = _PyPegen_expect_token(p, 19)) // token='&'
9296 &&
9297 (b = shift_expr_rule(p)) // shift_expr
9298 )
9299 {
9300 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9301 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9302 if (_token == NULL) {
9303 D(p->level--);
9304 return NULL;
9305 }
9306 int _end_lineno = _token->end_lineno;
9307 UNUSED(_end_lineno); // Only used by EXTRA macro
9308 int _end_col_offset = _token->end_col_offset;
9309 UNUSED(_end_col_offset); // Only used by EXTRA macro
9310 _res = _Py_BinOp ( a , BitAnd , b , EXTRA );
9311 if (_res == NULL && PyErr_Occurred()) {
9312 p->error_indicator = 1;
9313 D(p->level--);
9314 return NULL;
9315 }
9316 goto done;
9317 }
9318 p->mark = _mark;
9319 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9320 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr"));
9321 }
9322 { // shift_expr
9323 if (p->error_indicator) {
9324 D(p->level--);
9325 return NULL;
9326 }
9327 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9328 expr_ty shift_expr_var;
9329 if (
9330 (shift_expr_var = shift_expr_rule(p)) // shift_expr
9331 )
9332 {
9333 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9334 _res = shift_expr_var;
9335 goto done;
9336 }
9337 p->mark = _mark;
9338 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9339 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
9340 }
9341 _res = NULL;
9342 done:
9343 D(p->level--);
9344 return _res;
9345}
9346
9347// Left-recursive
9348// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
9349static expr_ty shift_expr_raw(Parser *);
9350static expr_ty
9351shift_expr_rule(Parser *p)
9352{
9353 D(p->level++);
9354 expr_ty _res = NULL;
9355 if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
9356 D(p->level--);
9357 return _res;
9358 }
9359 int _mark = p->mark;
9360 int _resmark = p->mark;
9361 while (1) {
9362 int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
9363 if (tmpvar_4) {
9364 D(p->level--);
9365 return _res;
9366 }
9367 p->mark = _mark;
9368 void *_raw = shift_expr_raw(p);
9369 if (_raw == NULL || p->mark <= _resmark)
9370 break;
9371 _resmark = p->mark;
9372 _res = _raw;
9373 }
9374 p->mark = _resmark;
9375 D(p->level--);
9376 return _res;
9377}
9378static expr_ty
9379shift_expr_raw(Parser *p)
9380{
9381 D(p->level++);
9382 if (p->error_indicator) {
9383 D(p->level--);
9384 return NULL;
9385 }
9386 expr_ty _res = NULL;
9387 int _mark = p->mark;
9388 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9389 p->error_indicator = 1;
9390 D(p->level--);
9391 return NULL;
9392 }
9393 int _start_lineno = p->tokens[_mark]->lineno;
9394 UNUSED(_start_lineno); // Only used by EXTRA macro
9395 int _start_col_offset = p->tokens[_mark]->col_offset;
9396 UNUSED(_start_col_offset); // Only used by EXTRA macro
9397 { // shift_expr '<<' sum
9398 if (p->error_indicator) {
9399 D(p->level--);
9400 return NULL;
9401 }
9402 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9403 Token * _literal;
9404 expr_ty a;
9405 expr_ty b;
9406 if (
9407 (a = shift_expr_rule(p)) // shift_expr
9408 &&
9409 (_literal = _PyPegen_expect_token(p, 33)) // token='<<'
9410 &&
9411 (b = sum_rule(p)) // sum
9412 )
9413 {
9414 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9415 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9416 if (_token == NULL) {
9417 D(p->level--);
9418 return NULL;
9419 }
9420 int _end_lineno = _token->end_lineno;
9421 UNUSED(_end_lineno); // Only used by EXTRA macro
9422 int _end_col_offset = _token->end_col_offset;
9423 UNUSED(_end_col_offset); // Only used by EXTRA macro
9424 _res = _Py_BinOp ( a , LShift , b , EXTRA );
9425 if (_res == NULL && PyErr_Occurred()) {
9426 p->error_indicator = 1;
9427 D(p->level--);
9428 return NULL;
9429 }
9430 goto done;
9431 }
9432 p->mark = _mark;
9433 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9434 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
9435 }
9436 { // shift_expr '>>' sum
9437 if (p->error_indicator) {
9438 D(p->level--);
9439 return NULL;
9440 }
9441 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9442 Token * _literal;
9443 expr_ty a;
9444 expr_ty b;
9445 if (
9446 (a = shift_expr_rule(p)) // shift_expr
9447 &&
9448 (_literal = _PyPegen_expect_token(p, 34)) // token='>>'
9449 &&
9450 (b = sum_rule(p)) // sum
9451 )
9452 {
9453 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9454 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9455 if (_token == NULL) {
9456 D(p->level--);
9457 return NULL;
9458 }
9459 int _end_lineno = _token->end_lineno;
9460 UNUSED(_end_lineno); // Only used by EXTRA macro
9461 int _end_col_offset = _token->end_col_offset;
9462 UNUSED(_end_col_offset); // Only used by EXTRA macro
9463 _res = _Py_BinOp ( a , RShift , b , EXTRA );
9464 if (_res == NULL && PyErr_Occurred()) {
9465 p->error_indicator = 1;
9466 D(p->level--);
9467 return NULL;
9468 }
9469 goto done;
9470 }
9471 p->mark = _mark;
9472 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9473 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum"));
9474 }
9475 { // sum
9476 if (p->error_indicator) {
9477 D(p->level--);
9478 return NULL;
9479 }
9480 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
9481 expr_ty sum_var;
9482 if (
9483 (sum_var = sum_rule(p)) // sum
9484 )
9485 {
9486 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
9487 _res = sum_var;
9488 goto done;
9489 }
9490 p->mark = _mark;
9491 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9492 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
9493 }
9494 _res = NULL;
9495 done:
9496 D(p->level--);
9497 return _res;
9498}
9499
9500// Left-recursive
9501// sum: sum '+' term | sum '-' term | term
9502static expr_ty sum_raw(Parser *);
9503static expr_ty
9504sum_rule(Parser *p)
9505{
9506 D(p->level++);
9507 expr_ty _res = NULL;
9508 if (_PyPegen_is_memoized(p, sum_type, &_res)) {
9509 D(p->level--);
9510 return _res;
9511 }
9512 int _mark = p->mark;
9513 int _resmark = p->mark;
9514 while (1) {
9515 int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res);
9516 if (tmpvar_5) {
9517 D(p->level--);
9518 return _res;
9519 }
9520 p->mark = _mark;
9521 void *_raw = sum_raw(p);
9522 if (_raw == NULL || p->mark <= _resmark)
9523 break;
9524 _resmark = p->mark;
9525 _res = _raw;
9526 }
9527 p->mark = _resmark;
9528 D(p->level--);
9529 return _res;
9530}
9531static expr_ty
9532sum_raw(Parser *p)
9533{
9534 D(p->level++);
9535 if (p->error_indicator) {
9536 D(p->level--);
9537 return NULL;
9538 }
9539 expr_ty _res = NULL;
9540 int _mark = p->mark;
9541 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9542 p->error_indicator = 1;
9543 D(p->level--);
9544 return NULL;
9545 }
9546 int _start_lineno = p->tokens[_mark]->lineno;
9547 UNUSED(_start_lineno); // Only used by EXTRA macro
9548 int _start_col_offset = p->tokens[_mark]->col_offset;
9549 UNUSED(_start_col_offset); // Only used by EXTRA macro
9550 { // sum '+' term
9551 if (p->error_indicator) {
9552 D(p->level--);
9553 return NULL;
9554 }
9555 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9556 Token * _literal;
9557 expr_ty a;
9558 expr_ty b;
9559 if (
9560 (a = sum_rule(p)) // sum
9561 &&
9562 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9563 &&
9564 (b = term_rule(p)) // term
9565 )
9566 {
9567 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9568 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9569 if (_token == NULL) {
9570 D(p->level--);
9571 return NULL;
9572 }
9573 int _end_lineno = _token->end_lineno;
9574 UNUSED(_end_lineno); // Only used by EXTRA macro
9575 int _end_col_offset = _token->end_col_offset;
9576 UNUSED(_end_col_offset); // Only used by EXTRA macro
9577 _res = _Py_BinOp ( a , Add , b , EXTRA );
9578 if (_res == NULL && PyErr_Occurred()) {
9579 p->error_indicator = 1;
9580 D(p->level--);
9581 return NULL;
9582 }
9583 goto done;
9584 }
9585 p->mark = _mark;
9586 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9587 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
9588 }
9589 { // sum '-' term
9590 if (p->error_indicator) {
9591 D(p->level--);
9592 return NULL;
9593 }
9594 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9595 Token * _literal;
9596 expr_ty a;
9597 expr_ty b;
9598 if (
9599 (a = sum_rule(p)) // sum
9600 &&
9601 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
9602 &&
9603 (b = term_rule(p)) // term
9604 )
9605 {
9606 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9607 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9608 if (_token == NULL) {
9609 D(p->level--);
9610 return NULL;
9611 }
9612 int _end_lineno = _token->end_lineno;
9613 UNUSED(_end_lineno); // Only used by EXTRA macro
9614 int _end_col_offset = _token->end_col_offset;
9615 UNUSED(_end_col_offset); // Only used by EXTRA macro
9616 _res = _Py_BinOp ( a , Sub , b , EXTRA );
9617 if (_res == NULL && PyErr_Occurred()) {
9618 p->error_indicator = 1;
9619 D(p->level--);
9620 return NULL;
9621 }
9622 goto done;
9623 }
9624 p->mark = _mark;
9625 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9626 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term"));
9627 }
9628 { // term
9629 if (p->error_indicator) {
9630 D(p->level--);
9631 return NULL;
9632 }
9633 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
9634 expr_ty term_var;
9635 if (
9636 (term_var = term_rule(p)) // term
9637 )
9638 {
9639 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
9640 _res = term_var;
9641 goto done;
9642 }
9643 p->mark = _mark;
9644 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9645 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
9646 }
9647 _res = NULL;
9648 done:
9649 D(p->level--);
9650 return _res;
9651}
9652
9653// Left-recursive
9654// term:
9655// | term '*' factor
9656// | term '/' factor
9657// | term '//' factor
9658// | term '%' factor
9659// | term '@' factor
9660// | factor
9661static expr_ty term_raw(Parser *);
9662static expr_ty
9663term_rule(Parser *p)
9664{
9665 D(p->level++);
9666 expr_ty _res = NULL;
9667 if (_PyPegen_is_memoized(p, term_type, &_res)) {
9668 D(p->level--);
9669 return _res;
9670 }
9671 int _mark = p->mark;
9672 int _resmark = p->mark;
9673 while (1) {
9674 int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res);
9675 if (tmpvar_6) {
9676 D(p->level--);
9677 return _res;
9678 }
9679 p->mark = _mark;
9680 void *_raw = term_raw(p);
9681 if (_raw == NULL || p->mark <= _resmark)
9682 break;
9683 _resmark = p->mark;
9684 _res = _raw;
9685 }
9686 p->mark = _resmark;
9687 D(p->level--);
9688 return _res;
9689}
9690static expr_ty
9691term_raw(Parser *p)
9692{
9693 D(p->level++);
9694 if (p->error_indicator) {
9695 D(p->level--);
9696 return NULL;
9697 }
9698 expr_ty _res = NULL;
9699 int _mark = p->mark;
9700 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9701 p->error_indicator = 1;
9702 D(p->level--);
9703 return NULL;
9704 }
9705 int _start_lineno = p->tokens[_mark]->lineno;
9706 UNUSED(_start_lineno); // Only used by EXTRA macro
9707 int _start_col_offset = p->tokens[_mark]->col_offset;
9708 UNUSED(_start_col_offset); // Only used by EXTRA macro
9709 { // term '*' factor
9710 if (p->error_indicator) {
9711 D(p->level--);
9712 return NULL;
9713 }
9714 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9715 Token * _literal;
9716 expr_ty a;
9717 expr_ty b;
9718 if (
9719 (a = term_rule(p)) // term
9720 &&
9721 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
9722 &&
9723 (b = factor_rule(p)) // factor
9724 )
9725 {
9726 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9727 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9728 if (_token == NULL) {
9729 D(p->level--);
9730 return NULL;
9731 }
9732 int _end_lineno = _token->end_lineno;
9733 UNUSED(_end_lineno); // Only used by EXTRA macro
9734 int _end_col_offset = _token->end_col_offset;
9735 UNUSED(_end_col_offset); // Only used by EXTRA macro
9736 _res = _Py_BinOp ( a , Mult , b , EXTRA );
9737 if (_res == NULL && PyErr_Occurred()) {
9738 p->error_indicator = 1;
9739 D(p->level--);
9740 return NULL;
9741 }
9742 goto done;
9743 }
9744 p->mark = _mark;
9745 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9746 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
9747 }
9748 { // term '/' factor
9749 if (p->error_indicator) {
9750 D(p->level--);
9751 return NULL;
9752 }
9753 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9754 Token * _literal;
9755 expr_ty a;
9756 expr_ty b;
9757 if (
9758 (a = term_rule(p)) // term
9759 &&
9760 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
9761 &&
9762 (b = factor_rule(p)) // factor
9763 )
9764 {
9765 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9766 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9767 if (_token == NULL) {
9768 D(p->level--);
9769 return NULL;
9770 }
9771 int _end_lineno = _token->end_lineno;
9772 UNUSED(_end_lineno); // Only used by EXTRA macro
9773 int _end_col_offset = _token->end_col_offset;
9774 UNUSED(_end_col_offset); // Only used by EXTRA macro
9775 _res = _Py_BinOp ( a , Div , b , EXTRA );
9776 if (_res == NULL && PyErr_Occurred()) {
9777 p->error_indicator = 1;
9778 D(p->level--);
9779 return NULL;
9780 }
9781 goto done;
9782 }
9783 p->mark = _mark;
9784 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9785 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
9786 }
9787 { // term '//' factor
9788 if (p->error_indicator) {
9789 D(p->level--);
9790 return NULL;
9791 }
9792 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9793 Token * _literal;
9794 expr_ty a;
9795 expr_ty b;
9796 if (
9797 (a = term_rule(p)) // term
9798 &&
9799 (_literal = _PyPegen_expect_token(p, 47)) // token='//'
9800 &&
9801 (b = factor_rule(p)) // factor
9802 )
9803 {
9804 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9805 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9806 if (_token == NULL) {
9807 D(p->level--);
9808 return NULL;
9809 }
9810 int _end_lineno = _token->end_lineno;
9811 UNUSED(_end_lineno); // Only used by EXTRA macro
9812 int _end_col_offset = _token->end_col_offset;
9813 UNUSED(_end_col_offset); // Only used by EXTRA macro
9814 _res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
9815 if (_res == NULL && PyErr_Occurred()) {
9816 p->error_indicator = 1;
9817 D(p->level--);
9818 return NULL;
9819 }
9820 goto done;
9821 }
9822 p->mark = _mark;
9823 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9824 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
9825 }
9826 { // term '%' factor
9827 if (p->error_indicator) {
9828 D(p->level--);
9829 return NULL;
9830 }
9831 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9832 Token * _literal;
9833 expr_ty a;
9834 expr_ty b;
9835 if (
9836 (a = term_rule(p)) // term
9837 &&
9838 (_literal = _PyPegen_expect_token(p, 24)) // token='%'
9839 &&
9840 (b = factor_rule(p)) // factor
9841 )
9842 {
9843 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9844 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9845 if (_token == NULL) {
9846 D(p->level--);
9847 return NULL;
9848 }
9849 int _end_lineno = _token->end_lineno;
9850 UNUSED(_end_lineno); // Only used by EXTRA macro
9851 int _end_col_offset = _token->end_col_offset;
9852 UNUSED(_end_col_offset); // Only used by EXTRA macro
9853 _res = _Py_BinOp ( a , Mod , b , EXTRA );
9854 if (_res == NULL && PyErr_Occurred()) {
9855 p->error_indicator = 1;
9856 D(p->level--);
9857 return NULL;
9858 }
9859 goto done;
9860 }
9861 p->mark = _mark;
9862 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9863 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
9864 }
9865 { // term '@' factor
9866 if (p->error_indicator) {
9867 D(p->level--);
9868 return NULL;
9869 }
9870 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9871 Token * _literal;
9872 expr_ty a;
9873 expr_ty b;
9874 if (
9875 (a = term_rule(p)) // term
9876 &&
9877 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
9878 &&
9879 (b = factor_rule(p)) // factor
9880 )
9881 {
9882 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9883 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9884 if (_token == NULL) {
9885 D(p->level--);
9886 return NULL;
9887 }
9888 int _end_lineno = _token->end_lineno;
9889 UNUSED(_end_lineno); // Only used by EXTRA macro
9890 int _end_col_offset = _token->end_col_offset;
9891 UNUSED(_end_col_offset); // Only used by EXTRA macro
9892 _res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) );
9893 if (_res == NULL && PyErr_Occurred()) {
9894 p->error_indicator = 1;
9895 D(p->level--);
9896 return NULL;
9897 }
9898 goto done;
9899 }
9900 p->mark = _mark;
9901 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9902 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor"));
9903 }
9904 { // factor
9905 if (p->error_indicator) {
9906 D(p->level--);
9907 return NULL;
9908 }
9909 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
9910 expr_ty factor_var;
9911 if (
9912 (factor_var = factor_rule(p)) // factor
9913 )
9914 {
9915 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
9916 _res = factor_var;
9917 goto done;
9918 }
9919 p->mark = _mark;
9920 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9921 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
9922 }
9923 _res = NULL;
9924 done:
9925 D(p->level--);
9926 return _res;
9927}
9928
9929// factor: '+' factor | '-' factor | '~' factor | power
9930static expr_ty
9931factor_rule(Parser *p)
9932{
9933 D(p->level++);
9934 if (p->error_indicator) {
9935 D(p->level--);
9936 return NULL;
9937 }
9938 expr_ty _res = NULL;
9939 if (_PyPegen_is_memoized(p, factor_type, &_res)) {
9940 D(p->level--);
9941 return _res;
9942 }
9943 int _mark = p->mark;
9944 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9945 p->error_indicator = 1;
9946 D(p->level--);
9947 return NULL;
9948 }
9949 int _start_lineno = p->tokens[_mark]->lineno;
9950 UNUSED(_start_lineno); // Only used by EXTRA macro
9951 int _start_col_offset = p->tokens[_mark]->col_offset;
9952 UNUSED(_start_col_offset); // Only used by EXTRA macro
9953 { // '+' factor
9954 if (p->error_indicator) {
9955 D(p->level--);
9956 return NULL;
9957 }
9958 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9959 Token * _literal;
9960 expr_ty a;
9961 if (
9962 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9963 &&
9964 (a = factor_rule(p)) // factor
9965 )
9966 {
9967 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9968 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9969 if (_token == NULL) {
9970 D(p->level--);
9971 return NULL;
9972 }
9973 int _end_lineno = _token->end_lineno;
9974 UNUSED(_end_lineno); // Only used by EXTRA macro
9975 int _end_col_offset = _token->end_col_offset;
9976 UNUSED(_end_col_offset); // Only used by EXTRA macro
9977 _res = _Py_UnaryOp ( UAdd , a , EXTRA );
9978 if (_res == NULL && PyErr_Occurred()) {
9979 p->error_indicator = 1;
9980 D(p->level--);
9981 return NULL;
9982 }
9983 goto done;
9984 }
9985 p->mark = _mark;
9986 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
9987 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
9988 }
9989 { // '-' factor
9990 if (p->error_indicator) {
9991 D(p->level--);
9992 return NULL;
9993 }
9994 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
9995 Token * _literal;
9996 expr_ty a;
9997 if (
9998 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
9999 &&
10000 (a = factor_rule(p)) // factor
10001 )
10002 {
10003 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10004 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10005 if (_token == NULL) {
10006 D(p->level--);
10007 return NULL;
10008 }
10009 int _end_lineno = _token->end_lineno;
10010 UNUSED(_end_lineno); // Only used by EXTRA macro
10011 int _end_col_offset = _token->end_col_offset;
10012 UNUSED(_end_col_offset); // Only used by EXTRA macro
10013 _res = _Py_UnaryOp ( USub , a , EXTRA );
10014 if (_res == NULL && PyErr_Occurred()) {
10015 p->error_indicator = 1;
10016 D(p->level--);
10017 return NULL;
10018 }
10019 goto done;
10020 }
10021 p->mark = _mark;
10022 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10023 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
10024 }
10025 { // '~' factor
10026 if (p->error_indicator) {
10027 D(p->level--);
10028 return NULL;
10029 }
10030 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10031 Token * _literal;
10032 expr_ty a;
10033 if (
10034 (_literal = _PyPegen_expect_token(p, 31)) // token='~'
10035 &&
10036 (a = factor_rule(p)) // factor
10037 )
10038 {
10039 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10040 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10041 if (_token == NULL) {
10042 D(p->level--);
10043 return NULL;
10044 }
10045 int _end_lineno = _token->end_lineno;
10046 UNUSED(_end_lineno); // Only used by EXTRA macro
10047 int _end_col_offset = _token->end_col_offset;
10048 UNUSED(_end_col_offset); // Only used by EXTRA macro
10049 _res = _Py_UnaryOp ( Invert , a , EXTRA );
10050 if (_res == NULL && PyErr_Occurred()) {
10051 p->error_indicator = 1;
10052 D(p->level--);
10053 return NULL;
10054 }
10055 goto done;
10056 }
10057 p->mark = _mark;
10058 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10059 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor"));
10060 }
10061 { // power
10062 if (p->error_indicator) {
10063 D(p->level--);
10064 return NULL;
10065 }
10066 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
10067 expr_ty power_var;
10068 if (
10069 (power_var = power_rule(p)) // power
10070 )
10071 {
10072 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
10073 _res = power_var;
10074 goto done;
10075 }
10076 p->mark = _mark;
10077 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10078 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
10079 }
10080 _res = NULL;
10081 done:
10082 _PyPegen_insert_memo(p, _mark, factor_type, _res);
10083 D(p->level--);
10084 return _res;
10085}
10086
10087// power: await_primary '**' factor | await_primary
10088static expr_ty
10089power_rule(Parser *p)
10090{
10091 D(p->level++);
10092 if (p->error_indicator) {
10093 D(p->level--);
10094 return NULL;
10095 }
10096 expr_ty _res = NULL;
10097 int _mark = p->mark;
10098 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10099 p->error_indicator = 1;
10100 D(p->level--);
10101 return NULL;
10102 }
10103 int _start_lineno = p->tokens[_mark]->lineno;
10104 UNUSED(_start_lineno); // Only used by EXTRA macro
10105 int _start_col_offset = p->tokens[_mark]->col_offset;
10106 UNUSED(_start_col_offset); // Only used by EXTRA macro
10107 { // await_primary '**' factor
10108 if (p->error_indicator) {
10109 D(p->level--);
10110 return NULL;
10111 }
10112 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10113 Token * _literal;
10114 expr_ty a;
10115 expr_ty b;
10116 if (
10117 (a = await_primary_rule(p)) // await_primary
10118 &&
10119 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
10120 &&
10121 (b = factor_rule(p)) // factor
10122 )
10123 {
10124 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10125 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10126 if (_token == NULL) {
10127 D(p->level--);
10128 return NULL;
10129 }
10130 int _end_lineno = _token->end_lineno;
10131 UNUSED(_end_lineno); // Only used by EXTRA macro
10132 int _end_col_offset = _token->end_col_offset;
10133 UNUSED(_end_col_offset); // Only used by EXTRA macro
10134 _res = _Py_BinOp ( a , Pow , b , EXTRA );
10135 if (_res == NULL && PyErr_Occurred()) {
10136 p->error_indicator = 1;
10137 D(p->level--);
10138 return NULL;
10139 }
10140 goto done;
10141 }
10142 p->mark = _mark;
10143 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10144 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor"));
10145 }
10146 { // await_primary
10147 if (p->error_indicator) {
10148 D(p->level--);
10149 return NULL;
10150 }
10151 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
10152 expr_ty await_primary_var;
10153 if (
10154 (await_primary_var = await_primary_rule(p)) // await_primary
10155 )
10156 {
10157 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
10158 _res = await_primary_var;
10159 goto done;
10160 }
10161 p->mark = _mark;
10162 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10163 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
10164 }
10165 _res = NULL;
10166 done:
10167 D(p->level--);
10168 return _res;
10169}
10170
10171// await_primary: AWAIT primary | primary
10172static expr_ty
10173await_primary_rule(Parser *p)
10174{
10175 D(p->level++);
10176 if (p->error_indicator) {
10177 D(p->level--);
10178 return NULL;
10179 }
10180 expr_ty _res = NULL;
10181 if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
10182 D(p->level--);
10183 return _res;
10184 }
10185 int _mark = p->mark;
10186 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10187 p->error_indicator = 1;
10188 D(p->level--);
10189 return NULL;
10190 }
10191 int _start_lineno = p->tokens[_mark]->lineno;
10192 UNUSED(_start_lineno); // Only used by EXTRA macro
10193 int _start_col_offset = p->tokens[_mark]->col_offset;
10194 UNUSED(_start_col_offset); // Only used by EXTRA macro
10195 { // AWAIT primary
10196 if (p->error_indicator) {
10197 D(p->level--);
10198 return NULL;
10199 }
10200 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10201 expr_ty a;
10202 Token * await_var;
10203 if (
10204 (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT'
10205 &&
10206 (a = primary_rule(p)) // primary
10207 )
10208 {
10209 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10210 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10211 if (_token == NULL) {
10212 D(p->level--);
10213 return NULL;
10214 }
10215 int _end_lineno = _token->end_lineno;
10216 UNUSED(_end_lineno); // Only used by EXTRA macro
10217 int _end_col_offset = _token->end_col_offset;
10218 UNUSED(_end_col_offset); // Only used by EXTRA macro
10219 _res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) );
10220 if (_res == NULL && PyErr_Occurred()) {
10221 p->error_indicator = 1;
10222 D(p->level--);
10223 return NULL;
10224 }
10225 goto done;
10226 }
10227 p->mark = _mark;
10228 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10229 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary"));
10230 }
10231 { // primary
10232 if (p->error_indicator) {
10233 D(p->level--);
10234 return NULL;
10235 }
10236 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
10237 expr_ty primary_var;
10238 if (
10239 (primary_var = primary_rule(p)) // primary
10240 )
10241 {
10242 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
10243 _res = primary_var;
10244 goto done;
10245 }
10246 p->mark = _mark;
10247 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10248 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
10249 }
10250 _res = NULL;
10251 done:
10252 _PyPegen_insert_memo(p, _mark, await_primary_type, _res);
10253 D(p->level--);
10254 return _res;
10255}
10256
10257// Left-recursive
10258// primary:
10259// | primary '.' NAME
10260// | primary genexp
10261// | primary '(' arguments? ')'
10262// | primary '[' slices ']'
10263// | atom
10264static expr_ty primary_raw(Parser *);
10265static expr_ty
10266primary_rule(Parser *p)
10267{
10268 D(p->level++);
10269 expr_ty _res = NULL;
10270 if (_PyPegen_is_memoized(p, primary_type, &_res)) {
10271 D(p->level--);
10272 return _res;
10273 }
10274 int _mark = p->mark;
10275 int _resmark = p->mark;
10276 while (1) {
10277 int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res);
10278 if (tmpvar_7) {
10279 D(p->level--);
10280 return _res;
10281 }
10282 p->mark = _mark;
10283 void *_raw = primary_raw(p);
10284 if (_raw == NULL || p->mark <= _resmark)
10285 break;
10286 _resmark = p->mark;
10287 _res = _raw;
10288 }
10289 p->mark = _resmark;
10290 D(p->level--);
10291 return _res;
10292}
10293static expr_ty
10294primary_raw(Parser *p)
10295{
10296 D(p->level++);
10297 if (p->error_indicator) {
10298 D(p->level--);
10299 return NULL;
10300 }
10301 expr_ty _res = NULL;
10302 int _mark = p->mark;
10303 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10304 p->error_indicator = 1;
10305 D(p->level--);
10306 return NULL;
10307 }
10308 int _start_lineno = p->tokens[_mark]->lineno;
10309 UNUSED(_start_lineno); // Only used by EXTRA macro
10310 int _start_col_offset = p->tokens[_mark]->col_offset;
10311 UNUSED(_start_col_offset); // Only used by EXTRA macro
10312 { // primary '.' NAME
10313 if (p->error_indicator) {
10314 D(p->level--);
10315 return NULL;
10316 }
10317 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10318 Token * _literal;
10319 expr_ty a;
10320 expr_ty b;
10321 if (
10322 (a = primary_rule(p)) // primary
10323 &&
10324 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
10325 &&
10326 (b = _PyPegen_name_token(p)) // NAME
10327 )
10328 {
10329 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10330 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10331 if (_token == NULL) {
10332 D(p->level--);
10333 return NULL;
10334 }
10335 int _end_lineno = _token->end_lineno;
10336 UNUSED(_end_lineno); // Only used by EXTRA macro
10337 int _end_col_offset = _token->end_col_offset;
10338 UNUSED(_end_col_offset); // Only used by EXTRA macro
10339 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
10340 if (_res == NULL && PyErr_Occurred()) {
10341 p->error_indicator = 1;
10342 D(p->level--);
10343 return NULL;
10344 }
10345 goto done;
10346 }
10347 p->mark = _mark;
10348 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10349 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
10350 }
10351 { // primary genexp
10352 if (p->error_indicator) {
10353 D(p->level--);
10354 return NULL;
10355 }
10356 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10357 expr_ty a;
10358 expr_ty b;
10359 if (
10360 (a = primary_rule(p)) // primary
10361 &&
10362 (b = genexp_rule(p)) // genexp
10363 )
10364 {
10365 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10366 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10367 if (_token == NULL) {
10368 D(p->level--);
10369 return NULL;
10370 }
10371 int _end_lineno = _token->end_lineno;
10372 UNUSED(_end_lineno); // Only used by EXTRA macro
10373 int _end_col_offset = _token->end_col_offset;
10374 UNUSED(_end_col_offset); // Only used by EXTRA macro
10375 _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
10376 if (_res == NULL && PyErr_Occurred()) {
10377 p->error_indicator = 1;
10378 D(p->level--);
10379 return NULL;
10380 }
10381 goto done;
10382 }
10383 p->mark = _mark;
10384 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10385 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
10386 }
10387 { // primary '(' arguments? ')'
10388 if (p->error_indicator) {
10389 D(p->level--);
10390 return NULL;
10391 }
10392 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10393 Token * _literal;
10394 Token * _literal_1;
10395 expr_ty a;
10396 void *b;
10397 if (
10398 (a = primary_rule(p)) // primary
10399 &&
10400 (_literal = _PyPegen_expect_token(p, 7)) // token='('
10401 &&
10402 (b = arguments_rule(p), 1) // arguments?
10403 &&
10404 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
10405 )
10406 {
10407 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10408 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10409 if (_token == NULL) {
10410 D(p->level--);
10411 return NULL;
10412 }
10413 int _end_lineno = _token->end_lineno;
10414 UNUSED(_end_lineno); // Only used by EXTRA macro
10415 int _end_col_offset = _token->end_col_offset;
10416 UNUSED(_end_col_offset); // Only used by EXTRA macro
10417 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
10418 if (_res == NULL && PyErr_Occurred()) {
10419 p->error_indicator = 1;
10420 D(p->level--);
10421 return NULL;
10422 }
10423 goto done;
10424 }
10425 p->mark = _mark;
10426 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10427 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
10428 }
10429 { // primary '[' slices ']'
10430 if (p->error_indicator) {
10431 D(p->level--);
10432 return NULL;
10433 }
10434 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10435 Token * _literal;
10436 Token * _literal_1;
10437 expr_ty a;
10438 expr_ty b;
10439 if (
10440 (a = primary_rule(p)) // primary
10441 &&
10442 (_literal = _PyPegen_expect_token(p, 9)) // token='['
10443 &&
10444 (b = slices_rule(p)) // slices
10445 &&
10446 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
10447 )
10448 {
10449 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10450 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10451 if (_token == NULL) {
10452 D(p->level--);
10453 return NULL;
10454 }
10455 int _end_lineno = _token->end_lineno;
10456 UNUSED(_end_lineno); // Only used by EXTRA macro
10457 int _end_col_offset = _token->end_col_offset;
10458 UNUSED(_end_col_offset); // Only used by EXTRA macro
10459 _res = _Py_Subscript ( a , b , Load , EXTRA );
10460 if (_res == NULL && PyErr_Occurred()) {
10461 p->error_indicator = 1;
10462 D(p->level--);
10463 return NULL;
10464 }
10465 goto done;
10466 }
10467 p->mark = _mark;
10468 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10469 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
10470 }
10471 { // atom
10472 if (p->error_indicator) {
10473 D(p->level--);
10474 return NULL;
10475 }
10476 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
10477 expr_ty atom_var;
10478 if (
10479 (atom_var = atom_rule(p)) // atom
10480 )
10481 {
10482 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
10483 _res = atom_var;
10484 goto done;
10485 }
10486 p->mark = _mark;
10487 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10488 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
10489 }
10490 _res = NULL;
10491 done:
10492 D(p->level--);
10493 return _res;
10494}
10495
10496// slices: slice !',' | ','.slice+ ','?
10497static expr_ty
10498slices_rule(Parser *p)
10499{
10500 D(p->level++);
10501 if (p->error_indicator) {
10502 D(p->level--);
10503 return NULL;
10504 }
10505 expr_ty _res = NULL;
10506 int _mark = p->mark;
10507 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10508 p->error_indicator = 1;
10509 D(p->level--);
10510 return NULL;
10511 }
10512 int _start_lineno = p->tokens[_mark]->lineno;
10513 UNUSED(_start_lineno); // Only used by EXTRA macro
10514 int _start_col_offset = p->tokens[_mark]->col_offset;
10515 UNUSED(_start_col_offset); // Only used by EXTRA macro
10516 { // slice !','
10517 if (p->error_indicator) {
10518 D(p->level--);
10519 return NULL;
10520 }
10521 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
10522 expr_ty a;
10523 if (
10524 (a = slice_rule(p)) // slice
10525 &&
10526 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
10527 )
10528 {
10529 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
10530 _res = a;
10531 if (_res == NULL && PyErr_Occurred()) {
10532 p->error_indicator = 1;
10533 D(p->level--);
10534 return NULL;
10535 }
10536 goto done;
10537 }
10538 p->mark = _mark;
10539 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10540 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
10541 }
10542 { // ','.slice+ ','?
10543 if (p->error_indicator) {
10544 D(p->level--);
10545 return NULL;
10546 }
10547 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10548 void *_opt_var;
10549 UNUSED(_opt_var); // Silence compiler warnings
10550 asdl_seq * a;
10551 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010552 (a = _gather_94_rule(p)) // ','.slice+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010553 &&
10554 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
10555 )
10556 {
10557 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10558 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10559 if (_token == NULL) {
10560 D(p->level--);
10561 return NULL;
10562 }
10563 int _end_lineno = _token->end_lineno;
10564 UNUSED(_end_lineno); // Only used by EXTRA macro
10565 int _end_col_offset = _token->end_col_offset;
10566 UNUSED(_end_col_offset); // Only used by EXTRA macro
10567 _res = _Py_Tuple ( a , Load , EXTRA );
10568 if (_res == NULL && PyErr_Occurred()) {
10569 p->error_indicator = 1;
10570 D(p->level--);
10571 return NULL;
10572 }
10573 goto done;
10574 }
10575 p->mark = _mark;
10576 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10577 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?"));
10578 }
10579 _res = NULL;
10580 done:
10581 D(p->level--);
10582 return _res;
10583}
10584
10585// slice: expression? ':' expression? [':' expression?] | expression
10586static expr_ty
10587slice_rule(Parser *p)
10588{
10589 D(p->level++);
10590 if (p->error_indicator) {
10591 D(p->level--);
10592 return NULL;
10593 }
10594 expr_ty _res = NULL;
10595 int _mark = p->mark;
10596 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10597 p->error_indicator = 1;
10598 D(p->level--);
10599 return NULL;
10600 }
10601 int _start_lineno = p->tokens[_mark]->lineno;
10602 UNUSED(_start_lineno); // Only used by EXTRA macro
10603 int _start_col_offset = p->tokens[_mark]->col_offset;
10604 UNUSED(_start_col_offset); // Only used by EXTRA macro
10605 { // expression? ':' expression? [':' expression?]
10606 if (p->error_indicator) {
10607 D(p->level--);
10608 return NULL;
10609 }
10610 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10611 Token * _literal;
10612 void *a;
10613 void *b;
10614 void *c;
10615 if (
10616 (a = expression_rule(p), 1) // expression?
10617 &&
10618 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
10619 &&
10620 (b = expression_rule(p), 1) // expression?
10621 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010622 (c = _tmp_96_rule(p), 1) // [':' expression?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010623 )
10624 {
10625 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10626 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10627 if (_token == NULL) {
10628 D(p->level--);
10629 return NULL;
10630 }
10631 int _end_lineno = _token->end_lineno;
10632 UNUSED(_end_lineno); // Only used by EXTRA macro
10633 int _end_col_offset = _token->end_col_offset;
10634 UNUSED(_end_col_offset); // Only used by EXTRA macro
10635 _res = _Py_Slice ( a , b , c , EXTRA );
10636 if (_res == NULL && PyErr_Occurred()) {
10637 p->error_indicator = 1;
10638 D(p->level--);
10639 return NULL;
10640 }
10641 goto done;
10642 }
10643 p->mark = _mark;
10644 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10645 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10646 }
10647 { // expression
10648 if (p->error_indicator) {
10649 D(p->level--);
10650 return NULL;
10651 }
10652 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
10653 expr_ty a;
10654 if (
10655 (a = expression_rule(p)) // expression
10656 )
10657 {
10658 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
10659 _res = a;
10660 if (_res == NULL && PyErr_Occurred()) {
10661 p->error_indicator = 1;
10662 D(p->level--);
10663 return NULL;
10664 }
10665 goto done;
10666 }
10667 p->mark = _mark;
10668 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10669 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
10670 }
10671 _res = NULL;
10672 done:
10673 D(p->level--);
10674 return _res;
10675}
10676
10677// atom:
10678// | NAME
10679// | 'True'
10680// | 'False'
10681// | 'None'
10682// | &STRING strings
10683// | NUMBER
10684// | &'(' (tuple | group | genexp)
10685// | &'[' (list | listcomp)
10686// | &'{' (dict | set | dictcomp | setcomp)
10687// | '...'
10688static expr_ty
10689atom_rule(Parser *p)
10690{
10691 D(p->level++);
10692 if (p->error_indicator) {
10693 D(p->level--);
10694 return NULL;
10695 }
10696 expr_ty _res = NULL;
10697 int _mark = p->mark;
10698 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10699 p->error_indicator = 1;
10700 D(p->level--);
10701 return NULL;
10702 }
10703 int _start_lineno = p->tokens[_mark]->lineno;
10704 UNUSED(_start_lineno); // Only used by EXTRA macro
10705 int _start_col_offset = p->tokens[_mark]->col_offset;
10706 UNUSED(_start_col_offset); // Only used by EXTRA macro
10707 { // NAME
10708 if (p->error_indicator) {
10709 D(p->level--);
10710 return NULL;
10711 }
10712 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
10713 expr_ty name_var;
10714 if (
10715 (name_var = _PyPegen_name_token(p)) // NAME
10716 )
10717 {
10718 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
10719 _res = name_var;
10720 goto done;
10721 }
10722 p->mark = _mark;
10723 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10724 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
10725 }
10726 { // 'True'
10727 if (p->error_indicator) {
10728 D(p->level--);
10729 return NULL;
10730 }
10731 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
10732 Token * _keyword;
10733 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010734 (_keyword = _PyPegen_expect_token(p, 528)) // token='True'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010735 )
10736 {
10737 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
10738 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10739 if (_token == NULL) {
10740 D(p->level--);
10741 return NULL;
10742 }
10743 int _end_lineno = _token->end_lineno;
10744 UNUSED(_end_lineno); // Only used by EXTRA macro
10745 int _end_col_offset = _token->end_col_offset;
10746 UNUSED(_end_col_offset); // Only used by EXTRA macro
10747 _res = _Py_Constant ( Py_True , NULL , EXTRA );
10748 if (_res == NULL && PyErr_Occurred()) {
10749 p->error_indicator = 1;
10750 D(p->level--);
10751 return NULL;
10752 }
10753 goto done;
10754 }
10755 p->mark = _mark;
10756 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10757 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
10758 }
10759 { // 'False'
10760 if (p->error_indicator) {
10761 D(p->level--);
10762 return NULL;
10763 }
10764 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
10765 Token * _keyword;
10766 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010767 (_keyword = _PyPegen_expect_token(p, 529)) // token='False'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010768 )
10769 {
10770 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
10771 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10772 if (_token == NULL) {
10773 D(p->level--);
10774 return NULL;
10775 }
10776 int _end_lineno = _token->end_lineno;
10777 UNUSED(_end_lineno); // Only used by EXTRA macro
10778 int _end_col_offset = _token->end_col_offset;
10779 UNUSED(_end_col_offset); // Only used by EXTRA macro
10780 _res = _Py_Constant ( Py_False , NULL , EXTRA );
10781 if (_res == NULL && PyErr_Occurred()) {
10782 p->error_indicator = 1;
10783 D(p->level--);
10784 return NULL;
10785 }
10786 goto done;
10787 }
10788 p->mark = _mark;
10789 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10790 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
10791 }
10792 { // 'None'
10793 if (p->error_indicator) {
10794 D(p->level--);
10795 return NULL;
10796 }
10797 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
10798 Token * _keyword;
10799 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010800 (_keyword = _PyPegen_expect_token(p, 530)) // token='None'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010801 )
10802 {
10803 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
10804 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10805 if (_token == NULL) {
10806 D(p->level--);
10807 return NULL;
10808 }
10809 int _end_lineno = _token->end_lineno;
10810 UNUSED(_end_lineno); // Only used by EXTRA macro
10811 int _end_col_offset = _token->end_col_offset;
10812 UNUSED(_end_col_offset); // Only used by EXTRA macro
10813 _res = _Py_Constant ( Py_None , NULL , EXTRA );
10814 if (_res == NULL && PyErr_Occurred()) {
10815 p->error_indicator = 1;
10816 D(p->level--);
10817 return NULL;
10818 }
10819 goto done;
10820 }
10821 p->mark = _mark;
10822 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10823 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
10824 }
10825 { // &STRING strings
10826 if (p->error_indicator) {
10827 D(p->level--);
10828 return NULL;
10829 }
10830 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10831 expr_ty strings_var;
10832 if (
10833 _PyPegen_lookahead(1, _PyPegen_string_token, p)
10834 &&
10835 (strings_var = strings_rule(p)) // strings
10836 )
10837 {
10838 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10839 _res = strings_var;
10840 goto done;
10841 }
10842 p->mark = _mark;
10843 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10844 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings"));
10845 }
10846 { // NUMBER
10847 if (p->error_indicator) {
10848 D(p->level--);
10849 return NULL;
10850 }
10851 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10852 expr_ty number_var;
10853 if (
10854 (number_var = _PyPegen_number_token(p)) // NUMBER
10855 )
10856 {
10857 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10858 _res = number_var;
10859 goto done;
10860 }
10861 p->mark = _mark;
10862 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10863 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
10864 }
10865 { // &'(' (tuple | group | genexp)
10866 if (p->error_indicator) {
10867 D(p->level--);
10868 return NULL;
10869 }
10870 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010871 void *_tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010872 if (
10873 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='('
10874 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010875 (_tmp_97_var = _tmp_97_rule(p)) // tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010876 )
10877 {
10878 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 +030010879 _res = _tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010880 goto done;
10881 }
10882 p->mark = _mark;
10883 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10884 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
10885 }
10886 { // &'[' (list | listcomp)
10887 if (p->error_indicator) {
10888 D(p->level--);
10889 return NULL;
10890 }
10891 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010892 void *_tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010893 if (
10894 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='['
10895 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010896 (_tmp_98_var = _tmp_98_rule(p)) // list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010897 )
10898 {
10899 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010900 _res = _tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010901 goto done;
10902 }
10903 p->mark = _mark;
10904 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10905 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
10906 }
10907 { // &'{' (dict | set | dictcomp | setcomp)
10908 if (p->error_indicator) {
10909 D(p->level--);
10910 return NULL;
10911 }
10912 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 +030010913 void *_tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010914 if (
10915 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{'
10916 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010917 (_tmp_99_var = _tmp_99_rule(p)) // dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010918 )
10919 {
10920 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 +030010921 _res = _tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010922 goto done;
10923 }
10924 p->mark = _mark;
10925 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10926 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
10927 }
10928 { // '...'
10929 if (p->error_indicator) {
10930 D(p->level--);
10931 return NULL;
10932 }
10933 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
10934 Token * _literal;
10935 if (
10936 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
10937 )
10938 {
10939 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
10940 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10941 if (_token == NULL) {
10942 D(p->level--);
10943 return NULL;
10944 }
10945 int _end_lineno = _token->end_lineno;
10946 UNUSED(_end_lineno); // Only used by EXTRA macro
10947 int _end_col_offset = _token->end_col_offset;
10948 UNUSED(_end_col_offset); // Only used by EXTRA macro
10949 _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
10950 if (_res == NULL && PyErr_Occurred()) {
10951 p->error_indicator = 1;
10952 D(p->level--);
10953 return NULL;
10954 }
10955 goto done;
10956 }
10957 p->mark = _mark;
10958 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10959 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
10960 }
10961 _res = NULL;
10962 done:
10963 D(p->level--);
10964 return _res;
10965}
10966
10967// strings: STRING+
10968static expr_ty
10969strings_rule(Parser *p)
10970{
10971 D(p->level++);
10972 if (p->error_indicator) {
10973 D(p->level--);
10974 return NULL;
10975 }
10976 expr_ty _res = NULL;
10977 if (_PyPegen_is_memoized(p, strings_type, &_res)) {
10978 D(p->level--);
10979 return _res;
10980 }
10981 int _mark = p->mark;
10982 { // STRING+
10983 if (p->error_indicator) {
10984 D(p->level--);
10985 return NULL;
10986 }
10987 D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
10988 asdl_seq * a;
10989 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010990 (a = _loop1_100_rule(p)) // STRING+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010991 )
10992 {
10993 D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
10994 _res = _PyPegen_concatenate_strings ( p , a );
10995 if (_res == NULL && PyErr_Occurred()) {
10996 p->error_indicator = 1;
10997 D(p->level--);
10998 return NULL;
10999 }
11000 goto done;
11001 }
11002 p->mark = _mark;
11003 D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
11004 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
11005 }
11006 _res = NULL;
11007 done:
11008 _PyPegen_insert_memo(p, _mark, strings_type, _res);
11009 D(p->level--);
11010 return _res;
11011}
11012
11013// list: '[' star_named_expressions? ']'
11014static expr_ty
11015list_rule(Parser *p)
11016{
11017 D(p->level++);
11018 if (p->error_indicator) {
11019 D(p->level--);
11020 return NULL;
11021 }
11022 expr_ty _res = NULL;
11023 int _mark = p->mark;
11024 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11025 p->error_indicator = 1;
11026 D(p->level--);
11027 return NULL;
11028 }
11029 int _start_lineno = p->tokens[_mark]->lineno;
11030 UNUSED(_start_lineno); // Only used by EXTRA macro
11031 int _start_col_offset = p->tokens[_mark]->col_offset;
11032 UNUSED(_start_col_offset); // Only used by EXTRA macro
11033 { // '[' star_named_expressions? ']'
11034 if (p->error_indicator) {
11035 D(p->level--);
11036 return NULL;
11037 }
11038 D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11039 Token * _literal;
11040 Token * _literal_1;
11041 void *a;
11042 if (
11043 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11044 &&
11045 (a = star_named_expressions_rule(p), 1) // star_named_expressions?
11046 &&
11047 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11048 )
11049 {
11050 D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11051 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11052 if (_token == NULL) {
11053 D(p->level--);
11054 return NULL;
11055 }
11056 int _end_lineno = _token->end_lineno;
11057 UNUSED(_end_lineno); // Only used by EXTRA macro
11058 int _end_col_offset = _token->end_col_offset;
11059 UNUSED(_end_col_offset); // Only used by EXTRA macro
11060 _res = _Py_List ( a , Load , EXTRA );
11061 if (_res == NULL && PyErr_Occurred()) {
11062 p->error_indicator = 1;
11063 D(p->level--);
11064 return NULL;
11065 }
11066 goto done;
11067 }
11068 p->mark = _mark;
11069 D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
11070 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
11071 }
11072 _res = NULL;
11073 done:
11074 D(p->level--);
11075 return _res;
11076}
11077
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011078// listcomp: '[' named_expression ~ for_if_clauses ']' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011079static expr_ty
11080listcomp_rule(Parser *p)
11081{
11082 D(p->level++);
11083 if (p->error_indicator) {
11084 D(p->level--);
11085 return NULL;
11086 }
11087 expr_ty _res = NULL;
11088 int _mark = p->mark;
11089 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11090 p->error_indicator = 1;
11091 D(p->level--);
11092 return NULL;
11093 }
11094 int _start_lineno = p->tokens[_mark]->lineno;
11095 UNUSED(_start_lineno); // Only used by EXTRA macro
11096 int _start_col_offset = p->tokens[_mark]->col_offset;
11097 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011098 { // '[' named_expression ~ for_if_clauses ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011099 if (p->error_indicator) {
11100 D(p->level--);
11101 return NULL;
11102 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011103 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11104 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011105 Token * _literal;
11106 Token * _literal_1;
11107 expr_ty a;
11108 asdl_seq* b;
11109 if (
11110 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11111 &&
11112 (a = named_expression_rule(p)) // named_expression
11113 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011114 (_cut_var = 1)
11115 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011116 (b = for_if_clauses_rule(p)) // for_if_clauses
11117 &&
11118 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11119 )
11120 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011121 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 +010011122 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11123 if (_token == NULL) {
11124 D(p->level--);
11125 return NULL;
11126 }
11127 int _end_lineno = _token->end_lineno;
11128 UNUSED(_end_lineno); // Only used by EXTRA macro
11129 int _end_col_offset = _token->end_col_offset;
11130 UNUSED(_end_col_offset); // Only used by EXTRA macro
11131 _res = _Py_ListComp ( a , b , EXTRA );
11132 if (_res == NULL && PyErr_Occurred()) {
11133 p->error_indicator = 1;
11134 D(p->level--);
11135 return NULL;
11136 }
11137 goto done;
11138 }
11139 p->mark = _mark;
11140 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011141 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11142 if (_cut_var) {
11143 D(p->level--);
11144 return NULL;
11145 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011146 }
11147 { // invalid_comprehension
11148 if (p->error_indicator) {
11149 D(p->level--);
11150 return NULL;
11151 }
11152 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11153 void *invalid_comprehension_var;
11154 if (
11155 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11156 )
11157 {
11158 D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11159 _res = invalid_comprehension_var;
11160 goto done;
11161 }
11162 p->mark = _mark;
11163 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
11164 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11165 }
11166 _res = NULL;
11167 done:
11168 D(p->level--);
11169 return _res;
11170}
11171
11172// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
11173static expr_ty
11174tuple_rule(Parser *p)
11175{
11176 D(p->level++);
11177 if (p->error_indicator) {
11178 D(p->level--);
11179 return NULL;
11180 }
11181 expr_ty _res = NULL;
11182 int _mark = p->mark;
11183 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11184 p->error_indicator = 1;
11185 D(p->level--);
11186 return NULL;
11187 }
11188 int _start_lineno = p->tokens[_mark]->lineno;
11189 UNUSED(_start_lineno); // Only used by EXTRA macro
11190 int _start_col_offset = p->tokens[_mark]->col_offset;
11191 UNUSED(_start_col_offset); // Only used by EXTRA macro
11192 { // '(' [star_named_expression ',' star_named_expressions?] ')'
11193 if (p->error_indicator) {
11194 D(p->level--);
11195 return NULL;
11196 }
11197 D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11198 Token * _literal;
11199 Token * _literal_1;
11200 void *a;
11201 if (
11202 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11203 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011204 (a = _tmp_101_rule(p), 1) // [star_named_expression ',' star_named_expressions?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011205 &&
11206 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11207 )
11208 {
11209 D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11210 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11211 if (_token == NULL) {
11212 D(p->level--);
11213 return NULL;
11214 }
11215 int _end_lineno = _token->end_lineno;
11216 UNUSED(_end_lineno); // Only used by EXTRA macro
11217 int _end_col_offset = _token->end_col_offset;
11218 UNUSED(_end_col_offset); // Only used by EXTRA macro
11219 _res = _Py_Tuple ( a , Load , EXTRA );
11220 if (_res == NULL && PyErr_Occurred()) {
11221 p->error_indicator = 1;
11222 D(p->level--);
11223 return NULL;
11224 }
11225 goto done;
11226 }
11227 p->mark = _mark;
11228 D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
11229 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11230 }
11231 _res = NULL;
11232 done:
11233 D(p->level--);
11234 return _res;
11235}
11236
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011237// group: '(' (yield_expr | named_expression) ')' | invalid_group
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011238static expr_ty
11239group_rule(Parser *p)
11240{
11241 D(p->level++);
11242 if (p->error_indicator) {
11243 D(p->level--);
11244 return NULL;
11245 }
11246 expr_ty _res = NULL;
11247 int _mark = p->mark;
11248 { // '(' (yield_expr | named_expression) ')'
11249 if (p->error_indicator) {
11250 D(p->level--);
11251 return NULL;
11252 }
11253 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11254 Token * _literal;
11255 Token * _literal_1;
11256 void *a;
11257 if (
11258 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11259 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011260 (a = _tmp_102_rule(p)) // yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011261 &&
11262 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11263 )
11264 {
11265 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11266 _res = a;
11267 if (_res == NULL && PyErr_Occurred()) {
11268 p->error_indicator = 1;
11269 D(p->level--);
11270 return NULL;
11271 }
11272 goto done;
11273 }
11274 p->mark = _mark;
11275 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11276 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11277 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011278 { // invalid_group
11279 if (p->error_indicator) {
11280 D(p->level--);
11281 return NULL;
11282 }
11283 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11284 void *invalid_group_var;
11285 if (
11286 (invalid_group_var = invalid_group_rule(p)) // invalid_group
11287 )
11288 {
11289 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11290 _res = invalid_group_var;
11291 goto done;
11292 }
11293 p->mark = _mark;
11294 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11295 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
11296 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011297 _res = NULL;
11298 done:
11299 D(p->level--);
11300 return _res;
11301}
11302
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011303// genexp: '(' expression ~ for_if_clauses ')' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011304static expr_ty
11305genexp_rule(Parser *p)
11306{
11307 D(p->level++);
11308 if (p->error_indicator) {
11309 D(p->level--);
11310 return NULL;
11311 }
11312 expr_ty _res = NULL;
11313 int _mark = p->mark;
11314 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11315 p->error_indicator = 1;
11316 D(p->level--);
11317 return NULL;
11318 }
11319 int _start_lineno = p->tokens[_mark]->lineno;
11320 UNUSED(_start_lineno); // Only used by EXTRA macro
11321 int _start_col_offset = p->tokens[_mark]->col_offset;
11322 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011323 { // '(' expression ~ for_if_clauses ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011324 if (p->error_indicator) {
11325 D(p->level--);
11326 return NULL;
11327 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011328 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11329 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011330 Token * _literal;
11331 Token * _literal_1;
11332 expr_ty a;
11333 asdl_seq* b;
11334 if (
11335 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11336 &&
11337 (a = expression_rule(p)) // expression
11338 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011339 (_cut_var = 1)
11340 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011341 (b = for_if_clauses_rule(p)) // for_if_clauses
11342 &&
11343 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11344 )
11345 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011346 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 +010011347 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11348 if (_token == NULL) {
11349 D(p->level--);
11350 return NULL;
11351 }
11352 int _end_lineno = _token->end_lineno;
11353 UNUSED(_end_lineno); // Only used by EXTRA macro
11354 int _end_col_offset = _token->end_col_offset;
11355 UNUSED(_end_col_offset); // Only used by EXTRA macro
11356 _res = _Py_GeneratorExp ( a , b , EXTRA );
11357 if (_res == NULL && PyErr_Occurred()) {
11358 p->error_indicator = 1;
11359 D(p->level--);
11360 return NULL;
11361 }
11362 goto done;
11363 }
11364 p->mark = _mark;
11365 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011366 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11367 if (_cut_var) {
11368 D(p->level--);
11369 return NULL;
11370 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011371 }
11372 { // invalid_comprehension
11373 if (p->error_indicator) {
11374 D(p->level--);
11375 return NULL;
11376 }
11377 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11378 void *invalid_comprehension_var;
11379 if (
11380 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11381 )
11382 {
11383 D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11384 _res = invalid_comprehension_var;
11385 goto done;
11386 }
11387 p->mark = _mark;
11388 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
11389 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11390 }
11391 _res = NULL;
11392 done:
11393 D(p->level--);
11394 return _res;
11395}
11396
11397// set: '{' expressions_list '}'
11398static expr_ty
11399set_rule(Parser *p)
11400{
11401 D(p->level++);
11402 if (p->error_indicator) {
11403 D(p->level--);
11404 return NULL;
11405 }
11406 expr_ty _res = NULL;
11407 int _mark = p->mark;
11408 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11409 p->error_indicator = 1;
11410 D(p->level--);
11411 return NULL;
11412 }
11413 int _start_lineno = p->tokens[_mark]->lineno;
11414 UNUSED(_start_lineno); // Only used by EXTRA macro
11415 int _start_col_offset = p->tokens[_mark]->col_offset;
11416 UNUSED(_start_col_offset); // Only used by EXTRA macro
11417 { // '{' expressions_list '}'
11418 if (p->error_indicator) {
11419 D(p->level--);
11420 return NULL;
11421 }
11422 D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11423 Token * _literal;
11424 Token * _literal_1;
11425 asdl_seq* a;
11426 if (
11427 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11428 &&
11429 (a = expressions_list_rule(p)) // expressions_list
11430 &&
11431 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11432 )
11433 {
11434 D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11435 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11436 if (_token == NULL) {
11437 D(p->level--);
11438 return NULL;
11439 }
11440 int _end_lineno = _token->end_lineno;
11441 UNUSED(_end_lineno); // Only used by EXTRA macro
11442 int _end_col_offset = _token->end_col_offset;
11443 UNUSED(_end_col_offset); // Only used by EXTRA macro
11444 _res = _Py_Set ( a , EXTRA );
11445 if (_res == NULL && PyErr_Occurred()) {
11446 p->error_indicator = 1;
11447 D(p->level--);
11448 return NULL;
11449 }
11450 goto done;
11451 }
11452 p->mark = _mark;
11453 D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
11454 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'"));
11455 }
11456 _res = NULL;
11457 done:
11458 D(p->level--);
11459 return _res;
11460}
11461
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011462// setcomp: '{' expression ~ for_if_clauses '}' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011463static expr_ty
11464setcomp_rule(Parser *p)
11465{
11466 D(p->level++);
11467 if (p->error_indicator) {
11468 D(p->level--);
11469 return NULL;
11470 }
11471 expr_ty _res = NULL;
11472 int _mark = p->mark;
11473 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11474 p->error_indicator = 1;
11475 D(p->level--);
11476 return NULL;
11477 }
11478 int _start_lineno = p->tokens[_mark]->lineno;
11479 UNUSED(_start_lineno); // Only used by EXTRA macro
11480 int _start_col_offset = p->tokens[_mark]->col_offset;
11481 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011482 { // '{' expression ~ for_if_clauses '}'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011483 if (p->error_indicator) {
11484 D(p->level--);
11485 return NULL;
11486 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011487 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11488 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011489 Token * _literal;
11490 Token * _literal_1;
11491 expr_ty a;
11492 asdl_seq* b;
11493 if (
11494 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11495 &&
11496 (a = expression_rule(p)) // expression
11497 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011498 (_cut_var = 1)
11499 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011500 (b = for_if_clauses_rule(p)) // for_if_clauses
11501 &&
11502 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11503 )
11504 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011505 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 +010011506 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11507 if (_token == NULL) {
11508 D(p->level--);
11509 return NULL;
11510 }
11511 int _end_lineno = _token->end_lineno;
11512 UNUSED(_end_lineno); // Only used by EXTRA macro
11513 int _end_col_offset = _token->end_col_offset;
11514 UNUSED(_end_col_offset); // Only used by EXTRA macro
11515 _res = _Py_SetComp ( a , b , EXTRA );
11516 if (_res == NULL && PyErr_Occurred()) {
11517 p->error_indicator = 1;
11518 D(p->level--);
11519 return NULL;
11520 }
11521 goto done;
11522 }
11523 p->mark = _mark;
11524 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011525 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11526 if (_cut_var) {
11527 D(p->level--);
11528 return NULL;
11529 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011530 }
11531 { // invalid_comprehension
11532 if (p->error_indicator) {
11533 D(p->level--);
11534 return NULL;
11535 }
11536 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11537 void *invalid_comprehension_var;
11538 if (
11539 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11540 )
11541 {
11542 D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11543 _res = invalid_comprehension_var;
11544 goto done;
11545 }
11546 p->mark = _mark;
11547 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
11548 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11549 }
11550 _res = NULL;
11551 done:
11552 D(p->level--);
11553 return _res;
11554}
11555
11556// dict: '{' double_starred_kvpairs? '}'
11557static expr_ty
11558dict_rule(Parser *p)
11559{
11560 D(p->level++);
11561 if (p->error_indicator) {
11562 D(p->level--);
11563 return NULL;
11564 }
11565 expr_ty _res = NULL;
11566 int _mark = p->mark;
11567 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11568 p->error_indicator = 1;
11569 D(p->level--);
11570 return NULL;
11571 }
11572 int _start_lineno = p->tokens[_mark]->lineno;
11573 UNUSED(_start_lineno); // Only used by EXTRA macro
11574 int _start_col_offset = p->tokens[_mark]->col_offset;
11575 UNUSED(_start_col_offset); // Only used by EXTRA macro
11576 { // '{' double_starred_kvpairs? '}'
11577 if (p->error_indicator) {
11578 D(p->level--);
11579 return NULL;
11580 }
11581 D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11582 Token * _literal;
11583 Token * _literal_1;
11584 void *a;
11585 if (
11586 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11587 &&
11588 (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs?
11589 &&
11590 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11591 )
11592 {
11593 D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11594 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11595 if (_token == NULL) {
11596 D(p->level--);
11597 return NULL;
11598 }
11599 int _end_lineno = _token->end_lineno;
11600 UNUSED(_end_lineno); // Only used by EXTRA macro
11601 int _end_col_offset = _token->end_col_offset;
11602 UNUSED(_end_col_offset); // Only used by EXTRA macro
11603 _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA );
11604 if (_res == NULL && PyErr_Occurred()) {
11605 p->error_indicator = 1;
11606 D(p->level--);
11607 return NULL;
11608 }
11609 goto done;
11610 }
11611 p->mark = _mark;
11612 D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
11613 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11614 }
11615 _res = NULL;
11616 done:
11617 D(p->level--);
11618 return _res;
11619}
11620
11621// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
11622static expr_ty
11623dictcomp_rule(Parser *p)
11624{
11625 D(p->level++);
11626 if (p->error_indicator) {
11627 D(p->level--);
11628 return NULL;
11629 }
11630 expr_ty _res = NULL;
11631 int _mark = p->mark;
11632 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11633 p->error_indicator = 1;
11634 D(p->level--);
11635 return NULL;
11636 }
11637 int _start_lineno = p->tokens[_mark]->lineno;
11638 UNUSED(_start_lineno); // Only used by EXTRA macro
11639 int _start_col_offset = p->tokens[_mark]->col_offset;
11640 UNUSED(_start_col_offset); // Only used by EXTRA macro
11641 { // '{' kvpair for_if_clauses '}'
11642 if (p->error_indicator) {
11643 D(p->level--);
11644 return NULL;
11645 }
11646 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11647 Token * _literal;
11648 Token * _literal_1;
11649 KeyValuePair* a;
11650 asdl_seq* b;
11651 if (
11652 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11653 &&
11654 (a = kvpair_rule(p)) // kvpair
11655 &&
11656 (b = for_if_clauses_rule(p)) // for_if_clauses
11657 &&
11658 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11659 )
11660 {
11661 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11662 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11663 if (_token == NULL) {
11664 D(p->level--);
11665 return NULL;
11666 }
11667 int _end_lineno = _token->end_lineno;
11668 UNUSED(_end_lineno); // Only used by EXTRA macro
11669 int _end_col_offset = _token->end_col_offset;
11670 UNUSED(_end_col_offset); // Only used by EXTRA macro
11671 _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
11672 if (_res == NULL && PyErr_Occurred()) {
11673 p->error_indicator = 1;
11674 D(p->level--);
11675 return NULL;
11676 }
11677 goto done;
11678 }
11679 p->mark = _mark;
11680 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11681 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11682 }
11683 { // invalid_dict_comprehension
11684 if (p->error_indicator) {
11685 D(p->level--);
11686 return NULL;
11687 }
11688 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11689 void *invalid_dict_comprehension_var;
11690 if (
11691 (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
11692 )
11693 {
11694 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11695 _res = invalid_dict_comprehension_var;
11696 goto done;
11697 }
11698 p->mark = _mark;
11699 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11700 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
11701 }
11702 _res = NULL;
11703 done:
11704 D(p->level--);
11705 return _res;
11706}
11707
11708// double_starred_kvpairs: ','.double_starred_kvpair+ ','?
11709static asdl_seq*
11710double_starred_kvpairs_rule(Parser *p)
11711{
11712 D(p->level++);
11713 if (p->error_indicator) {
11714 D(p->level--);
11715 return NULL;
11716 }
11717 asdl_seq* _res = NULL;
11718 int _mark = p->mark;
11719 { // ','.double_starred_kvpair+ ','?
11720 if (p->error_indicator) {
11721 D(p->level--);
11722 return NULL;
11723 }
11724 D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11725 void *_opt_var;
11726 UNUSED(_opt_var); // Silence compiler warnings
11727 asdl_seq * a;
11728 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011729 (a = _gather_103_rule(p)) // ','.double_starred_kvpair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011730 &&
11731 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
11732 )
11733 {
11734 D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11735 _res = a;
11736 if (_res == NULL && PyErr_Occurred()) {
11737 p->error_indicator = 1;
11738 D(p->level--);
11739 return NULL;
11740 }
11741 goto done;
11742 }
11743 p->mark = _mark;
11744 D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
11745 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11746 }
11747 _res = NULL;
11748 done:
11749 D(p->level--);
11750 return _res;
11751}
11752
11753// double_starred_kvpair: '**' bitwise_or | kvpair
11754static KeyValuePair*
11755double_starred_kvpair_rule(Parser *p)
11756{
11757 D(p->level++);
11758 if (p->error_indicator) {
11759 D(p->level--);
11760 return NULL;
11761 }
11762 KeyValuePair* _res = NULL;
11763 int _mark = p->mark;
11764 { // '**' bitwise_or
11765 if (p->error_indicator) {
11766 D(p->level--);
11767 return NULL;
11768 }
11769 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11770 Token * _literal;
11771 expr_ty a;
11772 if (
11773 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
11774 &&
11775 (a = bitwise_or_rule(p)) // bitwise_or
11776 )
11777 {
11778 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11779 _res = _PyPegen_key_value_pair ( p , NULL , a );
11780 if (_res == NULL && PyErr_Occurred()) {
11781 p->error_indicator = 1;
11782 D(p->level--);
11783 return NULL;
11784 }
11785 goto done;
11786 }
11787 p->mark = _mark;
11788 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11789 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
11790 }
11791 { // kvpair
11792 if (p->error_indicator) {
11793 D(p->level--);
11794 return NULL;
11795 }
11796 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
11797 KeyValuePair* kvpair_var;
11798 if (
11799 (kvpair_var = kvpair_rule(p)) // kvpair
11800 )
11801 {
11802 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
11803 _res = kvpair_var;
11804 goto done;
11805 }
11806 p->mark = _mark;
11807 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11808 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
11809 }
11810 _res = NULL;
11811 done:
11812 D(p->level--);
11813 return _res;
11814}
11815
11816// kvpair: expression ':' expression
11817static KeyValuePair*
11818kvpair_rule(Parser *p)
11819{
11820 D(p->level++);
11821 if (p->error_indicator) {
11822 D(p->level--);
11823 return NULL;
11824 }
11825 KeyValuePair* _res = NULL;
11826 int _mark = p->mark;
11827 { // expression ':' expression
11828 if (p->error_indicator) {
11829 D(p->level--);
11830 return NULL;
11831 }
11832 D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11833 Token * _literal;
11834 expr_ty a;
11835 expr_ty b;
11836 if (
11837 (a = expression_rule(p)) // expression
11838 &&
11839 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
11840 &&
11841 (b = expression_rule(p)) // expression
11842 )
11843 {
11844 D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11845 _res = _PyPegen_key_value_pair ( p , a , b );
11846 if (_res == NULL && PyErr_Occurred()) {
11847 p->error_indicator = 1;
11848 D(p->level--);
11849 return NULL;
11850 }
11851 goto done;
11852 }
11853 p->mark = _mark;
11854 D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11855 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
11856 }
11857 _res = NULL;
11858 done:
11859 D(p->level--);
11860 return _res;
11861}
11862
11863// for_if_clauses: for_if_clause+
11864static asdl_seq*
11865for_if_clauses_rule(Parser *p)
11866{
11867 D(p->level++);
11868 if (p->error_indicator) {
11869 D(p->level--);
11870 return NULL;
11871 }
11872 asdl_seq* _res = NULL;
11873 int _mark = p->mark;
11874 { // for_if_clause+
11875 if (p->error_indicator) {
11876 D(p->level--);
11877 return NULL;
11878 }
11879 D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011880 asdl_seq * _loop1_105_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011881 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011882 (_loop1_105_var = _loop1_105_rule(p)) // for_if_clause+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011883 )
11884 {
11885 D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011886 _res = _loop1_105_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011887 goto done;
11888 }
11889 p->mark = _mark;
11890 D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
11891 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
11892 }
11893 _res = NULL;
11894 done:
11895 D(p->level--);
11896 return _res;
11897}
11898
11899// for_if_clause:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011900// | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11901// | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11902// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011903static comprehension_ty
11904for_if_clause_rule(Parser *p)
11905{
11906 D(p->level++);
11907 if (p->error_indicator) {
11908 D(p->level--);
11909 return NULL;
11910 }
11911 comprehension_ty _res = NULL;
11912 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011913 { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011914 if (p->error_indicator) {
11915 D(p->level--);
11916 return NULL;
11917 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011918 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11919 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011920 Token * _keyword;
11921 Token * _keyword_1;
11922 expr_ty a;
11923 Token * async_var;
11924 expr_ty b;
11925 asdl_seq * c;
11926 if (
11927 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
11928 &&
11929 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11930 &&
11931 (a = star_targets_rule(p)) // star_targets
11932 &&
11933 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11934 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011935 (_cut_var = 1)
11936 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011937 (b = disjunction_rule(p)) // disjunction
11938 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011939 (c = _loop0_106_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011940 )
11941 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011942 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011943 _res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) );
11944 if (_res == NULL && PyErr_Occurred()) {
11945 p->error_indicator = 1;
11946 D(p->level--);
11947 return NULL;
11948 }
11949 goto done;
11950 }
11951 p->mark = _mark;
11952 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011953 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11954 if (_cut_var) {
11955 D(p->level--);
11956 return NULL;
11957 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011958 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011959 { // '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, "'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 expr_ty b;
11970 asdl_seq * c;
11971 if (
11972 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11973 &&
11974 (a = star_targets_rule(p)) // star_targets
11975 &&
11976 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11977 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011978 (_cut_var = 1)
11979 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011980 (b = disjunction_rule(p)) // disjunction
11981 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011982 (c = _loop0_107_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011983 )
11984 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011985 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 +010011986 _res = _Py_comprehension ( a , b , c , 0 , p -> arena );
11987 if (_res == NULL && PyErr_Occurred()) {
11988 p->error_indicator = 1;
11989 D(p->level--);
11990 return NULL;
11991 }
11992 goto done;
11993 }
11994 p->mark = _mark;
11995 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011996 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11997 if (_cut_var) {
11998 D(p->level--);
11999 return NULL;
12000 }
12001 }
12002 { // invalid_for_target
12003 if (p->error_indicator) {
12004 D(p->level--);
12005 return NULL;
12006 }
12007 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12008 void *invalid_for_target_var;
12009 if (
12010 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
12011 )
12012 {
12013 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12014 _res = invalid_for_target_var;
12015 goto done;
12016 }
12017 p->mark = _mark;
12018 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
12019 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012020 }
12021 _res = NULL;
12022 done:
12023 D(p->level--);
12024 return _res;
12025}
12026
12027// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
12028static expr_ty
12029yield_expr_rule(Parser *p)
12030{
12031 D(p->level++);
12032 if (p->error_indicator) {
12033 D(p->level--);
12034 return NULL;
12035 }
12036 expr_ty _res = NULL;
12037 int _mark = p->mark;
12038 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12039 p->error_indicator = 1;
12040 D(p->level--);
12041 return NULL;
12042 }
12043 int _start_lineno = p->tokens[_mark]->lineno;
12044 UNUSED(_start_lineno); // Only used by EXTRA macro
12045 int _start_col_offset = p->tokens[_mark]->col_offset;
12046 UNUSED(_start_col_offset); // Only used by EXTRA macro
12047 { // 'yield' 'from' expression
12048 if (p->error_indicator) {
12049 D(p->level--);
12050 return NULL;
12051 }
12052 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12053 Token * _keyword;
12054 Token * _keyword_1;
12055 expr_ty a;
12056 if (
12057 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12058 &&
12059 (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from'
12060 &&
12061 (a = expression_rule(p)) // expression
12062 )
12063 {
12064 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12065 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12066 if (_token == NULL) {
12067 D(p->level--);
12068 return NULL;
12069 }
12070 int _end_lineno = _token->end_lineno;
12071 UNUSED(_end_lineno); // Only used by EXTRA macro
12072 int _end_col_offset = _token->end_col_offset;
12073 UNUSED(_end_col_offset); // Only used by EXTRA macro
12074 _res = _Py_YieldFrom ( a , EXTRA );
12075 if (_res == NULL && PyErr_Occurred()) {
12076 p->error_indicator = 1;
12077 D(p->level--);
12078 return NULL;
12079 }
12080 goto done;
12081 }
12082 p->mark = _mark;
12083 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12084 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
12085 }
12086 { // 'yield' star_expressions?
12087 if (p->error_indicator) {
12088 D(p->level--);
12089 return NULL;
12090 }
12091 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12092 Token * _keyword;
12093 void *a;
12094 if (
12095 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12096 &&
12097 (a = star_expressions_rule(p), 1) // star_expressions?
12098 )
12099 {
12100 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12101 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12102 if (_token == NULL) {
12103 D(p->level--);
12104 return NULL;
12105 }
12106 int _end_lineno = _token->end_lineno;
12107 UNUSED(_end_lineno); // Only used by EXTRA macro
12108 int _end_col_offset = _token->end_col_offset;
12109 UNUSED(_end_col_offset); // Only used by EXTRA macro
12110 _res = _Py_Yield ( a , EXTRA );
12111 if (_res == NULL && PyErr_Occurred()) {
12112 p->error_indicator = 1;
12113 D(p->level--);
12114 return NULL;
12115 }
12116 goto done;
12117 }
12118 p->mark = _mark;
12119 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12120 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
12121 }
12122 _res = NULL;
12123 done:
12124 D(p->level--);
12125 return _res;
12126}
12127
12128// arguments: args ','? &')' | incorrect_arguments
12129static expr_ty
12130arguments_rule(Parser *p)
12131{
12132 D(p->level++);
12133 if (p->error_indicator) {
12134 D(p->level--);
12135 return NULL;
12136 }
12137 expr_ty _res = NULL;
12138 if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
12139 D(p->level--);
12140 return _res;
12141 }
12142 int _mark = p->mark;
12143 { // args ','? &')'
12144 if (p->error_indicator) {
12145 D(p->level--);
12146 return NULL;
12147 }
12148 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12149 void *_opt_var;
12150 UNUSED(_opt_var); // Silence compiler warnings
12151 expr_ty a;
12152 if (
12153 (a = args_rule(p)) // args
12154 &&
12155 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12156 &&
12157 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
12158 )
12159 {
12160 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12161 _res = a;
12162 if (_res == NULL && PyErr_Occurred()) {
12163 p->error_indicator = 1;
12164 D(p->level--);
12165 return NULL;
12166 }
12167 goto done;
12168 }
12169 p->mark = _mark;
12170 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12171 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
12172 }
12173 { // incorrect_arguments
12174 if (p->error_indicator) {
12175 D(p->level--);
12176 return NULL;
12177 }
12178 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "incorrect_arguments"));
12179 void *incorrect_arguments_var;
12180 if (
12181 (incorrect_arguments_var = incorrect_arguments_rule(p)) // incorrect_arguments
12182 )
12183 {
12184 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "incorrect_arguments"));
12185 _res = incorrect_arguments_var;
12186 goto done;
12187 }
12188 p->mark = _mark;
12189 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12190 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "incorrect_arguments"));
12191 }
12192 _res = NULL;
12193 done:
12194 _PyPegen_insert_memo(p, _mark, arguments_type, _res);
12195 D(p->level--);
12196 return _res;
12197}
12198
12199// args: starred_expression [',' args] | kwargs | named_expression [',' args]
12200static expr_ty
12201args_rule(Parser *p)
12202{
12203 D(p->level++);
12204 if (p->error_indicator) {
12205 D(p->level--);
12206 return NULL;
12207 }
12208 expr_ty _res = NULL;
12209 int _mark = p->mark;
12210 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12211 p->error_indicator = 1;
12212 D(p->level--);
12213 return NULL;
12214 }
12215 int _start_lineno = p->tokens[_mark]->lineno;
12216 UNUSED(_start_lineno); // Only used by EXTRA macro
12217 int _start_col_offset = p->tokens[_mark]->col_offset;
12218 UNUSED(_start_col_offset); // Only used by EXTRA macro
12219 { // starred_expression [',' args]
12220 if (p->error_indicator) {
12221 D(p->level--);
12222 return NULL;
12223 }
12224 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]"));
12225 expr_ty a;
12226 void *b;
12227 if (
12228 (a = starred_expression_rule(p)) // starred_expression
12229 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012230 (b = _tmp_108_rule(p), 1) // [',' args]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012231 )
12232 {
12233 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]"));
12234 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12235 if (_token == NULL) {
12236 D(p->level--);
12237 return NULL;
12238 }
12239 int _end_lineno = _token->end_lineno;
12240 UNUSED(_end_lineno); // Only used by EXTRA macro
12241 int _end_col_offset = _token->end_col_offset;
12242 UNUSED(_end_col_offset); // Only used by EXTRA macro
12243 _res = _Py_Call ( _PyPegen_dummy_name ( p ) , ( b ) ? CHECK ( _PyPegen_seq_insert_in_front ( p , a , ( ( expr_ty ) b ) -> v . Call . args ) ) : CHECK ( _PyPegen_singleton_seq ( p , a ) ) , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
12244 if (_res == NULL && PyErr_Occurred()) {
12245 p->error_indicator = 1;
12246 D(p->level--);
12247 return NULL;
12248 }
12249 goto done;
12250 }
12251 p->mark = _mark;
12252 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12253 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression [',' args]"));
12254 }
12255 { // kwargs
12256 if (p->error_indicator) {
12257 D(p->level--);
12258 return NULL;
12259 }
12260 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
12261 asdl_seq* a;
12262 if (
12263 (a = kwargs_rule(p)) // kwargs
12264 )
12265 {
12266 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
12267 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12268 if (_token == NULL) {
12269 D(p->level--);
12270 return NULL;
12271 }
12272 int _end_lineno = _token->end_lineno;
12273 UNUSED(_end_lineno); // Only used by EXTRA macro
12274 int _end_col_offset = _token->end_col_offset;
12275 UNUSED(_end_col_offset); // Only used by EXTRA macro
12276 _res = _Py_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA );
12277 if (_res == NULL && PyErr_Occurred()) {
12278 p->error_indicator = 1;
12279 D(p->level--);
12280 return NULL;
12281 }
12282 goto done;
12283 }
12284 p->mark = _mark;
12285 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12286 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
12287 }
12288 { // named_expression [',' args]
12289 if (p->error_indicator) {
12290 D(p->level--);
12291 return NULL;
12292 }
12293 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]"));
12294 expr_ty a;
12295 void *b;
12296 if (
12297 (a = named_expression_rule(p)) // named_expression
12298 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012299 (b = _tmp_109_rule(p), 1) // [',' args]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012300 )
12301 {
12302 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]"));
12303 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12304 if (_token == NULL) {
12305 D(p->level--);
12306 return NULL;
12307 }
12308 int _end_lineno = _token->end_lineno;
12309 UNUSED(_end_lineno); // Only used by EXTRA macro
12310 int _end_col_offset = _token->end_col_offset;
12311 UNUSED(_end_col_offset); // Only used by EXTRA macro
12312 _res = _Py_Call ( _PyPegen_dummy_name ( p ) , ( b ) ? CHECK ( _PyPegen_seq_insert_in_front ( p , a , ( ( expr_ty ) b ) -> v . Call . args ) ) : CHECK ( _PyPegen_singleton_seq ( p , a ) ) , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
12313 if (_res == NULL && PyErr_Occurred()) {
12314 p->error_indicator = 1;
12315 D(p->level--);
12316 return NULL;
12317 }
12318 goto done;
12319 }
12320 p->mark = _mark;
12321 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12322 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression [',' args]"));
12323 }
12324 _res = NULL;
12325 done:
12326 D(p->level--);
12327 return _res;
12328}
12329
12330// kwargs:
12331// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12332// | ','.kwarg_or_starred+
12333// | ','.kwarg_or_double_starred+
12334static asdl_seq*
12335kwargs_rule(Parser *p)
12336{
12337 D(p->level++);
12338 if (p->error_indicator) {
12339 D(p->level--);
12340 return NULL;
12341 }
12342 asdl_seq* _res = NULL;
12343 int _mark = p->mark;
12344 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12345 if (p->error_indicator) {
12346 D(p->level--);
12347 return NULL;
12348 }
12349 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12350 Token * _literal;
12351 asdl_seq * a;
12352 asdl_seq * b;
12353 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012354 (a = _gather_110_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012355 &&
12356 (_literal = _PyPegen_expect_token(p, 12)) // token=','
12357 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012358 (b = _gather_112_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012359 )
12360 {
12361 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12362 _res = _PyPegen_join_sequences ( p , a , b );
12363 if (_res == NULL && PyErr_Occurred()) {
12364 p->error_indicator = 1;
12365 D(p->level--);
12366 return NULL;
12367 }
12368 goto done;
12369 }
12370 p->mark = _mark;
12371 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12373 }
12374 { // ','.kwarg_or_starred+
12375 if (p->error_indicator) {
12376 D(p->level--);
12377 return NULL;
12378 }
12379 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012380 asdl_seq * _gather_114_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012381 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012382 (_gather_114_var = _gather_114_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012383 )
12384 {
12385 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012386 _res = _gather_114_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012387 goto done;
12388 }
12389 p->mark = _mark;
12390 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12391 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
12392 }
12393 { // ','.kwarg_or_double_starred+
12394 if (p->error_indicator) {
12395 D(p->level--);
12396 return NULL;
12397 }
12398 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012399 asdl_seq * _gather_116_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012400 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012401 (_gather_116_var = _gather_116_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012402 )
12403 {
12404 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012405 _res = _gather_116_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012406 goto done;
12407 }
12408 p->mark = _mark;
12409 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12410 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
12411 }
12412 _res = NULL;
12413 done:
12414 D(p->level--);
12415 return _res;
12416}
12417
12418// starred_expression: '*' expression
12419static expr_ty
12420starred_expression_rule(Parser *p)
12421{
12422 D(p->level++);
12423 if (p->error_indicator) {
12424 D(p->level--);
12425 return NULL;
12426 }
12427 expr_ty _res = NULL;
12428 int _mark = p->mark;
12429 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12430 p->error_indicator = 1;
12431 D(p->level--);
12432 return NULL;
12433 }
12434 int _start_lineno = p->tokens[_mark]->lineno;
12435 UNUSED(_start_lineno); // Only used by EXTRA macro
12436 int _start_col_offset = p->tokens[_mark]->col_offset;
12437 UNUSED(_start_col_offset); // Only used by EXTRA macro
12438 { // '*' expression
12439 if (p->error_indicator) {
12440 D(p->level--);
12441 return NULL;
12442 }
12443 D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12444 Token * _literal;
12445 expr_ty a;
12446 if (
12447 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12448 &&
12449 (a = expression_rule(p)) // expression
12450 )
12451 {
12452 D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12453 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12454 if (_token == NULL) {
12455 D(p->level--);
12456 return NULL;
12457 }
12458 int _end_lineno = _token->end_lineno;
12459 UNUSED(_end_lineno); // Only used by EXTRA macro
12460 int _end_col_offset = _token->end_col_offset;
12461 UNUSED(_end_col_offset); // Only used by EXTRA macro
12462 _res = _Py_Starred ( a , Load , EXTRA );
12463 if (_res == NULL && PyErr_Occurred()) {
12464 p->error_indicator = 1;
12465 D(p->level--);
12466 return NULL;
12467 }
12468 goto done;
12469 }
12470 p->mark = _mark;
12471 D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
12472 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
12473 }
12474 _res = NULL;
12475 done:
12476 D(p->level--);
12477 return _res;
12478}
12479
12480// kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg
12481static KeywordOrStarred*
12482kwarg_or_starred_rule(Parser *p)
12483{
12484 D(p->level++);
12485 if (p->error_indicator) {
12486 D(p->level--);
12487 return NULL;
12488 }
12489 KeywordOrStarred* _res = NULL;
12490 int _mark = p->mark;
12491 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12492 p->error_indicator = 1;
12493 D(p->level--);
12494 return NULL;
12495 }
12496 int _start_lineno = p->tokens[_mark]->lineno;
12497 UNUSED(_start_lineno); // Only used by EXTRA macro
12498 int _start_col_offset = p->tokens[_mark]->col_offset;
12499 UNUSED(_start_col_offset); // Only used by EXTRA macro
12500 { // NAME '=' expression
12501 if (p->error_indicator) {
12502 D(p->level--);
12503 return NULL;
12504 }
12505 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12506 Token * _literal;
12507 expr_ty a;
12508 expr_ty b;
12509 if (
12510 (a = _PyPegen_name_token(p)) // NAME
12511 &&
12512 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12513 &&
12514 (b = expression_rule(p)) // expression
12515 )
12516 {
12517 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12518 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12519 if (_token == NULL) {
12520 D(p->level--);
12521 return NULL;
12522 }
12523 int _end_lineno = _token->end_lineno;
12524 UNUSED(_end_lineno); // Only used by EXTRA macro
12525 int _end_col_offset = _token->end_col_offset;
12526 UNUSED(_end_col_offset); // Only used by EXTRA macro
12527 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
12528 if (_res == NULL && PyErr_Occurred()) {
12529 p->error_indicator = 1;
12530 D(p->level--);
12531 return NULL;
12532 }
12533 goto done;
12534 }
12535 p->mark = _mark;
12536 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12537 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12538 }
12539 { // starred_expression
12540 if (p->error_indicator) {
12541 D(p->level--);
12542 return NULL;
12543 }
12544 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12545 expr_ty a;
12546 if (
12547 (a = starred_expression_rule(p)) // starred_expression
12548 )
12549 {
12550 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12551 _res = _PyPegen_keyword_or_starred ( p , a , 0 );
12552 if (_res == NULL && PyErr_Occurred()) {
12553 p->error_indicator = 1;
12554 D(p->level--);
12555 return NULL;
12556 }
12557 goto done;
12558 }
12559 p->mark = _mark;
12560 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12561 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
12562 }
12563 { // invalid_kwarg
12564 if (p->error_indicator) {
12565 D(p->level--);
12566 return NULL;
12567 }
12568 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12569 void *invalid_kwarg_var;
12570 if (
12571 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12572 )
12573 {
12574 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12575 _res = invalid_kwarg_var;
12576 goto done;
12577 }
12578 p->mark = _mark;
12579 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12580 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12581 }
12582 _res = NULL;
12583 done:
12584 D(p->level--);
12585 return _res;
12586}
12587
12588// kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg
12589static KeywordOrStarred*
12590kwarg_or_double_starred_rule(Parser *p)
12591{
12592 D(p->level++);
12593 if (p->error_indicator) {
12594 D(p->level--);
12595 return NULL;
12596 }
12597 KeywordOrStarred* _res = NULL;
12598 int _mark = p->mark;
12599 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12600 p->error_indicator = 1;
12601 D(p->level--);
12602 return NULL;
12603 }
12604 int _start_lineno = p->tokens[_mark]->lineno;
12605 UNUSED(_start_lineno); // Only used by EXTRA macro
12606 int _start_col_offset = p->tokens[_mark]->col_offset;
12607 UNUSED(_start_col_offset); // Only used by EXTRA macro
12608 { // NAME '=' expression
12609 if (p->error_indicator) {
12610 D(p->level--);
12611 return NULL;
12612 }
12613 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12614 Token * _literal;
12615 expr_ty a;
12616 expr_ty b;
12617 if (
12618 (a = _PyPegen_name_token(p)) // NAME
12619 &&
12620 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12621 &&
12622 (b = expression_rule(p)) // expression
12623 )
12624 {
12625 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12626 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12627 if (_token == NULL) {
12628 D(p->level--);
12629 return NULL;
12630 }
12631 int _end_lineno = _token->end_lineno;
12632 UNUSED(_end_lineno); // Only used by EXTRA macro
12633 int _end_col_offset = _token->end_col_offset;
12634 UNUSED(_end_col_offset); // Only used by EXTRA macro
12635 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
12636 if (_res == NULL && PyErr_Occurred()) {
12637 p->error_indicator = 1;
12638 D(p->level--);
12639 return NULL;
12640 }
12641 goto done;
12642 }
12643 p->mark = _mark;
12644 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12645 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12646 }
12647 { // '**' expression
12648 if (p->error_indicator) {
12649 D(p->level--);
12650 return NULL;
12651 }
12652 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12653 Token * _literal;
12654 expr_ty a;
12655 if (
12656 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
12657 &&
12658 (a = expression_rule(p)) // expression
12659 )
12660 {
12661 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12662 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12663 if (_token == NULL) {
12664 D(p->level--);
12665 return NULL;
12666 }
12667 int _end_lineno = _token->end_lineno;
12668 UNUSED(_end_lineno); // Only used by EXTRA macro
12669 int _end_col_offset = _token->end_col_offset;
12670 UNUSED(_end_col_offset); // Only used by EXTRA macro
12671 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
12672 if (_res == NULL && PyErr_Occurred()) {
12673 p->error_indicator = 1;
12674 D(p->level--);
12675 return NULL;
12676 }
12677 goto done;
12678 }
12679 p->mark = _mark;
12680 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12681 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
12682 }
12683 { // invalid_kwarg
12684 if (p->error_indicator) {
12685 D(p->level--);
12686 return NULL;
12687 }
12688 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12689 void *invalid_kwarg_var;
12690 if (
12691 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12692 )
12693 {
12694 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12695 _res = invalid_kwarg_var;
12696 goto done;
12697 }
12698 p->mark = _mark;
12699 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12700 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12701 }
12702 _res = NULL;
12703 done:
12704 D(p->level--);
12705 return _res;
12706}
12707
12708// star_targets: star_target !',' | star_target ((',' star_target))* ','?
12709static expr_ty
12710star_targets_rule(Parser *p)
12711{
12712 D(p->level++);
12713 if (p->error_indicator) {
12714 D(p->level--);
12715 return NULL;
12716 }
12717 expr_ty _res = NULL;
12718 int _mark = p->mark;
12719 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12720 p->error_indicator = 1;
12721 D(p->level--);
12722 return NULL;
12723 }
12724 int _start_lineno = p->tokens[_mark]->lineno;
12725 UNUSED(_start_lineno); // Only used by EXTRA macro
12726 int _start_col_offset = p->tokens[_mark]->col_offset;
12727 UNUSED(_start_col_offset); // Only used by EXTRA macro
12728 { // star_target !','
12729 if (p->error_indicator) {
12730 D(p->level--);
12731 return NULL;
12732 }
12733 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12734 expr_ty a;
12735 if (
12736 (a = star_target_rule(p)) // star_target
12737 &&
12738 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
12739 )
12740 {
12741 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12742 _res = a;
12743 if (_res == NULL && PyErr_Occurred()) {
12744 p->error_indicator = 1;
12745 D(p->level--);
12746 return NULL;
12747 }
12748 goto done;
12749 }
12750 p->mark = _mark;
12751 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12752 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
12753 }
12754 { // star_target ((',' star_target))* ','?
12755 if (p->error_indicator) {
12756 D(p->level--);
12757 return NULL;
12758 }
12759 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12760 void *_opt_var;
12761 UNUSED(_opt_var); // Silence compiler warnings
12762 expr_ty a;
12763 asdl_seq * b;
12764 if (
12765 (a = star_target_rule(p)) // star_target
12766 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012767 (b = _loop0_118_rule(p)) // ((',' star_target))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012768 &&
12769 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12770 )
12771 {
12772 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12773 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12774 if (_token == NULL) {
12775 D(p->level--);
12776 return NULL;
12777 }
12778 int _end_lineno = _token->end_lineno;
12779 UNUSED(_end_lineno); // Only used by EXTRA macro
12780 int _end_col_offset = _token->end_col_offset;
12781 UNUSED(_end_col_offset); // Only used by EXTRA macro
12782 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
12783 if (_res == NULL && PyErr_Occurred()) {
12784 p->error_indicator = 1;
12785 D(p->level--);
12786 return NULL;
12787 }
12788 goto done;
12789 }
12790 p->mark = _mark;
12791 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12792 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
12793 }
12794 _res = NULL;
12795 done:
12796 D(p->level--);
12797 return _res;
12798}
12799
12800// star_targets_seq: ','.star_target+ ','?
12801static asdl_seq*
12802star_targets_seq_rule(Parser *p)
12803{
12804 D(p->level++);
12805 if (p->error_indicator) {
12806 D(p->level--);
12807 return NULL;
12808 }
12809 asdl_seq* _res = NULL;
12810 int _mark = p->mark;
12811 { // ','.star_target+ ','?
12812 if (p->error_indicator) {
12813 D(p->level--);
12814 return NULL;
12815 }
12816 D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12817 void *_opt_var;
12818 UNUSED(_opt_var); // Silence compiler warnings
12819 asdl_seq * a;
12820 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012821 (a = _gather_119_rule(p)) // ','.star_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012822 &&
12823 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12824 )
12825 {
12826 D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12827 _res = a;
12828 if (_res == NULL && PyErr_Occurred()) {
12829 p->error_indicator = 1;
12830 D(p->level--);
12831 return NULL;
12832 }
12833 goto done;
12834 }
12835 p->mark = _mark;
12836 D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ',
12837 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
12838 }
12839 _res = NULL;
12840 done:
12841 D(p->level--);
12842 return _res;
12843}
12844
12845// star_target:
12846// | '*' (!'*' star_target)
12847// | t_primary '.' NAME !t_lookahead
12848// | t_primary '[' slices ']' !t_lookahead
12849// | star_atom
12850static expr_ty
12851star_target_rule(Parser *p)
12852{
12853 D(p->level++);
12854 if (p->error_indicator) {
12855 D(p->level--);
12856 return NULL;
12857 }
12858 expr_ty _res = NULL;
12859 if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
12860 D(p->level--);
12861 return _res;
12862 }
12863 int _mark = p->mark;
12864 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12865 p->error_indicator = 1;
12866 D(p->level--);
12867 return NULL;
12868 }
12869 int _start_lineno = p->tokens[_mark]->lineno;
12870 UNUSED(_start_lineno); // Only used by EXTRA macro
12871 int _start_col_offset = p->tokens[_mark]->col_offset;
12872 UNUSED(_start_col_offset); // Only used by EXTRA macro
12873 { // '*' (!'*' star_target)
12874 if (p->error_indicator) {
12875 D(p->level--);
12876 return NULL;
12877 }
12878 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12879 Token * _literal;
12880 void *a;
12881 if (
12882 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12883 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012884 (a = _tmp_121_rule(p)) // !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012885 )
12886 {
12887 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12888 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12889 if (_token == NULL) {
12890 D(p->level--);
12891 return NULL;
12892 }
12893 int _end_lineno = _token->end_lineno;
12894 UNUSED(_end_lineno); // Only used by EXTRA macro
12895 int _end_col_offset = _token->end_col_offset;
12896 UNUSED(_end_col_offset); // Only used by EXTRA macro
12897 _res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
12898 if (_res == NULL && PyErr_Occurred()) {
12899 p->error_indicator = 1;
12900 D(p->level--);
12901 return NULL;
12902 }
12903 goto done;
12904 }
12905 p->mark = _mark;
12906 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12907 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
12908 }
12909 { // t_primary '.' NAME !t_lookahead
12910 if (p->error_indicator) {
12911 D(p->level--);
12912 return NULL;
12913 }
12914 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12915 Token * _literal;
12916 expr_ty a;
12917 expr_ty b;
12918 if (
12919 (a = t_primary_rule(p)) // t_primary
12920 &&
12921 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
12922 &&
12923 (b = _PyPegen_name_token(p)) // NAME
12924 &&
12925 _PyPegen_lookahead(0, t_lookahead_rule, p)
12926 )
12927 {
12928 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12929 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12930 if (_token == NULL) {
12931 D(p->level--);
12932 return NULL;
12933 }
12934 int _end_lineno = _token->end_lineno;
12935 UNUSED(_end_lineno); // Only used by EXTRA macro
12936 int _end_col_offset = _token->end_col_offset;
12937 UNUSED(_end_col_offset); // Only used by EXTRA macro
12938 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
12939 if (_res == NULL && PyErr_Occurred()) {
12940 p->error_indicator = 1;
12941 D(p->level--);
12942 return NULL;
12943 }
12944 goto done;
12945 }
12946 p->mark = _mark;
12947 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12948 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12949 }
12950 { // t_primary '[' slices ']' !t_lookahead
12951 if (p->error_indicator) {
12952 D(p->level--);
12953 return NULL;
12954 }
12955 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12956 Token * _literal;
12957 Token * _literal_1;
12958 expr_ty a;
12959 expr_ty b;
12960 if (
12961 (a = t_primary_rule(p)) // t_primary
12962 &&
12963 (_literal = _PyPegen_expect_token(p, 9)) // token='['
12964 &&
12965 (b = slices_rule(p)) // slices
12966 &&
12967 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
12968 &&
12969 _PyPegen_lookahead(0, t_lookahead_rule, p)
12970 )
12971 {
12972 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12973 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12974 if (_token == NULL) {
12975 D(p->level--);
12976 return NULL;
12977 }
12978 int _end_lineno = _token->end_lineno;
12979 UNUSED(_end_lineno); // Only used by EXTRA macro
12980 int _end_col_offset = _token->end_col_offset;
12981 UNUSED(_end_col_offset); // Only used by EXTRA macro
12982 _res = _Py_Subscript ( a , b , Store , EXTRA );
12983 if (_res == NULL && PyErr_Occurred()) {
12984 p->error_indicator = 1;
12985 D(p->level--);
12986 return NULL;
12987 }
12988 goto done;
12989 }
12990 p->mark = _mark;
12991 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12992 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12993 }
12994 { // star_atom
12995 if (p->error_indicator) {
12996 D(p->level--);
12997 return NULL;
12998 }
12999 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
13000 expr_ty star_atom_var;
13001 if (
13002 (star_atom_var = star_atom_rule(p)) // star_atom
13003 )
13004 {
13005 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
13006 _res = star_atom_var;
13007 goto done;
13008 }
13009 p->mark = _mark;
13010 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
13011 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
13012 }
13013 _res = NULL;
13014 done:
13015 _PyPegen_insert_memo(p, _mark, star_target_type, _res);
13016 D(p->level--);
13017 return _res;
13018}
13019
13020// star_atom:
13021// | NAME
13022// | '(' star_target ')'
13023// | '(' star_targets_seq? ')'
13024// | '[' star_targets_seq? ']'
13025static expr_ty
13026star_atom_rule(Parser *p)
13027{
13028 D(p->level++);
13029 if (p->error_indicator) {
13030 D(p->level--);
13031 return NULL;
13032 }
13033 expr_ty _res = NULL;
13034 int _mark = p->mark;
13035 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13036 p->error_indicator = 1;
13037 D(p->level--);
13038 return NULL;
13039 }
13040 int _start_lineno = p->tokens[_mark]->lineno;
13041 UNUSED(_start_lineno); // Only used by EXTRA macro
13042 int _start_col_offset = p->tokens[_mark]->col_offset;
13043 UNUSED(_start_col_offset); // Only used by EXTRA macro
13044 { // NAME
13045 if (p->error_indicator) {
13046 D(p->level--);
13047 return NULL;
13048 }
13049 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13050 expr_ty a;
13051 if (
13052 (a = _PyPegen_name_token(p)) // NAME
13053 )
13054 {
13055 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13056 _res = _PyPegen_set_expr_context ( p , a , Store );
13057 if (_res == NULL && PyErr_Occurred()) {
13058 p->error_indicator = 1;
13059 D(p->level--);
13060 return NULL;
13061 }
13062 goto done;
13063 }
13064 p->mark = _mark;
13065 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13066 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13067 }
13068 { // '(' star_target ')'
13069 if (p->error_indicator) {
13070 D(p->level--);
13071 return NULL;
13072 }
13073 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13074 Token * _literal;
13075 Token * _literal_1;
13076 expr_ty a;
13077 if (
13078 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13079 &&
13080 (a = star_target_rule(p)) // star_target
13081 &&
13082 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13083 )
13084 {
13085 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13086 _res = _PyPegen_set_expr_context ( p , a , Store );
13087 if (_res == NULL && PyErr_Occurred()) {
13088 p->error_indicator = 1;
13089 D(p->level--);
13090 return NULL;
13091 }
13092 goto done;
13093 }
13094 p->mark = _mark;
13095 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13096 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'"));
13097 }
13098 { // '(' star_targets_seq? ')'
13099 if (p->error_indicator) {
13100 D(p->level--);
13101 return NULL;
13102 }
13103 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13104 Token * _literal;
13105 Token * _literal_1;
13106 void *a;
13107 if (
13108 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13109 &&
13110 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13111 &&
13112 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13113 )
13114 {
13115 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13116 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13117 if (_token == NULL) {
13118 D(p->level--);
13119 return NULL;
13120 }
13121 int _end_lineno = _token->end_lineno;
13122 UNUSED(_end_lineno); // Only used by EXTRA macro
13123 int _end_col_offset = _token->end_col_offset;
13124 UNUSED(_end_col_offset); // Only used by EXTRA macro
13125 _res = _Py_Tuple ( a , Store , EXTRA );
13126 if (_res == NULL && PyErr_Occurred()) {
13127 p->error_indicator = 1;
13128 D(p->level--);
13129 return NULL;
13130 }
13131 goto done;
13132 }
13133 p->mark = _mark;
13134 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13135 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'"));
13136 }
13137 { // '[' star_targets_seq? ']'
13138 if (p->error_indicator) {
13139 D(p->level--);
13140 return NULL;
13141 }
13142 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13143 Token * _literal;
13144 Token * _literal_1;
13145 void *a;
13146 if (
13147 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13148 &&
13149 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13150 &&
13151 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13152 )
13153 {
13154 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13155 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13156 if (_token == NULL) {
13157 D(p->level--);
13158 return NULL;
13159 }
13160 int _end_lineno = _token->end_lineno;
13161 UNUSED(_end_lineno); // Only used by EXTRA macro
13162 int _end_col_offset = _token->end_col_offset;
13163 UNUSED(_end_col_offset); // Only used by EXTRA macro
13164 _res = _Py_List ( a , Store , EXTRA );
13165 if (_res == NULL && PyErr_Occurred()) {
13166 p->error_indicator = 1;
13167 D(p->level--);
13168 return NULL;
13169 }
13170 goto done;
13171 }
13172 p->mark = _mark;
13173 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13174 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'"));
13175 }
13176 _res = NULL;
13177 done:
13178 D(p->level--);
13179 return _res;
13180}
13181
13182// single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
13183static expr_ty
13184single_target_rule(Parser *p)
13185{
13186 D(p->level++);
13187 if (p->error_indicator) {
13188 D(p->level--);
13189 return NULL;
13190 }
13191 expr_ty _res = NULL;
13192 int _mark = p->mark;
13193 { // single_subscript_attribute_target
13194 if (p->error_indicator) {
13195 D(p->level--);
13196 return NULL;
13197 }
13198 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13199 expr_ty single_subscript_attribute_target_var;
13200 if (
13201 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
13202 )
13203 {
13204 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13205 _res = single_subscript_attribute_target_var;
13206 goto done;
13207 }
13208 p->mark = _mark;
13209 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13210 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
13211 }
13212 { // NAME
13213 if (p->error_indicator) {
13214 D(p->level--);
13215 return NULL;
13216 }
13217 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13218 expr_ty a;
13219 if (
13220 (a = _PyPegen_name_token(p)) // NAME
13221 )
13222 {
13223 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13224 _res = _PyPegen_set_expr_context ( p , a , Store );
13225 if (_res == NULL && PyErr_Occurred()) {
13226 p->error_indicator = 1;
13227 D(p->level--);
13228 return NULL;
13229 }
13230 goto done;
13231 }
13232 p->mark = _mark;
13233 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13234 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13235 }
13236 { // '(' single_target ')'
13237 if (p->error_indicator) {
13238 D(p->level--);
13239 return NULL;
13240 }
13241 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13242 Token * _literal;
13243 Token * _literal_1;
13244 expr_ty a;
13245 if (
13246 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13247 &&
13248 (a = single_target_rule(p)) // single_target
13249 &&
13250 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13251 )
13252 {
13253 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13254 _res = a;
13255 if (_res == NULL && PyErr_Occurred()) {
13256 p->error_indicator = 1;
13257 D(p->level--);
13258 return NULL;
13259 }
13260 goto done;
13261 }
13262 p->mark = _mark;
13263 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13264 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
13265 }
13266 _res = NULL;
13267 done:
13268 D(p->level--);
13269 return _res;
13270}
13271
13272// single_subscript_attribute_target:
13273// | t_primary '.' NAME !t_lookahead
13274// | t_primary '[' slices ']' !t_lookahead
13275static expr_ty
13276single_subscript_attribute_target_rule(Parser *p)
13277{
13278 D(p->level++);
13279 if (p->error_indicator) {
13280 D(p->level--);
13281 return NULL;
13282 }
13283 expr_ty _res = NULL;
13284 int _mark = p->mark;
13285 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13286 p->error_indicator = 1;
13287 D(p->level--);
13288 return NULL;
13289 }
13290 int _start_lineno = p->tokens[_mark]->lineno;
13291 UNUSED(_start_lineno); // Only used by EXTRA macro
13292 int _start_col_offset = p->tokens[_mark]->col_offset;
13293 UNUSED(_start_col_offset); // Only used by EXTRA macro
13294 { // t_primary '.' NAME !t_lookahead
13295 if (p->error_indicator) {
13296 D(p->level--);
13297 return NULL;
13298 }
13299 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13300 Token * _literal;
13301 expr_ty a;
13302 expr_ty b;
13303 if (
13304 (a = t_primary_rule(p)) // t_primary
13305 &&
13306 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13307 &&
13308 (b = _PyPegen_name_token(p)) // NAME
13309 &&
13310 _PyPegen_lookahead(0, t_lookahead_rule, p)
13311 )
13312 {
13313 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13314 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13315 if (_token == NULL) {
13316 D(p->level--);
13317 return NULL;
13318 }
13319 int _end_lineno = _token->end_lineno;
13320 UNUSED(_end_lineno); // Only used by EXTRA macro
13321 int _end_col_offset = _token->end_col_offset;
13322 UNUSED(_end_col_offset); // Only used by EXTRA macro
13323 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13324 if (_res == NULL && PyErr_Occurred()) {
13325 p->error_indicator = 1;
13326 D(p->level--);
13327 return NULL;
13328 }
13329 goto done;
13330 }
13331 p->mark = _mark;
13332 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13333 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13334 }
13335 { // t_primary '[' slices ']' !t_lookahead
13336 if (p->error_indicator) {
13337 D(p->level--);
13338 return NULL;
13339 }
13340 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13341 Token * _literal;
13342 Token * _literal_1;
13343 expr_ty a;
13344 expr_ty b;
13345 if (
13346 (a = t_primary_rule(p)) // t_primary
13347 &&
13348 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13349 &&
13350 (b = slices_rule(p)) // slices
13351 &&
13352 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13353 &&
13354 _PyPegen_lookahead(0, t_lookahead_rule, p)
13355 )
13356 {
13357 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13358 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13359 if (_token == NULL) {
13360 D(p->level--);
13361 return NULL;
13362 }
13363 int _end_lineno = _token->end_lineno;
13364 UNUSED(_end_lineno); // Only used by EXTRA macro
13365 int _end_col_offset = _token->end_col_offset;
13366 UNUSED(_end_col_offset); // Only used by EXTRA macro
13367 _res = _Py_Subscript ( a , b , Store , EXTRA );
13368 if (_res == NULL && PyErr_Occurred()) {
13369 p->error_indicator = 1;
13370 D(p->level--);
13371 return NULL;
13372 }
13373 goto done;
13374 }
13375 p->mark = _mark;
13376 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13377 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13378 }
13379 _res = NULL;
13380 done:
13381 D(p->level--);
13382 return _res;
13383}
13384
13385// del_targets: ','.del_target+ ','?
13386static asdl_seq*
13387del_targets_rule(Parser *p)
13388{
13389 D(p->level++);
13390 if (p->error_indicator) {
13391 D(p->level--);
13392 return NULL;
13393 }
13394 asdl_seq* _res = NULL;
13395 int _mark = p->mark;
13396 { // ','.del_target+ ','?
13397 if (p->error_indicator) {
13398 D(p->level--);
13399 return NULL;
13400 }
13401 D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13402 void *_opt_var;
13403 UNUSED(_opt_var); // Silence compiler warnings
13404 asdl_seq * a;
13405 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013406 (a = _gather_122_rule(p)) // ','.del_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013407 &&
13408 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13409 )
13410 {
13411 D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13412 _res = a;
13413 if (_res == NULL && PyErr_Occurred()) {
13414 p->error_indicator = 1;
13415 D(p->level--);
13416 return NULL;
13417 }
13418 goto done;
13419 }
13420 p->mark = _mark;
13421 D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
13422 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
13423 }
13424 _res = NULL;
13425 done:
13426 D(p->level--);
13427 return _res;
13428}
13429
13430// del_target:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013431// | t_primary '.' NAME !t_lookahead
13432// | t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013433// | del_t_atom
13434static expr_ty
13435del_target_rule(Parser *p)
13436{
13437 D(p->level++);
13438 if (p->error_indicator) {
13439 D(p->level--);
13440 return NULL;
13441 }
13442 expr_ty _res = NULL;
13443 if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
13444 D(p->level--);
13445 return _res;
13446 }
13447 int _mark = p->mark;
13448 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13449 p->error_indicator = 1;
13450 D(p->level--);
13451 return NULL;
13452 }
13453 int _start_lineno = p->tokens[_mark]->lineno;
13454 UNUSED(_start_lineno); // Only used by EXTRA macro
13455 int _start_col_offset = p->tokens[_mark]->col_offset;
13456 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013457 { // t_primary '.' NAME !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013458 if (p->error_indicator) {
13459 D(p->level--);
13460 return NULL;
13461 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013462 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 +010013463 Token * _literal;
13464 expr_ty a;
13465 expr_ty b;
13466 if (
13467 (a = t_primary_rule(p)) // t_primary
13468 &&
13469 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13470 &&
13471 (b = _PyPegen_name_token(p)) // NAME
13472 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013473 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013474 )
13475 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013476 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 +010013477 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13478 if (_token == NULL) {
13479 D(p->level--);
13480 return NULL;
13481 }
13482 int _end_lineno = _token->end_lineno;
13483 UNUSED(_end_lineno); // Only used by EXTRA macro
13484 int _end_col_offset = _token->end_col_offset;
13485 UNUSED(_end_col_offset); // Only used by EXTRA macro
13486 _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
13487 if (_res == NULL && PyErr_Occurred()) {
13488 p->error_indicator = 1;
13489 D(p->level--);
13490 return NULL;
13491 }
13492 goto done;
13493 }
13494 p->mark = _mark;
13495 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013496 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013497 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013498 { // t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013499 if (p->error_indicator) {
13500 D(p->level--);
13501 return NULL;
13502 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013503 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 +010013504 Token * _literal;
13505 Token * _literal_1;
13506 expr_ty a;
13507 expr_ty b;
13508 if (
13509 (a = t_primary_rule(p)) // t_primary
13510 &&
13511 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13512 &&
13513 (b = slices_rule(p)) // slices
13514 &&
13515 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13516 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013517 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013518 )
13519 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013520 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 +010013521 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13522 if (_token == NULL) {
13523 D(p->level--);
13524 return NULL;
13525 }
13526 int _end_lineno = _token->end_lineno;
13527 UNUSED(_end_lineno); // Only used by EXTRA macro
13528 int _end_col_offset = _token->end_col_offset;
13529 UNUSED(_end_col_offset); // Only used by EXTRA macro
13530 _res = _Py_Subscript ( a , b , Del , EXTRA );
13531 if (_res == NULL && PyErr_Occurred()) {
13532 p->error_indicator = 1;
13533 D(p->level--);
13534 return NULL;
13535 }
13536 goto done;
13537 }
13538 p->mark = _mark;
13539 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013540 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013541 }
13542 { // del_t_atom
13543 if (p->error_indicator) {
13544 D(p->level--);
13545 return NULL;
13546 }
13547 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13548 expr_ty del_t_atom_var;
13549 if (
13550 (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom
13551 )
13552 {
13553 D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13554 _res = del_t_atom_var;
13555 goto done;
13556 }
13557 p->mark = _mark;
13558 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
13559 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
13560 }
13561 _res = NULL;
13562 done:
13563 _PyPegen_insert_memo(p, _mark, del_target_type, _res);
13564 D(p->level--);
13565 return _res;
13566}
13567
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013568// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013569static expr_ty
13570del_t_atom_rule(Parser *p)
13571{
13572 D(p->level++);
13573 if (p->error_indicator) {
13574 D(p->level--);
13575 return NULL;
13576 }
13577 expr_ty _res = NULL;
13578 int _mark = p->mark;
13579 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13580 p->error_indicator = 1;
13581 D(p->level--);
13582 return NULL;
13583 }
13584 int _start_lineno = p->tokens[_mark]->lineno;
13585 UNUSED(_start_lineno); // Only used by EXTRA macro
13586 int _start_col_offset = p->tokens[_mark]->col_offset;
13587 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013588 { // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013589 if (p->error_indicator) {
13590 D(p->level--);
13591 return NULL;
13592 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013593 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013594 expr_ty a;
13595 if (
13596 (a = _PyPegen_name_token(p)) // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013597 )
13598 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013599 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 +010013600 _res = _PyPegen_set_expr_context ( p , a , Del );
13601 if (_res == NULL && PyErr_Occurred()) {
13602 p->error_indicator = 1;
13603 D(p->level--);
13604 return NULL;
13605 }
13606 goto done;
13607 }
13608 p->mark = _mark;
13609 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013610 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013611 }
13612 { // '(' del_target ')'
13613 if (p->error_indicator) {
13614 D(p->level--);
13615 return NULL;
13616 }
13617 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13618 Token * _literal;
13619 Token * _literal_1;
13620 expr_ty a;
13621 if (
13622 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13623 &&
13624 (a = del_target_rule(p)) // del_target
13625 &&
13626 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13627 )
13628 {
13629 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13630 _res = _PyPegen_set_expr_context ( p , a , Del );
13631 if (_res == NULL && PyErr_Occurred()) {
13632 p->error_indicator = 1;
13633 D(p->level--);
13634 return NULL;
13635 }
13636 goto done;
13637 }
13638 p->mark = _mark;
13639 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13640 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
13641 }
13642 { // '(' del_targets? ')'
13643 if (p->error_indicator) {
13644 D(p->level--);
13645 return NULL;
13646 }
13647 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13648 Token * _literal;
13649 Token * _literal_1;
13650 void *a;
13651 if (
13652 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13653 &&
13654 (a = del_targets_rule(p), 1) // del_targets?
13655 &&
13656 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13657 )
13658 {
13659 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13660 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13661 if (_token == NULL) {
13662 D(p->level--);
13663 return NULL;
13664 }
13665 int _end_lineno = _token->end_lineno;
13666 UNUSED(_end_lineno); // Only used by EXTRA macro
13667 int _end_col_offset = _token->end_col_offset;
13668 UNUSED(_end_col_offset); // Only used by EXTRA macro
13669 _res = _Py_Tuple ( a , Del , EXTRA );
13670 if (_res == NULL && PyErr_Occurred()) {
13671 p->error_indicator = 1;
13672 D(p->level--);
13673 return NULL;
13674 }
13675 goto done;
13676 }
13677 p->mark = _mark;
13678 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13679 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
13680 }
13681 { // '[' del_targets? ']'
13682 if (p->error_indicator) {
13683 D(p->level--);
13684 return NULL;
13685 }
13686 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13687 Token * _literal;
13688 Token * _literal_1;
13689 void *a;
13690 if (
13691 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13692 &&
13693 (a = del_targets_rule(p), 1) // del_targets?
13694 &&
13695 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13696 )
13697 {
13698 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13699 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13700 if (_token == NULL) {
13701 D(p->level--);
13702 return NULL;
13703 }
13704 int _end_lineno = _token->end_lineno;
13705 UNUSED(_end_lineno); // Only used by EXTRA macro
13706 int _end_col_offset = _token->end_col_offset;
13707 UNUSED(_end_col_offset); // Only used by EXTRA macro
13708 _res = _Py_List ( a , Del , EXTRA );
13709 if (_res == NULL && PyErr_Occurred()) {
13710 p->error_indicator = 1;
13711 D(p->level--);
13712 return NULL;
13713 }
13714 goto done;
13715 }
13716 p->mark = _mark;
13717 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13718 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
13719 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013720 _res = NULL;
13721 done:
13722 D(p->level--);
13723 return _res;
13724}
13725
13726// targets: ','.target+ ','?
13727static asdl_seq*
13728targets_rule(Parser *p)
13729{
13730 D(p->level++);
13731 if (p->error_indicator) {
13732 D(p->level--);
13733 return NULL;
13734 }
13735 asdl_seq* _res = NULL;
13736 int _mark = p->mark;
13737 { // ','.target+ ','?
13738 if (p->error_indicator) {
13739 D(p->level--);
13740 return NULL;
13741 }
13742 D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13743 void *_opt_var;
13744 UNUSED(_opt_var); // Silence compiler warnings
13745 asdl_seq * a;
13746 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013747 (a = _gather_124_rule(p)) // ','.target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013748 &&
13749 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13750 )
13751 {
13752 D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13753 _res = a;
13754 if (_res == NULL && PyErr_Occurred()) {
13755 p->error_indicator = 1;
13756 D(p->level--);
13757 return NULL;
13758 }
13759 goto done;
13760 }
13761 p->mark = _mark;
13762 D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ',
13763 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?"));
13764 }
13765 _res = NULL;
13766 done:
13767 D(p->level--);
13768 return _res;
13769}
13770
13771// target:
13772// | t_primary '.' NAME !t_lookahead
13773// | t_primary '[' slices ']' !t_lookahead
13774// | t_atom
13775static expr_ty
13776target_rule(Parser *p)
13777{
13778 D(p->level++);
13779 if (p->error_indicator) {
13780 D(p->level--);
13781 return NULL;
13782 }
13783 expr_ty _res = NULL;
13784 if (_PyPegen_is_memoized(p, target_type, &_res)) {
13785 D(p->level--);
13786 return _res;
13787 }
13788 int _mark = p->mark;
13789 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13790 p->error_indicator = 1;
13791 D(p->level--);
13792 return NULL;
13793 }
13794 int _start_lineno = p->tokens[_mark]->lineno;
13795 UNUSED(_start_lineno); // Only used by EXTRA macro
13796 int _start_col_offset = p->tokens[_mark]->col_offset;
13797 UNUSED(_start_col_offset); // Only used by EXTRA macro
13798 { // t_primary '.' NAME !t_lookahead
13799 if (p->error_indicator) {
13800 D(p->level--);
13801 return NULL;
13802 }
13803 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13804 Token * _literal;
13805 expr_ty a;
13806 expr_ty b;
13807 if (
13808 (a = t_primary_rule(p)) // t_primary
13809 &&
13810 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13811 &&
13812 (b = _PyPegen_name_token(p)) // NAME
13813 &&
13814 _PyPegen_lookahead(0, t_lookahead_rule, p)
13815 )
13816 {
13817 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13818 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13819 if (_token == NULL) {
13820 D(p->level--);
13821 return NULL;
13822 }
13823 int _end_lineno = _token->end_lineno;
13824 UNUSED(_end_lineno); // Only used by EXTRA macro
13825 int _end_col_offset = _token->end_col_offset;
13826 UNUSED(_end_col_offset); // Only used by EXTRA macro
13827 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13828 if (_res == NULL && PyErr_Occurred()) {
13829 p->error_indicator = 1;
13830 D(p->level--);
13831 return NULL;
13832 }
13833 goto done;
13834 }
13835 p->mark = _mark;
13836 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13837 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13838 }
13839 { // t_primary '[' slices ']' !t_lookahead
13840 if (p->error_indicator) {
13841 D(p->level--);
13842 return NULL;
13843 }
13844 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13845 Token * _literal;
13846 Token * _literal_1;
13847 expr_ty a;
13848 expr_ty b;
13849 if (
13850 (a = t_primary_rule(p)) // t_primary
13851 &&
13852 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13853 &&
13854 (b = slices_rule(p)) // slices
13855 &&
13856 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13857 &&
13858 _PyPegen_lookahead(0, t_lookahead_rule, p)
13859 )
13860 {
13861 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13862 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13863 if (_token == NULL) {
13864 D(p->level--);
13865 return NULL;
13866 }
13867 int _end_lineno = _token->end_lineno;
13868 UNUSED(_end_lineno); // Only used by EXTRA macro
13869 int _end_col_offset = _token->end_col_offset;
13870 UNUSED(_end_col_offset); // Only used by EXTRA macro
13871 _res = _Py_Subscript ( a , b , Store , EXTRA );
13872 if (_res == NULL && PyErr_Occurred()) {
13873 p->error_indicator = 1;
13874 D(p->level--);
13875 return NULL;
13876 }
13877 goto done;
13878 }
13879 p->mark = _mark;
13880 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13881 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13882 }
13883 { // t_atom
13884 if (p->error_indicator) {
13885 D(p->level--);
13886 return NULL;
13887 }
13888 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom"));
13889 expr_ty t_atom_var;
13890 if (
13891 (t_atom_var = t_atom_rule(p)) // t_atom
13892 )
13893 {
13894 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom"));
13895 _res = t_atom_var;
13896 goto done;
13897 }
13898 p->mark = _mark;
13899 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13900 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom"));
13901 }
13902 _res = NULL;
13903 done:
13904 _PyPegen_insert_memo(p, _mark, target_type, _res);
13905 D(p->level--);
13906 return _res;
13907}
13908
13909// Left-recursive
13910// t_primary:
13911// | t_primary '.' NAME &t_lookahead
13912// | t_primary '[' slices ']' &t_lookahead
13913// | t_primary genexp &t_lookahead
13914// | t_primary '(' arguments? ')' &t_lookahead
13915// | atom &t_lookahead
13916static expr_ty t_primary_raw(Parser *);
13917static expr_ty
13918t_primary_rule(Parser *p)
13919{
13920 D(p->level++);
13921 expr_ty _res = NULL;
13922 if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
13923 D(p->level--);
13924 return _res;
13925 }
13926 int _mark = p->mark;
13927 int _resmark = p->mark;
13928 while (1) {
13929 int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
13930 if (tmpvar_8) {
13931 D(p->level--);
13932 return _res;
13933 }
13934 p->mark = _mark;
13935 void *_raw = t_primary_raw(p);
13936 if (_raw == NULL || p->mark <= _resmark)
13937 break;
13938 _resmark = p->mark;
13939 _res = _raw;
13940 }
13941 p->mark = _resmark;
13942 D(p->level--);
13943 return _res;
13944}
13945static expr_ty
13946t_primary_raw(Parser *p)
13947{
13948 D(p->level++);
13949 if (p->error_indicator) {
13950 D(p->level--);
13951 return NULL;
13952 }
13953 expr_ty _res = NULL;
13954 int _mark = p->mark;
13955 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13956 p->error_indicator = 1;
13957 D(p->level--);
13958 return NULL;
13959 }
13960 int _start_lineno = p->tokens[_mark]->lineno;
13961 UNUSED(_start_lineno); // Only used by EXTRA macro
13962 int _start_col_offset = p->tokens[_mark]->col_offset;
13963 UNUSED(_start_col_offset); // Only used by EXTRA macro
13964 { // t_primary '.' NAME &t_lookahead
13965 if (p->error_indicator) {
13966 D(p->level--);
13967 return NULL;
13968 }
13969 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13970 Token * _literal;
13971 expr_ty a;
13972 expr_ty b;
13973 if (
13974 (a = t_primary_rule(p)) // t_primary
13975 &&
13976 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13977 &&
13978 (b = _PyPegen_name_token(p)) // NAME
13979 &&
13980 _PyPegen_lookahead(1, t_lookahead_rule, p)
13981 )
13982 {
13983 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13984 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13985 if (_token == NULL) {
13986 D(p->level--);
13987 return NULL;
13988 }
13989 int _end_lineno = _token->end_lineno;
13990 UNUSED(_end_lineno); // Only used by EXTRA macro
13991 int _end_col_offset = _token->end_col_offset;
13992 UNUSED(_end_col_offset); // Only used by EXTRA macro
13993 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
13994 if (_res == NULL && PyErr_Occurred()) {
13995 p->error_indicator = 1;
13996 D(p->level--);
13997 return NULL;
13998 }
13999 goto done;
14000 }
14001 p->mark = _mark;
14002 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14003 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
14004 }
14005 { // t_primary '[' slices ']' &t_lookahead
14006 if (p->error_indicator) {
14007 D(p->level--);
14008 return NULL;
14009 }
14010 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14011 Token * _literal;
14012 Token * _literal_1;
14013 expr_ty a;
14014 expr_ty b;
14015 if (
14016 (a = t_primary_rule(p)) // t_primary
14017 &&
14018 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14019 &&
14020 (b = slices_rule(p)) // slices
14021 &&
14022 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14023 &&
14024 _PyPegen_lookahead(1, t_lookahead_rule, p)
14025 )
14026 {
14027 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14028 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14029 if (_token == NULL) {
14030 D(p->level--);
14031 return NULL;
14032 }
14033 int _end_lineno = _token->end_lineno;
14034 UNUSED(_end_lineno); // Only used by EXTRA macro
14035 int _end_col_offset = _token->end_col_offset;
14036 UNUSED(_end_col_offset); // Only used by EXTRA macro
14037 _res = _Py_Subscript ( a , b , Load , EXTRA );
14038 if (_res == NULL && PyErr_Occurred()) {
14039 p->error_indicator = 1;
14040 D(p->level--);
14041 return NULL;
14042 }
14043 goto done;
14044 }
14045 p->mark = _mark;
14046 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14047 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14048 }
14049 { // t_primary genexp &t_lookahead
14050 if (p->error_indicator) {
14051 D(p->level--);
14052 return NULL;
14053 }
14054 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14055 expr_ty a;
14056 expr_ty b;
14057 if (
14058 (a = t_primary_rule(p)) // t_primary
14059 &&
14060 (b = genexp_rule(p)) // genexp
14061 &&
14062 _PyPegen_lookahead(1, t_lookahead_rule, p)
14063 )
14064 {
14065 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14066 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14067 if (_token == NULL) {
14068 D(p->level--);
14069 return NULL;
14070 }
14071 int _end_lineno = _token->end_lineno;
14072 UNUSED(_end_lineno); // Only used by EXTRA macro
14073 int _end_col_offset = _token->end_col_offset;
14074 UNUSED(_end_col_offset); // Only used by EXTRA macro
14075 _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
14076 if (_res == NULL && PyErr_Occurred()) {
14077 p->error_indicator = 1;
14078 D(p->level--);
14079 return NULL;
14080 }
14081 goto done;
14082 }
14083 p->mark = _mark;
14084 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14085 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
14086 }
14087 { // t_primary '(' arguments? ')' &t_lookahead
14088 if (p->error_indicator) {
14089 D(p->level--);
14090 return NULL;
14091 }
14092 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14093 Token * _literal;
14094 Token * _literal_1;
14095 expr_ty a;
14096 void *b;
14097 if (
14098 (a = t_primary_rule(p)) // t_primary
14099 &&
14100 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14101 &&
14102 (b = arguments_rule(p), 1) // arguments?
14103 &&
14104 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14105 &&
14106 _PyPegen_lookahead(1, t_lookahead_rule, p)
14107 )
14108 {
14109 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14110 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14111 if (_token == NULL) {
14112 D(p->level--);
14113 return NULL;
14114 }
14115 int _end_lineno = _token->end_lineno;
14116 UNUSED(_end_lineno); // Only used by EXTRA macro
14117 int _end_col_offset = _token->end_col_offset;
14118 UNUSED(_end_col_offset); // Only used by EXTRA macro
14119 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
14120 if (_res == NULL && PyErr_Occurred()) {
14121 p->error_indicator = 1;
14122 D(p->level--);
14123 return NULL;
14124 }
14125 goto done;
14126 }
14127 p->mark = _mark;
14128 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14129 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14130 }
14131 { // atom &t_lookahead
14132 if (p->error_indicator) {
14133 D(p->level--);
14134 return NULL;
14135 }
14136 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14137 expr_ty a;
14138 if (
14139 (a = atom_rule(p)) // atom
14140 &&
14141 _PyPegen_lookahead(1, t_lookahead_rule, p)
14142 )
14143 {
14144 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14145 _res = a;
14146 if (_res == NULL && PyErr_Occurred()) {
14147 p->error_indicator = 1;
14148 D(p->level--);
14149 return NULL;
14150 }
14151 goto done;
14152 }
14153 p->mark = _mark;
14154 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14155 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
14156 }
14157 _res = NULL;
14158 done:
14159 D(p->level--);
14160 return _res;
14161}
14162
14163// t_lookahead: '(' | '[' | '.'
14164static void *
14165t_lookahead_rule(Parser *p)
14166{
14167 D(p->level++);
14168 if (p->error_indicator) {
14169 D(p->level--);
14170 return NULL;
14171 }
14172 void * _res = NULL;
14173 int _mark = p->mark;
14174 { // '('
14175 if (p->error_indicator) {
14176 D(p->level--);
14177 return NULL;
14178 }
14179 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
14180 Token * _literal;
14181 if (
14182 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14183 )
14184 {
14185 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
14186 _res = _literal;
14187 goto done;
14188 }
14189 p->mark = _mark;
14190 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14191 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
14192 }
14193 { // '['
14194 if (p->error_indicator) {
14195 D(p->level--);
14196 return NULL;
14197 }
14198 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
14199 Token * _literal;
14200 if (
14201 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14202 )
14203 {
14204 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
14205 _res = _literal;
14206 goto done;
14207 }
14208 p->mark = _mark;
14209 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14210 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
14211 }
14212 { // '.'
14213 if (p->error_indicator) {
14214 D(p->level--);
14215 return NULL;
14216 }
14217 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
14218 Token * _literal;
14219 if (
14220 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
14221 )
14222 {
14223 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
14224 _res = _literal;
14225 goto done;
14226 }
14227 p->mark = _mark;
14228 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14229 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
14230 }
14231 _res = NULL;
14232 done:
14233 D(p->level--);
14234 return _res;
14235}
14236
14237// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
14238static expr_ty
14239t_atom_rule(Parser *p)
14240{
14241 D(p->level++);
14242 if (p->error_indicator) {
14243 D(p->level--);
14244 return NULL;
14245 }
14246 expr_ty _res = NULL;
14247 int _mark = p->mark;
14248 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
14249 p->error_indicator = 1;
14250 D(p->level--);
14251 return NULL;
14252 }
14253 int _start_lineno = p->tokens[_mark]->lineno;
14254 UNUSED(_start_lineno); // Only used by EXTRA macro
14255 int _start_col_offset = p->tokens[_mark]->col_offset;
14256 UNUSED(_start_col_offset); // Only used by EXTRA macro
14257 { // NAME
14258 if (p->error_indicator) {
14259 D(p->level--);
14260 return NULL;
14261 }
14262 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
14263 expr_ty a;
14264 if (
14265 (a = _PyPegen_name_token(p)) // NAME
14266 )
14267 {
14268 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
14269 _res = _PyPegen_set_expr_context ( p , a , Store );
14270 if (_res == NULL && PyErr_Occurred()) {
14271 p->error_indicator = 1;
14272 D(p->level--);
14273 return NULL;
14274 }
14275 goto done;
14276 }
14277 p->mark = _mark;
14278 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14279 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
14280 }
14281 { // '(' target ')'
14282 if (p->error_indicator) {
14283 D(p->level--);
14284 return NULL;
14285 }
14286 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14287 Token * _literal;
14288 Token * _literal_1;
14289 expr_ty a;
14290 if (
14291 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14292 &&
14293 (a = target_rule(p)) // target
14294 &&
14295 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14296 )
14297 {
14298 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14299 _res = _PyPegen_set_expr_context ( p , a , Store );
14300 if (_res == NULL && PyErr_Occurred()) {
14301 p->error_indicator = 1;
14302 D(p->level--);
14303 return NULL;
14304 }
14305 goto done;
14306 }
14307 p->mark = _mark;
14308 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14309 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'"));
14310 }
14311 { // '(' targets? ')'
14312 if (p->error_indicator) {
14313 D(p->level--);
14314 return NULL;
14315 }
14316 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14317 Token * _literal;
14318 Token * _literal_1;
14319 void *b;
14320 if (
14321 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14322 &&
14323 (b = targets_rule(p), 1) // targets?
14324 &&
14325 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14326 )
14327 {
14328 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14329 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14330 if (_token == NULL) {
14331 D(p->level--);
14332 return NULL;
14333 }
14334 int _end_lineno = _token->end_lineno;
14335 UNUSED(_end_lineno); // Only used by EXTRA macro
14336 int _end_col_offset = _token->end_col_offset;
14337 UNUSED(_end_col_offset); // Only used by EXTRA macro
14338 _res = _Py_Tuple ( b , Store , EXTRA );
14339 if (_res == NULL && PyErr_Occurred()) {
14340 p->error_indicator = 1;
14341 D(p->level--);
14342 return NULL;
14343 }
14344 goto done;
14345 }
14346 p->mark = _mark;
14347 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14348 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'"));
14349 }
14350 { // '[' targets? ']'
14351 if (p->error_indicator) {
14352 D(p->level--);
14353 return NULL;
14354 }
14355 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14356 Token * _literal;
14357 Token * _literal_1;
14358 void *b;
14359 if (
14360 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14361 &&
14362 (b = targets_rule(p), 1) // targets?
14363 &&
14364 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14365 )
14366 {
14367 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14368 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14369 if (_token == NULL) {
14370 D(p->level--);
14371 return NULL;
14372 }
14373 int _end_lineno = _token->end_lineno;
14374 UNUSED(_end_lineno); // Only used by EXTRA macro
14375 int _end_col_offset = _token->end_col_offset;
14376 UNUSED(_end_col_offset); // Only used by EXTRA macro
14377 _res = _Py_List ( b , Store , EXTRA );
14378 if (_res == NULL && PyErr_Occurred()) {
14379 p->error_indicator = 1;
14380 D(p->level--);
14381 return NULL;
14382 }
14383 goto done;
14384 }
14385 p->mark = _mark;
14386 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14387 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'"));
14388 }
14389 _res = NULL;
14390 done:
14391 D(p->level--);
14392 return _res;
14393}
14394
14395// incorrect_arguments:
14396// | args ',' '*'
14397// | expression for_if_clauses ',' [args | expression for_if_clauses]
14398// | args for_if_clauses
14399// | args ',' expression for_if_clauses
14400// | args ',' args
14401static void *
14402incorrect_arguments_rule(Parser *p)
14403{
14404 D(p->level++);
14405 if (p->error_indicator) {
14406 D(p->level--);
14407 return NULL;
14408 }
14409 void * _res = NULL;
14410 int _mark = p->mark;
14411 { // args ',' '*'
14412 if (p->error_indicator) {
14413 D(p->level--);
14414 return NULL;
14415 }
14416 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
14417 Token * _literal;
14418 Token * _literal_1;
14419 expr_ty args_var;
14420 if (
14421 (args_var = args_rule(p)) // args
14422 &&
14423 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14424 &&
14425 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
14426 )
14427 {
14428 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
14429 _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
14430 if (_res == NULL && PyErr_Occurred()) {
14431 p->error_indicator = 1;
14432 D(p->level--);
14433 return NULL;
14434 }
14435 goto done;
14436 }
14437 p->mark = _mark;
14438 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14439 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'"));
14440 }
14441 { // expression for_if_clauses ',' [args | expression for_if_clauses]
14442 if (p->error_indicator) {
14443 D(p->level--);
14444 return NULL;
14445 }
14446 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14447 Token * _literal;
14448 void *_opt_var;
14449 UNUSED(_opt_var); // Silence compiler warnings
14450 expr_ty a;
14451 asdl_seq* for_if_clauses_var;
14452 if (
14453 (a = expression_rule(p)) // expression
14454 &&
14455 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14456 &&
14457 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14458 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014459 (_opt_var = _tmp_126_rule(p), 1) // [args | expression for_if_clauses]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014460 )
14461 {
14462 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14463 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14464 if (_res == NULL && PyErr_Occurred()) {
14465 p->error_indicator = 1;
14466 D(p->level--);
14467 return NULL;
14468 }
14469 goto done;
14470 }
14471 p->mark = _mark;
14472 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14473 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14474 }
14475 { // args for_if_clauses
14476 if (p->error_indicator) {
14477 D(p->level--);
14478 return NULL;
14479 }
14480 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
14481 expr_ty a;
14482 asdl_seq* for_if_clauses_var;
14483 if (
14484 (a = args_rule(p)) // args
14485 &&
14486 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14487 )
14488 {
14489 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
14490 _res = _PyPegen_nonparen_genexp_in_call ( p , a );
14491 if (_res == NULL && PyErr_Occurred()) {
14492 p->error_indicator = 1;
14493 D(p->level--);
14494 return NULL;
14495 }
14496 goto done;
14497 }
14498 p->mark = _mark;
14499 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14500 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
14501 }
14502 { // args ',' expression for_if_clauses
14503 if (p->error_indicator) {
14504 D(p->level--);
14505 return NULL;
14506 }
14507 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
14508 Token * _literal;
14509 expr_ty a;
14510 expr_ty args_var;
14511 asdl_seq* for_if_clauses_var;
14512 if (
14513 (args_var = args_rule(p)) // args
14514 &&
14515 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14516 &&
14517 (a = expression_rule(p)) // expression
14518 &&
14519 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14520 )
14521 {
14522 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
14523 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14524 if (_res == NULL && PyErr_Occurred()) {
14525 p->error_indicator = 1;
14526 D(p->level--);
14527 return NULL;
14528 }
14529 goto done;
14530 }
14531 p->mark = _mark;
14532 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14533 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
14534 }
14535 { // args ',' args
14536 if (p->error_indicator) {
14537 D(p->level--);
14538 return NULL;
14539 }
14540 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
14541 Token * _literal;
14542 expr_ty a;
14543 expr_ty args_var;
14544 if (
14545 (a = args_rule(p)) // args
14546 &&
14547 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14548 &&
14549 (args_var = args_rule(p)) // args
14550 )
14551 {
14552 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
14553 _res = _PyPegen_arguments_parsing_error ( p , a );
14554 if (_res == NULL && PyErr_Occurred()) {
14555 p->error_indicator = 1;
14556 D(p->level--);
14557 return NULL;
14558 }
14559 goto done;
14560 }
14561 p->mark = _mark;
14562 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14563 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
14564 }
14565 _res = NULL;
14566 done:
14567 D(p->level--);
14568 return _res;
14569}
14570
14571// invalid_kwarg: expression '='
14572static void *
14573invalid_kwarg_rule(Parser *p)
14574{
14575 D(p->level++);
14576 if (p->error_indicator) {
14577 D(p->level--);
14578 return NULL;
14579 }
14580 void * _res = NULL;
14581 int _mark = p->mark;
14582 { // expression '='
14583 if (p->error_indicator) {
14584 D(p->level--);
14585 return NULL;
14586 }
14587 D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='"));
14588 Token * _literal;
14589 expr_ty a;
14590 if (
14591 (a = expression_rule(p)) // expression
14592 &&
14593 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14594 )
14595 {
14596 D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='"));
14597 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" );
14598 if (_res == NULL && PyErr_Occurred()) {
14599 p->error_indicator = 1;
14600 D(p->level--);
14601 return NULL;
14602 }
14603 goto done;
14604 }
14605 p->mark = _mark;
14606 D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
14607 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='"));
14608 }
14609 _res = NULL;
14610 done:
14611 D(p->level--);
14612 return _res;
14613}
14614
14615// invalid_named_expression: expression ':=' expression
14616static void *
14617invalid_named_expression_rule(Parser *p)
14618{
14619 D(p->level++);
14620 if (p->error_indicator) {
14621 D(p->level--);
14622 return NULL;
14623 }
14624 void * _res = NULL;
14625 int _mark = p->mark;
14626 { // expression ':=' expression
14627 if (p->error_indicator) {
14628 D(p->level--);
14629 return NULL;
14630 }
14631 D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14632 Token * _literal;
14633 expr_ty a;
14634 expr_ty expression_var;
14635 if (
14636 (a = expression_rule(p)) // expression
14637 &&
14638 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
14639 &&
14640 (expression_var = expression_rule(p)) // expression
14641 )
14642 {
14643 D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14644 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
14645 if (_res == NULL && PyErr_Occurred()) {
14646 p->error_indicator = 1;
14647 D(p->level--);
14648 return NULL;
14649 }
14650 goto done;
14651 }
14652 p->mark = _mark;
14653 D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
14654 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
14655 }
14656 _res = NULL;
14657 done:
14658 D(p->level--);
14659 return _res;
14660}
14661
14662// invalid_assignment:
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014663// | list ':' expression
14664// | tuple ':' expression
14665// | star_named_expression ',' star_named_expressions* ':' expression
14666// | expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014667// | ((star_targets '='))* star_expressions '='
14668// | ((star_targets '='))* yield_expr '='
14669// | star_expressions augassign (yield_expr | star_expressions)
14670static void *
14671invalid_assignment_rule(Parser *p)
14672{
14673 D(p->level++);
14674 if (p->error_indicator) {
14675 D(p->level--);
14676 return NULL;
14677 }
14678 void * _res = NULL;
14679 int _mark = p->mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014680 { // list ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014681 if (p->error_indicator) {
14682 D(p->level--);
14683 return NULL;
14684 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014685 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014686 Token * _literal;
14687 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014688 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014689 if (
14690 (a = list_rule(p)) // list
14691 &&
14692 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014693 &&
14694 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014695 )
14696 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014697 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014698 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not list) can be annotated" );
14699 if (_res == NULL && PyErr_Occurred()) {
14700 p->error_indicator = 1;
14701 D(p->level--);
14702 return NULL;
14703 }
14704 goto done;
14705 }
14706 p->mark = _mark;
14707 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014708 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014709 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014710 { // tuple ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014711 if (p->error_indicator) {
14712 D(p->level--);
14713 return NULL;
14714 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014715 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014716 Token * _literal;
14717 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014718 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014719 if (
14720 (a = tuple_rule(p)) // tuple
14721 &&
14722 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014723 &&
14724 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014725 )
14726 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014727 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014728 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
14729 if (_res == NULL && PyErr_Occurred()) {
14730 p->error_indicator = 1;
14731 D(p->level--);
14732 return NULL;
14733 }
14734 goto done;
14735 }
14736 p->mark = _mark;
14737 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014738 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014739 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014740 { // star_named_expression ',' star_named_expressions* ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014741 if (p->error_indicator) {
14742 D(p->level--);
14743 return NULL;
14744 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014745 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 +010014746 Token * _literal;
14747 Token * _literal_1;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014748 asdl_seq * _loop0_127_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014749 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014750 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014751 if (
14752 (a = star_named_expression_rule(p)) // star_named_expression
14753 &&
14754 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14755 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014756 (_loop0_127_var = _loop0_127_rule(p)) // star_named_expressions*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014757 &&
14758 (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014759 &&
14760 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014761 )
14762 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014763 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 +010014764 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
14765 if (_res == NULL && PyErr_Occurred()) {
14766 p->error_indicator = 1;
14767 D(p->level--);
14768 return NULL;
14769 }
14770 goto done;
14771 }
14772 p->mark = _mark;
14773 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014774 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014775 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014776 { // expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014777 if (p->error_indicator) {
14778 D(p->level--);
14779 return NULL;
14780 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014781 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014782 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014783 expr_ty a;
14784 expr_ty expression_var;
14785 if (
14786 (a = expression_rule(p)) // expression
14787 &&
14788 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
14789 &&
14790 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014791 )
14792 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014793 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 +010014794 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
14795 if (_res == NULL && PyErr_Occurred()) {
14796 p->error_indicator = 1;
14797 D(p->level--);
14798 return NULL;
14799 }
14800 goto done;
14801 }
14802 p->mark = _mark;
14803 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014804 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014805 }
14806 { // ((star_targets '='))* star_expressions '='
14807 if (p->error_indicator) {
14808 D(p->level--);
14809 return NULL;
14810 }
14811 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14812 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014813 asdl_seq * _loop0_128_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014814 expr_ty a;
14815 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014816 (_loop0_128_var = _loop0_128_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014817 &&
14818 (a = star_expressions_rule(p)) // star_expressions
14819 &&
14820 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14821 )
14822 {
14823 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 +030014824 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014825 if (_res == NULL && PyErr_Occurred()) {
14826 p->error_indicator = 1;
14827 D(p->level--);
14828 return NULL;
14829 }
14830 goto done;
14831 }
14832 p->mark = _mark;
14833 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14834 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14835 }
14836 { // ((star_targets '='))* yield_expr '='
14837 if (p->error_indicator) {
14838 D(p->level--);
14839 return NULL;
14840 }
14841 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14842 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014843 asdl_seq * _loop0_129_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014844 expr_ty a;
14845 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014846 (_loop0_129_var = _loop0_129_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014847 &&
14848 (a = yield_expr_rule(p)) // yield_expr
14849 &&
14850 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14851 )
14852 {
14853 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14854 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
14855 if (_res == NULL && PyErr_Occurred()) {
14856 p->error_indicator = 1;
14857 D(p->level--);
14858 return NULL;
14859 }
14860 goto done;
14861 }
14862 p->mark = _mark;
14863 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14864 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14865 }
14866 { // star_expressions augassign (yield_expr | star_expressions)
14867 if (p->error_indicator) {
14868 D(p->level--);
14869 return NULL;
14870 }
14871 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014872 void *_tmp_130_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014873 expr_ty a;
14874 AugOperator* augassign_var;
14875 if (
14876 (a = star_expressions_rule(p)) // star_expressions
14877 &&
14878 (augassign_var = augassign_rule(p)) // augassign
14879 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014880 (_tmp_130_var = _tmp_130_rule(p)) // yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014881 )
14882 {
14883 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14884 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
14885 if (_res == NULL && PyErr_Occurred()) {
14886 p->error_indicator = 1;
14887 D(p->level--);
14888 return NULL;
14889 }
14890 goto done;
14891 }
14892 p->mark = _mark;
14893 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14894 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14895 }
14896 _res = NULL;
14897 done:
14898 D(p->level--);
14899 return _res;
14900}
14901
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014902// invalid_del_stmt: 'del' star_expressions
14903static void *
14904invalid_del_stmt_rule(Parser *p)
14905{
14906 D(p->level++);
14907 if (p->error_indicator) {
14908 D(p->level--);
14909 return NULL;
14910 }
14911 void * _res = NULL;
14912 int _mark = p->mark;
14913 { // 'del' star_expressions
14914 if (p->error_indicator) {
14915 D(p->level--);
14916 return NULL;
14917 }
14918 D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
14919 Token * _keyword;
14920 expr_ty a;
14921 if (
14922 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
14923 &&
14924 (a = star_expressions_rule(p)) // star_expressions
14925 )
14926 {
14927 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 +030014928 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014929 if (_res == NULL && PyErr_Occurred()) {
14930 p->error_indicator = 1;
14931 D(p->level--);
14932 return NULL;
14933 }
14934 goto done;
14935 }
14936 p->mark = _mark;
14937 D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
14938 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
14939 }
14940 _res = NULL;
14941 done:
14942 D(p->level--);
14943 return _res;
14944}
14945
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014946// invalid_block: NEWLINE !INDENT
14947static void *
14948invalid_block_rule(Parser *p)
14949{
14950 D(p->level++);
14951 if (p->error_indicator) {
14952 D(p->level--);
14953 return NULL;
14954 }
14955 void * _res = NULL;
14956 int _mark = p->mark;
14957 { // NEWLINE !INDENT
14958 if (p->error_indicator) {
14959 D(p->level--);
14960 return NULL;
14961 }
14962 D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
14963 Token * newline_var;
14964 if (
14965 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
14966 &&
14967 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
14968 )
14969 {
14970 D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
14971 _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
14972 if (_res == NULL && PyErr_Occurred()) {
14973 p->error_indicator = 1;
14974 D(p->level--);
14975 return NULL;
14976 }
14977 goto done;
14978 }
14979 p->mark = _mark;
14980 D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
14981 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
14982 }
14983 _res = NULL;
14984 done:
14985 D(p->level--);
14986 return _res;
14987}
14988
14989// invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses
14990static void *
14991invalid_comprehension_rule(Parser *p)
14992{
14993 D(p->level++);
14994 if (p->error_indicator) {
14995 D(p->level--);
14996 return NULL;
14997 }
14998 void * _res = NULL;
14999 int _mark = p->mark;
15000 { // ('[' | '(' | '{') starred_expression for_if_clauses
15001 if (p->error_indicator) {
15002 D(p->level--);
15003 return NULL;
15004 }
15005 D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015006 void *_tmp_131_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015007 expr_ty a;
15008 asdl_seq* for_if_clauses_var;
15009 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015010 (_tmp_131_var = _tmp_131_rule(p)) // '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015011 &&
15012 (a = starred_expression_rule(p)) // starred_expression
15013 &&
15014 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15015 )
15016 {
15017 D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15018 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
15019 if (_res == NULL && PyErr_Occurred()) {
15020 p->error_indicator = 1;
15021 D(p->level--);
15022 return NULL;
15023 }
15024 goto done;
15025 }
15026 p->mark = _mark;
15027 D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15028 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15029 }
15030 _res = NULL;
15031 done:
15032 D(p->level--);
15033 return _res;
15034}
15035
15036// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
15037static void *
15038invalid_dict_comprehension_rule(Parser *p)
15039{
15040 D(p->level++);
15041 if (p->error_indicator) {
15042 D(p->level--);
15043 return NULL;
15044 }
15045 void * _res = NULL;
15046 int _mark = p->mark;
15047 { // '{' '**' bitwise_or for_if_clauses '}'
15048 if (p->error_indicator) {
15049 D(p->level--);
15050 return NULL;
15051 }
15052 D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15053 Token * _literal;
15054 Token * _literal_1;
15055 Token * a;
15056 expr_ty bitwise_or_var;
15057 asdl_seq* for_if_clauses_var;
15058 if (
15059 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
15060 &&
15061 (a = _PyPegen_expect_token(p, 35)) // token='**'
15062 &&
15063 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
15064 &&
15065 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15066 &&
15067 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
15068 )
15069 {
15070 D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15071 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
15072 if (_res == NULL && PyErr_Occurred()) {
15073 p->error_indicator = 1;
15074 D(p->level--);
15075 return NULL;
15076 }
15077 goto done;
15078 }
15079 p->mark = _mark;
15080 D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15081 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15082 }
15083 _res = NULL;
15084 done:
15085 D(p->level--);
15086 return _res;
15087}
15088
15089// invalid_parameters:
15090// | param_no_default* (slash_with_default | param_with_default+) param_no_default
15091static void *
15092invalid_parameters_rule(Parser *p)
15093{
15094 D(p->level++);
15095 if (p->error_indicator) {
15096 D(p->level--);
15097 return NULL;
15098 }
15099 void * _res = NULL;
15100 int _mark = p->mark;
15101 { // param_no_default* (slash_with_default | param_with_default+) param_no_default
15102 if (p->error_indicator) {
15103 D(p->level--);
15104 return NULL;
15105 }
15106 D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015107 asdl_seq * _loop0_132_var;
15108 void *_tmp_133_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015109 arg_ty param_no_default_var;
15110 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015111 (_loop0_132_var = _loop0_132_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015112 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015113 (_tmp_133_var = _tmp_133_rule(p)) // slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015114 &&
15115 (param_no_default_var = param_no_default_rule(p)) // param_no_default
15116 )
15117 {
15118 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"));
15119 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15120 if (_res == NULL && PyErr_Occurred()) {
15121 p->error_indicator = 1;
15122 D(p->level--);
15123 return NULL;
15124 }
15125 goto done;
15126 }
15127 p->mark = _mark;
15128 D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15129 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
15130 }
15131 _res = NULL;
15132 done:
15133 D(p->level--);
15134 return _res;
15135}
15136
15137// invalid_lambda_parameters:
15138// | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15139static void *
15140invalid_lambda_parameters_rule(Parser *p)
15141{
15142 D(p->level++);
15143 if (p->error_indicator) {
15144 D(p->level--);
15145 return NULL;
15146 }
15147 void * _res = NULL;
15148 int _mark = p->mark;
15149 { // lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15150 if (p->error_indicator) {
15151 D(p->level--);
15152 return NULL;
15153 }
15154 D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015155 asdl_seq * _loop0_134_var;
15156 void *_tmp_135_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015157 arg_ty lambda_param_no_default_var;
15158 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015159 (_loop0_134_var = _loop0_134_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015160 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015161 (_tmp_135_var = _tmp_135_rule(p)) // lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015162 &&
15163 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
15164 )
15165 {
15166 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"));
15167 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15168 if (_res == NULL && PyErr_Occurred()) {
15169 p->error_indicator = 1;
15170 D(p->level--);
15171 return NULL;
15172 }
15173 goto done;
15174 }
15175 p->mark = _mark;
15176 D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15177 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
15178 }
15179 _res = NULL;
15180 done:
15181 D(p->level--);
15182 return _res;
15183}
15184
15185// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT
15186static void *
15187invalid_star_etc_rule(Parser *p)
15188{
15189 D(p->level++);
15190 if (p->error_indicator) {
15191 D(p->level--);
15192 return NULL;
15193 }
15194 void * _res = NULL;
15195 int _mark = p->mark;
15196 { // '*' (')' | ',' (')' | '**'))
15197 if (p->error_indicator) {
15198 D(p->level--);
15199 return NULL;
15200 }
15201 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15202 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015203 void *_tmp_136_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015204 if (
15205 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15206 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015207 (_tmp_136_var = _tmp_136_rule(p)) // ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015208 )
15209 {
15210 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15211 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15212 if (_res == NULL && PyErr_Occurred()) {
15213 p->error_indicator = 1;
15214 D(p->level--);
15215 return NULL;
15216 }
15217 goto done;
15218 }
15219 p->mark = _mark;
15220 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15221 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15222 }
15223 { // '*' ',' TYPE_COMMENT
15224 if (p->error_indicator) {
15225 D(p->level--);
15226 return NULL;
15227 }
15228 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15229 Token * _literal;
15230 Token * _literal_1;
15231 Token * type_comment_var;
15232 if (
15233 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15234 &&
15235 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
15236 &&
15237 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15238 )
15239 {
15240 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15241 _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
15242 if (_res == NULL && PyErr_Occurred()) {
15243 p->error_indicator = 1;
15244 D(p->level--);
15245 return NULL;
15246 }
15247 goto done;
15248 }
15249 p->mark = _mark;
15250 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15251 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15252 }
15253 _res = NULL;
15254 done:
15255 D(p->level--);
15256 return _res;
15257}
15258
15259// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**'))
15260static void *
15261invalid_lambda_star_etc_rule(Parser *p)
15262{
15263 D(p->level++);
15264 if (p->error_indicator) {
15265 D(p->level--);
15266 return NULL;
15267 }
15268 void * _res = NULL;
15269 int _mark = p->mark;
15270 { // '*' (':' | ',' (':' | '**'))
15271 if (p->error_indicator) {
15272 D(p->level--);
15273 return NULL;
15274 }
15275 D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15276 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015277 void *_tmp_137_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015278 if (
15279 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15280 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030015281 (_tmp_137_var = _tmp_137_rule(p)) // ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015282 )
15283 {
15284 D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15285 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15286 if (_res == NULL && PyErr_Occurred()) {
15287 p->error_indicator = 1;
15288 D(p->level--);
15289 return NULL;
15290 }
15291 goto done;
15292 }
15293 p->mark = _mark;
15294 D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15295 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15296 }
15297 _res = NULL;
15298 done:
15299 D(p->level--);
15300 return _res;
15301}
15302
15303// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15304static void *
15305invalid_double_type_comments_rule(Parser *p)
15306{
15307 D(p->level++);
15308 if (p->error_indicator) {
15309 D(p->level--);
15310 return NULL;
15311 }
15312 void * _res = NULL;
15313 int _mark = p->mark;
15314 { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15315 if (p->error_indicator) {
15316 D(p->level--);
15317 return NULL;
15318 }
15319 D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15320 Token * indent_var;
15321 Token * newline_var;
15322 Token * newline_var_1;
15323 Token * type_comment_var;
15324 Token * type_comment_var_1;
15325 if (
15326 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15327 &&
15328 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15329 &&
15330 (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15331 &&
15332 (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15333 &&
15334 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
15335 )
15336 {
15337 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"));
15338 _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
15339 if (_res == NULL && PyErr_Occurred()) {
15340 p->error_indicator = 1;
15341 D(p->level--);
15342 return NULL;
15343 }
15344 goto done;
15345 }
15346 p->mark = _mark;
15347 D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
15348 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15349 }
15350 _res = NULL;
15351 done:
15352 D(p->level--);
15353 return _res;
15354}
15355
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015356// invalid_with_item: expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015357static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015358invalid_with_item_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015359{
15360 D(p->level++);
15361 if (p->error_indicator) {
15362 D(p->level--);
15363 return NULL;
15364 }
15365 void * _res = NULL;
15366 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015367 { // expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015368 if (p->error_indicator) {
15369 D(p->level--);
15370 return NULL;
15371 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015372 D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression"));
15373 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015374 expr_ty a;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015375 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015376 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015377 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015378 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015379 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
15380 &&
15381 (a = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015382 )
15383 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015384 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 +030015385 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015386 if (_res == NULL && PyErr_Occurred()) {
15387 p->error_indicator = 1;
15388 D(p->level--);
15389 return NULL;
15390 }
15391 goto done;
15392 }
15393 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015394 D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
15395 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression"));
15396 }
15397 _res = NULL;
15398 done:
15399 D(p->level--);
15400 return _res;
15401}
15402
15403// invalid_for_target: ASYNC? 'for' star_expressions
15404static void *
15405invalid_for_target_rule(Parser *p)
15406{
15407 D(p->level++);
15408 if (p->error_indicator) {
15409 D(p->level--);
15410 return NULL;
15411 }
15412 void * _res = NULL;
15413 int _mark = p->mark;
15414 { // ASYNC? 'for' star_expressions
15415 if (p->error_indicator) {
15416 D(p->level--);
15417 return NULL;
15418 }
15419 D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
15420 Token * _keyword;
15421 void *_opt_var;
15422 UNUSED(_opt_var); // Silence compiler warnings
15423 expr_ty a;
15424 if (
15425 (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
15426 &&
15427 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
15428 &&
15429 (a = star_expressions_rule(p)) // star_expressions
15430 )
15431 {
15432 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 +030015433 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015434 if (_res == NULL && PyErr_Occurred()) {
15435 p->error_indicator = 1;
15436 D(p->level--);
15437 return NULL;
15438 }
15439 goto done;
15440 }
15441 p->mark = _mark;
15442 D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
15443 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions"));
15444 }
15445 _res = NULL;
15446 done:
15447 D(p->level--);
15448 return _res;
15449}
15450
15451// invalid_group: '(' starred_expression ')'
15452static void *
15453invalid_group_rule(Parser *p)
15454{
15455 D(p->level++);
15456 if (p->error_indicator) {
15457 D(p->level--);
15458 return NULL;
15459 }
15460 void * _res = NULL;
15461 int _mark = p->mark;
15462 { // '(' starred_expression ')'
15463 if (p->error_indicator) {
15464 D(p->level--);
15465 return NULL;
15466 }
15467 D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15468 Token * _literal;
15469 Token * _literal_1;
15470 expr_ty a;
15471 if (
15472 (_literal = _PyPegen_expect_token(p, 7)) // token='('
15473 &&
15474 (a = starred_expression_rule(p)) // starred_expression
15475 &&
15476 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
15477 )
15478 {
15479 D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15480 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "can't use starred expression here" );
15481 if (_res == NULL && PyErr_Occurred()) {
15482 p->error_indicator = 1;
15483 D(p->level--);
15484 return NULL;
15485 }
15486 goto done;
15487 }
15488 p->mark = _mark;
15489 D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
15490 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015491 }
15492 _res = NULL;
15493 done:
15494 D(p->level--);
15495 return _res;
15496}
15497
15498// invalid_import_from_targets: import_from_as_names ','
15499static void *
15500invalid_import_from_targets_rule(Parser *p)
15501{
15502 D(p->level++);
15503 if (p->error_indicator) {
15504 D(p->level--);
15505 return NULL;
15506 }
15507 void * _res = NULL;
15508 int _mark = p->mark;
15509 { // import_from_as_names ','
15510 if (p->error_indicator) {
15511 D(p->level--);
15512 return NULL;
15513 }
15514 D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15515 Token * _literal;
15516 asdl_seq* import_from_as_names_var;
15517 if (
15518 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
15519 &&
15520 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15521 )
15522 {
15523 D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15524 _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
15525 if (_res == NULL && PyErr_Occurred()) {
15526 p->error_indicator = 1;
15527 D(p->level--);
15528 return NULL;
15529 }
15530 goto done;
15531 }
15532 p->mark = _mark;
15533 D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
15534 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','"));
15535 }
15536 _res = NULL;
15537 done:
15538 D(p->level--);
15539 return _res;
15540}
15541
15542// _loop0_1: NEWLINE
15543static asdl_seq *
15544_loop0_1_rule(Parser *p)
15545{
15546 D(p->level++);
15547 if (p->error_indicator) {
15548 D(p->level--);
15549 return NULL;
15550 }
15551 void *_res = NULL;
15552 int _mark = p->mark;
15553 int _start_mark = p->mark;
15554 void **_children = PyMem_Malloc(sizeof(void *));
15555 if (!_children) {
15556 p->error_indicator = 1;
15557 PyErr_NoMemory();
15558 D(p->level--);
15559 return NULL;
15560 }
15561 ssize_t _children_capacity = 1;
15562 ssize_t _n = 0;
15563 { // NEWLINE
15564 if (p->error_indicator) {
15565 D(p->level--);
15566 return NULL;
15567 }
15568 D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15569 Token * newline_var;
15570 while (
15571 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15572 )
15573 {
15574 _res = newline_var;
15575 if (_n == _children_capacity) {
15576 _children_capacity *= 2;
15577 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15578 if (!_new_children) {
15579 p->error_indicator = 1;
15580 PyErr_NoMemory();
15581 D(p->level--);
15582 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015583 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015584 _children = _new_children;
15585 }
15586 _children[_n++] = _res;
15587 _mark = p->mark;
15588 }
15589 p->mark = _mark;
15590 D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
15591 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15592 }
15593 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15594 if (!_seq) {
15595 PyMem_Free(_children);
15596 p->error_indicator = 1;
15597 PyErr_NoMemory();
15598 D(p->level--);
15599 return NULL;
15600 }
15601 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15602 PyMem_Free(_children);
15603 _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq);
15604 D(p->level--);
15605 return _seq;
15606}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015607
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015608// _loop0_2: NEWLINE
15609static asdl_seq *
15610_loop0_2_rule(Parser *p)
15611{
15612 D(p->level++);
15613 if (p->error_indicator) {
15614 D(p->level--);
15615 return NULL;
15616 }
15617 void *_res = NULL;
15618 int _mark = p->mark;
15619 int _start_mark = p->mark;
15620 void **_children = PyMem_Malloc(sizeof(void *));
15621 if (!_children) {
15622 p->error_indicator = 1;
15623 PyErr_NoMemory();
15624 D(p->level--);
15625 return NULL;
15626 }
15627 ssize_t _children_capacity = 1;
15628 ssize_t _n = 0;
15629 { // NEWLINE
15630 if (p->error_indicator) {
15631 D(p->level--);
15632 return NULL;
15633 }
15634 D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15635 Token * newline_var;
15636 while (
15637 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15638 )
15639 {
15640 _res = newline_var;
15641 if (_n == _children_capacity) {
15642 _children_capacity *= 2;
15643 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15644 if (!_new_children) {
15645 p->error_indicator = 1;
15646 PyErr_NoMemory();
15647 D(p->level--);
15648 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015649 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015650 _children = _new_children;
15651 }
15652 _children[_n++] = _res;
15653 _mark = p->mark;
15654 }
15655 p->mark = _mark;
15656 D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
15657 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15658 }
15659 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15660 if (!_seq) {
15661 PyMem_Free(_children);
15662 p->error_indicator = 1;
15663 PyErr_NoMemory();
15664 D(p->level--);
15665 return NULL;
15666 }
15667 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15668 PyMem_Free(_children);
15669 _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq);
15670 D(p->level--);
15671 return _seq;
15672}
15673
15674// _loop0_4: ',' expression
15675static asdl_seq *
15676_loop0_4_rule(Parser *p)
15677{
15678 D(p->level++);
15679 if (p->error_indicator) {
15680 D(p->level--);
15681 return NULL;
15682 }
15683 void *_res = NULL;
15684 int _mark = p->mark;
15685 int _start_mark = p->mark;
15686 void **_children = PyMem_Malloc(sizeof(void *));
15687 if (!_children) {
15688 p->error_indicator = 1;
15689 PyErr_NoMemory();
15690 D(p->level--);
15691 return NULL;
15692 }
15693 ssize_t _children_capacity = 1;
15694 ssize_t _n = 0;
15695 { // ',' expression
15696 if (p->error_indicator) {
15697 D(p->level--);
15698 return NULL;
15699 }
15700 D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15701 Token * _literal;
15702 expr_ty elem;
15703 while (
15704 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15705 &&
15706 (elem = expression_rule(p)) // expression
15707 )
15708 {
15709 _res = elem;
15710 if (_res == NULL && PyErr_Occurred()) {
15711 p->error_indicator = 1;
15712 PyMem_Free(_children);
15713 D(p->level--);
15714 return NULL;
15715 }
15716 if (_n == _children_capacity) {
15717 _children_capacity *= 2;
15718 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15719 if (!_new_children) {
15720 p->error_indicator = 1;
15721 PyErr_NoMemory();
15722 D(p->level--);
15723 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015724 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015725 _children = _new_children;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015726 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015727 _children[_n++] = _res;
15728 _mark = p->mark;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015729 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015730 p->mark = _mark;
15731 D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
15732 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015733 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015734 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15735 if (!_seq) {
15736 PyMem_Free(_children);
15737 p->error_indicator = 1;
15738 PyErr_NoMemory();
15739 D(p->level--);
15740 return NULL;
15741 }
15742 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15743 PyMem_Free(_children);
15744 _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
15745 D(p->level--);
15746 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015747}
15748
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015749// _gather_3: expression _loop0_4
15750static asdl_seq *
15751_gather_3_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015752{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015753 D(p->level++);
15754 if (p->error_indicator) {
15755 D(p->level--);
15756 return NULL;
15757 }
15758 asdl_seq * _res = NULL;
15759 int _mark = p->mark;
15760 { // expression _loop0_4
15761 if (p->error_indicator) {
15762 D(p->level--);
15763 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015764 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015765 D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15766 expr_ty elem;
15767 asdl_seq * seq;
15768 if (
15769 (elem = expression_rule(p)) // expression
15770 &&
15771 (seq = _loop0_4_rule(p)) // _loop0_4
15772 )
15773 {
15774 D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15775 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15776 goto done;
15777 }
15778 p->mark = _mark;
15779 D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ',
15780 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015781 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015782 _res = NULL;
15783 done:
15784 D(p->level--);
15785 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015786}
15787
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015788// _loop0_6: ',' expression
15789static asdl_seq *
15790_loop0_6_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015791{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015792 D(p->level++);
15793 if (p->error_indicator) {
15794 D(p->level--);
15795 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015796 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015797 void *_res = NULL;
15798 int _mark = p->mark;
15799 int _start_mark = p->mark;
15800 void **_children = PyMem_Malloc(sizeof(void *));
15801 if (!_children) {
15802 p->error_indicator = 1;
15803 PyErr_NoMemory();
15804 D(p->level--);
15805 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015806 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015807 ssize_t _children_capacity = 1;
15808 ssize_t _n = 0;
15809 { // ',' expression
15810 if (p->error_indicator) {
15811 D(p->level--);
15812 return NULL;
15813 }
15814 D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15815 Token * _literal;
15816 expr_ty elem;
15817 while (
15818 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15819 &&
15820 (elem = expression_rule(p)) // expression
15821 )
15822 {
15823 _res = elem;
15824 if (_res == NULL && PyErr_Occurred()) {
15825 p->error_indicator = 1;
15826 PyMem_Free(_children);
15827 D(p->level--);
15828 return NULL;
15829 }
15830 if (_n == _children_capacity) {
15831 _children_capacity *= 2;
15832 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15833 if (!_new_children) {
15834 p->error_indicator = 1;
15835 PyErr_NoMemory();
15836 D(p->level--);
15837 return NULL;
15838 }
15839 _children = _new_children;
15840 }
15841 _children[_n++] = _res;
15842 _mark = p->mark;
15843 }
15844 p->mark = _mark;
15845 D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
15846 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
15847 }
15848 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15849 if (!_seq) {
15850 PyMem_Free(_children);
15851 p->error_indicator = 1;
15852 PyErr_NoMemory();
15853 D(p->level--);
15854 return NULL;
15855 }
15856 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15857 PyMem_Free(_children);
15858 _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
15859 D(p->level--);
15860 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015861}
15862
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015863// _gather_5: expression _loop0_6
15864static asdl_seq *
15865_gather_5_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015866{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015867 D(p->level++);
15868 if (p->error_indicator) {
15869 D(p->level--);
15870 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015871 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015872 asdl_seq * _res = NULL;
15873 int _mark = p->mark;
15874 { // expression _loop0_6
15875 if (p->error_indicator) {
15876 D(p->level--);
15877 return NULL;
15878 }
15879 D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15880 expr_ty elem;
15881 asdl_seq * seq;
15882 if (
15883 (elem = expression_rule(p)) // expression
15884 &&
15885 (seq = _loop0_6_rule(p)) // _loop0_6
15886 )
15887 {
15888 D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15889 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15890 goto done;
15891 }
15892 p->mark = _mark;
15893 D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ',
15894 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6"));
15895 }
15896 _res = NULL;
15897 done:
15898 D(p->level--);
15899 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015900}
15901
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015902// _loop0_8: ',' expression
15903static asdl_seq *
15904_loop0_8_rule(Parser *p)
15905{
15906 D(p->level++);
15907 if (p->error_indicator) {
15908 D(p->level--);
15909 return NULL;
15910 }
15911 void *_res = NULL;
15912 int _mark = p->mark;
15913 int _start_mark = p->mark;
15914 void **_children = PyMem_Malloc(sizeof(void *));
15915 if (!_children) {
15916 p->error_indicator = 1;
15917 PyErr_NoMemory();
15918 D(p->level--);
15919 return NULL;
15920 }
15921 ssize_t _children_capacity = 1;
15922 ssize_t _n = 0;
15923 { // ',' expression
15924 if (p->error_indicator) {
15925 D(p->level--);
15926 return NULL;
15927 }
15928 D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15929 Token * _literal;
15930 expr_ty elem;
15931 while (
15932 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15933 &&
15934 (elem = expression_rule(p)) // expression
15935 )
15936 {
15937 _res = elem;
15938 if (_res == NULL && PyErr_Occurred()) {
15939 p->error_indicator = 1;
15940 PyMem_Free(_children);
15941 D(p->level--);
15942 return NULL;
15943 }
15944 if (_n == _children_capacity) {
15945 _children_capacity *= 2;
15946 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15947 if (!_new_children) {
15948 p->error_indicator = 1;
15949 PyErr_NoMemory();
15950 D(p->level--);
15951 return NULL;
15952 }
15953 _children = _new_children;
15954 }
15955 _children[_n++] = _res;
15956 _mark = p->mark;
15957 }
15958 p->mark = _mark;
15959 D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
15960 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
15961 }
15962 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15963 if (!_seq) {
15964 PyMem_Free(_children);
15965 p->error_indicator = 1;
15966 PyErr_NoMemory();
15967 D(p->level--);
15968 return NULL;
15969 }
15970 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15971 PyMem_Free(_children);
15972 _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
15973 D(p->level--);
15974 return _seq;
15975}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015976
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015977// _gather_7: expression _loop0_8
15978static asdl_seq *
15979_gather_7_rule(Parser *p)
15980{
15981 D(p->level++);
15982 if (p->error_indicator) {
15983 D(p->level--);
15984 return NULL;
15985 }
15986 asdl_seq * _res = NULL;
15987 int _mark = p->mark;
15988 { // expression _loop0_8
15989 if (p->error_indicator) {
15990 D(p->level--);
15991 return NULL;
15992 }
15993 D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
15994 expr_ty elem;
15995 asdl_seq * seq;
15996 if (
15997 (elem = expression_rule(p)) // expression
15998 &&
15999 (seq = _loop0_8_rule(p)) // _loop0_8
16000 )
16001 {
16002 D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16003 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16004 goto done;
16005 }
16006 p->mark = _mark;
16007 D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ',
16008 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8"));
16009 }
16010 _res = NULL;
16011 done:
16012 D(p->level--);
16013 return _res;
16014}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016015
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016016// _loop0_10: ',' expression
16017static asdl_seq *
16018_loop0_10_rule(Parser *p)
16019{
16020 D(p->level++);
16021 if (p->error_indicator) {
16022 D(p->level--);
16023 return NULL;
16024 }
16025 void *_res = NULL;
16026 int _mark = p->mark;
16027 int _start_mark = p->mark;
16028 void **_children = PyMem_Malloc(sizeof(void *));
16029 if (!_children) {
16030 p->error_indicator = 1;
16031 PyErr_NoMemory();
16032 D(p->level--);
16033 return NULL;
16034 }
16035 ssize_t _children_capacity = 1;
16036 ssize_t _n = 0;
16037 { // ',' expression
16038 if (p->error_indicator) {
16039 D(p->level--);
16040 return NULL;
16041 }
16042 D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
16043 Token * _literal;
16044 expr_ty elem;
16045 while (
16046 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16047 &&
16048 (elem = expression_rule(p)) // expression
16049 )
16050 {
16051 _res = elem;
16052 if (_res == NULL && PyErr_Occurred()) {
16053 p->error_indicator = 1;
16054 PyMem_Free(_children);
16055 D(p->level--);
16056 return NULL;
16057 }
16058 if (_n == _children_capacity) {
16059 _children_capacity *= 2;
16060 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16061 if (!_new_children) {
16062 p->error_indicator = 1;
16063 PyErr_NoMemory();
16064 D(p->level--);
16065 return NULL;
16066 }
16067 _children = _new_children;
16068 }
16069 _children[_n++] = _res;
16070 _mark = p->mark;
16071 }
16072 p->mark = _mark;
16073 D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
16074 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16075 }
16076 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16077 if (!_seq) {
16078 PyMem_Free(_children);
16079 p->error_indicator = 1;
16080 PyErr_NoMemory();
16081 D(p->level--);
16082 return NULL;
16083 }
16084 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16085 PyMem_Free(_children);
16086 _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
16087 D(p->level--);
16088 return _seq;
16089}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016090
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016091// _gather_9: expression _loop0_10
16092static asdl_seq *
16093_gather_9_rule(Parser *p)
16094{
16095 D(p->level++);
16096 if (p->error_indicator) {
16097 D(p->level--);
16098 return NULL;
16099 }
16100 asdl_seq * _res = NULL;
16101 int _mark = p->mark;
16102 { // expression _loop0_10
16103 if (p->error_indicator) {
16104 D(p->level--);
16105 return NULL;
16106 }
16107 D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16108 expr_ty elem;
16109 asdl_seq * seq;
16110 if (
16111 (elem = expression_rule(p)) // expression
16112 &&
16113 (seq = _loop0_10_rule(p)) // _loop0_10
16114 )
16115 {
16116 D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16117 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16118 goto done;
16119 }
16120 p->mark = _mark;
16121 D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ',
16122 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10"));
16123 }
16124 _res = NULL;
16125 done:
16126 D(p->level--);
16127 return _res;
16128}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016129
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016130// _loop1_11: statement
16131static asdl_seq *
16132_loop1_11_rule(Parser *p)
16133{
16134 D(p->level++);
16135 if (p->error_indicator) {
16136 D(p->level--);
16137 return NULL;
16138 }
16139 void *_res = NULL;
16140 int _mark = p->mark;
16141 int _start_mark = p->mark;
16142 void **_children = PyMem_Malloc(sizeof(void *));
16143 if (!_children) {
16144 p->error_indicator = 1;
16145 PyErr_NoMemory();
16146 D(p->level--);
16147 return NULL;
16148 }
16149 ssize_t _children_capacity = 1;
16150 ssize_t _n = 0;
16151 { // statement
16152 if (p->error_indicator) {
16153 D(p->level--);
16154 return NULL;
16155 }
16156 D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
16157 asdl_seq* statement_var;
16158 while (
16159 (statement_var = statement_rule(p)) // statement
16160 )
16161 {
16162 _res = statement_var;
16163 if (_n == _children_capacity) {
16164 _children_capacity *= 2;
16165 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16166 if (!_new_children) {
16167 p->error_indicator = 1;
16168 PyErr_NoMemory();
16169 D(p->level--);
16170 return NULL;
16171 }
16172 _children = _new_children;
16173 }
16174 _children[_n++] = _res;
16175 _mark = p->mark;
16176 }
16177 p->mark = _mark;
16178 D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ',
16179 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
16180 }
16181 if (_n == 0 || p->error_indicator) {
16182 PyMem_Free(_children);
16183 D(p->level--);
16184 return NULL;
16185 }
16186 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16187 if (!_seq) {
16188 PyMem_Free(_children);
16189 p->error_indicator = 1;
16190 PyErr_NoMemory();
16191 D(p->level--);
16192 return NULL;
16193 }
16194 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16195 PyMem_Free(_children);
16196 _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
16197 D(p->level--);
16198 return _seq;
16199}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016200
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016201// _loop0_13: ';' small_stmt
16202static asdl_seq *
16203_loop0_13_rule(Parser *p)
16204{
16205 D(p->level++);
16206 if (p->error_indicator) {
16207 D(p->level--);
16208 return NULL;
16209 }
16210 void *_res = NULL;
16211 int _mark = p->mark;
16212 int _start_mark = p->mark;
16213 void **_children = PyMem_Malloc(sizeof(void *));
16214 if (!_children) {
16215 p->error_indicator = 1;
16216 PyErr_NoMemory();
16217 D(p->level--);
16218 return NULL;
16219 }
16220 ssize_t _children_capacity = 1;
16221 ssize_t _n = 0;
16222 { // ';' small_stmt
16223 if (p->error_indicator) {
16224 D(p->level--);
16225 return NULL;
16226 }
16227 D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt"));
16228 Token * _literal;
16229 stmt_ty elem;
16230 while (
16231 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
16232 &&
16233 (elem = small_stmt_rule(p)) // small_stmt
16234 )
16235 {
16236 _res = elem;
16237 if (_res == NULL && PyErr_Occurred()) {
16238 p->error_indicator = 1;
16239 PyMem_Free(_children);
16240 D(p->level--);
16241 return NULL;
16242 }
16243 if (_n == _children_capacity) {
16244 _children_capacity *= 2;
16245 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16246 if (!_new_children) {
16247 p->error_indicator = 1;
16248 PyErr_NoMemory();
16249 D(p->level--);
16250 return NULL;
16251 }
16252 _children = _new_children;
16253 }
16254 _children[_n++] = _res;
16255 _mark = p->mark;
16256 }
16257 p->mark = _mark;
16258 D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
16259 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt"));
16260 }
16261 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16262 if (!_seq) {
16263 PyMem_Free(_children);
16264 p->error_indicator = 1;
16265 PyErr_NoMemory();
16266 D(p->level--);
16267 return NULL;
16268 }
16269 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16270 PyMem_Free(_children);
16271 _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
16272 D(p->level--);
16273 return _seq;
16274}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016275
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016276// _gather_12: small_stmt _loop0_13
16277static asdl_seq *
16278_gather_12_rule(Parser *p)
16279{
16280 D(p->level++);
16281 if (p->error_indicator) {
16282 D(p->level--);
16283 return NULL;
16284 }
16285 asdl_seq * _res = NULL;
16286 int _mark = p->mark;
16287 { // small_stmt _loop0_13
16288 if (p->error_indicator) {
16289 D(p->level--);
16290 return NULL;
16291 }
16292 D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16293 stmt_ty elem;
16294 asdl_seq * seq;
16295 if (
16296 (elem = small_stmt_rule(p)) // small_stmt
16297 &&
16298 (seq = _loop0_13_rule(p)) // _loop0_13
16299 )
16300 {
16301 D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16302 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16303 goto done;
16304 }
16305 p->mark = _mark;
16306 D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ',
16307 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13"));
16308 }
16309 _res = NULL;
16310 done:
16311 D(p->level--);
16312 return _res;
16313}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016314
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016315// _tmp_14: 'import' | 'from'
16316static void *
16317_tmp_14_rule(Parser *p)
16318{
16319 D(p->level++);
16320 if (p->error_indicator) {
16321 D(p->level--);
16322 return NULL;
16323 }
16324 void * _res = NULL;
16325 int _mark = p->mark;
16326 { // 'import'
16327 if (p->error_indicator) {
16328 D(p->level--);
16329 return NULL;
16330 }
16331 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
16332 Token * _keyword;
16333 if (
16334 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
16335 )
16336 {
16337 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
16338 _res = _keyword;
16339 goto done;
16340 }
16341 p->mark = _mark;
16342 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16343 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
16344 }
16345 { // 'from'
16346 if (p->error_indicator) {
16347 D(p->level--);
16348 return NULL;
16349 }
16350 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
16351 Token * _keyword;
16352 if (
16353 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
16354 )
16355 {
16356 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
16357 _res = _keyword;
16358 goto done;
16359 }
16360 p->mark = _mark;
16361 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16362 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
16363 }
16364 _res = NULL;
16365 done:
16366 D(p->level--);
16367 return _res;
16368}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016369
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016370// _tmp_15: 'def' | '@' | ASYNC
16371static void *
16372_tmp_15_rule(Parser *p)
16373{
16374 D(p->level++);
16375 if (p->error_indicator) {
16376 D(p->level--);
16377 return NULL;
16378 }
16379 void * _res = NULL;
16380 int _mark = p->mark;
16381 { // 'def'
16382 if (p->error_indicator) {
16383 D(p->level--);
16384 return NULL;
16385 }
16386 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
16387 Token * _keyword;
16388 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016389 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016390 )
16391 {
16392 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
16393 _res = _keyword;
16394 goto done;
16395 }
16396 p->mark = _mark;
16397 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16398 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
16399 }
16400 { // '@'
16401 if (p->error_indicator) {
16402 D(p->level--);
16403 return NULL;
16404 }
16405 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16406 Token * _literal;
16407 if (
16408 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16409 )
16410 {
16411 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16412 _res = _literal;
16413 goto done;
16414 }
16415 p->mark = _mark;
16416 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16417 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16418 }
16419 { // ASYNC
16420 if (p->error_indicator) {
16421 D(p->level--);
16422 return NULL;
16423 }
16424 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16425 Token * async_var;
16426 if (
16427 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16428 )
16429 {
16430 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16431 _res = async_var;
16432 goto done;
16433 }
16434 p->mark = _mark;
16435 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16436 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16437 }
16438 _res = NULL;
16439 done:
16440 D(p->level--);
16441 return _res;
16442}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016443
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016444// _tmp_16: 'class' | '@'
16445static void *
16446_tmp_16_rule(Parser *p)
16447{
16448 D(p->level++);
16449 if (p->error_indicator) {
16450 D(p->level--);
16451 return NULL;
16452 }
16453 void * _res = NULL;
16454 int _mark = p->mark;
16455 { // 'class'
16456 if (p->error_indicator) {
16457 D(p->level--);
16458 return NULL;
16459 }
16460 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
16461 Token * _keyword;
16462 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016463 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016464 )
16465 {
16466 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
16467 _res = _keyword;
16468 goto done;
16469 }
16470 p->mark = _mark;
16471 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16472 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
16473 }
16474 { // '@'
16475 if (p->error_indicator) {
16476 D(p->level--);
16477 return NULL;
16478 }
16479 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16480 Token * _literal;
16481 if (
16482 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16483 )
16484 {
16485 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16486 _res = _literal;
16487 goto done;
16488 }
16489 p->mark = _mark;
16490 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16491 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16492 }
16493 _res = NULL;
16494 done:
16495 D(p->level--);
16496 return _res;
16497}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016498
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016499// _tmp_17: 'with' | ASYNC
16500static void *
16501_tmp_17_rule(Parser *p)
16502{
16503 D(p->level++);
16504 if (p->error_indicator) {
16505 D(p->level--);
16506 return NULL;
16507 }
16508 void * _res = NULL;
16509 int _mark = p->mark;
16510 { // 'with'
16511 if (p->error_indicator) {
16512 D(p->level--);
16513 return NULL;
16514 }
16515 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
16516 Token * _keyword;
16517 if (
16518 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
16519 )
16520 {
16521 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
16522 _res = _keyword;
16523 goto done;
16524 }
16525 p->mark = _mark;
16526 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16527 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
16528 }
16529 { // ASYNC
16530 if (p->error_indicator) {
16531 D(p->level--);
16532 return NULL;
16533 }
16534 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16535 Token * async_var;
16536 if (
16537 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16538 )
16539 {
16540 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16541 _res = async_var;
16542 goto done;
16543 }
16544 p->mark = _mark;
16545 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16546 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16547 }
16548 _res = NULL;
16549 done:
16550 D(p->level--);
16551 return _res;
16552}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016553
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016554// _tmp_18: 'for' | ASYNC
16555static void *
16556_tmp_18_rule(Parser *p)
16557{
16558 D(p->level++);
16559 if (p->error_indicator) {
16560 D(p->level--);
16561 return NULL;
16562 }
16563 void * _res = NULL;
16564 int _mark = p->mark;
16565 { // 'for'
16566 if (p->error_indicator) {
16567 D(p->level--);
16568 return NULL;
16569 }
16570 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
16571 Token * _keyword;
16572 if (
16573 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
16574 )
16575 {
16576 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
16577 _res = _keyword;
16578 goto done;
16579 }
16580 p->mark = _mark;
16581 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16582 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
16583 }
16584 { // ASYNC
16585 if (p->error_indicator) {
16586 D(p->level--);
16587 return NULL;
16588 }
16589 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16590 Token * async_var;
16591 if (
16592 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16593 )
16594 {
16595 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16596 _res = async_var;
16597 goto done;
16598 }
16599 p->mark = _mark;
16600 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16601 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16602 }
16603 _res = NULL;
16604 done:
16605 D(p->level--);
16606 return _res;
16607}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016608
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016609// _tmp_19: '=' annotated_rhs
16610static void *
16611_tmp_19_rule(Parser *p)
16612{
16613 D(p->level++);
16614 if (p->error_indicator) {
16615 D(p->level--);
16616 return NULL;
16617 }
16618 void * _res = NULL;
16619 int _mark = p->mark;
16620 { // '=' annotated_rhs
16621 if (p->error_indicator) {
16622 D(p->level--);
16623 return NULL;
16624 }
16625 D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16626 Token * _literal;
16627 expr_ty d;
16628 if (
16629 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16630 &&
16631 (d = annotated_rhs_rule(p)) // annotated_rhs
16632 )
16633 {
16634 D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16635 _res = d;
16636 if (_res == NULL && PyErr_Occurred()) {
16637 p->error_indicator = 1;
16638 D(p->level--);
16639 return NULL;
16640 }
16641 goto done;
16642 }
16643 p->mark = _mark;
16644 D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ',
16645 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16646 }
16647 _res = NULL;
16648 done:
16649 D(p->level--);
16650 return _res;
16651}
16652
16653// _tmp_20: '(' single_target ')' | single_subscript_attribute_target
16654static void *
16655_tmp_20_rule(Parser *p)
16656{
16657 D(p->level++);
16658 if (p->error_indicator) {
16659 D(p->level--);
16660 return NULL;
16661 }
16662 void * _res = NULL;
16663 int _mark = p->mark;
16664 { // '(' single_target ')'
16665 if (p->error_indicator) {
16666 D(p->level--);
16667 return NULL;
16668 }
16669 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16670 Token * _literal;
16671 Token * _literal_1;
16672 expr_ty b;
16673 if (
16674 (_literal = _PyPegen_expect_token(p, 7)) // token='('
16675 &&
16676 (b = single_target_rule(p)) // single_target
16677 &&
16678 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
16679 )
16680 {
16681 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16682 _res = b;
16683 if (_res == NULL && PyErr_Occurred()) {
16684 p->error_indicator = 1;
16685 D(p->level--);
16686 return NULL;
16687 }
16688 goto done;
16689 }
16690 p->mark = _mark;
16691 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16692 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
16693 }
16694 { // single_subscript_attribute_target
16695 if (p->error_indicator) {
16696 D(p->level--);
16697 return NULL;
16698 }
16699 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16700 expr_ty single_subscript_attribute_target_var;
16701 if (
16702 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
16703 )
16704 {
16705 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16706 _res = single_subscript_attribute_target_var;
16707 goto done;
16708 }
16709 p->mark = _mark;
16710 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16711 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
16712 }
16713 _res = NULL;
16714 done:
16715 D(p->level--);
16716 return _res;
16717}
16718
16719// _tmp_21: '=' annotated_rhs
16720static void *
16721_tmp_21_rule(Parser *p)
16722{
16723 D(p->level++);
16724 if (p->error_indicator) {
16725 D(p->level--);
16726 return NULL;
16727 }
16728 void * _res = NULL;
16729 int _mark = p->mark;
16730 { // '=' annotated_rhs
16731 if (p->error_indicator) {
16732 D(p->level--);
16733 return NULL;
16734 }
16735 D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16736 Token * _literal;
16737 expr_ty d;
16738 if (
16739 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16740 &&
16741 (d = annotated_rhs_rule(p)) // annotated_rhs
16742 )
16743 {
16744 D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16745 _res = d;
16746 if (_res == NULL && PyErr_Occurred()) {
16747 p->error_indicator = 1;
16748 D(p->level--);
16749 return NULL;
16750 }
16751 goto done;
16752 }
16753 p->mark = _mark;
16754 D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ',
16755 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16756 }
16757 _res = NULL;
16758 done:
16759 D(p->level--);
16760 return _res;
16761}
16762
16763// _loop1_22: (star_targets '=')
16764static asdl_seq *
16765_loop1_22_rule(Parser *p)
16766{
16767 D(p->level++);
16768 if (p->error_indicator) {
16769 D(p->level--);
16770 return NULL;
16771 }
16772 void *_res = NULL;
16773 int _mark = p->mark;
16774 int _start_mark = p->mark;
16775 void **_children = PyMem_Malloc(sizeof(void *));
16776 if (!_children) {
16777 p->error_indicator = 1;
16778 PyErr_NoMemory();
16779 D(p->level--);
16780 return NULL;
16781 }
16782 ssize_t _children_capacity = 1;
16783 ssize_t _n = 0;
16784 { // (star_targets '=')
16785 if (p->error_indicator) {
16786 D(p->level--);
16787 return NULL;
16788 }
16789 D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030016790 void *_tmp_138_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016791 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030016792 (_tmp_138_var = _tmp_138_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016793 )
16794 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030016795 _res = _tmp_138_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016796 if (_n == _children_capacity) {
16797 _children_capacity *= 2;
16798 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16799 if (!_new_children) {
16800 p->error_indicator = 1;
16801 PyErr_NoMemory();
16802 D(p->level--);
16803 return NULL;
16804 }
16805 _children = _new_children;
16806 }
16807 _children[_n++] = _res;
16808 _mark = p->mark;
16809 }
16810 p->mark = _mark;
16811 D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ',
16812 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
16813 }
16814 if (_n == 0 || p->error_indicator) {
16815 PyMem_Free(_children);
16816 D(p->level--);
16817 return NULL;
16818 }
16819 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16820 if (!_seq) {
16821 PyMem_Free(_children);
16822 p->error_indicator = 1;
16823 PyErr_NoMemory();
16824 D(p->level--);
16825 return NULL;
16826 }
16827 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16828 PyMem_Free(_children);
16829 _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
16830 D(p->level--);
16831 return _seq;
16832}
16833
16834// _tmp_23: yield_expr | star_expressions
16835static void *
16836_tmp_23_rule(Parser *p)
16837{
16838 D(p->level++);
16839 if (p->error_indicator) {
16840 D(p->level--);
16841 return NULL;
16842 }
16843 void * _res = NULL;
16844 int _mark = p->mark;
16845 { // yield_expr
16846 if (p->error_indicator) {
16847 D(p->level--);
16848 return NULL;
16849 }
16850 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16851 expr_ty yield_expr_var;
16852 if (
16853 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16854 )
16855 {
16856 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16857 _res = yield_expr_var;
16858 goto done;
16859 }
16860 p->mark = _mark;
16861 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16862 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16863 }
16864 { // star_expressions
16865 if (p->error_indicator) {
16866 D(p->level--);
16867 return NULL;
16868 }
16869 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16870 expr_ty star_expressions_var;
16871 if (
16872 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16873 )
16874 {
16875 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16876 _res = star_expressions_var;
16877 goto done;
16878 }
16879 p->mark = _mark;
16880 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16881 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16882 }
16883 _res = NULL;
16884 done:
16885 D(p->level--);
16886 return _res;
16887}
16888
16889// _tmp_24: yield_expr | star_expressions
16890static void *
16891_tmp_24_rule(Parser *p)
16892{
16893 D(p->level++);
16894 if (p->error_indicator) {
16895 D(p->level--);
16896 return NULL;
16897 }
16898 void * _res = NULL;
16899 int _mark = p->mark;
16900 { // yield_expr
16901 if (p->error_indicator) {
16902 D(p->level--);
16903 return NULL;
16904 }
16905 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16906 expr_ty yield_expr_var;
16907 if (
16908 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16909 )
16910 {
16911 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16912 _res = yield_expr_var;
16913 goto done;
16914 }
16915 p->mark = _mark;
16916 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16917 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16918 }
16919 { // star_expressions
16920 if (p->error_indicator) {
16921 D(p->level--);
16922 return NULL;
16923 }
16924 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16925 expr_ty star_expressions_var;
16926 if (
16927 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16928 )
16929 {
16930 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16931 _res = star_expressions_var;
16932 goto done;
16933 }
16934 p->mark = _mark;
16935 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16936 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16937 }
16938 _res = NULL;
16939 done:
16940 D(p->level--);
16941 return _res;
16942}
16943
16944// _loop0_26: ',' NAME
16945static asdl_seq *
16946_loop0_26_rule(Parser *p)
16947{
16948 D(p->level++);
16949 if (p->error_indicator) {
16950 D(p->level--);
16951 return NULL;
16952 }
16953 void *_res = NULL;
16954 int _mark = p->mark;
16955 int _start_mark = p->mark;
16956 void **_children = PyMem_Malloc(sizeof(void *));
16957 if (!_children) {
16958 p->error_indicator = 1;
16959 PyErr_NoMemory();
16960 D(p->level--);
16961 return NULL;
16962 }
16963 ssize_t _children_capacity = 1;
16964 ssize_t _n = 0;
16965 { // ',' NAME
16966 if (p->error_indicator) {
16967 D(p->level--);
16968 return NULL;
16969 }
16970 D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
16971 Token * _literal;
16972 expr_ty elem;
16973 while (
16974 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16975 &&
16976 (elem = _PyPegen_name_token(p)) // NAME
16977 )
16978 {
16979 _res = elem;
16980 if (_res == NULL && PyErr_Occurred()) {
16981 p->error_indicator = 1;
16982 PyMem_Free(_children);
16983 D(p->level--);
16984 return NULL;
16985 }
16986 if (_n == _children_capacity) {
16987 _children_capacity *= 2;
16988 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16989 if (!_new_children) {
16990 p->error_indicator = 1;
16991 PyErr_NoMemory();
16992 D(p->level--);
16993 return NULL;
16994 }
16995 _children = _new_children;
16996 }
16997 _children[_n++] = _res;
16998 _mark = p->mark;
16999 }
17000 p->mark = _mark;
17001 D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
17002 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17003 }
17004 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17005 if (!_seq) {
17006 PyMem_Free(_children);
17007 p->error_indicator = 1;
17008 PyErr_NoMemory();
17009 D(p->level--);
17010 return NULL;
17011 }
17012 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17013 PyMem_Free(_children);
17014 _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
17015 D(p->level--);
17016 return _seq;
17017}
17018
17019// _gather_25: NAME _loop0_26
17020static asdl_seq *
17021_gather_25_rule(Parser *p)
17022{
17023 D(p->level++);
17024 if (p->error_indicator) {
17025 D(p->level--);
17026 return NULL;
17027 }
17028 asdl_seq * _res = NULL;
17029 int _mark = p->mark;
17030 { // NAME _loop0_26
17031 if (p->error_indicator) {
17032 D(p->level--);
17033 return NULL;
17034 }
17035 D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17036 expr_ty elem;
17037 asdl_seq * seq;
17038 if (
17039 (elem = _PyPegen_name_token(p)) // NAME
17040 &&
17041 (seq = _loop0_26_rule(p)) // _loop0_26
17042 )
17043 {
17044 D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17045 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17046 goto done;
17047 }
17048 p->mark = _mark;
17049 D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ',
17050 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26"));
17051 }
17052 _res = NULL;
17053 done:
17054 D(p->level--);
17055 return _res;
17056}
17057
17058// _loop0_28: ',' NAME
17059static asdl_seq *
17060_loop0_28_rule(Parser *p)
17061{
17062 D(p->level++);
17063 if (p->error_indicator) {
17064 D(p->level--);
17065 return NULL;
17066 }
17067 void *_res = NULL;
17068 int _mark = p->mark;
17069 int _start_mark = p->mark;
17070 void **_children = PyMem_Malloc(sizeof(void *));
17071 if (!_children) {
17072 p->error_indicator = 1;
17073 PyErr_NoMemory();
17074 D(p->level--);
17075 return NULL;
17076 }
17077 ssize_t _children_capacity = 1;
17078 ssize_t _n = 0;
17079 { // ',' NAME
17080 if (p->error_indicator) {
17081 D(p->level--);
17082 return NULL;
17083 }
17084 D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17085 Token * _literal;
17086 expr_ty elem;
17087 while (
17088 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17089 &&
17090 (elem = _PyPegen_name_token(p)) // NAME
17091 )
17092 {
17093 _res = elem;
17094 if (_res == NULL && PyErr_Occurred()) {
17095 p->error_indicator = 1;
17096 PyMem_Free(_children);
17097 D(p->level--);
17098 return NULL;
17099 }
17100 if (_n == _children_capacity) {
17101 _children_capacity *= 2;
17102 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17103 if (!_new_children) {
17104 p->error_indicator = 1;
17105 PyErr_NoMemory();
17106 D(p->level--);
17107 return NULL;
17108 }
17109 _children = _new_children;
17110 }
17111 _children[_n++] = _res;
17112 _mark = p->mark;
17113 }
17114 p->mark = _mark;
17115 D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
17116 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17117 }
17118 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17119 if (!_seq) {
17120 PyMem_Free(_children);
17121 p->error_indicator = 1;
17122 PyErr_NoMemory();
17123 D(p->level--);
17124 return NULL;
17125 }
17126 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17127 PyMem_Free(_children);
17128 _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
17129 D(p->level--);
17130 return _seq;
17131}
17132
17133// _gather_27: NAME _loop0_28
17134static asdl_seq *
17135_gather_27_rule(Parser *p)
17136{
17137 D(p->level++);
17138 if (p->error_indicator) {
17139 D(p->level--);
17140 return NULL;
17141 }
17142 asdl_seq * _res = NULL;
17143 int _mark = p->mark;
17144 { // NAME _loop0_28
17145 if (p->error_indicator) {
17146 D(p->level--);
17147 return NULL;
17148 }
17149 D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17150 expr_ty elem;
17151 asdl_seq * seq;
17152 if (
17153 (elem = _PyPegen_name_token(p)) // NAME
17154 &&
17155 (seq = _loop0_28_rule(p)) // _loop0_28
17156 )
17157 {
17158 D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17159 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17160 goto done;
17161 }
17162 p->mark = _mark;
17163 D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ',
17164 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28"));
17165 }
17166 _res = NULL;
17167 done:
17168 D(p->level--);
17169 return _res;
17170}
17171
17172// _tmp_29: ',' expression
17173static void *
17174_tmp_29_rule(Parser *p)
17175{
17176 D(p->level++);
17177 if (p->error_indicator) {
17178 D(p->level--);
17179 return NULL;
17180 }
17181 void * _res = NULL;
17182 int _mark = p->mark;
17183 { // ',' expression
17184 if (p->error_indicator) {
17185 D(p->level--);
17186 return NULL;
17187 }
17188 D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
17189 Token * _literal;
17190 expr_ty z;
17191 if (
17192 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17193 &&
17194 (z = expression_rule(p)) // expression
17195 )
17196 {
17197 D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
17198 _res = z;
17199 if (_res == NULL && PyErr_Occurred()) {
17200 p->error_indicator = 1;
17201 D(p->level--);
17202 return NULL;
17203 }
17204 goto done;
17205 }
17206 p->mark = _mark;
17207 D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ',
17208 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
17209 }
17210 _res = NULL;
17211 done:
17212 D(p->level--);
17213 return _res;
17214}
17215
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017216// _tmp_30: ';' | NEWLINE
17217static void *
17218_tmp_30_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017219{
17220 D(p->level++);
17221 if (p->error_indicator) {
17222 D(p->level--);
17223 return NULL;
17224 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017225 void * _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017226 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017227 { // ';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017228 if (p->error_indicator) {
17229 D(p->level--);
17230 return NULL;
17231 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017232 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
17233 Token * _literal;
17234 if (
17235 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017236 )
17237 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017238 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
17239 _res = _literal;
17240 goto done;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017241 }
17242 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017243 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17244 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017245 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017246 { // NEWLINE
17247 if (p->error_indicator) {
17248 D(p->level--);
17249 return NULL;
17250 }
17251 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17252 Token * newline_var;
17253 if (
17254 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
17255 )
17256 {
17257 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17258 _res = newline_var;
17259 goto done;
17260 }
17261 p->mark = _mark;
17262 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17263 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017264 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017265 _res = NULL;
17266 done:
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017267 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017268 return _res;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017269}
17270
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017271// _loop0_31: ('.' | '...')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017272static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017273_loop0_31_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017274{
17275 D(p->level++);
17276 if (p->error_indicator) {
17277 D(p->level--);
17278 return NULL;
17279 }
17280 void *_res = NULL;
17281 int _mark = p->mark;
17282 int _start_mark = p->mark;
17283 void **_children = PyMem_Malloc(sizeof(void *));
17284 if (!_children) {
17285 p->error_indicator = 1;
17286 PyErr_NoMemory();
17287 D(p->level--);
17288 return NULL;
17289 }
17290 ssize_t _children_capacity = 1;
17291 ssize_t _n = 0;
17292 { // ('.' | '...')
17293 if (p->error_indicator) {
17294 D(p->level--);
17295 return NULL;
17296 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017297 D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017298 void *_tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017299 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017300 (_tmp_139_var = _tmp_139_rule(p)) // '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017301 )
17302 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017303 _res = _tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017304 if (_n == _children_capacity) {
17305 _children_capacity *= 2;
17306 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17307 if (!_new_children) {
17308 p->error_indicator = 1;
17309 PyErr_NoMemory();
17310 D(p->level--);
17311 return NULL;
17312 }
17313 _children = _new_children;
17314 }
17315 _children[_n++] = _res;
17316 _mark = p->mark;
17317 }
17318 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017319 D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
17320 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17321 }
17322 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17323 if (!_seq) {
17324 PyMem_Free(_children);
17325 p->error_indicator = 1;
17326 PyErr_NoMemory();
17327 D(p->level--);
17328 return NULL;
17329 }
17330 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17331 PyMem_Free(_children);
17332 _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
17333 D(p->level--);
17334 return _seq;
17335}
17336
17337// _loop1_32: ('.' | '...')
17338static asdl_seq *
17339_loop1_32_rule(Parser *p)
17340{
17341 D(p->level++);
17342 if (p->error_indicator) {
17343 D(p->level--);
17344 return NULL;
17345 }
17346 void *_res = NULL;
17347 int _mark = p->mark;
17348 int _start_mark = p->mark;
17349 void **_children = PyMem_Malloc(sizeof(void *));
17350 if (!_children) {
17351 p->error_indicator = 1;
17352 PyErr_NoMemory();
17353 D(p->level--);
17354 return NULL;
17355 }
17356 ssize_t _children_capacity = 1;
17357 ssize_t _n = 0;
17358 { // ('.' | '...')
17359 if (p->error_indicator) {
17360 D(p->level--);
17361 return NULL;
17362 }
17363 D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017364 void *_tmp_140_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017365 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017366 (_tmp_140_var = _tmp_140_rule(p)) // '.' | '...'
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017367 )
17368 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030017369 _res = _tmp_140_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017370 if (_n == _children_capacity) {
17371 _children_capacity *= 2;
17372 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17373 if (!_new_children) {
17374 p->error_indicator = 1;
17375 PyErr_NoMemory();
17376 D(p->level--);
17377 return NULL;
17378 }
17379 _children = _new_children;
17380 }
17381 _children[_n++] = _res;
17382 _mark = p->mark;
17383 }
17384 p->mark = _mark;
17385 D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017386 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17387 }
17388 if (_n == 0 || p->error_indicator) {
17389 PyMem_Free(_children);
17390 D(p->level--);
17391 return NULL;
17392 }
17393 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17394 if (!_seq) {
17395 PyMem_Free(_children);
17396 p->error_indicator = 1;
17397 PyErr_NoMemory();
17398 D(p->level--);
17399 return NULL;
17400 }
17401 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17402 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017403 _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017404 D(p->level--);
17405 return _seq;
17406}
17407
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017408// _loop0_34: ',' import_from_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017409static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017410_loop0_34_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017411{
17412 D(p->level++);
17413 if (p->error_indicator) {
17414 D(p->level--);
17415 return NULL;
17416 }
17417 void *_res = NULL;
17418 int _mark = p->mark;
17419 int _start_mark = p->mark;
17420 void **_children = PyMem_Malloc(sizeof(void *));
17421 if (!_children) {
17422 p->error_indicator = 1;
17423 PyErr_NoMemory();
17424 D(p->level--);
17425 return NULL;
17426 }
17427 ssize_t _children_capacity = 1;
17428 ssize_t _n = 0;
17429 { // ',' import_from_as_name
17430 if (p->error_indicator) {
17431 D(p->level--);
17432 return NULL;
17433 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017434 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 +010017435 Token * _literal;
17436 alias_ty elem;
17437 while (
17438 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17439 &&
17440 (elem = import_from_as_name_rule(p)) // import_from_as_name
17441 )
17442 {
17443 _res = elem;
17444 if (_res == NULL && PyErr_Occurred()) {
17445 p->error_indicator = 1;
17446 PyMem_Free(_children);
17447 D(p->level--);
17448 return NULL;
17449 }
17450 if (_n == _children_capacity) {
17451 _children_capacity *= 2;
17452 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17453 if (!_new_children) {
17454 p->error_indicator = 1;
17455 PyErr_NoMemory();
17456 D(p->level--);
17457 return NULL;
17458 }
17459 _children = _new_children;
17460 }
17461 _children[_n++] = _res;
17462 _mark = p->mark;
17463 }
17464 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017465 D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017466 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
17467 }
17468 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17469 if (!_seq) {
17470 PyMem_Free(_children);
17471 p->error_indicator = 1;
17472 PyErr_NoMemory();
17473 D(p->level--);
17474 return NULL;
17475 }
17476 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17477 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017478 _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017479 D(p->level--);
17480 return _seq;
17481}
17482
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017483// _gather_33: import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017484static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017485_gather_33_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017486{
17487 D(p->level++);
17488 if (p->error_indicator) {
17489 D(p->level--);
17490 return NULL;
17491 }
17492 asdl_seq * _res = NULL;
17493 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017494 { // import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017495 if (p->error_indicator) {
17496 D(p->level--);
17497 return NULL;
17498 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017499 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 +010017500 alias_ty elem;
17501 asdl_seq * seq;
17502 if (
17503 (elem = import_from_as_name_rule(p)) // import_from_as_name
17504 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017505 (seq = _loop0_34_rule(p)) // _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017506 )
17507 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017508 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 +010017509 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17510 goto done;
17511 }
17512 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017513 D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ',
17514 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017515 }
17516 _res = NULL;
17517 done:
17518 D(p->level--);
17519 return _res;
17520}
17521
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017522// _tmp_35: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017523static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017524_tmp_35_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017525{
17526 D(p->level++);
17527 if (p->error_indicator) {
17528 D(p->level--);
17529 return NULL;
17530 }
17531 void * _res = NULL;
17532 int _mark = p->mark;
17533 { // 'as' NAME
17534 if (p->error_indicator) {
17535 D(p->level--);
17536 return NULL;
17537 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017538 D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017539 Token * _keyword;
17540 expr_ty z;
17541 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017542 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017543 &&
17544 (z = _PyPegen_name_token(p)) // NAME
17545 )
17546 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017547 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 +010017548 _res = z;
17549 if (_res == NULL && PyErr_Occurred()) {
17550 p->error_indicator = 1;
17551 D(p->level--);
17552 return NULL;
17553 }
17554 goto done;
17555 }
17556 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017557 D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017558 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17559 }
17560 _res = NULL;
17561 done:
17562 D(p->level--);
17563 return _res;
17564}
17565
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017566// _loop0_37: ',' dotted_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017567static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017568_loop0_37_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017569{
17570 D(p->level++);
17571 if (p->error_indicator) {
17572 D(p->level--);
17573 return NULL;
17574 }
17575 void *_res = NULL;
17576 int _mark = p->mark;
17577 int _start_mark = p->mark;
17578 void **_children = PyMem_Malloc(sizeof(void *));
17579 if (!_children) {
17580 p->error_indicator = 1;
17581 PyErr_NoMemory();
17582 D(p->level--);
17583 return NULL;
17584 }
17585 ssize_t _children_capacity = 1;
17586 ssize_t _n = 0;
17587 { // ',' dotted_as_name
17588 if (p->error_indicator) {
17589 D(p->level--);
17590 return NULL;
17591 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017592 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 +010017593 Token * _literal;
17594 alias_ty elem;
17595 while (
17596 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17597 &&
17598 (elem = dotted_as_name_rule(p)) // dotted_as_name
17599 )
17600 {
17601 _res = elem;
17602 if (_res == NULL && PyErr_Occurred()) {
17603 p->error_indicator = 1;
17604 PyMem_Free(_children);
17605 D(p->level--);
17606 return NULL;
17607 }
17608 if (_n == _children_capacity) {
17609 _children_capacity *= 2;
17610 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17611 if (!_new_children) {
17612 p->error_indicator = 1;
17613 PyErr_NoMemory();
17614 D(p->level--);
17615 return NULL;
17616 }
17617 _children = _new_children;
17618 }
17619 _children[_n++] = _res;
17620 _mark = p->mark;
17621 }
17622 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017623 D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017624 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
17625 }
17626 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17627 if (!_seq) {
17628 PyMem_Free(_children);
17629 p->error_indicator = 1;
17630 PyErr_NoMemory();
17631 D(p->level--);
17632 return NULL;
17633 }
17634 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17635 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017636 _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017637 D(p->level--);
17638 return _seq;
17639}
17640
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017641// _gather_36: dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017642static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017643_gather_36_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017644{
17645 D(p->level++);
17646 if (p->error_indicator) {
17647 D(p->level--);
17648 return NULL;
17649 }
17650 asdl_seq * _res = NULL;
17651 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017652 { // dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017653 if (p->error_indicator) {
17654 D(p->level--);
17655 return NULL;
17656 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017657 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 +010017658 alias_ty elem;
17659 asdl_seq * seq;
17660 if (
17661 (elem = dotted_as_name_rule(p)) // dotted_as_name
17662 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017663 (seq = _loop0_37_rule(p)) // _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017664 )
17665 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017666 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 +010017667 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17668 goto done;
17669 }
17670 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017671 D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ',
17672 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017673 }
17674 _res = NULL;
17675 done:
17676 D(p->level--);
17677 return _res;
17678}
17679
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017680// _tmp_38: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017681static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017682_tmp_38_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017683{
17684 D(p->level++);
17685 if (p->error_indicator) {
17686 D(p->level--);
17687 return NULL;
17688 }
17689 void * _res = NULL;
17690 int _mark = p->mark;
17691 { // 'as' NAME
17692 if (p->error_indicator) {
17693 D(p->level--);
17694 return NULL;
17695 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017696 D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017697 Token * _keyword;
17698 expr_ty z;
17699 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017700 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017701 &&
17702 (z = _PyPegen_name_token(p)) // NAME
17703 )
17704 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017705 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 +010017706 _res = z;
17707 if (_res == NULL && PyErr_Occurred()) {
17708 p->error_indicator = 1;
17709 D(p->level--);
17710 return NULL;
17711 }
17712 goto done;
17713 }
17714 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017715 D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017716 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17717 }
17718 _res = NULL;
17719 done:
17720 D(p->level--);
17721 return _res;
17722}
17723
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017724// _loop0_40: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017725static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017726_loop0_40_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017727{
17728 D(p->level++);
17729 if (p->error_indicator) {
17730 D(p->level--);
17731 return NULL;
17732 }
17733 void *_res = NULL;
17734 int _mark = p->mark;
17735 int _start_mark = p->mark;
17736 void **_children = PyMem_Malloc(sizeof(void *));
17737 if (!_children) {
17738 p->error_indicator = 1;
17739 PyErr_NoMemory();
17740 D(p->level--);
17741 return NULL;
17742 }
17743 ssize_t _children_capacity = 1;
17744 ssize_t _n = 0;
17745 { // ',' with_item
17746 if (p->error_indicator) {
17747 D(p->level--);
17748 return NULL;
17749 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017750 D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017751 Token * _literal;
17752 withitem_ty elem;
17753 while (
17754 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17755 &&
17756 (elem = with_item_rule(p)) // with_item
17757 )
17758 {
17759 _res = elem;
17760 if (_res == NULL && PyErr_Occurred()) {
17761 p->error_indicator = 1;
17762 PyMem_Free(_children);
17763 D(p->level--);
17764 return NULL;
17765 }
17766 if (_n == _children_capacity) {
17767 _children_capacity *= 2;
17768 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17769 if (!_new_children) {
17770 p->error_indicator = 1;
17771 PyErr_NoMemory();
17772 D(p->level--);
17773 return NULL;
17774 }
17775 _children = _new_children;
17776 }
17777 _children[_n++] = _res;
17778 _mark = p->mark;
17779 }
17780 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017781 D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017782 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17783 }
17784 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17785 if (!_seq) {
17786 PyMem_Free(_children);
17787 p->error_indicator = 1;
17788 PyErr_NoMemory();
17789 D(p->level--);
17790 return NULL;
17791 }
17792 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17793 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017794 _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017795 D(p->level--);
17796 return _seq;
17797}
17798
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017799// _gather_39: with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017800static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017801_gather_39_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017802{
17803 D(p->level++);
17804 if (p->error_indicator) {
17805 D(p->level--);
17806 return NULL;
17807 }
17808 asdl_seq * _res = NULL;
17809 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017810 { // with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017811 if (p->error_indicator) {
17812 D(p->level--);
17813 return NULL;
17814 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017815 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 +010017816 withitem_ty elem;
17817 asdl_seq * seq;
17818 if (
17819 (elem = with_item_rule(p)) // with_item
17820 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017821 (seq = _loop0_40_rule(p)) // _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017822 )
17823 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017824 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 +010017825 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17826 goto done;
17827 }
17828 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017829 D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ',
17830 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017831 }
17832 _res = NULL;
17833 done:
17834 D(p->level--);
17835 return _res;
17836}
17837
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017838// _loop0_42: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017839static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017840_loop0_42_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017841{
17842 D(p->level++);
17843 if (p->error_indicator) {
17844 D(p->level--);
17845 return NULL;
17846 }
17847 void *_res = NULL;
17848 int _mark = p->mark;
17849 int _start_mark = p->mark;
17850 void **_children = PyMem_Malloc(sizeof(void *));
17851 if (!_children) {
17852 p->error_indicator = 1;
17853 PyErr_NoMemory();
17854 D(p->level--);
17855 return NULL;
17856 }
17857 ssize_t _children_capacity = 1;
17858 ssize_t _n = 0;
17859 { // ',' with_item
17860 if (p->error_indicator) {
17861 D(p->level--);
17862 return NULL;
17863 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017864 D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017865 Token * _literal;
17866 withitem_ty elem;
17867 while (
17868 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17869 &&
17870 (elem = with_item_rule(p)) // with_item
17871 )
17872 {
17873 _res = elem;
17874 if (_res == NULL && PyErr_Occurred()) {
17875 p->error_indicator = 1;
17876 PyMem_Free(_children);
17877 D(p->level--);
17878 return NULL;
17879 }
17880 if (_n == _children_capacity) {
17881 _children_capacity *= 2;
17882 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17883 if (!_new_children) {
17884 p->error_indicator = 1;
17885 PyErr_NoMemory();
17886 D(p->level--);
17887 return NULL;
17888 }
17889 _children = _new_children;
17890 }
17891 _children[_n++] = _res;
17892 _mark = p->mark;
17893 }
17894 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017895 D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017896 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17897 }
17898 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17899 if (!_seq) {
17900 PyMem_Free(_children);
17901 p->error_indicator = 1;
17902 PyErr_NoMemory();
17903 D(p->level--);
17904 return NULL;
17905 }
17906 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17907 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017908 _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017909 D(p->level--);
17910 return _seq;
17911}
17912
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017913// _gather_41: with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017914static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017915_gather_41_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017916{
17917 D(p->level++);
17918 if (p->error_indicator) {
17919 D(p->level--);
17920 return NULL;
17921 }
17922 asdl_seq * _res = NULL;
17923 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017924 { // with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017925 if (p->error_indicator) {
17926 D(p->level--);
17927 return NULL;
17928 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017929 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 +010017930 withitem_ty elem;
17931 asdl_seq * seq;
17932 if (
17933 (elem = with_item_rule(p)) // with_item
17934 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017935 (seq = _loop0_42_rule(p)) // _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017936 )
17937 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017938 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 +010017939 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17940 goto done;
17941 }
17942 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017943 D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
17944 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017945 }
17946 _res = NULL;
17947 done:
17948 D(p->level--);
17949 return _res;
17950}
17951
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017952// _loop0_44: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017953static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017954_loop0_44_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017955{
17956 D(p->level++);
17957 if (p->error_indicator) {
17958 D(p->level--);
17959 return NULL;
17960 }
17961 void *_res = NULL;
17962 int _mark = p->mark;
17963 int _start_mark = p->mark;
17964 void **_children = PyMem_Malloc(sizeof(void *));
17965 if (!_children) {
17966 p->error_indicator = 1;
17967 PyErr_NoMemory();
17968 D(p->level--);
17969 return NULL;
17970 }
17971 ssize_t _children_capacity = 1;
17972 ssize_t _n = 0;
17973 { // ',' with_item
17974 if (p->error_indicator) {
17975 D(p->level--);
17976 return NULL;
17977 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017978 D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017979 Token * _literal;
17980 withitem_ty elem;
17981 while (
17982 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17983 &&
17984 (elem = with_item_rule(p)) // with_item
17985 )
17986 {
17987 _res = elem;
17988 if (_res == NULL && PyErr_Occurred()) {
17989 p->error_indicator = 1;
17990 PyMem_Free(_children);
17991 D(p->level--);
17992 return NULL;
17993 }
17994 if (_n == _children_capacity) {
17995 _children_capacity *= 2;
17996 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17997 if (!_new_children) {
17998 p->error_indicator = 1;
17999 PyErr_NoMemory();
18000 D(p->level--);
18001 return NULL;
18002 }
18003 _children = _new_children;
18004 }
18005 _children[_n++] = _res;
18006 _mark = p->mark;
18007 }
18008 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018009 D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018010 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18011 }
18012 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18013 if (!_seq) {
18014 PyMem_Free(_children);
18015 p->error_indicator = 1;
18016 PyErr_NoMemory();
18017 D(p->level--);
18018 return NULL;
18019 }
18020 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18021 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018022 _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018023 D(p->level--);
18024 return _seq;
18025}
18026
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018027// _gather_43: with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018028static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018029_gather_43_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018030{
18031 D(p->level++);
18032 if (p->error_indicator) {
18033 D(p->level--);
18034 return NULL;
18035 }
18036 asdl_seq * _res = NULL;
18037 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018038 { // with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018039 if (p->error_indicator) {
18040 D(p->level--);
18041 return NULL;
18042 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018043 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 +010018044 withitem_ty elem;
18045 asdl_seq * seq;
18046 if (
18047 (elem = with_item_rule(p)) // with_item
18048 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018049 (seq = _loop0_44_rule(p)) // _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018050 )
18051 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018052 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 +010018053 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18054 goto done;
18055 }
18056 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018057 D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ',
18058 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018059 }
18060 _res = NULL;
18061 done:
18062 D(p->level--);
18063 return _res;
18064}
18065
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018066// _loop0_46: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018067static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018068_loop0_46_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018069{
18070 D(p->level++);
18071 if (p->error_indicator) {
18072 D(p->level--);
18073 return NULL;
18074 }
18075 void *_res = NULL;
18076 int _mark = p->mark;
18077 int _start_mark = p->mark;
18078 void **_children = PyMem_Malloc(sizeof(void *));
18079 if (!_children) {
18080 p->error_indicator = 1;
18081 PyErr_NoMemory();
18082 D(p->level--);
18083 return NULL;
18084 }
18085 ssize_t _children_capacity = 1;
18086 ssize_t _n = 0;
18087 { // ',' with_item
18088 if (p->error_indicator) {
18089 D(p->level--);
18090 return NULL;
18091 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018092 D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018093 Token * _literal;
18094 withitem_ty elem;
18095 while (
18096 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18097 &&
18098 (elem = with_item_rule(p)) // with_item
18099 )
18100 {
18101 _res = elem;
18102 if (_res == NULL && PyErr_Occurred()) {
18103 p->error_indicator = 1;
18104 PyMem_Free(_children);
18105 D(p->level--);
18106 return NULL;
18107 }
18108 if (_n == _children_capacity) {
18109 _children_capacity *= 2;
18110 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18111 if (!_new_children) {
18112 p->error_indicator = 1;
18113 PyErr_NoMemory();
18114 D(p->level--);
18115 return NULL;
18116 }
18117 _children = _new_children;
18118 }
18119 _children[_n++] = _res;
18120 _mark = p->mark;
18121 }
18122 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018123 D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018124 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18125 }
18126 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18127 if (!_seq) {
18128 PyMem_Free(_children);
18129 p->error_indicator = 1;
18130 PyErr_NoMemory();
18131 D(p->level--);
18132 return NULL;
18133 }
18134 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18135 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018136 _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018137 D(p->level--);
18138 return _seq;
18139}
18140
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018141// _gather_45: with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018142static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018143_gather_45_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018144{
18145 D(p->level++);
18146 if (p->error_indicator) {
18147 D(p->level--);
18148 return NULL;
18149 }
18150 asdl_seq * _res = NULL;
18151 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018152 { // with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018153 if (p->error_indicator) {
18154 D(p->level--);
18155 return NULL;
18156 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018157 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 +010018158 withitem_ty elem;
18159 asdl_seq * seq;
18160 if (
18161 (elem = with_item_rule(p)) // with_item
18162 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018163 (seq = _loop0_46_rule(p)) // _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018164 )
18165 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018166 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 +010018167 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18168 goto done;
18169 }
18170 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018171 D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
18172 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018173 }
18174 _res = NULL;
18175 done:
18176 D(p->level--);
18177 return _res;
18178}
18179
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018180// _tmp_47: ',' | ')' | ':'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018181static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018182_tmp_47_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018183{
18184 D(p->level++);
18185 if (p->error_indicator) {
18186 D(p->level--);
18187 return NULL;
18188 }
18189 void * _res = NULL;
18190 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018191 { // ','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018192 if (p->error_indicator) {
18193 D(p->level--);
18194 return NULL;
18195 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018196 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
18197 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018198 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018199 (_literal = _PyPegen_expect_token(p, 12)) // token=','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018200 )
18201 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018202 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
18203 _res = _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018204 goto done;
18205 }
18206 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018207 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18208 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
18209 }
18210 { // ')'
18211 if (p->error_indicator) {
18212 D(p->level--);
18213 return NULL;
18214 }
18215 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
18216 Token * _literal;
18217 if (
18218 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
18219 )
18220 {
18221 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
18222 _res = _literal;
18223 goto done;
18224 }
18225 p->mark = _mark;
18226 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18227 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
18228 }
18229 { // ':'
18230 if (p->error_indicator) {
18231 D(p->level--);
18232 return NULL;
18233 }
18234 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
18235 Token * _literal;
18236 if (
18237 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
18238 )
18239 {
18240 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
18241 _res = _literal;
18242 goto done;
18243 }
18244 p->mark = _mark;
18245 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18246 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018247 }
18248 _res = NULL;
18249 done:
18250 D(p->level--);
18251 return _res;
18252}
18253
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018254// _loop1_48: except_block
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018255static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018256_loop1_48_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018257{
18258 D(p->level++);
18259 if (p->error_indicator) {
18260 D(p->level--);
18261 return NULL;
18262 }
18263 void *_res = NULL;
18264 int _mark = p->mark;
18265 int _start_mark = p->mark;
18266 void **_children = PyMem_Malloc(sizeof(void *));
18267 if (!_children) {
18268 p->error_indicator = 1;
18269 PyErr_NoMemory();
18270 D(p->level--);
18271 return NULL;
18272 }
18273 ssize_t _children_capacity = 1;
18274 ssize_t _n = 0;
18275 { // except_block
18276 if (p->error_indicator) {
18277 D(p->level--);
18278 return NULL;
18279 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018280 D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018281 excepthandler_ty except_block_var;
18282 while (
18283 (except_block_var = except_block_rule(p)) // except_block
18284 )
18285 {
18286 _res = except_block_var;
18287 if (_n == _children_capacity) {
18288 _children_capacity *= 2;
18289 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18290 if (!_new_children) {
18291 p->error_indicator = 1;
18292 PyErr_NoMemory();
18293 D(p->level--);
18294 return NULL;
18295 }
18296 _children = _new_children;
18297 }
18298 _children[_n++] = _res;
18299 _mark = p->mark;
18300 }
18301 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018302 D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018303 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
18304 }
18305 if (_n == 0 || p->error_indicator) {
18306 PyMem_Free(_children);
18307 D(p->level--);
18308 return NULL;
18309 }
18310 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18311 if (!_seq) {
18312 PyMem_Free(_children);
18313 p->error_indicator = 1;
18314 PyErr_NoMemory();
18315 D(p->level--);
18316 return NULL;
18317 }
18318 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18319 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018320 _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018321 D(p->level--);
18322 return _seq;
18323}
18324
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018325// _tmp_49: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018326static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018327_tmp_49_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018328{
18329 D(p->level++);
18330 if (p->error_indicator) {
18331 D(p->level--);
18332 return NULL;
18333 }
18334 void * _res = NULL;
18335 int _mark = p->mark;
18336 { // 'as' NAME
18337 if (p->error_indicator) {
18338 D(p->level--);
18339 return NULL;
18340 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018341 D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018342 Token * _keyword;
18343 expr_ty z;
18344 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018345 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018346 &&
18347 (z = _PyPegen_name_token(p)) // NAME
18348 )
18349 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018350 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 +010018351 _res = z;
18352 if (_res == NULL && PyErr_Occurred()) {
18353 p->error_indicator = 1;
18354 D(p->level--);
18355 return NULL;
18356 }
18357 goto done;
18358 }
18359 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018360 D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018361 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
18362 }
18363 _res = NULL;
18364 done:
18365 D(p->level--);
18366 return _res;
18367}
18368
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018369// _tmp_50: 'from' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018370static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018371_tmp_50_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018372{
18373 D(p->level++);
18374 if (p->error_indicator) {
18375 D(p->level--);
18376 return NULL;
18377 }
18378 void * _res = NULL;
18379 int _mark = p->mark;
18380 { // 'from' expression
18381 if (p->error_indicator) {
18382 D(p->level--);
18383 return NULL;
18384 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018385 D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018386 Token * _keyword;
18387 expr_ty z;
18388 if (
18389 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
18390 &&
18391 (z = expression_rule(p)) // expression
18392 )
18393 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018394 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 +010018395 _res = z;
18396 if (_res == NULL && PyErr_Occurred()) {
18397 p->error_indicator = 1;
18398 D(p->level--);
18399 return NULL;
18400 }
18401 goto done;
18402 }
18403 p->mark = _mark;
18404 D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018405 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018406 }
18407 _res = NULL;
18408 done:
18409 D(p->level--);
18410 return _res;
18411}
18412
18413// _tmp_51: '->' expression
18414static void *
18415_tmp_51_rule(Parser *p)
18416{
18417 D(p->level++);
18418 if (p->error_indicator) {
18419 D(p->level--);
18420 return NULL;
18421 }
18422 void * _res = NULL;
18423 int _mark = p->mark;
18424 { // '->' expression
18425 if (p->error_indicator) {
18426 D(p->level--);
18427 return NULL;
18428 }
18429 D(fprintf(stderr, "%*c> _tmp_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18430 Token * _literal;
18431 expr_ty z;
18432 if (
18433 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18434 &&
18435 (z = expression_rule(p)) // expression
18436 )
18437 {
18438 D(fprintf(stderr, "%*c+ _tmp_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18439 _res = z;
18440 if (_res == NULL && PyErr_Occurred()) {
18441 p->error_indicator = 1;
18442 D(p->level--);
18443 return NULL;
18444 }
18445 goto done;
18446 }
18447 p->mark = _mark;
18448 D(fprintf(stderr, "%*c%s _tmp_51[%d-%d]: %s failed!\n", p->level, ' ',
18449 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18450 }
18451 _res = NULL;
18452 done:
18453 D(p->level--);
18454 return _res;
18455}
18456
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018457// _tmp_52: '->' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018458static void *
18459_tmp_52_rule(Parser *p)
18460{
18461 D(p->level++);
18462 if (p->error_indicator) {
18463 D(p->level--);
18464 return NULL;
18465 }
18466 void * _res = NULL;
18467 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018468 { // '->' expression
18469 if (p->error_indicator) {
18470 D(p->level--);
18471 return NULL;
18472 }
18473 D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18474 Token * _literal;
18475 expr_ty z;
18476 if (
18477 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18478 &&
18479 (z = expression_rule(p)) // expression
18480 )
18481 {
18482 D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18483 _res = z;
18484 if (_res == NULL && PyErr_Occurred()) {
18485 p->error_indicator = 1;
18486 D(p->level--);
18487 return NULL;
18488 }
18489 goto done;
18490 }
18491 p->mark = _mark;
18492 D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ',
18493 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18494 }
18495 _res = NULL;
18496 done:
18497 D(p->level--);
18498 return _res;
18499}
18500
18501// _tmp_53: NEWLINE INDENT
18502static void *
18503_tmp_53_rule(Parser *p)
18504{
18505 D(p->level++);
18506 if (p->error_indicator) {
18507 D(p->level--);
18508 return NULL;
18509 }
18510 void * _res = NULL;
18511 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018512 { // NEWLINE INDENT
18513 if (p->error_indicator) {
18514 D(p->level--);
18515 return NULL;
18516 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018517 D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018518 Token * indent_var;
18519 Token * newline_var;
18520 if (
18521 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
18522 &&
18523 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
18524 )
18525 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018526 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 +010018527 _res = _PyPegen_dummy_name(p, newline_var, indent_var);
18528 goto done;
18529 }
18530 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018531 D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018532 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
18533 }
18534 _res = NULL;
18535 done:
18536 D(p->level--);
18537 return _res;
18538}
18539
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018540// _loop0_54: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018541static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018542_loop0_54_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018543{
18544 D(p->level++);
18545 if (p->error_indicator) {
18546 D(p->level--);
18547 return NULL;
18548 }
18549 void *_res = NULL;
18550 int _mark = p->mark;
18551 int _start_mark = p->mark;
18552 void **_children = PyMem_Malloc(sizeof(void *));
18553 if (!_children) {
18554 p->error_indicator = 1;
18555 PyErr_NoMemory();
18556 D(p->level--);
18557 return NULL;
18558 }
18559 ssize_t _children_capacity = 1;
18560 ssize_t _n = 0;
18561 { // param_no_default
18562 if (p->error_indicator) {
18563 D(p->level--);
18564 return NULL;
18565 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018566 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 +010018567 arg_ty param_no_default_var;
18568 while (
18569 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18570 )
18571 {
18572 _res = param_no_default_var;
18573 if (_n == _children_capacity) {
18574 _children_capacity *= 2;
18575 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18576 if (!_new_children) {
18577 p->error_indicator = 1;
18578 PyErr_NoMemory();
18579 D(p->level--);
18580 return NULL;
18581 }
18582 _children = _new_children;
18583 }
18584 _children[_n++] = _res;
18585 _mark = p->mark;
18586 }
18587 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018588 D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018589 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018590 }
18591 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18592 if (!_seq) {
18593 PyMem_Free(_children);
18594 p->error_indicator = 1;
18595 PyErr_NoMemory();
18596 D(p->level--);
18597 return NULL;
18598 }
18599 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18600 PyMem_Free(_children);
18601 _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq);
18602 D(p->level--);
18603 return _seq;
18604}
18605
18606// _loop0_55: param_with_default
18607static asdl_seq *
18608_loop0_55_rule(Parser *p)
18609{
18610 D(p->level++);
18611 if (p->error_indicator) {
18612 D(p->level--);
18613 return NULL;
18614 }
18615 void *_res = NULL;
18616 int _mark = p->mark;
18617 int _start_mark = p->mark;
18618 void **_children = PyMem_Malloc(sizeof(void *));
18619 if (!_children) {
18620 p->error_indicator = 1;
18621 PyErr_NoMemory();
18622 D(p->level--);
18623 return NULL;
18624 }
18625 ssize_t _children_capacity = 1;
18626 ssize_t _n = 0;
18627 { // param_with_default
18628 if (p->error_indicator) {
18629 D(p->level--);
18630 return NULL;
18631 }
18632 D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18633 NameDefaultPair* param_with_default_var;
18634 while (
18635 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18636 )
18637 {
18638 _res = param_with_default_var;
18639 if (_n == _children_capacity) {
18640 _children_capacity *= 2;
18641 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18642 if (!_new_children) {
18643 p->error_indicator = 1;
18644 PyErr_NoMemory();
18645 D(p->level--);
18646 return NULL;
18647 }
18648 _children = _new_children;
18649 }
18650 _children[_n++] = _res;
18651 _mark = p->mark;
18652 }
18653 p->mark = _mark;
18654 D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ',
18655 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18656 }
18657 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18658 if (!_seq) {
18659 PyMem_Free(_children);
18660 p->error_indicator = 1;
18661 PyErr_NoMemory();
18662 D(p->level--);
18663 return NULL;
18664 }
18665 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18666 PyMem_Free(_children);
18667 _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq);
18668 D(p->level--);
18669 return _seq;
18670}
18671
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018672// _loop0_56: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018673static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018674_loop0_56_rule(Parser *p)
18675{
18676 D(p->level++);
18677 if (p->error_indicator) {
18678 D(p->level--);
18679 return NULL;
18680 }
18681 void *_res = NULL;
18682 int _mark = p->mark;
18683 int _start_mark = p->mark;
18684 void **_children = PyMem_Malloc(sizeof(void *));
18685 if (!_children) {
18686 p->error_indicator = 1;
18687 PyErr_NoMemory();
18688 D(p->level--);
18689 return NULL;
18690 }
18691 ssize_t _children_capacity = 1;
18692 ssize_t _n = 0;
18693 { // param_with_default
18694 if (p->error_indicator) {
18695 D(p->level--);
18696 return NULL;
18697 }
18698 D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18699 NameDefaultPair* param_with_default_var;
18700 while (
18701 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18702 )
18703 {
18704 _res = param_with_default_var;
18705 if (_n == _children_capacity) {
18706 _children_capacity *= 2;
18707 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18708 if (!_new_children) {
18709 p->error_indicator = 1;
18710 PyErr_NoMemory();
18711 D(p->level--);
18712 return NULL;
18713 }
18714 _children = _new_children;
18715 }
18716 _children[_n++] = _res;
18717 _mark = p->mark;
18718 }
18719 p->mark = _mark;
18720 D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ',
18721 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18722 }
18723 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18724 if (!_seq) {
18725 PyMem_Free(_children);
18726 p->error_indicator = 1;
18727 PyErr_NoMemory();
18728 D(p->level--);
18729 return NULL;
18730 }
18731 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18732 PyMem_Free(_children);
18733 _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq);
18734 D(p->level--);
18735 return _seq;
18736}
18737
18738// _loop1_57: param_no_default
18739static asdl_seq *
18740_loop1_57_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018741{
18742 D(p->level++);
18743 if (p->error_indicator) {
18744 D(p->level--);
18745 return NULL;
18746 }
18747 void *_res = NULL;
18748 int _mark = p->mark;
18749 int _start_mark = p->mark;
18750 void **_children = PyMem_Malloc(sizeof(void *));
18751 if (!_children) {
18752 p->error_indicator = 1;
18753 PyErr_NoMemory();
18754 D(p->level--);
18755 return NULL;
18756 }
18757 ssize_t _children_capacity = 1;
18758 ssize_t _n = 0;
18759 { // param_no_default
18760 if (p->error_indicator) {
18761 D(p->level--);
18762 return NULL;
18763 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018764 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 +010018765 arg_ty param_no_default_var;
18766 while (
18767 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18768 )
18769 {
18770 _res = param_no_default_var;
18771 if (_n == _children_capacity) {
18772 _children_capacity *= 2;
18773 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18774 if (!_new_children) {
18775 p->error_indicator = 1;
18776 PyErr_NoMemory();
18777 D(p->level--);
18778 return NULL;
18779 }
18780 _children = _new_children;
18781 }
18782 _children[_n++] = _res;
18783 _mark = p->mark;
18784 }
18785 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018786 D(fprintf(stderr, "%*c%s _loop1_57[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018787 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
18788 }
18789 if (_n == 0 || p->error_indicator) {
18790 PyMem_Free(_children);
18791 D(p->level--);
18792 return NULL;
18793 }
18794 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18795 if (!_seq) {
18796 PyMem_Free(_children);
18797 p->error_indicator = 1;
18798 PyErr_NoMemory();
18799 D(p->level--);
18800 return NULL;
18801 }
18802 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18803 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018804 _PyPegen_insert_memo(p, _start_mark, _loop1_57_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018805 D(p->level--);
18806 return _seq;
18807}
18808
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018809// _loop0_58: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018810static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018811_loop0_58_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018812{
18813 D(p->level++);
18814 if (p->error_indicator) {
18815 D(p->level--);
18816 return NULL;
18817 }
18818 void *_res = NULL;
18819 int _mark = p->mark;
18820 int _start_mark = p->mark;
18821 void **_children = PyMem_Malloc(sizeof(void *));
18822 if (!_children) {
18823 p->error_indicator = 1;
18824 PyErr_NoMemory();
18825 D(p->level--);
18826 return NULL;
18827 }
18828 ssize_t _children_capacity = 1;
18829 ssize_t _n = 0;
18830 { // param_with_default
18831 if (p->error_indicator) {
18832 D(p->level--);
18833 return NULL;
18834 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018835 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 +010018836 NameDefaultPair* param_with_default_var;
18837 while (
18838 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18839 )
18840 {
18841 _res = param_with_default_var;
18842 if (_n == _children_capacity) {
18843 _children_capacity *= 2;
18844 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18845 if (!_new_children) {
18846 p->error_indicator = 1;
18847 PyErr_NoMemory();
18848 D(p->level--);
18849 return NULL;
18850 }
18851 _children = _new_children;
18852 }
18853 _children[_n++] = _res;
18854 _mark = p->mark;
18855 }
18856 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018857 D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018858 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18859 }
18860 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18861 if (!_seq) {
18862 PyMem_Free(_children);
18863 p->error_indicator = 1;
18864 PyErr_NoMemory();
18865 D(p->level--);
18866 return NULL;
18867 }
18868 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18869 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018870 _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018871 D(p->level--);
18872 return _seq;
18873}
18874
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018875// _loop1_59: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018876static asdl_seq *
18877_loop1_59_rule(Parser *p)
18878{
18879 D(p->level++);
18880 if (p->error_indicator) {
18881 D(p->level--);
18882 return NULL;
18883 }
18884 void *_res = NULL;
18885 int _mark = p->mark;
18886 int _start_mark = p->mark;
18887 void **_children = PyMem_Malloc(sizeof(void *));
18888 if (!_children) {
18889 p->error_indicator = 1;
18890 PyErr_NoMemory();
18891 D(p->level--);
18892 return NULL;
18893 }
18894 ssize_t _children_capacity = 1;
18895 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018896 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018897 if (p->error_indicator) {
18898 D(p->level--);
18899 return NULL;
18900 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018901 D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18902 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018903 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018904 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018905 )
18906 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018907 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018908 if (_n == _children_capacity) {
18909 _children_capacity *= 2;
18910 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18911 if (!_new_children) {
18912 p->error_indicator = 1;
18913 PyErr_NoMemory();
18914 D(p->level--);
18915 return NULL;
18916 }
18917 _children = _new_children;
18918 }
18919 _children[_n++] = _res;
18920 _mark = p->mark;
18921 }
18922 p->mark = _mark;
18923 D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018924 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018925 }
18926 if (_n == 0 || p->error_indicator) {
18927 PyMem_Free(_children);
18928 D(p->level--);
18929 return NULL;
18930 }
18931 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18932 if (!_seq) {
18933 PyMem_Free(_children);
18934 p->error_indicator = 1;
18935 PyErr_NoMemory();
18936 D(p->level--);
18937 return NULL;
18938 }
18939 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18940 PyMem_Free(_children);
18941 _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq);
18942 D(p->level--);
18943 return _seq;
18944}
18945
18946// _loop1_60: param_no_default
18947static asdl_seq *
18948_loop1_60_rule(Parser *p)
18949{
18950 D(p->level++);
18951 if (p->error_indicator) {
18952 D(p->level--);
18953 return NULL;
18954 }
18955 void *_res = NULL;
18956 int _mark = p->mark;
18957 int _start_mark = p->mark;
18958 void **_children = PyMem_Malloc(sizeof(void *));
18959 if (!_children) {
18960 p->error_indicator = 1;
18961 PyErr_NoMemory();
18962 D(p->level--);
18963 return NULL;
18964 }
18965 ssize_t _children_capacity = 1;
18966 ssize_t _n = 0;
18967 { // param_no_default
18968 if (p->error_indicator) {
18969 D(p->level--);
18970 return NULL;
18971 }
18972 D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
18973 arg_ty param_no_default_var;
18974 while (
18975 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18976 )
18977 {
18978 _res = param_no_default_var;
18979 if (_n == _children_capacity) {
18980 _children_capacity *= 2;
18981 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18982 if (!_new_children) {
18983 p->error_indicator = 1;
18984 PyErr_NoMemory();
18985 D(p->level--);
18986 return NULL;
18987 }
18988 _children = _new_children;
18989 }
18990 _children[_n++] = _res;
18991 _mark = p->mark;
18992 }
18993 p->mark = _mark;
18994 D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ',
18995 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
18996 }
18997 if (_n == 0 || p->error_indicator) {
18998 PyMem_Free(_children);
18999 D(p->level--);
19000 return NULL;
19001 }
19002 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19003 if (!_seq) {
19004 PyMem_Free(_children);
19005 p->error_indicator = 1;
19006 PyErr_NoMemory();
19007 D(p->level--);
19008 return NULL;
19009 }
19010 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19011 PyMem_Free(_children);
19012 _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq);
19013 D(p->level--);
19014 return _seq;
19015}
19016
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019017// _loop1_61: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019018static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019019_loop1_61_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019020{
19021 D(p->level++);
19022 if (p->error_indicator) {
19023 D(p->level--);
19024 return NULL;
19025 }
19026 void *_res = NULL;
19027 int _mark = p->mark;
19028 int _start_mark = p->mark;
19029 void **_children = PyMem_Malloc(sizeof(void *));
19030 if (!_children) {
19031 p->error_indicator = 1;
19032 PyErr_NoMemory();
19033 D(p->level--);
19034 return NULL;
19035 }
19036 ssize_t _children_capacity = 1;
19037 ssize_t _n = 0;
19038 { // param_no_default
19039 if (p->error_indicator) {
19040 D(p->level--);
19041 return NULL;
19042 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019043 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 +010019044 arg_ty param_no_default_var;
19045 while (
19046 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19047 )
19048 {
19049 _res = param_no_default_var;
19050 if (_n == _children_capacity) {
19051 _children_capacity *= 2;
19052 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19053 if (!_new_children) {
19054 p->error_indicator = 1;
19055 PyErr_NoMemory();
19056 D(p->level--);
19057 return NULL;
19058 }
19059 _children = _new_children;
19060 }
19061 _children[_n++] = _res;
19062 _mark = p->mark;
19063 }
19064 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019065 D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019066 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19067 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019068 if (_n == 0 || p->error_indicator) {
19069 PyMem_Free(_children);
19070 D(p->level--);
19071 return NULL;
19072 }
19073 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19074 if (!_seq) {
19075 PyMem_Free(_children);
19076 p->error_indicator = 1;
19077 PyErr_NoMemory();
19078 D(p->level--);
19079 return NULL;
19080 }
19081 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19082 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019083 _PyPegen_insert_memo(p, _start_mark, _loop1_61_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019084 D(p->level--);
19085 return _seq;
19086}
19087
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019088// _loop0_62: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019089static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019090_loop0_62_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019091{
19092 D(p->level++);
19093 if (p->error_indicator) {
19094 D(p->level--);
19095 return NULL;
19096 }
19097 void *_res = NULL;
19098 int _mark = p->mark;
19099 int _start_mark = p->mark;
19100 void **_children = PyMem_Malloc(sizeof(void *));
19101 if (!_children) {
19102 p->error_indicator = 1;
19103 PyErr_NoMemory();
19104 D(p->level--);
19105 return NULL;
19106 }
19107 ssize_t _children_capacity = 1;
19108 ssize_t _n = 0;
19109 { // param_no_default
19110 if (p->error_indicator) {
19111 D(p->level--);
19112 return NULL;
19113 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019114 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 +010019115 arg_ty param_no_default_var;
19116 while (
19117 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19118 )
19119 {
19120 _res = param_no_default_var;
19121 if (_n == _children_capacity) {
19122 _children_capacity *= 2;
19123 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19124 if (!_new_children) {
19125 p->error_indicator = 1;
19126 PyErr_NoMemory();
19127 D(p->level--);
19128 return NULL;
19129 }
19130 _children = _new_children;
19131 }
19132 _children[_n++] = _res;
19133 _mark = p->mark;
19134 }
19135 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019136 D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019137 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19138 }
19139 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19140 if (!_seq) {
19141 PyMem_Free(_children);
19142 p->error_indicator = 1;
19143 PyErr_NoMemory();
19144 D(p->level--);
19145 return NULL;
19146 }
19147 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19148 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019149 _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019150 D(p->level--);
19151 return _seq;
19152}
19153
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019154// _loop1_63: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019155static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019156_loop1_63_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019157{
19158 D(p->level++);
19159 if (p->error_indicator) {
19160 D(p->level--);
19161 return NULL;
19162 }
19163 void *_res = NULL;
19164 int _mark = p->mark;
19165 int _start_mark = p->mark;
19166 void **_children = PyMem_Malloc(sizeof(void *));
19167 if (!_children) {
19168 p->error_indicator = 1;
19169 PyErr_NoMemory();
19170 D(p->level--);
19171 return NULL;
19172 }
19173 ssize_t _children_capacity = 1;
19174 ssize_t _n = 0;
19175 { // param_with_default
19176 if (p->error_indicator) {
19177 D(p->level--);
19178 return NULL;
19179 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019180 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 +010019181 NameDefaultPair* param_with_default_var;
19182 while (
19183 (param_with_default_var = param_with_default_rule(p)) // param_with_default
19184 )
19185 {
19186 _res = param_with_default_var;
19187 if (_n == _children_capacity) {
19188 _children_capacity *= 2;
19189 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19190 if (!_new_children) {
19191 p->error_indicator = 1;
19192 PyErr_NoMemory();
19193 D(p->level--);
19194 return NULL;
19195 }
19196 _children = _new_children;
19197 }
19198 _children[_n++] = _res;
19199 _mark = p->mark;
19200 }
19201 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019202 D(fprintf(stderr, "%*c%s _loop1_63[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019203 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
19204 }
19205 if (_n == 0 || p->error_indicator) {
19206 PyMem_Free(_children);
19207 D(p->level--);
19208 return NULL;
19209 }
19210 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19211 if (!_seq) {
19212 PyMem_Free(_children);
19213 p->error_indicator = 1;
19214 PyErr_NoMemory();
19215 D(p->level--);
19216 return NULL;
19217 }
19218 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19219 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019220 _PyPegen_insert_memo(p, _start_mark, _loop1_63_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019221 D(p->level--);
19222 return _seq;
19223}
19224
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019225// _loop0_64: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019226static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019227_loop0_64_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019228{
19229 D(p->level++);
19230 if (p->error_indicator) {
19231 D(p->level--);
19232 return NULL;
19233 }
19234 void *_res = NULL;
19235 int _mark = p->mark;
19236 int _start_mark = p->mark;
19237 void **_children = PyMem_Malloc(sizeof(void *));
19238 if (!_children) {
19239 p->error_indicator = 1;
19240 PyErr_NoMemory();
19241 D(p->level--);
19242 return NULL;
19243 }
19244 ssize_t _children_capacity = 1;
19245 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019246 { // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019247 if (p->error_indicator) {
19248 D(p->level--);
19249 return NULL;
19250 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019251 D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19252 arg_ty param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019253 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019254 (param_no_default_var = param_no_default_rule(p)) // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019255 )
19256 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019257 _res = param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019258 if (_n == _children_capacity) {
19259 _children_capacity *= 2;
19260 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19261 if (!_new_children) {
19262 p->error_indicator = 1;
19263 PyErr_NoMemory();
19264 D(p->level--);
19265 return NULL;
19266 }
19267 _children = _new_children;
19268 }
19269 _children[_n++] = _res;
19270 _mark = p->mark;
19271 }
19272 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019273 D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ',
19274 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019275 }
19276 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19277 if (!_seq) {
19278 PyMem_Free(_children);
19279 p->error_indicator = 1;
19280 PyErr_NoMemory();
19281 D(p->level--);
19282 return NULL;
19283 }
19284 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19285 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019286 _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019287 D(p->level--);
19288 return _seq;
19289}
19290
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019291// _loop1_65: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019292static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019293_loop1_65_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019294{
19295 D(p->level++);
19296 if (p->error_indicator) {
19297 D(p->level--);
19298 return NULL;
19299 }
19300 void *_res = NULL;
19301 int _mark = p->mark;
19302 int _start_mark = p->mark;
19303 void **_children = PyMem_Malloc(sizeof(void *));
19304 if (!_children) {
19305 p->error_indicator = 1;
19306 PyErr_NoMemory();
19307 D(p->level--);
19308 return NULL;
19309 }
19310 ssize_t _children_capacity = 1;
19311 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019312 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019313 if (p->error_indicator) {
19314 D(p->level--);
19315 return NULL;
19316 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019317 D(fprintf(stderr, "%*c> _loop1_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
19318 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019319 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019320 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019321 )
19322 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019323 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019324 if (_n == _children_capacity) {
19325 _children_capacity *= 2;
19326 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19327 if (!_new_children) {
19328 p->error_indicator = 1;
19329 PyErr_NoMemory();
19330 D(p->level--);
19331 return NULL;
19332 }
19333 _children = _new_children;
19334 }
19335 _children[_n++] = _res;
19336 _mark = p->mark;
19337 }
19338 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019339 D(fprintf(stderr, "%*c%s _loop1_65[%d-%d]: %s failed!\n", p->level, ' ',
19340 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019341 }
19342 if (_n == 0 || p->error_indicator) {
19343 PyMem_Free(_children);
19344 D(p->level--);
19345 return NULL;
19346 }
19347 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19348 if (!_seq) {
19349 PyMem_Free(_children);
19350 p->error_indicator = 1;
19351 PyErr_NoMemory();
19352 D(p->level--);
19353 return NULL;
19354 }
19355 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19356 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019357 _PyPegen_insert_memo(p, _start_mark, _loop1_65_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019358 D(p->level--);
19359 return _seq;
19360}
19361
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019362// _loop0_66: param_maybe_default
19363static asdl_seq *
19364_loop0_66_rule(Parser *p)
19365{
19366 D(p->level++);
19367 if (p->error_indicator) {
19368 D(p->level--);
19369 return NULL;
19370 }
19371 void *_res = NULL;
19372 int _mark = p->mark;
19373 int _start_mark = p->mark;
19374 void **_children = PyMem_Malloc(sizeof(void *));
19375 if (!_children) {
19376 p->error_indicator = 1;
19377 PyErr_NoMemory();
19378 D(p->level--);
19379 return NULL;
19380 }
19381 ssize_t _children_capacity = 1;
19382 ssize_t _n = 0;
19383 { // param_maybe_default
19384 if (p->error_indicator) {
19385 D(p->level--);
19386 return NULL;
19387 }
19388 D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19389 NameDefaultPair* param_maybe_default_var;
19390 while (
19391 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19392 )
19393 {
19394 _res = param_maybe_default_var;
19395 if (_n == _children_capacity) {
19396 _children_capacity *= 2;
19397 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19398 if (!_new_children) {
19399 p->error_indicator = 1;
19400 PyErr_NoMemory();
19401 D(p->level--);
19402 return NULL;
19403 }
19404 _children = _new_children;
19405 }
19406 _children[_n++] = _res;
19407 _mark = p->mark;
19408 }
19409 p->mark = _mark;
19410 D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ',
19411 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19412 }
19413 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19414 if (!_seq) {
19415 PyMem_Free(_children);
19416 p->error_indicator = 1;
19417 PyErr_NoMemory();
19418 D(p->level--);
19419 return NULL;
19420 }
19421 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19422 PyMem_Free(_children);
19423 _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq);
19424 D(p->level--);
19425 return _seq;
19426}
19427
19428// _loop1_67: param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019429static asdl_seq *
19430_loop1_67_rule(Parser *p)
19431{
19432 D(p->level++);
19433 if (p->error_indicator) {
19434 D(p->level--);
19435 return NULL;
19436 }
19437 void *_res = NULL;
19438 int _mark = p->mark;
19439 int _start_mark = p->mark;
19440 void **_children = PyMem_Malloc(sizeof(void *));
19441 if (!_children) {
19442 p->error_indicator = 1;
19443 PyErr_NoMemory();
19444 D(p->level--);
19445 return NULL;
19446 }
19447 ssize_t _children_capacity = 1;
19448 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019449 { // param_maybe_default
19450 if (p->error_indicator) {
19451 D(p->level--);
19452 return NULL;
19453 }
19454 D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19455 NameDefaultPair* param_maybe_default_var;
19456 while (
19457 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19458 )
19459 {
19460 _res = param_maybe_default_var;
19461 if (_n == _children_capacity) {
19462 _children_capacity *= 2;
19463 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19464 if (!_new_children) {
19465 p->error_indicator = 1;
19466 PyErr_NoMemory();
19467 D(p->level--);
19468 return NULL;
19469 }
19470 _children = _new_children;
19471 }
19472 _children[_n++] = _res;
19473 _mark = p->mark;
19474 }
19475 p->mark = _mark;
19476 D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ',
19477 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19478 }
19479 if (_n == 0 || p->error_indicator) {
19480 PyMem_Free(_children);
19481 D(p->level--);
19482 return NULL;
19483 }
19484 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19485 if (!_seq) {
19486 PyMem_Free(_children);
19487 p->error_indicator = 1;
19488 PyErr_NoMemory();
19489 D(p->level--);
19490 return NULL;
19491 }
19492 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19493 PyMem_Free(_children);
19494 _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq);
19495 D(p->level--);
19496 return _seq;
19497}
19498
19499// _loop1_68: ('@' named_expression NEWLINE)
19500static asdl_seq *
19501_loop1_68_rule(Parser *p)
19502{
19503 D(p->level++);
19504 if (p->error_indicator) {
19505 D(p->level--);
19506 return NULL;
19507 }
19508 void *_res = NULL;
19509 int _mark = p->mark;
19510 int _start_mark = p->mark;
19511 void **_children = PyMem_Malloc(sizeof(void *));
19512 if (!_children) {
19513 p->error_indicator = 1;
19514 PyErr_NoMemory();
19515 D(p->level--);
19516 return NULL;
19517 }
19518 ssize_t _children_capacity = 1;
19519 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019520 { // ('@' named_expression NEWLINE)
19521 if (p->error_indicator) {
19522 D(p->level--);
19523 return NULL;
19524 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019525 D(fprintf(stderr, "%*c> _loop1_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019526 void *_tmp_141_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019527 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019528 (_tmp_141_var = _tmp_141_rule(p)) // '@' named_expression NEWLINE
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019529 )
19530 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019531 _res = _tmp_141_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019532 if (_n == _children_capacity) {
19533 _children_capacity *= 2;
19534 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19535 if (!_new_children) {
19536 p->error_indicator = 1;
19537 PyErr_NoMemory();
19538 D(p->level--);
19539 return NULL;
19540 }
19541 _children = _new_children;
19542 }
19543 _children[_n++] = _res;
19544 _mark = p->mark;
19545 }
19546 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019547 D(fprintf(stderr, "%*c%s _loop1_68[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019548 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
19549 }
19550 if (_n == 0 || p->error_indicator) {
19551 PyMem_Free(_children);
19552 D(p->level--);
19553 return NULL;
19554 }
19555 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19556 if (!_seq) {
19557 PyMem_Free(_children);
19558 p->error_indicator = 1;
19559 PyErr_NoMemory();
19560 D(p->level--);
19561 return NULL;
19562 }
19563 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19564 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019565 _PyPegen_insert_memo(p, _start_mark, _loop1_68_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019566 D(p->level--);
19567 return _seq;
19568}
19569
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019570// _tmp_69: '(' arguments? ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019571static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019572_tmp_69_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019573{
19574 D(p->level++);
19575 if (p->error_indicator) {
19576 D(p->level--);
19577 return NULL;
19578 }
19579 void * _res = NULL;
19580 int _mark = p->mark;
19581 { // '(' arguments? ')'
19582 if (p->error_indicator) {
19583 D(p->level--);
19584 return NULL;
19585 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019586 D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019587 Token * _literal;
19588 Token * _literal_1;
19589 void *z;
19590 if (
19591 (_literal = _PyPegen_expect_token(p, 7)) // token='('
19592 &&
19593 (z = arguments_rule(p), 1) // arguments?
19594 &&
19595 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
19596 )
19597 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019598 D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019599 _res = z;
19600 if (_res == NULL && PyErr_Occurred()) {
19601 p->error_indicator = 1;
19602 D(p->level--);
19603 return NULL;
19604 }
19605 goto done;
19606 }
19607 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019608 D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019609 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
19610 }
19611 _res = NULL;
19612 done:
19613 D(p->level--);
19614 return _res;
19615}
19616
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019617// _loop0_71: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019618static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019619_loop0_71_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019620{
19621 D(p->level++);
19622 if (p->error_indicator) {
19623 D(p->level--);
19624 return NULL;
19625 }
19626 void *_res = NULL;
19627 int _mark = p->mark;
19628 int _start_mark = p->mark;
19629 void **_children = PyMem_Malloc(sizeof(void *));
19630 if (!_children) {
19631 p->error_indicator = 1;
19632 PyErr_NoMemory();
19633 D(p->level--);
19634 return NULL;
19635 }
19636 ssize_t _children_capacity = 1;
19637 ssize_t _n = 0;
19638 { // ',' star_expression
19639 if (p->error_indicator) {
19640 D(p->level--);
19641 return NULL;
19642 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019643 D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019644 Token * _literal;
19645 expr_ty elem;
19646 while (
19647 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19648 &&
19649 (elem = star_expression_rule(p)) // star_expression
19650 )
19651 {
19652 _res = elem;
19653 if (_res == NULL && PyErr_Occurred()) {
19654 p->error_indicator = 1;
19655 PyMem_Free(_children);
19656 D(p->level--);
19657 return NULL;
19658 }
19659 if (_n == _children_capacity) {
19660 _children_capacity *= 2;
19661 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19662 if (!_new_children) {
19663 p->error_indicator = 1;
19664 PyErr_NoMemory();
19665 D(p->level--);
19666 return NULL;
19667 }
19668 _children = _new_children;
19669 }
19670 _children[_n++] = _res;
19671 _mark = p->mark;
19672 }
19673 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019674 D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019675 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
19676 }
19677 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19678 if (!_seq) {
19679 PyMem_Free(_children);
19680 p->error_indicator = 1;
19681 PyErr_NoMemory();
19682 D(p->level--);
19683 return NULL;
19684 }
19685 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19686 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019687 _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019688 D(p->level--);
19689 return _seq;
19690}
19691
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019692// _gather_70: star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019693static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019694_gather_70_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019695{
19696 D(p->level++);
19697 if (p->error_indicator) {
19698 D(p->level--);
19699 return NULL;
19700 }
19701 asdl_seq * _res = NULL;
19702 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019703 { // star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019704 if (p->error_indicator) {
19705 D(p->level--);
19706 return NULL;
19707 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019708 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 +010019709 expr_ty elem;
19710 asdl_seq * seq;
19711 if (
19712 (elem = star_expression_rule(p)) // star_expression
19713 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019714 (seq = _loop0_71_rule(p)) // _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019715 )
19716 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019717 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 +010019718 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19719 goto done;
19720 }
19721 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019722 D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ',
19723 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_71"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019724 }
19725 _res = NULL;
19726 done:
19727 D(p->level--);
19728 return _res;
19729}
19730
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019731// _loop1_72: (',' star_expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019732static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019733_loop1_72_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019734{
19735 D(p->level++);
19736 if (p->error_indicator) {
19737 D(p->level--);
19738 return NULL;
19739 }
19740 void *_res = NULL;
19741 int _mark = p->mark;
19742 int _start_mark = p->mark;
19743 void **_children = PyMem_Malloc(sizeof(void *));
19744 if (!_children) {
19745 p->error_indicator = 1;
19746 PyErr_NoMemory();
19747 D(p->level--);
19748 return NULL;
19749 }
19750 ssize_t _children_capacity = 1;
19751 ssize_t _n = 0;
19752 { // (',' star_expression)
19753 if (p->error_indicator) {
19754 D(p->level--);
19755 return NULL;
19756 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019757 D(fprintf(stderr, "%*c> _loop1_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019758 void *_tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019759 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019760 (_tmp_142_var = _tmp_142_rule(p)) // ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019761 )
19762 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019763 _res = _tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019764 if (_n == _children_capacity) {
19765 _children_capacity *= 2;
19766 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19767 if (!_new_children) {
19768 p->error_indicator = 1;
19769 PyErr_NoMemory();
19770 D(p->level--);
19771 return NULL;
19772 }
19773 _children = _new_children;
19774 }
19775 _children[_n++] = _res;
19776 _mark = p->mark;
19777 }
19778 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019779 D(fprintf(stderr, "%*c%s _loop1_72[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019780 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
19781 }
19782 if (_n == 0 || p->error_indicator) {
19783 PyMem_Free(_children);
19784 D(p->level--);
19785 return NULL;
19786 }
19787 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19788 if (!_seq) {
19789 PyMem_Free(_children);
19790 p->error_indicator = 1;
19791 PyErr_NoMemory();
19792 D(p->level--);
19793 return NULL;
19794 }
19795 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19796 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019797 _PyPegen_insert_memo(p, _start_mark, _loop1_72_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019798 D(p->level--);
19799 return _seq;
19800}
19801
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019802// _loop0_74: ',' star_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019803static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019804_loop0_74_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019805{
19806 D(p->level++);
19807 if (p->error_indicator) {
19808 D(p->level--);
19809 return NULL;
19810 }
19811 void *_res = NULL;
19812 int _mark = p->mark;
19813 int _start_mark = p->mark;
19814 void **_children = PyMem_Malloc(sizeof(void *));
19815 if (!_children) {
19816 p->error_indicator = 1;
19817 PyErr_NoMemory();
19818 D(p->level--);
19819 return NULL;
19820 }
19821 ssize_t _children_capacity = 1;
19822 ssize_t _n = 0;
19823 { // ',' star_named_expression
19824 if (p->error_indicator) {
19825 D(p->level--);
19826 return NULL;
19827 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019828 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 +010019829 Token * _literal;
19830 expr_ty elem;
19831 while (
19832 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19833 &&
19834 (elem = star_named_expression_rule(p)) // star_named_expression
19835 )
19836 {
19837 _res = elem;
19838 if (_res == NULL && PyErr_Occurred()) {
19839 p->error_indicator = 1;
19840 PyMem_Free(_children);
19841 D(p->level--);
19842 return NULL;
19843 }
19844 if (_n == _children_capacity) {
19845 _children_capacity *= 2;
19846 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19847 if (!_new_children) {
19848 p->error_indicator = 1;
19849 PyErr_NoMemory();
19850 D(p->level--);
19851 return NULL;
19852 }
19853 _children = _new_children;
19854 }
19855 _children[_n++] = _res;
19856 _mark = p->mark;
19857 }
19858 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019859 D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019860 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
19861 }
19862 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19863 if (!_seq) {
19864 PyMem_Free(_children);
19865 p->error_indicator = 1;
19866 PyErr_NoMemory();
19867 D(p->level--);
19868 return NULL;
19869 }
19870 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19871 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019872 _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019873 D(p->level--);
19874 return _seq;
19875}
19876
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019877// _gather_73: star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019878static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019879_gather_73_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019880{
19881 D(p->level++);
19882 if (p->error_indicator) {
19883 D(p->level--);
19884 return NULL;
19885 }
19886 asdl_seq * _res = NULL;
19887 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019888 { // star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019889 if (p->error_indicator) {
19890 D(p->level--);
19891 return NULL;
19892 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019893 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 +010019894 expr_ty elem;
19895 asdl_seq * seq;
19896 if (
19897 (elem = star_named_expression_rule(p)) // star_named_expression
19898 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019899 (seq = _loop0_74_rule(p)) // _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019900 )
19901 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019902 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 +010019903 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19904 goto done;
19905 }
19906 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019907 D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ',
19908 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_74"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019909 }
19910 _res = NULL;
19911 done:
19912 D(p->level--);
19913 return _res;
19914}
19915
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019916// _loop1_75: (',' expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019917static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019918_loop1_75_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019919{
19920 D(p->level++);
19921 if (p->error_indicator) {
19922 D(p->level--);
19923 return NULL;
19924 }
19925 void *_res = NULL;
19926 int _mark = p->mark;
19927 int _start_mark = p->mark;
19928 void **_children = PyMem_Malloc(sizeof(void *));
19929 if (!_children) {
19930 p->error_indicator = 1;
19931 PyErr_NoMemory();
19932 D(p->level--);
19933 return NULL;
19934 }
19935 ssize_t _children_capacity = 1;
19936 ssize_t _n = 0;
19937 { // (',' expression)
19938 if (p->error_indicator) {
19939 D(p->level--);
19940 return NULL;
19941 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019942 D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019943 void *_tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019944 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019945 (_tmp_143_var = _tmp_143_rule(p)) // ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019946 )
19947 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030019948 _res = _tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019949 if (_n == _children_capacity) {
19950 _children_capacity *= 2;
19951 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19952 if (!_new_children) {
19953 p->error_indicator = 1;
19954 PyErr_NoMemory();
19955 D(p->level--);
19956 return NULL;
19957 }
19958 _children = _new_children;
19959 }
19960 _children[_n++] = _res;
19961 _mark = p->mark;
19962 }
19963 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019964 D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019965 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
19966 }
19967 if (_n == 0 || p->error_indicator) {
19968 PyMem_Free(_children);
19969 D(p->level--);
19970 return NULL;
19971 }
19972 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19973 if (!_seq) {
19974 PyMem_Free(_children);
19975 p->error_indicator = 1;
19976 PyErr_NoMemory();
19977 D(p->level--);
19978 return NULL;
19979 }
19980 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19981 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019982 _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019983 D(p->level--);
19984 return _seq;
19985}
19986
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019987// _loop0_76: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019988static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019989_loop0_76_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019990{
19991 D(p->level++);
19992 if (p->error_indicator) {
19993 D(p->level--);
19994 return NULL;
19995 }
19996 void *_res = NULL;
19997 int _mark = p->mark;
19998 int _start_mark = p->mark;
19999 void **_children = PyMem_Malloc(sizeof(void *));
20000 if (!_children) {
20001 p->error_indicator = 1;
20002 PyErr_NoMemory();
20003 D(p->level--);
20004 return NULL;
20005 }
20006 ssize_t _children_capacity = 1;
20007 ssize_t _n = 0;
20008 { // lambda_param_no_default
20009 if (p->error_indicator) {
20010 D(p->level--);
20011 return NULL;
20012 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020013 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 +010020014 arg_ty lambda_param_no_default_var;
20015 while (
20016 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20017 )
20018 {
20019 _res = lambda_param_no_default_var;
20020 if (_n == _children_capacity) {
20021 _children_capacity *= 2;
20022 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20023 if (!_new_children) {
20024 p->error_indicator = 1;
20025 PyErr_NoMemory();
20026 D(p->level--);
20027 return NULL;
20028 }
20029 _children = _new_children;
20030 }
20031 _children[_n++] = _res;
20032 _mark = p->mark;
20033 }
20034 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020035 D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020036 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020037 }
20038 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20039 if (!_seq) {
20040 PyMem_Free(_children);
20041 p->error_indicator = 1;
20042 PyErr_NoMemory();
20043 D(p->level--);
20044 return NULL;
20045 }
20046 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20047 PyMem_Free(_children);
20048 _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq);
20049 D(p->level--);
20050 return _seq;
20051}
20052
20053// _loop0_77: lambda_param_with_default
20054static asdl_seq *
20055_loop0_77_rule(Parser *p)
20056{
20057 D(p->level++);
20058 if (p->error_indicator) {
20059 D(p->level--);
20060 return NULL;
20061 }
20062 void *_res = NULL;
20063 int _mark = p->mark;
20064 int _start_mark = p->mark;
20065 void **_children = PyMem_Malloc(sizeof(void *));
20066 if (!_children) {
20067 p->error_indicator = 1;
20068 PyErr_NoMemory();
20069 D(p->level--);
20070 return NULL;
20071 }
20072 ssize_t _children_capacity = 1;
20073 ssize_t _n = 0;
20074 { // lambda_param_with_default
20075 if (p->error_indicator) {
20076 D(p->level--);
20077 return NULL;
20078 }
20079 D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20080 NameDefaultPair* lambda_param_with_default_var;
20081 while (
20082 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20083 )
20084 {
20085 _res = lambda_param_with_default_var;
20086 if (_n == _children_capacity) {
20087 _children_capacity *= 2;
20088 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20089 if (!_new_children) {
20090 p->error_indicator = 1;
20091 PyErr_NoMemory();
20092 D(p->level--);
20093 return NULL;
20094 }
20095 _children = _new_children;
20096 }
20097 _children[_n++] = _res;
20098 _mark = p->mark;
20099 }
20100 p->mark = _mark;
20101 D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ',
20102 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20103 }
20104 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20105 if (!_seq) {
20106 PyMem_Free(_children);
20107 p->error_indicator = 1;
20108 PyErr_NoMemory();
20109 D(p->level--);
20110 return NULL;
20111 }
20112 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20113 PyMem_Free(_children);
20114 _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq);
20115 D(p->level--);
20116 return _seq;
20117}
20118
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020119// _loop0_78: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020120static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020121_loop0_78_rule(Parser *p)
20122{
20123 D(p->level++);
20124 if (p->error_indicator) {
20125 D(p->level--);
20126 return NULL;
20127 }
20128 void *_res = NULL;
20129 int _mark = p->mark;
20130 int _start_mark = p->mark;
20131 void **_children = PyMem_Malloc(sizeof(void *));
20132 if (!_children) {
20133 p->error_indicator = 1;
20134 PyErr_NoMemory();
20135 D(p->level--);
20136 return NULL;
20137 }
20138 ssize_t _children_capacity = 1;
20139 ssize_t _n = 0;
20140 { // lambda_param_with_default
20141 if (p->error_indicator) {
20142 D(p->level--);
20143 return NULL;
20144 }
20145 D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20146 NameDefaultPair* lambda_param_with_default_var;
20147 while (
20148 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20149 )
20150 {
20151 _res = lambda_param_with_default_var;
20152 if (_n == _children_capacity) {
20153 _children_capacity *= 2;
20154 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20155 if (!_new_children) {
20156 p->error_indicator = 1;
20157 PyErr_NoMemory();
20158 D(p->level--);
20159 return NULL;
20160 }
20161 _children = _new_children;
20162 }
20163 _children[_n++] = _res;
20164 _mark = p->mark;
20165 }
20166 p->mark = _mark;
20167 D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
20168 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20169 }
20170 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20171 if (!_seq) {
20172 PyMem_Free(_children);
20173 p->error_indicator = 1;
20174 PyErr_NoMemory();
20175 D(p->level--);
20176 return NULL;
20177 }
20178 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20179 PyMem_Free(_children);
20180 _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
20181 D(p->level--);
20182 return _seq;
20183}
20184
20185// _loop1_79: lambda_param_no_default
20186static asdl_seq *
20187_loop1_79_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020188{
20189 D(p->level++);
20190 if (p->error_indicator) {
20191 D(p->level--);
20192 return NULL;
20193 }
20194 void *_res = NULL;
20195 int _mark = p->mark;
20196 int _start_mark = p->mark;
20197 void **_children = PyMem_Malloc(sizeof(void *));
20198 if (!_children) {
20199 p->error_indicator = 1;
20200 PyErr_NoMemory();
20201 D(p->level--);
20202 return NULL;
20203 }
20204 ssize_t _children_capacity = 1;
20205 ssize_t _n = 0;
20206 { // lambda_param_no_default
20207 if (p->error_indicator) {
20208 D(p->level--);
20209 return NULL;
20210 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020211 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 +010020212 arg_ty lambda_param_no_default_var;
20213 while (
20214 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20215 )
20216 {
20217 _res = lambda_param_no_default_var;
20218 if (_n == _children_capacity) {
20219 _children_capacity *= 2;
20220 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20221 if (!_new_children) {
20222 p->error_indicator = 1;
20223 PyErr_NoMemory();
20224 D(p->level--);
20225 return NULL;
20226 }
20227 _children = _new_children;
20228 }
20229 _children[_n++] = _res;
20230 _mark = p->mark;
20231 }
20232 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020233 D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020234 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20235 }
20236 if (_n == 0 || p->error_indicator) {
20237 PyMem_Free(_children);
20238 D(p->level--);
20239 return NULL;
20240 }
20241 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20242 if (!_seq) {
20243 PyMem_Free(_children);
20244 p->error_indicator = 1;
20245 PyErr_NoMemory();
20246 D(p->level--);
20247 return NULL;
20248 }
20249 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20250 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020251 _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020252 D(p->level--);
20253 return _seq;
20254}
20255
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020256// _loop0_80: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020257static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020258_loop0_80_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020259{
20260 D(p->level++);
20261 if (p->error_indicator) {
20262 D(p->level--);
20263 return NULL;
20264 }
20265 void *_res = NULL;
20266 int _mark = p->mark;
20267 int _start_mark = p->mark;
20268 void **_children = PyMem_Malloc(sizeof(void *));
20269 if (!_children) {
20270 p->error_indicator = 1;
20271 PyErr_NoMemory();
20272 D(p->level--);
20273 return NULL;
20274 }
20275 ssize_t _children_capacity = 1;
20276 ssize_t _n = 0;
20277 { // lambda_param_with_default
20278 if (p->error_indicator) {
20279 D(p->level--);
20280 return NULL;
20281 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020282 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 +010020283 NameDefaultPair* lambda_param_with_default_var;
20284 while (
20285 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20286 )
20287 {
20288 _res = lambda_param_with_default_var;
20289 if (_n == _children_capacity) {
20290 _children_capacity *= 2;
20291 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20292 if (!_new_children) {
20293 p->error_indicator = 1;
20294 PyErr_NoMemory();
20295 D(p->level--);
20296 return NULL;
20297 }
20298 _children = _new_children;
20299 }
20300 _children[_n++] = _res;
20301 _mark = p->mark;
20302 }
20303 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020304 D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020305 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20306 }
20307 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20308 if (!_seq) {
20309 PyMem_Free(_children);
20310 p->error_indicator = 1;
20311 PyErr_NoMemory();
20312 D(p->level--);
20313 return NULL;
20314 }
20315 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20316 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020317 _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020318 D(p->level--);
20319 return _seq;
20320}
20321
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020322// _loop1_81: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020323static asdl_seq *
20324_loop1_81_rule(Parser *p)
20325{
20326 D(p->level++);
20327 if (p->error_indicator) {
20328 D(p->level--);
20329 return NULL;
20330 }
20331 void *_res = NULL;
20332 int _mark = p->mark;
20333 int _start_mark = p->mark;
20334 void **_children = PyMem_Malloc(sizeof(void *));
20335 if (!_children) {
20336 p->error_indicator = 1;
20337 PyErr_NoMemory();
20338 D(p->level--);
20339 return NULL;
20340 }
20341 ssize_t _children_capacity = 1;
20342 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020343 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020344 if (p->error_indicator) {
20345 D(p->level--);
20346 return NULL;
20347 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020348 D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20349 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020350 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020351 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020352 )
20353 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020354 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020355 if (_n == _children_capacity) {
20356 _children_capacity *= 2;
20357 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20358 if (!_new_children) {
20359 p->error_indicator = 1;
20360 PyErr_NoMemory();
20361 D(p->level--);
20362 return NULL;
20363 }
20364 _children = _new_children;
20365 }
20366 _children[_n++] = _res;
20367 _mark = p->mark;
20368 }
20369 p->mark = _mark;
20370 D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020371 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020372 }
20373 if (_n == 0 || p->error_indicator) {
20374 PyMem_Free(_children);
20375 D(p->level--);
20376 return NULL;
20377 }
20378 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20379 if (!_seq) {
20380 PyMem_Free(_children);
20381 p->error_indicator = 1;
20382 PyErr_NoMemory();
20383 D(p->level--);
20384 return NULL;
20385 }
20386 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20387 PyMem_Free(_children);
20388 _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
20389 D(p->level--);
20390 return _seq;
20391}
20392
20393// _loop1_82: lambda_param_no_default
20394static asdl_seq *
20395_loop1_82_rule(Parser *p)
20396{
20397 D(p->level++);
20398 if (p->error_indicator) {
20399 D(p->level--);
20400 return NULL;
20401 }
20402 void *_res = NULL;
20403 int _mark = p->mark;
20404 int _start_mark = p->mark;
20405 void **_children = PyMem_Malloc(sizeof(void *));
20406 if (!_children) {
20407 p->error_indicator = 1;
20408 PyErr_NoMemory();
20409 D(p->level--);
20410 return NULL;
20411 }
20412 ssize_t _children_capacity = 1;
20413 ssize_t _n = 0;
20414 { // lambda_param_no_default
20415 if (p->error_indicator) {
20416 D(p->level--);
20417 return NULL;
20418 }
20419 D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20420 arg_ty lambda_param_no_default_var;
20421 while (
20422 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20423 )
20424 {
20425 _res = lambda_param_no_default_var;
20426 if (_n == _children_capacity) {
20427 _children_capacity *= 2;
20428 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20429 if (!_new_children) {
20430 p->error_indicator = 1;
20431 PyErr_NoMemory();
20432 D(p->level--);
20433 return NULL;
20434 }
20435 _children = _new_children;
20436 }
20437 _children[_n++] = _res;
20438 _mark = p->mark;
20439 }
20440 p->mark = _mark;
20441 D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ',
20442 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20443 }
20444 if (_n == 0 || p->error_indicator) {
20445 PyMem_Free(_children);
20446 D(p->level--);
20447 return NULL;
20448 }
20449 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20450 if (!_seq) {
20451 PyMem_Free(_children);
20452 p->error_indicator = 1;
20453 PyErr_NoMemory();
20454 D(p->level--);
20455 return NULL;
20456 }
20457 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20458 PyMem_Free(_children);
20459 _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq);
20460 D(p->level--);
20461 return _seq;
20462}
20463
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020464// _loop1_83: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020465static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020466_loop1_83_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020467{
20468 D(p->level++);
20469 if (p->error_indicator) {
20470 D(p->level--);
20471 return NULL;
20472 }
20473 void *_res = NULL;
20474 int _mark = p->mark;
20475 int _start_mark = p->mark;
20476 void **_children = PyMem_Malloc(sizeof(void *));
20477 if (!_children) {
20478 p->error_indicator = 1;
20479 PyErr_NoMemory();
20480 D(p->level--);
20481 return NULL;
20482 }
20483 ssize_t _children_capacity = 1;
20484 ssize_t _n = 0;
20485 { // lambda_param_no_default
20486 if (p->error_indicator) {
20487 D(p->level--);
20488 return NULL;
20489 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020490 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 +010020491 arg_ty lambda_param_no_default_var;
20492 while (
20493 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20494 )
20495 {
20496 _res = lambda_param_no_default_var;
20497 if (_n == _children_capacity) {
20498 _children_capacity *= 2;
20499 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20500 if (!_new_children) {
20501 p->error_indicator = 1;
20502 PyErr_NoMemory();
20503 D(p->level--);
20504 return NULL;
20505 }
20506 _children = _new_children;
20507 }
20508 _children[_n++] = _res;
20509 _mark = p->mark;
20510 }
20511 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020512 D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020513 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20514 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020515 if (_n == 0 || p->error_indicator) {
20516 PyMem_Free(_children);
20517 D(p->level--);
20518 return NULL;
20519 }
20520 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20521 if (!_seq) {
20522 PyMem_Free(_children);
20523 p->error_indicator = 1;
20524 PyErr_NoMemory();
20525 D(p->level--);
20526 return NULL;
20527 }
20528 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20529 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020530 _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020531 D(p->level--);
20532 return _seq;
20533}
20534
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020535// _loop0_84: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020536static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020537_loop0_84_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020538{
20539 D(p->level++);
20540 if (p->error_indicator) {
20541 D(p->level--);
20542 return NULL;
20543 }
20544 void *_res = NULL;
20545 int _mark = p->mark;
20546 int _start_mark = p->mark;
20547 void **_children = PyMem_Malloc(sizeof(void *));
20548 if (!_children) {
20549 p->error_indicator = 1;
20550 PyErr_NoMemory();
20551 D(p->level--);
20552 return NULL;
20553 }
20554 ssize_t _children_capacity = 1;
20555 ssize_t _n = 0;
20556 { // lambda_param_no_default
20557 if (p->error_indicator) {
20558 D(p->level--);
20559 return NULL;
20560 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020561 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 +010020562 arg_ty lambda_param_no_default_var;
20563 while (
20564 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20565 )
20566 {
20567 _res = lambda_param_no_default_var;
20568 if (_n == _children_capacity) {
20569 _children_capacity *= 2;
20570 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20571 if (!_new_children) {
20572 p->error_indicator = 1;
20573 PyErr_NoMemory();
20574 D(p->level--);
20575 return NULL;
20576 }
20577 _children = _new_children;
20578 }
20579 _children[_n++] = _res;
20580 _mark = p->mark;
20581 }
20582 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020583 D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020584 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20585 }
20586 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20587 if (!_seq) {
20588 PyMem_Free(_children);
20589 p->error_indicator = 1;
20590 PyErr_NoMemory();
20591 D(p->level--);
20592 return NULL;
20593 }
20594 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20595 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020596 _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020597 D(p->level--);
20598 return _seq;
20599}
20600
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020601// _loop1_85: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020602static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020603_loop1_85_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020604{
20605 D(p->level++);
20606 if (p->error_indicator) {
20607 D(p->level--);
20608 return NULL;
20609 }
20610 void *_res = NULL;
20611 int _mark = p->mark;
20612 int _start_mark = p->mark;
20613 void **_children = PyMem_Malloc(sizeof(void *));
20614 if (!_children) {
20615 p->error_indicator = 1;
20616 PyErr_NoMemory();
20617 D(p->level--);
20618 return NULL;
20619 }
20620 ssize_t _children_capacity = 1;
20621 ssize_t _n = 0;
20622 { // lambda_param_with_default
20623 if (p->error_indicator) {
20624 D(p->level--);
20625 return NULL;
20626 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020627 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 +010020628 NameDefaultPair* lambda_param_with_default_var;
20629 while (
20630 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20631 )
20632 {
20633 _res = lambda_param_with_default_var;
20634 if (_n == _children_capacity) {
20635 _children_capacity *= 2;
20636 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20637 if (!_new_children) {
20638 p->error_indicator = 1;
20639 PyErr_NoMemory();
20640 D(p->level--);
20641 return NULL;
20642 }
20643 _children = _new_children;
20644 }
20645 _children[_n++] = _res;
20646 _mark = p->mark;
20647 }
20648 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020649 D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020650 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20651 }
20652 if (_n == 0 || p->error_indicator) {
20653 PyMem_Free(_children);
20654 D(p->level--);
20655 return NULL;
20656 }
20657 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20658 if (!_seq) {
20659 PyMem_Free(_children);
20660 p->error_indicator = 1;
20661 PyErr_NoMemory();
20662 D(p->level--);
20663 return NULL;
20664 }
20665 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20666 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020667 _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020668 D(p->level--);
20669 return _seq;
20670}
20671
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020672// _loop0_86: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020673static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020674_loop0_86_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020675{
20676 D(p->level++);
20677 if (p->error_indicator) {
20678 D(p->level--);
20679 return NULL;
20680 }
20681 void *_res = NULL;
20682 int _mark = p->mark;
20683 int _start_mark = p->mark;
20684 void **_children = PyMem_Malloc(sizeof(void *));
20685 if (!_children) {
20686 p->error_indicator = 1;
20687 PyErr_NoMemory();
20688 D(p->level--);
20689 return NULL;
20690 }
20691 ssize_t _children_capacity = 1;
20692 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020693 { // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020694 if (p->error_indicator) {
20695 D(p->level--);
20696 return NULL;
20697 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020698 D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20699 arg_ty lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020700 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020701 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020702 )
20703 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020704 _res = lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020705 if (_n == _children_capacity) {
20706 _children_capacity *= 2;
20707 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20708 if (!_new_children) {
20709 p->error_indicator = 1;
20710 PyErr_NoMemory();
20711 D(p->level--);
20712 return NULL;
20713 }
20714 _children = _new_children;
20715 }
20716 _children[_n++] = _res;
20717 _mark = p->mark;
20718 }
20719 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020720 D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
20721 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020722 }
20723 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20724 if (!_seq) {
20725 PyMem_Free(_children);
20726 p->error_indicator = 1;
20727 PyErr_NoMemory();
20728 D(p->level--);
20729 return NULL;
20730 }
20731 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20732 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020733 _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020734 D(p->level--);
20735 return _seq;
20736}
20737
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020738// _loop1_87: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020739static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020740_loop1_87_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020741{
20742 D(p->level++);
20743 if (p->error_indicator) {
20744 D(p->level--);
20745 return NULL;
20746 }
20747 void *_res = NULL;
20748 int _mark = p->mark;
20749 int _start_mark = p->mark;
20750 void **_children = PyMem_Malloc(sizeof(void *));
20751 if (!_children) {
20752 p->error_indicator = 1;
20753 PyErr_NoMemory();
20754 D(p->level--);
20755 return NULL;
20756 }
20757 ssize_t _children_capacity = 1;
20758 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020759 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020760 if (p->error_indicator) {
20761 D(p->level--);
20762 return NULL;
20763 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020764 D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20765 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020766 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020767 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020768 )
20769 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020770 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020771 if (_n == _children_capacity) {
20772 _children_capacity *= 2;
20773 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20774 if (!_new_children) {
20775 p->error_indicator = 1;
20776 PyErr_NoMemory();
20777 D(p->level--);
20778 return NULL;
20779 }
20780 _children = _new_children;
20781 }
20782 _children[_n++] = _res;
20783 _mark = p->mark;
20784 }
20785 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020786 D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ',
20787 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020788 }
20789 if (_n == 0 || p->error_indicator) {
20790 PyMem_Free(_children);
20791 D(p->level--);
20792 return NULL;
20793 }
20794 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20795 if (!_seq) {
20796 PyMem_Free(_children);
20797 p->error_indicator = 1;
20798 PyErr_NoMemory();
20799 D(p->level--);
20800 return NULL;
20801 }
20802 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20803 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020804 _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020805 D(p->level--);
20806 return _seq;
20807}
20808
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020809// _loop0_88: lambda_param_maybe_default
20810static asdl_seq *
20811_loop0_88_rule(Parser *p)
20812{
20813 D(p->level++);
20814 if (p->error_indicator) {
20815 D(p->level--);
20816 return NULL;
20817 }
20818 void *_res = NULL;
20819 int _mark = p->mark;
20820 int _start_mark = p->mark;
20821 void **_children = PyMem_Malloc(sizeof(void *));
20822 if (!_children) {
20823 p->error_indicator = 1;
20824 PyErr_NoMemory();
20825 D(p->level--);
20826 return NULL;
20827 }
20828 ssize_t _children_capacity = 1;
20829 ssize_t _n = 0;
20830 { // lambda_param_maybe_default
20831 if (p->error_indicator) {
20832 D(p->level--);
20833 return NULL;
20834 }
20835 D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20836 NameDefaultPair* lambda_param_maybe_default_var;
20837 while (
20838 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20839 )
20840 {
20841 _res = lambda_param_maybe_default_var;
20842 if (_n == _children_capacity) {
20843 _children_capacity *= 2;
20844 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20845 if (!_new_children) {
20846 p->error_indicator = 1;
20847 PyErr_NoMemory();
20848 D(p->level--);
20849 return NULL;
20850 }
20851 _children = _new_children;
20852 }
20853 _children[_n++] = _res;
20854 _mark = p->mark;
20855 }
20856 p->mark = _mark;
20857 D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ',
20858 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20859 }
20860 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20861 if (!_seq) {
20862 PyMem_Free(_children);
20863 p->error_indicator = 1;
20864 PyErr_NoMemory();
20865 D(p->level--);
20866 return NULL;
20867 }
20868 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20869 PyMem_Free(_children);
20870 _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq);
20871 D(p->level--);
20872 return _seq;
20873}
20874
20875// _loop1_89: lambda_param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020876static asdl_seq *
20877_loop1_89_rule(Parser *p)
20878{
20879 D(p->level++);
20880 if (p->error_indicator) {
20881 D(p->level--);
20882 return NULL;
20883 }
20884 void *_res = NULL;
20885 int _mark = p->mark;
20886 int _start_mark = p->mark;
20887 void **_children = PyMem_Malloc(sizeof(void *));
20888 if (!_children) {
20889 p->error_indicator = 1;
20890 PyErr_NoMemory();
20891 D(p->level--);
20892 return NULL;
20893 }
20894 ssize_t _children_capacity = 1;
20895 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020896 { // lambda_param_maybe_default
20897 if (p->error_indicator) {
20898 D(p->level--);
20899 return NULL;
20900 }
20901 D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20902 NameDefaultPair* lambda_param_maybe_default_var;
20903 while (
20904 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20905 )
20906 {
20907 _res = lambda_param_maybe_default_var;
20908 if (_n == _children_capacity) {
20909 _children_capacity *= 2;
20910 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20911 if (!_new_children) {
20912 p->error_indicator = 1;
20913 PyErr_NoMemory();
20914 D(p->level--);
20915 return NULL;
20916 }
20917 _children = _new_children;
20918 }
20919 _children[_n++] = _res;
20920 _mark = p->mark;
20921 }
20922 p->mark = _mark;
20923 D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ',
20924 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20925 }
20926 if (_n == 0 || p->error_indicator) {
20927 PyMem_Free(_children);
20928 D(p->level--);
20929 return NULL;
20930 }
20931 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20932 if (!_seq) {
20933 PyMem_Free(_children);
20934 p->error_indicator = 1;
20935 PyErr_NoMemory();
20936 D(p->level--);
20937 return NULL;
20938 }
20939 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20940 PyMem_Free(_children);
20941 _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
20942 D(p->level--);
20943 return _seq;
20944}
20945
20946// _loop1_90: ('or' conjunction)
20947static asdl_seq *
20948_loop1_90_rule(Parser *p)
20949{
20950 D(p->level++);
20951 if (p->error_indicator) {
20952 D(p->level--);
20953 return NULL;
20954 }
20955 void *_res = NULL;
20956 int _mark = p->mark;
20957 int _start_mark = p->mark;
20958 void **_children = PyMem_Malloc(sizeof(void *));
20959 if (!_children) {
20960 p->error_indicator = 1;
20961 PyErr_NoMemory();
20962 D(p->level--);
20963 return NULL;
20964 }
20965 ssize_t _children_capacity = 1;
20966 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020967 { // ('or' conjunction)
20968 if (p->error_indicator) {
20969 D(p->level--);
20970 return NULL;
20971 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020972 D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030020973 void *_tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020974 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030020975 (_tmp_144_var = _tmp_144_rule(p)) // 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020976 )
20977 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030020978 _res = _tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020979 if (_n == _children_capacity) {
20980 _children_capacity *= 2;
20981 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20982 if (!_new_children) {
20983 p->error_indicator = 1;
20984 PyErr_NoMemory();
20985 D(p->level--);
20986 return NULL;
20987 }
20988 _children = _new_children;
20989 }
20990 _children[_n++] = _res;
20991 _mark = p->mark;
20992 }
20993 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020994 D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020995 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
20996 }
20997 if (_n == 0 || p->error_indicator) {
20998 PyMem_Free(_children);
20999 D(p->level--);
21000 return NULL;
21001 }
21002 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21003 if (!_seq) {
21004 PyMem_Free(_children);
21005 p->error_indicator = 1;
21006 PyErr_NoMemory();
21007 D(p->level--);
21008 return NULL;
21009 }
21010 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21011 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021012 _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021013 D(p->level--);
21014 return _seq;
21015}
21016
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021017// _loop1_91: ('and' inversion)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021018static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021019_loop1_91_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021020{
21021 D(p->level++);
21022 if (p->error_indicator) {
21023 D(p->level--);
21024 return NULL;
21025 }
21026 void *_res = NULL;
21027 int _mark = p->mark;
21028 int _start_mark = p->mark;
21029 void **_children = PyMem_Malloc(sizeof(void *));
21030 if (!_children) {
21031 p->error_indicator = 1;
21032 PyErr_NoMemory();
21033 D(p->level--);
21034 return NULL;
21035 }
21036 ssize_t _children_capacity = 1;
21037 ssize_t _n = 0;
21038 { // ('and' inversion)
21039 if (p->error_indicator) {
21040 D(p->level--);
21041 return NULL;
21042 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021043 D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021044 void *_tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021045 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021046 (_tmp_145_var = _tmp_145_rule(p)) // 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021047 )
21048 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021049 _res = _tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021050 if (_n == _children_capacity) {
21051 _children_capacity *= 2;
21052 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21053 if (!_new_children) {
21054 p->error_indicator = 1;
21055 PyErr_NoMemory();
21056 D(p->level--);
21057 return NULL;
21058 }
21059 _children = _new_children;
21060 }
21061 _children[_n++] = _res;
21062 _mark = p->mark;
21063 }
21064 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021065 D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021066 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
21067 }
21068 if (_n == 0 || p->error_indicator) {
21069 PyMem_Free(_children);
21070 D(p->level--);
21071 return NULL;
21072 }
21073 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21074 if (!_seq) {
21075 PyMem_Free(_children);
21076 p->error_indicator = 1;
21077 PyErr_NoMemory();
21078 D(p->level--);
21079 return NULL;
21080 }
21081 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21082 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021083 _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021084 D(p->level--);
21085 return _seq;
21086}
21087
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021088// _loop1_92: compare_op_bitwise_or_pair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021089static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021090_loop1_92_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021091{
21092 D(p->level++);
21093 if (p->error_indicator) {
21094 D(p->level--);
21095 return NULL;
21096 }
21097 void *_res = NULL;
21098 int _mark = p->mark;
21099 int _start_mark = p->mark;
21100 void **_children = PyMem_Malloc(sizeof(void *));
21101 if (!_children) {
21102 p->error_indicator = 1;
21103 PyErr_NoMemory();
21104 D(p->level--);
21105 return NULL;
21106 }
21107 ssize_t _children_capacity = 1;
21108 ssize_t _n = 0;
21109 { // compare_op_bitwise_or_pair
21110 if (p->error_indicator) {
21111 D(p->level--);
21112 return NULL;
21113 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021114 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 +010021115 CmpopExprPair* compare_op_bitwise_or_pair_var;
21116 while (
21117 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
21118 )
21119 {
21120 _res = compare_op_bitwise_or_pair_var;
21121 if (_n == _children_capacity) {
21122 _children_capacity *= 2;
21123 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21124 if (!_new_children) {
21125 p->error_indicator = 1;
21126 PyErr_NoMemory();
21127 D(p->level--);
21128 return NULL;
21129 }
21130 _children = _new_children;
21131 }
21132 _children[_n++] = _res;
21133 _mark = p->mark;
21134 }
21135 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021136 D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021137 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
21138 }
21139 if (_n == 0 || p->error_indicator) {
21140 PyMem_Free(_children);
21141 D(p->level--);
21142 return NULL;
21143 }
21144 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21145 if (!_seq) {
21146 PyMem_Free(_children);
21147 p->error_indicator = 1;
21148 PyErr_NoMemory();
21149 D(p->level--);
21150 return NULL;
21151 }
21152 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21153 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021154 _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021155 D(p->level--);
21156 return _seq;
21157}
21158
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021159// _tmp_93: '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021160static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021161_tmp_93_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021162{
21163 D(p->level++);
21164 if (p->error_indicator) {
21165 D(p->level--);
21166 return NULL;
21167 }
21168 void * _res = NULL;
21169 int _mark = p->mark;
21170 { // '!='
21171 if (p->error_indicator) {
21172 D(p->level--);
21173 return NULL;
21174 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021175 D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021176 Token * tok;
21177 if (
21178 (tok = _PyPegen_expect_token(p, 28)) // token='!='
21179 )
21180 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021181 D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021182 _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok;
21183 if (_res == NULL && PyErr_Occurred()) {
21184 p->error_indicator = 1;
21185 D(p->level--);
21186 return NULL;
21187 }
21188 goto done;
21189 }
21190 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021191 D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021192 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
21193 }
21194 _res = NULL;
21195 done:
21196 D(p->level--);
21197 return _res;
21198}
21199
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021200// _loop0_95: ',' slice
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021201static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021202_loop0_95_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021203{
21204 D(p->level++);
21205 if (p->error_indicator) {
21206 D(p->level--);
21207 return NULL;
21208 }
21209 void *_res = NULL;
21210 int _mark = p->mark;
21211 int _start_mark = p->mark;
21212 void **_children = PyMem_Malloc(sizeof(void *));
21213 if (!_children) {
21214 p->error_indicator = 1;
21215 PyErr_NoMemory();
21216 D(p->level--);
21217 return NULL;
21218 }
21219 ssize_t _children_capacity = 1;
21220 ssize_t _n = 0;
21221 { // ',' slice
21222 if (p->error_indicator) {
21223 D(p->level--);
21224 return NULL;
21225 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021226 D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021227 Token * _literal;
21228 expr_ty elem;
21229 while (
21230 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21231 &&
21232 (elem = slice_rule(p)) // slice
21233 )
21234 {
21235 _res = elem;
21236 if (_res == NULL && PyErr_Occurred()) {
21237 p->error_indicator = 1;
21238 PyMem_Free(_children);
21239 D(p->level--);
21240 return NULL;
21241 }
21242 if (_n == _children_capacity) {
21243 _children_capacity *= 2;
21244 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21245 if (!_new_children) {
21246 p->error_indicator = 1;
21247 PyErr_NoMemory();
21248 D(p->level--);
21249 return NULL;
21250 }
21251 _children = _new_children;
21252 }
21253 _children[_n++] = _res;
21254 _mark = p->mark;
21255 }
21256 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021257 D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021258 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
21259 }
21260 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21261 if (!_seq) {
21262 PyMem_Free(_children);
21263 p->error_indicator = 1;
21264 PyErr_NoMemory();
21265 D(p->level--);
21266 return NULL;
21267 }
21268 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21269 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021270 _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021271 D(p->level--);
21272 return _seq;
21273}
21274
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021275// _gather_94: slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021276static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021277_gather_94_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021278{
21279 D(p->level++);
21280 if (p->error_indicator) {
21281 D(p->level--);
21282 return NULL;
21283 }
21284 asdl_seq * _res = NULL;
21285 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021286 { // slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021287 if (p->error_indicator) {
21288 D(p->level--);
21289 return NULL;
21290 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021291 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 +010021292 expr_ty elem;
21293 asdl_seq * seq;
21294 if (
21295 (elem = slice_rule(p)) // slice
21296 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021297 (seq = _loop0_95_rule(p)) // _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021298 )
21299 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021300 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 +010021301 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21302 goto done;
21303 }
21304 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021305 D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ',
21306 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_95"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021307 }
21308 _res = NULL;
21309 done:
21310 D(p->level--);
21311 return _res;
21312}
21313
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021314// _tmp_96: ':' expression?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021315static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021316_tmp_96_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021317{
21318 D(p->level++);
21319 if (p->error_indicator) {
21320 D(p->level--);
21321 return NULL;
21322 }
21323 void * _res = NULL;
21324 int _mark = p->mark;
21325 { // ':' expression?
21326 if (p->error_indicator) {
21327 D(p->level--);
21328 return NULL;
21329 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021330 D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021331 Token * _literal;
21332 void *d;
21333 if (
21334 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
21335 &&
21336 (d = expression_rule(p), 1) // expression?
21337 )
21338 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021339 D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021340 _res = d;
21341 if (_res == NULL && PyErr_Occurred()) {
21342 p->error_indicator = 1;
21343 D(p->level--);
21344 return NULL;
21345 }
21346 goto done;
21347 }
21348 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021349 D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021350 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
21351 }
21352 _res = NULL;
21353 done:
21354 D(p->level--);
21355 return _res;
21356}
21357
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021358// _tmp_97: tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021359static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021360_tmp_97_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021361{
21362 D(p->level++);
21363 if (p->error_indicator) {
21364 D(p->level--);
21365 return NULL;
21366 }
21367 void * _res = NULL;
21368 int _mark = p->mark;
21369 { // tuple
21370 if (p->error_indicator) {
21371 D(p->level--);
21372 return NULL;
21373 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021374 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021375 expr_ty tuple_var;
21376 if (
21377 (tuple_var = tuple_rule(p)) // tuple
21378 )
21379 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021380 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021381 _res = tuple_var;
21382 goto done;
21383 }
21384 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021385 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021386 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
21387 }
21388 { // group
21389 if (p->error_indicator) {
21390 D(p->level--);
21391 return NULL;
21392 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021393 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021394 expr_ty group_var;
21395 if (
21396 (group_var = group_rule(p)) // group
21397 )
21398 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021399 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021400 _res = group_var;
21401 goto done;
21402 }
21403 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021404 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021405 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
21406 }
21407 { // genexp
21408 if (p->error_indicator) {
21409 D(p->level--);
21410 return NULL;
21411 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021412 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021413 expr_ty genexp_var;
21414 if (
21415 (genexp_var = genexp_rule(p)) // genexp
21416 )
21417 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021418 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021419 _res = genexp_var;
21420 goto done;
21421 }
21422 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021423 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021424 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
21425 }
21426 _res = NULL;
21427 done:
21428 D(p->level--);
21429 return _res;
21430}
21431
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021432// _tmp_98: list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021433static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021434_tmp_98_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021435{
21436 D(p->level++);
21437 if (p->error_indicator) {
21438 D(p->level--);
21439 return NULL;
21440 }
21441 void * _res = NULL;
21442 int _mark = p->mark;
21443 { // list
21444 if (p->error_indicator) {
21445 D(p->level--);
21446 return NULL;
21447 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021448 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021449 expr_ty list_var;
21450 if (
21451 (list_var = list_rule(p)) // list
21452 )
21453 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021454 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021455 _res = list_var;
21456 goto done;
21457 }
21458 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021459 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021460 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
21461 }
21462 { // listcomp
21463 if (p->error_indicator) {
21464 D(p->level--);
21465 return NULL;
21466 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021467 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021468 expr_ty listcomp_var;
21469 if (
21470 (listcomp_var = listcomp_rule(p)) // listcomp
21471 )
21472 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021473 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021474 _res = listcomp_var;
21475 goto done;
21476 }
21477 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021478 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021479 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
21480 }
21481 _res = NULL;
21482 done:
21483 D(p->level--);
21484 return _res;
21485}
21486
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021487// _tmp_99: dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021488static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021489_tmp_99_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021490{
21491 D(p->level++);
21492 if (p->error_indicator) {
21493 D(p->level--);
21494 return NULL;
21495 }
21496 void * _res = NULL;
21497 int _mark = p->mark;
21498 { // dict
21499 if (p->error_indicator) {
21500 D(p->level--);
21501 return NULL;
21502 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021503 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021504 expr_ty dict_var;
21505 if (
21506 (dict_var = dict_rule(p)) // dict
21507 )
21508 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021509 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021510 _res = dict_var;
21511 goto done;
21512 }
21513 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021514 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021515 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
21516 }
21517 { // set
21518 if (p->error_indicator) {
21519 D(p->level--);
21520 return NULL;
21521 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021522 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021523 expr_ty set_var;
21524 if (
21525 (set_var = set_rule(p)) // set
21526 )
21527 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021528 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021529 _res = set_var;
21530 goto done;
21531 }
21532 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021533 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021534 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
21535 }
21536 { // dictcomp
21537 if (p->error_indicator) {
21538 D(p->level--);
21539 return NULL;
21540 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021541 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021542 expr_ty dictcomp_var;
21543 if (
21544 (dictcomp_var = dictcomp_rule(p)) // dictcomp
21545 )
21546 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021547 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021548 _res = dictcomp_var;
21549 goto done;
21550 }
21551 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021552 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021553 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
21554 }
21555 { // setcomp
21556 if (p->error_indicator) {
21557 D(p->level--);
21558 return NULL;
21559 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021560 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021561 expr_ty setcomp_var;
21562 if (
21563 (setcomp_var = setcomp_rule(p)) // setcomp
21564 )
21565 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021566 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021567 _res = setcomp_var;
21568 goto done;
21569 }
21570 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021571 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021572 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
21573 }
21574 _res = NULL;
21575 done:
21576 D(p->level--);
21577 return _res;
21578}
21579
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021580// _loop1_100: STRING
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021581static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021582_loop1_100_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021583{
21584 D(p->level++);
21585 if (p->error_indicator) {
21586 D(p->level--);
21587 return NULL;
21588 }
21589 void *_res = NULL;
21590 int _mark = p->mark;
21591 int _start_mark = p->mark;
21592 void **_children = PyMem_Malloc(sizeof(void *));
21593 if (!_children) {
21594 p->error_indicator = 1;
21595 PyErr_NoMemory();
21596 D(p->level--);
21597 return NULL;
21598 }
21599 ssize_t _children_capacity = 1;
21600 ssize_t _n = 0;
21601 { // STRING
21602 if (p->error_indicator) {
21603 D(p->level--);
21604 return NULL;
21605 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021606 D(fprintf(stderr, "%*c> _loop1_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021607 expr_ty string_var;
21608 while (
21609 (string_var = _PyPegen_string_token(p)) // STRING
21610 )
21611 {
21612 _res = string_var;
21613 if (_n == _children_capacity) {
21614 _children_capacity *= 2;
21615 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21616 if (!_new_children) {
21617 p->error_indicator = 1;
21618 PyErr_NoMemory();
21619 D(p->level--);
21620 return NULL;
21621 }
21622 _children = _new_children;
21623 }
21624 _children[_n++] = _res;
21625 _mark = p->mark;
21626 }
21627 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021628 D(fprintf(stderr, "%*c%s _loop1_100[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021629 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
21630 }
21631 if (_n == 0 || p->error_indicator) {
21632 PyMem_Free(_children);
21633 D(p->level--);
21634 return NULL;
21635 }
21636 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21637 if (!_seq) {
21638 PyMem_Free(_children);
21639 p->error_indicator = 1;
21640 PyErr_NoMemory();
21641 D(p->level--);
21642 return NULL;
21643 }
21644 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21645 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021646 _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021647 D(p->level--);
21648 return _seq;
21649}
21650
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021651// _tmp_101: star_named_expression ',' star_named_expressions?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021652static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021653_tmp_101_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021654{
21655 D(p->level++);
21656 if (p->error_indicator) {
21657 D(p->level--);
21658 return NULL;
21659 }
21660 void * _res = NULL;
21661 int _mark = p->mark;
21662 { // star_named_expression ',' star_named_expressions?
21663 if (p->error_indicator) {
21664 D(p->level--);
21665 return NULL;
21666 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021667 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 +010021668 Token * _literal;
21669 expr_ty y;
21670 void *z;
21671 if (
21672 (y = star_named_expression_rule(p)) // star_named_expression
21673 &&
21674 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21675 &&
21676 (z = star_named_expressions_rule(p), 1) // star_named_expressions?
21677 )
21678 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021679 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 +010021680 _res = _PyPegen_seq_insert_in_front ( p , y , z );
21681 if (_res == NULL && PyErr_Occurred()) {
21682 p->error_indicator = 1;
21683 D(p->level--);
21684 return NULL;
21685 }
21686 goto done;
21687 }
21688 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021689 D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021690 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
21691 }
21692 _res = NULL;
21693 done:
21694 D(p->level--);
21695 return _res;
21696}
21697
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021698// _tmp_102: yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021699static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021700_tmp_102_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021701{
21702 D(p->level++);
21703 if (p->error_indicator) {
21704 D(p->level--);
21705 return NULL;
21706 }
21707 void * _res = NULL;
21708 int _mark = p->mark;
21709 { // yield_expr
21710 if (p->error_indicator) {
21711 D(p->level--);
21712 return NULL;
21713 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021714 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021715 expr_ty yield_expr_var;
21716 if (
21717 (yield_expr_var = yield_expr_rule(p)) // yield_expr
21718 )
21719 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021720 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 +010021721 _res = yield_expr_var;
21722 goto done;
21723 }
21724 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021725 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021726 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
21727 }
21728 { // named_expression
21729 if (p->error_indicator) {
21730 D(p->level--);
21731 return NULL;
21732 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021733 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021734 expr_ty named_expression_var;
21735 if (
21736 (named_expression_var = named_expression_rule(p)) // named_expression
21737 )
21738 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021739 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 +010021740 _res = named_expression_var;
21741 goto done;
21742 }
21743 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021744 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021745 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
21746 }
21747 _res = NULL;
21748 done:
21749 D(p->level--);
21750 return _res;
21751}
21752
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021753// _loop0_104: ',' double_starred_kvpair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021754static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021755_loop0_104_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021756{
21757 D(p->level++);
21758 if (p->error_indicator) {
21759 D(p->level--);
21760 return NULL;
21761 }
21762 void *_res = NULL;
21763 int _mark = p->mark;
21764 int _start_mark = p->mark;
21765 void **_children = PyMem_Malloc(sizeof(void *));
21766 if (!_children) {
21767 p->error_indicator = 1;
21768 PyErr_NoMemory();
21769 D(p->level--);
21770 return NULL;
21771 }
21772 ssize_t _children_capacity = 1;
21773 ssize_t _n = 0;
21774 { // ',' double_starred_kvpair
21775 if (p->error_indicator) {
21776 D(p->level--);
21777 return NULL;
21778 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021779 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 +010021780 Token * _literal;
21781 KeyValuePair* elem;
21782 while (
21783 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21784 &&
21785 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21786 )
21787 {
21788 _res = elem;
21789 if (_res == NULL && PyErr_Occurred()) {
21790 p->error_indicator = 1;
21791 PyMem_Free(_children);
21792 D(p->level--);
21793 return NULL;
21794 }
21795 if (_n == _children_capacity) {
21796 _children_capacity *= 2;
21797 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21798 if (!_new_children) {
21799 p->error_indicator = 1;
21800 PyErr_NoMemory();
21801 D(p->level--);
21802 return NULL;
21803 }
21804 _children = _new_children;
21805 }
21806 _children[_n++] = _res;
21807 _mark = p->mark;
21808 }
21809 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021810 D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021811 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
21812 }
21813 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21814 if (!_seq) {
21815 PyMem_Free(_children);
21816 p->error_indicator = 1;
21817 PyErr_NoMemory();
21818 D(p->level--);
21819 return NULL;
21820 }
21821 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21822 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021823 _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021824 D(p->level--);
21825 return _seq;
21826}
21827
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021828// _gather_103: double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021829static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021830_gather_103_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021831{
21832 D(p->level++);
21833 if (p->error_indicator) {
21834 D(p->level--);
21835 return NULL;
21836 }
21837 asdl_seq * _res = NULL;
21838 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021839 { // double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021840 if (p->error_indicator) {
21841 D(p->level--);
21842 return NULL;
21843 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021844 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 +010021845 KeyValuePair* elem;
21846 asdl_seq * seq;
21847 if (
21848 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21849 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021850 (seq = _loop0_104_rule(p)) // _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021851 )
21852 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021853 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 +010021854 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21855 goto done;
21856 }
21857 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021858 D(fprintf(stderr, "%*c%s _gather_103[%d-%d]: %s failed!\n", p->level, ' ',
21859 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_104"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021860 }
21861 _res = NULL;
21862 done:
21863 D(p->level--);
21864 return _res;
21865}
21866
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021867// _loop1_105: for_if_clause
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021868static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021869_loop1_105_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021870{
21871 D(p->level++);
21872 if (p->error_indicator) {
21873 D(p->level--);
21874 return NULL;
21875 }
21876 void *_res = NULL;
21877 int _mark = p->mark;
21878 int _start_mark = p->mark;
21879 void **_children = PyMem_Malloc(sizeof(void *));
21880 if (!_children) {
21881 p->error_indicator = 1;
21882 PyErr_NoMemory();
21883 D(p->level--);
21884 return NULL;
21885 }
21886 ssize_t _children_capacity = 1;
21887 ssize_t _n = 0;
21888 { // for_if_clause
21889 if (p->error_indicator) {
21890 D(p->level--);
21891 return NULL;
21892 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021893 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 +010021894 comprehension_ty for_if_clause_var;
21895 while (
21896 (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
21897 )
21898 {
21899 _res = for_if_clause_var;
21900 if (_n == _children_capacity) {
21901 _children_capacity *= 2;
21902 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21903 if (!_new_children) {
21904 p->error_indicator = 1;
21905 PyErr_NoMemory();
21906 D(p->level--);
21907 return NULL;
21908 }
21909 _children = _new_children;
21910 }
21911 _children[_n++] = _res;
21912 _mark = p->mark;
21913 }
21914 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021915 D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021916 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
21917 }
21918 if (_n == 0 || p->error_indicator) {
21919 PyMem_Free(_children);
21920 D(p->level--);
21921 return NULL;
21922 }
21923 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21924 if (!_seq) {
21925 PyMem_Free(_children);
21926 p->error_indicator = 1;
21927 PyErr_NoMemory();
21928 D(p->level--);
21929 return NULL;
21930 }
21931 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21932 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021933 _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021934 D(p->level--);
21935 return _seq;
21936}
21937
21938// _loop0_106: ('if' disjunction)
21939static asdl_seq *
21940_loop0_106_rule(Parser *p)
21941{
21942 D(p->level++);
21943 if (p->error_indicator) {
21944 D(p->level--);
21945 return NULL;
21946 }
21947 void *_res = NULL;
21948 int _mark = p->mark;
21949 int _start_mark = p->mark;
21950 void **_children = PyMem_Malloc(sizeof(void *));
21951 if (!_children) {
21952 p->error_indicator = 1;
21953 PyErr_NoMemory();
21954 D(p->level--);
21955 return NULL;
21956 }
21957 ssize_t _children_capacity = 1;
21958 ssize_t _n = 0;
21959 { // ('if' disjunction)
21960 if (p->error_indicator) {
21961 D(p->level--);
21962 return NULL;
21963 }
21964 D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021965 void *_tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021966 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021967 (_tmp_146_var = _tmp_146_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021968 )
21969 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030021970 _res = _tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021971 if (_n == _children_capacity) {
21972 _children_capacity *= 2;
21973 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21974 if (!_new_children) {
21975 p->error_indicator = 1;
21976 PyErr_NoMemory();
21977 D(p->level--);
21978 return NULL;
21979 }
21980 _children = _new_children;
21981 }
21982 _children[_n++] = _res;
21983 _mark = p->mark;
21984 }
21985 p->mark = _mark;
21986 D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ',
21987 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
21988 }
21989 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21990 if (!_seq) {
21991 PyMem_Free(_children);
21992 p->error_indicator = 1;
21993 PyErr_NoMemory();
21994 D(p->level--);
21995 return NULL;
21996 }
21997 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21998 PyMem_Free(_children);
21999 _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq);
22000 D(p->level--);
22001 return _seq;
22002}
22003
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022004// _loop0_107: ('if' disjunction)
22005static asdl_seq *
22006_loop0_107_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022007{
22008 D(p->level++);
22009 if (p->error_indicator) {
22010 D(p->level--);
22011 return NULL;
22012 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022013 void *_res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022014 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022015 int _start_mark = p->mark;
22016 void **_children = PyMem_Malloc(sizeof(void *));
22017 if (!_children) {
22018 p->error_indicator = 1;
22019 PyErr_NoMemory();
22020 D(p->level--);
22021 return NULL;
22022 }
22023 ssize_t _children_capacity = 1;
22024 ssize_t _n = 0;
22025 { // ('if' disjunction)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022026 if (p->error_indicator) {
22027 D(p->level--);
22028 return NULL;
22029 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022030 D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022031 void *_tmp_147_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022032 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022033 (_tmp_147_var = _tmp_147_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022034 )
22035 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022036 _res = _tmp_147_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022037 if (_n == _children_capacity) {
22038 _children_capacity *= 2;
22039 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22040 if (!_new_children) {
22041 p->error_indicator = 1;
22042 PyErr_NoMemory();
22043 D(p->level--);
22044 return NULL;
22045 }
22046 _children = _new_children;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022047 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022048 _children[_n++] = _res;
22049 _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022050 }
22051 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022052 D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ',
22053 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022054 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022055 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22056 if (!_seq) {
22057 PyMem_Free(_children);
22058 p->error_indicator = 1;
22059 PyErr_NoMemory();
22060 D(p->level--);
22061 return NULL;
22062 }
22063 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22064 PyMem_Free(_children);
22065 _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022066 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022067 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022068}
22069
22070// _tmp_108: ',' args
22071static void *
22072_tmp_108_rule(Parser *p)
22073{
22074 D(p->level++);
22075 if (p->error_indicator) {
22076 D(p->level--);
22077 return NULL;
22078 }
22079 void * _res = NULL;
22080 int _mark = p->mark;
22081 { // ',' args
22082 if (p->error_indicator) {
22083 D(p->level--);
22084 return NULL;
22085 }
22086 D(fprintf(stderr, "%*c> _tmp_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args"));
22087 Token * _literal;
22088 expr_ty c;
22089 if (
22090 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22091 &&
22092 (c = args_rule(p)) // args
22093 )
22094 {
22095 D(fprintf(stderr, "%*c+ _tmp_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args"));
22096 _res = c;
22097 if (_res == NULL && PyErr_Occurred()) {
22098 p->error_indicator = 1;
22099 D(p->level--);
22100 return NULL;
22101 }
22102 goto done;
22103 }
22104 p->mark = _mark;
22105 D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ',
22106 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args"));
22107 }
22108 _res = NULL;
22109 done:
22110 D(p->level--);
22111 return _res;
22112}
22113
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022114// _tmp_109: ',' args
22115static void *
22116_tmp_109_rule(Parser *p)
22117{
22118 D(p->level++);
22119 if (p->error_indicator) {
22120 D(p->level--);
22121 return NULL;
22122 }
22123 void * _res = NULL;
22124 int _mark = p->mark;
22125 { // ',' args
22126 if (p->error_indicator) {
22127 D(p->level--);
22128 return NULL;
22129 }
22130 D(fprintf(stderr, "%*c> _tmp_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args"));
22131 Token * _literal;
22132 expr_ty c;
22133 if (
22134 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22135 &&
22136 (c = args_rule(p)) // args
22137 )
22138 {
22139 D(fprintf(stderr, "%*c+ _tmp_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args"));
22140 _res = c;
22141 if (_res == NULL && PyErr_Occurred()) {
22142 p->error_indicator = 1;
22143 D(p->level--);
22144 return NULL;
22145 }
22146 goto done;
22147 }
22148 p->mark = _mark;
22149 D(fprintf(stderr, "%*c%s _tmp_109[%d-%d]: %s failed!\n", p->level, ' ',
22150 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args"));
22151 }
22152 _res = NULL;
22153 done:
22154 D(p->level--);
22155 return _res;
22156}
22157
22158// _loop0_111: ',' kwarg_or_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022159static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022160_loop0_111_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022161{
22162 D(p->level++);
22163 if (p->error_indicator) {
22164 D(p->level--);
22165 return NULL;
22166 }
22167 void *_res = NULL;
22168 int _mark = p->mark;
22169 int _start_mark = p->mark;
22170 void **_children = PyMem_Malloc(sizeof(void *));
22171 if (!_children) {
22172 p->error_indicator = 1;
22173 PyErr_NoMemory();
22174 D(p->level--);
22175 return NULL;
22176 }
22177 ssize_t _children_capacity = 1;
22178 ssize_t _n = 0;
22179 { // ',' kwarg_or_starred
22180 if (p->error_indicator) {
22181 D(p->level--);
22182 return NULL;
22183 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022184 D(fprintf(stderr, "%*c> _loop0_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022185 Token * _literal;
22186 KeywordOrStarred* elem;
22187 while (
22188 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22189 &&
22190 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22191 )
22192 {
22193 _res = elem;
22194 if (_res == NULL && PyErr_Occurred()) {
22195 p->error_indicator = 1;
22196 PyMem_Free(_children);
22197 D(p->level--);
22198 return NULL;
22199 }
22200 if (_n == _children_capacity) {
22201 _children_capacity *= 2;
22202 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22203 if (!_new_children) {
22204 p->error_indicator = 1;
22205 PyErr_NoMemory();
22206 D(p->level--);
22207 return NULL;
22208 }
22209 _children = _new_children;
22210 }
22211 _children[_n++] = _res;
22212 _mark = p->mark;
22213 }
22214 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022215 D(fprintf(stderr, "%*c%s _loop0_111[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022216 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22217 }
22218 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22219 if (!_seq) {
22220 PyMem_Free(_children);
22221 p->error_indicator = 1;
22222 PyErr_NoMemory();
22223 D(p->level--);
22224 return NULL;
22225 }
22226 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22227 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022228 _PyPegen_insert_memo(p, _start_mark, _loop0_111_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022229 D(p->level--);
22230 return _seq;
22231}
22232
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022233// _gather_110: kwarg_or_starred _loop0_111
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022234static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022235_gather_110_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022236{
22237 D(p->level++);
22238 if (p->error_indicator) {
22239 D(p->level--);
22240 return NULL;
22241 }
22242 asdl_seq * _res = NULL;
22243 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022244 { // kwarg_or_starred _loop0_111
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022245 if (p->error_indicator) {
22246 D(p->level--);
22247 return NULL;
22248 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022249 D(fprintf(stderr, "%*c> _gather_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_111"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022250 KeywordOrStarred* elem;
22251 asdl_seq * seq;
22252 if (
22253 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22254 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022255 (seq = _loop0_111_rule(p)) // _loop0_111
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022256 )
22257 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022258 D(fprintf(stderr, "%*c+ _gather_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_111"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022259 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22260 goto done;
22261 }
22262 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022263 D(fprintf(stderr, "%*c%s _gather_110[%d-%d]: %s failed!\n", p->level, ' ',
22264 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_111"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022265 }
22266 _res = NULL;
22267 done:
22268 D(p->level--);
22269 return _res;
22270}
22271
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022272// _loop0_113: ',' kwarg_or_double_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022273static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022274_loop0_113_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022275{
22276 D(p->level++);
22277 if (p->error_indicator) {
22278 D(p->level--);
22279 return NULL;
22280 }
22281 void *_res = NULL;
22282 int _mark = p->mark;
22283 int _start_mark = p->mark;
22284 void **_children = PyMem_Malloc(sizeof(void *));
22285 if (!_children) {
22286 p->error_indicator = 1;
22287 PyErr_NoMemory();
22288 D(p->level--);
22289 return NULL;
22290 }
22291 ssize_t _children_capacity = 1;
22292 ssize_t _n = 0;
22293 { // ',' kwarg_or_double_starred
22294 if (p->error_indicator) {
22295 D(p->level--);
22296 return NULL;
22297 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022298 D(fprintf(stderr, "%*c> _loop0_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022299 Token * _literal;
22300 KeywordOrStarred* elem;
22301 while (
22302 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22303 &&
22304 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22305 )
22306 {
22307 _res = elem;
22308 if (_res == NULL && PyErr_Occurred()) {
22309 p->error_indicator = 1;
22310 PyMem_Free(_children);
22311 D(p->level--);
22312 return NULL;
22313 }
22314 if (_n == _children_capacity) {
22315 _children_capacity *= 2;
22316 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22317 if (!_new_children) {
22318 p->error_indicator = 1;
22319 PyErr_NoMemory();
22320 D(p->level--);
22321 return NULL;
22322 }
22323 _children = _new_children;
22324 }
22325 _children[_n++] = _res;
22326 _mark = p->mark;
22327 }
22328 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022329 D(fprintf(stderr, "%*c%s _loop0_113[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022330 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22331 }
22332 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22333 if (!_seq) {
22334 PyMem_Free(_children);
22335 p->error_indicator = 1;
22336 PyErr_NoMemory();
22337 D(p->level--);
22338 return NULL;
22339 }
22340 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22341 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022342 _PyPegen_insert_memo(p, _start_mark, _loop0_113_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022343 D(p->level--);
22344 return _seq;
22345}
22346
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022347// _gather_112: kwarg_or_double_starred _loop0_113
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022348static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022349_gather_112_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022350{
22351 D(p->level++);
22352 if (p->error_indicator) {
22353 D(p->level--);
22354 return NULL;
22355 }
22356 asdl_seq * _res = NULL;
22357 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022358 { // kwarg_or_double_starred _loop0_113
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022359 if (p->error_indicator) {
22360 D(p->level--);
22361 return NULL;
22362 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022363 D(fprintf(stderr, "%*c> _gather_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_113"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022364 KeywordOrStarred* elem;
22365 asdl_seq * seq;
22366 if (
22367 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22368 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022369 (seq = _loop0_113_rule(p)) // _loop0_113
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022370 )
22371 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022372 D(fprintf(stderr, "%*c+ _gather_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_113"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022373 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22374 goto done;
22375 }
22376 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022377 D(fprintf(stderr, "%*c%s _gather_112[%d-%d]: %s failed!\n", p->level, ' ',
22378 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_113"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022379 }
22380 _res = NULL;
22381 done:
22382 D(p->level--);
22383 return _res;
22384}
22385
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022386// _loop0_115: ',' kwarg_or_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022387static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022388_loop0_115_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022389{
22390 D(p->level++);
22391 if (p->error_indicator) {
22392 D(p->level--);
22393 return NULL;
22394 }
22395 void *_res = NULL;
22396 int _mark = p->mark;
22397 int _start_mark = p->mark;
22398 void **_children = PyMem_Malloc(sizeof(void *));
22399 if (!_children) {
22400 p->error_indicator = 1;
22401 PyErr_NoMemory();
22402 D(p->level--);
22403 return NULL;
22404 }
22405 ssize_t _children_capacity = 1;
22406 ssize_t _n = 0;
22407 { // ',' kwarg_or_starred
22408 if (p->error_indicator) {
22409 D(p->level--);
22410 return NULL;
22411 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022412 D(fprintf(stderr, "%*c> _loop0_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022413 Token * _literal;
22414 KeywordOrStarred* elem;
22415 while (
22416 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22417 &&
22418 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22419 )
22420 {
22421 _res = elem;
22422 if (_res == NULL && PyErr_Occurred()) {
22423 p->error_indicator = 1;
22424 PyMem_Free(_children);
22425 D(p->level--);
22426 return NULL;
22427 }
22428 if (_n == _children_capacity) {
22429 _children_capacity *= 2;
22430 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22431 if (!_new_children) {
22432 p->error_indicator = 1;
22433 PyErr_NoMemory();
22434 D(p->level--);
22435 return NULL;
22436 }
22437 _children = _new_children;
22438 }
22439 _children[_n++] = _res;
22440 _mark = p->mark;
22441 }
22442 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022443 D(fprintf(stderr, "%*c%s _loop0_115[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022444 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22445 }
22446 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22447 if (!_seq) {
22448 PyMem_Free(_children);
22449 p->error_indicator = 1;
22450 PyErr_NoMemory();
22451 D(p->level--);
22452 return NULL;
22453 }
22454 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22455 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022456 _PyPegen_insert_memo(p, _start_mark, _loop0_115_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022457 D(p->level--);
22458 return _seq;
22459}
22460
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022461// _gather_114: kwarg_or_starred _loop0_115
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022462static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022463_gather_114_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022464{
22465 D(p->level++);
22466 if (p->error_indicator) {
22467 D(p->level--);
22468 return NULL;
22469 }
22470 asdl_seq * _res = NULL;
22471 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022472 { // kwarg_or_starred _loop0_115
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022473 if (p->error_indicator) {
22474 D(p->level--);
22475 return NULL;
22476 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022477 D(fprintf(stderr, "%*c> _gather_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_115"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022478 KeywordOrStarred* elem;
22479 asdl_seq * seq;
22480 if (
22481 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22482 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022483 (seq = _loop0_115_rule(p)) // _loop0_115
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022484 )
22485 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022486 D(fprintf(stderr, "%*c+ _gather_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_115"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022487 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22488 goto done;
22489 }
22490 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022491 D(fprintf(stderr, "%*c%s _gather_114[%d-%d]: %s failed!\n", p->level, ' ',
22492 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_115"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022493 }
22494 _res = NULL;
22495 done:
22496 D(p->level--);
22497 return _res;
22498}
22499
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022500// _loop0_117: ',' kwarg_or_double_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022501static asdl_seq *
22502_loop0_117_rule(Parser *p)
22503{
22504 D(p->level++);
22505 if (p->error_indicator) {
22506 D(p->level--);
22507 return NULL;
22508 }
22509 void *_res = NULL;
22510 int _mark = p->mark;
22511 int _start_mark = p->mark;
22512 void **_children = PyMem_Malloc(sizeof(void *));
22513 if (!_children) {
22514 p->error_indicator = 1;
22515 PyErr_NoMemory();
22516 D(p->level--);
22517 return NULL;
22518 }
22519 ssize_t _children_capacity = 1;
22520 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022521 { // ',' kwarg_or_double_starred
22522 if (p->error_indicator) {
22523 D(p->level--);
22524 return NULL;
22525 }
22526 D(fprintf(stderr, "%*c> _loop0_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
22527 Token * _literal;
22528 KeywordOrStarred* elem;
22529 while (
22530 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22531 &&
22532 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22533 )
22534 {
22535 _res = elem;
22536 if (_res == NULL && PyErr_Occurred()) {
22537 p->error_indicator = 1;
22538 PyMem_Free(_children);
22539 D(p->level--);
22540 return NULL;
22541 }
22542 if (_n == _children_capacity) {
22543 _children_capacity *= 2;
22544 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22545 if (!_new_children) {
22546 p->error_indicator = 1;
22547 PyErr_NoMemory();
22548 D(p->level--);
22549 return NULL;
22550 }
22551 _children = _new_children;
22552 }
22553 _children[_n++] = _res;
22554 _mark = p->mark;
22555 }
22556 p->mark = _mark;
22557 D(fprintf(stderr, "%*c%s _loop0_117[%d-%d]: %s failed!\n", p->level, ' ',
22558 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22559 }
22560 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22561 if (!_seq) {
22562 PyMem_Free(_children);
22563 p->error_indicator = 1;
22564 PyErr_NoMemory();
22565 D(p->level--);
22566 return NULL;
22567 }
22568 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22569 PyMem_Free(_children);
22570 _PyPegen_insert_memo(p, _start_mark, _loop0_117_type, _seq);
22571 D(p->level--);
22572 return _seq;
22573}
22574
22575// _gather_116: kwarg_or_double_starred _loop0_117
22576static asdl_seq *
22577_gather_116_rule(Parser *p)
22578{
22579 D(p->level++);
22580 if (p->error_indicator) {
22581 D(p->level--);
22582 return NULL;
22583 }
22584 asdl_seq * _res = NULL;
22585 int _mark = p->mark;
22586 { // kwarg_or_double_starred _loop0_117
22587 if (p->error_indicator) {
22588 D(p->level--);
22589 return NULL;
22590 }
22591 D(fprintf(stderr, "%*c> _gather_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_117"));
22592 KeywordOrStarred* elem;
22593 asdl_seq * seq;
22594 if (
22595 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22596 &&
22597 (seq = _loop0_117_rule(p)) // _loop0_117
22598 )
22599 {
22600 D(fprintf(stderr, "%*c+ _gather_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_117"));
22601 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22602 goto done;
22603 }
22604 p->mark = _mark;
22605 D(fprintf(stderr, "%*c%s _gather_116[%d-%d]: %s failed!\n", p->level, ' ',
22606 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_117"));
22607 }
22608 _res = NULL;
22609 done:
22610 D(p->level--);
22611 return _res;
22612}
22613
22614// _loop0_118: (',' star_target)
22615static asdl_seq *
22616_loop0_118_rule(Parser *p)
22617{
22618 D(p->level++);
22619 if (p->error_indicator) {
22620 D(p->level--);
22621 return NULL;
22622 }
22623 void *_res = NULL;
22624 int _mark = p->mark;
22625 int _start_mark = p->mark;
22626 void **_children = PyMem_Malloc(sizeof(void *));
22627 if (!_children) {
22628 p->error_indicator = 1;
22629 PyErr_NoMemory();
22630 D(p->level--);
22631 return NULL;
22632 }
22633 ssize_t _children_capacity = 1;
22634 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022635 { // (',' star_target)
22636 if (p->error_indicator) {
22637 D(p->level--);
22638 return NULL;
22639 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022640 D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022641 void *_tmp_148_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022642 while (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022643 (_tmp_148_var = _tmp_148_rule(p)) // ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022644 )
22645 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030022646 _res = _tmp_148_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022647 if (_n == _children_capacity) {
22648 _children_capacity *= 2;
22649 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22650 if (!_new_children) {
22651 p->error_indicator = 1;
22652 PyErr_NoMemory();
22653 D(p->level--);
22654 return NULL;
22655 }
22656 _children = _new_children;
22657 }
22658 _children[_n++] = _res;
22659 _mark = p->mark;
22660 }
22661 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022662 D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022663 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
22664 }
22665 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22666 if (!_seq) {
22667 PyMem_Free(_children);
22668 p->error_indicator = 1;
22669 PyErr_NoMemory();
22670 D(p->level--);
22671 return NULL;
22672 }
22673 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22674 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022675 _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022676 D(p->level--);
22677 return _seq;
22678}
22679
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022680// _loop0_120: ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022681static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022682_loop0_120_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022683{
22684 D(p->level++);
22685 if (p->error_indicator) {
22686 D(p->level--);
22687 return NULL;
22688 }
22689 void *_res = NULL;
22690 int _mark = p->mark;
22691 int _start_mark = p->mark;
22692 void **_children = PyMem_Malloc(sizeof(void *));
22693 if (!_children) {
22694 p->error_indicator = 1;
22695 PyErr_NoMemory();
22696 D(p->level--);
22697 return NULL;
22698 }
22699 ssize_t _children_capacity = 1;
22700 ssize_t _n = 0;
22701 { // ',' star_target
22702 if (p->error_indicator) {
22703 D(p->level--);
22704 return NULL;
22705 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022706 D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022707 Token * _literal;
22708 expr_ty elem;
22709 while (
22710 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22711 &&
22712 (elem = star_target_rule(p)) // star_target
22713 )
22714 {
22715 _res = elem;
22716 if (_res == NULL && PyErr_Occurred()) {
22717 p->error_indicator = 1;
22718 PyMem_Free(_children);
22719 D(p->level--);
22720 return NULL;
22721 }
22722 if (_n == _children_capacity) {
22723 _children_capacity *= 2;
22724 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22725 if (!_new_children) {
22726 p->error_indicator = 1;
22727 PyErr_NoMemory();
22728 D(p->level--);
22729 return NULL;
22730 }
22731 _children = _new_children;
22732 }
22733 _children[_n++] = _res;
22734 _mark = p->mark;
22735 }
22736 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022737 D(fprintf(stderr, "%*c%s _loop0_120[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022738 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
22739 }
22740 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22741 if (!_seq) {
22742 PyMem_Free(_children);
22743 p->error_indicator = 1;
22744 PyErr_NoMemory();
22745 D(p->level--);
22746 return NULL;
22747 }
22748 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22749 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022750 _PyPegen_insert_memo(p, _start_mark, _loop0_120_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022751 D(p->level--);
22752 return _seq;
22753}
22754
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022755// _gather_119: star_target _loop0_120
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022756static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022757_gather_119_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022758{
22759 D(p->level++);
22760 if (p->error_indicator) {
22761 D(p->level--);
22762 return NULL;
22763 }
22764 asdl_seq * _res = NULL;
22765 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022766 { // star_target _loop0_120
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022767 if (p->error_indicator) {
22768 D(p->level--);
22769 return NULL;
22770 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022771 D(fprintf(stderr, "%*c> _gather_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_120"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022772 expr_ty elem;
22773 asdl_seq * seq;
22774 if (
22775 (elem = star_target_rule(p)) // star_target
22776 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022777 (seq = _loop0_120_rule(p)) // _loop0_120
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022778 )
22779 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022780 D(fprintf(stderr, "%*c+ _gather_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_120"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022781 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22782 goto done;
22783 }
22784 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022785 D(fprintf(stderr, "%*c%s _gather_119[%d-%d]: %s failed!\n", p->level, ' ',
22786 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_120"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022787 }
22788 _res = NULL;
22789 done:
22790 D(p->level--);
22791 return _res;
22792}
22793
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022794// _tmp_121: !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022795static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022796_tmp_121_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022797{
22798 D(p->level++);
22799 if (p->error_indicator) {
22800 D(p->level--);
22801 return NULL;
22802 }
22803 void * _res = NULL;
22804 int _mark = p->mark;
22805 { // !'*' star_target
22806 if (p->error_indicator) {
22807 D(p->level--);
22808 return NULL;
22809 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022810 D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022811 expr_ty star_target_var;
22812 if (
22813 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
22814 &&
22815 (star_target_var = star_target_rule(p)) // star_target
22816 )
22817 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022818 D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022819 _res = star_target_var;
22820 goto done;
22821 }
22822 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022823 D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022824 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
22825 }
22826 _res = NULL;
22827 done:
22828 D(p->level--);
22829 return _res;
22830}
22831
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022832// _loop0_123: ',' del_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022833static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022834_loop0_123_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022835{
22836 D(p->level++);
22837 if (p->error_indicator) {
22838 D(p->level--);
22839 return NULL;
22840 }
22841 void *_res = NULL;
22842 int _mark = p->mark;
22843 int _start_mark = p->mark;
22844 void **_children = PyMem_Malloc(sizeof(void *));
22845 if (!_children) {
22846 p->error_indicator = 1;
22847 PyErr_NoMemory();
22848 D(p->level--);
22849 return NULL;
22850 }
22851 ssize_t _children_capacity = 1;
22852 ssize_t _n = 0;
22853 { // ',' del_target
22854 if (p->error_indicator) {
22855 D(p->level--);
22856 return NULL;
22857 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022858 D(fprintf(stderr, "%*c> _loop0_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022859 Token * _literal;
22860 expr_ty elem;
22861 while (
22862 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22863 &&
22864 (elem = del_target_rule(p)) // del_target
22865 )
22866 {
22867 _res = elem;
22868 if (_res == NULL && PyErr_Occurred()) {
22869 p->error_indicator = 1;
22870 PyMem_Free(_children);
22871 D(p->level--);
22872 return NULL;
22873 }
22874 if (_n == _children_capacity) {
22875 _children_capacity *= 2;
22876 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22877 if (!_new_children) {
22878 p->error_indicator = 1;
22879 PyErr_NoMemory();
22880 D(p->level--);
22881 return NULL;
22882 }
22883 _children = _new_children;
22884 }
22885 _children[_n++] = _res;
22886 _mark = p->mark;
22887 }
22888 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022889 D(fprintf(stderr, "%*c%s _loop0_123[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022890 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
22891 }
22892 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22893 if (!_seq) {
22894 PyMem_Free(_children);
22895 p->error_indicator = 1;
22896 PyErr_NoMemory();
22897 D(p->level--);
22898 return NULL;
22899 }
22900 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22901 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022902 _PyPegen_insert_memo(p, _start_mark, _loop0_123_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022903 D(p->level--);
22904 return _seq;
22905}
22906
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022907// _gather_122: del_target _loop0_123
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022908static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022909_gather_122_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022910{
22911 D(p->level++);
22912 if (p->error_indicator) {
22913 D(p->level--);
22914 return NULL;
22915 }
22916 asdl_seq * _res = NULL;
22917 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022918 { // del_target _loop0_123
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022919 if (p->error_indicator) {
22920 D(p->level--);
22921 return NULL;
22922 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022923 D(fprintf(stderr, "%*c> _gather_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_123"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022924 expr_ty elem;
22925 asdl_seq * seq;
22926 if (
22927 (elem = del_target_rule(p)) // del_target
22928 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022929 (seq = _loop0_123_rule(p)) // _loop0_123
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022930 )
22931 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022932 D(fprintf(stderr, "%*c+ _gather_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_123"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022933 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22934 goto done;
22935 }
22936 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022937 D(fprintf(stderr, "%*c%s _gather_122[%d-%d]: %s failed!\n", p->level, ' ',
22938 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_123"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022939 }
22940 _res = NULL;
22941 done:
22942 D(p->level--);
22943 return _res;
22944}
22945
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022946// _loop0_125: ',' target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022947static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022948_loop0_125_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022949{
22950 D(p->level++);
22951 if (p->error_indicator) {
22952 D(p->level--);
22953 return NULL;
22954 }
22955 void *_res = NULL;
22956 int _mark = p->mark;
22957 int _start_mark = p->mark;
22958 void **_children = PyMem_Malloc(sizeof(void *));
22959 if (!_children) {
22960 p->error_indicator = 1;
22961 PyErr_NoMemory();
22962 D(p->level--);
22963 return NULL;
22964 }
22965 ssize_t _children_capacity = 1;
22966 ssize_t _n = 0;
22967 { // ',' target
22968 if (p->error_indicator) {
22969 D(p->level--);
22970 return NULL;
22971 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022972 D(fprintf(stderr, "%*c> _loop0_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022973 Token * _literal;
22974 expr_ty elem;
22975 while (
22976 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22977 &&
22978 (elem = target_rule(p)) // target
22979 )
22980 {
22981 _res = elem;
22982 if (_res == NULL && PyErr_Occurred()) {
22983 p->error_indicator = 1;
22984 PyMem_Free(_children);
22985 D(p->level--);
22986 return NULL;
22987 }
22988 if (_n == _children_capacity) {
22989 _children_capacity *= 2;
22990 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22991 if (!_new_children) {
22992 p->error_indicator = 1;
22993 PyErr_NoMemory();
22994 D(p->level--);
22995 return NULL;
22996 }
22997 _children = _new_children;
22998 }
22999 _children[_n++] = _res;
23000 _mark = p->mark;
23001 }
23002 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023003 D(fprintf(stderr, "%*c%s _loop0_125[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023004 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target"));
23005 }
23006 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23007 if (!_seq) {
23008 PyMem_Free(_children);
23009 p->error_indicator = 1;
23010 PyErr_NoMemory();
23011 D(p->level--);
23012 return NULL;
23013 }
23014 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23015 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023016 _PyPegen_insert_memo(p, _start_mark, _loop0_125_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023017 D(p->level--);
23018 return _seq;
23019}
23020
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023021// _gather_124: target _loop0_125
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023022static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023023_gather_124_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023024{
23025 D(p->level++);
23026 if (p->error_indicator) {
23027 D(p->level--);
23028 return NULL;
23029 }
23030 asdl_seq * _res = NULL;
23031 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023032 { // target _loop0_125
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023033 if (p->error_indicator) {
23034 D(p->level--);
23035 return NULL;
23036 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023037 D(fprintf(stderr, "%*c> _gather_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_125"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023038 expr_ty elem;
23039 asdl_seq * seq;
23040 if (
23041 (elem = target_rule(p)) // target
23042 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023043 (seq = _loop0_125_rule(p)) // _loop0_125
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023044 )
23045 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023046 D(fprintf(stderr, "%*c+ _gather_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_125"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023047 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23048 goto done;
23049 }
23050 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023051 D(fprintf(stderr, "%*c%s _gather_124[%d-%d]: %s failed!\n", p->level, ' ',
23052 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_125"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023053 }
23054 _res = NULL;
23055 done:
23056 D(p->level--);
23057 return _res;
23058}
23059
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023060// _tmp_126: args | expression for_if_clauses
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023061static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023062_tmp_126_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023063{
23064 D(p->level++);
23065 if (p->error_indicator) {
23066 D(p->level--);
23067 return NULL;
23068 }
23069 void * _res = NULL;
23070 int _mark = p->mark;
23071 { // args
23072 if (p->error_indicator) {
23073 D(p->level--);
23074 return NULL;
23075 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023076 D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023077 expr_ty args_var;
23078 if (
23079 (args_var = args_rule(p)) // args
23080 )
23081 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023082 D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023083 _res = args_var;
23084 goto done;
23085 }
23086 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023087 D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023088 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
23089 }
23090 { // expression for_if_clauses
23091 if (p->error_indicator) {
23092 D(p->level--);
23093 return NULL;
23094 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023095 D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023096 expr_ty expression_var;
23097 asdl_seq* for_if_clauses_var;
23098 if (
23099 (expression_var = expression_rule(p)) // expression
23100 &&
23101 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
23102 )
23103 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023104 D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023105 _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
23106 goto done;
23107 }
23108 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023109 D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023110 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
23111 }
23112 _res = NULL;
23113 done:
23114 D(p->level--);
23115 return _res;
23116}
23117
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023118// _loop0_127: star_named_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023119static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023120_loop0_127_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023121{
23122 D(p->level++);
23123 if (p->error_indicator) {
23124 D(p->level--);
23125 return NULL;
23126 }
23127 void *_res = NULL;
23128 int _mark = p->mark;
23129 int _start_mark = p->mark;
23130 void **_children = PyMem_Malloc(sizeof(void *));
23131 if (!_children) {
23132 p->error_indicator = 1;
23133 PyErr_NoMemory();
23134 D(p->level--);
23135 return NULL;
23136 }
23137 ssize_t _children_capacity = 1;
23138 ssize_t _n = 0;
23139 { // star_named_expressions
23140 if (p->error_indicator) {
23141 D(p->level--);
23142 return NULL;
23143 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023144 D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023145 asdl_seq* star_named_expressions_var;
23146 while (
23147 (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions
23148 )
23149 {
23150 _res = star_named_expressions_var;
23151 if (_n == _children_capacity) {
23152 _children_capacity *= 2;
23153 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23154 if (!_new_children) {
23155 p->error_indicator = 1;
23156 PyErr_NoMemory();
23157 D(p->level--);
23158 return NULL;
23159 }
23160 _children = _new_children;
23161 }
23162 _children[_n++] = _res;
23163 _mark = p->mark;
23164 }
23165 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023166 D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023167 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
23168 }
23169 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23170 if (!_seq) {
23171 PyMem_Free(_children);
23172 p->error_indicator = 1;
23173 PyErr_NoMemory();
23174 D(p->level--);
23175 return NULL;
23176 }
23177 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23178 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030023179 _PyPegen_insert_memo(p, _start_mark, _loop0_127_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023180 D(p->level--);
23181 return _seq;
23182}
23183
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023184// _loop0_128: (star_targets '=')
23185static asdl_seq *
23186_loop0_128_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023187{
23188 D(p->level++);
23189 if (p->error_indicator) {
23190 D(p->level--);
23191 return NULL;
23192 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023193 void *_res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023194 int _mark = p->mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023195 int _start_mark = p->mark;
23196 void **_children = PyMem_Malloc(sizeof(void *));
23197 if (!_children) {
23198 p->error_indicator = 1;
23199 PyErr_NoMemory();
23200 D(p->level--);
23201 return NULL;
23202 }
23203 ssize_t _children_capacity = 1;
23204 ssize_t _n = 0;
23205 { // (star_targets '=')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023206 if (p->error_indicator) {
23207 D(p->level--);
23208 return NULL;
23209 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023210 D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
23211 void *_tmp_149_var;
23212 while (
23213 (_tmp_149_var = _tmp_149_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023214 )
23215 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023216 _res = _tmp_149_var;
23217 if (_n == _children_capacity) {
23218 _children_capacity *= 2;
23219 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23220 if (!_new_children) {
23221 p->error_indicator = 1;
23222 PyErr_NoMemory();
23223 D(p->level--);
23224 return NULL;
23225 }
23226 _children = _new_children;
23227 }
23228 _children[_n++] = _res;
23229 _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023230 }
23231 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023232 D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ',
23233 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023234 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023235 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23236 if (!_seq) {
23237 PyMem_Free(_children);
23238 p->error_indicator = 1;
23239 PyErr_NoMemory();
23240 D(p->level--);
23241 return NULL;
23242 }
23243 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23244 PyMem_Free(_children);
23245 _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023246 D(p->level--);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023247 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023248}
23249
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023250// _loop0_129: (star_targets '=')
23251static asdl_seq *
23252_loop0_129_rule(Parser *p)
23253{
23254 D(p->level++);
23255 if (p->error_indicator) {
23256 D(p->level--);
23257 return NULL;
23258 }
23259 void *_res = NULL;
23260 int _mark = p->mark;
23261 int _start_mark = p->mark;
23262 void **_children = PyMem_Malloc(sizeof(void *));
23263 if (!_children) {
23264 p->error_indicator = 1;
23265 PyErr_NoMemory();
23266 D(p->level--);
23267 return NULL;
23268 }
23269 ssize_t _children_capacity = 1;
23270 ssize_t _n = 0;
23271 { // (star_targets '=')
23272 if (p->error_indicator) {
23273 D(p->level--);
23274 return NULL;
23275 }
23276 D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
23277 void *_tmp_150_var;
23278 while (
23279 (_tmp_150_var = _tmp_150_rule(p)) // star_targets '='
23280 )
23281 {
23282 _res = _tmp_150_var;
23283 if (_n == _children_capacity) {
23284 _children_capacity *= 2;
23285 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23286 if (!_new_children) {
23287 p->error_indicator = 1;
23288 PyErr_NoMemory();
23289 D(p->level--);
23290 return NULL;
23291 }
23292 _children = _new_children;
23293 }
23294 _children[_n++] = _res;
23295 _mark = p->mark;
23296 }
23297 p->mark = _mark;
23298 D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
23299 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23300 }
23301 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23302 if (!_seq) {
23303 PyMem_Free(_children);
23304 p->error_indicator = 1;
23305 PyErr_NoMemory();
23306 D(p->level--);
23307 return NULL;
23308 }
23309 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23310 PyMem_Free(_children);
23311 _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq);
23312 D(p->level--);
23313 return _seq;
23314}
23315
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023316// _tmp_130: yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023317static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023318_tmp_130_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023319{
23320 D(p->level++);
23321 if (p->error_indicator) {
23322 D(p->level--);
23323 return NULL;
23324 }
23325 void * _res = NULL;
23326 int _mark = p->mark;
23327 { // yield_expr
23328 if (p->error_indicator) {
23329 D(p->level--);
23330 return NULL;
23331 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023332 D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023333 expr_ty yield_expr_var;
23334 if (
23335 (yield_expr_var = yield_expr_rule(p)) // yield_expr
23336 )
23337 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023338 D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023339 _res = yield_expr_var;
23340 goto done;
23341 }
23342 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023343 D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023344 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
23345 }
23346 { // star_expressions
23347 if (p->error_indicator) {
23348 D(p->level--);
23349 return NULL;
23350 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023351 D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023352 expr_ty star_expressions_var;
23353 if (
23354 (star_expressions_var = star_expressions_rule(p)) // star_expressions
23355 )
23356 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023357 D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023358 _res = star_expressions_var;
23359 goto done;
23360 }
23361 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023362 D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023363 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
23364 }
23365 _res = NULL;
23366 done:
23367 D(p->level--);
23368 return _res;
23369}
23370
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023371// _tmp_131: '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023372static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023373_tmp_131_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023374{
23375 D(p->level++);
23376 if (p->error_indicator) {
23377 D(p->level--);
23378 return NULL;
23379 }
23380 void * _res = NULL;
23381 int _mark = p->mark;
23382 { // '['
23383 if (p->error_indicator) {
23384 D(p->level--);
23385 return NULL;
23386 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023387 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023388 Token * _literal;
23389 if (
23390 (_literal = _PyPegen_expect_token(p, 9)) // token='['
23391 )
23392 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023393 D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023394 _res = _literal;
23395 goto done;
23396 }
23397 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023398 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023399 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
23400 }
23401 { // '('
23402 if (p->error_indicator) {
23403 D(p->level--);
23404 return NULL;
23405 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023406 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023407 Token * _literal;
23408 if (
23409 (_literal = _PyPegen_expect_token(p, 7)) // token='('
23410 )
23411 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023412 D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023413 _res = _literal;
23414 goto done;
23415 }
23416 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023417 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023418 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
23419 }
23420 { // '{'
23421 if (p->error_indicator) {
23422 D(p->level--);
23423 return NULL;
23424 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023425 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023426 Token * _literal;
23427 if (
23428 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
23429 )
23430 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023431 D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023432 _res = _literal;
23433 goto done;
23434 }
23435 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023436 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023437 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
23438 }
23439 _res = NULL;
23440 done:
23441 D(p->level--);
23442 return _res;
23443}
23444
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023445// _loop0_132: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023446static asdl_seq *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023447_loop0_132_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023448{
23449 D(p->level++);
23450 if (p->error_indicator) {
23451 D(p->level--);
23452 return NULL;
23453 }
23454 void *_res = NULL;
23455 int _mark = p->mark;
23456 int _start_mark = p->mark;
23457 void **_children = PyMem_Malloc(sizeof(void *));
23458 if (!_children) {
23459 p->error_indicator = 1;
23460 PyErr_NoMemory();
23461 D(p->level--);
23462 return NULL;
23463 }
23464 ssize_t _children_capacity = 1;
23465 ssize_t _n = 0;
23466 { // param_no_default
23467 if (p->error_indicator) {
23468 D(p->level--);
23469 return NULL;
23470 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023471 D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023472 arg_ty param_no_default_var;
23473 while (
23474 (param_no_default_var = param_no_default_rule(p)) // param_no_default
23475 )
23476 {
23477 _res = param_no_default_var;
23478 if (_n == _children_capacity) {
23479 _children_capacity *= 2;
23480 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23481 if (!_new_children) {
23482 p->error_indicator = 1;
23483 PyErr_NoMemory();
23484 D(p->level--);
23485 return NULL;
23486 }
23487 _children = _new_children;
23488 }
23489 _children[_n++] = _res;
23490 _mark = p->mark;
23491 }
23492 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023493 D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023494 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
23495 }
23496 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23497 if (!_seq) {
23498 PyMem_Free(_children);
23499 p->error_indicator = 1;
23500 PyErr_NoMemory();
23501 D(p->level--);
23502 return NULL;
23503 }
23504 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23505 PyMem_Free(_children);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023506 _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023507 D(p->level--);
23508 return _seq;
23509}
23510
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023511// _tmp_133: slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023512static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023513_tmp_133_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023514{
23515 D(p->level++);
23516 if (p->error_indicator) {
23517 D(p->level--);
23518 return NULL;
23519 }
23520 void * _res = NULL;
23521 int _mark = p->mark;
23522 { // slash_with_default
23523 if (p->error_indicator) {
23524 D(p->level--);
23525 return NULL;
23526 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023527 D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023528 SlashWithDefault* slash_with_default_var;
23529 if (
23530 (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default
23531 )
23532 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023533 D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023534 _res = slash_with_default_var;
23535 goto done;
23536 }
23537 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023538 D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023539 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
23540 }
23541 { // param_with_default+
23542 if (p->error_indicator) {
23543 D(p->level--);
23544 return NULL;
23545 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023546 D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23547 asdl_seq * _loop1_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023548 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023549 (_loop1_151_var = _loop1_151_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023550 )
23551 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023552 D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23553 _res = _loop1_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023554 goto done;
23555 }
23556 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023557 D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023558 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
23559 }
23560 _res = NULL;
23561 done:
23562 D(p->level--);
23563 return _res;
23564}
23565
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023566// _loop0_134: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023567static asdl_seq *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023568_loop0_134_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023569{
23570 D(p->level++);
23571 if (p->error_indicator) {
23572 D(p->level--);
23573 return NULL;
23574 }
23575 void *_res = NULL;
23576 int _mark = p->mark;
23577 int _start_mark = p->mark;
23578 void **_children = PyMem_Malloc(sizeof(void *));
23579 if (!_children) {
23580 p->error_indicator = 1;
23581 PyErr_NoMemory();
23582 D(p->level--);
23583 return NULL;
23584 }
23585 ssize_t _children_capacity = 1;
23586 ssize_t _n = 0;
23587 { // lambda_param_no_default
23588 if (p->error_indicator) {
23589 D(p->level--);
23590 return NULL;
23591 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023592 D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023593 arg_ty lambda_param_no_default_var;
23594 while (
23595 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
23596 )
23597 {
23598 _res = lambda_param_no_default_var;
23599 if (_n == _children_capacity) {
23600 _children_capacity *= 2;
23601 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23602 if (!_new_children) {
23603 p->error_indicator = 1;
23604 PyErr_NoMemory();
23605 D(p->level--);
23606 return NULL;
23607 }
23608 _children = _new_children;
23609 }
23610 _children[_n++] = _res;
23611 _mark = p->mark;
23612 }
23613 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023614 D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023615 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
23616 }
23617 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23618 if (!_seq) {
23619 PyMem_Free(_children);
23620 p->error_indicator = 1;
23621 PyErr_NoMemory();
23622 D(p->level--);
23623 return NULL;
23624 }
23625 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23626 PyMem_Free(_children);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023627 _PyPegen_insert_memo(p, _start_mark, _loop0_134_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023628 D(p->level--);
23629 return _seq;
23630}
23631
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023632// _tmp_135: lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023633static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023634_tmp_135_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023635{
23636 D(p->level++);
23637 if (p->error_indicator) {
23638 D(p->level--);
23639 return NULL;
23640 }
23641 void * _res = NULL;
23642 int _mark = p->mark;
23643 { // lambda_slash_with_default
23644 if (p->error_indicator) {
23645 D(p->level--);
23646 return NULL;
23647 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023648 D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023649 SlashWithDefault* lambda_slash_with_default_var;
23650 if (
23651 (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
23652 )
23653 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023654 D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023655 _res = lambda_slash_with_default_var;
23656 goto done;
23657 }
23658 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023659 D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023660 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
23661 }
23662 { // lambda_param_with_default+
23663 if (p->error_indicator) {
23664 D(p->level--);
23665 return NULL;
23666 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023667 D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23668 asdl_seq * _loop1_152_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023669 if (
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023670 (_loop1_152_var = _loop1_152_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023671 )
23672 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023673 D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23674 _res = _loop1_152_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023675 goto done;
23676 }
23677 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023678 D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023679 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
23680 }
23681 _res = NULL;
23682 done:
23683 D(p->level--);
23684 return _res;
23685}
23686
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023687// _tmp_136: ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023688static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023689_tmp_136_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023690{
23691 D(p->level++);
23692 if (p->error_indicator) {
23693 D(p->level--);
23694 return NULL;
23695 }
23696 void * _res = NULL;
23697 int _mark = p->mark;
23698 { // ')'
23699 if (p->error_indicator) {
23700 D(p->level--);
23701 return NULL;
23702 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023703 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023704 Token * _literal;
23705 if (
23706 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
23707 )
23708 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023709 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023710 _res = _literal;
23711 goto done;
23712 }
23713 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023714 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023715 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
23716 }
23717 { // ',' (')' | '**')
23718 if (p->error_indicator) {
23719 D(p->level--);
23720 return NULL;
23721 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023722 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023723 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023724 void *_tmp_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023725 if (
23726 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23727 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023728 (_tmp_153_var = _tmp_153_rule(p)) // ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023729 )
23730 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023731 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
23732 _res = _PyPegen_dummy_name(p, _literal, _tmp_153_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023733 goto done;
23734 }
23735 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023736 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023737 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
23738 }
23739 _res = NULL;
23740 done:
23741 D(p->level--);
23742 return _res;
23743}
23744
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023745// _tmp_137: ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023746static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023747_tmp_137_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 { // ':'
23757 if (p->error_indicator) {
23758 D(p->level--);
23759 return NULL;
23760 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023761 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023762 Token * _literal;
23763 if (
23764 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
23765 )
23766 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023767 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023768 _res = _literal;
23769 goto done;
23770 }
23771 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023772 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023773 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
23774 }
23775 { // ',' (':' | '**')
23776 if (p->error_indicator) {
23777 D(p->level--);
23778 return NULL;
23779 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023780 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023781 Token * _literal;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023782 void *_tmp_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023783 if (
23784 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23785 &&
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023786 (_tmp_154_var = _tmp_154_rule(p)) // ':' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023787 )
23788 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023789 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
23790 _res = _PyPegen_dummy_name(p, _literal, _tmp_154_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023791 goto done;
23792 }
23793 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023794 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023795 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
23796 }
23797 _res = NULL;
23798 done:
23799 D(p->level--);
23800 return _res;
23801}
23802
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023803// _tmp_138: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023804static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023805_tmp_138_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023806{
23807 D(p->level++);
23808 if (p->error_indicator) {
23809 D(p->level--);
23810 return NULL;
23811 }
23812 void * _res = NULL;
23813 int _mark = p->mark;
23814 { // star_targets '='
23815 if (p->error_indicator) {
23816 D(p->level--);
23817 return NULL;
23818 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023819 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023820 Token * _literal;
23821 expr_ty z;
23822 if (
23823 (z = star_targets_rule(p)) // star_targets
23824 &&
23825 (_literal = _PyPegen_expect_token(p, 22)) // token='='
23826 )
23827 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023828 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023829 _res = z;
23830 if (_res == NULL && PyErr_Occurred()) {
23831 p->error_indicator = 1;
23832 D(p->level--);
23833 return NULL;
23834 }
23835 goto done;
23836 }
23837 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023838 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023839 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
23840 }
23841 _res = NULL;
23842 done:
23843 D(p->level--);
23844 return _res;
23845}
23846
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023847// _tmp_139: '.' | '...'
23848static void *
23849_tmp_139_rule(Parser *p)
23850{
23851 D(p->level++);
23852 if (p->error_indicator) {
23853 D(p->level--);
23854 return NULL;
23855 }
23856 void * _res = NULL;
23857 int _mark = p->mark;
23858 { // '.'
23859 if (p->error_indicator) {
23860 D(p->level--);
23861 return NULL;
23862 }
23863 D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
23864 Token * _literal;
23865 if (
23866 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
23867 )
23868 {
23869 D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
23870 _res = _literal;
23871 goto done;
23872 }
23873 p->mark = _mark;
23874 D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
23875 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
23876 }
23877 { // '...'
23878 if (p->error_indicator) {
23879 D(p->level--);
23880 return NULL;
23881 }
23882 D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
23883 Token * _literal;
23884 if (
23885 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
23886 )
23887 {
23888 D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
23889 _res = _literal;
23890 goto done;
23891 }
23892 p->mark = _mark;
23893 D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
23894 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
23895 }
23896 _res = NULL;
23897 done:
23898 D(p->level--);
23899 return _res;
23900}
23901
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023902// _tmp_140: '.' | '...'
23903static void *
23904_tmp_140_rule(Parser *p)
23905{
23906 D(p->level++);
23907 if (p->error_indicator) {
23908 D(p->level--);
23909 return NULL;
23910 }
23911 void * _res = NULL;
23912 int _mark = p->mark;
23913 { // '.'
23914 if (p->error_indicator) {
23915 D(p->level--);
23916 return NULL;
23917 }
23918 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
23919 Token * _literal;
23920 if (
23921 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
23922 )
23923 {
23924 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
23925 _res = _literal;
23926 goto done;
23927 }
23928 p->mark = _mark;
23929 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
23930 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
23931 }
23932 { // '...'
23933 if (p->error_indicator) {
23934 D(p->level--);
23935 return NULL;
23936 }
23937 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
23938 Token * _literal;
23939 if (
23940 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
23941 )
23942 {
23943 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
23944 _res = _literal;
23945 goto done;
23946 }
23947 p->mark = _mark;
23948 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
23949 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
23950 }
23951 _res = NULL;
23952 done:
23953 D(p->level--);
23954 return _res;
23955}
23956
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023957// _tmp_141: '@' named_expression NEWLINE
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023958static void *
23959_tmp_141_rule(Parser *p)
23960{
23961 D(p->level++);
23962 if (p->error_indicator) {
23963 D(p->level--);
23964 return NULL;
23965 }
23966 void * _res = NULL;
23967 int _mark = p->mark;
23968 { // '@' named_expression NEWLINE
23969 if (p->error_indicator) {
23970 D(p->level--);
23971 return NULL;
23972 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023973 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023974 Token * _literal;
23975 expr_ty f;
23976 Token * newline_var;
23977 if (
23978 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
23979 &&
23980 (f = named_expression_rule(p)) // named_expression
23981 &&
23982 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
23983 )
23984 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023985 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023986 _res = f;
23987 if (_res == NULL && PyErr_Occurred()) {
23988 p->error_indicator = 1;
23989 D(p->level--);
23990 return NULL;
23991 }
23992 goto done;
23993 }
23994 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023995 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023996 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
23997 }
23998 _res = NULL;
23999 done:
24000 D(p->level--);
24001 return _res;
24002}
24003
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024004// _tmp_142: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024005static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024006_tmp_142_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024007{
24008 D(p->level++);
24009 if (p->error_indicator) {
24010 D(p->level--);
24011 return NULL;
24012 }
24013 void * _res = NULL;
24014 int _mark = p->mark;
24015 { // ',' star_expression
24016 if (p->error_indicator) {
24017 D(p->level--);
24018 return NULL;
24019 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024020 D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024021 Token * _literal;
24022 expr_ty c;
24023 if (
24024 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24025 &&
24026 (c = star_expression_rule(p)) // star_expression
24027 )
24028 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024029 D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024030 _res = c;
24031 if (_res == NULL && PyErr_Occurred()) {
24032 p->error_indicator = 1;
24033 D(p->level--);
24034 return NULL;
24035 }
24036 goto done;
24037 }
24038 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024039 D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024040 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
24041 }
24042 _res = NULL;
24043 done:
24044 D(p->level--);
24045 return _res;
24046}
24047
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024048// _tmp_143: ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024049static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024050_tmp_143_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024051{
24052 D(p->level++);
24053 if (p->error_indicator) {
24054 D(p->level--);
24055 return NULL;
24056 }
24057 void * _res = NULL;
24058 int _mark = p->mark;
24059 { // ',' expression
24060 if (p->error_indicator) {
24061 D(p->level--);
24062 return NULL;
24063 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024064 D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024065 Token * _literal;
24066 expr_ty c;
24067 if (
24068 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24069 &&
24070 (c = expression_rule(p)) // expression
24071 )
24072 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024073 D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024074 _res = c;
24075 if (_res == NULL && PyErr_Occurred()) {
24076 p->error_indicator = 1;
24077 D(p->level--);
24078 return NULL;
24079 }
24080 goto done;
24081 }
24082 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024083 D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024084 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
24085 }
24086 _res = NULL;
24087 done:
24088 D(p->level--);
24089 return _res;
24090}
24091
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024092// _tmp_144: 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024093static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024094_tmp_144_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024095{
24096 D(p->level++);
24097 if (p->error_indicator) {
24098 D(p->level--);
24099 return NULL;
24100 }
24101 void * _res = NULL;
24102 int _mark = p->mark;
24103 { // 'or' conjunction
24104 if (p->error_indicator) {
24105 D(p->level--);
24106 return NULL;
24107 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024108 D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024109 Token * _keyword;
24110 expr_ty c;
24111 if (
24112 (_keyword = _PyPegen_expect_token(p, 531)) // token='or'
24113 &&
24114 (c = conjunction_rule(p)) // conjunction
24115 )
24116 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024117 D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024118 _res = c;
24119 if (_res == NULL && PyErr_Occurred()) {
24120 p->error_indicator = 1;
24121 D(p->level--);
24122 return NULL;
24123 }
24124 goto done;
24125 }
24126 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024127 D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024128 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
24129 }
24130 _res = NULL;
24131 done:
24132 D(p->level--);
24133 return _res;
24134}
24135
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024136// _tmp_145: 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024137static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024138_tmp_145_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024139{
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;
24147 { // 'and' inversion
24148 if (p->error_indicator) {
24149 D(p->level--);
24150 return NULL;
24151 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024152 D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024153 Token * _keyword;
24154 expr_ty c;
24155 if (
24156 (_keyword = _PyPegen_expect_token(p, 532)) // token='and'
24157 &&
24158 (c = inversion_rule(p)) // inversion
24159 )
24160 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024161 D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024162 _res = c;
24163 if (_res == NULL && PyErr_Occurred()) {
24164 p->error_indicator = 1;
24165 D(p->level--);
24166 return NULL;
24167 }
24168 goto done;
24169 }
24170 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024171 D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030024172 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024173 }
24174 _res = NULL;
24175 done:
24176 D(p->level--);
24177 return _res;
24178}
24179
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024180// _tmp_146: 'if' disjunction
24181static void *
24182_tmp_146_rule(Parser *p)
24183{
24184 D(p->level++);
24185 if (p->error_indicator) {
24186 D(p->level--);
24187 return NULL;
24188 }
24189 void * _res = NULL;
24190 int _mark = p->mark;
24191 { // 'if' disjunction
24192 if (p->error_indicator) {
24193 D(p->level--);
24194 return NULL;
24195 }
24196 D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24197 Token * _keyword;
24198 expr_ty z;
24199 if (
24200 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24201 &&
24202 (z = disjunction_rule(p)) // disjunction
24203 )
24204 {
24205 D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24206 _res = z;
24207 if (_res == NULL && PyErr_Occurred()) {
24208 p->error_indicator = 1;
24209 D(p->level--);
24210 return NULL;
24211 }
24212 goto done;
24213 }
24214 p->mark = _mark;
24215 D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
24216 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24217 }
24218 _res = NULL;
24219 done:
24220 D(p->level--);
24221 return _res;
24222}
24223
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024224// _tmp_147: 'if' disjunction
24225static void *
24226_tmp_147_rule(Parser *p)
24227{
24228 D(p->level++);
24229 if (p->error_indicator) {
24230 D(p->level--);
24231 return NULL;
24232 }
24233 void * _res = NULL;
24234 int _mark = p->mark;
24235 { // 'if' disjunction
24236 if (p->error_indicator) {
24237 D(p->level--);
24238 return NULL;
24239 }
24240 D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24241 Token * _keyword;
24242 expr_ty z;
24243 if (
24244 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24245 &&
24246 (z = disjunction_rule(p)) // disjunction
24247 )
24248 {
24249 D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24250 _res = z;
24251 if (_res == NULL && PyErr_Occurred()) {
24252 p->error_indicator = 1;
24253 D(p->level--);
24254 return NULL;
24255 }
24256 goto done;
24257 }
24258 p->mark = _mark;
24259 D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
24260 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24261 }
24262 _res = NULL;
24263 done:
24264 D(p->level--);
24265 return _res;
24266}
24267
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024268// _tmp_148: ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024269static void *
24270_tmp_148_rule(Parser *p)
24271{
24272 D(p->level++);
24273 if (p->error_indicator) {
24274 D(p->level--);
24275 return NULL;
24276 }
24277 void * _res = NULL;
24278 int _mark = p->mark;
24279 { // ',' star_target
24280 if (p->error_indicator) {
24281 D(p->level--);
24282 return NULL;
24283 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024284 D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024285 Token * _literal;
24286 expr_ty c;
24287 if (
24288 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24289 &&
24290 (c = star_target_rule(p)) // star_target
24291 )
24292 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024293 D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024294 _res = c;
24295 if (_res == NULL && PyErr_Occurred()) {
24296 p->error_indicator = 1;
24297 D(p->level--);
24298 return NULL;
24299 }
24300 goto done;
24301 }
24302 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024303 D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030024304 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024305 }
24306 _res = NULL;
24307 done:
24308 D(p->level--);
24309 return _res;
24310}
24311
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024312// _tmp_149: star_targets '='
24313static void *
24314_tmp_149_rule(Parser *p)
24315{
24316 D(p->level++);
24317 if (p->error_indicator) {
24318 D(p->level--);
24319 return NULL;
24320 }
24321 void * _res = NULL;
24322 int _mark = p->mark;
24323 { // star_targets '='
24324 if (p->error_indicator) {
24325 D(p->level--);
24326 return NULL;
24327 }
24328 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
24329 Token * _literal;
24330 expr_ty star_targets_var;
24331 if (
24332 (star_targets_var = star_targets_rule(p)) // star_targets
24333 &&
24334 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24335 )
24336 {
24337 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
24338 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24339 goto done;
24340 }
24341 p->mark = _mark;
24342 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24343 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24344 }
24345 _res = NULL;
24346 done:
24347 D(p->level--);
24348 return _res;
24349}
24350
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024351// _tmp_150: star_targets '='
24352static void *
24353_tmp_150_rule(Parser *p)
24354{
24355 D(p->level++);
24356 if (p->error_indicator) {
24357 D(p->level--);
24358 return NULL;
24359 }
24360 void * _res = NULL;
24361 int _mark = p->mark;
24362 { // star_targets '='
24363 if (p->error_indicator) {
24364 D(p->level--);
24365 return NULL;
24366 }
24367 D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
24368 Token * _literal;
24369 expr_ty star_targets_var;
24370 if (
24371 (star_targets_var = star_targets_rule(p)) // star_targets
24372 &&
24373 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24374 )
24375 {
24376 D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
24377 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24378 goto done;
24379 }
24380 p->mark = _mark;
24381 D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
24382 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24383 }
24384 _res = NULL;
24385 done:
24386 D(p->level--);
24387 return _res;
24388}
24389
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024390// _loop1_151: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024391static asdl_seq *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024392_loop1_151_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024393{
24394 D(p->level++);
24395 if (p->error_indicator) {
24396 D(p->level--);
24397 return NULL;
24398 }
24399 void *_res = NULL;
24400 int _mark = p->mark;
24401 int _start_mark = p->mark;
24402 void **_children = PyMem_Malloc(sizeof(void *));
24403 if (!_children) {
24404 p->error_indicator = 1;
24405 PyErr_NoMemory();
24406 D(p->level--);
24407 return NULL;
24408 }
24409 ssize_t _children_capacity = 1;
24410 ssize_t _n = 0;
24411 { // param_with_default
24412 if (p->error_indicator) {
24413 D(p->level--);
24414 return NULL;
24415 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024416 D(fprintf(stderr, "%*c> _loop1_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024417 NameDefaultPair* param_with_default_var;
24418 while (
24419 (param_with_default_var = param_with_default_rule(p)) // param_with_default
24420 )
24421 {
24422 _res = param_with_default_var;
24423 if (_n == _children_capacity) {
24424 _children_capacity *= 2;
24425 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24426 if (!_new_children) {
24427 p->error_indicator = 1;
24428 PyErr_NoMemory();
24429 D(p->level--);
24430 return NULL;
24431 }
24432 _children = _new_children;
24433 }
24434 _children[_n++] = _res;
24435 _mark = p->mark;
24436 }
24437 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024438 D(fprintf(stderr, "%*c%s _loop1_151[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024439 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
24440 }
24441 if (_n == 0 || p->error_indicator) {
24442 PyMem_Free(_children);
24443 D(p->level--);
24444 return NULL;
24445 }
24446 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
24447 if (!_seq) {
24448 PyMem_Free(_children);
24449 p->error_indicator = 1;
24450 PyErr_NoMemory();
24451 D(p->level--);
24452 return NULL;
24453 }
24454 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
24455 PyMem_Free(_children);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024456 _PyPegen_insert_memo(p, _start_mark, _loop1_151_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024457 D(p->level--);
24458 return _seq;
24459}
24460
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024461// _loop1_152: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024462static asdl_seq *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024463_loop1_152_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024464{
24465 D(p->level++);
24466 if (p->error_indicator) {
24467 D(p->level--);
24468 return NULL;
24469 }
24470 void *_res = NULL;
24471 int _mark = p->mark;
24472 int _start_mark = p->mark;
24473 void **_children = PyMem_Malloc(sizeof(void *));
24474 if (!_children) {
24475 p->error_indicator = 1;
24476 PyErr_NoMemory();
24477 D(p->level--);
24478 return NULL;
24479 }
24480 ssize_t _children_capacity = 1;
24481 ssize_t _n = 0;
24482 { // lambda_param_with_default
24483 if (p->error_indicator) {
24484 D(p->level--);
24485 return NULL;
24486 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024487 D(fprintf(stderr, "%*c> _loop1_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024488 NameDefaultPair* lambda_param_with_default_var;
24489 while (
24490 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
24491 )
24492 {
24493 _res = lambda_param_with_default_var;
24494 if (_n == _children_capacity) {
24495 _children_capacity *= 2;
24496 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24497 if (!_new_children) {
24498 p->error_indicator = 1;
24499 PyErr_NoMemory();
24500 D(p->level--);
24501 return NULL;
24502 }
24503 _children = _new_children;
24504 }
24505 _children[_n++] = _res;
24506 _mark = p->mark;
24507 }
24508 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024509 D(fprintf(stderr, "%*c%s _loop1_152[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024510 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
24511 }
24512 if (_n == 0 || p->error_indicator) {
24513 PyMem_Free(_children);
24514 D(p->level--);
24515 return NULL;
24516 }
24517 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
24518 if (!_seq) {
24519 PyMem_Free(_children);
24520 p->error_indicator = 1;
24521 PyErr_NoMemory();
24522 D(p->level--);
24523 return NULL;
24524 }
24525 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
24526 PyMem_Free(_children);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024527 _PyPegen_insert_memo(p, _start_mark, _loop1_152_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024528 D(p->level--);
24529 return _seq;
24530}
24531
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024532// _tmp_153: ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024533static void *
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024534_tmp_153_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024535{
24536 D(p->level++);
24537 if (p->error_indicator) {
24538 D(p->level--);
24539 return NULL;
24540 }
24541 void * _res = NULL;
24542 int _mark = p->mark;
24543 { // ')'
24544 if (p->error_indicator) {
24545 D(p->level--);
24546 return NULL;
24547 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024548 D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024549 Token * _literal;
24550 if (
24551 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
24552 )
24553 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024554 D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
24555 _res = _literal;
24556 goto done;
24557 }
24558 p->mark = _mark;
24559 D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
24560 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
24561 }
24562 { // '**'
24563 if (p->error_indicator) {
24564 D(p->level--);
24565 return NULL;
24566 }
24567 D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
24568 Token * _literal;
24569 if (
24570 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24571 )
24572 {
24573 D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
24574 _res = _literal;
24575 goto done;
24576 }
24577 p->mark = _mark;
24578 D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
24579 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24580 }
24581 _res = NULL;
24582 done:
24583 D(p->level--);
24584 return _res;
24585}
24586
24587// _tmp_154: ':' | '**'
24588static void *
24589_tmp_154_rule(Parser *p)
24590{
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 { // ':'
24599 if (p->error_indicator) {
24600 D(p->level--);
24601 return NULL;
24602 }
24603 D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
24604 Token * _literal;
24605 if (
24606 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
24607 )
24608 {
24609 D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024610 _res = _literal;
24611 goto done;
24612 }
24613 p->mark = _mark;
24614 D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024615 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024616 }
24617 { // '**'
24618 if (p->error_indicator) {
24619 D(p->level--);
24620 return NULL;
24621 }
24622 D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
24623 Token * _literal;
24624 if (
24625 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24626 )
24627 {
24628 D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
24629 _res = _literal;
24630 goto done;
24631 }
24632 p->mark = _mark;
24633 D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ',
24634 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24635 }
24636 _res = NULL;
24637 done:
24638 D(p->level--);
24639 return _res;
24640}
24641
24642void *
24643_PyPegen_parse(Parser *p)
24644{
24645 // Initialize keywords
24646 p->keywords = reserved_keywords;
24647 p->n_keyword_lists = n_keyword_lists;
24648
24649 // Run parser
24650 void *result = NULL;
24651 if (p->start_rule == Py_file_input) {
24652 result = file_rule(p);
24653 } else if (p->start_rule == Py_single_input) {
24654 result = interactive_rule(p);
24655 } else if (p->start_rule == Py_eval_input) {
24656 result = eval_rule(p);
24657 } else if (p->start_rule == Py_func_type_input) {
24658 result = func_type_rule(p);
24659 } else if (p->start_rule == Py_fstring_input) {
24660 result = fstring_rule(p);
24661 }
24662
24663 return result;
24664}
24665
24666// The end