blob: 25607eaf73cdcb63600ee19ea5ce7cac186d8e95 [file] [log] [blame]
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001// @generated by pegen.py from ./Grammar/python.gram
2#include "pegen.h"
3static const int n_keyword_lists = 15;
4static KeywordToken *reserved_keywords[] = {
5 NULL,
6 NULL,
7 (KeywordToken[]) {
8 {"if", 510},
9 {"in", 518},
10 {"is", 526},
11 {"as", 531},
12 {"or", 532},
13 {NULL, -1},
14 },
15 (KeywordToken[]) {
16 {"del", 503},
17 {"try", 511},
18 {"for", 517},
19 {"def", 522},
20 {"not", 525},
21 {"and", 533},
22 {NULL, -1},
23 },
24 (KeywordToken[]) {
25 {"pass", 502},
26 {"from", 514},
27 {"elif", 515},
28 {"else", 516},
29 {"with", 519},
30 {"True", 527},
31 {"None", 529},
32 {NULL, -1},
33 },
34 (KeywordToken[]) {
35 {"raise", 501},
36 {"yield", 504},
37 {"break", 506},
38 {"while", 512},
39 {"class", 523},
40 {"False", 528},
41 {NULL, -1},
42 },
43 (KeywordToken[]) {
44 {"return", 500},
45 {"assert", 505},
46 {"global", 508},
47 {"import", 513},
48 {"except", 520},
49 {"lambda", 524},
50 {NULL, -1},
51 },
52 (KeywordToken[]) {
53 {"finally", 521},
54 {NULL, -1},
55 },
56 (KeywordToken[]) {
57 {"continue", 507},
58 {"nonlocal", 509},
59 {NULL, -1},
60 },
61 NULL,
62 NULL,
63 NULL,
64 NULL,
65 NULL,
66 (KeywordToken[]) {
67 {"__new_parser__", 530},
68 {NULL, -1},
69 },
70};
71#define file_type 1000
72#define interactive_type 1001
73#define eval_type 1002
74#define fstring_type 1003
75#define statements_type 1004
76#define statement_type 1005
77#define statement_newline_type 1006
78#define simple_stmt_type 1007
79#define small_stmt_type 1008
80#define compound_stmt_type 1009
81#define assignment_type 1010
82#define augassign_type 1011
83#define global_stmt_type 1012
84#define nonlocal_stmt_type 1013
85#define yield_stmt_type 1014
86#define assert_stmt_type 1015
87#define del_stmt_type 1016
88#define import_stmt_type 1017
89#define import_name_type 1018
90#define import_from_type 1019
91#define import_from_targets_type 1020
92#define import_from_as_names_type 1021
93#define import_from_as_name_type 1022
94#define dotted_as_names_type 1023
95#define dotted_as_name_type 1024
96#define dotted_name_type 1025 // Left-recursive
97#define if_stmt_type 1026
98#define elif_stmt_type 1027
99#define else_block_type 1028
100#define while_stmt_type 1029
101#define for_stmt_type 1030
102#define with_stmt_type 1031
103#define with_item_type 1032
104#define try_stmt_type 1033
105#define except_block_type 1034
106#define finally_block_type 1035
107#define return_stmt_type 1036
108#define raise_stmt_type 1037
109#define function_def_type 1038
110#define function_def_raw_type 1039
111#define params_type 1040
112#define parameters_type 1041
113#define slash_without_default_type 1042
114#define slash_with_default_type 1043
115#define star_etc_type 1044
116#define name_with_optional_default_type 1045
117#define names_with_default_type 1046
118#define name_with_default_type 1047
119#define plain_names_type 1048
120#define plain_name_type 1049
121#define kwds_type 1050
122#define annotation_type 1051
123#define decorators_type 1052
124#define class_def_type 1053
125#define class_def_raw_type 1054
126#define block_type 1055
127#define expressions_list_type 1056
128#define star_expressions_type 1057
129#define star_expression_type 1058
130#define star_named_expressions_type 1059
131#define star_named_expression_type 1060
132#define named_expression_type 1061
133#define annotated_rhs_type 1062
134#define expressions_type 1063
135#define expression_type 1064
136#define lambdef_type 1065
137#define lambda_parameters_type 1066
138#define lambda_slash_without_default_type 1067
139#define lambda_slash_with_default_type 1068
140#define lambda_star_etc_type 1069
141#define lambda_name_with_optional_default_type 1070
142#define lambda_names_with_default_type 1071
143#define lambda_name_with_default_type 1072
144#define lambda_plain_names_type 1073
145#define lambda_plain_name_type 1074
146#define lambda_kwds_type 1075
147#define disjunction_type 1076
148#define conjunction_type 1077
149#define inversion_type 1078
150#define comparison_type 1079
151#define compare_op_bitwise_or_pair_type 1080
152#define eq_bitwise_or_type 1081
153#define noteq_bitwise_or_type 1082
154#define lte_bitwise_or_type 1083
155#define lt_bitwise_or_type 1084
156#define gte_bitwise_or_type 1085
157#define gt_bitwise_or_type 1086
158#define notin_bitwise_or_type 1087
159#define in_bitwise_or_type 1088
160#define isnot_bitwise_or_type 1089
161#define is_bitwise_or_type 1090
162#define bitwise_or_type 1091 // Left-recursive
163#define bitwise_xor_type 1092 // Left-recursive
164#define bitwise_and_type 1093 // Left-recursive
165#define shift_expr_type 1094 // Left-recursive
166#define sum_type 1095 // Left-recursive
167#define term_type 1096 // Left-recursive
168#define factor_type 1097
169#define power_type 1098
170#define await_primary_type 1099
171#define primary_type 1100 // Left-recursive
172#define slices_type 1101
173#define slice_type 1102
174#define atom_type 1103
175#define strings_type 1104
176#define list_type 1105
177#define listcomp_type 1106
178#define tuple_type 1107
179#define group_type 1108
180#define genexp_type 1109
181#define set_type 1110
182#define setcomp_type 1111
183#define dict_type 1112
184#define dictcomp_type 1113
185#define kvpairs_type 1114
186#define kvpair_type 1115
187#define for_if_clauses_type 1116
188#define yield_expr_type 1117
189#define arguments_type 1118
190#define args_type 1119
191#define kwargs_type 1120
192#define starred_expression_type 1121
193#define kwarg_or_starred_type 1122
194#define kwarg_or_double_starred_type 1123
195#define star_targets_type 1124
196#define star_targets_seq_type 1125
197#define star_target_type 1126
198#define star_atom_type 1127
199#define inside_paren_ann_assign_target_type 1128
200#define ann_assign_subscript_attribute_target_type 1129
201#define del_targets_type 1130
202#define del_target_type 1131
203#define del_t_atom_type 1132
204#define targets_type 1133
205#define target_type 1134
206#define t_primary_type 1135 // Left-recursive
207#define t_lookahead_type 1136
208#define t_atom_type 1137
209#define incorrect_arguments_type 1138
210#define invalid_named_expression_type 1139
211#define invalid_assignment_type 1140
212#define invalid_block_type 1141
213#define invalid_comprehension_type 1142
214#define invalid_parameters_type 1143
215#define _loop0_1_type 1144
216#define _loop1_2_type 1145
217#define _loop0_4_type 1146
218#define _gather_3_type 1147
219#define _tmp_5_type 1148
220#define _tmp_6_type 1149
221#define _tmp_7_type 1150
222#define _tmp_8_type 1151
223#define _tmp_9_type 1152
224#define _tmp_10_type 1153
225#define _tmp_11_type 1154
226#define _tmp_12_type 1155
227#define _loop1_13_type 1156
228#define _tmp_14_type 1157
229#define _tmp_15_type 1158
230#define _loop0_17_type 1159
231#define _gather_16_type 1160
232#define _loop0_19_type 1161
233#define _gather_18_type 1162
234#define _tmp_20_type 1163
235#define _loop0_21_type 1164
236#define _loop1_22_type 1165
237#define _loop0_24_type 1166
238#define _gather_23_type 1167
239#define _tmp_25_type 1168
240#define _loop0_27_type 1169
241#define _gather_26_type 1170
242#define _tmp_28_type 1171
243#define _loop0_30_type 1172
244#define _gather_29_type 1173
245#define _loop0_32_type 1174
246#define _gather_31_type 1175
247#define _tmp_33_type 1176
248#define _loop1_34_type 1177
249#define _tmp_35_type 1178
250#define _tmp_36_type 1179
251#define _tmp_37_type 1180
252#define _tmp_38_type 1181
253#define _tmp_39_type 1182
254#define _tmp_40_type 1183
255#define _tmp_41_type 1184
256#define _tmp_42_type 1185
257#define _tmp_43_type 1186
258#define _tmp_44_type 1187
259#define _tmp_45_type 1188
260#define _tmp_46_type 1189
261#define _loop0_47_type 1190
262#define _tmp_48_type 1191
263#define _loop1_49_type 1192
264#define _tmp_50_type 1193
265#define _tmp_51_type 1194
266#define _loop0_53_type 1195
267#define _gather_52_type 1196
268#define _loop0_55_type 1197
269#define _gather_54_type 1198
270#define _tmp_56_type 1199
271#define _loop1_57_type 1200
272#define _tmp_58_type 1201
273#define _loop0_60_type 1202
274#define _gather_59_type 1203
275#define _loop1_61_type 1204
276#define _loop0_63_type 1205
277#define _gather_62_type 1206
278#define _loop1_64_type 1207
279#define _tmp_65_type 1208
280#define _tmp_66_type 1209
281#define _tmp_67_type 1210
282#define _tmp_68_type 1211
283#define _tmp_69_type 1212
284#define _tmp_70_type 1213
285#define _tmp_71_type 1214
286#define _tmp_72_type 1215
287#define _tmp_73_type 1216
288#define _loop0_74_type 1217
289#define _tmp_75_type 1218
290#define _loop1_76_type 1219
291#define _tmp_77_type 1220
292#define _tmp_78_type 1221
293#define _loop0_80_type 1222
294#define _gather_79_type 1223
295#define _loop0_82_type 1224
296#define _gather_81_type 1225
297#define _loop1_83_type 1226
298#define _loop1_84_type 1227
299#define _loop1_85_type 1228
300#define _loop0_87_type 1229
301#define _gather_86_type 1230
302#define _tmp_88_type 1231
303#define _tmp_89_type 1232
304#define _tmp_90_type 1233
305#define _tmp_91_type 1234
306#define _loop1_92_type 1235
307#define _tmp_93_type 1236
308#define _tmp_94_type 1237
309#define _loop0_96_type 1238
310#define _gather_95_type 1239
311#define _loop1_97_type 1240
312#define _tmp_98_type 1241
313#define _tmp_99_type 1242
314#define _loop0_101_type 1243
315#define _gather_100_type 1244
316#define _loop0_103_type 1245
317#define _gather_102_type 1246
318#define _loop0_105_type 1247
319#define _gather_104_type 1248
320#define _loop0_107_type 1249
321#define _gather_106_type 1250
322#define _loop0_108_type 1251
323#define _loop0_110_type 1252
324#define _gather_109_type 1253
325#define _tmp_111_type 1254
326#define _loop0_113_type 1255
327#define _gather_112_type 1256
328#define _loop0_115_type 1257
329#define _gather_114_type 1258
330#define _tmp_116_type 1259
331#define _tmp_117_type 1260
332#define _tmp_118_type 1261
333#define _tmp_119_type 1262
334#define _tmp_120_type 1263
335#define _tmp_121_type 1264
336#define _tmp_122_type 1265
337#define _tmp_123_type 1266
338#define _tmp_124_type 1267
339#define _tmp_125_type 1268
340#define _tmp_126_type 1269
341#define _tmp_127_type 1270
342#define _tmp_128_type 1271
343#define _tmp_129_type 1272
344#define _tmp_130_type 1273
345#define _tmp_131_type 1274
346#define _tmp_132_type 1275
347#define _tmp_133_type 1276
348#define _tmp_134_type 1277
349#define _loop0_135_type 1278
350#define _tmp_136_type 1279
351
352static mod_ty file_rule(Parser *p);
353static mod_ty interactive_rule(Parser *p);
354static mod_ty eval_rule(Parser *p);
355static expr_ty fstring_rule(Parser *p);
356static asdl_seq* statements_rule(Parser *p);
357static asdl_seq* statement_rule(Parser *p);
358static asdl_seq* statement_newline_rule(Parser *p);
359static asdl_seq* simple_stmt_rule(Parser *p);
360static stmt_ty small_stmt_rule(Parser *p);
361static stmt_ty compound_stmt_rule(Parser *p);
362static void *assignment_rule(Parser *p);
363static AugOperator* augassign_rule(Parser *p);
364static stmt_ty global_stmt_rule(Parser *p);
365static stmt_ty nonlocal_stmt_rule(Parser *p);
366static stmt_ty yield_stmt_rule(Parser *p);
367static stmt_ty assert_stmt_rule(Parser *p);
368static stmt_ty del_stmt_rule(Parser *p);
369static stmt_ty import_stmt_rule(Parser *p);
370static stmt_ty import_name_rule(Parser *p);
371static stmt_ty import_from_rule(Parser *p);
372static asdl_seq* import_from_targets_rule(Parser *p);
373static asdl_seq* import_from_as_names_rule(Parser *p);
374static alias_ty import_from_as_name_rule(Parser *p);
375static asdl_seq* dotted_as_names_rule(Parser *p);
376static alias_ty dotted_as_name_rule(Parser *p);
377static expr_ty dotted_name_rule(Parser *p);
378static stmt_ty if_stmt_rule(Parser *p);
379static stmt_ty elif_stmt_rule(Parser *p);
380static asdl_seq* else_block_rule(Parser *p);
381static stmt_ty while_stmt_rule(Parser *p);
382static stmt_ty for_stmt_rule(Parser *p);
383static stmt_ty with_stmt_rule(Parser *p);
384static withitem_ty with_item_rule(Parser *p);
385static stmt_ty try_stmt_rule(Parser *p);
386static excepthandler_ty except_block_rule(Parser *p);
387static asdl_seq* finally_block_rule(Parser *p);
388static stmt_ty return_stmt_rule(Parser *p);
389static stmt_ty raise_stmt_rule(Parser *p);
390static stmt_ty function_def_rule(Parser *p);
391static stmt_ty function_def_raw_rule(Parser *p);
392static arguments_ty params_rule(Parser *p);
393static arguments_ty parameters_rule(Parser *p);
394static asdl_seq* slash_without_default_rule(Parser *p);
395static SlashWithDefault* slash_with_default_rule(Parser *p);
396static StarEtc* star_etc_rule(Parser *p);
397static NameDefaultPair* name_with_optional_default_rule(Parser *p);
398static asdl_seq* names_with_default_rule(Parser *p);
399static NameDefaultPair* name_with_default_rule(Parser *p);
400static asdl_seq* plain_names_rule(Parser *p);
401static arg_ty plain_name_rule(Parser *p);
402static arg_ty kwds_rule(Parser *p);
403static expr_ty annotation_rule(Parser *p);
404static asdl_seq* decorators_rule(Parser *p);
405static stmt_ty class_def_rule(Parser *p);
406static stmt_ty class_def_raw_rule(Parser *p);
407static asdl_seq* block_rule(Parser *p);
408static asdl_seq* expressions_list_rule(Parser *p);
409static expr_ty star_expressions_rule(Parser *p);
410static expr_ty star_expression_rule(Parser *p);
411static asdl_seq* star_named_expressions_rule(Parser *p);
412static expr_ty star_named_expression_rule(Parser *p);
413static expr_ty named_expression_rule(Parser *p);
414static expr_ty annotated_rhs_rule(Parser *p);
415static expr_ty expressions_rule(Parser *p);
416static expr_ty expression_rule(Parser *p);
417static expr_ty lambdef_rule(Parser *p);
418static arguments_ty lambda_parameters_rule(Parser *p);
419static asdl_seq* lambda_slash_without_default_rule(Parser *p);
420static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
421static StarEtc* lambda_star_etc_rule(Parser *p);
422static NameDefaultPair* lambda_name_with_optional_default_rule(Parser *p);
423static asdl_seq* lambda_names_with_default_rule(Parser *p);
424static NameDefaultPair* lambda_name_with_default_rule(Parser *p);
425static asdl_seq* lambda_plain_names_rule(Parser *p);
426static arg_ty lambda_plain_name_rule(Parser *p);
427static arg_ty lambda_kwds_rule(Parser *p);
428static expr_ty disjunction_rule(Parser *p);
429static expr_ty conjunction_rule(Parser *p);
430static expr_ty inversion_rule(Parser *p);
431static expr_ty comparison_rule(Parser *p);
432static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
433static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
434static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
435static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
436static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
437static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
438static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
439static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
440static CmpopExprPair* in_bitwise_or_rule(Parser *p);
441static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
442static CmpopExprPair* is_bitwise_or_rule(Parser *p);
443static expr_ty bitwise_or_rule(Parser *p);
444static expr_ty bitwise_xor_rule(Parser *p);
445static expr_ty bitwise_and_rule(Parser *p);
446static expr_ty shift_expr_rule(Parser *p);
447static expr_ty sum_rule(Parser *p);
448static expr_ty term_rule(Parser *p);
449static expr_ty factor_rule(Parser *p);
450static expr_ty power_rule(Parser *p);
451static expr_ty await_primary_rule(Parser *p);
452static expr_ty primary_rule(Parser *p);
453static expr_ty slices_rule(Parser *p);
454static expr_ty slice_rule(Parser *p);
455static expr_ty atom_rule(Parser *p);
456static expr_ty strings_rule(Parser *p);
457static expr_ty list_rule(Parser *p);
458static expr_ty listcomp_rule(Parser *p);
459static expr_ty tuple_rule(Parser *p);
460static expr_ty group_rule(Parser *p);
461static expr_ty genexp_rule(Parser *p);
462static expr_ty set_rule(Parser *p);
463static expr_ty setcomp_rule(Parser *p);
464static expr_ty dict_rule(Parser *p);
465static expr_ty dictcomp_rule(Parser *p);
466static asdl_seq* kvpairs_rule(Parser *p);
467static KeyValuePair* kvpair_rule(Parser *p);
468static asdl_seq* for_if_clauses_rule(Parser *p);
469static expr_ty yield_expr_rule(Parser *p);
470static expr_ty arguments_rule(Parser *p);
471static expr_ty args_rule(Parser *p);
472static asdl_seq* kwargs_rule(Parser *p);
473static expr_ty starred_expression_rule(Parser *p);
474static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
475static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
476static expr_ty star_targets_rule(Parser *p);
477static asdl_seq* star_targets_seq_rule(Parser *p);
478static expr_ty star_target_rule(Parser *p);
479static expr_ty star_atom_rule(Parser *p);
480static expr_ty inside_paren_ann_assign_target_rule(Parser *p);
481static expr_ty ann_assign_subscript_attribute_target_rule(Parser *p);
482static asdl_seq* del_targets_rule(Parser *p);
483static expr_ty del_target_rule(Parser *p);
484static expr_ty del_t_atom_rule(Parser *p);
485static asdl_seq* targets_rule(Parser *p);
486static expr_ty target_rule(Parser *p);
487static expr_ty t_primary_rule(Parser *p);
488static void *t_lookahead_rule(Parser *p);
489static expr_ty t_atom_rule(Parser *p);
490static void *incorrect_arguments_rule(Parser *p);
491static void *invalid_named_expression_rule(Parser *p);
492static void *invalid_assignment_rule(Parser *p);
493static void *invalid_block_rule(Parser *p);
494static void *invalid_comprehension_rule(Parser *p);
495static void *invalid_parameters_rule(Parser *p);
496static asdl_seq *_loop0_1_rule(Parser *p);
497static asdl_seq *_loop1_2_rule(Parser *p);
498static asdl_seq *_loop0_4_rule(Parser *p);
499static asdl_seq *_gather_3_rule(Parser *p);
500static void *_tmp_5_rule(Parser *p);
501static void *_tmp_6_rule(Parser *p);
502static void *_tmp_7_rule(Parser *p);
503static void *_tmp_8_rule(Parser *p);
504static void *_tmp_9_rule(Parser *p);
505static void *_tmp_10_rule(Parser *p);
506static void *_tmp_11_rule(Parser *p);
507static void *_tmp_12_rule(Parser *p);
508static asdl_seq *_loop1_13_rule(Parser *p);
509static void *_tmp_14_rule(Parser *p);
510static void *_tmp_15_rule(Parser *p);
511static asdl_seq *_loop0_17_rule(Parser *p);
512static asdl_seq *_gather_16_rule(Parser *p);
513static asdl_seq *_loop0_19_rule(Parser *p);
514static asdl_seq *_gather_18_rule(Parser *p);
515static void *_tmp_20_rule(Parser *p);
516static asdl_seq *_loop0_21_rule(Parser *p);
517static asdl_seq *_loop1_22_rule(Parser *p);
518static asdl_seq *_loop0_24_rule(Parser *p);
519static asdl_seq *_gather_23_rule(Parser *p);
520static void *_tmp_25_rule(Parser *p);
521static asdl_seq *_loop0_27_rule(Parser *p);
522static asdl_seq *_gather_26_rule(Parser *p);
523static void *_tmp_28_rule(Parser *p);
524static asdl_seq *_loop0_30_rule(Parser *p);
525static asdl_seq *_gather_29_rule(Parser *p);
526static asdl_seq *_loop0_32_rule(Parser *p);
527static asdl_seq *_gather_31_rule(Parser *p);
528static void *_tmp_33_rule(Parser *p);
529static asdl_seq *_loop1_34_rule(Parser *p);
530static void *_tmp_35_rule(Parser *p);
531static void *_tmp_36_rule(Parser *p);
532static void *_tmp_37_rule(Parser *p);
533static void *_tmp_38_rule(Parser *p);
534static void *_tmp_39_rule(Parser *p);
535static void *_tmp_40_rule(Parser *p);
536static void *_tmp_41_rule(Parser *p);
537static void *_tmp_42_rule(Parser *p);
538static void *_tmp_43_rule(Parser *p);
539static void *_tmp_44_rule(Parser *p);
540static void *_tmp_45_rule(Parser *p);
541static void *_tmp_46_rule(Parser *p);
542static asdl_seq *_loop0_47_rule(Parser *p);
543static void *_tmp_48_rule(Parser *p);
544static asdl_seq *_loop1_49_rule(Parser *p);
545static void *_tmp_50_rule(Parser *p);
546static void *_tmp_51_rule(Parser *p);
547static asdl_seq *_loop0_53_rule(Parser *p);
548static asdl_seq *_gather_52_rule(Parser *p);
549static asdl_seq *_loop0_55_rule(Parser *p);
550static asdl_seq *_gather_54_rule(Parser *p);
551static void *_tmp_56_rule(Parser *p);
552static asdl_seq *_loop1_57_rule(Parser *p);
553static void *_tmp_58_rule(Parser *p);
554static asdl_seq *_loop0_60_rule(Parser *p);
555static asdl_seq *_gather_59_rule(Parser *p);
556static asdl_seq *_loop1_61_rule(Parser *p);
557static asdl_seq *_loop0_63_rule(Parser *p);
558static asdl_seq *_gather_62_rule(Parser *p);
559static asdl_seq *_loop1_64_rule(Parser *p);
560static void *_tmp_65_rule(Parser *p);
561static void *_tmp_66_rule(Parser *p);
562static void *_tmp_67_rule(Parser *p);
563static void *_tmp_68_rule(Parser *p);
564static void *_tmp_69_rule(Parser *p);
565static void *_tmp_70_rule(Parser *p);
566static void *_tmp_71_rule(Parser *p);
567static void *_tmp_72_rule(Parser *p);
568static void *_tmp_73_rule(Parser *p);
569static asdl_seq *_loop0_74_rule(Parser *p);
570static void *_tmp_75_rule(Parser *p);
571static asdl_seq *_loop1_76_rule(Parser *p);
572static void *_tmp_77_rule(Parser *p);
573static void *_tmp_78_rule(Parser *p);
574static asdl_seq *_loop0_80_rule(Parser *p);
575static asdl_seq *_gather_79_rule(Parser *p);
576static asdl_seq *_loop0_82_rule(Parser *p);
577static asdl_seq *_gather_81_rule(Parser *p);
578static asdl_seq *_loop1_83_rule(Parser *p);
579static asdl_seq *_loop1_84_rule(Parser *p);
580static asdl_seq *_loop1_85_rule(Parser *p);
581static asdl_seq *_loop0_87_rule(Parser *p);
582static asdl_seq *_gather_86_rule(Parser *p);
583static void *_tmp_88_rule(Parser *p);
584static void *_tmp_89_rule(Parser *p);
585static void *_tmp_90_rule(Parser *p);
586static void *_tmp_91_rule(Parser *p);
587static asdl_seq *_loop1_92_rule(Parser *p);
588static void *_tmp_93_rule(Parser *p);
589static void *_tmp_94_rule(Parser *p);
590static asdl_seq *_loop0_96_rule(Parser *p);
591static asdl_seq *_gather_95_rule(Parser *p);
592static asdl_seq *_loop1_97_rule(Parser *p);
593static void *_tmp_98_rule(Parser *p);
594static void *_tmp_99_rule(Parser *p);
595static asdl_seq *_loop0_101_rule(Parser *p);
596static asdl_seq *_gather_100_rule(Parser *p);
597static asdl_seq *_loop0_103_rule(Parser *p);
598static asdl_seq *_gather_102_rule(Parser *p);
599static asdl_seq *_loop0_105_rule(Parser *p);
600static asdl_seq *_gather_104_rule(Parser *p);
601static asdl_seq *_loop0_107_rule(Parser *p);
602static asdl_seq *_gather_106_rule(Parser *p);
603static asdl_seq *_loop0_108_rule(Parser *p);
604static asdl_seq *_loop0_110_rule(Parser *p);
605static asdl_seq *_gather_109_rule(Parser *p);
606static void *_tmp_111_rule(Parser *p);
607static asdl_seq *_loop0_113_rule(Parser *p);
608static asdl_seq *_gather_112_rule(Parser *p);
609static asdl_seq *_loop0_115_rule(Parser *p);
610static asdl_seq *_gather_114_rule(Parser *p);
611static void *_tmp_116_rule(Parser *p);
612static void *_tmp_117_rule(Parser *p);
613static void *_tmp_118_rule(Parser *p);
614static void *_tmp_119_rule(Parser *p);
615static void *_tmp_120_rule(Parser *p);
616static void *_tmp_121_rule(Parser *p);
617static void *_tmp_122_rule(Parser *p);
618static void *_tmp_123_rule(Parser *p);
619static void *_tmp_124_rule(Parser *p);
620static void *_tmp_125_rule(Parser *p);
621static void *_tmp_126_rule(Parser *p);
622static void *_tmp_127_rule(Parser *p);
623static void *_tmp_128_rule(Parser *p);
624static void *_tmp_129_rule(Parser *p);
625static void *_tmp_130_rule(Parser *p);
626static void *_tmp_131_rule(Parser *p);
627static void *_tmp_132_rule(Parser *p);
628static void *_tmp_133_rule(Parser *p);
629static void *_tmp_134_rule(Parser *p);
630static asdl_seq *_loop0_135_rule(Parser *p);
631static void *_tmp_136_rule(Parser *p);
632
633
634// file: statements? $
635static mod_ty
636file_rule(Parser *p)
637{
638 if (p->error_indicator) {
639 return NULL;
640 }
641 mod_ty res = NULL;
642 int mark = p->mark;
643 { // statements? $
644 void *a;
645 void *endmarker_var;
646 if (
647 (a = statements_rule(p), 1)
648 &&
649 (endmarker_var = _PyPegen_endmarker_token(p))
650 )
651 {
652 res = Module ( a , NULL , p -> arena );
653 if (res == NULL && PyErr_Occurred()) {
654 p->error_indicator = 1;
655 return NULL;
656 }
657 goto done;
658 }
659 p->mark = mark;
660 }
661 res = NULL;
662 done:
663 return res;
664}
665
666// interactive: statement_newline
667static mod_ty
668interactive_rule(Parser *p)
669{
670 if (p->error_indicator) {
671 return NULL;
672 }
673 mod_ty res = NULL;
674 int mark = p->mark;
675 { // statement_newline
676 asdl_seq* a;
677 if (
678 (a = statement_newline_rule(p))
679 )
680 {
681 res = Interactive ( a , p -> arena );
682 if (res == NULL && PyErr_Occurred()) {
683 p->error_indicator = 1;
684 return NULL;
685 }
686 goto done;
687 }
688 p->mark = mark;
689 }
690 res = NULL;
691 done:
692 return res;
693}
694
695// eval: expressions NEWLINE* $
696static mod_ty
697eval_rule(Parser *p)
698{
699 if (p->error_indicator) {
700 return NULL;
701 }
702 mod_ty res = NULL;
703 int mark = p->mark;
704 { // expressions NEWLINE* $
705 asdl_seq * _loop0_1_var;
706 expr_ty a;
707 void *endmarker_var;
708 if (
709 (a = expressions_rule(p))
710 &&
711 (_loop0_1_var = _loop0_1_rule(p))
712 &&
713 (endmarker_var = _PyPegen_endmarker_token(p))
714 )
715 {
716 res = Expression ( a , p -> arena );
717 if (res == NULL && PyErr_Occurred()) {
718 p->error_indicator = 1;
719 return NULL;
720 }
721 goto done;
722 }
723 p->mark = mark;
724 }
725 res = NULL;
726 done:
727 return res;
728}
729
730// fstring: star_expressions
731static expr_ty
732fstring_rule(Parser *p)
733{
734 if (p->error_indicator) {
735 return NULL;
736 }
737 expr_ty res = NULL;
738 int mark = p->mark;
739 { // star_expressions
740 expr_ty star_expressions_var;
741 if (
742 (star_expressions_var = star_expressions_rule(p))
743 )
744 {
745 res = star_expressions_var;
746 goto done;
747 }
748 p->mark = mark;
749 }
750 res = NULL;
751 done:
752 return res;
753}
754
755// statements: statement+
756static asdl_seq*
757statements_rule(Parser *p)
758{
759 if (p->error_indicator) {
760 return NULL;
761 }
762 asdl_seq* res = NULL;
763 int mark = p->mark;
764 { // statement+
765 asdl_seq * a;
766 if (
767 (a = _loop1_2_rule(p))
768 )
769 {
770 res = _PyPegen_seq_flatten ( p , a );
771 if (res == NULL && PyErr_Occurred()) {
772 p->error_indicator = 1;
773 return NULL;
774 }
775 goto done;
776 }
777 p->mark = mark;
778 }
779 res = NULL;
780 done:
781 return res;
782}
783
784// statement: compound_stmt | simple_stmt
785static asdl_seq*
786statement_rule(Parser *p)
787{
788 if (p->error_indicator) {
789 return NULL;
790 }
791 asdl_seq* res = NULL;
792 int mark = p->mark;
793 { // compound_stmt
794 stmt_ty a;
795 if (
796 (a = compound_stmt_rule(p))
797 )
798 {
799 res = _PyPegen_singleton_seq ( p , a );
800 if (res == NULL && PyErr_Occurred()) {
801 p->error_indicator = 1;
802 return NULL;
803 }
804 goto done;
805 }
806 p->mark = mark;
807 }
808 { // simple_stmt
809 asdl_seq* simple_stmt_var;
810 if (
811 (simple_stmt_var = simple_stmt_rule(p))
812 )
813 {
814 res = simple_stmt_var;
815 goto done;
816 }
817 p->mark = mark;
818 }
819 res = NULL;
820 done:
821 return res;
822}
823
824// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
825static asdl_seq*
826statement_newline_rule(Parser *p)
827{
828 if (p->error_indicator) {
829 return NULL;
830 }
831 asdl_seq* res = NULL;
832 int mark = p->mark;
833 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
834 p->error_indicator = 1;
835 return NULL;
836 }
837 int start_lineno = p->tokens[mark]->lineno;
838 UNUSED(start_lineno); // Only used by EXTRA macro
839 int start_col_offset = p->tokens[mark]->col_offset;
840 UNUSED(start_col_offset); // Only used by EXTRA macro
841 { // compound_stmt NEWLINE
842 stmt_ty a;
843 void *newline_var;
844 if (
845 (a = compound_stmt_rule(p))
846 &&
847 (newline_var = _PyPegen_newline_token(p))
848 )
849 {
850 res = _PyPegen_singleton_seq ( p , a );
851 if (res == NULL && PyErr_Occurred()) {
852 p->error_indicator = 1;
853 return NULL;
854 }
855 goto done;
856 }
857 p->mark = mark;
858 }
859 { // simple_stmt
860 asdl_seq* simple_stmt_var;
861 if (
862 (simple_stmt_var = simple_stmt_rule(p))
863 )
864 {
865 res = simple_stmt_var;
866 goto done;
867 }
868 p->mark = mark;
869 }
870 { // NEWLINE
871 void *newline_var;
872 if (
873 (newline_var = _PyPegen_newline_token(p))
874 )
875 {
876 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
877 if (token == NULL) {
878 return NULL;
879 }
880 int end_lineno = token->end_lineno;
881 UNUSED(end_lineno); // Only used by EXTRA macro
882 int end_col_offset = token->end_col_offset;
883 UNUSED(end_col_offset); // Only used by EXTRA macro
884 res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
885 if (res == NULL && PyErr_Occurred()) {
886 p->error_indicator = 1;
887 return NULL;
888 }
889 goto done;
890 }
891 p->mark = mark;
892 }
893 { // $
894 void *endmarker_var;
895 if (
896 (endmarker_var = _PyPegen_endmarker_token(p))
897 )
898 {
899 res = _PyPegen_interactive_exit ( p );
900 if (res == NULL && PyErr_Occurred()) {
901 p->error_indicator = 1;
902 return NULL;
903 }
904 goto done;
905 }
906 p->mark = mark;
907 }
908 res = NULL;
909 done:
910 return res;
911}
912
913// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
914static asdl_seq*
915simple_stmt_rule(Parser *p)
916{
917 if (p->error_indicator) {
918 return NULL;
919 }
920 asdl_seq* res = NULL;
921 int mark = p->mark;
922 { // small_stmt !';' NEWLINE
923 stmt_ty a;
924 void *newline_var;
925 if (
926 (a = small_stmt_rule(p))
927 &&
928 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13)
929 &&
930 (newline_var = _PyPegen_newline_token(p))
931 )
932 {
933 res = _PyPegen_singleton_seq ( p , a );
934 if (res == NULL && PyErr_Occurred()) {
935 p->error_indicator = 1;
936 return NULL;
937 }
938 goto done;
939 }
940 p->mark = mark;
941 }
942 { // ';'.small_stmt+ ';'? NEWLINE
943 asdl_seq * a;
944 void *newline_var;
945 void *opt_var;
946 UNUSED(opt_var); // Silence compiler warnings
947 if (
948 (a = _gather_3_rule(p))
949 &&
950 (opt_var = _PyPegen_expect_token(p, 13), 1)
951 &&
952 (newline_var = _PyPegen_newline_token(p))
953 )
954 {
955 res = a;
956 if (res == NULL && PyErr_Occurred()) {
957 p->error_indicator = 1;
958 return NULL;
959 }
960 goto done;
961 }
962 p->mark = mark;
963 }
964 res = NULL;
965 done:
966 return res;
967}
968
969// small_stmt:
970// | assignment
971// | star_expressions
972// | &'return' return_stmt
973// | &('import' | 'from') import_stmt
974// | &'raise' raise_stmt
975// | 'pass'
976// | &'del' del_stmt
977// | &'yield' yield_stmt
978// | &'assert' assert_stmt
979// | 'break'
980// | 'continue'
981// | &'global' global_stmt
982// | &'nonlocal' nonlocal_stmt
983static stmt_ty
984small_stmt_rule(Parser *p)
985{
986 if (p->error_indicator) {
987 return NULL;
988 }
989 stmt_ty res = NULL;
990 if (_PyPegen_is_memoized(p, small_stmt_type, &res))
991 return res;
992 int mark = p->mark;
993 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
994 p->error_indicator = 1;
995 return NULL;
996 }
997 int start_lineno = p->tokens[mark]->lineno;
998 UNUSED(start_lineno); // Only used by EXTRA macro
999 int start_col_offset = p->tokens[mark]->col_offset;
1000 UNUSED(start_col_offset); // Only used by EXTRA macro
1001 { // assignment
1002 void *assignment_var;
1003 if (
1004 (assignment_var = assignment_rule(p))
1005 )
1006 {
1007 res = assignment_var;
1008 goto done;
1009 }
1010 p->mark = mark;
1011 }
1012 { // star_expressions
1013 expr_ty e;
1014 if (
1015 (e = star_expressions_rule(p))
1016 )
1017 {
1018 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1019 if (token == NULL) {
1020 return NULL;
1021 }
1022 int end_lineno = token->end_lineno;
1023 UNUSED(end_lineno); // Only used by EXTRA macro
1024 int end_col_offset = token->end_col_offset;
1025 UNUSED(end_col_offset); // Only used by EXTRA macro
1026 res = _Py_Expr ( e , EXTRA );
1027 if (res == NULL && PyErr_Occurred()) {
1028 p->error_indicator = 1;
1029 return NULL;
1030 }
1031 goto done;
1032 }
1033 p->mark = mark;
1034 }
1035 { // &'return' return_stmt
1036 stmt_ty return_stmt_var;
1037 if (
1038 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500)
1039 &&
1040 (return_stmt_var = return_stmt_rule(p))
1041 )
1042 {
1043 res = return_stmt_var;
1044 goto done;
1045 }
1046 p->mark = mark;
1047 }
1048 { // &('import' | 'from') import_stmt
1049 stmt_ty import_stmt_var;
1050 if (
1051 _PyPegen_lookahead(1, _tmp_5_rule, p)
1052 &&
1053 (import_stmt_var = import_stmt_rule(p))
1054 )
1055 {
1056 res = import_stmt_var;
1057 goto done;
1058 }
1059 p->mark = mark;
1060 }
1061 { // &'raise' raise_stmt
1062 stmt_ty raise_stmt_var;
1063 if (
1064 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501)
1065 &&
1066 (raise_stmt_var = raise_stmt_rule(p))
1067 )
1068 {
1069 res = raise_stmt_var;
1070 goto done;
1071 }
1072 p->mark = mark;
1073 }
1074 { // 'pass'
1075 void *keyword;
1076 if (
1077 (keyword = _PyPegen_expect_token(p, 502))
1078 )
1079 {
1080 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1081 if (token == NULL) {
1082 return NULL;
1083 }
1084 int end_lineno = token->end_lineno;
1085 UNUSED(end_lineno); // Only used by EXTRA macro
1086 int end_col_offset = token->end_col_offset;
1087 UNUSED(end_col_offset); // Only used by EXTRA macro
1088 res = _Py_Pass ( EXTRA );
1089 if (res == NULL && PyErr_Occurred()) {
1090 p->error_indicator = 1;
1091 return NULL;
1092 }
1093 goto done;
1094 }
1095 p->mark = mark;
1096 }
1097 { // &'del' del_stmt
1098 stmt_ty del_stmt_var;
1099 if (
1100 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503)
1101 &&
1102 (del_stmt_var = del_stmt_rule(p))
1103 )
1104 {
1105 res = del_stmt_var;
1106 goto done;
1107 }
1108 p->mark = mark;
1109 }
1110 { // &'yield' yield_stmt
1111 stmt_ty yield_stmt_var;
1112 if (
1113 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504)
1114 &&
1115 (yield_stmt_var = yield_stmt_rule(p))
1116 )
1117 {
1118 res = yield_stmt_var;
1119 goto done;
1120 }
1121 p->mark = mark;
1122 }
1123 { // &'assert' assert_stmt
1124 stmt_ty assert_stmt_var;
1125 if (
1126 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505)
1127 &&
1128 (assert_stmt_var = assert_stmt_rule(p))
1129 )
1130 {
1131 res = assert_stmt_var;
1132 goto done;
1133 }
1134 p->mark = mark;
1135 }
1136 { // 'break'
1137 void *keyword;
1138 if (
1139 (keyword = _PyPegen_expect_token(p, 506))
1140 )
1141 {
1142 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1143 if (token == NULL) {
1144 return NULL;
1145 }
1146 int end_lineno = token->end_lineno;
1147 UNUSED(end_lineno); // Only used by EXTRA macro
1148 int end_col_offset = token->end_col_offset;
1149 UNUSED(end_col_offset); // Only used by EXTRA macro
1150 res = _Py_Break ( EXTRA );
1151 if (res == NULL && PyErr_Occurred()) {
1152 p->error_indicator = 1;
1153 return NULL;
1154 }
1155 goto done;
1156 }
1157 p->mark = mark;
1158 }
1159 { // 'continue'
1160 void *keyword;
1161 if (
1162 (keyword = _PyPegen_expect_token(p, 507))
1163 )
1164 {
1165 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1166 if (token == NULL) {
1167 return NULL;
1168 }
1169 int end_lineno = token->end_lineno;
1170 UNUSED(end_lineno); // Only used by EXTRA macro
1171 int end_col_offset = token->end_col_offset;
1172 UNUSED(end_col_offset); // Only used by EXTRA macro
1173 res = _Py_Continue ( EXTRA );
1174 if (res == NULL && PyErr_Occurred()) {
1175 p->error_indicator = 1;
1176 return NULL;
1177 }
1178 goto done;
1179 }
1180 p->mark = mark;
1181 }
1182 { // &'global' global_stmt
1183 stmt_ty global_stmt_var;
1184 if (
1185 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508)
1186 &&
1187 (global_stmt_var = global_stmt_rule(p))
1188 )
1189 {
1190 res = global_stmt_var;
1191 goto done;
1192 }
1193 p->mark = mark;
1194 }
1195 { // &'nonlocal' nonlocal_stmt
1196 stmt_ty nonlocal_stmt_var;
1197 if (
1198 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509)
1199 &&
1200 (nonlocal_stmt_var = nonlocal_stmt_rule(p))
1201 )
1202 {
1203 res = nonlocal_stmt_var;
1204 goto done;
1205 }
1206 p->mark = mark;
1207 }
1208 res = NULL;
1209 done:
1210 _PyPegen_insert_memo(p, mark, small_stmt_type, res);
1211 return res;
1212}
1213
1214// compound_stmt:
1215// | &('def' | '@' | ASYNC) function_def
1216// | &'if' if_stmt
1217// | &('class' | '@') class_def
1218// | &('with' | ASYNC) with_stmt
1219// | &('for' | ASYNC) for_stmt
1220// | &'try' try_stmt
1221// | &'while' while_stmt
1222static stmt_ty
1223compound_stmt_rule(Parser *p)
1224{
1225 if (p->error_indicator) {
1226 return NULL;
1227 }
1228 stmt_ty res = NULL;
1229 int mark = p->mark;
1230 { // &('def' | '@' | ASYNC) function_def
1231 stmt_ty function_def_var;
1232 if (
1233 _PyPegen_lookahead(1, _tmp_6_rule, p)
1234 &&
1235 (function_def_var = function_def_rule(p))
1236 )
1237 {
1238 res = function_def_var;
1239 goto done;
1240 }
1241 p->mark = mark;
1242 }
1243 { // &'if' if_stmt
1244 stmt_ty if_stmt_var;
1245 if (
1246 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510)
1247 &&
1248 (if_stmt_var = if_stmt_rule(p))
1249 )
1250 {
1251 res = if_stmt_var;
1252 goto done;
1253 }
1254 p->mark = mark;
1255 }
1256 { // &('class' | '@') class_def
1257 stmt_ty class_def_var;
1258 if (
1259 _PyPegen_lookahead(1, _tmp_7_rule, p)
1260 &&
1261 (class_def_var = class_def_rule(p))
1262 )
1263 {
1264 res = class_def_var;
1265 goto done;
1266 }
1267 p->mark = mark;
1268 }
1269 { // &('with' | ASYNC) with_stmt
1270 stmt_ty with_stmt_var;
1271 if (
1272 _PyPegen_lookahead(1, _tmp_8_rule, p)
1273 &&
1274 (with_stmt_var = with_stmt_rule(p))
1275 )
1276 {
1277 res = with_stmt_var;
1278 goto done;
1279 }
1280 p->mark = mark;
1281 }
1282 { // &('for' | ASYNC) for_stmt
1283 stmt_ty for_stmt_var;
1284 if (
1285 _PyPegen_lookahead(1, _tmp_9_rule, p)
1286 &&
1287 (for_stmt_var = for_stmt_rule(p))
1288 )
1289 {
1290 res = for_stmt_var;
1291 goto done;
1292 }
1293 p->mark = mark;
1294 }
1295 { // &'try' try_stmt
1296 stmt_ty try_stmt_var;
1297 if (
1298 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511)
1299 &&
1300 (try_stmt_var = try_stmt_rule(p))
1301 )
1302 {
1303 res = try_stmt_var;
1304 goto done;
1305 }
1306 p->mark = mark;
1307 }
1308 { // &'while' while_stmt
1309 stmt_ty while_stmt_var;
1310 if (
1311 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512)
1312 &&
1313 (while_stmt_var = while_stmt_rule(p))
1314 )
1315 {
1316 res = while_stmt_var;
1317 goto done;
1318 }
1319 p->mark = mark;
1320 }
1321 res = NULL;
1322 done:
1323 return res;
1324}
1325
1326// assignment:
1327// | NAME ':' expression ['=' annotated_rhs]
1328// | ('(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target) ':' expression ['=' annotated_rhs]
1329// | ((star_targets '='))+ (yield_expr | star_expressions)
1330// | target augassign (yield_expr | star_expressions)
1331// | invalid_assignment
1332static void *
1333assignment_rule(Parser *p)
1334{
1335 if (p->error_indicator) {
1336 return NULL;
1337 }
1338 void * res = NULL;
1339 int mark = p->mark;
1340 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1341 p->error_indicator = 1;
1342 return NULL;
1343 }
1344 int start_lineno = p->tokens[mark]->lineno;
1345 UNUSED(start_lineno); // Only used by EXTRA macro
1346 int start_col_offset = p->tokens[mark]->col_offset;
1347 UNUSED(start_col_offset); // Only used by EXTRA macro
1348 { // NAME ':' expression ['=' annotated_rhs]
1349 expr_ty a;
1350 expr_ty b;
1351 void *c;
1352 void *literal;
1353 if (
1354 (a = _PyPegen_name_token(p))
1355 &&
1356 (literal = _PyPegen_expect_token(p, 11))
1357 &&
1358 (b = expression_rule(p))
1359 &&
1360 (c = _tmp_10_rule(p), 1)
1361 )
1362 {
1363 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1364 if (token == NULL) {
1365 return NULL;
1366 }
1367 int end_lineno = token->end_lineno;
1368 UNUSED(end_lineno); // Only used by EXTRA macro
1369 int end_col_offset = token->end_col_offset;
1370 UNUSED(end_col_offset); // Only used by EXTRA macro
1371 res = _Py_AnnAssign ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA );
1372 if (res == NULL && PyErr_Occurred()) {
1373 p->error_indicator = 1;
1374 return NULL;
1375 }
1376 goto done;
1377 }
1378 p->mark = mark;
1379 }
1380 { // ('(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target) ':' expression ['=' annotated_rhs]
1381 void *a;
1382 expr_ty b;
1383 void *c;
1384 void *literal;
1385 if (
1386 (a = _tmp_11_rule(p))
1387 &&
1388 (literal = _PyPegen_expect_token(p, 11))
1389 &&
1390 (b = expression_rule(p))
1391 &&
1392 (c = _tmp_12_rule(p), 1)
1393 )
1394 {
1395 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1396 if (token == NULL) {
1397 return NULL;
1398 }
1399 int end_lineno = token->end_lineno;
1400 UNUSED(end_lineno); // Only used by EXTRA macro
1401 int end_col_offset = token->end_col_offset;
1402 UNUSED(end_col_offset); // Only used by EXTRA macro
1403 res = _Py_AnnAssign ( a , b , c , 0 , EXTRA );
1404 if (res == NULL && PyErr_Occurred()) {
1405 p->error_indicator = 1;
1406 return NULL;
1407 }
1408 goto done;
1409 }
1410 p->mark = mark;
1411 }
1412 { // ((star_targets '='))+ (yield_expr | star_expressions)
1413 asdl_seq * a;
1414 void *b;
1415 if (
1416 (a = _loop1_13_rule(p))
1417 &&
1418 (b = _tmp_14_rule(p))
1419 )
1420 {
1421 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1422 if (token == NULL) {
1423 return NULL;
1424 }
1425 int end_lineno = token->end_lineno;
1426 UNUSED(end_lineno); // Only used by EXTRA macro
1427 int end_col_offset = token->end_col_offset;
1428 UNUSED(end_col_offset); // Only used by EXTRA macro
1429 res = _Py_Assign ( a , b , NULL , EXTRA );
1430 if (res == NULL && PyErr_Occurred()) {
1431 p->error_indicator = 1;
1432 return NULL;
1433 }
1434 goto done;
1435 }
1436 p->mark = mark;
1437 }
1438 { // target augassign (yield_expr | star_expressions)
1439 expr_ty a;
1440 AugOperator* b;
1441 void *c;
1442 if (
1443 (a = target_rule(p))
1444 &&
1445 (b = augassign_rule(p))
1446 &&
1447 (c = _tmp_15_rule(p))
1448 )
1449 {
1450 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1451 if (token == NULL) {
1452 return NULL;
1453 }
1454 int end_lineno = token->end_lineno;
1455 UNUSED(end_lineno); // Only used by EXTRA macro
1456 int end_col_offset = token->end_col_offset;
1457 UNUSED(end_col_offset); // Only used by EXTRA macro
1458 res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
1459 if (res == NULL && PyErr_Occurred()) {
1460 p->error_indicator = 1;
1461 return NULL;
1462 }
1463 goto done;
1464 }
1465 p->mark = mark;
1466 }
1467 { // invalid_assignment
1468 void *invalid_assignment_var;
1469 if (
1470 (invalid_assignment_var = invalid_assignment_rule(p))
1471 )
1472 {
1473 res = invalid_assignment_var;
1474 goto done;
1475 }
1476 p->mark = mark;
1477 }
1478 res = NULL;
1479 done:
1480 return res;
1481}
1482
1483// augassign:
1484// | '+='
1485// | '-='
1486// | '*='
1487// | '@='
1488// | '/='
1489// | '%='
1490// | '&='
1491// | '|='
1492// | '^='
1493// | '<<='
1494// | '>>='
1495// | '**='
1496// | '//='
1497static AugOperator*
1498augassign_rule(Parser *p)
1499{
1500 if (p->error_indicator) {
1501 return NULL;
1502 }
1503 AugOperator* res = NULL;
1504 int mark = p->mark;
1505 { // '+='
1506 void *literal;
1507 if (
1508 (literal = _PyPegen_expect_token(p, 36))
1509 )
1510 {
1511 res = _PyPegen_augoperator ( p , Add );
1512 if (res == NULL && PyErr_Occurred()) {
1513 p->error_indicator = 1;
1514 return NULL;
1515 }
1516 goto done;
1517 }
1518 p->mark = mark;
1519 }
1520 { // '-='
1521 void *literal;
1522 if (
1523 (literal = _PyPegen_expect_token(p, 37))
1524 )
1525 {
1526 res = _PyPegen_augoperator ( p , Sub );
1527 if (res == NULL && PyErr_Occurred()) {
1528 p->error_indicator = 1;
1529 return NULL;
1530 }
1531 goto done;
1532 }
1533 p->mark = mark;
1534 }
1535 { // '*='
1536 void *literal;
1537 if (
1538 (literal = _PyPegen_expect_token(p, 38))
1539 )
1540 {
1541 res = _PyPegen_augoperator ( p , Mult );
1542 if (res == NULL && PyErr_Occurred()) {
1543 p->error_indicator = 1;
1544 return NULL;
1545 }
1546 goto done;
1547 }
1548 p->mark = mark;
1549 }
1550 { // '@='
1551 void *literal;
1552 if (
1553 (literal = _PyPegen_expect_token(p, 50))
1554 )
1555 {
1556 res = _PyPegen_augoperator ( p , MatMult );
1557 if (res == NULL && PyErr_Occurred()) {
1558 p->error_indicator = 1;
1559 return NULL;
1560 }
1561 goto done;
1562 }
1563 p->mark = mark;
1564 }
1565 { // '/='
1566 void *literal;
1567 if (
1568 (literal = _PyPegen_expect_token(p, 39))
1569 )
1570 {
1571 res = _PyPegen_augoperator ( p , Div );
1572 if (res == NULL && PyErr_Occurred()) {
1573 p->error_indicator = 1;
1574 return NULL;
1575 }
1576 goto done;
1577 }
1578 p->mark = mark;
1579 }
1580 { // '%='
1581 void *literal;
1582 if (
1583 (literal = _PyPegen_expect_token(p, 40))
1584 )
1585 {
1586 res = _PyPegen_augoperator ( p , Mod );
1587 if (res == NULL && PyErr_Occurred()) {
1588 p->error_indicator = 1;
1589 return NULL;
1590 }
1591 goto done;
1592 }
1593 p->mark = mark;
1594 }
1595 { // '&='
1596 void *literal;
1597 if (
1598 (literal = _PyPegen_expect_token(p, 41))
1599 )
1600 {
1601 res = _PyPegen_augoperator ( p , BitAnd );
1602 if (res == NULL && PyErr_Occurred()) {
1603 p->error_indicator = 1;
1604 return NULL;
1605 }
1606 goto done;
1607 }
1608 p->mark = mark;
1609 }
1610 { // '|='
1611 void *literal;
1612 if (
1613 (literal = _PyPegen_expect_token(p, 42))
1614 )
1615 {
1616 res = _PyPegen_augoperator ( p , BitOr );
1617 if (res == NULL && PyErr_Occurred()) {
1618 p->error_indicator = 1;
1619 return NULL;
1620 }
1621 goto done;
1622 }
1623 p->mark = mark;
1624 }
1625 { // '^='
1626 void *literal;
1627 if (
1628 (literal = _PyPegen_expect_token(p, 43))
1629 )
1630 {
1631 res = _PyPegen_augoperator ( p , BitXor );
1632 if (res == NULL && PyErr_Occurred()) {
1633 p->error_indicator = 1;
1634 return NULL;
1635 }
1636 goto done;
1637 }
1638 p->mark = mark;
1639 }
1640 { // '<<='
1641 void *literal;
1642 if (
1643 (literal = _PyPegen_expect_token(p, 44))
1644 )
1645 {
1646 res = _PyPegen_augoperator ( p , LShift );
1647 if (res == NULL && PyErr_Occurred()) {
1648 p->error_indicator = 1;
1649 return NULL;
1650 }
1651 goto done;
1652 }
1653 p->mark = mark;
1654 }
1655 { // '>>='
1656 void *literal;
1657 if (
1658 (literal = _PyPegen_expect_token(p, 45))
1659 )
1660 {
1661 res = _PyPegen_augoperator ( p , RShift );
1662 if (res == NULL && PyErr_Occurred()) {
1663 p->error_indicator = 1;
1664 return NULL;
1665 }
1666 goto done;
1667 }
1668 p->mark = mark;
1669 }
1670 { // '**='
1671 void *literal;
1672 if (
1673 (literal = _PyPegen_expect_token(p, 46))
1674 )
1675 {
1676 res = _PyPegen_augoperator ( p , Pow );
1677 if (res == NULL && PyErr_Occurred()) {
1678 p->error_indicator = 1;
1679 return NULL;
1680 }
1681 goto done;
1682 }
1683 p->mark = mark;
1684 }
1685 { // '//='
1686 void *literal;
1687 if (
1688 (literal = _PyPegen_expect_token(p, 48))
1689 )
1690 {
1691 res = _PyPegen_augoperator ( p , FloorDiv );
1692 if (res == NULL && PyErr_Occurred()) {
1693 p->error_indicator = 1;
1694 return NULL;
1695 }
1696 goto done;
1697 }
1698 p->mark = mark;
1699 }
1700 res = NULL;
1701 done:
1702 return res;
1703}
1704
1705// global_stmt: 'global' ','.NAME+
1706static stmt_ty
1707global_stmt_rule(Parser *p)
1708{
1709 if (p->error_indicator) {
1710 return NULL;
1711 }
1712 stmt_ty res = NULL;
1713 int mark = p->mark;
1714 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1715 p->error_indicator = 1;
1716 return NULL;
1717 }
1718 int start_lineno = p->tokens[mark]->lineno;
1719 UNUSED(start_lineno); // Only used by EXTRA macro
1720 int start_col_offset = p->tokens[mark]->col_offset;
1721 UNUSED(start_col_offset); // Only used by EXTRA macro
1722 { // 'global' ','.NAME+
1723 asdl_seq * a;
1724 void *keyword;
1725 if (
1726 (keyword = _PyPegen_expect_token(p, 508))
1727 &&
1728 (a = _gather_16_rule(p))
1729 )
1730 {
1731 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1732 if (token == NULL) {
1733 return NULL;
1734 }
1735 int end_lineno = token->end_lineno;
1736 UNUSED(end_lineno); // Only used by EXTRA macro
1737 int end_col_offset = token->end_col_offset;
1738 UNUSED(end_col_offset); // Only used by EXTRA macro
1739 res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
1740 if (res == NULL && PyErr_Occurred()) {
1741 p->error_indicator = 1;
1742 return NULL;
1743 }
1744 goto done;
1745 }
1746 p->mark = mark;
1747 }
1748 res = NULL;
1749 done:
1750 return res;
1751}
1752
1753// nonlocal_stmt: 'nonlocal' ','.NAME+
1754static stmt_ty
1755nonlocal_stmt_rule(Parser *p)
1756{
1757 if (p->error_indicator) {
1758 return NULL;
1759 }
1760 stmt_ty res = NULL;
1761 int mark = p->mark;
1762 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1763 p->error_indicator = 1;
1764 return NULL;
1765 }
1766 int start_lineno = p->tokens[mark]->lineno;
1767 UNUSED(start_lineno); // Only used by EXTRA macro
1768 int start_col_offset = p->tokens[mark]->col_offset;
1769 UNUSED(start_col_offset); // Only used by EXTRA macro
1770 { // 'nonlocal' ','.NAME+
1771 asdl_seq * a;
1772 void *keyword;
1773 if (
1774 (keyword = _PyPegen_expect_token(p, 509))
1775 &&
1776 (a = _gather_18_rule(p))
1777 )
1778 {
1779 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1780 if (token == NULL) {
1781 return NULL;
1782 }
1783 int end_lineno = token->end_lineno;
1784 UNUSED(end_lineno); // Only used by EXTRA macro
1785 int end_col_offset = token->end_col_offset;
1786 UNUSED(end_col_offset); // Only used by EXTRA macro
1787 res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
1788 if (res == NULL && PyErr_Occurred()) {
1789 p->error_indicator = 1;
1790 return NULL;
1791 }
1792 goto done;
1793 }
1794 p->mark = mark;
1795 }
1796 res = NULL;
1797 done:
1798 return res;
1799}
1800
1801// yield_stmt: yield_expr
1802static stmt_ty
1803yield_stmt_rule(Parser *p)
1804{
1805 if (p->error_indicator) {
1806 return NULL;
1807 }
1808 stmt_ty res = NULL;
1809 int mark = p->mark;
1810 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1811 p->error_indicator = 1;
1812 return NULL;
1813 }
1814 int start_lineno = p->tokens[mark]->lineno;
1815 UNUSED(start_lineno); // Only used by EXTRA macro
1816 int start_col_offset = p->tokens[mark]->col_offset;
1817 UNUSED(start_col_offset); // Only used by EXTRA macro
1818 { // yield_expr
1819 expr_ty y;
1820 if (
1821 (y = yield_expr_rule(p))
1822 )
1823 {
1824 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1825 if (token == NULL) {
1826 return NULL;
1827 }
1828 int end_lineno = token->end_lineno;
1829 UNUSED(end_lineno); // Only used by EXTRA macro
1830 int end_col_offset = token->end_col_offset;
1831 UNUSED(end_col_offset); // Only used by EXTRA macro
1832 res = _Py_Expr ( y , EXTRA );
1833 if (res == NULL && PyErr_Occurred()) {
1834 p->error_indicator = 1;
1835 return NULL;
1836 }
1837 goto done;
1838 }
1839 p->mark = mark;
1840 }
1841 res = NULL;
1842 done:
1843 return res;
1844}
1845
1846// assert_stmt: 'assert' expression [',' expression]
1847static stmt_ty
1848assert_stmt_rule(Parser *p)
1849{
1850 if (p->error_indicator) {
1851 return NULL;
1852 }
1853 stmt_ty res = NULL;
1854 int mark = p->mark;
1855 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1856 p->error_indicator = 1;
1857 return NULL;
1858 }
1859 int start_lineno = p->tokens[mark]->lineno;
1860 UNUSED(start_lineno); // Only used by EXTRA macro
1861 int start_col_offset = p->tokens[mark]->col_offset;
1862 UNUSED(start_col_offset); // Only used by EXTRA macro
1863 { // 'assert' expression [',' expression]
1864 expr_ty a;
1865 void *b;
1866 void *keyword;
1867 if (
1868 (keyword = _PyPegen_expect_token(p, 505))
1869 &&
1870 (a = expression_rule(p))
1871 &&
1872 (b = _tmp_20_rule(p), 1)
1873 )
1874 {
1875 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1876 if (token == NULL) {
1877 return NULL;
1878 }
1879 int end_lineno = token->end_lineno;
1880 UNUSED(end_lineno); // Only used by EXTRA macro
1881 int end_col_offset = token->end_col_offset;
1882 UNUSED(end_col_offset); // Only used by EXTRA macro
1883 res = _Py_Assert ( a , b , EXTRA );
1884 if (res == NULL && PyErr_Occurred()) {
1885 p->error_indicator = 1;
1886 return NULL;
1887 }
1888 goto done;
1889 }
1890 p->mark = mark;
1891 }
1892 res = NULL;
1893 done:
1894 return res;
1895}
1896
1897// del_stmt: 'del' del_targets
1898static stmt_ty
1899del_stmt_rule(Parser *p)
1900{
1901 if (p->error_indicator) {
1902 return NULL;
1903 }
1904 stmt_ty res = NULL;
1905 int mark = p->mark;
1906 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1907 p->error_indicator = 1;
1908 return NULL;
1909 }
1910 int start_lineno = p->tokens[mark]->lineno;
1911 UNUSED(start_lineno); // Only used by EXTRA macro
1912 int start_col_offset = p->tokens[mark]->col_offset;
1913 UNUSED(start_col_offset); // Only used by EXTRA macro
1914 { // 'del' del_targets
1915 asdl_seq* a;
1916 void *keyword;
1917 if (
1918 (keyword = _PyPegen_expect_token(p, 503))
1919 &&
1920 (a = del_targets_rule(p))
1921 )
1922 {
1923 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1924 if (token == NULL) {
1925 return NULL;
1926 }
1927 int end_lineno = token->end_lineno;
1928 UNUSED(end_lineno); // Only used by EXTRA macro
1929 int end_col_offset = token->end_col_offset;
1930 UNUSED(end_col_offset); // Only used by EXTRA macro
1931 res = _Py_Delete ( a , EXTRA );
1932 if (res == NULL && PyErr_Occurred()) {
1933 p->error_indicator = 1;
1934 return NULL;
1935 }
1936 goto done;
1937 }
1938 p->mark = mark;
1939 }
1940 res = NULL;
1941 done:
1942 return res;
1943}
1944
1945// import_stmt: import_name | import_from
1946static stmt_ty
1947import_stmt_rule(Parser *p)
1948{
1949 if (p->error_indicator) {
1950 return NULL;
1951 }
1952 stmt_ty res = NULL;
1953 int mark = p->mark;
1954 { // import_name
1955 stmt_ty import_name_var;
1956 if (
1957 (import_name_var = import_name_rule(p))
1958 )
1959 {
1960 res = import_name_var;
1961 goto done;
1962 }
1963 p->mark = mark;
1964 }
1965 { // import_from
1966 stmt_ty import_from_var;
1967 if (
1968 (import_from_var = import_from_rule(p))
1969 )
1970 {
1971 res = import_from_var;
1972 goto done;
1973 }
1974 p->mark = mark;
1975 }
1976 res = NULL;
1977 done:
1978 return res;
1979}
1980
1981// import_name: 'import' dotted_as_names
1982static stmt_ty
1983import_name_rule(Parser *p)
1984{
1985 if (p->error_indicator) {
1986 return NULL;
1987 }
1988 stmt_ty res = NULL;
1989 int mark = p->mark;
1990 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1991 p->error_indicator = 1;
1992 return NULL;
1993 }
1994 int start_lineno = p->tokens[mark]->lineno;
1995 UNUSED(start_lineno); // Only used by EXTRA macro
1996 int start_col_offset = p->tokens[mark]->col_offset;
1997 UNUSED(start_col_offset); // Only used by EXTRA macro
1998 { // 'import' dotted_as_names
1999 asdl_seq* a;
2000 void *keyword;
2001 if (
2002 (keyword = _PyPegen_expect_token(p, 513))
2003 &&
2004 (a = dotted_as_names_rule(p))
2005 )
2006 {
2007 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2008 if (token == NULL) {
2009 return NULL;
2010 }
2011 int end_lineno = token->end_lineno;
2012 UNUSED(end_lineno); // Only used by EXTRA macro
2013 int end_col_offset = token->end_col_offset;
2014 UNUSED(end_col_offset); // Only used by EXTRA macro
2015 res = _Py_Import ( a , EXTRA );
2016 if (res == NULL && PyErr_Occurred()) {
2017 p->error_indicator = 1;
2018 return NULL;
2019 }
2020 goto done;
2021 }
2022 p->mark = mark;
2023 }
2024 res = NULL;
2025 done:
2026 return res;
2027}
2028
2029// import_from:
2030// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
2031// | 'from' (('.' | '...'))+ 'import' import_from_targets
2032static stmt_ty
2033import_from_rule(Parser *p)
2034{
2035 if (p->error_indicator) {
2036 return NULL;
2037 }
2038 stmt_ty res = NULL;
2039 int mark = p->mark;
2040 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2041 p->error_indicator = 1;
2042 return NULL;
2043 }
2044 int start_lineno = p->tokens[mark]->lineno;
2045 UNUSED(start_lineno); // Only used by EXTRA macro
2046 int start_col_offset = p->tokens[mark]->col_offset;
2047 UNUSED(start_col_offset); // Only used by EXTRA macro
2048 { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
2049 asdl_seq * a;
2050 expr_ty b;
2051 asdl_seq* c;
2052 void *keyword;
2053 void *keyword_1;
2054 if (
2055 (keyword = _PyPegen_expect_token(p, 514))
2056 &&
2057 (a = _loop0_21_rule(p))
2058 &&
2059 (b = dotted_name_rule(p))
2060 &&
2061 (keyword_1 = _PyPegen_expect_token(p, 513))
2062 &&
2063 (c = import_from_targets_rule(p))
2064 )
2065 {
2066 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2067 if (token == NULL) {
2068 return NULL;
2069 }
2070 int end_lineno = token->end_lineno;
2071 UNUSED(end_lineno); // Only used by EXTRA macro
2072 int end_col_offset = token->end_col_offset;
2073 UNUSED(end_col_offset); // Only used by EXTRA macro
2074 res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
2075 if (res == NULL && PyErr_Occurred()) {
2076 p->error_indicator = 1;
2077 return NULL;
2078 }
2079 goto done;
2080 }
2081 p->mark = mark;
2082 }
2083 { // 'from' (('.' | '...'))+ 'import' import_from_targets
2084 asdl_seq * a;
2085 asdl_seq* b;
2086 void *keyword;
2087 void *keyword_1;
2088 if (
2089 (keyword = _PyPegen_expect_token(p, 514))
2090 &&
2091 (a = _loop1_22_rule(p))
2092 &&
2093 (keyword_1 = _PyPegen_expect_token(p, 513))
2094 &&
2095 (b = import_from_targets_rule(p))
2096 )
2097 {
2098 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2099 if (token == NULL) {
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 = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
2107 if (res == NULL && PyErr_Occurred()) {
2108 p->error_indicator = 1;
2109 return NULL;
2110 }
2111 goto done;
2112 }
2113 p->mark = mark;
2114 }
2115 res = NULL;
2116 done:
2117 return res;
2118}
2119
2120// import_from_targets: '(' import_from_as_names ','? ')' | import_from_as_names | '*'
2121static asdl_seq*
2122import_from_targets_rule(Parser *p)
2123{
2124 if (p->error_indicator) {
2125 return NULL;
2126 }
2127 asdl_seq* res = NULL;
2128 int mark = p->mark;
2129 { // '(' import_from_as_names ','? ')'
2130 asdl_seq* a;
2131 void *literal;
2132 void *literal_1;
2133 void *opt_var;
2134 UNUSED(opt_var); // Silence compiler warnings
2135 if (
2136 (literal = _PyPegen_expect_token(p, 7))
2137 &&
2138 (a = import_from_as_names_rule(p))
2139 &&
2140 (opt_var = _PyPegen_expect_token(p, 12), 1)
2141 &&
2142 (literal_1 = _PyPegen_expect_token(p, 8))
2143 )
2144 {
2145 res = a;
2146 if (res == NULL && PyErr_Occurred()) {
2147 p->error_indicator = 1;
2148 return NULL;
2149 }
2150 goto done;
2151 }
2152 p->mark = mark;
2153 }
2154 { // import_from_as_names
2155 asdl_seq* import_from_as_names_var;
2156 if (
2157 (import_from_as_names_var = import_from_as_names_rule(p))
2158 )
2159 {
2160 res = import_from_as_names_var;
2161 goto done;
2162 }
2163 p->mark = mark;
2164 }
2165 { // '*'
2166 void *literal;
2167 if (
2168 (literal = _PyPegen_expect_token(p, 16))
2169 )
2170 {
2171 res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
2172 if (res == NULL && PyErr_Occurred()) {
2173 p->error_indicator = 1;
2174 return NULL;
2175 }
2176 goto done;
2177 }
2178 p->mark = mark;
2179 }
2180 res = NULL;
2181 done:
2182 return res;
2183}
2184
2185// import_from_as_names: ','.import_from_as_name+
2186static asdl_seq*
2187import_from_as_names_rule(Parser *p)
2188{
2189 if (p->error_indicator) {
2190 return NULL;
2191 }
2192 asdl_seq* res = NULL;
2193 int mark = p->mark;
2194 { // ','.import_from_as_name+
2195 asdl_seq * a;
2196 if (
2197 (a = _gather_23_rule(p))
2198 )
2199 {
2200 res = a;
2201 if (res == NULL && PyErr_Occurred()) {
2202 p->error_indicator = 1;
2203 return NULL;
2204 }
2205 goto done;
2206 }
2207 p->mark = mark;
2208 }
2209 res = NULL;
2210 done:
2211 return res;
2212}
2213
2214// import_from_as_name: NAME ['as' NAME]
2215static alias_ty
2216import_from_as_name_rule(Parser *p)
2217{
2218 if (p->error_indicator) {
2219 return NULL;
2220 }
2221 alias_ty res = NULL;
2222 int mark = p->mark;
2223 { // NAME ['as' NAME]
2224 expr_ty a;
2225 void *b;
2226 if (
2227 (a = _PyPegen_name_token(p))
2228 &&
2229 (b = _tmp_25_rule(p), 1)
2230 )
2231 {
2232 res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
2233 if (res == NULL && PyErr_Occurred()) {
2234 p->error_indicator = 1;
2235 return NULL;
2236 }
2237 goto done;
2238 }
2239 p->mark = mark;
2240 }
2241 res = NULL;
2242 done:
2243 return res;
2244}
2245
2246// dotted_as_names: ','.dotted_as_name+
2247static asdl_seq*
2248dotted_as_names_rule(Parser *p)
2249{
2250 if (p->error_indicator) {
2251 return NULL;
2252 }
2253 asdl_seq* res = NULL;
2254 int mark = p->mark;
2255 { // ','.dotted_as_name+
2256 asdl_seq * a;
2257 if (
2258 (a = _gather_26_rule(p))
2259 )
2260 {
2261 res = a;
2262 if (res == NULL && PyErr_Occurred()) {
2263 p->error_indicator = 1;
2264 return NULL;
2265 }
2266 goto done;
2267 }
2268 p->mark = mark;
2269 }
2270 res = NULL;
2271 done:
2272 return res;
2273}
2274
2275// dotted_as_name: dotted_name ['as' NAME]
2276static alias_ty
2277dotted_as_name_rule(Parser *p)
2278{
2279 if (p->error_indicator) {
2280 return NULL;
2281 }
2282 alias_ty res = NULL;
2283 int mark = p->mark;
2284 { // dotted_name ['as' NAME]
2285 expr_ty a;
2286 void *b;
2287 if (
2288 (a = dotted_name_rule(p))
2289 &&
2290 (b = _tmp_28_rule(p), 1)
2291 )
2292 {
2293 res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
2294 if (res == NULL && PyErr_Occurred()) {
2295 p->error_indicator = 1;
2296 return NULL;
2297 }
2298 goto done;
2299 }
2300 p->mark = mark;
2301 }
2302 res = NULL;
2303 done:
2304 return res;
2305}
2306
2307// Left-recursive
2308// dotted_name: dotted_name '.' NAME | NAME
2309static expr_ty dotted_name_raw(Parser *);
2310static expr_ty
2311dotted_name_rule(Parser *p)
2312{
2313 expr_ty res = NULL;
2314 if (_PyPegen_is_memoized(p, dotted_name_type, &res))
2315 return res;
2316 int mark = p->mark;
2317 int resmark = p->mark;
2318 while (1) {
2319 int tmpvar_0 = _PyPegen_update_memo(p, mark, dotted_name_type, res);
2320 if (tmpvar_0) {
2321 return res;
2322 }
2323 p->mark = mark;
2324 void *raw = dotted_name_raw(p);
2325 if (raw == NULL || p->mark <= resmark)
2326 break;
2327 resmark = p->mark;
2328 res = raw;
2329 }
2330 p->mark = resmark;
2331 return res;
2332}
2333static expr_ty
2334dotted_name_raw(Parser *p)
2335{
2336 if (p->error_indicator) {
2337 return NULL;
2338 }
2339 expr_ty res = NULL;
2340 int mark = p->mark;
2341 { // dotted_name '.' NAME
2342 expr_ty a;
2343 expr_ty b;
2344 void *literal;
2345 if (
2346 (a = dotted_name_rule(p))
2347 &&
2348 (literal = _PyPegen_expect_token(p, 23))
2349 &&
2350 (b = _PyPegen_name_token(p))
2351 )
2352 {
2353 res = _PyPegen_join_names_with_dot ( p , a , b );
2354 if (res == NULL && PyErr_Occurred()) {
2355 p->error_indicator = 1;
2356 return NULL;
2357 }
2358 goto done;
2359 }
2360 p->mark = mark;
2361 }
2362 { // NAME
2363 expr_ty name_var;
2364 if (
2365 (name_var = _PyPegen_name_token(p))
2366 )
2367 {
2368 res = name_var;
2369 goto done;
2370 }
2371 p->mark = mark;
2372 }
2373 res = NULL;
2374 done:
2375 return res;
2376}
2377
2378// if_stmt:
2379// | 'if' named_expression ':' block elif_stmt
2380// | 'if' named_expression ':' block else_block?
2381static stmt_ty
2382if_stmt_rule(Parser *p)
2383{
2384 if (p->error_indicator) {
2385 return NULL;
2386 }
2387 stmt_ty res = NULL;
2388 int mark = p->mark;
2389 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2390 p->error_indicator = 1;
2391 return NULL;
2392 }
2393 int start_lineno = p->tokens[mark]->lineno;
2394 UNUSED(start_lineno); // Only used by EXTRA macro
2395 int start_col_offset = p->tokens[mark]->col_offset;
2396 UNUSED(start_col_offset); // Only used by EXTRA macro
2397 { // 'if' named_expression ':' block elif_stmt
2398 expr_ty a;
2399 asdl_seq* b;
2400 stmt_ty c;
2401 void *keyword;
2402 void *literal;
2403 if (
2404 (keyword = _PyPegen_expect_token(p, 510))
2405 &&
2406 (a = named_expression_rule(p))
2407 &&
2408 (literal = _PyPegen_expect_token(p, 11))
2409 &&
2410 (b = block_rule(p))
2411 &&
2412 (c = elif_stmt_rule(p))
2413 )
2414 {
2415 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2416 if (token == NULL) {
2417 return NULL;
2418 }
2419 int end_lineno = token->end_lineno;
2420 UNUSED(end_lineno); // Only used by EXTRA macro
2421 int end_col_offset = token->end_col_offset;
2422 UNUSED(end_col_offset); // Only used by EXTRA macro
2423 res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
2424 if (res == NULL && PyErr_Occurred()) {
2425 p->error_indicator = 1;
2426 return NULL;
2427 }
2428 goto done;
2429 }
2430 p->mark = mark;
2431 }
2432 { // 'if' named_expression ':' block else_block?
2433 expr_ty a;
2434 asdl_seq* b;
2435 void *c;
2436 void *keyword;
2437 void *literal;
2438 if (
2439 (keyword = _PyPegen_expect_token(p, 510))
2440 &&
2441 (a = named_expression_rule(p))
2442 &&
2443 (literal = _PyPegen_expect_token(p, 11))
2444 &&
2445 (b = block_rule(p))
2446 &&
2447 (c = else_block_rule(p), 1)
2448 )
2449 {
2450 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2451 if (token == NULL) {
2452 return NULL;
2453 }
2454 int end_lineno = token->end_lineno;
2455 UNUSED(end_lineno); // Only used by EXTRA macro
2456 int end_col_offset = token->end_col_offset;
2457 UNUSED(end_col_offset); // Only used by EXTRA macro
2458 res = _Py_If ( a , b , c , EXTRA );
2459 if (res == NULL && PyErr_Occurred()) {
2460 p->error_indicator = 1;
2461 return NULL;
2462 }
2463 goto done;
2464 }
2465 p->mark = mark;
2466 }
2467 res = NULL;
2468 done:
2469 return res;
2470}
2471
2472// elif_stmt:
2473// | 'elif' named_expression ':' block elif_stmt
2474// | 'elif' named_expression ':' block else_block?
2475static stmt_ty
2476elif_stmt_rule(Parser *p)
2477{
2478 if (p->error_indicator) {
2479 return NULL;
2480 }
2481 stmt_ty res = NULL;
2482 int mark = p->mark;
2483 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2484 p->error_indicator = 1;
2485 return NULL;
2486 }
2487 int start_lineno = p->tokens[mark]->lineno;
2488 UNUSED(start_lineno); // Only used by EXTRA macro
2489 int start_col_offset = p->tokens[mark]->col_offset;
2490 UNUSED(start_col_offset); // Only used by EXTRA macro
2491 { // 'elif' named_expression ':' block elif_stmt
2492 expr_ty a;
2493 asdl_seq* b;
2494 stmt_ty c;
2495 void *keyword;
2496 void *literal;
2497 if (
2498 (keyword = _PyPegen_expect_token(p, 515))
2499 &&
2500 (a = named_expression_rule(p))
2501 &&
2502 (literal = _PyPegen_expect_token(p, 11))
2503 &&
2504 (b = block_rule(p))
2505 &&
2506 (c = elif_stmt_rule(p))
2507 )
2508 {
2509 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2510 if (token == NULL) {
2511 return NULL;
2512 }
2513 int end_lineno = token->end_lineno;
2514 UNUSED(end_lineno); // Only used by EXTRA macro
2515 int end_col_offset = token->end_col_offset;
2516 UNUSED(end_col_offset); // Only used by EXTRA macro
2517 res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
2518 if (res == NULL && PyErr_Occurred()) {
2519 p->error_indicator = 1;
2520 return NULL;
2521 }
2522 goto done;
2523 }
2524 p->mark = mark;
2525 }
2526 { // 'elif' named_expression ':' block else_block?
2527 expr_ty a;
2528 asdl_seq* b;
2529 void *c;
2530 void *keyword;
2531 void *literal;
2532 if (
2533 (keyword = _PyPegen_expect_token(p, 515))
2534 &&
2535 (a = named_expression_rule(p))
2536 &&
2537 (literal = _PyPegen_expect_token(p, 11))
2538 &&
2539 (b = block_rule(p))
2540 &&
2541 (c = else_block_rule(p), 1)
2542 )
2543 {
2544 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2545 if (token == NULL) {
2546 return NULL;
2547 }
2548 int end_lineno = token->end_lineno;
2549 UNUSED(end_lineno); // Only used by EXTRA macro
2550 int end_col_offset = token->end_col_offset;
2551 UNUSED(end_col_offset); // Only used by EXTRA macro
2552 res = _Py_If ( a , b , c , EXTRA );
2553 if (res == NULL && PyErr_Occurred()) {
2554 p->error_indicator = 1;
2555 return NULL;
2556 }
2557 goto done;
2558 }
2559 p->mark = mark;
2560 }
2561 res = NULL;
2562 done:
2563 return res;
2564}
2565
2566// else_block: 'else' ':' block
2567static asdl_seq*
2568else_block_rule(Parser *p)
2569{
2570 if (p->error_indicator) {
2571 return NULL;
2572 }
2573 asdl_seq* res = NULL;
2574 int mark = p->mark;
2575 { // 'else' ':' block
2576 asdl_seq* b;
2577 void *keyword;
2578 void *literal;
2579 if (
2580 (keyword = _PyPegen_expect_token(p, 516))
2581 &&
2582 (literal = _PyPegen_expect_token(p, 11))
2583 &&
2584 (b = block_rule(p))
2585 )
2586 {
2587 res = b;
2588 if (res == NULL && PyErr_Occurred()) {
2589 p->error_indicator = 1;
2590 return NULL;
2591 }
2592 goto done;
2593 }
2594 p->mark = mark;
2595 }
2596 res = NULL;
2597 done:
2598 return res;
2599}
2600
2601// while_stmt: 'while' named_expression ':' block else_block?
2602static stmt_ty
2603while_stmt_rule(Parser *p)
2604{
2605 if (p->error_indicator) {
2606 return NULL;
2607 }
2608 stmt_ty res = NULL;
2609 int mark = p->mark;
2610 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2611 p->error_indicator = 1;
2612 return NULL;
2613 }
2614 int start_lineno = p->tokens[mark]->lineno;
2615 UNUSED(start_lineno); // Only used by EXTRA macro
2616 int start_col_offset = p->tokens[mark]->col_offset;
2617 UNUSED(start_col_offset); // Only used by EXTRA macro
2618 { // 'while' named_expression ':' block else_block?
2619 expr_ty a;
2620 asdl_seq* b;
2621 void *c;
2622 void *keyword;
2623 void *literal;
2624 if (
2625 (keyword = _PyPegen_expect_token(p, 512))
2626 &&
2627 (a = named_expression_rule(p))
2628 &&
2629 (literal = _PyPegen_expect_token(p, 11))
2630 &&
2631 (b = block_rule(p))
2632 &&
2633 (c = else_block_rule(p), 1)
2634 )
2635 {
2636 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2637 if (token == NULL) {
2638 return NULL;
2639 }
2640 int end_lineno = token->end_lineno;
2641 UNUSED(end_lineno); // Only used by EXTRA macro
2642 int end_col_offset = token->end_col_offset;
2643 UNUSED(end_col_offset); // Only used by EXTRA macro
2644 res = _Py_While ( a , b , c , EXTRA );
2645 if (res == NULL && PyErr_Occurred()) {
2646 p->error_indicator = 1;
2647 return NULL;
2648 }
2649 goto done;
2650 }
2651 p->mark = mark;
2652 }
2653 res = NULL;
2654 done:
2655 return res;
2656}
2657
2658// for_stmt: ASYNC? 'for' star_targets 'in' star_expressions ':' block else_block?
2659static stmt_ty
2660for_stmt_rule(Parser *p)
2661{
2662 if (p->error_indicator) {
2663 return NULL;
2664 }
2665 stmt_ty res = NULL;
2666 int mark = p->mark;
2667 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2668 p->error_indicator = 1;
2669 return NULL;
2670 }
2671 int start_lineno = p->tokens[mark]->lineno;
2672 UNUSED(start_lineno); // Only used by EXTRA macro
2673 int start_col_offset = p->tokens[mark]->col_offset;
2674 UNUSED(start_col_offset); // Only used by EXTRA macro
2675 { // ASYNC? 'for' star_targets 'in' star_expressions ':' block else_block?
2676 asdl_seq* b;
2677 void *el;
2678 expr_ty ex;
2679 void *is_async;
2680 void *keyword;
2681 void *keyword_1;
2682 void *literal;
2683 expr_ty t;
2684 if (
2685 (is_async = _PyPegen_async_token(p), 1)
2686 &&
2687 (keyword = _PyPegen_expect_token(p, 517))
2688 &&
2689 (t = star_targets_rule(p))
2690 &&
2691 (keyword_1 = _PyPegen_expect_token(p, 518))
2692 &&
2693 (ex = star_expressions_rule(p))
2694 &&
2695 (literal = _PyPegen_expect_token(p, 11))
2696 &&
2697 (b = block_rule(p))
2698 &&
2699 (el = else_block_rule(p), 1)
2700 )
2701 {
2702 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2703 if (token == NULL) {
2704 return NULL;
2705 }
2706 int end_lineno = token->end_lineno;
2707 UNUSED(end_lineno); // Only used by EXTRA macro
2708 int end_col_offset = token->end_col_offset;
2709 UNUSED(end_col_offset); // Only used by EXTRA macro
2710 res = ( is_async ? _Py_AsyncFor : _Py_For ) ( t , ex , b , el , NULL , EXTRA );
2711 if (res == NULL && PyErr_Occurred()) {
2712 p->error_indicator = 1;
2713 return NULL;
2714 }
2715 goto done;
2716 }
2717 p->mark = mark;
2718 }
2719 res = NULL;
2720 done:
2721 return res;
2722}
2723
2724// with_stmt:
2725// | ASYNC? 'with' '(' ','.with_item+ ')' ':' block
2726// | ASYNC? 'with' ','.with_item+ ':' block
2727static stmt_ty
2728with_stmt_rule(Parser *p)
2729{
2730 if (p->error_indicator) {
2731 return NULL;
2732 }
2733 stmt_ty res = NULL;
2734 int mark = p->mark;
2735 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2736 p->error_indicator = 1;
2737 return NULL;
2738 }
2739 int start_lineno = p->tokens[mark]->lineno;
2740 UNUSED(start_lineno); // Only used by EXTRA macro
2741 int start_col_offset = p->tokens[mark]->col_offset;
2742 UNUSED(start_col_offset); // Only used by EXTRA macro
2743 { // ASYNC? 'with' '(' ','.with_item+ ')' ':' block
2744 asdl_seq * a;
2745 asdl_seq* b;
2746 void *is_async;
2747 void *keyword;
2748 void *literal;
2749 void *literal_1;
2750 void *literal_2;
2751 if (
2752 (is_async = _PyPegen_async_token(p), 1)
2753 &&
2754 (keyword = _PyPegen_expect_token(p, 519))
2755 &&
2756 (literal = _PyPegen_expect_token(p, 7))
2757 &&
2758 (a = _gather_29_rule(p))
2759 &&
2760 (literal_1 = _PyPegen_expect_token(p, 8))
2761 &&
2762 (literal_2 = _PyPegen_expect_token(p, 11))
2763 &&
2764 (b = block_rule(p))
2765 )
2766 {
2767 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2768 if (token == NULL) {
2769 return NULL;
2770 }
2771 int end_lineno = token->end_lineno;
2772 UNUSED(end_lineno); // Only used by EXTRA macro
2773 int end_col_offset = token->end_col_offset;
2774 UNUSED(end_col_offset); // Only used by EXTRA macro
2775 res = ( is_async ? _Py_AsyncWith : _Py_With ) ( a , b , NULL , EXTRA );
2776 if (res == NULL && PyErr_Occurred()) {
2777 p->error_indicator = 1;
2778 return NULL;
2779 }
2780 goto done;
2781 }
2782 p->mark = mark;
2783 }
2784 { // ASYNC? 'with' ','.with_item+ ':' block
2785 asdl_seq * a;
2786 asdl_seq* b;
2787 void *is_async;
2788 void *keyword;
2789 void *literal;
2790 if (
2791 (is_async = _PyPegen_async_token(p), 1)
2792 &&
2793 (keyword = _PyPegen_expect_token(p, 519))
2794 &&
2795 (a = _gather_31_rule(p))
2796 &&
2797 (literal = _PyPegen_expect_token(p, 11))
2798 &&
2799 (b = block_rule(p))
2800 )
2801 {
2802 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2803 if (token == NULL) {
2804 return NULL;
2805 }
2806 int end_lineno = token->end_lineno;
2807 UNUSED(end_lineno); // Only used by EXTRA macro
2808 int end_col_offset = token->end_col_offset;
2809 UNUSED(end_col_offset); // Only used by EXTRA macro
2810 res = ( is_async ? _Py_AsyncWith : _Py_With ) ( a , b , NULL , EXTRA );
2811 if (res == NULL && PyErr_Occurred()) {
2812 p->error_indicator = 1;
2813 return NULL;
2814 }
2815 goto done;
2816 }
2817 p->mark = mark;
2818 }
2819 res = NULL;
2820 done:
2821 return res;
2822}
2823
2824// with_item: expression ['as' target]
2825static withitem_ty
2826with_item_rule(Parser *p)
2827{
2828 if (p->error_indicator) {
2829 return NULL;
2830 }
2831 withitem_ty res = NULL;
2832 int mark = p->mark;
2833 { // expression ['as' target]
2834 expr_ty e;
2835 void *o;
2836 if (
2837 (e = expression_rule(p))
2838 &&
2839 (o = _tmp_33_rule(p), 1)
2840 )
2841 {
2842 res = _Py_withitem ( e , o , p -> arena );
2843 if (res == NULL && PyErr_Occurred()) {
2844 p->error_indicator = 1;
2845 return NULL;
2846 }
2847 goto done;
2848 }
2849 p->mark = mark;
2850 }
2851 res = NULL;
2852 done:
2853 return res;
2854}
2855
2856// try_stmt:
2857// | 'try' ':' block finally_block
2858// | 'try' ':' block except_block+ else_block? finally_block?
2859static stmt_ty
2860try_stmt_rule(Parser *p)
2861{
2862 if (p->error_indicator) {
2863 return NULL;
2864 }
2865 stmt_ty res = NULL;
2866 int mark = p->mark;
2867 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2868 p->error_indicator = 1;
2869 return NULL;
2870 }
2871 int start_lineno = p->tokens[mark]->lineno;
2872 UNUSED(start_lineno); // Only used by EXTRA macro
2873 int start_col_offset = p->tokens[mark]->col_offset;
2874 UNUSED(start_col_offset); // Only used by EXTRA macro
2875 { // 'try' ':' block finally_block
2876 asdl_seq* b;
2877 asdl_seq* f;
2878 void *keyword;
2879 void *literal;
2880 if (
2881 (keyword = _PyPegen_expect_token(p, 511))
2882 &&
2883 (literal = _PyPegen_expect_token(p, 11))
2884 &&
2885 (b = block_rule(p))
2886 &&
2887 (f = finally_block_rule(p))
2888 )
2889 {
2890 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2891 if (token == NULL) {
2892 return NULL;
2893 }
2894 int end_lineno = token->end_lineno;
2895 UNUSED(end_lineno); // Only used by EXTRA macro
2896 int end_col_offset = token->end_col_offset;
2897 UNUSED(end_col_offset); // Only used by EXTRA macro
2898 res = _Py_Try ( b , NULL , NULL , f , EXTRA );
2899 if (res == NULL && PyErr_Occurred()) {
2900 p->error_indicator = 1;
2901 return NULL;
2902 }
2903 goto done;
2904 }
2905 p->mark = mark;
2906 }
2907 { // 'try' ':' block except_block+ else_block? finally_block?
2908 asdl_seq* b;
2909 void *el;
2910 asdl_seq * ex;
2911 void *f;
2912 void *keyword;
2913 void *literal;
2914 if (
2915 (keyword = _PyPegen_expect_token(p, 511))
2916 &&
2917 (literal = _PyPegen_expect_token(p, 11))
2918 &&
2919 (b = block_rule(p))
2920 &&
2921 (ex = _loop1_34_rule(p))
2922 &&
2923 (el = else_block_rule(p), 1)
2924 &&
2925 (f = finally_block_rule(p), 1)
2926 )
2927 {
2928 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2929 if (token == NULL) {
2930 return NULL;
2931 }
2932 int end_lineno = token->end_lineno;
2933 UNUSED(end_lineno); // Only used by EXTRA macro
2934 int end_col_offset = token->end_col_offset;
2935 UNUSED(end_col_offset); // Only used by EXTRA macro
2936 res = _Py_Try ( b , ex , el , f , EXTRA );
2937 if (res == NULL && PyErr_Occurred()) {
2938 p->error_indicator = 1;
2939 return NULL;
2940 }
2941 goto done;
2942 }
2943 p->mark = mark;
2944 }
2945 res = NULL;
2946 done:
2947 return res;
2948}
2949
2950// except_block: 'except' expression ['as' target] ':' block | 'except' ':' block
2951static excepthandler_ty
2952except_block_rule(Parser *p)
2953{
2954 if (p->error_indicator) {
2955 return NULL;
2956 }
2957 excepthandler_ty res = NULL;
2958 int mark = p->mark;
2959 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2960 p->error_indicator = 1;
2961 return NULL;
2962 }
2963 int start_lineno = p->tokens[mark]->lineno;
2964 UNUSED(start_lineno); // Only used by EXTRA macro
2965 int start_col_offset = p->tokens[mark]->col_offset;
2966 UNUSED(start_col_offset); // Only used by EXTRA macro
2967 { // 'except' expression ['as' target] ':' block
2968 asdl_seq* b;
2969 expr_ty e;
2970 void *keyword;
2971 void *literal;
2972 void *t;
2973 if (
2974 (keyword = _PyPegen_expect_token(p, 520))
2975 &&
2976 (e = expression_rule(p))
2977 &&
2978 (t = _tmp_35_rule(p), 1)
2979 &&
2980 (literal = _PyPegen_expect_token(p, 11))
2981 &&
2982 (b = block_rule(p))
2983 )
2984 {
2985 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2986 if (token == NULL) {
2987 return NULL;
2988 }
2989 int end_lineno = token->end_lineno;
2990 UNUSED(end_lineno); // Only used by EXTRA macro
2991 int end_col_offset = token->end_col_offset;
2992 UNUSED(end_col_offset); // Only used by EXTRA macro
2993 res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
2994 if (res == NULL && PyErr_Occurred()) {
2995 p->error_indicator = 1;
2996 return NULL;
2997 }
2998 goto done;
2999 }
3000 p->mark = mark;
3001 }
3002 { // 'except' ':' block
3003 asdl_seq* b;
3004 void *keyword;
3005 void *literal;
3006 if (
3007 (keyword = _PyPegen_expect_token(p, 520))
3008 &&
3009 (literal = _PyPegen_expect_token(p, 11))
3010 &&
3011 (b = block_rule(p))
3012 )
3013 {
3014 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3015 if (token == NULL) {
3016 return NULL;
3017 }
3018 int end_lineno = token->end_lineno;
3019 UNUSED(end_lineno); // Only used by EXTRA macro
3020 int end_col_offset = token->end_col_offset;
3021 UNUSED(end_col_offset); // Only used by EXTRA macro
3022 res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
3023 if (res == NULL && PyErr_Occurred()) {
3024 p->error_indicator = 1;
3025 return NULL;
3026 }
3027 goto done;
3028 }
3029 p->mark = mark;
3030 }
3031 res = NULL;
3032 done:
3033 return res;
3034}
3035
3036// finally_block: 'finally' ':' block
3037static asdl_seq*
3038finally_block_rule(Parser *p)
3039{
3040 if (p->error_indicator) {
3041 return NULL;
3042 }
3043 asdl_seq* res = NULL;
3044 int mark = p->mark;
3045 { // 'finally' ':' block
3046 asdl_seq* a;
3047 void *keyword;
3048 void *literal;
3049 if (
3050 (keyword = _PyPegen_expect_token(p, 521))
3051 &&
3052 (literal = _PyPegen_expect_token(p, 11))
3053 &&
3054 (a = block_rule(p))
3055 )
3056 {
3057 res = a;
3058 if (res == NULL && PyErr_Occurred()) {
3059 p->error_indicator = 1;
3060 return NULL;
3061 }
3062 goto done;
3063 }
3064 p->mark = mark;
3065 }
3066 res = NULL;
3067 done:
3068 return res;
3069}
3070
3071// return_stmt: 'return' star_expressions?
3072static stmt_ty
3073return_stmt_rule(Parser *p)
3074{
3075 if (p->error_indicator) {
3076 return NULL;
3077 }
3078 stmt_ty res = NULL;
3079 int mark = p->mark;
3080 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3081 p->error_indicator = 1;
3082 return NULL;
3083 }
3084 int start_lineno = p->tokens[mark]->lineno;
3085 UNUSED(start_lineno); // Only used by EXTRA macro
3086 int start_col_offset = p->tokens[mark]->col_offset;
3087 UNUSED(start_col_offset); // Only used by EXTRA macro
3088 { // 'return' star_expressions?
3089 void *a;
3090 void *keyword;
3091 if (
3092 (keyword = _PyPegen_expect_token(p, 500))
3093 &&
3094 (a = star_expressions_rule(p), 1)
3095 )
3096 {
3097 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3098 if (token == NULL) {
3099 return NULL;
3100 }
3101 int end_lineno = token->end_lineno;
3102 UNUSED(end_lineno); // Only used by EXTRA macro
3103 int end_col_offset = token->end_col_offset;
3104 UNUSED(end_col_offset); // Only used by EXTRA macro
3105 res = _Py_Return ( a , EXTRA );
3106 if (res == NULL && PyErr_Occurred()) {
3107 p->error_indicator = 1;
3108 return NULL;
3109 }
3110 goto done;
3111 }
3112 p->mark = mark;
3113 }
3114 res = NULL;
3115 done:
3116 return res;
3117}
3118
3119// raise_stmt: 'raise' expression ['from' expression] | 'raise'
3120static stmt_ty
3121raise_stmt_rule(Parser *p)
3122{
3123 if (p->error_indicator) {
3124 return NULL;
3125 }
3126 stmt_ty res = NULL;
3127 int mark = p->mark;
3128 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3129 p->error_indicator = 1;
3130 return NULL;
3131 }
3132 int start_lineno = p->tokens[mark]->lineno;
3133 UNUSED(start_lineno); // Only used by EXTRA macro
3134 int start_col_offset = p->tokens[mark]->col_offset;
3135 UNUSED(start_col_offset); // Only used by EXTRA macro
3136 { // 'raise' expression ['from' expression]
3137 expr_ty a;
3138 void *b;
3139 void *keyword;
3140 if (
3141 (keyword = _PyPegen_expect_token(p, 501))
3142 &&
3143 (a = expression_rule(p))
3144 &&
3145 (b = _tmp_36_rule(p), 1)
3146 )
3147 {
3148 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3149 if (token == NULL) {
3150 return NULL;
3151 }
3152 int end_lineno = token->end_lineno;
3153 UNUSED(end_lineno); // Only used by EXTRA macro
3154 int end_col_offset = token->end_col_offset;
3155 UNUSED(end_col_offset); // Only used by EXTRA macro
3156 res = _Py_Raise ( a , b , EXTRA );
3157 if (res == NULL && PyErr_Occurred()) {
3158 p->error_indicator = 1;
3159 return NULL;
3160 }
3161 goto done;
3162 }
3163 p->mark = mark;
3164 }
3165 { // 'raise'
3166 void *keyword;
3167 if (
3168 (keyword = _PyPegen_expect_token(p, 501))
3169 )
3170 {
3171 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3172 if (token == NULL) {
3173 return NULL;
3174 }
3175 int end_lineno = token->end_lineno;
3176 UNUSED(end_lineno); // Only used by EXTRA macro
3177 int end_col_offset = token->end_col_offset;
3178 UNUSED(end_col_offset); // Only used by EXTRA macro
3179 res = _Py_Raise ( NULL , NULL , EXTRA );
3180 if (res == NULL && PyErr_Occurred()) {
3181 p->error_indicator = 1;
3182 return NULL;
3183 }
3184 goto done;
3185 }
3186 p->mark = mark;
3187 }
3188 res = NULL;
3189 done:
3190 return res;
3191}
3192
3193// function_def: decorators function_def_raw | function_def_raw
3194static stmt_ty
3195function_def_rule(Parser *p)
3196{
3197 if (p->error_indicator) {
3198 return NULL;
3199 }
3200 stmt_ty res = NULL;
3201 int mark = p->mark;
3202 { // decorators function_def_raw
3203 asdl_seq* d;
3204 stmt_ty f;
3205 if (
3206 (d = decorators_rule(p))
3207 &&
3208 (f = function_def_raw_rule(p))
3209 )
3210 {
3211 res = _PyPegen_function_def_decorators ( p , d , f );
3212 if (res == NULL && PyErr_Occurred()) {
3213 p->error_indicator = 1;
3214 return NULL;
3215 }
3216 goto done;
3217 }
3218 p->mark = mark;
3219 }
3220 { // function_def_raw
3221 stmt_ty function_def_raw_var;
3222 if (
3223 (function_def_raw_var = function_def_raw_rule(p))
3224 )
3225 {
3226 res = function_def_raw_var;
3227 goto done;
3228 }
3229 p->mark = mark;
3230 }
3231 res = NULL;
3232 done:
3233 return res;
3234}
3235
3236// function_def_raw: ASYNC? 'def' NAME '(' params? ')' ['->' annotation] ':' block
3237static stmt_ty
3238function_def_raw_rule(Parser *p)
3239{
3240 if (p->error_indicator) {
3241 return NULL;
3242 }
3243 stmt_ty res = NULL;
3244 int mark = p->mark;
3245 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3246 p->error_indicator = 1;
3247 return NULL;
3248 }
3249 int start_lineno = p->tokens[mark]->lineno;
3250 UNUSED(start_lineno); // Only used by EXTRA macro
3251 int start_col_offset = p->tokens[mark]->col_offset;
3252 UNUSED(start_col_offset); // Only used by EXTRA macro
3253 { // ASYNC? 'def' NAME '(' params? ')' ['->' annotation] ':' block
3254 void *a;
3255 asdl_seq* b;
3256 void *is_async;
3257 void *keyword;
3258 void *literal;
3259 void *literal_1;
3260 void *literal_2;
3261 expr_ty n;
3262 void *params;
3263 if (
3264 (is_async = _PyPegen_async_token(p), 1)
3265 &&
3266 (keyword = _PyPegen_expect_token(p, 522))
3267 &&
3268 (n = _PyPegen_name_token(p))
3269 &&
3270 (literal = _PyPegen_expect_token(p, 7))
3271 &&
3272 (params = params_rule(p), 1)
3273 &&
3274 (literal_1 = _PyPegen_expect_token(p, 8))
3275 &&
3276 (a = _tmp_37_rule(p), 1)
3277 &&
3278 (literal_2 = _PyPegen_expect_token(p, 11))
3279 &&
3280 (b = block_rule(p))
3281 )
3282 {
3283 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3284 if (token == NULL) {
3285 return NULL;
3286 }
3287 int end_lineno = token->end_lineno;
3288 UNUSED(end_lineno); // Only used by EXTRA macro
3289 int end_col_offset = token->end_col_offset;
3290 UNUSED(end_col_offset); // Only used by EXTRA macro
3291 res = ( is_async ? _Py_AsyncFunctionDef : _Py_FunctionDef ) ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NULL , EXTRA );
3292 if (res == NULL && PyErr_Occurred()) {
3293 p->error_indicator = 1;
3294 return NULL;
3295 }
3296 goto done;
3297 }
3298 p->mark = mark;
3299 }
3300 res = NULL;
3301 done:
3302 return res;
3303}
3304
3305// params: invalid_parameters | parameters
3306static arguments_ty
3307params_rule(Parser *p)
3308{
3309 if (p->error_indicator) {
3310 return NULL;
3311 }
3312 arguments_ty res = NULL;
3313 int mark = p->mark;
3314 { // invalid_parameters
3315 void *invalid_parameters_var;
3316 if (
3317 (invalid_parameters_var = invalid_parameters_rule(p))
3318 )
3319 {
3320 res = invalid_parameters_var;
3321 goto done;
3322 }
3323 p->mark = mark;
3324 }
3325 { // parameters
3326 arguments_ty parameters_var;
3327 if (
3328 (parameters_var = parameters_rule(p))
3329 )
3330 {
3331 res = parameters_var;
3332 goto done;
3333 }
3334 p->mark = mark;
3335 }
3336 res = NULL;
3337 done:
3338 return res;
3339}
3340
3341// parameters:
3342// | slash_without_default [',' plain_names] [',' names_with_default] [',' star_etc?]
3343// | slash_with_default [',' names_with_default] [',' star_etc?]
3344// | plain_names [',' names_with_default] [',' star_etc?]
3345// | names_with_default [',' star_etc?]
3346// | star_etc
3347static arguments_ty
3348parameters_rule(Parser *p)
3349{
3350 if (p->error_indicator) {
3351 return NULL;
3352 }
3353 arguments_ty res = NULL;
3354 int mark = p->mark;
3355 { // slash_without_default [',' plain_names] [',' names_with_default] [',' star_etc?]
3356 asdl_seq* a;
3357 void *b;
3358 void *c;
3359 void *d;
3360 if (
3361 (a = slash_without_default_rule(p))
3362 &&
3363 (b = _tmp_38_rule(p), 1)
3364 &&
3365 (c = _tmp_39_rule(p), 1)
3366 &&
3367 (d = _tmp_40_rule(p), 1)
3368 )
3369 {
3370 res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
3371 if (res == NULL && PyErr_Occurred()) {
3372 p->error_indicator = 1;
3373 return NULL;
3374 }
3375 goto done;
3376 }
3377 p->mark = mark;
3378 }
3379 { // slash_with_default [',' names_with_default] [',' star_etc?]
3380 SlashWithDefault* a;
3381 void *b;
3382 void *c;
3383 if (
3384 (a = slash_with_default_rule(p))
3385 &&
3386 (b = _tmp_41_rule(p), 1)
3387 &&
3388 (c = _tmp_42_rule(p), 1)
3389 )
3390 {
3391 res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
3392 if (res == NULL && PyErr_Occurred()) {
3393 p->error_indicator = 1;
3394 return NULL;
3395 }
3396 goto done;
3397 }
3398 p->mark = mark;
3399 }
3400 { // plain_names [',' names_with_default] [',' star_etc?]
3401 asdl_seq* a;
3402 void *b;
3403 void *c;
3404 if (
3405 (a = plain_names_rule(p))
3406 &&
3407 (b = _tmp_43_rule(p), 1)
3408 &&
3409 (c = _tmp_44_rule(p), 1)
3410 )
3411 {
3412 res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
3413 if (res == NULL && PyErr_Occurred()) {
3414 p->error_indicator = 1;
3415 return NULL;
3416 }
3417 goto done;
3418 }
3419 p->mark = mark;
3420 }
3421 { // names_with_default [',' star_etc?]
3422 asdl_seq* a;
3423 void *b;
3424 if (
3425 (a = names_with_default_rule(p))
3426 &&
3427 (b = _tmp_45_rule(p), 1)
3428 )
3429 {
3430 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
3431 if (res == NULL && PyErr_Occurred()) {
3432 p->error_indicator = 1;
3433 return NULL;
3434 }
3435 goto done;
3436 }
3437 p->mark = mark;
3438 }
3439 { // star_etc
3440 StarEtc* a;
3441 if (
3442 (a = star_etc_rule(p))
3443 )
3444 {
3445 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
3446 if (res == NULL && PyErr_Occurred()) {
3447 p->error_indicator = 1;
3448 return NULL;
3449 }
3450 goto done;
3451 }
3452 p->mark = mark;
3453 }
3454 res = NULL;
3455 done:
3456 return res;
3457}
3458
3459// slash_without_default: plain_names ',' '/'
3460static asdl_seq*
3461slash_without_default_rule(Parser *p)
3462{
3463 if (p->error_indicator) {
3464 return NULL;
3465 }
3466 asdl_seq* res = NULL;
3467 int mark = p->mark;
3468 { // plain_names ',' '/'
3469 asdl_seq* a;
3470 void *literal;
3471 void *literal_1;
3472 if (
3473 (a = plain_names_rule(p))
3474 &&
3475 (literal = _PyPegen_expect_token(p, 12))
3476 &&
3477 (literal_1 = _PyPegen_expect_token(p, 17))
3478 )
3479 {
3480 res = a;
3481 if (res == NULL && PyErr_Occurred()) {
3482 p->error_indicator = 1;
3483 return NULL;
3484 }
3485 goto done;
3486 }
3487 p->mark = mark;
3488 }
3489 res = NULL;
3490 done:
3491 return res;
3492}
3493
3494// slash_with_default: [plain_names ','] names_with_default ',' '/'
3495static SlashWithDefault*
3496slash_with_default_rule(Parser *p)
3497{
3498 if (p->error_indicator) {
3499 return NULL;
3500 }
3501 SlashWithDefault* res = NULL;
3502 int mark = p->mark;
3503 { // [plain_names ','] names_with_default ',' '/'
3504 void *a;
3505 asdl_seq* b;
3506 void *literal;
3507 void *literal_1;
3508 if (
3509 (a = _tmp_46_rule(p), 1)
3510 &&
3511 (b = names_with_default_rule(p))
3512 &&
3513 (literal = _PyPegen_expect_token(p, 12))
3514 &&
3515 (literal_1 = _PyPegen_expect_token(p, 17))
3516 )
3517 {
3518 res = _PyPegen_slash_with_default ( p , a , b );
3519 if (res == NULL && PyErr_Occurred()) {
3520 p->error_indicator = 1;
3521 return NULL;
3522 }
3523 goto done;
3524 }
3525 p->mark = mark;
3526 }
3527 res = NULL;
3528 done:
3529 return res;
3530}
3531
3532// star_etc:
3533// | '*' plain_name name_with_optional_default* [',' kwds] ','?
3534// | '*' name_with_optional_default+ [',' kwds] ','?
3535// | kwds ','?
3536static StarEtc*
3537star_etc_rule(Parser *p)
3538{
3539 if (p->error_indicator) {
3540 return NULL;
3541 }
3542 StarEtc* res = NULL;
3543 int mark = p->mark;
3544 { // '*' plain_name name_with_optional_default* [',' kwds] ','?
3545 arg_ty a;
3546 asdl_seq * b;
3547 void *c;
3548 void *literal;
3549 void *opt_var;
3550 UNUSED(opt_var); // Silence compiler warnings
3551 if (
3552 (literal = _PyPegen_expect_token(p, 16))
3553 &&
3554 (a = plain_name_rule(p))
3555 &&
3556 (b = _loop0_47_rule(p))
3557 &&
3558 (c = _tmp_48_rule(p), 1)
3559 &&
3560 (opt_var = _PyPegen_expect_token(p, 12), 1)
3561 )
3562 {
3563 res = _PyPegen_star_etc ( p , a , b , c );
3564 if (res == NULL && PyErr_Occurred()) {
3565 p->error_indicator = 1;
3566 return NULL;
3567 }
3568 goto done;
3569 }
3570 p->mark = mark;
3571 }
3572 { // '*' name_with_optional_default+ [',' kwds] ','?
3573 asdl_seq * b;
3574 void *c;
3575 void *literal;
3576 void *opt_var;
3577 UNUSED(opt_var); // Silence compiler warnings
3578 if (
3579 (literal = _PyPegen_expect_token(p, 16))
3580 &&
3581 (b = _loop1_49_rule(p))
3582 &&
3583 (c = _tmp_50_rule(p), 1)
3584 &&
3585 (opt_var = _PyPegen_expect_token(p, 12), 1)
3586 )
3587 {
3588 res = _PyPegen_star_etc ( p , NULL , b , c );
3589 if (res == NULL && PyErr_Occurred()) {
3590 p->error_indicator = 1;
3591 return NULL;
3592 }
3593 goto done;
3594 }
3595 p->mark = mark;
3596 }
3597 { // kwds ','?
3598 arg_ty a;
3599 void *opt_var;
3600 UNUSED(opt_var); // Silence compiler warnings
3601 if (
3602 (a = kwds_rule(p))
3603 &&
3604 (opt_var = _PyPegen_expect_token(p, 12), 1)
3605 )
3606 {
3607 res = _PyPegen_star_etc ( p , NULL , NULL , a );
3608 if (res == NULL && PyErr_Occurred()) {
3609 p->error_indicator = 1;
3610 return NULL;
3611 }
3612 goto done;
3613 }
3614 p->mark = mark;
3615 }
3616 res = NULL;
3617 done:
3618 return res;
3619}
3620
3621// name_with_optional_default: ',' plain_name ['=' expression]
3622static NameDefaultPair*
3623name_with_optional_default_rule(Parser *p)
3624{
3625 if (p->error_indicator) {
3626 return NULL;
3627 }
3628 NameDefaultPair* res = NULL;
3629 int mark = p->mark;
3630 { // ',' plain_name ['=' expression]
3631 arg_ty a;
3632 void *b;
3633 void *literal;
3634 if (
3635 (literal = _PyPegen_expect_token(p, 12))
3636 &&
3637 (a = plain_name_rule(p))
3638 &&
3639 (b = _tmp_51_rule(p), 1)
3640 )
3641 {
3642 res = _PyPegen_name_default_pair ( p , a , b );
3643 if (res == NULL && PyErr_Occurred()) {
3644 p->error_indicator = 1;
3645 return NULL;
3646 }
3647 goto done;
3648 }
3649 p->mark = mark;
3650 }
3651 res = NULL;
3652 done:
3653 return res;
3654}
3655
3656// names_with_default: ','.name_with_default+
3657static asdl_seq*
3658names_with_default_rule(Parser *p)
3659{
3660 if (p->error_indicator) {
3661 return NULL;
3662 }
3663 asdl_seq* res = NULL;
3664 int mark = p->mark;
3665 { // ','.name_with_default+
3666 asdl_seq * a;
3667 if (
3668 (a = _gather_52_rule(p))
3669 )
3670 {
3671 res = a;
3672 if (res == NULL && PyErr_Occurred()) {
3673 p->error_indicator = 1;
3674 return NULL;
3675 }
3676 goto done;
3677 }
3678 p->mark = mark;
3679 }
3680 res = NULL;
3681 done:
3682 return res;
3683}
3684
3685// name_with_default: plain_name '=' expression
3686static NameDefaultPair*
3687name_with_default_rule(Parser *p)
3688{
3689 if (p->error_indicator) {
3690 return NULL;
3691 }
3692 NameDefaultPair* res = NULL;
3693 int mark = p->mark;
3694 { // plain_name '=' expression
3695 expr_ty e;
3696 void *literal;
3697 arg_ty n;
3698 if (
3699 (n = plain_name_rule(p))
3700 &&
3701 (literal = _PyPegen_expect_token(p, 22))
3702 &&
3703 (e = expression_rule(p))
3704 )
3705 {
3706 res = _PyPegen_name_default_pair ( p , n , e );
3707 if (res == NULL && PyErr_Occurred()) {
3708 p->error_indicator = 1;
3709 return NULL;
3710 }
3711 goto done;
3712 }
3713 p->mark = mark;
3714 }
3715 res = NULL;
3716 done:
3717 return res;
3718}
3719
3720// plain_names: ','.(plain_name !'=')+
3721static asdl_seq*
3722plain_names_rule(Parser *p)
3723{
3724 if (p->error_indicator) {
3725 return NULL;
3726 }
3727 asdl_seq* res = NULL;
3728 if (_PyPegen_is_memoized(p, plain_names_type, &res))
3729 return res;
3730 int mark = p->mark;
3731 { // ','.(plain_name !'=')+
3732 asdl_seq * a;
3733 if (
3734 (a = _gather_54_rule(p))
3735 )
3736 {
3737 res = a;
3738 if (res == NULL && PyErr_Occurred()) {
3739 p->error_indicator = 1;
3740 return NULL;
3741 }
3742 goto done;
3743 }
3744 p->mark = mark;
3745 }
3746 res = NULL;
3747 done:
3748 _PyPegen_insert_memo(p, mark, plain_names_type, res);
3749 return res;
3750}
3751
3752// plain_name: NAME [':' annotation]
3753static arg_ty
3754plain_name_rule(Parser *p)
3755{
3756 if (p->error_indicator) {
3757 return NULL;
3758 }
3759 arg_ty res = NULL;
3760 int mark = p->mark;
3761 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3762 p->error_indicator = 1;
3763 return NULL;
3764 }
3765 int start_lineno = p->tokens[mark]->lineno;
3766 UNUSED(start_lineno); // Only used by EXTRA macro
3767 int start_col_offset = p->tokens[mark]->col_offset;
3768 UNUSED(start_col_offset); // Only used by EXTRA macro
3769 { // NAME [':' annotation]
3770 expr_ty a;
3771 void *b;
3772 if (
3773 (a = _PyPegen_name_token(p))
3774 &&
3775 (b = _tmp_56_rule(p), 1)
3776 )
3777 {
3778 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3779 if (token == NULL) {
3780 return NULL;
3781 }
3782 int end_lineno = token->end_lineno;
3783 UNUSED(end_lineno); // Only used by EXTRA macro
3784 int end_col_offset = token->end_col_offset;
3785 UNUSED(end_col_offset); // Only used by EXTRA macro
3786 res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
3787 if (res == NULL && PyErr_Occurred()) {
3788 p->error_indicator = 1;
3789 return NULL;
3790 }
3791 goto done;
3792 }
3793 p->mark = mark;
3794 }
3795 res = NULL;
3796 done:
3797 return res;
3798}
3799
3800// kwds: '**' plain_name
3801static arg_ty
3802kwds_rule(Parser *p)
3803{
3804 if (p->error_indicator) {
3805 return NULL;
3806 }
3807 arg_ty res = NULL;
3808 int mark = p->mark;
3809 { // '**' plain_name
3810 arg_ty a;
3811 void *literal;
3812 if (
3813 (literal = _PyPegen_expect_token(p, 35))
3814 &&
3815 (a = plain_name_rule(p))
3816 )
3817 {
3818 res = a;
3819 if (res == NULL && PyErr_Occurred()) {
3820 p->error_indicator = 1;
3821 return NULL;
3822 }
3823 goto done;
3824 }
3825 p->mark = mark;
3826 }
3827 res = NULL;
3828 done:
3829 return res;
3830}
3831
3832// annotation: expression
3833static expr_ty
3834annotation_rule(Parser *p)
3835{
3836 if (p->error_indicator) {
3837 return NULL;
3838 }
3839 expr_ty res = NULL;
3840 int mark = p->mark;
3841 { // expression
3842 expr_ty expression_var;
3843 if (
3844 (expression_var = expression_rule(p))
3845 )
3846 {
3847 res = expression_var;
3848 goto done;
3849 }
3850 p->mark = mark;
3851 }
3852 res = NULL;
3853 done:
3854 return res;
3855}
3856
3857// decorators: (('@' named_expression NEWLINE))+
3858static asdl_seq*
3859decorators_rule(Parser *p)
3860{
3861 if (p->error_indicator) {
3862 return NULL;
3863 }
3864 asdl_seq* res = NULL;
3865 int mark = p->mark;
3866 { // (('@' named_expression NEWLINE))+
3867 asdl_seq * a;
3868 if (
3869 (a = _loop1_57_rule(p))
3870 )
3871 {
3872 res = a;
3873 if (res == NULL && PyErr_Occurred()) {
3874 p->error_indicator = 1;
3875 return NULL;
3876 }
3877 goto done;
3878 }
3879 p->mark = mark;
3880 }
3881 res = NULL;
3882 done:
3883 return res;
3884}
3885
3886// class_def: decorators class_def_raw | class_def_raw
3887static stmt_ty
3888class_def_rule(Parser *p)
3889{
3890 if (p->error_indicator) {
3891 return NULL;
3892 }
3893 stmt_ty res = NULL;
3894 int mark = p->mark;
3895 { // decorators class_def_raw
3896 asdl_seq* a;
3897 stmt_ty b;
3898 if (
3899 (a = decorators_rule(p))
3900 &&
3901 (b = class_def_raw_rule(p))
3902 )
3903 {
3904 res = _PyPegen_class_def_decorators ( p , a , b );
3905 if (res == NULL && PyErr_Occurred()) {
3906 p->error_indicator = 1;
3907 return NULL;
3908 }
3909 goto done;
3910 }
3911 p->mark = mark;
3912 }
3913 { // class_def_raw
3914 stmt_ty class_def_raw_var;
3915 if (
3916 (class_def_raw_var = class_def_raw_rule(p))
3917 )
3918 {
3919 res = class_def_raw_var;
3920 goto done;
3921 }
3922 p->mark = mark;
3923 }
3924 res = NULL;
3925 done:
3926 return res;
3927}
3928
3929// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
3930static stmt_ty
3931class_def_raw_rule(Parser *p)
3932{
3933 if (p->error_indicator) {
3934 return NULL;
3935 }
3936 stmt_ty res = NULL;
3937 int mark = p->mark;
3938 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3939 p->error_indicator = 1;
3940 return NULL;
3941 }
3942 int start_lineno = p->tokens[mark]->lineno;
3943 UNUSED(start_lineno); // Only used by EXTRA macro
3944 int start_col_offset = p->tokens[mark]->col_offset;
3945 UNUSED(start_col_offset); // Only used by EXTRA macro
3946 { // 'class' NAME ['(' arguments? ')'] ':' block
3947 expr_ty a;
3948 void *b;
3949 asdl_seq* c;
3950 void *keyword;
3951 void *literal;
3952 if (
3953 (keyword = _PyPegen_expect_token(p, 523))
3954 &&
3955 (a = _PyPegen_name_token(p))
3956 &&
3957 (b = _tmp_58_rule(p), 1)
3958 &&
3959 (literal = _PyPegen_expect_token(p, 11))
3960 &&
3961 (c = block_rule(p))
3962 )
3963 {
3964 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3965 if (token == NULL) {
3966 return NULL;
3967 }
3968 int end_lineno = token->end_lineno;
3969 UNUSED(end_lineno); // Only used by EXTRA macro
3970 int end_col_offset = token->end_col_offset;
3971 UNUSED(end_col_offset); // Only used by EXTRA macro
3972 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 );
3973 if (res == NULL && PyErr_Occurred()) {
3974 p->error_indicator = 1;
3975 return NULL;
3976 }
3977 goto done;
3978 }
3979 p->mark = mark;
3980 }
3981 res = NULL;
3982 done:
3983 return res;
3984}
3985
3986// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
3987static asdl_seq*
3988block_rule(Parser *p)
3989{
3990 if (p->error_indicator) {
3991 return NULL;
3992 }
3993 asdl_seq* res = NULL;
3994 if (_PyPegen_is_memoized(p, block_type, &res))
3995 return res;
3996 int mark = p->mark;
3997 { // NEWLINE INDENT statements DEDENT
3998 asdl_seq* a;
3999 void *dedent_var;
4000 void *indent_var;
4001 void *newline_var;
4002 if (
4003 (newline_var = _PyPegen_newline_token(p))
4004 &&
4005 (indent_var = _PyPegen_indent_token(p))
4006 &&
4007 (a = statements_rule(p))
4008 &&
4009 (dedent_var = _PyPegen_dedent_token(p))
4010 )
4011 {
4012 res = a;
4013 if (res == NULL && PyErr_Occurred()) {
4014 p->error_indicator = 1;
4015 return NULL;
4016 }
4017 goto done;
4018 }
4019 p->mark = mark;
4020 }
4021 { // simple_stmt
4022 asdl_seq* simple_stmt_var;
4023 if (
4024 (simple_stmt_var = simple_stmt_rule(p))
4025 )
4026 {
4027 res = simple_stmt_var;
4028 goto done;
4029 }
4030 p->mark = mark;
4031 }
4032 { // invalid_block
4033 void *invalid_block_var;
4034 if (
4035 (invalid_block_var = invalid_block_rule(p))
4036 )
4037 {
4038 res = invalid_block_var;
4039 goto done;
4040 }
4041 p->mark = mark;
4042 }
4043 res = NULL;
4044 done:
4045 _PyPegen_insert_memo(p, mark, block_type, res);
4046 return res;
4047}
4048
4049// expressions_list: ','.star_expression+ ','?
4050static asdl_seq*
4051expressions_list_rule(Parser *p)
4052{
4053 if (p->error_indicator) {
4054 return NULL;
4055 }
4056 asdl_seq* res = NULL;
4057 int mark = p->mark;
4058 { // ','.star_expression+ ','?
4059 asdl_seq * a;
4060 void *opt_var;
4061 UNUSED(opt_var); // Silence compiler warnings
4062 if (
4063 (a = _gather_59_rule(p))
4064 &&
4065 (opt_var = _PyPegen_expect_token(p, 12), 1)
4066 )
4067 {
4068 res = a;
4069 if (res == NULL && PyErr_Occurred()) {
4070 p->error_indicator = 1;
4071 return NULL;
4072 }
4073 goto done;
4074 }
4075 p->mark = mark;
4076 }
4077 res = NULL;
4078 done:
4079 return res;
4080}
4081
4082// star_expressions:
4083// | star_expression ((',' star_expression))+ ','?
4084// | star_expression ','
4085// | star_expression
4086static expr_ty
4087star_expressions_rule(Parser *p)
4088{
4089 if (p->error_indicator) {
4090 return NULL;
4091 }
4092 expr_ty res = NULL;
4093 int mark = p->mark;
4094 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4095 p->error_indicator = 1;
4096 return NULL;
4097 }
4098 int start_lineno = p->tokens[mark]->lineno;
4099 UNUSED(start_lineno); // Only used by EXTRA macro
4100 int start_col_offset = p->tokens[mark]->col_offset;
4101 UNUSED(start_col_offset); // Only used by EXTRA macro
4102 { // star_expression ((',' star_expression))+ ','?
4103 expr_ty a;
4104 asdl_seq * b;
4105 void *opt_var;
4106 UNUSED(opt_var); // Silence compiler warnings
4107 if (
4108 (a = star_expression_rule(p))
4109 &&
4110 (b = _loop1_61_rule(p))
4111 &&
4112 (opt_var = _PyPegen_expect_token(p, 12), 1)
4113 )
4114 {
4115 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4116 if (token == NULL) {
4117 return NULL;
4118 }
4119 int end_lineno = token->end_lineno;
4120 UNUSED(end_lineno); // Only used by EXTRA macro
4121 int end_col_offset = token->end_col_offset;
4122 UNUSED(end_col_offset); // Only used by EXTRA macro
4123 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
4124 if (res == NULL && PyErr_Occurred()) {
4125 p->error_indicator = 1;
4126 return NULL;
4127 }
4128 goto done;
4129 }
4130 p->mark = mark;
4131 }
4132 { // star_expression ','
4133 expr_ty a;
4134 void *literal;
4135 if (
4136 (a = star_expression_rule(p))
4137 &&
4138 (literal = _PyPegen_expect_token(p, 12))
4139 )
4140 {
4141 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4142 if (token == NULL) {
4143 return NULL;
4144 }
4145 int end_lineno = token->end_lineno;
4146 UNUSED(end_lineno); // Only used by EXTRA macro
4147 int end_col_offset = token->end_col_offset;
4148 UNUSED(end_col_offset); // Only used by EXTRA macro
4149 res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
4150 if (res == NULL && PyErr_Occurred()) {
4151 p->error_indicator = 1;
4152 return NULL;
4153 }
4154 goto done;
4155 }
4156 p->mark = mark;
4157 }
4158 { // star_expression
4159 expr_ty star_expression_var;
4160 if (
4161 (star_expression_var = star_expression_rule(p))
4162 )
4163 {
4164 res = star_expression_var;
4165 goto done;
4166 }
4167 p->mark = mark;
4168 }
4169 res = NULL;
4170 done:
4171 return res;
4172}
4173
4174// star_expression: '*' bitwise_or | expression
4175static expr_ty
4176star_expression_rule(Parser *p)
4177{
4178 if (p->error_indicator) {
4179 return NULL;
4180 }
4181 expr_ty res = NULL;
4182 if (_PyPegen_is_memoized(p, star_expression_type, &res))
4183 return res;
4184 int mark = p->mark;
4185 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4186 p->error_indicator = 1;
4187 return NULL;
4188 }
4189 int start_lineno = p->tokens[mark]->lineno;
4190 UNUSED(start_lineno); // Only used by EXTRA macro
4191 int start_col_offset = p->tokens[mark]->col_offset;
4192 UNUSED(start_col_offset); // Only used by EXTRA macro
4193 { // '*' bitwise_or
4194 expr_ty a;
4195 void *literal;
4196 if (
4197 (literal = _PyPegen_expect_token(p, 16))
4198 &&
4199 (a = bitwise_or_rule(p))
4200 )
4201 {
4202 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4203 if (token == NULL) {
4204 return NULL;
4205 }
4206 int end_lineno = token->end_lineno;
4207 UNUSED(end_lineno); // Only used by EXTRA macro
4208 int end_col_offset = token->end_col_offset;
4209 UNUSED(end_col_offset); // Only used by EXTRA macro
4210 res = _Py_Starred ( a , Load , EXTRA );
4211 if (res == NULL && PyErr_Occurred()) {
4212 p->error_indicator = 1;
4213 return NULL;
4214 }
4215 goto done;
4216 }
4217 p->mark = mark;
4218 }
4219 { // expression
4220 expr_ty expression_var;
4221 if (
4222 (expression_var = expression_rule(p))
4223 )
4224 {
4225 res = expression_var;
4226 goto done;
4227 }
4228 p->mark = mark;
4229 }
4230 res = NULL;
4231 done:
4232 _PyPegen_insert_memo(p, mark, star_expression_type, res);
4233 return res;
4234}
4235
4236// star_named_expressions: ','.star_named_expression+ ','?
4237static asdl_seq*
4238star_named_expressions_rule(Parser *p)
4239{
4240 if (p->error_indicator) {
4241 return NULL;
4242 }
4243 asdl_seq* res = NULL;
4244 int mark = p->mark;
4245 { // ','.star_named_expression+ ','?
4246 asdl_seq * a;
4247 void *opt_var;
4248 UNUSED(opt_var); // Silence compiler warnings
4249 if (
4250 (a = _gather_62_rule(p))
4251 &&
4252 (opt_var = _PyPegen_expect_token(p, 12), 1)
4253 )
4254 {
4255 res = a;
4256 if (res == NULL && PyErr_Occurred()) {
4257 p->error_indicator = 1;
4258 return NULL;
4259 }
4260 goto done;
4261 }
4262 p->mark = mark;
4263 }
4264 res = NULL;
4265 done:
4266 return res;
4267}
4268
4269// star_named_expression: '*' bitwise_or | named_expression
4270static expr_ty
4271star_named_expression_rule(Parser *p)
4272{
4273 if (p->error_indicator) {
4274 return NULL;
4275 }
4276 expr_ty res = NULL;
4277 int mark = p->mark;
4278 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4279 p->error_indicator = 1;
4280 return NULL;
4281 }
4282 int start_lineno = p->tokens[mark]->lineno;
4283 UNUSED(start_lineno); // Only used by EXTRA macro
4284 int start_col_offset = p->tokens[mark]->col_offset;
4285 UNUSED(start_col_offset); // Only used by EXTRA macro
4286 { // '*' bitwise_or
4287 expr_ty a;
4288 void *literal;
4289 if (
4290 (literal = _PyPegen_expect_token(p, 16))
4291 &&
4292 (a = bitwise_or_rule(p))
4293 )
4294 {
4295 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4296 if (token == NULL) {
4297 return NULL;
4298 }
4299 int end_lineno = token->end_lineno;
4300 UNUSED(end_lineno); // Only used by EXTRA macro
4301 int end_col_offset = token->end_col_offset;
4302 UNUSED(end_col_offset); // Only used by EXTRA macro
4303 res = _Py_Starred ( a , Load , EXTRA );
4304 if (res == NULL && PyErr_Occurred()) {
4305 p->error_indicator = 1;
4306 return NULL;
4307 }
4308 goto done;
4309 }
4310 p->mark = mark;
4311 }
4312 { // named_expression
4313 expr_ty named_expression_var;
4314 if (
4315 (named_expression_var = named_expression_rule(p))
4316 )
4317 {
4318 res = named_expression_var;
4319 goto done;
4320 }
4321 p->mark = mark;
4322 }
4323 res = NULL;
4324 done:
4325 return res;
4326}
4327
4328// named_expression: NAME ':=' expression | expression !':=' | invalid_named_expression
4329static expr_ty
4330named_expression_rule(Parser *p)
4331{
4332 if (p->error_indicator) {
4333 return NULL;
4334 }
4335 expr_ty res = NULL;
4336 int mark = p->mark;
4337 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4338 p->error_indicator = 1;
4339 return NULL;
4340 }
4341 int start_lineno = p->tokens[mark]->lineno;
4342 UNUSED(start_lineno); // Only used by EXTRA macro
4343 int start_col_offset = p->tokens[mark]->col_offset;
4344 UNUSED(start_col_offset); // Only used by EXTRA macro
4345 { // NAME ':=' expression
4346 expr_ty a;
4347 expr_ty b;
4348 void *literal;
4349 if (
4350 (a = _PyPegen_name_token(p))
4351 &&
4352 (literal = _PyPegen_expect_token(p, 53))
4353 &&
4354 (b = expression_rule(p))
4355 )
4356 {
4357 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4358 if (token == NULL) {
4359 return NULL;
4360 }
4361 int end_lineno = token->end_lineno;
4362 UNUSED(end_lineno); // Only used by EXTRA macro
4363 int end_col_offset = token->end_col_offset;
4364 UNUSED(end_col_offset); // Only used by EXTRA macro
4365 res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
4366 if (res == NULL && PyErr_Occurred()) {
4367 p->error_indicator = 1;
4368 return NULL;
4369 }
4370 goto done;
4371 }
4372 p->mark = mark;
4373 }
4374 { // expression !':='
4375 expr_ty expression_var;
4376 if (
4377 (expression_var = expression_rule(p))
4378 &&
4379 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53)
4380 )
4381 {
4382 res = expression_var;
4383 goto done;
4384 }
4385 p->mark = mark;
4386 }
4387 { // invalid_named_expression
4388 void *invalid_named_expression_var;
4389 if (
4390 (invalid_named_expression_var = invalid_named_expression_rule(p))
4391 )
4392 {
4393 res = invalid_named_expression_var;
4394 goto done;
4395 }
4396 p->mark = mark;
4397 }
4398 res = NULL;
4399 done:
4400 return res;
4401}
4402
4403// annotated_rhs: yield_expr | star_expressions
4404static expr_ty
4405annotated_rhs_rule(Parser *p)
4406{
4407 if (p->error_indicator) {
4408 return NULL;
4409 }
4410 expr_ty res = NULL;
4411 int mark = p->mark;
4412 { // yield_expr
4413 expr_ty yield_expr_var;
4414 if (
4415 (yield_expr_var = yield_expr_rule(p))
4416 )
4417 {
4418 res = yield_expr_var;
4419 goto done;
4420 }
4421 p->mark = mark;
4422 }
4423 { // star_expressions
4424 expr_ty star_expressions_var;
4425 if (
4426 (star_expressions_var = star_expressions_rule(p))
4427 )
4428 {
4429 res = star_expressions_var;
4430 goto done;
4431 }
4432 p->mark = mark;
4433 }
4434 res = NULL;
4435 done:
4436 return res;
4437}
4438
4439// expressions: expression ((',' expression))+ ','? | expression ',' | expression
4440static expr_ty
4441expressions_rule(Parser *p)
4442{
4443 if (p->error_indicator) {
4444 return NULL;
4445 }
4446 expr_ty res = NULL;
4447 int mark = p->mark;
4448 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4449 p->error_indicator = 1;
4450 return NULL;
4451 }
4452 int start_lineno = p->tokens[mark]->lineno;
4453 UNUSED(start_lineno); // Only used by EXTRA macro
4454 int start_col_offset = p->tokens[mark]->col_offset;
4455 UNUSED(start_col_offset); // Only used by EXTRA macro
4456 { // expression ((',' expression))+ ','?
4457 expr_ty a;
4458 asdl_seq * b;
4459 void *opt_var;
4460 UNUSED(opt_var); // Silence compiler warnings
4461 if (
4462 (a = expression_rule(p))
4463 &&
4464 (b = _loop1_64_rule(p))
4465 &&
4466 (opt_var = _PyPegen_expect_token(p, 12), 1)
4467 )
4468 {
4469 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4470 if (token == NULL) {
4471 return NULL;
4472 }
4473 int end_lineno = token->end_lineno;
4474 UNUSED(end_lineno); // Only used by EXTRA macro
4475 int end_col_offset = token->end_col_offset;
4476 UNUSED(end_col_offset); // Only used by EXTRA macro
4477 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
4478 if (res == NULL && PyErr_Occurred()) {
4479 p->error_indicator = 1;
4480 return NULL;
4481 }
4482 goto done;
4483 }
4484 p->mark = mark;
4485 }
4486 { // expression ','
4487 expr_ty a;
4488 void *literal;
4489 if (
4490 (a = expression_rule(p))
4491 &&
4492 (literal = _PyPegen_expect_token(p, 12))
4493 )
4494 {
4495 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4496 if (token == NULL) {
4497 return NULL;
4498 }
4499 int end_lineno = token->end_lineno;
4500 UNUSED(end_lineno); // Only used by EXTRA macro
4501 int end_col_offset = token->end_col_offset;
4502 UNUSED(end_col_offset); // Only used by EXTRA macro
4503 res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
4504 if (res == NULL && PyErr_Occurred()) {
4505 p->error_indicator = 1;
4506 return NULL;
4507 }
4508 goto done;
4509 }
4510 p->mark = mark;
4511 }
4512 { // expression
4513 expr_ty expression_var;
4514 if (
4515 (expression_var = expression_rule(p))
4516 )
4517 {
4518 res = expression_var;
4519 goto done;
4520 }
4521 p->mark = mark;
4522 }
4523 res = NULL;
4524 done:
4525 return res;
4526}
4527
4528// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
4529static expr_ty
4530expression_rule(Parser *p)
4531{
4532 if (p->error_indicator) {
4533 return NULL;
4534 }
4535 expr_ty res = NULL;
4536 if (_PyPegen_is_memoized(p, expression_type, &res))
4537 return res;
4538 int mark = p->mark;
4539 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4540 p->error_indicator = 1;
4541 return NULL;
4542 }
4543 int start_lineno = p->tokens[mark]->lineno;
4544 UNUSED(start_lineno); // Only used by EXTRA macro
4545 int start_col_offset = p->tokens[mark]->col_offset;
4546 UNUSED(start_col_offset); // Only used by EXTRA macro
4547 { // disjunction 'if' disjunction 'else' expression
4548 expr_ty a;
4549 expr_ty b;
4550 expr_ty c;
4551 void *keyword;
4552 void *keyword_1;
4553 if (
4554 (a = disjunction_rule(p))
4555 &&
4556 (keyword = _PyPegen_expect_token(p, 510))
4557 &&
4558 (b = disjunction_rule(p))
4559 &&
4560 (keyword_1 = _PyPegen_expect_token(p, 516))
4561 &&
4562 (c = expression_rule(p))
4563 )
4564 {
4565 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4566 if (token == NULL) {
4567 return NULL;
4568 }
4569 int end_lineno = token->end_lineno;
4570 UNUSED(end_lineno); // Only used by EXTRA macro
4571 int end_col_offset = token->end_col_offset;
4572 UNUSED(end_col_offset); // Only used by EXTRA macro
4573 res = _Py_IfExp ( b , a , c , EXTRA );
4574 if (res == NULL && PyErr_Occurred()) {
4575 p->error_indicator = 1;
4576 return NULL;
4577 }
4578 goto done;
4579 }
4580 p->mark = mark;
4581 }
4582 { // disjunction
4583 expr_ty disjunction_var;
4584 if (
4585 (disjunction_var = disjunction_rule(p))
4586 )
4587 {
4588 res = disjunction_var;
4589 goto done;
4590 }
4591 p->mark = mark;
4592 }
4593 { // lambdef
4594 expr_ty lambdef_var;
4595 if (
4596 (lambdef_var = lambdef_rule(p))
4597 )
4598 {
4599 res = lambdef_var;
4600 goto done;
4601 }
4602 p->mark = mark;
4603 }
4604 res = NULL;
4605 done:
4606 _PyPegen_insert_memo(p, mark, expression_type, res);
4607 return res;
4608}
4609
4610// lambdef: 'lambda' lambda_parameters? ':' expression
4611static expr_ty
4612lambdef_rule(Parser *p)
4613{
4614 if (p->error_indicator) {
4615 return NULL;
4616 }
4617 expr_ty res = NULL;
4618 int mark = p->mark;
4619 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4620 p->error_indicator = 1;
4621 return NULL;
4622 }
4623 int start_lineno = p->tokens[mark]->lineno;
4624 UNUSED(start_lineno); // Only used by EXTRA macro
4625 int start_col_offset = p->tokens[mark]->col_offset;
4626 UNUSED(start_col_offset); // Only used by EXTRA macro
4627 { // 'lambda' lambda_parameters? ':' expression
4628 void *a;
4629 expr_ty b;
4630 void *keyword;
4631 void *literal;
4632 if (
4633 (keyword = _PyPegen_expect_token(p, 524))
4634 &&
4635 (a = lambda_parameters_rule(p), 1)
4636 &&
4637 (literal = _PyPegen_expect_token(p, 11))
4638 &&
4639 (b = expression_rule(p))
4640 )
4641 {
4642 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4643 if (token == NULL) {
4644 return NULL;
4645 }
4646 int end_lineno = token->end_lineno;
4647 UNUSED(end_lineno); // Only used by EXTRA macro
4648 int end_col_offset = token->end_col_offset;
4649 UNUSED(end_col_offset); // Only used by EXTRA macro
4650 res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
4651 if (res == NULL && PyErr_Occurred()) {
4652 p->error_indicator = 1;
4653 return NULL;
4654 }
4655 goto done;
4656 }
4657 p->mark = mark;
4658 }
4659 res = NULL;
4660 done:
4661 return res;
4662}
4663
4664// lambda_parameters:
4665// | lambda_slash_without_default [',' lambda_plain_names] [',' lambda_names_with_default] [',' lambda_star_etc?]
4666// | lambda_slash_with_default [',' lambda_names_with_default] [',' lambda_star_etc?]
4667// | lambda_plain_names [',' lambda_names_with_default] [',' lambda_star_etc?]
4668// | lambda_names_with_default [',' lambda_star_etc?]
4669// | lambda_star_etc
4670static arguments_ty
4671lambda_parameters_rule(Parser *p)
4672{
4673 if (p->error_indicator) {
4674 return NULL;
4675 }
4676 arguments_ty res = NULL;
4677 int mark = p->mark;
4678 { // lambda_slash_without_default [',' lambda_plain_names] [',' lambda_names_with_default] [',' lambda_star_etc?]
4679 asdl_seq* a;
4680 void *b;
4681 void *c;
4682 void *d;
4683 if (
4684 (a = lambda_slash_without_default_rule(p))
4685 &&
4686 (b = _tmp_65_rule(p), 1)
4687 &&
4688 (c = _tmp_66_rule(p), 1)
4689 &&
4690 (d = _tmp_67_rule(p), 1)
4691 )
4692 {
4693 res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
4694 if (res == NULL && PyErr_Occurred()) {
4695 p->error_indicator = 1;
4696 return NULL;
4697 }
4698 goto done;
4699 }
4700 p->mark = mark;
4701 }
4702 { // lambda_slash_with_default [',' lambda_names_with_default] [',' lambda_star_etc?]
4703 SlashWithDefault* a;
4704 void *b;
4705 void *c;
4706 if (
4707 (a = lambda_slash_with_default_rule(p))
4708 &&
4709 (b = _tmp_68_rule(p), 1)
4710 &&
4711 (c = _tmp_69_rule(p), 1)
4712 )
4713 {
4714 res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
4715 if (res == NULL && PyErr_Occurred()) {
4716 p->error_indicator = 1;
4717 return NULL;
4718 }
4719 goto done;
4720 }
4721 p->mark = mark;
4722 }
4723 { // lambda_plain_names [',' lambda_names_with_default] [',' lambda_star_etc?]
4724 asdl_seq* a;
4725 void *b;
4726 void *c;
4727 if (
4728 (a = lambda_plain_names_rule(p))
4729 &&
4730 (b = _tmp_70_rule(p), 1)
4731 &&
4732 (c = _tmp_71_rule(p), 1)
4733 )
4734 {
4735 res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
4736 if (res == NULL && PyErr_Occurred()) {
4737 p->error_indicator = 1;
4738 return NULL;
4739 }
4740 goto done;
4741 }
4742 p->mark = mark;
4743 }
4744 { // lambda_names_with_default [',' lambda_star_etc?]
4745 asdl_seq* a;
4746 void *b;
4747 if (
4748 (a = lambda_names_with_default_rule(p))
4749 &&
4750 (b = _tmp_72_rule(p), 1)
4751 )
4752 {
4753 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
4754 if (res == NULL && PyErr_Occurred()) {
4755 p->error_indicator = 1;
4756 return NULL;
4757 }
4758 goto done;
4759 }
4760 p->mark = mark;
4761 }
4762 { // lambda_star_etc
4763 StarEtc* a;
4764 if (
4765 (a = lambda_star_etc_rule(p))
4766 )
4767 {
4768 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
4769 if (res == NULL && PyErr_Occurred()) {
4770 p->error_indicator = 1;
4771 return NULL;
4772 }
4773 goto done;
4774 }
4775 p->mark = mark;
4776 }
4777 res = NULL;
4778 done:
4779 return res;
4780}
4781
4782// lambda_slash_without_default: lambda_plain_names ',' '/'
4783static asdl_seq*
4784lambda_slash_without_default_rule(Parser *p)
4785{
4786 if (p->error_indicator) {
4787 return NULL;
4788 }
4789 asdl_seq* res = NULL;
4790 int mark = p->mark;
4791 { // lambda_plain_names ',' '/'
4792 asdl_seq* a;
4793 void *literal;
4794 void *literal_1;
4795 if (
4796 (a = lambda_plain_names_rule(p))
4797 &&
4798 (literal = _PyPegen_expect_token(p, 12))
4799 &&
4800 (literal_1 = _PyPegen_expect_token(p, 17))
4801 )
4802 {
4803 res = a;
4804 if (res == NULL && PyErr_Occurred()) {
4805 p->error_indicator = 1;
4806 return NULL;
4807 }
4808 goto done;
4809 }
4810 p->mark = mark;
4811 }
4812 res = NULL;
4813 done:
4814 return res;
4815}
4816
4817// lambda_slash_with_default: [lambda_plain_names ','] lambda_names_with_default ',' '/'
4818static SlashWithDefault*
4819lambda_slash_with_default_rule(Parser *p)
4820{
4821 if (p->error_indicator) {
4822 return NULL;
4823 }
4824 SlashWithDefault* res = NULL;
4825 int mark = p->mark;
4826 { // [lambda_plain_names ','] lambda_names_with_default ',' '/'
4827 void *a;
4828 asdl_seq* b;
4829 void *literal;
4830 void *literal_1;
4831 if (
4832 (a = _tmp_73_rule(p), 1)
4833 &&
4834 (b = lambda_names_with_default_rule(p))
4835 &&
4836 (literal = _PyPegen_expect_token(p, 12))
4837 &&
4838 (literal_1 = _PyPegen_expect_token(p, 17))
4839 )
4840 {
4841 res = _PyPegen_slash_with_default ( p , a , b );
4842 if (res == NULL && PyErr_Occurred()) {
4843 p->error_indicator = 1;
4844 return NULL;
4845 }
4846 goto done;
4847 }
4848 p->mark = mark;
4849 }
4850 res = NULL;
4851 done:
4852 return res;
4853}
4854
4855// lambda_star_etc:
4856// | '*' lambda_plain_name lambda_name_with_optional_default* [',' lambda_kwds] ','?
4857// | '*' lambda_name_with_optional_default+ [',' lambda_kwds] ','?
4858// | lambda_kwds ','?
4859static StarEtc*
4860lambda_star_etc_rule(Parser *p)
4861{
4862 if (p->error_indicator) {
4863 return NULL;
4864 }
4865 StarEtc* res = NULL;
4866 int mark = p->mark;
4867 { // '*' lambda_plain_name lambda_name_with_optional_default* [',' lambda_kwds] ','?
4868 arg_ty a;
4869 asdl_seq * b;
4870 void *c;
4871 void *literal;
4872 void *opt_var;
4873 UNUSED(opt_var); // Silence compiler warnings
4874 if (
4875 (literal = _PyPegen_expect_token(p, 16))
4876 &&
4877 (a = lambda_plain_name_rule(p))
4878 &&
4879 (b = _loop0_74_rule(p))
4880 &&
4881 (c = _tmp_75_rule(p), 1)
4882 &&
4883 (opt_var = _PyPegen_expect_token(p, 12), 1)
4884 )
4885 {
4886 res = _PyPegen_star_etc ( p , a , b , c );
4887 if (res == NULL && PyErr_Occurred()) {
4888 p->error_indicator = 1;
4889 return NULL;
4890 }
4891 goto done;
4892 }
4893 p->mark = mark;
4894 }
4895 { // '*' lambda_name_with_optional_default+ [',' lambda_kwds] ','?
4896 asdl_seq * b;
4897 void *c;
4898 void *literal;
4899 void *opt_var;
4900 UNUSED(opt_var); // Silence compiler warnings
4901 if (
4902 (literal = _PyPegen_expect_token(p, 16))
4903 &&
4904 (b = _loop1_76_rule(p))
4905 &&
4906 (c = _tmp_77_rule(p), 1)
4907 &&
4908 (opt_var = _PyPegen_expect_token(p, 12), 1)
4909 )
4910 {
4911 res = _PyPegen_star_etc ( p , NULL , b , c );
4912 if (res == NULL && PyErr_Occurred()) {
4913 p->error_indicator = 1;
4914 return NULL;
4915 }
4916 goto done;
4917 }
4918 p->mark = mark;
4919 }
4920 { // lambda_kwds ','?
4921 arg_ty a;
4922 void *opt_var;
4923 UNUSED(opt_var); // Silence compiler warnings
4924 if (
4925 (a = lambda_kwds_rule(p))
4926 &&
4927 (opt_var = _PyPegen_expect_token(p, 12), 1)
4928 )
4929 {
4930 res = _PyPegen_star_etc ( p , NULL , NULL , a );
4931 if (res == NULL && PyErr_Occurred()) {
4932 p->error_indicator = 1;
4933 return NULL;
4934 }
4935 goto done;
4936 }
4937 p->mark = mark;
4938 }
4939 res = NULL;
4940 done:
4941 return res;
4942}
4943
4944// lambda_name_with_optional_default: ',' lambda_plain_name ['=' expression]
4945static NameDefaultPair*
4946lambda_name_with_optional_default_rule(Parser *p)
4947{
4948 if (p->error_indicator) {
4949 return NULL;
4950 }
4951 NameDefaultPair* res = NULL;
4952 int mark = p->mark;
4953 { // ',' lambda_plain_name ['=' expression]
4954 arg_ty a;
4955 void *b;
4956 void *literal;
4957 if (
4958 (literal = _PyPegen_expect_token(p, 12))
4959 &&
4960 (a = lambda_plain_name_rule(p))
4961 &&
4962 (b = _tmp_78_rule(p), 1)
4963 )
4964 {
4965 res = _PyPegen_name_default_pair ( p , a , b );
4966 if (res == NULL && PyErr_Occurred()) {
4967 p->error_indicator = 1;
4968 return NULL;
4969 }
4970 goto done;
4971 }
4972 p->mark = mark;
4973 }
4974 res = NULL;
4975 done:
4976 return res;
4977}
4978
4979// lambda_names_with_default: ','.lambda_name_with_default+
4980static asdl_seq*
4981lambda_names_with_default_rule(Parser *p)
4982{
4983 if (p->error_indicator) {
4984 return NULL;
4985 }
4986 asdl_seq* res = NULL;
4987 int mark = p->mark;
4988 { // ','.lambda_name_with_default+
4989 asdl_seq * a;
4990 if (
4991 (a = _gather_79_rule(p))
4992 )
4993 {
4994 res = a;
4995 if (res == NULL && PyErr_Occurred()) {
4996 p->error_indicator = 1;
4997 return NULL;
4998 }
4999 goto done;
5000 }
5001 p->mark = mark;
5002 }
5003 res = NULL;
5004 done:
5005 return res;
5006}
5007
5008// lambda_name_with_default: lambda_plain_name '=' expression
5009static NameDefaultPair*
5010lambda_name_with_default_rule(Parser *p)
5011{
5012 if (p->error_indicator) {
5013 return NULL;
5014 }
5015 NameDefaultPair* res = NULL;
5016 int mark = p->mark;
5017 { // lambda_plain_name '=' expression
5018 expr_ty e;
5019 void *literal;
5020 arg_ty n;
5021 if (
5022 (n = lambda_plain_name_rule(p))
5023 &&
5024 (literal = _PyPegen_expect_token(p, 22))
5025 &&
5026 (e = expression_rule(p))
5027 )
5028 {
5029 res = _PyPegen_name_default_pair ( p , n , e );
5030 if (res == NULL && PyErr_Occurred()) {
5031 p->error_indicator = 1;
5032 return NULL;
5033 }
5034 goto done;
5035 }
5036 p->mark = mark;
5037 }
5038 res = NULL;
5039 done:
5040 return res;
5041}
5042
5043// lambda_plain_names: ','.(lambda_plain_name !'=')+
5044static asdl_seq*
5045lambda_plain_names_rule(Parser *p)
5046{
5047 if (p->error_indicator) {
5048 return NULL;
5049 }
5050 asdl_seq* res = NULL;
5051 int mark = p->mark;
5052 { // ','.(lambda_plain_name !'=')+
5053 asdl_seq * a;
5054 if (
5055 (a = _gather_81_rule(p))
5056 )
5057 {
5058 res = a;
5059 if (res == NULL && PyErr_Occurred()) {
5060 p->error_indicator = 1;
5061 return NULL;
5062 }
5063 goto done;
5064 }
5065 p->mark = mark;
5066 }
5067 res = NULL;
5068 done:
5069 return res;
5070}
5071
5072// lambda_plain_name: NAME
5073static arg_ty
5074lambda_plain_name_rule(Parser *p)
5075{
5076 if (p->error_indicator) {
5077 return NULL;
5078 }
5079 arg_ty res = NULL;
5080 int mark = p->mark;
5081 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5082 p->error_indicator = 1;
5083 return NULL;
5084 }
5085 int start_lineno = p->tokens[mark]->lineno;
5086 UNUSED(start_lineno); // Only used by EXTRA macro
5087 int start_col_offset = p->tokens[mark]->col_offset;
5088 UNUSED(start_col_offset); // Only used by EXTRA macro
5089 { // NAME
5090 expr_ty a;
5091 if (
5092 (a = _PyPegen_name_token(p))
5093 )
5094 {
5095 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5096 if (token == NULL) {
5097 return NULL;
5098 }
5099 int end_lineno = token->end_lineno;
5100 UNUSED(end_lineno); // Only used by EXTRA macro
5101 int end_col_offset = token->end_col_offset;
5102 UNUSED(end_col_offset); // Only used by EXTRA macro
5103 res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
5104 if (res == NULL && PyErr_Occurred()) {
5105 p->error_indicator = 1;
5106 return NULL;
5107 }
5108 goto done;
5109 }
5110 p->mark = mark;
5111 }
5112 res = NULL;
5113 done:
5114 return res;
5115}
5116
5117// lambda_kwds: '**' lambda_plain_name
5118static arg_ty
5119lambda_kwds_rule(Parser *p)
5120{
5121 if (p->error_indicator) {
5122 return NULL;
5123 }
5124 arg_ty res = NULL;
5125 int mark = p->mark;
5126 { // '**' lambda_plain_name
5127 arg_ty a;
5128 void *literal;
5129 if (
5130 (literal = _PyPegen_expect_token(p, 35))
5131 &&
5132 (a = lambda_plain_name_rule(p))
5133 )
5134 {
5135 res = a;
5136 if (res == NULL && PyErr_Occurred()) {
5137 p->error_indicator = 1;
5138 return NULL;
5139 }
5140 goto done;
5141 }
5142 p->mark = mark;
5143 }
5144 res = NULL;
5145 done:
5146 return res;
5147}
5148
5149// disjunction: conjunction (('or' conjunction))+ | conjunction
5150static expr_ty
5151disjunction_rule(Parser *p)
5152{
5153 if (p->error_indicator) {
5154 return NULL;
5155 }
5156 expr_ty res = NULL;
5157 if (_PyPegen_is_memoized(p, disjunction_type, &res))
5158 return res;
5159 int mark = p->mark;
5160 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5161 p->error_indicator = 1;
5162 return NULL;
5163 }
5164 int start_lineno = p->tokens[mark]->lineno;
5165 UNUSED(start_lineno); // Only used by EXTRA macro
5166 int start_col_offset = p->tokens[mark]->col_offset;
5167 UNUSED(start_col_offset); // Only used by EXTRA macro
5168 { // conjunction (('or' conjunction))+
5169 expr_ty a;
5170 asdl_seq * b;
5171 if (
5172 (a = conjunction_rule(p))
5173 &&
5174 (b = _loop1_83_rule(p))
5175 )
5176 {
5177 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5178 if (token == NULL) {
5179 return NULL;
5180 }
5181 int end_lineno = token->end_lineno;
5182 UNUSED(end_lineno); // Only used by EXTRA macro
5183 int end_col_offset = token->end_col_offset;
5184 UNUSED(end_col_offset); // Only used by EXTRA macro
5185 res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
5186 if (res == NULL && PyErr_Occurred()) {
5187 p->error_indicator = 1;
5188 return NULL;
5189 }
5190 goto done;
5191 }
5192 p->mark = mark;
5193 }
5194 { // conjunction
5195 expr_ty conjunction_var;
5196 if (
5197 (conjunction_var = conjunction_rule(p))
5198 )
5199 {
5200 res = conjunction_var;
5201 goto done;
5202 }
5203 p->mark = mark;
5204 }
5205 res = NULL;
5206 done:
5207 _PyPegen_insert_memo(p, mark, disjunction_type, res);
5208 return res;
5209}
5210
5211// conjunction: inversion (('and' inversion))+ | inversion
5212static expr_ty
5213conjunction_rule(Parser *p)
5214{
5215 if (p->error_indicator) {
5216 return NULL;
5217 }
5218 expr_ty res = NULL;
5219 if (_PyPegen_is_memoized(p, conjunction_type, &res))
5220 return res;
5221 int mark = p->mark;
5222 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5223 p->error_indicator = 1;
5224 return NULL;
5225 }
5226 int start_lineno = p->tokens[mark]->lineno;
5227 UNUSED(start_lineno); // Only used by EXTRA macro
5228 int start_col_offset = p->tokens[mark]->col_offset;
5229 UNUSED(start_col_offset); // Only used by EXTRA macro
5230 { // inversion (('and' inversion))+
5231 expr_ty a;
5232 asdl_seq * b;
5233 if (
5234 (a = inversion_rule(p))
5235 &&
5236 (b = _loop1_84_rule(p))
5237 )
5238 {
5239 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5240 if (token == NULL) {
5241 return NULL;
5242 }
5243 int end_lineno = token->end_lineno;
5244 UNUSED(end_lineno); // Only used by EXTRA macro
5245 int end_col_offset = token->end_col_offset;
5246 UNUSED(end_col_offset); // Only used by EXTRA macro
5247 res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
5248 if (res == NULL && PyErr_Occurred()) {
5249 p->error_indicator = 1;
5250 return NULL;
5251 }
5252 goto done;
5253 }
5254 p->mark = mark;
5255 }
5256 { // inversion
5257 expr_ty inversion_var;
5258 if (
5259 (inversion_var = inversion_rule(p))
5260 )
5261 {
5262 res = inversion_var;
5263 goto done;
5264 }
5265 p->mark = mark;
5266 }
5267 res = NULL;
5268 done:
5269 _PyPegen_insert_memo(p, mark, conjunction_type, res);
5270 return res;
5271}
5272
5273// inversion: 'not' inversion | comparison
5274static expr_ty
5275inversion_rule(Parser *p)
5276{
5277 if (p->error_indicator) {
5278 return NULL;
5279 }
5280 expr_ty res = NULL;
5281 if (_PyPegen_is_memoized(p, inversion_type, &res))
5282 return res;
5283 int mark = p->mark;
5284 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5285 p->error_indicator = 1;
5286 return NULL;
5287 }
5288 int start_lineno = p->tokens[mark]->lineno;
5289 UNUSED(start_lineno); // Only used by EXTRA macro
5290 int start_col_offset = p->tokens[mark]->col_offset;
5291 UNUSED(start_col_offset); // Only used by EXTRA macro
5292 { // 'not' inversion
5293 expr_ty a;
5294 void *keyword;
5295 if (
5296 (keyword = _PyPegen_expect_token(p, 525))
5297 &&
5298 (a = inversion_rule(p))
5299 )
5300 {
5301 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5302 if (token == NULL) {
5303 return NULL;
5304 }
5305 int end_lineno = token->end_lineno;
5306 UNUSED(end_lineno); // Only used by EXTRA macro
5307 int end_col_offset = token->end_col_offset;
5308 UNUSED(end_col_offset); // Only used by EXTRA macro
5309 res = _Py_UnaryOp ( Not , a , EXTRA );
5310 if (res == NULL && PyErr_Occurred()) {
5311 p->error_indicator = 1;
5312 return NULL;
5313 }
5314 goto done;
5315 }
5316 p->mark = mark;
5317 }
5318 { // comparison
5319 expr_ty comparison_var;
5320 if (
5321 (comparison_var = comparison_rule(p))
5322 )
5323 {
5324 res = comparison_var;
5325 goto done;
5326 }
5327 p->mark = mark;
5328 }
5329 res = NULL;
5330 done:
5331 _PyPegen_insert_memo(p, mark, inversion_type, res);
5332 return res;
5333}
5334
5335// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
5336static expr_ty
5337comparison_rule(Parser *p)
5338{
5339 if (p->error_indicator) {
5340 return NULL;
5341 }
5342 expr_ty res = NULL;
5343 int mark = p->mark;
5344 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5345 p->error_indicator = 1;
5346 return NULL;
5347 }
5348 int start_lineno = p->tokens[mark]->lineno;
5349 UNUSED(start_lineno); // Only used by EXTRA macro
5350 int start_col_offset = p->tokens[mark]->col_offset;
5351 UNUSED(start_col_offset); // Only used by EXTRA macro
5352 { // bitwise_or compare_op_bitwise_or_pair+
5353 expr_ty a;
5354 asdl_seq * b;
5355 if (
5356 (a = bitwise_or_rule(p))
5357 &&
5358 (b = _loop1_85_rule(p))
5359 )
5360 {
5361 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5362 if (token == NULL) {
5363 return NULL;
5364 }
5365 int end_lineno = token->end_lineno;
5366 UNUSED(end_lineno); // Only used by EXTRA macro
5367 int end_col_offset = token->end_col_offset;
5368 UNUSED(end_col_offset); // Only used by EXTRA macro
5369 res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA );
5370 if (res == NULL && PyErr_Occurred()) {
5371 p->error_indicator = 1;
5372 return NULL;
5373 }
5374 goto done;
5375 }
5376 p->mark = mark;
5377 }
5378 { // bitwise_or
5379 expr_ty bitwise_or_var;
5380 if (
5381 (bitwise_or_var = bitwise_or_rule(p))
5382 )
5383 {
5384 res = bitwise_or_var;
5385 goto done;
5386 }
5387 p->mark = mark;
5388 }
5389 res = NULL;
5390 done:
5391 return res;
5392}
5393
5394// compare_op_bitwise_or_pair:
5395// | eq_bitwise_or
5396// | noteq_bitwise_or
5397// | lte_bitwise_or
5398// | lt_bitwise_or
5399// | gte_bitwise_or
5400// | gt_bitwise_or
5401// | notin_bitwise_or
5402// | in_bitwise_or
5403// | isnot_bitwise_or
5404// | is_bitwise_or
5405static CmpopExprPair*
5406compare_op_bitwise_or_pair_rule(Parser *p)
5407{
5408 if (p->error_indicator) {
5409 return NULL;
5410 }
5411 CmpopExprPair* res = NULL;
5412 int mark = p->mark;
5413 { // eq_bitwise_or
5414 CmpopExprPair* eq_bitwise_or_var;
5415 if (
5416 (eq_bitwise_or_var = eq_bitwise_or_rule(p))
5417 )
5418 {
5419 res = eq_bitwise_or_var;
5420 goto done;
5421 }
5422 p->mark = mark;
5423 }
5424 { // noteq_bitwise_or
5425 CmpopExprPair* noteq_bitwise_or_var;
5426 if (
5427 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p))
5428 )
5429 {
5430 res = noteq_bitwise_or_var;
5431 goto done;
5432 }
5433 p->mark = mark;
5434 }
5435 { // lte_bitwise_or
5436 CmpopExprPair* lte_bitwise_or_var;
5437 if (
5438 (lte_bitwise_or_var = lte_bitwise_or_rule(p))
5439 )
5440 {
5441 res = lte_bitwise_or_var;
5442 goto done;
5443 }
5444 p->mark = mark;
5445 }
5446 { // lt_bitwise_or
5447 CmpopExprPair* lt_bitwise_or_var;
5448 if (
5449 (lt_bitwise_or_var = lt_bitwise_or_rule(p))
5450 )
5451 {
5452 res = lt_bitwise_or_var;
5453 goto done;
5454 }
5455 p->mark = mark;
5456 }
5457 { // gte_bitwise_or
5458 CmpopExprPair* gte_bitwise_or_var;
5459 if (
5460 (gte_bitwise_or_var = gte_bitwise_or_rule(p))
5461 )
5462 {
5463 res = gte_bitwise_or_var;
5464 goto done;
5465 }
5466 p->mark = mark;
5467 }
5468 { // gt_bitwise_or
5469 CmpopExprPair* gt_bitwise_or_var;
5470 if (
5471 (gt_bitwise_or_var = gt_bitwise_or_rule(p))
5472 )
5473 {
5474 res = gt_bitwise_or_var;
5475 goto done;
5476 }
5477 p->mark = mark;
5478 }
5479 { // notin_bitwise_or
5480 CmpopExprPair* notin_bitwise_or_var;
5481 if (
5482 (notin_bitwise_or_var = notin_bitwise_or_rule(p))
5483 )
5484 {
5485 res = notin_bitwise_or_var;
5486 goto done;
5487 }
5488 p->mark = mark;
5489 }
5490 { // in_bitwise_or
5491 CmpopExprPair* in_bitwise_or_var;
5492 if (
5493 (in_bitwise_or_var = in_bitwise_or_rule(p))
5494 )
5495 {
5496 res = in_bitwise_or_var;
5497 goto done;
5498 }
5499 p->mark = mark;
5500 }
5501 { // isnot_bitwise_or
5502 CmpopExprPair* isnot_bitwise_or_var;
5503 if (
5504 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p))
5505 )
5506 {
5507 res = isnot_bitwise_or_var;
5508 goto done;
5509 }
5510 p->mark = mark;
5511 }
5512 { // is_bitwise_or
5513 CmpopExprPair* is_bitwise_or_var;
5514 if (
5515 (is_bitwise_or_var = is_bitwise_or_rule(p))
5516 )
5517 {
5518 res = is_bitwise_or_var;
5519 goto done;
5520 }
5521 p->mark = mark;
5522 }
5523 res = NULL;
5524 done:
5525 return res;
5526}
5527
5528// eq_bitwise_or: '==' bitwise_or
5529static CmpopExprPair*
5530eq_bitwise_or_rule(Parser *p)
5531{
5532 if (p->error_indicator) {
5533 return NULL;
5534 }
5535 CmpopExprPair* res = NULL;
5536 int mark = p->mark;
5537 { // '==' bitwise_or
5538 expr_ty a;
5539 void *literal;
5540 if (
5541 (literal = _PyPegen_expect_token(p, 27))
5542 &&
5543 (a = bitwise_or_rule(p))
5544 )
5545 {
5546 res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
5547 if (res == NULL && PyErr_Occurred()) {
5548 p->error_indicator = 1;
5549 return NULL;
5550 }
5551 goto done;
5552 }
5553 p->mark = mark;
5554 }
5555 res = NULL;
5556 done:
5557 return res;
5558}
5559
5560// noteq_bitwise_or: '!=' bitwise_or
5561static CmpopExprPair*
5562noteq_bitwise_or_rule(Parser *p)
5563{
5564 if (p->error_indicator) {
5565 return NULL;
5566 }
5567 CmpopExprPair* res = NULL;
5568 int mark = p->mark;
5569 { // '!=' bitwise_or
5570 expr_ty a;
5571 void *literal;
5572 if (
5573 (literal = _PyPegen_expect_token(p, 28))
5574 &&
5575 (a = bitwise_or_rule(p))
5576 )
5577 {
5578 res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
5579 if (res == NULL && PyErr_Occurred()) {
5580 p->error_indicator = 1;
5581 return NULL;
5582 }
5583 goto done;
5584 }
5585 p->mark = mark;
5586 }
5587 res = NULL;
5588 done:
5589 return res;
5590}
5591
5592// lte_bitwise_or: '<=' bitwise_or
5593static CmpopExprPair*
5594lte_bitwise_or_rule(Parser *p)
5595{
5596 if (p->error_indicator) {
5597 return NULL;
5598 }
5599 CmpopExprPair* res = NULL;
5600 int mark = p->mark;
5601 { // '<=' bitwise_or
5602 expr_ty a;
5603 void *literal;
5604 if (
5605 (literal = _PyPegen_expect_token(p, 29))
5606 &&
5607 (a = bitwise_or_rule(p))
5608 )
5609 {
5610 res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
5611 if (res == NULL && PyErr_Occurred()) {
5612 p->error_indicator = 1;
5613 return NULL;
5614 }
5615 goto done;
5616 }
5617 p->mark = mark;
5618 }
5619 res = NULL;
5620 done:
5621 return res;
5622}
5623
5624// lt_bitwise_or: '<' bitwise_or
5625static CmpopExprPair*
5626lt_bitwise_or_rule(Parser *p)
5627{
5628 if (p->error_indicator) {
5629 return NULL;
5630 }
5631 CmpopExprPair* res = NULL;
5632 int mark = p->mark;
5633 { // '<' bitwise_or
5634 expr_ty a;
5635 void *literal;
5636 if (
5637 (literal = _PyPegen_expect_token(p, 20))
5638 &&
5639 (a = bitwise_or_rule(p))
5640 )
5641 {
5642 res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
5643 if (res == NULL && PyErr_Occurred()) {
5644 p->error_indicator = 1;
5645 return NULL;
5646 }
5647 goto done;
5648 }
5649 p->mark = mark;
5650 }
5651 res = NULL;
5652 done:
5653 return res;
5654}
5655
5656// gte_bitwise_or: '>=' bitwise_or
5657static CmpopExprPair*
5658gte_bitwise_or_rule(Parser *p)
5659{
5660 if (p->error_indicator) {
5661 return NULL;
5662 }
5663 CmpopExprPair* res = NULL;
5664 int mark = p->mark;
5665 { // '>=' bitwise_or
5666 expr_ty a;
5667 void *literal;
5668 if (
5669 (literal = _PyPegen_expect_token(p, 30))
5670 &&
5671 (a = bitwise_or_rule(p))
5672 )
5673 {
5674 res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
5675 if (res == NULL && PyErr_Occurred()) {
5676 p->error_indicator = 1;
5677 return NULL;
5678 }
5679 goto done;
5680 }
5681 p->mark = mark;
5682 }
5683 res = NULL;
5684 done:
5685 return res;
5686}
5687
5688// gt_bitwise_or: '>' bitwise_or
5689static CmpopExprPair*
5690gt_bitwise_or_rule(Parser *p)
5691{
5692 if (p->error_indicator) {
5693 return NULL;
5694 }
5695 CmpopExprPair* res = NULL;
5696 int mark = p->mark;
5697 { // '>' bitwise_or
5698 expr_ty a;
5699 void *literal;
5700 if (
5701 (literal = _PyPegen_expect_token(p, 21))
5702 &&
5703 (a = bitwise_or_rule(p))
5704 )
5705 {
5706 res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
5707 if (res == NULL && PyErr_Occurred()) {
5708 p->error_indicator = 1;
5709 return NULL;
5710 }
5711 goto done;
5712 }
5713 p->mark = mark;
5714 }
5715 res = NULL;
5716 done:
5717 return res;
5718}
5719
5720// notin_bitwise_or: 'not' 'in' bitwise_or
5721static CmpopExprPair*
5722notin_bitwise_or_rule(Parser *p)
5723{
5724 if (p->error_indicator) {
5725 return NULL;
5726 }
5727 CmpopExprPair* res = NULL;
5728 int mark = p->mark;
5729 { // 'not' 'in' bitwise_or
5730 expr_ty a;
5731 void *keyword;
5732 void *keyword_1;
5733 if (
5734 (keyword = _PyPegen_expect_token(p, 525))
5735 &&
5736 (keyword_1 = _PyPegen_expect_token(p, 518))
5737 &&
5738 (a = bitwise_or_rule(p))
5739 )
5740 {
5741 res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
5742 if (res == NULL && PyErr_Occurred()) {
5743 p->error_indicator = 1;
5744 return NULL;
5745 }
5746 goto done;
5747 }
5748 p->mark = mark;
5749 }
5750 res = NULL;
5751 done:
5752 return res;
5753}
5754
5755// in_bitwise_or: 'in' bitwise_or
5756static CmpopExprPair*
5757in_bitwise_or_rule(Parser *p)
5758{
5759 if (p->error_indicator) {
5760 return NULL;
5761 }
5762 CmpopExprPair* res = NULL;
5763 int mark = p->mark;
5764 { // 'in' bitwise_or
5765 expr_ty a;
5766 void *keyword;
5767 if (
5768 (keyword = _PyPegen_expect_token(p, 518))
5769 &&
5770 (a = bitwise_or_rule(p))
5771 )
5772 {
5773 res = _PyPegen_cmpop_expr_pair ( p , In , a );
5774 if (res == NULL && PyErr_Occurred()) {
5775 p->error_indicator = 1;
5776 return NULL;
5777 }
5778 goto done;
5779 }
5780 p->mark = mark;
5781 }
5782 res = NULL;
5783 done:
5784 return res;
5785}
5786
5787// isnot_bitwise_or: 'is' 'not' bitwise_or
5788static CmpopExprPair*
5789isnot_bitwise_or_rule(Parser *p)
5790{
5791 if (p->error_indicator) {
5792 return NULL;
5793 }
5794 CmpopExprPair* res = NULL;
5795 int mark = p->mark;
5796 { // 'is' 'not' bitwise_or
5797 expr_ty a;
5798 void *keyword;
5799 void *keyword_1;
5800 if (
5801 (keyword = _PyPegen_expect_token(p, 526))
5802 &&
5803 (keyword_1 = _PyPegen_expect_token(p, 525))
5804 &&
5805 (a = bitwise_or_rule(p))
5806 )
5807 {
5808 res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
5809 if (res == NULL && PyErr_Occurred()) {
5810 p->error_indicator = 1;
5811 return NULL;
5812 }
5813 goto done;
5814 }
5815 p->mark = mark;
5816 }
5817 res = NULL;
5818 done:
5819 return res;
5820}
5821
5822// is_bitwise_or: 'is' bitwise_or
5823static CmpopExprPair*
5824is_bitwise_or_rule(Parser *p)
5825{
5826 if (p->error_indicator) {
5827 return NULL;
5828 }
5829 CmpopExprPair* res = NULL;
5830 int mark = p->mark;
5831 { // 'is' bitwise_or
5832 expr_ty a;
5833 void *keyword;
5834 if (
5835 (keyword = _PyPegen_expect_token(p, 526))
5836 &&
5837 (a = bitwise_or_rule(p))
5838 )
5839 {
5840 res = _PyPegen_cmpop_expr_pair ( p , Is , a );
5841 if (res == NULL && PyErr_Occurred()) {
5842 p->error_indicator = 1;
5843 return NULL;
5844 }
5845 goto done;
5846 }
5847 p->mark = mark;
5848 }
5849 res = NULL;
5850 done:
5851 return res;
5852}
5853
5854// Left-recursive
5855// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
5856static expr_ty bitwise_or_raw(Parser *);
5857static expr_ty
5858bitwise_or_rule(Parser *p)
5859{
5860 expr_ty res = NULL;
5861 if (_PyPegen_is_memoized(p, bitwise_or_type, &res))
5862 return res;
5863 int mark = p->mark;
5864 int resmark = p->mark;
5865 while (1) {
5866 int tmpvar_1 = _PyPegen_update_memo(p, mark, bitwise_or_type, res);
5867 if (tmpvar_1) {
5868 return res;
5869 }
5870 p->mark = mark;
5871 void *raw = bitwise_or_raw(p);
5872 if (raw == NULL || p->mark <= resmark)
5873 break;
5874 resmark = p->mark;
5875 res = raw;
5876 }
5877 p->mark = resmark;
5878 return res;
5879}
5880static expr_ty
5881bitwise_or_raw(Parser *p)
5882{
5883 if (p->error_indicator) {
5884 return NULL;
5885 }
5886 expr_ty res = NULL;
5887 int mark = p->mark;
5888 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5889 p->error_indicator = 1;
5890 return NULL;
5891 }
5892 int start_lineno = p->tokens[mark]->lineno;
5893 UNUSED(start_lineno); // Only used by EXTRA macro
5894 int start_col_offset = p->tokens[mark]->col_offset;
5895 UNUSED(start_col_offset); // Only used by EXTRA macro
5896 { // bitwise_or '|' bitwise_xor
5897 expr_ty a;
5898 expr_ty b;
5899 void *literal;
5900 if (
5901 (a = bitwise_or_rule(p))
5902 &&
5903 (literal = _PyPegen_expect_token(p, 18))
5904 &&
5905 (b = bitwise_xor_rule(p))
5906 )
5907 {
5908 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5909 if (token == NULL) {
5910 return NULL;
5911 }
5912 int end_lineno = token->end_lineno;
5913 UNUSED(end_lineno); // Only used by EXTRA macro
5914 int end_col_offset = token->end_col_offset;
5915 UNUSED(end_col_offset); // Only used by EXTRA macro
5916 res = _Py_BinOp ( a , BitOr , b , EXTRA );
5917 if (res == NULL && PyErr_Occurred()) {
5918 p->error_indicator = 1;
5919 return NULL;
5920 }
5921 goto done;
5922 }
5923 p->mark = mark;
5924 }
5925 { // bitwise_xor
5926 expr_ty bitwise_xor_var;
5927 if (
5928 (bitwise_xor_var = bitwise_xor_rule(p))
5929 )
5930 {
5931 res = bitwise_xor_var;
5932 goto done;
5933 }
5934 p->mark = mark;
5935 }
5936 res = NULL;
5937 done:
5938 return res;
5939}
5940
5941// Left-recursive
5942// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
5943static expr_ty bitwise_xor_raw(Parser *);
5944static expr_ty
5945bitwise_xor_rule(Parser *p)
5946{
5947 expr_ty res = NULL;
5948 if (_PyPegen_is_memoized(p, bitwise_xor_type, &res))
5949 return res;
5950 int mark = p->mark;
5951 int resmark = p->mark;
5952 while (1) {
5953 int tmpvar_2 = _PyPegen_update_memo(p, mark, bitwise_xor_type, res);
5954 if (tmpvar_2) {
5955 return res;
5956 }
5957 p->mark = mark;
5958 void *raw = bitwise_xor_raw(p);
5959 if (raw == NULL || p->mark <= resmark)
5960 break;
5961 resmark = p->mark;
5962 res = raw;
5963 }
5964 p->mark = resmark;
5965 return res;
5966}
5967static expr_ty
5968bitwise_xor_raw(Parser *p)
5969{
5970 if (p->error_indicator) {
5971 return NULL;
5972 }
5973 expr_ty res = NULL;
5974 int mark = p->mark;
5975 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5976 p->error_indicator = 1;
5977 return NULL;
5978 }
5979 int start_lineno = p->tokens[mark]->lineno;
5980 UNUSED(start_lineno); // Only used by EXTRA macro
5981 int start_col_offset = p->tokens[mark]->col_offset;
5982 UNUSED(start_col_offset); // Only used by EXTRA macro
5983 { // bitwise_xor '^' bitwise_and
5984 expr_ty a;
5985 expr_ty b;
5986 void *literal;
5987 if (
5988 (a = bitwise_xor_rule(p))
5989 &&
5990 (literal = _PyPegen_expect_token(p, 32))
5991 &&
5992 (b = bitwise_and_rule(p))
5993 )
5994 {
5995 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5996 if (token == NULL) {
5997 return NULL;
5998 }
5999 int end_lineno = token->end_lineno;
6000 UNUSED(end_lineno); // Only used by EXTRA macro
6001 int end_col_offset = token->end_col_offset;
6002 UNUSED(end_col_offset); // Only used by EXTRA macro
6003 res = _Py_BinOp ( a , BitXor , b , EXTRA );
6004 if (res == NULL && PyErr_Occurred()) {
6005 p->error_indicator = 1;
6006 return NULL;
6007 }
6008 goto done;
6009 }
6010 p->mark = mark;
6011 }
6012 { // bitwise_and
6013 expr_ty bitwise_and_var;
6014 if (
6015 (bitwise_and_var = bitwise_and_rule(p))
6016 )
6017 {
6018 res = bitwise_and_var;
6019 goto done;
6020 }
6021 p->mark = mark;
6022 }
6023 res = NULL;
6024 done:
6025 return res;
6026}
6027
6028// Left-recursive
6029// bitwise_and: bitwise_and '&' shift_expr | shift_expr
6030static expr_ty bitwise_and_raw(Parser *);
6031static expr_ty
6032bitwise_and_rule(Parser *p)
6033{
6034 expr_ty res = NULL;
6035 if (_PyPegen_is_memoized(p, bitwise_and_type, &res))
6036 return res;
6037 int mark = p->mark;
6038 int resmark = p->mark;
6039 while (1) {
6040 int tmpvar_3 = _PyPegen_update_memo(p, mark, bitwise_and_type, res);
6041 if (tmpvar_3) {
6042 return res;
6043 }
6044 p->mark = mark;
6045 void *raw = bitwise_and_raw(p);
6046 if (raw == NULL || p->mark <= resmark)
6047 break;
6048 resmark = p->mark;
6049 res = raw;
6050 }
6051 p->mark = resmark;
6052 return res;
6053}
6054static expr_ty
6055bitwise_and_raw(Parser *p)
6056{
6057 if (p->error_indicator) {
6058 return NULL;
6059 }
6060 expr_ty res = NULL;
6061 int mark = p->mark;
6062 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6063 p->error_indicator = 1;
6064 return NULL;
6065 }
6066 int start_lineno = p->tokens[mark]->lineno;
6067 UNUSED(start_lineno); // Only used by EXTRA macro
6068 int start_col_offset = p->tokens[mark]->col_offset;
6069 UNUSED(start_col_offset); // Only used by EXTRA macro
6070 { // bitwise_and '&' shift_expr
6071 expr_ty a;
6072 expr_ty b;
6073 void *literal;
6074 if (
6075 (a = bitwise_and_rule(p))
6076 &&
6077 (literal = _PyPegen_expect_token(p, 19))
6078 &&
6079 (b = shift_expr_rule(p))
6080 )
6081 {
6082 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6083 if (token == NULL) {
6084 return NULL;
6085 }
6086 int end_lineno = token->end_lineno;
6087 UNUSED(end_lineno); // Only used by EXTRA macro
6088 int end_col_offset = token->end_col_offset;
6089 UNUSED(end_col_offset); // Only used by EXTRA macro
6090 res = _Py_BinOp ( a , BitAnd , b , EXTRA );
6091 if (res == NULL && PyErr_Occurred()) {
6092 p->error_indicator = 1;
6093 return NULL;
6094 }
6095 goto done;
6096 }
6097 p->mark = mark;
6098 }
6099 { // shift_expr
6100 expr_ty shift_expr_var;
6101 if (
6102 (shift_expr_var = shift_expr_rule(p))
6103 )
6104 {
6105 res = shift_expr_var;
6106 goto done;
6107 }
6108 p->mark = mark;
6109 }
6110 res = NULL;
6111 done:
6112 return res;
6113}
6114
6115// Left-recursive
6116// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
6117static expr_ty shift_expr_raw(Parser *);
6118static expr_ty
6119shift_expr_rule(Parser *p)
6120{
6121 expr_ty res = NULL;
6122 if (_PyPegen_is_memoized(p, shift_expr_type, &res))
6123 return res;
6124 int mark = p->mark;
6125 int resmark = p->mark;
6126 while (1) {
6127 int tmpvar_4 = _PyPegen_update_memo(p, mark, shift_expr_type, res);
6128 if (tmpvar_4) {
6129 return res;
6130 }
6131 p->mark = mark;
6132 void *raw = shift_expr_raw(p);
6133 if (raw == NULL || p->mark <= resmark)
6134 break;
6135 resmark = p->mark;
6136 res = raw;
6137 }
6138 p->mark = resmark;
6139 return res;
6140}
6141static expr_ty
6142shift_expr_raw(Parser *p)
6143{
6144 if (p->error_indicator) {
6145 return NULL;
6146 }
6147 expr_ty res = NULL;
6148 int mark = p->mark;
6149 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6150 p->error_indicator = 1;
6151 return NULL;
6152 }
6153 int start_lineno = p->tokens[mark]->lineno;
6154 UNUSED(start_lineno); // Only used by EXTRA macro
6155 int start_col_offset = p->tokens[mark]->col_offset;
6156 UNUSED(start_col_offset); // Only used by EXTRA macro
6157 { // shift_expr '<<' sum
6158 expr_ty a;
6159 expr_ty b;
6160 void *literal;
6161 if (
6162 (a = shift_expr_rule(p))
6163 &&
6164 (literal = _PyPegen_expect_token(p, 33))
6165 &&
6166 (b = sum_rule(p))
6167 )
6168 {
6169 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6170 if (token == NULL) {
6171 return NULL;
6172 }
6173 int end_lineno = token->end_lineno;
6174 UNUSED(end_lineno); // Only used by EXTRA macro
6175 int end_col_offset = token->end_col_offset;
6176 UNUSED(end_col_offset); // Only used by EXTRA macro
6177 res = _Py_BinOp ( a , LShift , b , EXTRA );
6178 if (res == NULL && PyErr_Occurred()) {
6179 p->error_indicator = 1;
6180 return NULL;
6181 }
6182 goto done;
6183 }
6184 p->mark = mark;
6185 }
6186 { // shift_expr '>>' sum
6187 expr_ty a;
6188 expr_ty b;
6189 void *literal;
6190 if (
6191 (a = shift_expr_rule(p))
6192 &&
6193 (literal = _PyPegen_expect_token(p, 34))
6194 &&
6195 (b = sum_rule(p))
6196 )
6197 {
6198 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6199 if (token == NULL) {
6200 return NULL;
6201 }
6202 int end_lineno = token->end_lineno;
6203 UNUSED(end_lineno); // Only used by EXTRA macro
6204 int end_col_offset = token->end_col_offset;
6205 UNUSED(end_col_offset); // Only used by EXTRA macro
6206 res = _Py_BinOp ( a , RShift , b , EXTRA );
6207 if (res == NULL && PyErr_Occurred()) {
6208 p->error_indicator = 1;
6209 return NULL;
6210 }
6211 goto done;
6212 }
6213 p->mark = mark;
6214 }
6215 { // sum
6216 expr_ty sum_var;
6217 if (
6218 (sum_var = sum_rule(p))
6219 )
6220 {
6221 res = sum_var;
6222 goto done;
6223 }
6224 p->mark = mark;
6225 }
6226 res = NULL;
6227 done:
6228 return res;
6229}
6230
6231// Left-recursive
6232// sum: sum '+' term | sum '-' term | term
6233static expr_ty sum_raw(Parser *);
6234static expr_ty
6235sum_rule(Parser *p)
6236{
6237 expr_ty res = NULL;
6238 if (_PyPegen_is_memoized(p, sum_type, &res))
6239 return res;
6240 int mark = p->mark;
6241 int resmark = p->mark;
6242 while (1) {
6243 int tmpvar_5 = _PyPegen_update_memo(p, mark, sum_type, res);
6244 if (tmpvar_5) {
6245 return res;
6246 }
6247 p->mark = mark;
6248 void *raw = sum_raw(p);
6249 if (raw == NULL || p->mark <= resmark)
6250 break;
6251 resmark = p->mark;
6252 res = raw;
6253 }
6254 p->mark = resmark;
6255 return res;
6256}
6257static expr_ty
6258sum_raw(Parser *p)
6259{
6260 if (p->error_indicator) {
6261 return NULL;
6262 }
6263 expr_ty res = NULL;
6264 int mark = p->mark;
6265 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6266 p->error_indicator = 1;
6267 return NULL;
6268 }
6269 int start_lineno = p->tokens[mark]->lineno;
6270 UNUSED(start_lineno); // Only used by EXTRA macro
6271 int start_col_offset = p->tokens[mark]->col_offset;
6272 UNUSED(start_col_offset); // Only used by EXTRA macro
6273 { // sum '+' term
6274 expr_ty a;
6275 expr_ty b;
6276 void *literal;
6277 if (
6278 (a = sum_rule(p))
6279 &&
6280 (literal = _PyPegen_expect_token(p, 14))
6281 &&
6282 (b = term_rule(p))
6283 )
6284 {
6285 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6286 if (token == NULL) {
6287 return NULL;
6288 }
6289 int end_lineno = token->end_lineno;
6290 UNUSED(end_lineno); // Only used by EXTRA macro
6291 int end_col_offset = token->end_col_offset;
6292 UNUSED(end_col_offset); // Only used by EXTRA macro
6293 res = _Py_BinOp ( a , Add , b , EXTRA );
6294 if (res == NULL && PyErr_Occurred()) {
6295 p->error_indicator = 1;
6296 return NULL;
6297 }
6298 goto done;
6299 }
6300 p->mark = mark;
6301 }
6302 { // sum '-' term
6303 expr_ty a;
6304 expr_ty b;
6305 void *literal;
6306 if (
6307 (a = sum_rule(p))
6308 &&
6309 (literal = _PyPegen_expect_token(p, 15))
6310 &&
6311 (b = term_rule(p))
6312 )
6313 {
6314 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6315 if (token == NULL) {
6316 return NULL;
6317 }
6318 int end_lineno = token->end_lineno;
6319 UNUSED(end_lineno); // Only used by EXTRA macro
6320 int end_col_offset = token->end_col_offset;
6321 UNUSED(end_col_offset); // Only used by EXTRA macro
6322 res = _Py_BinOp ( a , Sub , b , EXTRA );
6323 if (res == NULL && PyErr_Occurred()) {
6324 p->error_indicator = 1;
6325 return NULL;
6326 }
6327 goto done;
6328 }
6329 p->mark = mark;
6330 }
6331 { // term
6332 expr_ty term_var;
6333 if (
6334 (term_var = term_rule(p))
6335 )
6336 {
6337 res = term_var;
6338 goto done;
6339 }
6340 p->mark = mark;
6341 }
6342 res = NULL;
6343 done:
6344 return res;
6345}
6346
6347// Left-recursive
6348// term:
6349// | term '*' factor
6350// | term '/' factor
6351// | term '//' factor
6352// | term '%' factor
6353// | term '@' factor
6354// | factor
6355static expr_ty term_raw(Parser *);
6356static expr_ty
6357term_rule(Parser *p)
6358{
6359 expr_ty res = NULL;
6360 if (_PyPegen_is_memoized(p, term_type, &res))
6361 return res;
6362 int mark = p->mark;
6363 int resmark = p->mark;
6364 while (1) {
6365 int tmpvar_6 = _PyPegen_update_memo(p, mark, term_type, res);
6366 if (tmpvar_6) {
6367 return res;
6368 }
6369 p->mark = mark;
6370 void *raw = term_raw(p);
6371 if (raw == NULL || p->mark <= resmark)
6372 break;
6373 resmark = p->mark;
6374 res = raw;
6375 }
6376 p->mark = resmark;
6377 return res;
6378}
6379static expr_ty
6380term_raw(Parser *p)
6381{
6382 if (p->error_indicator) {
6383 return NULL;
6384 }
6385 expr_ty res = NULL;
6386 int mark = p->mark;
6387 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6388 p->error_indicator = 1;
6389 return NULL;
6390 }
6391 int start_lineno = p->tokens[mark]->lineno;
6392 UNUSED(start_lineno); // Only used by EXTRA macro
6393 int start_col_offset = p->tokens[mark]->col_offset;
6394 UNUSED(start_col_offset); // Only used by EXTRA macro
6395 { // term '*' factor
6396 expr_ty a;
6397 expr_ty b;
6398 void *literal;
6399 if (
6400 (a = term_rule(p))
6401 &&
6402 (literal = _PyPegen_expect_token(p, 16))
6403 &&
6404 (b = factor_rule(p))
6405 )
6406 {
6407 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6408 if (token == NULL) {
6409 return NULL;
6410 }
6411 int end_lineno = token->end_lineno;
6412 UNUSED(end_lineno); // Only used by EXTRA macro
6413 int end_col_offset = token->end_col_offset;
6414 UNUSED(end_col_offset); // Only used by EXTRA macro
6415 res = _Py_BinOp ( a , Mult , b , EXTRA );
6416 if (res == NULL && PyErr_Occurred()) {
6417 p->error_indicator = 1;
6418 return NULL;
6419 }
6420 goto done;
6421 }
6422 p->mark = mark;
6423 }
6424 { // term '/' factor
6425 expr_ty a;
6426 expr_ty b;
6427 void *literal;
6428 if (
6429 (a = term_rule(p))
6430 &&
6431 (literal = _PyPegen_expect_token(p, 17))
6432 &&
6433 (b = factor_rule(p))
6434 )
6435 {
6436 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6437 if (token == NULL) {
6438 return NULL;
6439 }
6440 int end_lineno = token->end_lineno;
6441 UNUSED(end_lineno); // Only used by EXTRA macro
6442 int end_col_offset = token->end_col_offset;
6443 UNUSED(end_col_offset); // Only used by EXTRA macro
6444 res = _Py_BinOp ( a , Div , b , EXTRA );
6445 if (res == NULL && PyErr_Occurred()) {
6446 p->error_indicator = 1;
6447 return NULL;
6448 }
6449 goto done;
6450 }
6451 p->mark = mark;
6452 }
6453 { // term '//' factor
6454 expr_ty a;
6455 expr_ty b;
6456 void *literal;
6457 if (
6458 (a = term_rule(p))
6459 &&
6460 (literal = _PyPegen_expect_token(p, 47))
6461 &&
6462 (b = factor_rule(p))
6463 )
6464 {
6465 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6466 if (token == NULL) {
6467 return NULL;
6468 }
6469 int end_lineno = token->end_lineno;
6470 UNUSED(end_lineno); // Only used by EXTRA macro
6471 int end_col_offset = token->end_col_offset;
6472 UNUSED(end_col_offset); // Only used by EXTRA macro
6473 res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
6474 if (res == NULL && PyErr_Occurred()) {
6475 p->error_indicator = 1;
6476 return NULL;
6477 }
6478 goto done;
6479 }
6480 p->mark = mark;
6481 }
6482 { // term '%' factor
6483 expr_ty a;
6484 expr_ty b;
6485 void *literal;
6486 if (
6487 (a = term_rule(p))
6488 &&
6489 (literal = _PyPegen_expect_token(p, 24))
6490 &&
6491 (b = factor_rule(p))
6492 )
6493 {
6494 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6495 if (token == NULL) {
6496 return NULL;
6497 }
6498 int end_lineno = token->end_lineno;
6499 UNUSED(end_lineno); // Only used by EXTRA macro
6500 int end_col_offset = token->end_col_offset;
6501 UNUSED(end_col_offset); // Only used by EXTRA macro
6502 res = _Py_BinOp ( a , Mod , b , EXTRA );
6503 if (res == NULL && PyErr_Occurred()) {
6504 p->error_indicator = 1;
6505 return NULL;
6506 }
6507 goto done;
6508 }
6509 p->mark = mark;
6510 }
6511 { // term '@' factor
6512 expr_ty a;
6513 expr_ty b;
6514 void *literal;
6515 if (
6516 (a = term_rule(p))
6517 &&
6518 (literal = _PyPegen_expect_token(p, 49))
6519 &&
6520 (b = factor_rule(p))
6521 )
6522 {
6523 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6524 if (token == NULL) {
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_BinOp ( a , MatMult , b , EXTRA );
6532 if (res == NULL && PyErr_Occurred()) {
6533 p->error_indicator = 1;
6534 return NULL;
6535 }
6536 goto done;
6537 }
6538 p->mark = mark;
6539 }
6540 { // factor
6541 expr_ty factor_var;
6542 if (
6543 (factor_var = factor_rule(p))
6544 )
6545 {
6546 res = factor_var;
6547 goto done;
6548 }
6549 p->mark = mark;
6550 }
6551 res = NULL;
6552 done:
6553 return res;
6554}
6555
6556// factor: '+' factor | '-' factor | '~' factor | power
6557static expr_ty
6558factor_rule(Parser *p)
6559{
6560 if (p->error_indicator) {
6561 return NULL;
6562 }
6563 expr_ty res = NULL;
6564 if (_PyPegen_is_memoized(p, factor_type, &res))
6565 return res;
6566 int mark = p->mark;
6567 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6568 p->error_indicator = 1;
6569 return NULL;
6570 }
6571 int start_lineno = p->tokens[mark]->lineno;
6572 UNUSED(start_lineno); // Only used by EXTRA macro
6573 int start_col_offset = p->tokens[mark]->col_offset;
6574 UNUSED(start_col_offset); // Only used by EXTRA macro
6575 { // '+' factor
6576 expr_ty a;
6577 void *literal;
6578 if (
6579 (literal = _PyPegen_expect_token(p, 14))
6580 &&
6581 (a = factor_rule(p))
6582 )
6583 {
6584 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6585 if (token == NULL) {
6586 return NULL;
6587 }
6588 int end_lineno = token->end_lineno;
6589 UNUSED(end_lineno); // Only used by EXTRA macro
6590 int end_col_offset = token->end_col_offset;
6591 UNUSED(end_col_offset); // Only used by EXTRA macro
6592 res = _Py_UnaryOp ( UAdd , a , EXTRA );
6593 if (res == NULL && PyErr_Occurred()) {
6594 p->error_indicator = 1;
6595 return NULL;
6596 }
6597 goto done;
6598 }
6599 p->mark = mark;
6600 }
6601 { // '-' factor
6602 expr_ty a;
6603 void *literal;
6604 if (
6605 (literal = _PyPegen_expect_token(p, 15))
6606 &&
6607 (a = factor_rule(p))
6608 )
6609 {
6610 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6611 if (token == NULL) {
6612 return NULL;
6613 }
6614 int end_lineno = token->end_lineno;
6615 UNUSED(end_lineno); // Only used by EXTRA macro
6616 int end_col_offset = token->end_col_offset;
6617 UNUSED(end_col_offset); // Only used by EXTRA macro
6618 res = _Py_UnaryOp ( USub , a , EXTRA );
6619 if (res == NULL && PyErr_Occurred()) {
6620 p->error_indicator = 1;
6621 return NULL;
6622 }
6623 goto done;
6624 }
6625 p->mark = mark;
6626 }
6627 { // '~' factor
6628 expr_ty a;
6629 void *literal;
6630 if (
6631 (literal = _PyPegen_expect_token(p, 31))
6632 &&
6633 (a = factor_rule(p))
6634 )
6635 {
6636 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6637 if (token == NULL) {
6638 return NULL;
6639 }
6640 int end_lineno = token->end_lineno;
6641 UNUSED(end_lineno); // Only used by EXTRA macro
6642 int end_col_offset = token->end_col_offset;
6643 UNUSED(end_col_offset); // Only used by EXTRA macro
6644 res = _Py_UnaryOp ( Invert , a , EXTRA );
6645 if (res == NULL && PyErr_Occurred()) {
6646 p->error_indicator = 1;
6647 return NULL;
6648 }
6649 goto done;
6650 }
6651 p->mark = mark;
6652 }
6653 { // power
6654 expr_ty power_var;
6655 if (
6656 (power_var = power_rule(p))
6657 )
6658 {
6659 res = power_var;
6660 goto done;
6661 }
6662 p->mark = mark;
6663 }
6664 res = NULL;
6665 done:
6666 _PyPegen_insert_memo(p, mark, factor_type, res);
6667 return res;
6668}
6669
6670// power: await_primary '**' factor | await_primary
6671static expr_ty
6672power_rule(Parser *p)
6673{
6674 if (p->error_indicator) {
6675 return NULL;
6676 }
6677 expr_ty res = NULL;
6678 int mark = p->mark;
6679 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6680 p->error_indicator = 1;
6681 return NULL;
6682 }
6683 int start_lineno = p->tokens[mark]->lineno;
6684 UNUSED(start_lineno); // Only used by EXTRA macro
6685 int start_col_offset = p->tokens[mark]->col_offset;
6686 UNUSED(start_col_offset); // Only used by EXTRA macro
6687 { // await_primary '**' factor
6688 expr_ty a;
6689 expr_ty b;
6690 void *literal;
6691 if (
6692 (a = await_primary_rule(p))
6693 &&
6694 (literal = _PyPegen_expect_token(p, 35))
6695 &&
6696 (b = factor_rule(p))
6697 )
6698 {
6699 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6700 if (token == NULL) {
6701 return NULL;
6702 }
6703 int end_lineno = token->end_lineno;
6704 UNUSED(end_lineno); // Only used by EXTRA macro
6705 int end_col_offset = token->end_col_offset;
6706 UNUSED(end_col_offset); // Only used by EXTRA macro
6707 res = _Py_BinOp ( a , Pow , b , EXTRA );
6708 if (res == NULL && PyErr_Occurred()) {
6709 p->error_indicator = 1;
6710 return NULL;
6711 }
6712 goto done;
6713 }
6714 p->mark = mark;
6715 }
6716 { // await_primary
6717 expr_ty await_primary_var;
6718 if (
6719 (await_primary_var = await_primary_rule(p))
6720 )
6721 {
6722 res = await_primary_var;
6723 goto done;
6724 }
6725 p->mark = mark;
6726 }
6727 res = NULL;
6728 done:
6729 return res;
6730}
6731
6732// await_primary: AWAIT primary | primary
6733static expr_ty
6734await_primary_rule(Parser *p)
6735{
6736 if (p->error_indicator) {
6737 return NULL;
6738 }
6739 expr_ty res = NULL;
6740 if (_PyPegen_is_memoized(p, await_primary_type, &res))
6741 return res;
6742 int mark = p->mark;
6743 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6744 p->error_indicator = 1;
6745 return NULL;
6746 }
6747 int start_lineno = p->tokens[mark]->lineno;
6748 UNUSED(start_lineno); // Only used by EXTRA macro
6749 int start_col_offset = p->tokens[mark]->col_offset;
6750 UNUSED(start_col_offset); // Only used by EXTRA macro
6751 { // AWAIT primary
6752 expr_ty a;
6753 void *await_var;
6754 if (
6755 (await_var = _PyPegen_await_token(p))
6756 &&
6757 (a = primary_rule(p))
6758 )
6759 {
6760 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6761 if (token == NULL) {
6762 return NULL;
6763 }
6764 int end_lineno = token->end_lineno;
6765 UNUSED(end_lineno); // Only used by EXTRA macro
6766 int end_col_offset = token->end_col_offset;
6767 UNUSED(end_col_offset); // Only used by EXTRA macro
6768 res = _Py_Await ( a , EXTRA );
6769 if (res == NULL && PyErr_Occurred()) {
6770 p->error_indicator = 1;
6771 return NULL;
6772 }
6773 goto done;
6774 }
6775 p->mark = mark;
6776 }
6777 { // primary
6778 expr_ty primary_var;
6779 if (
6780 (primary_var = primary_rule(p))
6781 )
6782 {
6783 res = primary_var;
6784 goto done;
6785 }
6786 p->mark = mark;
6787 }
6788 res = NULL;
6789 done:
6790 _PyPegen_insert_memo(p, mark, await_primary_type, res);
6791 return res;
6792}
6793
6794// Left-recursive
6795// primary:
6796// | primary '.' NAME
6797// | primary genexp
6798// | primary '(' arguments? ')'
6799// | primary '[' slices ']'
6800// | atom
6801static expr_ty primary_raw(Parser *);
6802static expr_ty
6803primary_rule(Parser *p)
6804{
6805 expr_ty res = NULL;
6806 if (_PyPegen_is_memoized(p, primary_type, &res))
6807 return res;
6808 int mark = p->mark;
6809 int resmark = p->mark;
6810 while (1) {
6811 int tmpvar_7 = _PyPegen_update_memo(p, mark, primary_type, res);
6812 if (tmpvar_7) {
6813 return res;
6814 }
6815 p->mark = mark;
6816 void *raw = primary_raw(p);
6817 if (raw == NULL || p->mark <= resmark)
6818 break;
6819 resmark = p->mark;
6820 res = raw;
6821 }
6822 p->mark = resmark;
6823 return res;
6824}
6825static expr_ty
6826primary_raw(Parser *p)
6827{
6828 if (p->error_indicator) {
6829 return NULL;
6830 }
6831 expr_ty res = NULL;
6832 int mark = p->mark;
6833 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6834 p->error_indicator = 1;
6835 return NULL;
6836 }
6837 int start_lineno = p->tokens[mark]->lineno;
6838 UNUSED(start_lineno); // Only used by EXTRA macro
6839 int start_col_offset = p->tokens[mark]->col_offset;
6840 UNUSED(start_col_offset); // Only used by EXTRA macro
6841 { // primary '.' NAME
6842 expr_ty a;
6843 expr_ty b;
6844 void *literal;
6845 if (
6846 (a = primary_rule(p))
6847 &&
6848 (literal = _PyPegen_expect_token(p, 23))
6849 &&
6850 (b = _PyPegen_name_token(p))
6851 )
6852 {
6853 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6854 if (token == NULL) {
6855 return NULL;
6856 }
6857 int end_lineno = token->end_lineno;
6858 UNUSED(end_lineno); // Only used by EXTRA macro
6859 int end_col_offset = token->end_col_offset;
6860 UNUSED(end_col_offset); // Only used by EXTRA macro
6861 res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
6862 if (res == NULL && PyErr_Occurred()) {
6863 p->error_indicator = 1;
6864 return NULL;
6865 }
6866 goto done;
6867 }
6868 p->mark = mark;
6869 }
6870 { // primary genexp
6871 expr_ty a;
6872 expr_ty b;
6873 if (
6874 (a = primary_rule(p))
6875 &&
6876 (b = genexp_rule(p))
6877 )
6878 {
6879 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6880 if (token == NULL) {
6881 return NULL;
6882 }
6883 int end_lineno = token->end_lineno;
6884 UNUSED(end_lineno); // Only used by EXTRA macro
6885 int end_col_offset = token->end_col_offset;
6886 UNUSED(end_col_offset); // Only used by EXTRA macro
6887 res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
6888 if (res == NULL && PyErr_Occurred()) {
6889 p->error_indicator = 1;
6890 return NULL;
6891 }
6892 goto done;
6893 }
6894 p->mark = mark;
6895 }
6896 { // primary '(' arguments? ')'
6897 expr_ty a;
6898 void *b;
6899 void *literal;
6900 void *literal_1;
6901 if (
6902 (a = primary_rule(p))
6903 &&
6904 (literal = _PyPegen_expect_token(p, 7))
6905 &&
6906 (b = arguments_rule(p), 1)
6907 &&
6908 (literal_1 = _PyPegen_expect_token(p, 8))
6909 )
6910 {
6911 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6912 if (token == NULL) {
6913 return NULL;
6914 }
6915 int end_lineno = token->end_lineno;
6916 UNUSED(end_lineno); // Only used by EXTRA macro
6917 int end_col_offset = token->end_col_offset;
6918 UNUSED(end_col_offset); // Only used by EXTRA macro
6919 res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
6920 if (res == NULL && PyErr_Occurred()) {
6921 p->error_indicator = 1;
6922 return NULL;
6923 }
6924 goto done;
6925 }
6926 p->mark = mark;
6927 }
6928 { // primary '[' slices ']'
6929 expr_ty a;
6930 expr_ty b;
6931 void *literal;
6932 void *literal_1;
6933 if (
6934 (a = primary_rule(p))
6935 &&
6936 (literal = _PyPegen_expect_token(p, 9))
6937 &&
6938 (b = slices_rule(p))
6939 &&
6940 (literal_1 = _PyPegen_expect_token(p, 10))
6941 )
6942 {
6943 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6944 if (token == NULL) {
6945 return NULL;
6946 }
6947 int end_lineno = token->end_lineno;
6948 UNUSED(end_lineno); // Only used by EXTRA macro
6949 int end_col_offset = token->end_col_offset;
6950 UNUSED(end_col_offset); // Only used by EXTRA macro
6951 res = _Py_Subscript ( a , b , Load , EXTRA );
6952 if (res == NULL && PyErr_Occurred()) {
6953 p->error_indicator = 1;
6954 return NULL;
6955 }
6956 goto done;
6957 }
6958 p->mark = mark;
6959 }
6960 { // atom
6961 expr_ty atom_var;
6962 if (
6963 (atom_var = atom_rule(p))
6964 )
6965 {
6966 res = atom_var;
6967 goto done;
6968 }
6969 p->mark = mark;
6970 }
6971 res = NULL;
6972 done:
6973 return res;
6974}
6975
6976// slices: slice !',' | ','.slice+ ','?
6977static expr_ty
6978slices_rule(Parser *p)
6979{
6980 if (p->error_indicator) {
6981 return NULL;
6982 }
6983 expr_ty res = NULL;
6984 int mark = p->mark;
6985 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6986 p->error_indicator = 1;
6987 return NULL;
6988 }
6989 int start_lineno = p->tokens[mark]->lineno;
6990 UNUSED(start_lineno); // Only used by EXTRA macro
6991 int start_col_offset = p->tokens[mark]->col_offset;
6992 UNUSED(start_col_offset); // Only used by EXTRA macro
6993 { // slice !','
6994 expr_ty a;
6995 if (
6996 (a = slice_rule(p))
6997 &&
6998 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)
6999 )
7000 {
7001 res = a;
7002 if (res == NULL && PyErr_Occurred()) {
7003 p->error_indicator = 1;
7004 return NULL;
7005 }
7006 goto done;
7007 }
7008 p->mark = mark;
7009 }
7010 { // ','.slice+ ','?
7011 asdl_seq * a;
7012 void *opt_var;
7013 UNUSED(opt_var); // Silence compiler warnings
7014 if (
7015 (a = _gather_86_rule(p))
7016 &&
7017 (opt_var = _PyPegen_expect_token(p, 12), 1)
7018 )
7019 {
7020 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7021 if (token == NULL) {
7022 return NULL;
7023 }
7024 int end_lineno = token->end_lineno;
7025 UNUSED(end_lineno); // Only used by EXTRA macro
7026 int end_col_offset = token->end_col_offset;
7027 UNUSED(end_col_offset); // Only used by EXTRA macro
7028 res = _Py_Tuple ( a , Load , EXTRA );
7029 if (res == NULL && PyErr_Occurred()) {
7030 p->error_indicator = 1;
7031 return NULL;
7032 }
7033 goto done;
7034 }
7035 p->mark = mark;
7036 }
7037 res = NULL;
7038 done:
7039 return res;
7040}
7041
7042// slice: expression? ':' expression? [':' expression?] | expression
7043static expr_ty
7044slice_rule(Parser *p)
7045{
7046 if (p->error_indicator) {
7047 return NULL;
7048 }
7049 expr_ty res = NULL;
7050 int mark = p->mark;
7051 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7052 p->error_indicator = 1;
7053 return NULL;
7054 }
7055 int start_lineno = p->tokens[mark]->lineno;
7056 UNUSED(start_lineno); // Only used by EXTRA macro
7057 int start_col_offset = p->tokens[mark]->col_offset;
7058 UNUSED(start_col_offset); // Only used by EXTRA macro
7059 { // expression? ':' expression? [':' expression?]
7060 void *a;
7061 void *b;
7062 void *c;
7063 void *literal;
7064 if (
7065 (a = expression_rule(p), 1)
7066 &&
7067 (literal = _PyPegen_expect_token(p, 11))
7068 &&
7069 (b = expression_rule(p), 1)
7070 &&
7071 (c = _tmp_88_rule(p), 1)
7072 )
7073 {
7074 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7075 if (token == NULL) {
7076 return NULL;
7077 }
7078 int end_lineno = token->end_lineno;
7079 UNUSED(end_lineno); // Only used by EXTRA macro
7080 int end_col_offset = token->end_col_offset;
7081 UNUSED(end_col_offset); // Only used by EXTRA macro
7082 res = _Py_Slice ( a , b , c , EXTRA );
7083 if (res == NULL && PyErr_Occurred()) {
7084 p->error_indicator = 1;
7085 return NULL;
7086 }
7087 goto done;
7088 }
7089 p->mark = mark;
7090 }
7091 { // expression
7092 expr_ty a;
7093 if (
7094 (a = expression_rule(p))
7095 )
7096 {
7097 res = a;
7098 if (res == NULL && PyErr_Occurred()) {
7099 p->error_indicator = 1;
7100 return NULL;
7101 }
7102 goto done;
7103 }
7104 p->mark = mark;
7105 }
7106 res = NULL;
7107 done:
7108 return res;
7109}
7110
7111// atom:
7112// | NAME
7113// | 'True'
7114// | 'False'
7115// | 'None'
7116// | '__new_parser__'
7117// | &STRING strings
7118// | NUMBER
7119// | &'(' (tuple | group | genexp)
7120// | &'[' (list | listcomp)
7121// | &'{' (dict | set | dictcomp | setcomp)
7122// | '...'
7123static expr_ty
7124atom_rule(Parser *p)
7125{
7126 if (p->error_indicator) {
7127 return NULL;
7128 }
7129 expr_ty res = NULL;
7130 int mark = p->mark;
7131 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7132 p->error_indicator = 1;
7133 return NULL;
7134 }
7135 int start_lineno = p->tokens[mark]->lineno;
7136 UNUSED(start_lineno); // Only used by EXTRA macro
7137 int start_col_offset = p->tokens[mark]->col_offset;
7138 UNUSED(start_col_offset); // Only used by EXTRA macro
7139 { // NAME
7140 expr_ty name_var;
7141 if (
7142 (name_var = _PyPegen_name_token(p))
7143 )
7144 {
7145 res = name_var;
7146 goto done;
7147 }
7148 p->mark = mark;
7149 }
7150 { // 'True'
7151 void *keyword;
7152 if (
7153 (keyword = _PyPegen_expect_token(p, 527))
7154 )
7155 {
7156 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7157 if (token == NULL) {
7158 return NULL;
7159 }
7160 int end_lineno = token->end_lineno;
7161 UNUSED(end_lineno); // Only used by EXTRA macro
7162 int end_col_offset = token->end_col_offset;
7163 UNUSED(end_col_offset); // Only used by EXTRA macro
7164 res = _Py_Constant ( Py_True , NULL , EXTRA );
7165 if (res == NULL && PyErr_Occurred()) {
7166 p->error_indicator = 1;
7167 return NULL;
7168 }
7169 goto done;
7170 }
7171 p->mark = mark;
7172 }
7173 { // 'False'
7174 void *keyword;
7175 if (
7176 (keyword = _PyPegen_expect_token(p, 528))
7177 )
7178 {
7179 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7180 if (token == NULL) {
7181 return NULL;
7182 }
7183 int end_lineno = token->end_lineno;
7184 UNUSED(end_lineno); // Only used by EXTRA macro
7185 int end_col_offset = token->end_col_offset;
7186 UNUSED(end_col_offset); // Only used by EXTRA macro
7187 res = _Py_Constant ( Py_False , NULL , EXTRA );
7188 if (res == NULL && PyErr_Occurred()) {
7189 p->error_indicator = 1;
7190 return NULL;
7191 }
7192 goto done;
7193 }
7194 p->mark = mark;
7195 }
7196 { // 'None'
7197 void *keyword;
7198 if (
7199 (keyword = _PyPegen_expect_token(p, 529))
7200 )
7201 {
7202 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7203 if (token == NULL) {
7204 return NULL;
7205 }
7206 int end_lineno = token->end_lineno;
7207 UNUSED(end_lineno); // Only used by EXTRA macro
7208 int end_col_offset = token->end_col_offset;
7209 UNUSED(end_col_offset); // Only used by EXTRA macro
7210 res = _Py_Constant ( Py_None , NULL , EXTRA );
7211 if (res == NULL && PyErr_Occurred()) {
7212 p->error_indicator = 1;
7213 return NULL;
7214 }
7215 goto done;
7216 }
7217 p->mark = mark;
7218 }
7219 { // '__new_parser__'
7220 void *keyword;
7221 if (
7222 (keyword = _PyPegen_expect_token(p, 530))
7223 )
7224 {
7225 res = RAISE_SYNTAX_ERROR ( "You found it!" );
7226 if (res == NULL && PyErr_Occurred()) {
7227 p->error_indicator = 1;
7228 return NULL;
7229 }
7230 goto done;
7231 }
7232 p->mark = mark;
7233 }
7234 { // &STRING strings
7235 expr_ty strings_var;
7236 if (
7237 _PyPegen_lookahead(1, _PyPegen_string_token, p)
7238 &&
7239 (strings_var = strings_rule(p))
7240 )
7241 {
7242 res = strings_var;
7243 goto done;
7244 }
7245 p->mark = mark;
7246 }
7247 { // NUMBER
7248 expr_ty number_var;
7249 if (
7250 (number_var = _PyPegen_number_token(p))
7251 )
7252 {
7253 res = number_var;
7254 goto done;
7255 }
7256 p->mark = mark;
7257 }
7258 { // &'(' (tuple | group | genexp)
7259 void *_tmp_89_var;
7260 if (
7261 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7)
7262 &&
7263 (_tmp_89_var = _tmp_89_rule(p))
7264 )
7265 {
7266 res = _tmp_89_var;
7267 goto done;
7268 }
7269 p->mark = mark;
7270 }
7271 { // &'[' (list | listcomp)
7272 void *_tmp_90_var;
7273 if (
7274 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9)
7275 &&
7276 (_tmp_90_var = _tmp_90_rule(p))
7277 )
7278 {
7279 res = _tmp_90_var;
7280 goto done;
7281 }
7282 p->mark = mark;
7283 }
7284 { // &'{' (dict | set | dictcomp | setcomp)
7285 void *_tmp_91_var;
7286 if (
7287 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25)
7288 &&
7289 (_tmp_91_var = _tmp_91_rule(p))
7290 )
7291 {
7292 res = _tmp_91_var;
7293 goto done;
7294 }
7295 p->mark = mark;
7296 }
7297 { // '...'
7298 void *literal;
7299 if (
7300 (literal = _PyPegen_expect_token(p, 52))
7301 )
7302 {
7303 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7304 if (token == NULL) {
7305 return NULL;
7306 }
7307 int end_lineno = token->end_lineno;
7308 UNUSED(end_lineno); // Only used by EXTRA macro
7309 int end_col_offset = token->end_col_offset;
7310 UNUSED(end_col_offset); // Only used by EXTRA macro
7311 res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
7312 if (res == NULL && PyErr_Occurred()) {
7313 p->error_indicator = 1;
7314 return NULL;
7315 }
7316 goto done;
7317 }
7318 p->mark = mark;
7319 }
7320 res = NULL;
7321 done:
7322 return res;
7323}
7324
7325// strings: STRING+
7326static expr_ty
7327strings_rule(Parser *p)
7328{
7329 if (p->error_indicator) {
7330 return NULL;
7331 }
7332 expr_ty res = NULL;
7333 if (_PyPegen_is_memoized(p, strings_type, &res))
7334 return res;
7335 int mark = p->mark;
7336 { // STRING+
7337 asdl_seq * a;
7338 if (
7339 (a = _loop1_92_rule(p))
7340 )
7341 {
7342 res = _PyPegen_concatenate_strings ( p , a );
7343 if (res == NULL && PyErr_Occurred()) {
7344 p->error_indicator = 1;
7345 return NULL;
7346 }
7347 goto done;
7348 }
7349 p->mark = mark;
7350 }
7351 res = NULL;
7352 done:
7353 _PyPegen_insert_memo(p, mark, strings_type, res);
7354 return res;
7355}
7356
7357// list: '[' star_named_expressions? ']'
7358static expr_ty
7359list_rule(Parser *p)
7360{
7361 if (p->error_indicator) {
7362 return NULL;
7363 }
7364 expr_ty res = NULL;
7365 int mark = p->mark;
7366 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7367 p->error_indicator = 1;
7368 return NULL;
7369 }
7370 int start_lineno = p->tokens[mark]->lineno;
7371 UNUSED(start_lineno); // Only used by EXTRA macro
7372 int start_col_offset = p->tokens[mark]->col_offset;
7373 UNUSED(start_col_offset); // Only used by EXTRA macro
7374 { // '[' star_named_expressions? ']'
7375 void *a;
7376 void *literal;
7377 void *literal_1;
7378 if (
7379 (literal = _PyPegen_expect_token(p, 9))
7380 &&
7381 (a = star_named_expressions_rule(p), 1)
7382 &&
7383 (literal_1 = _PyPegen_expect_token(p, 10))
7384 )
7385 {
7386 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7387 if (token == NULL) {
7388 return NULL;
7389 }
7390 int end_lineno = token->end_lineno;
7391 UNUSED(end_lineno); // Only used by EXTRA macro
7392 int end_col_offset = token->end_col_offset;
7393 UNUSED(end_col_offset); // Only used by EXTRA macro
7394 res = _Py_List ( a , Load , EXTRA );
7395 if (res == NULL && PyErr_Occurred()) {
7396 p->error_indicator = 1;
7397 return NULL;
7398 }
7399 goto done;
7400 }
7401 p->mark = mark;
7402 }
7403 res = NULL;
7404 done:
7405 return res;
7406}
7407
7408// listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension
7409static expr_ty
7410listcomp_rule(Parser *p)
7411{
7412 if (p->error_indicator) {
7413 return NULL;
7414 }
7415 expr_ty res = NULL;
7416 int mark = p->mark;
7417 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7418 p->error_indicator = 1;
7419 return NULL;
7420 }
7421 int start_lineno = p->tokens[mark]->lineno;
7422 UNUSED(start_lineno); // Only used by EXTRA macro
7423 int start_col_offset = p->tokens[mark]->col_offset;
7424 UNUSED(start_col_offset); // Only used by EXTRA macro
7425 { // '[' named_expression for_if_clauses ']'
7426 expr_ty a;
7427 asdl_seq* b;
7428 void *literal;
7429 void *literal_1;
7430 if (
7431 (literal = _PyPegen_expect_token(p, 9))
7432 &&
7433 (a = named_expression_rule(p))
7434 &&
7435 (b = for_if_clauses_rule(p))
7436 &&
7437 (literal_1 = _PyPegen_expect_token(p, 10))
7438 )
7439 {
7440 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7441 if (token == NULL) {
7442 return NULL;
7443 }
7444 int end_lineno = token->end_lineno;
7445 UNUSED(end_lineno); // Only used by EXTRA macro
7446 int end_col_offset = token->end_col_offset;
7447 UNUSED(end_col_offset); // Only used by EXTRA macro
7448 res = _Py_ListComp ( a , b , EXTRA );
7449 if (res == NULL && PyErr_Occurred()) {
7450 p->error_indicator = 1;
7451 return NULL;
7452 }
7453 goto done;
7454 }
7455 p->mark = mark;
7456 }
7457 { // invalid_comprehension
7458 void *invalid_comprehension_var;
7459 if (
7460 (invalid_comprehension_var = invalid_comprehension_rule(p))
7461 )
7462 {
7463 res = invalid_comprehension_var;
7464 goto done;
7465 }
7466 p->mark = mark;
7467 }
7468 res = NULL;
7469 done:
7470 return res;
7471}
7472
7473// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
7474static expr_ty
7475tuple_rule(Parser *p)
7476{
7477 if (p->error_indicator) {
7478 return NULL;
7479 }
7480 expr_ty res = NULL;
7481 int mark = p->mark;
7482 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7483 p->error_indicator = 1;
7484 return NULL;
7485 }
7486 int start_lineno = p->tokens[mark]->lineno;
7487 UNUSED(start_lineno); // Only used by EXTRA macro
7488 int start_col_offset = p->tokens[mark]->col_offset;
7489 UNUSED(start_col_offset); // Only used by EXTRA macro
7490 { // '(' [star_named_expression ',' star_named_expressions?] ')'
7491 void *a;
7492 void *literal;
7493 void *literal_1;
7494 if (
7495 (literal = _PyPegen_expect_token(p, 7))
7496 &&
7497 (a = _tmp_93_rule(p), 1)
7498 &&
7499 (literal_1 = _PyPegen_expect_token(p, 8))
7500 )
7501 {
7502 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7503 if (token == NULL) {
7504 return NULL;
7505 }
7506 int end_lineno = token->end_lineno;
7507 UNUSED(end_lineno); // Only used by EXTRA macro
7508 int end_col_offset = token->end_col_offset;
7509 UNUSED(end_col_offset); // Only used by EXTRA macro
7510 res = _Py_Tuple ( a , Load , EXTRA );
7511 if (res == NULL && PyErr_Occurred()) {
7512 p->error_indicator = 1;
7513 return NULL;
7514 }
7515 goto done;
7516 }
7517 p->mark = mark;
7518 }
7519 res = NULL;
7520 done:
7521 return res;
7522}
7523
7524// group: '(' (yield_expr | named_expression) ')'
7525static expr_ty
7526group_rule(Parser *p)
7527{
7528 if (p->error_indicator) {
7529 return NULL;
7530 }
7531 expr_ty res = NULL;
7532 int mark = p->mark;
7533 { // '(' (yield_expr | named_expression) ')'
7534 void *a;
7535 void *literal;
7536 void *literal_1;
7537 if (
7538 (literal = _PyPegen_expect_token(p, 7))
7539 &&
7540 (a = _tmp_94_rule(p))
7541 &&
7542 (literal_1 = _PyPegen_expect_token(p, 8))
7543 )
7544 {
7545 res = a;
7546 if (res == NULL && PyErr_Occurred()) {
7547 p->error_indicator = 1;
7548 return NULL;
7549 }
7550 goto done;
7551 }
7552 p->mark = mark;
7553 }
7554 res = NULL;
7555 done:
7556 return res;
7557}
7558
7559// genexp: '(' expression for_if_clauses ')' | invalid_comprehension
7560static expr_ty
7561genexp_rule(Parser *p)
7562{
7563 if (p->error_indicator) {
7564 return NULL;
7565 }
7566 expr_ty res = NULL;
7567 int mark = p->mark;
7568 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7569 p->error_indicator = 1;
7570 return NULL;
7571 }
7572 int start_lineno = p->tokens[mark]->lineno;
7573 UNUSED(start_lineno); // Only used by EXTRA macro
7574 int start_col_offset = p->tokens[mark]->col_offset;
7575 UNUSED(start_col_offset); // Only used by EXTRA macro
7576 { // '(' expression for_if_clauses ')'
7577 expr_ty a;
7578 asdl_seq* b;
7579 void *literal;
7580 void *literal_1;
7581 if (
7582 (literal = _PyPegen_expect_token(p, 7))
7583 &&
7584 (a = expression_rule(p))
7585 &&
7586 (b = for_if_clauses_rule(p))
7587 &&
7588 (literal_1 = _PyPegen_expect_token(p, 8))
7589 )
7590 {
7591 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7592 if (token == NULL) {
7593 return NULL;
7594 }
7595 int end_lineno = token->end_lineno;
7596 UNUSED(end_lineno); // Only used by EXTRA macro
7597 int end_col_offset = token->end_col_offset;
7598 UNUSED(end_col_offset); // Only used by EXTRA macro
7599 res = _Py_GeneratorExp ( a , b , EXTRA );
7600 if (res == NULL && PyErr_Occurred()) {
7601 p->error_indicator = 1;
7602 return NULL;
7603 }
7604 goto done;
7605 }
7606 p->mark = mark;
7607 }
7608 { // invalid_comprehension
7609 void *invalid_comprehension_var;
7610 if (
7611 (invalid_comprehension_var = invalid_comprehension_rule(p))
7612 )
7613 {
7614 res = invalid_comprehension_var;
7615 goto done;
7616 }
7617 p->mark = mark;
7618 }
7619 res = NULL;
7620 done:
7621 return res;
7622}
7623
7624// set: '{' expressions_list '}'
7625static expr_ty
7626set_rule(Parser *p)
7627{
7628 if (p->error_indicator) {
7629 return NULL;
7630 }
7631 expr_ty res = NULL;
7632 int mark = p->mark;
7633 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7634 p->error_indicator = 1;
7635 return NULL;
7636 }
7637 int start_lineno = p->tokens[mark]->lineno;
7638 UNUSED(start_lineno); // Only used by EXTRA macro
7639 int start_col_offset = p->tokens[mark]->col_offset;
7640 UNUSED(start_col_offset); // Only used by EXTRA macro
7641 { // '{' expressions_list '}'
7642 asdl_seq* a;
7643 void *literal;
7644 void *literal_1;
7645 if (
7646 (literal = _PyPegen_expect_token(p, 25))
7647 &&
7648 (a = expressions_list_rule(p))
7649 &&
7650 (literal_1 = _PyPegen_expect_token(p, 26))
7651 )
7652 {
7653 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7654 if (token == NULL) {
7655 return NULL;
7656 }
7657 int end_lineno = token->end_lineno;
7658 UNUSED(end_lineno); // Only used by EXTRA macro
7659 int end_col_offset = token->end_col_offset;
7660 UNUSED(end_col_offset); // Only used by EXTRA macro
7661 res = _Py_Set ( a , EXTRA );
7662 if (res == NULL && PyErr_Occurred()) {
7663 p->error_indicator = 1;
7664 return NULL;
7665 }
7666 goto done;
7667 }
7668 p->mark = mark;
7669 }
7670 res = NULL;
7671 done:
7672 return res;
7673}
7674
7675// setcomp: '{' expression for_if_clauses '}' | invalid_comprehension
7676static expr_ty
7677setcomp_rule(Parser *p)
7678{
7679 if (p->error_indicator) {
7680 return NULL;
7681 }
7682 expr_ty res = NULL;
7683 int mark = p->mark;
7684 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7685 p->error_indicator = 1;
7686 return NULL;
7687 }
7688 int start_lineno = p->tokens[mark]->lineno;
7689 UNUSED(start_lineno); // Only used by EXTRA macro
7690 int start_col_offset = p->tokens[mark]->col_offset;
7691 UNUSED(start_col_offset); // Only used by EXTRA macro
7692 { // '{' expression for_if_clauses '}'
7693 expr_ty a;
7694 asdl_seq* b;
7695 void *literal;
7696 void *literal_1;
7697 if (
7698 (literal = _PyPegen_expect_token(p, 25))
7699 &&
7700 (a = expression_rule(p))
7701 &&
7702 (b = for_if_clauses_rule(p))
7703 &&
7704 (literal_1 = _PyPegen_expect_token(p, 26))
7705 )
7706 {
7707 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7708 if (token == NULL) {
7709 return NULL;
7710 }
7711 int end_lineno = token->end_lineno;
7712 UNUSED(end_lineno); // Only used by EXTRA macro
7713 int end_col_offset = token->end_col_offset;
7714 UNUSED(end_col_offset); // Only used by EXTRA macro
7715 res = _Py_SetComp ( a , b , EXTRA );
7716 if (res == NULL && PyErr_Occurred()) {
7717 p->error_indicator = 1;
7718 return NULL;
7719 }
7720 goto done;
7721 }
7722 p->mark = mark;
7723 }
7724 { // invalid_comprehension
7725 void *invalid_comprehension_var;
7726 if (
7727 (invalid_comprehension_var = invalid_comprehension_rule(p))
7728 )
7729 {
7730 res = invalid_comprehension_var;
7731 goto done;
7732 }
7733 p->mark = mark;
7734 }
7735 res = NULL;
7736 done:
7737 return res;
7738}
7739
7740// dict: '{' kvpairs? '}'
7741static expr_ty
7742dict_rule(Parser *p)
7743{
7744 if (p->error_indicator) {
7745 return NULL;
7746 }
7747 expr_ty res = NULL;
7748 int mark = p->mark;
7749 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7750 p->error_indicator = 1;
7751 return NULL;
7752 }
7753 int start_lineno = p->tokens[mark]->lineno;
7754 UNUSED(start_lineno); // Only used by EXTRA macro
7755 int start_col_offset = p->tokens[mark]->col_offset;
7756 UNUSED(start_col_offset); // Only used by EXTRA macro
7757 { // '{' kvpairs? '}'
7758 void *a;
7759 void *literal;
7760 void *literal_1;
7761 if (
7762 (literal = _PyPegen_expect_token(p, 25))
7763 &&
7764 (a = kvpairs_rule(p), 1)
7765 &&
7766 (literal_1 = _PyPegen_expect_token(p, 26))
7767 )
7768 {
7769 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7770 if (token == NULL) {
7771 return NULL;
7772 }
7773 int end_lineno = token->end_lineno;
7774 UNUSED(end_lineno); // Only used by EXTRA macro
7775 int end_col_offset = token->end_col_offset;
7776 UNUSED(end_col_offset); // Only used by EXTRA macro
7777 res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA );
7778 if (res == NULL && PyErr_Occurred()) {
7779 p->error_indicator = 1;
7780 return NULL;
7781 }
7782 goto done;
7783 }
7784 p->mark = mark;
7785 }
7786 res = NULL;
7787 done:
7788 return res;
7789}
7790
7791// dictcomp: '{' kvpair for_if_clauses '}'
7792static expr_ty
7793dictcomp_rule(Parser *p)
7794{
7795 if (p->error_indicator) {
7796 return NULL;
7797 }
7798 expr_ty res = NULL;
7799 int mark = p->mark;
7800 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7801 p->error_indicator = 1;
7802 return NULL;
7803 }
7804 int start_lineno = p->tokens[mark]->lineno;
7805 UNUSED(start_lineno); // Only used by EXTRA macro
7806 int start_col_offset = p->tokens[mark]->col_offset;
7807 UNUSED(start_col_offset); // Only used by EXTRA macro
7808 { // '{' kvpair for_if_clauses '}'
7809 KeyValuePair* a;
7810 asdl_seq* b;
7811 void *literal;
7812 void *literal_1;
7813 if (
7814 (literal = _PyPegen_expect_token(p, 25))
7815 &&
7816 (a = kvpair_rule(p))
7817 &&
7818 (b = for_if_clauses_rule(p))
7819 &&
7820 (literal_1 = _PyPegen_expect_token(p, 26))
7821 )
7822 {
7823 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7824 if (token == NULL) {
7825 return NULL;
7826 }
7827 int end_lineno = token->end_lineno;
7828 UNUSED(end_lineno); // Only used by EXTRA macro
7829 int end_col_offset = token->end_col_offset;
7830 UNUSED(end_col_offset); // Only used by EXTRA macro
7831 res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
7832 if (res == NULL && PyErr_Occurred()) {
7833 p->error_indicator = 1;
7834 return NULL;
7835 }
7836 goto done;
7837 }
7838 p->mark = mark;
7839 }
7840 res = NULL;
7841 done:
7842 return res;
7843}
7844
7845// kvpairs: ','.kvpair+ ','?
7846static asdl_seq*
7847kvpairs_rule(Parser *p)
7848{
7849 if (p->error_indicator) {
7850 return NULL;
7851 }
7852 asdl_seq* res = NULL;
7853 int mark = p->mark;
7854 { // ','.kvpair+ ','?
7855 asdl_seq * a;
7856 void *opt_var;
7857 UNUSED(opt_var); // Silence compiler warnings
7858 if (
7859 (a = _gather_95_rule(p))
7860 &&
7861 (opt_var = _PyPegen_expect_token(p, 12), 1)
7862 )
7863 {
7864 res = a;
7865 if (res == NULL && PyErr_Occurred()) {
7866 p->error_indicator = 1;
7867 return NULL;
7868 }
7869 goto done;
7870 }
7871 p->mark = mark;
7872 }
7873 res = NULL;
7874 done:
7875 return res;
7876}
7877
7878// kvpair: '**' bitwise_or | expression ':' expression
7879static KeyValuePair*
7880kvpair_rule(Parser *p)
7881{
7882 if (p->error_indicator) {
7883 return NULL;
7884 }
7885 KeyValuePair* res = NULL;
7886 int mark = p->mark;
7887 { // '**' bitwise_or
7888 expr_ty a;
7889 void *literal;
7890 if (
7891 (literal = _PyPegen_expect_token(p, 35))
7892 &&
7893 (a = bitwise_or_rule(p))
7894 )
7895 {
7896 res = _PyPegen_key_value_pair ( p , NULL , a );
7897 if (res == NULL && PyErr_Occurred()) {
7898 p->error_indicator = 1;
7899 return NULL;
7900 }
7901 goto done;
7902 }
7903 p->mark = mark;
7904 }
7905 { // expression ':' expression
7906 expr_ty a;
7907 expr_ty b;
7908 void *literal;
7909 if (
7910 (a = expression_rule(p))
7911 &&
7912 (literal = _PyPegen_expect_token(p, 11))
7913 &&
7914 (b = expression_rule(p))
7915 )
7916 {
7917 res = _PyPegen_key_value_pair ( p , a , b );
7918 if (res == NULL && PyErr_Occurred()) {
7919 p->error_indicator = 1;
7920 return NULL;
7921 }
7922 goto done;
7923 }
7924 p->mark = mark;
7925 }
7926 res = NULL;
7927 done:
7928 return res;
7929}
7930
7931// for_if_clauses: ((ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*))+
7932static asdl_seq*
7933for_if_clauses_rule(Parser *p)
7934{
7935 if (p->error_indicator) {
7936 return NULL;
7937 }
7938 asdl_seq* res = NULL;
7939 int mark = p->mark;
7940 { // ((ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*))+
7941 asdl_seq * a;
7942 if (
7943 (a = _loop1_97_rule(p))
7944 )
7945 {
7946 res = a;
7947 if (res == NULL && PyErr_Occurred()) {
7948 p->error_indicator = 1;
7949 return NULL;
7950 }
7951 goto done;
7952 }
7953 p->mark = mark;
7954 }
7955 res = NULL;
7956 done:
7957 return res;
7958}
7959
7960// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
7961static expr_ty
7962yield_expr_rule(Parser *p)
7963{
7964 if (p->error_indicator) {
7965 return NULL;
7966 }
7967 expr_ty res = NULL;
7968 int mark = p->mark;
7969 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7970 p->error_indicator = 1;
7971 return NULL;
7972 }
7973 int start_lineno = p->tokens[mark]->lineno;
7974 UNUSED(start_lineno); // Only used by EXTRA macro
7975 int start_col_offset = p->tokens[mark]->col_offset;
7976 UNUSED(start_col_offset); // Only used by EXTRA macro
7977 { // 'yield' 'from' expression
7978 expr_ty a;
7979 void *keyword;
7980 void *keyword_1;
7981 if (
7982 (keyword = _PyPegen_expect_token(p, 504))
7983 &&
7984 (keyword_1 = _PyPegen_expect_token(p, 514))
7985 &&
7986 (a = expression_rule(p))
7987 )
7988 {
7989 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7990 if (token == NULL) {
7991 return NULL;
7992 }
7993 int end_lineno = token->end_lineno;
7994 UNUSED(end_lineno); // Only used by EXTRA macro
7995 int end_col_offset = token->end_col_offset;
7996 UNUSED(end_col_offset); // Only used by EXTRA macro
7997 res = _Py_YieldFrom ( a , EXTRA );
7998 if (res == NULL && PyErr_Occurred()) {
7999 p->error_indicator = 1;
8000 return NULL;
8001 }
8002 goto done;
8003 }
8004 p->mark = mark;
8005 }
8006 { // 'yield' star_expressions?
8007 void *a;
8008 void *keyword;
8009 if (
8010 (keyword = _PyPegen_expect_token(p, 504))
8011 &&
8012 (a = star_expressions_rule(p), 1)
8013 )
8014 {
8015 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8016 if (token == NULL) {
8017 return NULL;
8018 }
8019 int end_lineno = token->end_lineno;
8020 UNUSED(end_lineno); // Only used by EXTRA macro
8021 int end_col_offset = token->end_col_offset;
8022 UNUSED(end_col_offset); // Only used by EXTRA macro
8023 res = _Py_Yield ( a , EXTRA );
8024 if (res == NULL && PyErr_Occurred()) {
8025 p->error_indicator = 1;
8026 return NULL;
8027 }
8028 goto done;
8029 }
8030 p->mark = mark;
8031 }
8032 res = NULL;
8033 done:
8034 return res;
8035}
8036
8037// arguments: args ','? &')' | incorrect_arguments
8038static expr_ty
8039arguments_rule(Parser *p)
8040{
8041 if (p->error_indicator) {
8042 return NULL;
8043 }
8044 expr_ty res = NULL;
8045 if (_PyPegen_is_memoized(p, arguments_type, &res))
8046 return res;
8047 int mark = p->mark;
8048 { // args ','? &')'
8049 expr_ty a;
8050 void *opt_var;
8051 UNUSED(opt_var); // Silence compiler warnings
8052 if (
8053 (a = args_rule(p))
8054 &&
8055 (opt_var = _PyPegen_expect_token(p, 12), 1)
8056 &&
8057 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
8058 )
8059 {
8060 res = a;
8061 if (res == NULL && PyErr_Occurred()) {
8062 p->error_indicator = 1;
8063 return NULL;
8064 }
8065 goto done;
8066 }
8067 p->mark = mark;
8068 }
8069 { // incorrect_arguments
8070 void *incorrect_arguments_var;
8071 if (
8072 (incorrect_arguments_var = incorrect_arguments_rule(p))
8073 )
8074 {
8075 res = incorrect_arguments_var;
8076 goto done;
8077 }
8078 p->mark = mark;
8079 }
8080 res = NULL;
8081 done:
8082 _PyPegen_insert_memo(p, mark, arguments_type, res);
8083 return res;
8084}
8085
8086// args: starred_expression [',' args] | kwargs | named_expression [',' args]
8087static expr_ty
8088args_rule(Parser *p)
8089{
8090 if (p->error_indicator) {
8091 return NULL;
8092 }
8093 expr_ty res = NULL;
8094 int mark = p->mark;
8095 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8096 p->error_indicator = 1;
8097 return NULL;
8098 }
8099 int start_lineno = p->tokens[mark]->lineno;
8100 UNUSED(start_lineno); // Only used by EXTRA macro
8101 int start_col_offset = p->tokens[mark]->col_offset;
8102 UNUSED(start_col_offset); // Only used by EXTRA macro
8103 { // starred_expression [',' args]
8104 expr_ty a;
8105 void *b;
8106 if (
8107 (a = starred_expression_rule(p))
8108 &&
8109 (b = _tmp_98_rule(p), 1)
8110 )
8111 {
8112 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8113 if (token == NULL) {
8114 return NULL;
8115 }
8116 int end_lineno = token->end_lineno;
8117 UNUSED(end_lineno); // Only used by EXTRA macro
8118 int end_col_offset = token->end_col_offset;
8119 UNUSED(end_col_offset); // Only used by EXTRA macro
8120 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 );
8121 if (res == NULL && PyErr_Occurred()) {
8122 p->error_indicator = 1;
8123 return NULL;
8124 }
8125 goto done;
8126 }
8127 p->mark = mark;
8128 }
8129 { // kwargs
8130 asdl_seq* a;
8131 if (
8132 (a = kwargs_rule(p))
8133 )
8134 {
8135 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8136 if (token == NULL) {
8137 return NULL;
8138 }
8139 int end_lineno = token->end_lineno;
8140 UNUSED(end_lineno); // Only used by EXTRA macro
8141 int end_col_offset = token->end_col_offset;
8142 UNUSED(end_col_offset); // Only used by EXTRA macro
8143 res = _Py_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 );
8144 if (res == NULL && PyErr_Occurred()) {
8145 p->error_indicator = 1;
8146 return NULL;
8147 }
8148 goto done;
8149 }
8150 p->mark = mark;
8151 }
8152 { // named_expression [',' args]
8153 expr_ty a;
8154 void *b;
8155 if (
8156 (a = named_expression_rule(p))
8157 &&
8158 (b = _tmp_99_rule(p), 1)
8159 )
8160 {
8161 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8162 if (token == NULL) {
8163 return NULL;
8164 }
8165 int end_lineno = token->end_lineno;
8166 UNUSED(end_lineno); // Only used by EXTRA macro
8167 int end_col_offset = token->end_col_offset;
8168 UNUSED(end_col_offset); // Only used by EXTRA macro
8169 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 );
8170 if (res == NULL && PyErr_Occurred()) {
8171 p->error_indicator = 1;
8172 return NULL;
8173 }
8174 goto done;
8175 }
8176 p->mark = mark;
8177 }
8178 res = NULL;
8179 done:
8180 return res;
8181}
8182
8183// kwargs:
8184// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
8185// | ','.kwarg_or_starred+
8186// | ','.kwarg_or_double_starred+
8187static asdl_seq*
8188kwargs_rule(Parser *p)
8189{
8190 if (p->error_indicator) {
8191 return NULL;
8192 }
8193 asdl_seq* res = NULL;
8194 int mark = p->mark;
8195 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
8196 asdl_seq * a;
8197 asdl_seq * b;
8198 void *literal;
8199 if (
8200 (a = _gather_100_rule(p))
8201 &&
8202 (literal = _PyPegen_expect_token(p, 12))
8203 &&
8204 (b = _gather_102_rule(p))
8205 )
8206 {
8207 res = _PyPegen_join_sequences ( p , a , b );
8208 if (res == NULL && PyErr_Occurred()) {
8209 p->error_indicator = 1;
8210 return NULL;
8211 }
8212 goto done;
8213 }
8214 p->mark = mark;
8215 }
8216 { // ','.kwarg_or_starred+
8217 asdl_seq * _gather_104_var;
8218 if (
8219 (_gather_104_var = _gather_104_rule(p))
8220 )
8221 {
8222 res = _gather_104_var;
8223 goto done;
8224 }
8225 p->mark = mark;
8226 }
8227 { // ','.kwarg_or_double_starred+
8228 asdl_seq * _gather_106_var;
8229 if (
8230 (_gather_106_var = _gather_106_rule(p))
8231 )
8232 {
8233 res = _gather_106_var;
8234 goto done;
8235 }
8236 p->mark = mark;
8237 }
8238 res = NULL;
8239 done:
8240 return res;
8241}
8242
8243// starred_expression: '*' expression
8244static expr_ty
8245starred_expression_rule(Parser *p)
8246{
8247 if (p->error_indicator) {
8248 return NULL;
8249 }
8250 expr_ty res = NULL;
8251 int mark = p->mark;
8252 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8253 p->error_indicator = 1;
8254 return NULL;
8255 }
8256 int start_lineno = p->tokens[mark]->lineno;
8257 UNUSED(start_lineno); // Only used by EXTRA macro
8258 int start_col_offset = p->tokens[mark]->col_offset;
8259 UNUSED(start_col_offset); // Only used by EXTRA macro
8260 { // '*' expression
8261 expr_ty a;
8262 void *literal;
8263 if (
8264 (literal = _PyPegen_expect_token(p, 16))
8265 &&
8266 (a = expression_rule(p))
8267 )
8268 {
8269 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8270 if (token == NULL) {
8271 return NULL;
8272 }
8273 int end_lineno = token->end_lineno;
8274 UNUSED(end_lineno); // Only used by EXTRA macro
8275 int end_col_offset = token->end_col_offset;
8276 UNUSED(end_col_offset); // Only used by EXTRA macro
8277 res = _Py_Starred ( a , Load , EXTRA );
8278 if (res == NULL && PyErr_Occurred()) {
8279 p->error_indicator = 1;
8280 return NULL;
8281 }
8282 goto done;
8283 }
8284 p->mark = mark;
8285 }
8286 res = NULL;
8287 done:
8288 return res;
8289}
8290
8291// kwarg_or_starred: NAME '=' expression | starred_expression
8292static KeywordOrStarred*
8293kwarg_or_starred_rule(Parser *p)
8294{
8295 if (p->error_indicator) {
8296 return NULL;
8297 }
8298 KeywordOrStarred* res = NULL;
8299 int mark = p->mark;
8300 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8301 p->error_indicator = 1;
8302 return NULL;
8303 }
8304 int start_lineno = p->tokens[mark]->lineno;
8305 UNUSED(start_lineno); // Only used by EXTRA macro
8306 int start_col_offset = p->tokens[mark]->col_offset;
8307 UNUSED(start_col_offset); // Only used by EXTRA macro
8308 { // NAME '=' expression
8309 expr_ty a;
8310 expr_ty b;
8311 void *literal;
8312 if (
8313 (a = _PyPegen_name_token(p))
8314 &&
8315 (literal = _PyPegen_expect_token(p, 22))
8316 &&
8317 (b = expression_rule(p))
8318 )
8319 {
8320 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8321 if (token == NULL) {
8322 return NULL;
8323 }
8324 int end_lineno = token->end_lineno;
8325 UNUSED(end_lineno); // Only used by EXTRA macro
8326 int end_col_offset = token->end_col_offset;
8327 UNUSED(end_col_offset); // Only used by EXTRA macro
8328 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
8329 if (res == NULL && PyErr_Occurred()) {
8330 p->error_indicator = 1;
8331 return NULL;
8332 }
8333 goto done;
8334 }
8335 p->mark = mark;
8336 }
8337 { // starred_expression
8338 expr_ty a;
8339 if (
8340 (a = starred_expression_rule(p))
8341 )
8342 {
8343 res = _PyPegen_keyword_or_starred ( p , a , 0 );
8344 if (res == NULL && PyErr_Occurred()) {
8345 p->error_indicator = 1;
8346 return NULL;
8347 }
8348 goto done;
8349 }
8350 p->mark = mark;
8351 }
8352 res = NULL;
8353 done:
8354 return res;
8355}
8356
8357// kwarg_or_double_starred: NAME '=' expression | '**' expression
8358static KeywordOrStarred*
8359kwarg_or_double_starred_rule(Parser *p)
8360{
8361 if (p->error_indicator) {
8362 return NULL;
8363 }
8364 KeywordOrStarred* res = NULL;
8365 int mark = p->mark;
8366 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8367 p->error_indicator = 1;
8368 return NULL;
8369 }
8370 int start_lineno = p->tokens[mark]->lineno;
8371 UNUSED(start_lineno); // Only used by EXTRA macro
8372 int start_col_offset = p->tokens[mark]->col_offset;
8373 UNUSED(start_col_offset); // Only used by EXTRA macro
8374 { // NAME '=' expression
8375 expr_ty a;
8376 expr_ty b;
8377 void *literal;
8378 if (
8379 (a = _PyPegen_name_token(p))
8380 &&
8381 (literal = _PyPegen_expect_token(p, 22))
8382 &&
8383 (b = expression_rule(p))
8384 )
8385 {
8386 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8387 if (token == NULL) {
8388 return NULL;
8389 }
8390 int end_lineno = token->end_lineno;
8391 UNUSED(end_lineno); // Only used by EXTRA macro
8392 int end_col_offset = token->end_col_offset;
8393 UNUSED(end_col_offset); // Only used by EXTRA macro
8394 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
8395 if (res == NULL && PyErr_Occurred()) {
8396 p->error_indicator = 1;
8397 return NULL;
8398 }
8399 goto done;
8400 }
8401 p->mark = mark;
8402 }
8403 { // '**' expression
8404 expr_ty a;
8405 void *literal;
8406 if (
8407 (literal = _PyPegen_expect_token(p, 35))
8408 &&
8409 (a = expression_rule(p))
8410 )
8411 {
8412 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8413 if (token == NULL) {
8414 return NULL;
8415 }
8416 int end_lineno = token->end_lineno;
8417 UNUSED(end_lineno); // Only used by EXTRA macro
8418 int end_col_offset = token->end_col_offset;
8419 UNUSED(end_col_offset); // Only used by EXTRA macro
8420 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
8421 if (res == NULL && PyErr_Occurred()) {
8422 p->error_indicator = 1;
8423 return NULL;
8424 }
8425 goto done;
8426 }
8427 p->mark = mark;
8428 }
8429 res = NULL;
8430 done:
8431 return res;
8432}
8433
8434// star_targets: star_target !',' | star_target ((',' star_target))* ','?
8435static expr_ty
8436star_targets_rule(Parser *p)
8437{
8438 if (p->error_indicator) {
8439 return NULL;
8440 }
8441 expr_ty res = NULL;
8442 int mark = p->mark;
8443 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8444 p->error_indicator = 1;
8445 return NULL;
8446 }
8447 int start_lineno = p->tokens[mark]->lineno;
8448 UNUSED(start_lineno); // Only used by EXTRA macro
8449 int start_col_offset = p->tokens[mark]->col_offset;
8450 UNUSED(start_col_offset); // Only used by EXTRA macro
8451 { // star_target !','
8452 expr_ty a;
8453 if (
8454 (a = star_target_rule(p))
8455 &&
8456 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)
8457 )
8458 {
8459 res = a;
8460 if (res == NULL && PyErr_Occurred()) {
8461 p->error_indicator = 1;
8462 return NULL;
8463 }
8464 goto done;
8465 }
8466 p->mark = mark;
8467 }
8468 { // star_target ((',' star_target))* ','?
8469 expr_ty a;
8470 asdl_seq * b;
8471 void *opt_var;
8472 UNUSED(opt_var); // Silence compiler warnings
8473 if (
8474 (a = star_target_rule(p))
8475 &&
8476 (b = _loop0_108_rule(p))
8477 &&
8478 (opt_var = _PyPegen_expect_token(p, 12), 1)
8479 )
8480 {
8481 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8482 if (token == NULL) {
8483 return NULL;
8484 }
8485 int end_lineno = token->end_lineno;
8486 UNUSED(end_lineno); // Only used by EXTRA macro
8487 int end_col_offset = token->end_col_offset;
8488 UNUSED(end_col_offset); // Only used by EXTRA macro
8489 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
8490 if (res == NULL && PyErr_Occurred()) {
8491 p->error_indicator = 1;
8492 return NULL;
8493 }
8494 goto done;
8495 }
8496 p->mark = mark;
8497 }
8498 res = NULL;
8499 done:
8500 return res;
8501}
8502
8503// star_targets_seq: ','.star_target+ ','?
8504static asdl_seq*
8505star_targets_seq_rule(Parser *p)
8506{
8507 if (p->error_indicator) {
8508 return NULL;
8509 }
8510 asdl_seq* res = NULL;
8511 int mark = p->mark;
8512 { // ','.star_target+ ','?
8513 asdl_seq * a;
8514 void *opt_var;
8515 UNUSED(opt_var); // Silence compiler warnings
8516 if (
8517 (a = _gather_109_rule(p))
8518 &&
8519 (opt_var = _PyPegen_expect_token(p, 12), 1)
8520 )
8521 {
8522 res = a;
8523 if (res == NULL && PyErr_Occurred()) {
8524 p->error_indicator = 1;
8525 return NULL;
8526 }
8527 goto done;
8528 }
8529 p->mark = mark;
8530 }
8531 res = NULL;
8532 done:
8533 return res;
8534}
8535
8536// star_target:
8537// | '*' (!'*' star_target)
8538// | t_primary '.' NAME !t_lookahead
8539// | t_primary '[' slices ']' !t_lookahead
8540// | star_atom
8541static expr_ty
8542star_target_rule(Parser *p)
8543{
8544 if (p->error_indicator) {
8545 return NULL;
8546 }
8547 expr_ty res = NULL;
8548 if (_PyPegen_is_memoized(p, star_target_type, &res))
8549 return res;
8550 int mark = p->mark;
8551 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8552 p->error_indicator = 1;
8553 return NULL;
8554 }
8555 int start_lineno = p->tokens[mark]->lineno;
8556 UNUSED(start_lineno); // Only used by EXTRA macro
8557 int start_col_offset = p->tokens[mark]->col_offset;
8558 UNUSED(start_col_offset); // Only used by EXTRA macro
8559 { // '*' (!'*' star_target)
8560 void *a;
8561 void *literal;
8562 if (
8563 (literal = _PyPegen_expect_token(p, 16))
8564 &&
8565 (a = _tmp_111_rule(p))
8566 )
8567 {
8568 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8569 if (token == NULL) {
8570 return NULL;
8571 }
8572 int end_lineno = token->end_lineno;
8573 UNUSED(end_lineno); // Only used by EXTRA macro
8574 int end_col_offset = token->end_col_offset;
8575 UNUSED(end_col_offset); // Only used by EXTRA macro
8576 res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
8577 if (res == NULL && PyErr_Occurred()) {
8578 p->error_indicator = 1;
8579 return NULL;
8580 }
8581 goto done;
8582 }
8583 p->mark = mark;
8584 }
8585 { // t_primary '.' NAME !t_lookahead
8586 expr_ty a;
8587 expr_ty b;
8588 void *literal;
8589 if (
8590 (a = t_primary_rule(p))
8591 &&
8592 (literal = _PyPegen_expect_token(p, 23))
8593 &&
8594 (b = _PyPegen_name_token(p))
8595 &&
8596 _PyPegen_lookahead(0, t_lookahead_rule, p)
8597 )
8598 {
8599 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8600 if (token == NULL) {
8601 return NULL;
8602 }
8603 int end_lineno = token->end_lineno;
8604 UNUSED(end_lineno); // Only used by EXTRA macro
8605 int end_col_offset = token->end_col_offset;
8606 UNUSED(end_col_offset); // Only used by EXTRA macro
8607 res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
8608 if (res == NULL && PyErr_Occurred()) {
8609 p->error_indicator = 1;
8610 return NULL;
8611 }
8612 goto done;
8613 }
8614 p->mark = mark;
8615 }
8616 { // t_primary '[' slices ']' !t_lookahead
8617 expr_ty a;
8618 expr_ty b;
8619 void *literal;
8620 void *literal_1;
8621 if (
8622 (a = t_primary_rule(p))
8623 &&
8624 (literal = _PyPegen_expect_token(p, 9))
8625 &&
8626 (b = slices_rule(p))
8627 &&
8628 (literal_1 = _PyPegen_expect_token(p, 10))
8629 &&
8630 _PyPegen_lookahead(0, t_lookahead_rule, p)
8631 )
8632 {
8633 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8634 if (token == NULL) {
8635 return NULL;
8636 }
8637 int end_lineno = token->end_lineno;
8638 UNUSED(end_lineno); // Only used by EXTRA macro
8639 int end_col_offset = token->end_col_offset;
8640 UNUSED(end_col_offset); // Only used by EXTRA macro
8641 res = _Py_Subscript ( a , b , Store , EXTRA );
8642 if (res == NULL && PyErr_Occurred()) {
8643 p->error_indicator = 1;
8644 return NULL;
8645 }
8646 goto done;
8647 }
8648 p->mark = mark;
8649 }
8650 { // star_atom
8651 expr_ty star_atom_var;
8652 if (
8653 (star_atom_var = star_atom_rule(p))
8654 )
8655 {
8656 res = star_atom_var;
8657 goto done;
8658 }
8659 p->mark = mark;
8660 }
8661 res = NULL;
8662 done:
8663 _PyPegen_insert_memo(p, mark, star_target_type, res);
8664 return res;
8665}
8666
8667// star_atom:
8668// | NAME
8669// | '(' star_target ')'
8670// | '(' star_targets_seq? ')'
8671// | '[' star_targets_seq? ']'
8672static expr_ty
8673star_atom_rule(Parser *p)
8674{
8675 if (p->error_indicator) {
8676 return NULL;
8677 }
8678 expr_ty res = NULL;
8679 int mark = p->mark;
8680 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8681 p->error_indicator = 1;
8682 return NULL;
8683 }
8684 int start_lineno = p->tokens[mark]->lineno;
8685 UNUSED(start_lineno); // Only used by EXTRA macro
8686 int start_col_offset = p->tokens[mark]->col_offset;
8687 UNUSED(start_col_offset); // Only used by EXTRA macro
8688 { // NAME
8689 expr_ty a;
8690 if (
8691 (a = _PyPegen_name_token(p))
8692 )
8693 {
8694 res = _PyPegen_set_expr_context ( p , a , Store );
8695 if (res == NULL && PyErr_Occurred()) {
8696 p->error_indicator = 1;
8697 return NULL;
8698 }
8699 goto done;
8700 }
8701 p->mark = mark;
8702 }
8703 { // '(' star_target ')'
8704 expr_ty a;
8705 void *literal;
8706 void *literal_1;
8707 if (
8708 (literal = _PyPegen_expect_token(p, 7))
8709 &&
8710 (a = star_target_rule(p))
8711 &&
8712 (literal_1 = _PyPegen_expect_token(p, 8))
8713 )
8714 {
8715 res = _PyPegen_set_expr_context ( p , a , Store );
8716 if (res == NULL && PyErr_Occurred()) {
8717 p->error_indicator = 1;
8718 return NULL;
8719 }
8720 goto done;
8721 }
8722 p->mark = mark;
8723 }
8724 { // '(' star_targets_seq? ')'
8725 void *a;
8726 void *literal;
8727 void *literal_1;
8728 if (
8729 (literal = _PyPegen_expect_token(p, 7))
8730 &&
8731 (a = star_targets_seq_rule(p), 1)
8732 &&
8733 (literal_1 = _PyPegen_expect_token(p, 8))
8734 )
8735 {
8736 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8737 if (token == NULL) {
8738 return NULL;
8739 }
8740 int end_lineno = token->end_lineno;
8741 UNUSED(end_lineno); // Only used by EXTRA macro
8742 int end_col_offset = token->end_col_offset;
8743 UNUSED(end_col_offset); // Only used by EXTRA macro
8744 res = _Py_Tuple ( a , Store , EXTRA );
8745 if (res == NULL && PyErr_Occurred()) {
8746 p->error_indicator = 1;
8747 return NULL;
8748 }
8749 goto done;
8750 }
8751 p->mark = mark;
8752 }
8753 { // '[' star_targets_seq? ']'
8754 void *a;
8755 void *literal;
8756 void *literal_1;
8757 if (
8758 (literal = _PyPegen_expect_token(p, 9))
8759 &&
8760 (a = star_targets_seq_rule(p), 1)
8761 &&
8762 (literal_1 = _PyPegen_expect_token(p, 10))
8763 )
8764 {
8765 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8766 if (token == NULL) {
8767 return NULL;
8768 }
8769 int end_lineno = token->end_lineno;
8770 UNUSED(end_lineno); // Only used by EXTRA macro
8771 int end_col_offset = token->end_col_offset;
8772 UNUSED(end_col_offset); // Only used by EXTRA macro
8773 res = _Py_List ( a , Store , EXTRA );
8774 if (res == NULL && PyErr_Occurred()) {
8775 p->error_indicator = 1;
8776 return NULL;
8777 }
8778 goto done;
8779 }
8780 p->mark = mark;
8781 }
8782 res = NULL;
8783 done:
8784 return res;
8785}
8786
8787// inside_paren_ann_assign_target:
8788// | ann_assign_subscript_attribute_target
8789// | NAME
8790// | '(' inside_paren_ann_assign_target ')'
8791static expr_ty
8792inside_paren_ann_assign_target_rule(Parser *p)
8793{
8794 if (p->error_indicator) {
8795 return NULL;
8796 }
8797 expr_ty res = NULL;
8798 int mark = p->mark;
8799 { // ann_assign_subscript_attribute_target
8800 expr_ty ann_assign_subscript_attribute_target_var;
8801 if (
8802 (ann_assign_subscript_attribute_target_var = ann_assign_subscript_attribute_target_rule(p))
8803 )
8804 {
8805 res = ann_assign_subscript_attribute_target_var;
8806 goto done;
8807 }
8808 p->mark = mark;
8809 }
8810 { // NAME
8811 expr_ty a;
8812 if (
8813 (a = _PyPegen_name_token(p))
8814 )
8815 {
8816 res = _PyPegen_set_expr_context ( p , a , Store );
8817 if (res == NULL && PyErr_Occurred()) {
8818 p->error_indicator = 1;
8819 return NULL;
8820 }
8821 goto done;
8822 }
8823 p->mark = mark;
8824 }
8825 { // '(' inside_paren_ann_assign_target ')'
8826 expr_ty a;
8827 void *literal;
8828 void *literal_1;
8829 if (
8830 (literal = _PyPegen_expect_token(p, 7))
8831 &&
8832 (a = inside_paren_ann_assign_target_rule(p))
8833 &&
8834 (literal_1 = _PyPegen_expect_token(p, 8))
8835 )
8836 {
8837 res = a;
8838 if (res == NULL && PyErr_Occurred()) {
8839 p->error_indicator = 1;
8840 return NULL;
8841 }
8842 goto done;
8843 }
8844 p->mark = mark;
8845 }
8846 res = NULL;
8847 done:
8848 return res;
8849}
8850
8851// ann_assign_subscript_attribute_target:
8852// | t_primary '.' NAME !t_lookahead
8853// | t_primary '[' slices ']' !t_lookahead
8854static expr_ty
8855ann_assign_subscript_attribute_target_rule(Parser *p)
8856{
8857 if (p->error_indicator) {
8858 return NULL;
8859 }
8860 expr_ty res = NULL;
8861 int mark = p->mark;
8862 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8863 p->error_indicator = 1;
8864 return NULL;
8865 }
8866 int start_lineno = p->tokens[mark]->lineno;
8867 UNUSED(start_lineno); // Only used by EXTRA macro
8868 int start_col_offset = p->tokens[mark]->col_offset;
8869 UNUSED(start_col_offset); // Only used by EXTRA macro
8870 { // t_primary '.' NAME !t_lookahead
8871 expr_ty a;
8872 expr_ty b;
8873 void *literal;
8874 if (
8875 (a = t_primary_rule(p))
8876 &&
8877 (literal = _PyPegen_expect_token(p, 23))
8878 &&
8879 (b = _PyPegen_name_token(p))
8880 &&
8881 _PyPegen_lookahead(0, t_lookahead_rule, p)
8882 )
8883 {
8884 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8885 if (token == NULL) {
8886 return NULL;
8887 }
8888 int end_lineno = token->end_lineno;
8889 UNUSED(end_lineno); // Only used by EXTRA macro
8890 int end_col_offset = token->end_col_offset;
8891 UNUSED(end_col_offset); // Only used by EXTRA macro
8892 res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
8893 if (res == NULL && PyErr_Occurred()) {
8894 p->error_indicator = 1;
8895 return NULL;
8896 }
8897 goto done;
8898 }
8899 p->mark = mark;
8900 }
8901 { // t_primary '[' slices ']' !t_lookahead
8902 expr_ty a;
8903 expr_ty b;
8904 void *literal;
8905 void *literal_1;
8906 if (
8907 (a = t_primary_rule(p))
8908 &&
8909 (literal = _PyPegen_expect_token(p, 9))
8910 &&
8911 (b = slices_rule(p))
8912 &&
8913 (literal_1 = _PyPegen_expect_token(p, 10))
8914 &&
8915 _PyPegen_lookahead(0, t_lookahead_rule, p)
8916 )
8917 {
8918 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8919 if (token == NULL) {
8920 return NULL;
8921 }
8922 int end_lineno = token->end_lineno;
8923 UNUSED(end_lineno); // Only used by EXTRA macro
8924 int end_col_offset = token->end_col_offset;
8925 UNUSED(end_col_offset); // Only used by EXTRA macro
8926 res = _Py_Subscript ( a , b , Store , EXTRA );
8927 if (res == NULL && PyErr_Occurred()) {
8928 p->error_indicator = 1;
8929 return NULL;
8930 }
8931 goto done;
8932 }
8933 p->mark = mark;
8934 }
8935 res = NULL;
8936 done:
8937 return res;
8938}
8939
8940// del_targets: ','.del_target+ ','?
8941static asdl_seq*
8942del_targets_rule(Parser *p)
8943{
8944 if (p->error_indicator) {
8945 return NULL;
8946 }
8947 asdl_seq* res = NULL;
8948 int mark = p->mark;
8949 { // ','.del_target+ ','?
8950 asdl_seq * a;
8951 void *opt_var;
8952 UNUSED(opt_var); // Silence compiler warnings
8953 if (
8954 (a = _gather_112_rule(p))
8955 &&
8956 (opt_var = _PyPegen_expect_token(p, 12), 1)
8957 )
8958 {
8959 res = a;
8960 if (res == NULL && PyErr_Occurred()) {
8961 p->error_indicator = 1;
8962 return NULL;
8963 }
8964 goto done;
8965 }
8966 p->mark = mark;
8967 }
8968 res = NULL;
8969 done:
8970 return res;
8971}
8972
8973// del_target:
8974// | t_primary '.' NAME !t_lookahead
8975// | t_primary '[' slices ']' !t_lookahead
8976// | del_t_atom
8977static expr_ty
8978del_target_rule(Parser *p)
8979{
8980 if (p->error_indicator) {
8981 return NULL;
8982 }
8983 expr_ty res = NULL;
8984 if (_PyPegen_is_memoized(p, del_target_type, &res))
8985 return res;
8986 int mark = p->mark;
8987 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8988 p->error_indicator = 1;
8989 return NULL;
8990 }
8991 int start_lineno = p->tokens[mark]->lineno;
8992 UNUSED(start_lineno); // Only used by EXTRA macro
8993 int start_col_offset = p->tokens[mark]->col_offset;
8994 UNUSED(start_col_offset); // Only used by EXTRA macro
8995 { // t_primary '.' NAME !t_lookahead
8996 expr_ty a;
8997 expr_ty b;
8998 void *literal;
8999 if (
9000 (a = t_primary_rule(p))
9001 &&
9002 (literal = _PyPegen_expect_token(p, 23))
9003 &&
9004 (b = _PyPegen_name_token(p))
9005 &&
9006 _PyPegen_lookahead(0, t_lookahead_rule, p)
9007 )
9008 {
9009 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9010 if (token == NULL) {
9011 return NULL;
9012 }
9013 int end_lineno = token->end_lineno;
9014 UNUSED(end_lineno); // Only used by EXTRA macro
9015 int end_col_offset = token->end_col_offset;
9016 UNUSED(end_col_offset); // Only used by EXTRA macro
9017 res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
9018 if (res == NULL && PyErr_Occurred()) {
9019 p->error_indicator = 1;
9020 return NULL;
9021 }
9022 goto done;
9023 }
9024 p->mark = mark;
9025 }
9026 { // t_primary '[' slices ']' !t_lookahead
9027 expr_ty a;
9028 expr_ty b;
9029 void *literal;
9030 void *literal_1;
9031 if (
9032 (a = t_primary_rule(p))
9033 &&
9034 (literal = _PyPegen_expect_token(p, 9))
9035 &&
9036 (b = slices_rule(p))
9037 &&
9038 (literal_1 = _PyPegen_expect_token(p, 10))
9039 &&
9040 _PyPegen_lookahead(0, t_lookahead_rule, p)
9041 )
9042 {
9043 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9044 if (token == NULL) {
9045 return NULL;
9046 }
9047 int end_lineno = token->end_lineno;
9048 UNUSED(end_lineno); // Only used by EXTRA macro
9049 int end_col_offset = token->end_col_offset;
9050 UNUSED(end_col_offset); // Only used by EXTRA macro
9051 res = _Py_Subscript ( a , b , Del , EXTRA );
9052 if (res == NULL && PyErr_Occurred()) {
9053 p->error_indicator = 1;
9054 return NULL;
9055 }
9056 goto done;
9057 }
9058 p->mark = mark;
9059 }
9060 { // del_t_atom
9061 expr_ty del_t_atom_var;
9062 if (
9063 (del_t_atom_var = del_t_atom_rule(p))
9064 )
9065 {
9066 res = del_t_atom_var;
9067 goto done;
9068 }
9069 p->mark = mark;
9070 }
9071 res = NULL;
9072 done:
9073 _PyPegen_insert_memo(p, mark, del_target_type, res);
9074 return res;
9075}
9076
9077// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
9078static expr_ty
9079del_t_atom_rule(Parser *p)
9080{
9081 if (p->error_indicator) {
9082 return NULL;
9083 }
9084 expr_ty res = NULL;
9085 int mark = p->mark;
9086 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9087 p->error_indicator = 1;
9088 return NULL;
9089 }
9090 int start_lineno = p->tokens[mark]->lineno;
9091 UNUSED(start_lineno); // Only used by EXTRA macro
9092 int start_col_offset = p->tokens[mark]->col_offset;
9093 UNUSED(start_col_offset); // Only used by EXTRA macro
9094 { // NAME
9095 expr_ty a;
9096 if (
9097 (a = _PyPegen_name_token(p))
9098 )
9099 {
9100 res = _PyPegen_set_expr_context ( p , a , Del );
9101 if (res == NULL && PyErr_Occurred()) {
9102 p->error_indicator = 1;
9103 return NULL;
9104 }
9105 goto done;
9106 }
9107 p->mark = mark;
9108 }
9109 { // '(' del_target ')'
9110 expr_ty a;
9111 void *literal;
9112 void *literal_1;
9113 if (
9114 (literal = _PyPegen_expect_token(p, 7))
9115 &&
9116 (a = del_target_rule(p))
9117 &&
9118 (literal_1 = _PyPegen_expect_token(p, 8))
9119 )
9120 {
9121 res = _PyPegen_set_expr_context ( p , a , Del );
9122 if (res == NULL && PyErr_Occurred()) {
9123 p->error_indicator = 1;
9124 return NULL;
9125 }
9126 goto done;
9127 }
9128 p->mark = mark;
9129 }
9130 { // '(' del_targets? ')'
9131 void *a;
9132 void *literal;
9133 void *literal_1;
9134 if (
9135 (literal = _PyPegen_expect_token(p, 7))
9136 &&
9137 (a = del_targets_rule(p), 1)
9138 &&
9139 (literal_1 = _PyPegen_expect_token(p, 8))
9140 )
9141 {
9142 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9143 if (token == NULL) {
9144 return NULL;
9145 }
9146 int end_lineno = token->end_lineno;
9147 UNUSED(end_lineno); // Only used by EXTRA macro
9148 int end_col_offset = token->end_col_offset;
9149 UNUSED(end_col_offset); // Only used by EXTRA macro
9150 res = _Py_Tuple ( a , Del , EXTRA );
9151 if (res == NULL && PyErr_Occurred()) {
9152 p->error_indicator = 1;
9153 return NULL;
9154 }
9155 goto done;
9156 }
9157 p->mark = mark;
9158 }
9159 { // '[' del_targets? ']'
9160 void *a;
9161 void *literal;
9162 void *literal_1;
9163 if (
9164 (literal = _PyPegen_expect_token(p, 9))
9165 &&
9166 (a = del_targets_rule(p), 1)
9167 &&
9168 (literal_1 = _PyPegen_expect_token(p, 10))
9169 )
9170 {
9171 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9172 if (token == NULL) {
9173 return NULL;
9174 }
9175 int end_lineno = token->end_lineno;
9176 UNUSED(end_lineno); // Only used by EXTRA macro
9177 int end_col_offset = token->end_col_offset;
9178 UNUSED(end_col_offset); // Only used by EXTRA macro
9179 res = _Py_List ( a , Del , EXTRA );
9180 if (res == NULL && PyErr_Occurred()) {
9181 p->error_indicator = 1;
9182 return NULL;
9183 }
9184 goto done;
9185 }
9186 p->mark = mark;
9187 }
9188 res = NULL;
9189 done:
9190 return res;
9191}
9192
9193// targets: ','.target+ ','?
9194static asdl_seq*
9195targets_rule(Parser *p)
9196{
9197 if (p->error_indicator) {
9198 return NULL;
9199 }
9200 asdl_seq* res = NULL;
9201 int mark = p->mark;
9202 { // ','.target+ ','?
9203 asdl_seq * a;
9204 void *opt_var;
9205 UNUSED(opt_var); // Silence compiler warnings
9206 if (
9207 (a = _gather_114_rule(p))
9208 &&
9209 (opt_var = _PyPegen_expect_token(p, 12), 1)
9210 )
9211 {
9212 res = a;
9213 if (res == NULL && PyErr_Occurred()) {
9214 p->error_indicator = 1;
9215 return NULL;
9216 }
9217 goto done;
9218 }
9219 p->mark = mark;
9220 }
9221 res = NULL;
9222 done:
9223 return res;
9224}
9225
9226// target:
9227// | t_primary '.' NAME !t_lookahead
9228// | t_primary '[' slices ']' !t_lookahead
9229// | t_atom
9230static expr_ty
9231target_rule(Parser *p)
9232{
9233 if (p->error_indicator) {
9234 return NULL;
9235 }
9236 expr_ty res = NULL;
9237 if (_PyPegen_is_memoized(p, target_type, &res))
9238 return res;
9239 int mark = p->mark;
9240 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9241 p->error_indicator = 1;
9242 return NULL;
9243 }
9244 int start_lineno = p->tokens[mark]->lineno;
9245 UNUSED(start_lineno); // Only used by EXTRA macro
9246 int start_col_offset = p->tokens[mark]->col_offset;
9247 UNUSED(start_col_offset); // Only used by EXTRA macro
9248 { // t_primary '.' NAME !t_lookahead
9249 expr_ty a;
9250 expr_ty b;
9251 void *literal;
9252 if (
9253 (a = t_primary_rule(p))
9254 &&
9255 (literal = _PyPegen_expect_token(p, 23))
9256 &&
9257 (b = _PyPegen_name_token(p))
9258 &&
9259 _PyPegen_lookahead(0, t_lookahead_rule, p)
9260 )
9261 {
9262 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9263 if (token == NULL) {
9264 return NULL;
9265 }
9266 int end_lineno = token->end_lineno;
9267 UNUSED(end_lineno); // Only used by EXTRA macro
9268 int end_col_offset = token->end_col_offset;
9269 UNUSED(end_col_offset); // Only used by EXTRA macro
9270 res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
9271 if (res == NULL && PyErr_Occurred()) {
9272 p->error_indicator = 1;
9273 return NULL;
9274 }
9275 goto done;
9276 }
9277 p->mark = mark;
9278 }
9279 { // t_primary '[' slices ']' !t_lookahead
9280 expr_ty a;
9281 expr_ty b;
9282 void *literal;
9283 void *literal_1;
9284 if (
9285 (a = t_primary_rule(p))
9286 &&
9287 (literal = _PyPegen_expect_token(p, 9))
9288 &&
9289 (b = slices_rule(p))
9290 &&
9291 (literal_1 = _PyPegen_expect_token(p, 10))
9292 &&
9293 _PyPegen_lookahead(0, t_lookahead_rule, p)
9294 )
9295 {
9296 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9297 if (token == NULL) {
9298 return NULL;
9299 }
9300 int end_lineno = token->end_lineno;
9301 UNUSED(end_lineno); // Only used by EXTRA macro
9302 int end_col_offset = token->end_col_offset;
9303 UNUSED(end_col_offset); // Only used by EXTRA macro
9304 res = _Py_Subscript ( a , b , Store , EXTRA );
9305 if (res == NULL && PyErr_Occurred()) {
9306 p->error_indicator = 1;
9307 return NULL;
9308 }
9309 goto done;
9310 }
9311 p->mark = mark;
9312 }
9313 { // t_atom
9314 expr_ty t_atom_var;
9315 if (
9316 (t_atom_var = t_atom_rule(p))
9317 )
9318 {
9319 res = t_atom_var;
9320 goto done;
9321 }
9322 p->mark = mark;
9323 }
9324 res = NULL;
9325 done:
9326 _PyPegen_insert_memo(p, mark, target_type, res);
9327 return res;
9328}
9329
9330// Left-recursive
9331// t_primary:
9332// | t_primary '.' NAME &t_lookahead
9333// | t_primary '[' slices ']' &t_lookahead
9334// | t_primary genexp &t_lookahead
9335// | t_primary '(' arguments? ')' &t_lookahead
9336// | atom &t_lookahead
9337static expr_ty t_primary_raw(Parser *);
9338static expr_ty
9339t_primary_rule(Parser *p)
9340{
9341 expr_ty res = NULL;
9342 if (_PyPegen_is_memoized(p, t_primary_type, &res))
9343 return res;
9344 int mark = p->mark;
9345 int resmark = p->mark;
9346 while (1) {
9347 int tmpvar_8 = _PyPegen_update_memo(p, mark, t_primary_type, res);
9348 if (tmpvar_8) {
9349 return res;
9350 }
9351 p->mark = mark;
9352 void *raw = t_primary_raw(p);
9353 if (raw == NULL || p->mark <= resmark)
9354 break;
9355 resmark = p->mark;
9356 res = raw;
9357 }
9358 p->mark = resmark;
9359 return res;
9360}
9361static expr_ty
9362t_primary_raw(Parser *p)
9363{
9364 if (p->error_indicator) {
9365 return NULL;
9366 }
9367 expr_ty res = NULL;
9368 int mark = p->mark;
9369 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9370 p->error_indicator = 1;
9371 return NULL;
9372 }
9373 int start_lineno = p->tokens[mark]->lineno;
9374 UNUSED(start_lineno); // Only used by EXTRA macro
9375 int start_col_offset = p->tokens[mark]->col_offset;
9376 UNUSED(start_col_offset); // Only used by EXTRA macro
9377 { // t_primary '.' NAME &t_lookahead
9378 expr_ty a;
9379 expr_ty b;
9380 void *literal;
9381 if (
9382 (a = t_primary_rule(p))
9383 &&
9384 (literal = _PyPegen_expect_token(p, 23))
9385 &&
9386 (b = _PyPegen_name_token(p))
9387 &&
9388 _PyPegen_lookahead(1, t_lookahead_rule, p)
9389 )
9390 {
9391 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9392 if (token == NULL) {
9393 return NULL;
9394 }
9395 int end_lineno = token->end_lineno;
9396 UNUSED(end_lineno); // Only used by EXTRA macro
9397 int end_col_offset = token->end_col_offset;
9398 UNUSED(end_col_offset); // Only used by EXTRA macro
9399 res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
9400 if (res == NULL && PyErr_Occurred()) {
9401 p->error_indicator = 1;
9402 return NULL;
9403 }
9404 goto done;
9405 }
9406 p->mark = mark;
9407 }
9408 { // t_primary '[' slices ']' &t_lookahead
9409 expr_ty a;
9410 expr_ty b;
9411 void *literal;
9412 void *literal_1;
9413 if (
9414 (a = t_primary_rule(p))
9415 &&
9416 (literal = _PyPegen_expect_token(p, 9))
9417 &&
9418 (b = slices_rule(p))
9419 &&
9420 (literal_1 = _PyPegen_expect_token(p, 10))
9421 &&
9422 _PyPegen_lookahead(1, t_lookahead_rule, p)
9423 )
9424 {
9425 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9426 if (token == NULL) {
9427 return NULL;
9428 }
9429 int end_lineno = token->end_lineno;
9430 UNUSED(end_lineno); // Only used by EXTRA macro
9431 int end_col_offset = token->end_col_offset;
9432 UNUSED(end_col_offset); // Only used by EXTRA macro
9433 res = _Py_Subscript ( a , b , Load , EXTRA );
9434 if (res == NULL && PyErr_Occurred()) {
9435 p->error_indicator = 1;
9436 return NULL;
9437 }
9438 goto done;
9439 }
9440 p->mark = mark;
9441 }
9442 { // t_primary genexp &t_lookahead
9443 expr_ty a;
9444 expr_ty b;
9445 if (
9446 (a = t_primary_rule(p))
9447 &&
9448 (b = genexp_rule(p))
9449 &&
9450 _PyPegen_lookahead(1, t_lookahead_rule, p)
9451 )
9452 {
9453 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9454 if (token == NULL) {
9455 return NULL;
9456 }
9457 int end_lineno = token->end_lineno;
9458 UNUSED(end_lineno); // Only used by EXTRA macro
9459 int end_col_offset = token->end_col_offset;
9460 UNUSED(end_col_offset); // Only used by EXTRA macro
9461 res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
9462 if (res == NULL && PyErr_Occurred()) {
9463 p->error_indicator = 1;
9464 return NULL;
9465 }
9466 goto done;
9467 }
9468 p->mark = mark;
9469 }
9470 { // t_primary '(' arguments? ')' &t_lookahead
9471 expr_ty a;
9472 void *b;
9473 void *literal;
9474 void *literal_1;
9475 if (
9476 (a = t_primary_rule(p))
9477 &&
9478 (literal = _PyPegen_expect_token(p, 7))
9479 &&
9480 (b = arguments_rule(p), 1)
9481 &&
9482 (literal_1 = _PyPegen_expect_token(p, 8))
9483 &&
9484 _PyPegen_lookahead(1, t_lookahead_rule, p)
9485 )
9486 {
9487 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9488 if (token == NULL) {
9489 return NULL;
9490 }
9491 int end_lineno = token->end_lineno;
9492 UNUSED(end_lineno); // Only used by EXTRA macro
9493 int end_col_offset = token->end_col_offset;
9494 UNUSED(end_col_offset); // Only used by EXTRA macro
9495 res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
9496 if (res == NULL && PyErr_Occurred()) {
9497 p->error_indicator = 1;
9498 return NULL;
9499 }
9500 goto done;
9501 }
9502 p->mark = mark;
9503 }
9504 { // atom &t_lookahead
9505 expr_ty a;
9506 if (
9507 (a = atom_rule(p))
9508 &&
9509 _PyPegen_lookahead(1, t_lookahead_rule, p)
9510 )
9511 {
9512 res = a;
9513 if (res == NULL && PyErr_Occurred()) {
9514 p->error_indicator = 1;
9515 return NULL;
9516 }
9517 goto done;
9518 }
9519 p->mark = mark;
9520 }
9521 res = NULL;
9522 done:
9523 return res;
9524}
9525
9526// t_lookahead: '(' | '[' | '.'
9527static void *
9528t_lookahead_rule(Parser *p)
9529{
9530 if (p->error_indicator) {
9531 return NULL;
9532 }
9533 void * res = NULL;
9534 int mark = p->mark;
9535 { // '('
9536 void *literal;
9537 if (
9538 (literal = _PyPegen_expect_token(p, 7))
9539 )
9540 {
9541 res = literal;
9542 goto done;
9543 }
9544 p->mark = mark;
9545 }
9546 { // '['
9547 void *literal;
9548 if (
9549 (literal = _PyPegen_expect_token(p, 9))
9550 )
9551 {
9552 res = literal;
9553 goto done;
9554 }
9555 p->mark = mark;
9556 }
9557 { // '.'
9558 void *literal;
9559 if (
9560 (literal = _PyPegen_expect_token(p, 23))
9561 )
9562 {
9563 res = literal;
9564 goto done;
9565 }
9566 p->mark = mark;
9567 }
9568 res = NULL;
9569 done:
9570 return res;
9571}
9572
9573// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
9574static expr_ty
9575t_atom_rule(Parser *p)
9576{
9577 if (p->error_indicator) {
9578 return NULL;
9579 }
9580 expr_ty res = NULL;
9581 int mark = p->mark;
9582 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9583 p->error_indicator = 1;
9584 return NULL;
9585 }
9586 int start_lineno = p->tokens[mark]->lineno;
9587 UNUSED(start_lineno); // Only used by EXTRA macro
9588 int start_col_offset = p->tokens[mark]->col_offset;
9589 UNUSED(start_col_offset); // Only used by EXTRA macro
9590 { // NAME
9591 expr_ty a;
9592 if (
9593 (a = _PyPegen_name_token(p))
9594 )
9595 {
9596 res = _PyPegen_set_expr_context ( p , a , Store );
9597 if (res == NULL && PyErr_Occurred()) {
9598 p->error_indicator = 1;
9599 return NULL;
9600 }
9601 goto done;
9602 }
9603 p->mark = mark;
9604 }
9605 { // '(' target ')'
9606 expr_ty a;
9607 void *literal;
9608 void *literal_1;
9609 if (
9610 (literal = _PyPegen_expect_token(p, 7))
9611 &&
9612 (a = target_rule(p))
9613 &&
9614 (literal_1 = _PyPegen_expect_token(p, 8))
9615 )
9616 {
9617 res = _PyPegen_set_expr_context ( p , a , Store );
9618 if (res == NULL && PyErr_Occurred()) {
9619 p->error_indicator = 1;
9620 return NULL;
9621 }
9622 goto done;
9623 }
9624 p->mark = mark;
9625 }
9626 { // '(' targets? ')'
9627 void *b;
9628 void *literal;
9629 void *literal_1;
9630 if (
9631 (literal = _PyPegen_expect_token(p, 7))
9632 &&
9633 (b = targets_rule(p), 1)
9634 &&
9635 (literal_1 = _PyPegen_expect_token(p, 8))
9636 )
9637 {
9638 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9639 if (token == NULL) {
9640 return NULL;
9641 }
9642 int end_lineno = token->end_lineno;
9643 UNUSED(end_lineno); // Only used by EXTRA macro
9644 int end_col_offset = token->end_col_offset;
9645 UNUSED(end_col_offset); // Only used by EXTRA macro
9646 res = _Py_Tuple ( b , Store , EXTRA );
9647 if (res == NULL && PyErr_Occurred()) {
9648 p->error_indicator = 1;
9649 return NULL;
9650 }
9651 goto done;
9652 }
9653 p->mark = mark;
9654 }
9655 { // '[' targets? ']'
9656 void *b;
9657 void *literal;
9658 void *literal_1;
9659 if (
9660 (literal = _PyPegen_expect_token(p, 9))
9661 &&
9662 (b = targets_rule(p), 1)
9663 &&
9664 (literal_1 = _PyPegen_expect_token(p, 10))
9665 )
9666 {
9667 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9668 if (token == NULL) {
9669 return NULL;
9670 }
9671 int end_lineno = token->end_lineno;
9672 UNUSED(end_lineno); // Only used by EXTRA macro
9673 int end_col_offset = token->end_col_offset;
9674 UNUSED(end_col_offset); // Only used by EXTRA macro
9675 res = _Py_List ( b , Store , EXTRA );
9676 if (res == NULL && PyErr_Occurred()) {
9677 p->error_indicator = 1;
9678 return NULL;
9679 }
9680 goto done;
9681 }
9682 p->mark = mark;
9683 }
9684 res = NULL;
9685 done:
9686 return res;
9687}
9688
9689// incorrect_arguments:
9690// | args ',' '*'
9691// | expression for_if_clauses ',' [args | expression for_if_clauses]
9692// | args ',' args
9693static void *
9694incorrect_arguments_rule(Parser *p)
9695{
9696 if (p->error_indicator) {
9697 return NULL;
9698 }
9699 void * res = NULL;
9700 int mark = p->mark;
9701 { // args ',' '*'
9702 expr_ty args_var;
9703 void *literal;
9704 void *literal_1;
9705 if (
9706 (args_var = args_rule(p))
9707 &&
9708 (literal = _PyPegen_expect_token(p, 12))
9709 &&
9710 (literal_1 = _PyPegen_expect_token(p, 16))
9711 )
9712 {
9713 res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
9714 if (res == NULL && PyErr_Occurred()) {
9715 p->error_indicator = 1;
9716 return NULL;
9717 }
9718 goto done;
9719 }
9720 p->mark = mark;
9721 }
9722 { // expression for_if_clauses ',' [args | expression for_if_clauses]
9723 expr_ty expression_var;
9724 asdl_seq* for_if_clauses_var;
9725 void *literal;
9726 void *opt_var;
9727 UNUSED(opt_var); // Silence compiler warnings
9728 if (
9729 (expression_var = expression_rule(p))
9730 &&
9731 (for_if_clauses_var = for_if_clauses_rule(p))
9732 &&
9733 (literal = _PyPegen_expect_token(p, 12))
9734 &&
9735 (opt_var = _tmp_116_rule(p), 1)
9736 )
9737 {
9738 res = RAISE_SYNTAX_ERROR ( "Generator expression must be parenthesized" );
9739 if (res == NULL && PyErr_Occurred()) {
9740 p->error_indicator = 1;
9741 return NULL;
9742 }
9743 goto done;
9744 }
9745 p->mark = mark;
9746 }
9747 { // args ',' args
9748 expr_ty a;
9749 expr_ty args_var;
9750 void *literal;
9751 if (
9752 (a = args_rule(p))
9753 &&
9754 (literal = _PyPegen_expect_token(p, 12))
9755 &&
9756 (args_var = args_rule(p))
9757 )
9758 {
9759 res = _PyPegen_arguments_parsing_error ( p , a );
9760 if (res == NULL && PyErr_Occurred()) {
9761 p->error_indicator = 1;
9762 return NULL;
9763 }
9764 goto done;
9765 }
9766 p->mark = mark;
9767 }
9768 res = NULL;
9769 done:
9770 return res;
9771}
9772
9773// invalid_named_expression: expression ':=' expression
9774static void *
9775invalid_named_expression_rule(Parser *p)
9776{
9777 if (p->error_indicator) {
9778 return NULL;
9779 }
9780 void * res = NULL;
9781 int mark = p->mark;
9782 { // expression ':=' expression
9783 expr_ty a;
9784 expr_ty expression_var;
9785 void *literal;
9786 if (
9787 (a = expression_rule(p))
9788 &&
9789 (literal = _PyPegen_expect_token(p, 53))
9790 &&
9791 (expression_var = expression_rule(p))
9792 )
9793 {
9794 res = RAISE_SYNTAX_ERROR ( "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
9795 if (res == NULL && PyErr_Occurred()) {
9796 p->error_indicator = 1;
9797 return NULL;
9798 }
9799 goto done;
9800 }
9801 p->mark = mark;
9802 }
9803 res = NULL;
9804 done:
9805 return res;
9806}
9807
9808// invalid_assignment:
9809// | list ':'
9810// | tuple ':'
9811// | expression ':' expression ['=' annotated_rhs]
9812// | expression ('=' | augassign) (yield_expr | star_expressions)
9813static void *
9814invalid_assignment_rule(Parser *p)
9815{
9816 if (p->error_indicator) {
9817 return NULL;
9818 }
9819 void * res = NULL;
9820 int mark = p->mark;
9821 { // list ':'
9822 expr_ty list_var;
9823 void *literal;
9824 if (
9825 (list_var = list_rule(p))
9826 &&
9827 (literal = _PyPegen_expect_token(p, 11))
9828 )
9829 {
9830 res = RAISE_SYNTAX_ERROR ( "only single target (not list) can be annotated" );
9831 if (res == NULL && PyErr_Occurred()) {
9832 p->error_indicator = 1;
9833 return NULL;
9834 }
9835 goto done;
9836 }
9837 p->mark = mark;
9838 }
9839 { // tuple ':'
9840 void *literal;
9841 expr_ty tuple_var;
9842 if (
9843 (tuple_var = tuple_rule(p))
9844 &&
9845 (literal = _PyPegen_expect_token(p, 11))
9846 )
9847 {
9848 res = RAISE_SYNTAX_ERROR ( "only single target (not tuple) can be annotated" );
9849 if (res == NULL && PyErr_Occurred()) {
9850 p->error_indicator = 1;
9851 return NULL;
9852 }
9853 goto done;
9854 }
9855 p->mark = mark;
9856 }
9857 { // expression ':' expression ['=' annotated_rhs]
9858 expr_ty expression_var;
9859 expr_ty expression_var_1;
9860 void *literal;
9861 void *opt_var;
9862 UNUSED(opt_var); // Silence compiler warnings
9863 if (
9864 (expression_var = expression_rule(p))
9865 &&
9866 (literal = _PyPegen_expect_token(p, 11))
9867 &&
9868 (expression_var_1 = expression_rule(p))
9869 &&
9870 (opt_var = _tmp_117_rule(p), 1)
9871 )
9872 {
9873 res = RAISE_SYNTAX_ERROR ( "illegal target for annotation" );
9874 if (res == NULL && PyErr_Occurred()) {
9875 p->error_indicator = 1;
9876 return NULL;
9877 }
9878 goto done;
9879 }
9880 p->mark = mark;
9881 }
9882 { // expression ('=' | augassign) (yield_expr | star_expressions)
9883 void *_tmp_118_var;
9884 void *_tmp_119_var;
9885 expr_ty a;
9886 if (
9887 (a = expression_rule(p))
9888 &&
9889 (_tmp_118_var = _tmp_118_rule(p))
9890 &&
9891 (_tmp_119_var = _tmp_119_rule(p))
9892 )
9893 {
9894 res = RAISE_SYNTAX_ERROR ( "cannot assign to %s" , _PyPegen_get_expr_name ( a ) );
9895 if (res == NULL && PyErr_Occurred()) {
9896 p->error_indicator = 1;
9897 return NULL;
9898 }
9899 goto done;
9900 }
9901 p->mark = mark;
9902 }
9903 res = NULL;
9904 done:
9905 return res;
9906}
9907
9908// invalid_block: NEWLINE !INDENT
9909static void *
9910invalid_block_rule(Parser *p)
9911{
9912 if (p->error_indicator) {
9913 return NULL;
9914 }
9915 void * res = NULL;
9916 int mark = p->mark;
9917 { // NEWLINE !INDENT
9918 void *newline_var;
9919 if (
9920 (newline_var = _PyPegen_newline_token(p))
9921 &&
9922 _PyPegen_lookahead(0, _PyPegen_indent_token, p)
9923 )
9924 {
9925 res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
9926 if (res == NULL && PyErr_Occurred()) {
9927 p->error_indicator = 1;
9928 return NULL;
9929 }
9930 goto done;
9931 }
9932 p->mark = mark;
9933 }
9934 res = NULL;
9935 done:
9936 return res;
9937}
9938
9939// invalid_comprehension: ('[' | '(' | '{') '*' expression for_if_clauses
9940static void *
9941invalid_comprehension_rule(Parser *p)
9942{
9943 if (p->error_indicator) {
9944 return NULL;
9945 }
9946 void * res = NULL;
9947 int mark = p->mark;
9948 { // ('[' | '(' | '{') '*' expression for_if_clauses
9949 void *_tmp_120_var;
9950 expr_ty expression_var;
9951 asdl_seq* for_if_clauses_var;
9952 void *literal;
9953 if (
9954 (_tmp_120_var = _tmp_120_rule(p))
9955 &&
9956 (literal = _PyPegen_expect_token(p, 16))
9957 &&
9958 (expression_var = expression_rule(p))
9959 &&
9960 (for_if_clauses_var = for_if_clauses_rule(p))
9961 )
9962 {
9963 res = RAISE_SYNTAX_ERROR ( "iterable unpacking cannot be used in comprehension" );
9964 if (res == NULL && PyErr_Occurred()) {
9965 p->error_indicator = 1;
9966 return NULL;
9967 }
9968 goto done;
9969 }
9970 p->mark = mark;
9971 }
9972 res = NULL;
9973 done:
9974 return res;
9975}
9976
9977// invalid_parameters:
9978// | [plain_names ','] (slash_with_default | names_with_default) ',' plain_names
9979static void *
9980invalid_parameters_rule(Parser *p)
9981{
9982 if (p->error_indicator) {
9983 return NULL;
9984 }
9985 void * res = NULL;
9986 int mark = p->mark;
9987 { // [plain_names ','] (slash_with_default | names_with_default) ',' plain_names
9988 void *_tmp_122_var;
9989 void *literal;
9990 void *opt_var;
9991 UNUSED(opt_var); // Silence compiler warnings
9992 asdl_seq* plain_names_var;
9993 if (
9994 (opt_var = _tmp_121_rule(p), 1)
9995 &&
9996 (_tmp_122_var = _tmp_122_rule(p))
9997 &&
9998 (literal = _PyPegen_expect_token(p, 12))
9999 &&
10000 (plain_names_var = plain_names_rule(p))
10001 )
10002 {
10003 res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
10004 if (res == NULL && PyErr_Occurred()) {
10005 p->error_indicator = 1;
10006 return NULL;
10007 }
10008 goto done;
10009 }
10010 p->mark = mark;
10011 }
10012 res = NULL;
10013 done:
10014 return res;
10015}
10016
10017// _loop0_1: NEWLINE
10018static asdl_seq *
10019_loop0_1_rule(Parser *p)
10020{
10021 if (p->error_indicator) {
10022 return NULL;
10023 }
10024 void *res = NULL;
10025 int mark = p->mark;
10026 int start_mark = p->mark;
10027 void **children = PyMem_Malloc(sizeof(void *));
10028 if (!children) {
10029 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10030 return NULL;
10031 }
10032 ssize_t children_capacity = 1;
10033 ssize_t n = 0;
10034 { // NEWLINE
10035 void *newline_var;
10036 while (
10037 (newline_var = _PyPegen_newline_token(p))
10038 )
10039 {
10040 res = newline_var;
10041 if (n == children_capacity) {
10042 children_capacity *= 2;
10043 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10044 if (!children) {
10045 PyErr_Format(PyExc_MemoryError, "realloc None");
10046 return NULL;
10047 }
10048 }
10049 children[n++] = res;
10050 mark = p->mark;
10051 }
10052 p->mark = mark;
10053 }
10054 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10055 if (!seq) {
10056 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_1");
10057 PyMem_Free(children);
10058 return NULL;
10059 }
10060 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10061 PyMem_Free(children);
10062 _PyPegen_insert_memo(p, start_mark, _loop0_1_type, seq);
10063 return seq;
10064}
10065
10066// _loop1_2: statement
10067static asdl_seq *
10068_loop1_2_rule(Parser *p)
10069{
10070 if (p->error_indicator) {
10071 return NULL;
10072 }
10073 void *res = NULL;
10074 int mark = p->mark;
10075 int start_mark = p->mark;
10076 void **children = PyMem_Malloc(sizeof(void *));
10077 if (!children) {
10078 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10079 return NULL;
10080 }
10081 ssize_t children_capacity = 1;
10082 ssize_t n = 0;
10083 { // statement
10084 asdl_seq* statement_var;
10085 while (
10086 (statement_var = statement_rule(p))
10087 )
10088 {
10089 res = statement_var;
10090 if (n == children_capacity) {
10091 children_capacity *= 2;
10092 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10093 if (!children) {
10094 PyErr_Format(PyExc_MemoryError, "realloc None");
10095 return NULL;
10096 }
10097 }
10098 children[n++] = res;
10099 mark = p->mark;
10100 }
10101 p->mark = mark;
10102 }
10103 if (n == 0) {
10104 PyMem_Free(children);
10105 return NULL;
10106 }
10107 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10108 if (!seq) {
10109 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_2");
10110 PyMem_Free(children);
10111 return NULL;
10112 }
10113 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10114 PyMem_Free(children);
10115 _PyPegen_insert_memo(p, start_mark, _loop1_2_type, seq);
10116 return seq;
10117}
10118
10119// _loop0_4: ';' small_stmt
10120static asdl_seq *
10121_loop0_4_rule(Parser *p)
10122{
10123 if (p->error_indicator) {
10124 return NULL;
10125 }
10126 void *res = NULL;
10127 int mark = p->mark;
10128 int start_mark = p->mark;
10129 void **children = PyMem_Malloc(sizeof(void *));
10130 if (!children) {
10131 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10132 return NULL;
10133 }
10134 ssize_t children_capacity = 1;
10135 ssize_t n = 0;
10136 { // ';' small_stmt
10137 stmt_ty elem;
10138 void *literal;
10139 while (
10140 (literal = _PyPegen_expect_token(p, 13))
10141 &&
10142 (elem = small_stmt_rule(p))
10143 )
10144 {
10145 res = elem;
10146 if (res == NULL && PyErr_Occurred()) {
10147 p->error_indicator = 1;
10148 PyMem_Free(children);
10149 return NULL;
10150 }
10151 if (n == children_capacity) {
10152 children_capacity *= 2;
10153 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10154 if (!children) {
10155 PyErr_Format(PyExc_MemoryError, "realloc None");
10156 return NULL;
10157 }
10158 }
10159 children[n++] = res;
10160 mark = p->mark;
10161 }
10162 p->mark = mark;
10163 }
10164 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10165 if (!seq) {
10166 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_4");
10167 PyMem_Free(children);
10168 return NULL;
10169 }
10170 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10171 PyMem_Free(children);
10172 _PyPegen_insert_memo(p, start_mark, _loop0_4_type, seq);
10173 return seq;
10174}
10175
10176// _gather_3: small_stmt _loop0_4
10177static asdl_seq *
10178_gather_3_rule(Parser *p)
10179{
10180 if (p->error_indicator) {
10181 return NULL;
10182 }
10183 asdl_seq * res = NULL;
10184 int mark = p->mark;
10185 { // small_stmt _loop0_4
10186 stmt_ty elem;
10187 asdl_seq * seq;
10188 if (
10189 (elem = small_stmt_rule(p))
10190 &&
10191 (seq = _loop0_4_rule(p))
10192 )
10193 {
10194 res = _PyPegen_seq_insert_in_front(p, elem, seq);
10195 goto done;
10196 }
10197 p->mark = mark;
10198 }
10199 res = NULL;
10200 done:
10201 return res;
10202}
10203
10204// _tmp_5: 'import' | 'from'
10205static void *
10206_tmp_5_rule(Parser *p)
10207{
10208 if (p->error_indicator) {
10209 return NULL;
10210 }
10211 void * res = NULL;
10212 int mark = p->mark;
10213 { // 'import'
10214 void *keyword;
10215 if (
10216 (keyword = _PyPegen_expect_token(p, 513))
10217 )
10218 {
10219 res = keyword;
10220 goto done;
10221 }
10222 p->mark = mark;
10223 }
10224 { // 'from'
10225 void *keyword;
10226 if (
10227 (keyword = _PyPegen_expect_token(p, 514))
10228 )
10229 {
10230 res = keyword;
10231 goto done;
10232 }
10233 p->mark = mark;
10234 }
10235 res = NULL;
10236 done:
10237 return res;
10238}
10239
10240// _tmp_6: 'def' | '@' | ASYNC
10241static void *
10242_tmp_6_rule(Parser *p)
10243{
10244 if (p->error_indicator) {
10245 return NULL;
10246 }
10247 void * res = NULL;
10248 int mark = p->mark;
10249 { // 'def'
10250 void *keyword;
10251 if (
10252 (keyword = _PyPegen_expect_token(p, 522))
10253 )
10254 {
10255 res = keyword;
10256 goto done;
10257 }
10258 p->mark = mark;
10259 }
10260 { // '@'
10261 void *literal;
10262 if (
10263 (literal = _PyPegen_expect_token(p, 49))
10264 )
10265 {
10266 res = literal;
10267 goto done;
10268 }
10269 p->mark = mark;
10270 }
10271 { // ASYNC
10272 void *async_var;
10273 if (
10274 (async_var = _PyPegen_async_token(p))
10275 )
10276 {
10277 res = async_var;
10278 goto done;
10279 }
10280 p->mark = mark;
10281 }
10282 res = NULL;
10283 done:
10284 return res;
10285}
10286
10287// _tmp_7: 'class' | '@'
10288static void *
10289_tmp_7_rule(Parser *p)
10290{
10291 if (p->error_indicator) {
10292 return NULL;
10293 }
10294 void * res = NULL;
10295 int mark = p->mark;
10296 { // 'class'
10297 void *keyword;
10298 if (
10299 (keyword = _PyPegen_expect_token(p, 523))
10300 )
10301 {
10302 res = keyword;
10303 goto done;
10304 }
10305 p->mark = mark;
10306 }
10307 { // '@'
10308 void *literal;
10309 if (
10310 (literal = _PyPegen_expect_token(p, 49))
10311 )
10312 {
10313 res = literal;
10314 goto done;
10315 }
10316 p->mark = mark;
10317 }
10318 res = NULL;
10319 done:
10320 return res;
10321}
10322
10323// _tmp_8: 'with' | ASYNC
10324static void *
10325_tmp_8_rule(Parser *p)
10326{
10327 if (p->error_indicator) {
10328 return NULL;
10329 }
10330 void * res = NULL;
10331 int mark = p->mark;
10332 { // 'with'
10333 void *keyword;
10334 if (
10335 (keyword = _PyPegen_expect_token(p, 519))
10336 )
10337 {
10338 res = keyword;
10339 goto done;
10340 }
10341 p->mark = mark;
10342 }
10343 { // ASYNC
10344 void *async_var;
10345 if (
10346 (async_var = _PyPegen_async_token(p))
10347 )
10348 {
10349 res = async_var;
10350 goto done;
10351 }
10352 p->mark = mark;
10353 }
10354 res = NULL;
10355 done:
10356 return res;
10357}
10358
10359// _tmp_9: 'for' | ASYNC
10360static void *
10361_tmp_9_rule(Parser *p)
10362{
10363 if (p->error_indicator) {
10364 return NULL;
10365 }
10366 void * res = NULL;
10367 int mark = p->mark;
10368 { // 'for'
10369 void *keyword;
10370 if (
10371 (keyword = _PyPegen_expect_token(p, 517))
10372 )
10373 {
10374 res = keyword;
10375 goto done;
10376 }
10377 p->mark = mark;
10378 }
10379 { // ASYNC
10380 void *async_var;
10381 if (
10382 (async_var = _PyPegen_async_token(p))
10383 )
10384 {
10385 res = async_var;
10386 goto done;
10387 }
10388 p->mark = mark;
10389 }
10390 res = NULL;
10391 done:
10392 return res;
10393}
10394
10395// _tmp_10: '=' annotated_rhs
10396static void *
10397_tmp_10_rule(Parser *p)
10398{
10399 if (p->error_indicator) {
10400 return NULL;
10401 }
10402 void * res = NULL;
10403 int mark = p->mark;
10404 { // '=' annotated_rhs
10405 expr_ty d;
10406 void *literal;
10407 if (
10408 (literal = _PyPegen_expect_token(p, 22))
10409 &&
10410 (d = annotated_rhs_rule(p))
10411 )
10412 {
10413 res = d;
10414 if (res == NULL && PyErr_Occurred()) {
10415 p->error_indicator = 1;
10416 return NULL;
10417 }
10418 goto done;
10419 }
10420 p->mark = mark;
10421 }
10422 res = NULL;
10423 done:
10424 return res;
10425}
10426
10427// _tmp_11: '(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target
10428static void *
10429_tmp_11_rule(Parser *p)
10430{
10431 if (p->error_indicator) {
10432 return NULL;
10433 }
10434 void * res = NULL;
10435 int mark = p->mark;
10436 { // '(' inside_paren_ann_assign_target ')'
10437 expr_ty b;
10438 void *literal;
10439 void *literal_1;
10440 if (
10441 (literal = _PyPegen_expect_token(p, 7))
10442 &&
10443 (b = inside_paren_ann_assign_target_rule(p))
10444 &&
10445 (literal_1 = _PyPegen_expect_token(p, 8))
10446 )
10447 {
10448 res = b;
10449 if (res == NULL && PyErr_Occurred()) {
10450 p->error_indicator = 1;
10451 return NULL;
10452 }
10453 goto done;
10454 }
10455 p->mark = mark;
10456 }
10457 { // ann_assign_subscript_attribute_target
10458 expr_ty ann_assign_subscript_attribute_target_var;
10459 if (
10460 (ann_assign_subscript_attribute_target_var = ann_assign_subscript_attribute_target_rule(p))
10461 )
10462 {
10463 res = ann_assign_subscript_attribute_target_var;
10464 goto done;
10465 }
10466 p->mark = mark;
10467 }
10468 res = NULL;
10469 done:
10470 return res;
10471}
10472
10473// _tmp_12: '=' annotated_rhs
10474static void *
10475_tmp_12_rule(Parser *p)
10476{
10477 if (p->error_indicator) {
10478 return NULL;
10479 }
10480 void * res = NULL;
10481 int mark = p->mark;
10482 { // '=' annotated_rhs
10483 expr_ty d;
10484 void *literal;
10485 if (
10486 (literal = _PyPegen_expect_token(p, 22))
10487 &&
10488 (d = annotated_rhs_rule(p))
10489 )
10490 {
10491 res = d;
10492 if (res == NULL && PyErr_Occurred()) {
10493 p->error_indicator = 1;
10494 return NULL;
10495 }
10496 goto done;
10497 }
10498 p->mark = mark;
10499 }
10500 res = NULL;
10501 done:
10502 return res;
10503}
10504
10505// _loop1_13: (star_targets '=')
10506static asdl_seq *
10507_loop1_13_rule(Parser *p)
10508{
10509 if (p->error_indicator) {
10510 return NULL;
10511 }
10512 void *res = NULL;
10513 int mark = p->mark;
10514 int start_mark = p->mark;
10515 void **children = PyMem_Malloc(sizeof(void *));
10516 if (!children) {
10517 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10518 return NULL;
10519 }
10520 ssize_t children_capacity = 1;
10521 ssize_t n = 0;
10522 { // (star_targets '=')
10523 void *_tmp_123_var;
10524 while (
10525 (_tmp_123_var = _tmp_123_rule(p))
10526 )
10527 {
10528 res = _tmp_123_var;
10529 if (n == children_capacity) {
10530 children_capacity *= 2;
10531 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10532 if (!children) {
10533 PyErr_Format(PyExc_MemoryError, "realloc None");
10534 return NULL;
10535 }
10536 }
10537 children[n++] = res;
10538 mark = p->mark;
10539 }
10540 p->mark = mark;
10541 }
10542 if (n == 0) {
10543 PyMem_Free(children);
10544 return NULL;
10545 }
10546 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10547 if (!seq) {
10548 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_13");
10549 PyMem_Free(children);
10550 return NULL;
10551 }
10552 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10553 PyMem_Free(children);
10554 _PyPegen_insert_memo(p, start_mark, _loop1_13_type, seq);
10555 return seq;
10556}
10557
10558// _tmp_14: yield_expr | star_expressions
10559static void *
10560_tmp_14_rule(Parser *p)
10561{
10562 if (p->error_indicator) {
10563 return NULL;
10564 }
10565 void * res = NULL;
10566 int mark = p->mark;
10567 { // yield_expr
10568 expr_ty yield_expr_var;
10569 if (
10570 (yield_expr_var = yield_expr_rule(p))
10571 )
10572 {
10573 res = yield_expr_var;
10574 goto done;
10575 }
10576 p->mark = mark;
10577 }
10578 { // star_expressions
10579 expr_ty star_expressions_var;
10580 if (
10581 (star_expressions_var = star_expressions_rule(p))
10582 )
10583 {
10584 res = star_expressions_var;
10585 goto done;
10586 }
10587 p->mark = mark;
10588 }
10589 res = NULL;
10590 done:
10591 return res;
10592}
10593
10594// _tmp_15: yield_expr | star_expressions
10595static void *
10596_tmp_15_rule(Parser *p)
10597{
10598 if (p->error_indicator) {
10599 return NULL;
10600 }
10601 void * res = NULL;
10602 int mark = p->mark;
10603 { // yield_expr
10604 expr_ty yield_expr_var;
10605 if (
10606 (yield_expr_var = yield_expr_rule(p))
10607 )
10608 {
10609 res = yield_expr_var;
10610 goto done;
10611 }
10612 p->mark = mark;
10613 }
10614 { // star_expressions
10615 expr_ty star_expressions_var;
10616 if (
10617 (star_expressions_var = star_expressions_rule(p))
10618 )
10619 {
10620 res = star_expressions_var;
10621 goto done;
10622 }
10623 p->mark = mark;
10624 }
10625 res = NULL;
10626 done:
10627 return res;
10628}
10629
10630// _loop0_17: ',' NAME
10631static asdl_seq *
10632_loop0_17_rule(Parser *p)
10633{
10634 if (p->error_indicator) {
10635 return NULL;
10636 }
10637 void *res = NULL;
10638 int mark = p->mark;
10639 int start_mark = p->mark;
10640 void **children = PyMem_Malloc(sizeof(void *));
10641 if (!children) {
10642 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10643 return NULL;
10644 }
10645 ssize_t children_capacity = 1;
10646 ssize_t n = 0;
10647 { // ',' NAME
10648 expr_ty elem;
10649 void *literal;
10650 while (
10651 (literal = _PyPegen_expect_token(p, 12))
10652 &&
10653 (elem = _PyPegen_name_token(p))
10654 )
10655 {
10656 res = elem;
10657 if (res == NULL && PyErr_Occurred()) {
10658 p->error_indicator = 1;
10659 PyMem_Free(children);
10660 return NULL;
10661 }
10662 if (n == children_capacity) {
10663 children_capacity *= 2;
10664 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10665 if (!children) {
10666 PyErr_Format(PyExc_MemoryError, "realloc None");
10667 return NULL;
10668 }
10669 }
10670 children[n++] = res;
10671 mark = p->mark;
10672 }
10673 p->mark = mark;
10674 }
10675 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10676 if (!seq) {
10677 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_17");
10678 PyMem_Free(children);
10679 return NULL;
10680 }
10681 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10682 PyMem_Free(children);
10683 _PyPegen_insert_memo(p, start_mark, _loop0_17_type, seq);
10684 return seq;
10685}
10686
10687// _gather_16: NAME _loop0_17
10688static asdl_seq *
10689_gather_16_rule(Parser *p)
10690{
10691 if (p->error_indicator) {
10692 return NULL;
10693 }
10694 asdl_seq * res = NULL;
10695 int mark = p->mark;
10696 { // NAME _loop0_17
10697 expr_ty elem;
10698 asdl_seq * seq;
10699 if (
10700 (elem = _PyPegen_name_token(p))
10701 &&
10702 (seq = _loop0_17_rule(p))
10703 )
10704 {
10705 res = _PyPegen_seq_insert_in_front(p, elem, seq);
10706 goto done;
10707 }
10708 p->mark = mark;
10709 }
10710 res = NULL;
10711 done:
10712 return res;
10713}
10714
10715// _loop0_19: ',' NAME
10716static asdl_seq *
10717_loop0_19_rule(Parser *p)
10718{
10719 if (p->error_indicator) {
10720 return NULL;
10721 }
10722 void *res = NULL;
10723 int mark = p->mark;
10724 int start_mark = p->mark;
10725 void **children = PyMem_Malloc(sizeof(void *));
10726 if (!children) {
10727 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10728 return NULL;
10729 }
10730 ssize_t children_capacity = 1;
10731 ssize_t n = 0;
10732 { // ',' NAME
10733 expr_ty elem;
10734 void *literal;
10735 while (
10736 (literal = _PyPegen_expect_token(p, 12))
10737 &&
10738 (elem = _PyPegen_name_token(p))
10739 )
10740 {
10741 res = elem;
10742 if (res == NULL && PyErr_Occurred()) {
10743 p->error_indicator = 1;
10744 PyMem_Free(children);
10745 return NULL;
10746 }
10747 if (n == children_capacity) {
10748 children_capacity *= 2;
10749 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10750 if (!children) {
10751 PyErr_Format(PyExc_MemoryError, "realloc None");
10752 return NULL;
10753 }
10754 }
10755 children[n++] = res;
10756 mark = p->mark;
10757 }
10758 p->mark = mark;
10759 }
10760 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10761 if (!seq) {
10762 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_19");
10763 PyMem_Free(children);
10764 return NULL;
10765 }
10766 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10767 PyMem_Free(children);
10768 _PyPegen_insert_memo(p, start_mark, _loop0_19_type, seq);
10769 return seq;
10770}
10771
10772// _gather_18: NAME _loop0_19
10773static asdl_seq *
10774_gather_18_rule(Parser *p)
10775{
10776 if (p->error_indicator) {
10777 return NULL;
10778 }
10779 asdl_seq * res = NULL;
10780 int mark = p->mark;
10781 { // NAME _loop0_19
10782 expr_ty elem;
10783 asdl_seq * seq;
10784 if (
10785 (elem = _PyPegen_name_token(p))
10786 &&
10787 (seq = _loop0_19_rule(p))
10788 )
10789 {
10790 res = _PyPegen_seq_insert_in_front(p, elem, seq);
10791 goto done;
10792 }
10793 p->mark = mark;
10794 }
10795 res = NULL;
10796 done:
10797 return res;
10798}
10799
10800// _tmp_20: ',' expression
10801static void *
10802_tmp_20_rule(Parser *p)
10803{
10804 if (p->error_indicator) {
10805 return NULL;
10806 }
10807 void * res = NULL;
10808 int mark = p->mark;
10809 { // ',' expression
10810 void *literal;
10811 expr_ty z;
10812 if (
10813 (literal = _PyPegen_expect_token(p, 12))
10814 &&
10815 (z = expression_rule(p))
10816 )
10817 {
10818 res = z;
10819 if (res == NULL && PyErr_Occurred()) {
10820 p->error_indicator = 1;
10821 return NULL;
10822 }
10823 goto done;
10824 }
10825 p->mark = mark;
10826 }
10827 res = NULL;
10828 done:
10829 return res;
10830}
10831
10832// _loop0_21: ('.' | '...')
10833static asdl_seq *
10834_loop0_21_rule(Parser *p)
10835{
10836 if (p->error_indicator) {
10837 return NULL;
10838 }
10839 void *res = NULL;
10840 int mark = p->mark;
10841 int start_mark = p->mark;
10842 void **children = PyMem_Malloc(sizeof(void *));
10843 if (!children) {
10844 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10845 return NULL;
10846 }
10847 ssize_t children_capacity = 1;
10848 ssize_t n = 0;
10849 { // ('.' | '...')
10850 void *_tmp_124_var;
10851 while (
10852 (_tmp_124_var = _tmp_124_rule(p))
10853 )
10854 {
10855 res = _tmp_124_var;
10856 if (n == children_capacity) {
10857 children_capacity *= 2;
10858 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10859 if (!children) {
10860 PyErr_Format(PyExc_MemoryError, "realloc None");
10861 return NULL;
10862 }
10863 }
10864 children[n++] = res;
10865 mark = p->mark;
10866 }
10867 p->mark = mark;
10868 }
10869 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10870 if (!seq) {
10871 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_21");
10872 PyMem_Free(children);
10873 return NULL;
10874 }
10875 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10876 PyMem_Free(children);
10877 _PyPegen_insert_memo(p, start_mark, _loop0_21_type, seq);
10878 return seq;
10879}
10880
10881// _loop1_22: ('.' | '...')
10882static asdl_seq *
10883_loop1_22_rule(Parser *p)
10884{
10885 if (p->error_indicator) {
10886 return NULL;
10887 }
10888 void *res = NULL;
10889 int mark = p->mark;
10890 int start_mark = p->mark;
10891 void **children = PyMem_Malloc(sizeof(void *));
10892 if (!children) {
10893 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10894 return NULL;
10895 }
10896 ssize_t children_capacity = 1;
10897 ssize_t n = 0;
10898 { // ('.' | '...')
10899 void *_tmp_125_var;
10900 while (
10901 (_tmp_125_var = _tmp_125_rule(p))
10902 )
10903 {
10904 res = _tmp_125_var;
10905 if (n == children_capacity) {
10906 children_capacity *= 2;
10907 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10908 if (!children) {
10909 PyErr_Format(PyExc_MemoryError, "realloc None");
10910 return NULL;
10911 }
10912 }
10913 children[n++] = res;
10914 mark = p->mark;
10915 }
10916 p->mark = mark;
10917 }
10918 if (n == 0) {
10919 PyMem_Free(children);
10920 return NULL;
10921 }
10922 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10923 if (!seq) {
10924 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_22");
10925 PyMem_Free(children);
10926 return NULL;
10927 }
10928 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10929 PyMem_Free(children);
10930 _PyPegen_insert_memo(p, start_mark, _loop1_22_type, seq);
10931 return seq;
10932}
10933
10934// _loop0_24: ',' import_from_as_name
10935static asdl_seq *
10936_loop0_24_rule(Parser *p)
10937{
10938 if (p->error_indicator) {
10939 return NULL;
10940 }
10941 void *res = NULL;
10942 int mark = p->mark;
10943 int start_mark = p->mark;
10944 void **children = PyMem_Malloc(sizeof(void *));
10945 if (!children) {
10946 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10947 return NULL;
10948 }
10949 ssize_t children_capacity = 1;
10950 ssize_t n = 0;
10951 { // ',' import_from_as_name
10952 alias_ty elem;
10953 void *literal;
10954 while (
10955 (literal = _PyPegen_expect_token(p, 12))
10956 &&
10957 (elem = import_from_as_name_rule(p))
10958 )
10959 {
10960 res = elem;
10961 if (res == NULL && PyErr_Occurred()) {
10962 p->error_indicator = 1;
10963 PyMem_Free(children);
10964 return NULL;
10965 }
10966 if (n == children_capacity) {
10967 children_capacity *= 2;
10968 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10969 if (!children) {
10970 PyErr_Format(PyExc_MemoryError, "realloc None");
10971 return NULL;
10972 }
10973 }
10974 children[n++] = res;
10975 mark = p->mark;
10976 }
10977 p->mark = mark;
10978 }
10979 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10980 if (!seq) {
10981 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_24");
10982 PyMem_Free(children);
10983 return NULL;
10984 }
10985 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10986 PyMem_Free(children);
10987 _PyPegen_insert_memo(p, start_mark, _loop0_24_type, seq);
10988 return seq;
10989}
10990
10991// _gather_23: import_from_as_name _loop0_24
10992static asdl_seq *
10993_gather_23_rule(Parser *p)
10994{
10995 if (p->error_indicator) {
10996 return NULL;
10997 }
10998 asdl_seq * res = NULL;
10999 int mark = p->mark;
11000 { // import_from_as_name _loop0_24
11001 alias_ty elem;
11002 asdl_seq * seq;
11003 if (
11004 (elem = import_from_as_name_rule(p))
11005 &&
11006 (seq = _loop0_24_rule(p))
11007 )
11008 {
11009 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11010 goto done;
11011 }
11012 p->mark = mark;
11013 }
11014 res = NULL;
11015 done:
11016 return res;
11017}
11018
11019// _tmp_25: 'as' NAME
11020static void *
11021_tmp_25_rule(Parser *p)
11022{
11023 if (p->error_indicator) {
11024 return NULL;
11025 }
11026 void * res = NULL;
11027 int mark = p->mark;
11028 { // 'as' NAME
11029 void *keyword;
11030 expr_ty z;
11031 if (
11032 (keyword = _PyPegen_expect_token(p, 531))
11033 &&
11034 (z = _PyPegen_name_token(p))
11035 )
11036 {
11037 res = z;
11038 if (res == NULL && PyErr_Occurred()) {
11039 p->error_indicator = 1;
11040 return NULL;
11041 }
11042 goto done;
11043 }
11044 p->mark = mark;
11045 }
11046 res = NULL;
11047 done:
11048 return res;
11049}
11050
11051// _loop0_27: ',' dotted_as_name
11052static asdl_seq *
11053_loop0_27_rule(Parser *p)
11054{
11055 if (p->error_indicator) {
11056 return NULL;
11057 }
11058 void *res = NULL;
11059 int mark = p->mark;
11060 int start_mark = p->mark;
11061 void **children = PyMem_Malloc(sizeof(void *));
11062 if (!children) {
11063 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11064 return NULL;
11065 }
11066 ssize_t children_capacity = 1;
11067 ssize_t n = 0;
11068 { // ',' dotted_as_name
11069 alias_ty elem;
11070 void *literal;
11071 while (
11072 (literal = _PyPegen_expect_token(p, 12))
11073 &&
11074 (elem = dotted_as_name_rule(p))
11075 )
11076 {
11077 res = elem;
11078 if (res == NULL && PyErr_Occurred()) {
11079 p->error_indicator = 1;
11080 PyMem_Free(children);
11081 return NULL;
11082 }
11083 if (n == children_capacity) {
11084 children_capacity *= 2;
11085 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11086 if (!children) {
11087 PyErr_Format(PyExc_MemoryError, "realloc None");
11088 return NULL;
11089 }
11090 }
11091 children[n++] = res;
11092 mark = p->mark;
11093 }
11094 p->mark = mark;
11095 }
11096 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11097 if (!seq) {
11098 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_27");
11099 PyMem_Free(children);
11100 return NULL;
11101 }
11102 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11103 PyMem_Free(children);
11104 _PyPegen_insert_memo(p, start_mark, _loop0_27_type, seq);
11105 return seq;
11106}
11107
11108// _gather_26: dotted_as_name _loop0_27
11109static asdl_seq *
11110_gather_26_rule(Parser *p)
11111{
11112 if (p->error_indicator) {
11113 return NULL;
11114 }
11115 asdl_seq * res = NULL;
11116 int mark = p->mark;
11117 { // dotted_as_name _loop0_27
11118 alias_ty elem;
11119 asdl_seq * seq;
11120 if (
11121 (elem = dotted_as_name_rule(p))
11122 &&
11123 (seq = _loop0_27_rule(p))
11124 )
11125 {
11126 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11127 goto done;
11128 }
11129 p->mark = mark;
11130 }
11131 res = NULL;
11132 done:
11133 return res;
11134}
11135
11136// _tmp_28: 'as' NAME
11137static void *
11138_tmp_28_rule(Parser *p)
11139{
11140 if (p->error_indicator) {
11141 return NULL;
11142 }
11143 void * res = NULL;
11144 int mark = p->mark;
11145 { // 'as' NAME
11146 void *keyword;
11147 expr_ty z;
11148 if (
11149 (keyword = _PyPegen_expect_token(p, 531))
11150 &&
11151 (z = _PyPegen_name_token(p))
11152 )
11153 {
11154 res = z;
11155 if (res == NULL && PyErr_Occurred()) {
11156 p->error_indicator = 1;
11157 return NULL;
11158 }
11159 goto done;
11160 }
11161 p->mark = mark;
11162 }
11163 res = NULL;
11164 done:
11165 return res;
11166}
11167
11168// _loop0_30: ',' with_item
11169static asdl_seq *
11170_loop0_30_rule(Parser *p)
11171{
11172 if (p->error_indicator) {
11173 return NULL;
11174 }
11175 void *res = NULL;
11176 int mark = p->mark;
11177 int start_mark = p->mark;
11178 void **children = PyMem_Malloc(sizeof(void *));
11179 if (!children) {
11180 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11181 return NULL;
11182 }
11183 ssize_t children_capacity = 1;
11184 ssize_t n = 0;
11185 { // ',' with_item
11186 withitem_ty elem;
11187 void *literal;
11188 while (
11189 (literal = _PyPegen_expect_token(p, 12))
11190 &&
11191 (elem = with_item_rule(p))
11192 )
11193 {
11194 res = elem;
11195 if (res == NULL && PyErr_Occurred()) {
11196 p->error_indicator = 1;
11197 PyMem_Free(children);
11198 return NULL;
11199 }
11200 if (n == children_capacity) {
11201 children_capacity *= 2;
11202 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11203 if (!children) {
11204 PyErr_Format(PyExc_MemoryError, "realloc None");
11205 return NULL;
11206 }
11207 }
11208 children[n++] = res;
11209 mark = p->mark;
11210 }
11211 p->mark = mark;
11212 }
11213 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11214 if (!seq) {
11215 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_30");
11216 PyMem_Free(children);
11217 return NULL;
11218 }
11219 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11220 PyMem_Free(children);
11221 _PyPegen_insert_memo(p, start_mark, _loop0_30_type, seq);
11222 return seq;
11223}
11224
11225// _gather_29: with_item _loop0_30
11226static asdl_seq *
11227_gather_29_rule(Parser *p)
11228{
11229 if (p->error_indicator) {
11230 return NULL;
11231 }
11232 asdl_seq * res = NULL;
11233 int mark = p->mark;
11234 { // with_item _loop0_30
11235 withitem_ty elem;
11236 asdl_seq * seq;
11237 if (
11238 (elem = with_item_rule(p))
11239 &&
11240 (seq = _loop0_30_rule(p))
11241 )
11242 {
11243 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11244 goto done;
11245 }
11246 p->mark = mark;
11247 }
11248 res = NULL;
11249 done:
11250 return res;
11251}
11252
11253// _loop0_32: ',' with_item
11254static asdl_seq *
11255_loop0_32_rule(Parser *p)
11256{
11257 if (p->error_indicator) {
11258 return NULL;
11259 }
11260 void *res = NULL;
11261 int mark = p->mark;
11262 int start_mark = p->mark;
11263 void **children = PyMem_Malloc(sizeof(void *));
11264 if (!children) {
11265 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11266 return NULL;
11267 }
11268 ssize_t children_capacity = 1;
11269 ssize_t n = 0;
11270 { // ',' with_item
11271 withitem_ty elem;
11272 void *literal;
11273 while (
11274 (literal = _PyPegen_expect_token(p, 12))
11275 &&
11276 (elem = with_item_rule(p))
11277 )
11278 {
11279 res = elem;
11280 if (res == NULL && PyErr_Occurred()) {
11281 p->error_indicator = 1;
11282 PyMem_Free(children);
11283 return NULL;
11284 }
11285 if (n == children_capacity) {
11286 children_capacity *= 2;
11287 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11288 if (!children) {
11289 PyErr_Format(PyExc_MemoryError, "realloc None");
11290 return NULL;
11291 }
11292 }
11293 children[n++] = res;
11294 mark = p->mark;
11295 }
11296 p->mark = mark;
11297 }
11298 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11299 if (!seq) {
11300 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_32");
11301 PyMem_Free(children);
11302 return NULL;
11303 }
11304 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11305 PyMem_Free(children);
11306 _PyPegen_insert_memo(p, start_mark, _loop0_32_type, seq);
11307 return seq;
11308}
11309
11310// _gather_31: with_item _loop0_32
11311static asdl_seq *
11312_gather_31_rule(Parser *p)
11313{
11314 if (p->error_indicator) {
11315 return NULL;
11316 }
11317 asdl_seq * res = NULL;
11318 int mark = p->mark;
11319 { // with_item _loop0_32
11320 withitem_ty elem;
11321 asdl_seq * seq;
11322 if (
11323 (elem = with_item_rule(p))
11324 &&
11325 (seq = _loop0_32_rule(p))
11326 )
11327 {
11328 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11329 goto done;
11330 }
11331 p->mark = mark;
11332 }
11333 res = NULL;
11334 done:
11335 return res;
11336}
11337
11338// _tmp_33: 'as' target
11339static void *
11340_tmp_33_rule(Parser *p)
11341{
11342 if (p->error_indicator) {
11343 return NULL;
11344 }
11345 void * res = NULL;
11346 int mark = p->mark;
11347 { // 'as' target
11348 void *keyword;
11349 expr_ty t;
11350 if (
11351 (keyword = _PyPegen_expect_token(p, 531))
11352 &&
11353 (t = target_rule(p))
11354 )
11355 {
11356 res = t;
11357 if (res == NULL && PyErr_Occurred()) {
11358 p->error_indicator = 1;
11359 return NULL;
11360 }
11361 goto done;
11362 }
11363 p->mark = mark;
11364 }
11365 res = NULL;
11366 done:
11367 return res;
11368}
11369
11370// _loop1_34: except_block
11371static asdl_seq *
11372_loop1_34_rule(Parser *p)
11373{
11374 if (p->error_indicator) {
11375 return NULL;
11376 }
11377 void *res = NULL;
11378 int mark = p->mark;
11379 int start_mark = p->mark;
11380 void **children = PyMem_Malloc(sizeof(void *));
11381 if (!children) {
11382 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11383 return NULL;
11384 }
11385 ssize_t children_capacity = 1;
11386 ssize_t n = 0;
11387 { // except_block
11388 excepthandler_ty except_block_var;
11389 while (
11390 (except_block_var = except_block_rule(p))
11391 )
11392 {
11393 res = except_block_var;
11394 if (n == children_capacity) {
11395 children_capacity *= 2;
11396 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11397 if (!children) {
11398 PyErr_Format(PyExc_MemoryError, "realloc None");
11399 return NULL;
11400 }
11401 }
11402 children[n++] = res;
11403 mark = p->mark;
11404 }
11405 p->mark = mark;
11406 }
11407 if (n == 0) {
11408 PyMem_Free(children);
11409 return NULL;
11410 }
11411 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11412 if (!seq) {
11413 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_34");
11414 PyMem_Free(children);
11415 return NULL;
11416 }
11417 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11418 PyMem_Free(children);
11419 _PyPegen_insert_memo(p, start_mark, _loop1_34_type, seq);
11420 return seq;
11421}
11422
11423// _tmp_35: 'as' target
11424static void *
11425_tmp_35_rule(Parser *p)
11426{
11427 if (p->error_indicator) {
11428 return NULL;
11429 }
11430 void * res = NULL;
11431 int mark = p->mark;
11432 { // 'as' target
11433 void *keyword;
11434 expr_ty z;
11435 if (
11436 (keyword = _PyPegen_expect_token(p, 531))
11437 &&
11438 (z = target_rule(p))
11439 )
11440 {
11441 res = z;
11442 if (res == NULL && PyErr_Occurred()) {
11443 p->error_indicator = 1;
11444 return NULL;
11445 }
11446 goto done;
11447 }
11448 p->mark = mark;
11449 }
11450 res = NULL;
11451 done:
11452 return res;
11453}
11454
11455// _tmp_36: 'from' expression
11456static void *
11457_tmp_36_rule(Parser *p)
11458{
11459 if (p->error_indicator) {
11460 return NULL;
11461 }
11462 void * res = NULL;
11463 int mark = p->mark;
11464 { // 'from' expression
11465 void *keyword;
11466 expr_ty z;
11467 if (
11468 (keyword = _PyPegen_expect_token(p, 514))
11469 &&
11470 (z = expression_rule(p))
11471 )
11472 {
11473 res = z;
11474 if (res == NULL && PyErr_Occurred()) {
11475 p->error_indicator = 1;
11476 return NULL;
11477 }
11478 goto done;
11479 }
11480 p->mark = mark;
11481 }
11482 res = NULL;
11483 done:
11484 return res;
11485}
11486
11487// _tmp_37: '->' annotation
11488static void *
11489_tmp_37_rule(Parser *p)
11490{
11491 if (p->error_indicator) {
11492 return NULL;
11493 }
11494 void * res = NULL;
11495 int mark = p->mark;
11496 { // '->' annotation
11497 void *literal;
11498 expr_ty z;
11499 if (
11500 (literal = _PyPegen_expect_token(p, 51))
11501 &&
11502 (z = annotation_rule(p))
11503 )
11504 {
11505 res = z;
11506 if (res == NULL && PyErr_Occurred()) {
11507 p->error_indicator = 1;
11508 return NULL;
11509 }
11510 goto done;
11511 }
11512 p->mark = mark;
11513 }
11514 res = NULL;
11515 done:
11516 return res;
11517}
11518
11519// _tmp_38: ',' plain_names
11520static void *
11521_tmp_38_rule(Parser *p)
11522{
11523 if (p->error_indicator) {
11524 return NULL;
11525 }
11526 void * res = NULL;
11527 int mark = p->mark;
11528 { // ',' plain_names
11529 void *literal;
11530 asdl_seq* x;
11531 if (
11532 (literal = _PyPegen_expect_token(p, 12))
11533 &&
11534 (x = plain_names_rule(p))
11535 )
11536 {
11537 res = x;
11538 if (res == NULL && PyErr_Occurred()) {
11539 p->error_indicator = 1;
11540 return NULL;
11541 }
11542 goto done;
11543 }
11544 p->mark = mark;
11545 }
11546 res = NULL;
11547 done:
11548 return res;
11549}
11550
11551// _tmp_39: ',' names_with_default
11552static void *
11553_tmp_39_rule(Parser *p)
11554{
11555 if (p->error_indicator) {
11556 return NULL;
11557 }
11558 void * res = NULL;
11559 int mark = p->mark;
11560 { // ',' names_with_default
11561 void *literal;
11562 asdl_seq* y;
11563 if (
11564 (literal = _PyPegen_expect_token(p, 12))
11565 &&
11566 (y = names_with_default_rule(p))
11567 )
11568 {
11569 res = y;
11570 if (res == NULL && PyErr_Occurred()) {
11571 p->error_indicator = 1;
11572 return NULL;
11573 }
11574 goto done;
11575 }
11576 p->mark = mark;
11577 }
11578 res = NULL;
11579 done:
11580 return res;
11581}
11582
11583// _tmp_40: ',' star_etc?
11584static void *
11585_tmp_40_rule(Parser *p)
11586{
11587 if (p->error_indicator) {
11588 return NULL;
11589 }
11590 void * res = NULL;
11591 int mark = p->mark;
11592 { // ',' star_etc?
11593 void *literal;
11594 void *z;
11595 if (
11596 (literal = _PyPegen_expect_token(p, 12))
11597 &&
11598 (z = star_etc_rule(p), 1)
11599 )
11600 {
11601 res = z;
11602 if (res == NULL && PyErr_Occurred()) {
11603 p->error_indicator = 1;
11604 return NULL;
11605 }
11606 goto done;
11607 }
11608 p->mark = mark;
11609 }
11610 res = NULL;
11611 done:
11612 return res;
11613}
11614
11615// _tmp_41: ',' names_with_default
11616static void *
11617_tmp_41_rule(Parser *p)
11618{
11619 if (p->error_indicator) {
11620 return NULL;
11621 }
11622 void * res = NULL;
11623 int mark = p->mark;
11624 { // ',' names_with_default
11625 void *literal;
11626 asdl_seq* y;
11627 if (
11628 (literal = _PyPegen_expect_token(p, 12))
11629 &&
11630 (y = names_with_default_rule(p))
11631 )
11632 {
11633 res = y;
11634 if (res == NULL && PyErr_Occurred()) {
11635 p->error_indicator = 1;
11636 return NULL;
11637 }
11638 goto done;
11639 }
11640 p->mark = mark;
11641 }
11642 res = NULL;
11643 done:
11644 return res;
11645}
11646
11647// _tmp_42: ',' star_etc?
11648static void *
11649_tmp_42_rule(Parser *p)
11650{
11651 if (p->error_indicator) {
11652 return NULL;
11653 }
11654 void * res = NULL;
11655 int mark = p->mark;
11656 { // ',' star_etc?
11657 void *literal;
11658 void *z;
11659 if (
11660 (literal = _PyPegen_expect_token(p, 12))
11661 &&
11662 (z = star_etc_rule(p), 1)
11663 )
11664 {
11665 res = z;
11666 if (res == NULL && PyErr_Occurred()) {
11667 p->error_indicator = 1;
11668 return NULL;
11669 }
11670 goto done;
11671 }
11672 p->mark = mark;
11673 }
11674 res = NULL;
11675 done:
11676 return res;
11677}
11678
11679// _tmp_43: ',' names_with_default
11680static void *
11681_tmp_43_rule(Parser *p)
11682{
11683 if (p->error_indicator) {
11684 return NULL;
11685 }
11686 void * res = NULL;
11687 int mark = p->mark;
11688 { // ',' names_with_default
11689 void *literal;
11690 asdl_seq* y;
11691 if (
11692 (literal = _PyPegen_expect_token(p, 12))
11693 &&
11694 (y = names_with_default_rule(p))
11695 )
11696 {
11697 res = y;
11698 if (res == NULL && PyErr_Occurred()) {
11699 p->error_indicator = 1;
11700 return NULL;
11701 }
11702 goto done;
11703 }
11704 p->mark = mark;
11705 }
11706 res = NULL;
11707 done:
11708 return res;
11709}
11710
11711// _tmp_44: ',' star_etc?
11712static void *
11713_tmp_44_rule(Parser *p)
11714{
11715 if (p->error_indicator) {
11716 return NULL;
11717 }
11718 void * res = NULL;
11719 int mark = p->mark;
11720 { // ',' star_etc?
11721 void *literal;
11722 void *z;
11723 if (
11724 (literal = _PyPegen_expect_token(p, 12))
11725 &&
11726 (z = star_etc_rule(p), 1)
11727 )
11728 {
11729 res = z;
11730 if (res == NULL && PyErr_Occurred()) {
11731 p->error_indicator = 1;
11732 return NULL;
11733 }
11734 goto done;
11735 }
11736 p->mark = mark;
11737 }
11738 res = NULL;
11739 done:
11740 return res;
11741}
11742
11743// _tmp_45: ',' star_etc?
11744static void *
11745_tmp_45_rule(Parser *p)
11746{
11747 if (p->error_indicator) {
11748 return NULL;
11749 }
11750 void * res = NULL;
11751 int mark = p->mark;
11752 { // ',' star_etc?
11753 void *literal;
11754 void *z;
11755 if (
11756 (literal = _PyPegen_expect_token(p, 12))
11757 &&
11758 (z = star_etc_rule(p), 1)
11759 )
11760 {
11761 res = z;
11762 if (res == NULL && PyErr_Occurred()) {
11763 p->error_indicator = 1;
11764 return NULL;
11765 }
11766 goto done;
11767 }
11768 p->mark = mark;
11769 }
11770 res = NULL;
11771 done:
11772 return res;
11773}
11774
11775// _tmp_46: plain_names ','
11776static void *
11777_tmp_46_rule(Parser *p)
11778{
11779 if (p->error_indicator) {
11780 return NULL;
11781 }
11782 void * res = NULL;
11783 int mark = p->mark;
11784 { // plain_names ','
11785 void *literal;
11786 asdl_seq* n;
11787 if (
11788 (n = plain_names_rule(p))
11789 &&
11790 (literal = _PyPegen_expect_token(p, 12))
11791 )
11792 {
11793 res = n;
11794 if (res == NULL && PyErr_Occurred()) {
11795 p->error_indicator = 1;
11796 return NULL;
11797 }
11798 goto done;
11799 }
11800 p->mark = mark;
11801 }
11802 res = NULL;
11803 done:
11804 return res;
11805}
11806
11807// _loop0_47: name_with_optional_default
11808static asdl_seq *
11809_loop0_47_rule(Parser *p)
11810{
11811 if (p->error_indicator) {
11812 return NULL;
11813 }
11814 void *res = NULL;
11815 int mark = p->mark;
11816 int start_mark = p->mark;
11817 void **children = PyMem_Malloc(sizeof(void *));
11818 if (!children) {
11819 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11820 return NULL;
11821 }
11822 ssize_t children_capacity = 1;
11823 ssize_t n = 0;
11824 { // name_with_optional_default
11825 NameDefaultPair* name_with_optional_default_var;
11826 while (
11827 (name_with_optional_default_var = name_with_optional_default_rule(p))
11828 )
11829 {
11830 res = name_with_optional_default_var;
11831 if (n == children_capacity) {
11832 children_capacity *= 2;
11833 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11834 if (!children) {
11835 PyErr_Format(PyExc_MemoryError, "realloc None");
11836 return NULL;
11837 }
11838 }
11839 children[n++] = res;
11840 mark = p->mark;
11841 }
11842 p->mark = mark;
11843 }
11844 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11845 if (!seq) {
11846 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_47");
11847 PyMem_Free(children);
11848 return NULL;
11849 }
11850 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11851 PyMem_Free(children);
11852 _PyPegen_insert_memo(p, start_mark, _loop0_47_type, seq);
11853 return seq;
11854}
11855
11856// _tmp_48: ',' kwds
11857static void *
11858_tmp_48_rule(Parser *p)
11859{
11860 if (p->error_indicator) {
11861 return NULL;
11862 }
11863 void * res = NULL;
11864 int mark = p->mark;
11865 { // ',' kwds
11866 arg_ty d;
11867 void *literal;
11868 if (
11869 (literal = _PyPegen_expect_token(p, 12))
11870 &&
11871 (d = kwds_rule(p))
11872 )
11873 {
11874 res = d;
11875 if (res == NULL && PyErr_Occurred()) {
11876 p->error_indicator = 1;
11877 return NULL;
11878 }
11879 goto done;
11880 }
11881 p->mark = mark;
11882 }
11883 res = NULL;
11884 done:
11885 return res;
11886}
11887
11888// _loop1_49: name_with_optional_default
11889static asdl_seq *
11890_loop1_49_rule(Parser *p)
11891{
11892 if (p->error_indicator) {
11893 return NULL;
11894 }
11895 void *res = NULL;
11896 int mark = p->mark;
11897 int start_mark = p->mark;
11898 void **children = PyMem_Malloc(sizeof(void *));
11899 if (!children) {
11900 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11901 return NULL;
11902 }
11903 ssize_t children_capacity = 1;
11904 ssize_t n = 0;
11905 { // name_with_optional_default
11906 NameDefaultPair* name_with_optional_default_var;
11907 while (
11908 (name_with_optional_default_var = name_with_optional_default_rule(p))
11909 )
11910 {
11911 res = name_with_optional_default_var;
11912 if (n == children_capacity) {
11913 children_capacity *= 2;
11914 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11915 if (!children) {
11916 PyErr_Format(PyExc_MemoryError, "realloc None");
11917 return NULL;
11918 }
11919 }
11920 children[n++] = res;
11921 mark = p->mark;
11922 }
11923 p->mark = mark;
11924 }
11925 if (n == 0) {
11926 PyMem_Free(children);
11927 return NULL;
11928 }
11929 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11930 if (!seq) {
11931 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_49");
11932 PyMem_Free(children);
11933 return NULL;
11934 }
11935 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11936 PyMem_Free(children);
11937 _PyPegen_insert_memo(p, start_mark, _loop1_49_type, seq);
11938 return seq;
11939}
11940
11941// _tmp_50: ',' kwds
11942static void *
11943_tmp_50_rule(Parser *p)
11944{
11945 if (p->error_indicator) {
11946 return NULL;
11947 }
11948 void * res = NULL;
11949 int mark = p->mark;
11950 { // ',' kwds
11951 arg_ty d;
11952 void *literal;
11953 if (
11954 (literal = _PyPegen_expect_token(p, 12))
11955 &&
11956 (d = kwds_rule(p))
11957 )
11958 {
11959 res = d;
11960 if (res == NULL && PyErr_Occurred()) {
11961 p->error_indicator = 1;
11962 return NULL;
11963 }
11964 goto done;
11965 }
11966 p->mark = mark;
11967 }
11968 res = NULL;
11969 done:
11970 return res;
11971}
11972
11973// _tmp_51: '=' expression
11974static void *
11975_tmp_51_rule(Parser *p)
11976{
11977 if (p->error_indicator) {
11978 return NULL;
11979 }
11980 void * res = NULL;
11981 int mark = p->mark;
11982 { // '=' expression
11983 expr_ty e;
11984 void *literal;
11985 if (
11986 (literal = _PyPegen_expect_token(p, 22))
11987 &&
11988 (e = expression_rule(p))
11989 )
11990 {
11991 res = e;
11992 if (res == NULL && PyErr_Occurred()) {
11993 p->error_indicator = 1;
11994 return NULL;
11995 }
11996 goto done;
11997 }
11998 p->mark = mark;
11999 }
12000 res = NULL;
12001 done:
12002 return res;
12003}
12004
12005// _loop0_53: ',' name_with_default
12006static asdl_seq *
12007_loop0_53_rule(Parser *p)
12008{
12009 if (p->error_indicator) {
12010 return NULL;
12011 }
12012 void *res = NULL;
12013 int mark = p->mark;
12014 int start_mark = p->mark;
12015 void **children = PyMem_Malloc(sizeof(void *));
12016 if (!children) {
12017 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12018 return NULL;
12019 }
12020 ssize_t children_capacity = 1;
12021 ssize_t n = 0;
12022 { // ',' name_with_default
12023 NameDefaultPair* elem;
12024 void *literal;
12025 while (
12026 (literal = _PyPegen_expect_token(p, 12))
12027 &&
12028 (elem = name_with_default_rule(p))
12029 )
12030 {
12031 res = elem;
12032 if (res == NULL && PyErr_Occurred()) {
12033 p->error_indicator = 1;
12034 PyMem_Free(children);
12035 return NULL;
12036 }
12037 if (n == children_capacity) {
12038 children_capacity *= 2;
12039 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12040 if (!children) {
12041 PyErr_Format(PyExc_MemoryError, "realloc None");
12042 return NULL;
12043 }
12044 }
12045 children[n++] = res;
12046 mark = p->mark;
12047 }
12048 p->mark = mark;
12049 }
12050 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12051 if (!seq) {
12052 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_53");
12053 PyMem_Free(children);
12054 return NULL;
12055 }
12056 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12057 PyMem_Free(children);
12058 _PyPegen_insert_memo(p, start_mark, _loop0_53_type, seq);
12059 return seq;
12060}
12061
12062// _gather_52: name_with_default _loop0_53
12063static asdl_seq *
12064_gather_52_rule(Parser *p)
12065{
12066 if (p->error_indicator) {
12067 return NULL;
12068 }
12069 asdl_seq * res = NULL;
12070 int mark = p->mark;
12071 { // name_with_default _loop0_53
12072 NameDefaultPair* elem;
12073 asdl_seq * seq;
12074 if (
12075 (elem = name_with_default_rule(p))
12076 &&
12077 (seq = _loop0_53_rule(p))
12078 )
12079 {
12080 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12081 goto done;
12082 }
12083 p->mark = mark;
12084 }
12085 res = NULL;
12086 done:
12087 return res;
12088}
12089
12090// _loop0_55: ',' (plain_name !'=')
12091static asdl_seq *
12092_loop0_55_rule(Parser *p)
12093{
12094 if (p->error_indicator) {
12095 return NULL;
12096 }
12097 void *res = NULL;
12098 int mark = p->mark;
12099 int start_mark = p->mark;
12100 void **children = PyMem_Malloc(sizeof(void *));
12101 if (!children) {
12102 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12103 return NULL;
12104 }
12105 ssize_t children_capacity = 1;
12106 ssize_t n = 0;
12107 { // ',' (plain_name !'=')
12108 void *elem;
12109 void *literal;
12110 while (
12111 (literal = _PyPegen_expect_token(p, 12))
12112 &&
12113 (elem = _tmp_126_rule(p))
12114 )
12115 {
12116 res = elem;
12117 if (res == NULL && PyErr_Occurred()) {
12118 p->error_indicator = 1;
12119 PyMem_Free(children);
12120 return NULL;
12121 }
12122 if (n == children_capacity) {
12123 children_capacity *= 2;
12124 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12125 if (!children) {
12126 PyErr_Format(PyExc_MemoryError, "realloc None");
12127 return NULL;
12128 }
12129 }
12130 children[n++] = res;
12131 mark = p->mark;
12132 }
12133 p->mark = mark;
12134 }
12135 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12136 if (!seq) {
12137 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_55");
12138 PyMem_Free(children);
12139 return NULL;
12140 }
12141 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12142 PyMem_Free(children);
12143 _PyPegen_insert_memo(p, start_mark, _loop0_55_type, seq);
12144 return seq;
12145}
12146
12147// _gather_54: (plain_name !'=') _loop0_55
12148static asdl_seq *
12149_gather_54_rule(Parser *p)
12150{
12151 if (p->error_indicator) {
12152 return NULL;
12153 }
12154 asdl_seq * res = NULL;
12155 int mark = p->mark;
12156 { // (plain_name !'=') _loop0_55
12157 void *elem;
12158 asdl_seq * seq;
12159 if (
12160 (elem = _tmp_126_rule(p))
12161 &&
12162 (seq = _loop0_55_rule(p))
12163 )
12164 {
12165 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12166 goto done;
12167 }
12168 p->mark = mark;
12169 }
12170 res = NULL;
12171 done:
12172 return res;
12173}
12174
12175// _tmp_56: ':' annotation
12176static void *
12177_tmp_56_rule(Parser *p)
12178{
12179 if (p->error_indicator) {
12180 return NULL;
12181 }
12182 void * res = NULL;
12183 int mark = p->mark;
12184 { // ':' annotation
12185 void *literal;
12186 expr_ty z;
12187 if (
12188 (literal = _PyPegen_expect_token(p, 11))
12189 &&
12190 (z = annotation_rule(p))
12191 )
12192 {
12193 res = z;
12194 if (res == NULL && PyErr_Occurred()) {
12195 p->error_indicator = 1;
12196 return NULL;
12197 }
12198 goto done;
12199 }
12200 p->mark = mark;
12201 }
12202 res = NULL;
12203 done:
12204 return res;
12205}
12206
12207// _loop1_57: ('@' named_expression NEWLINE)
12208static asdl_seq *
12209_loop1_57_rule(Parser *p)
12210{
12211 if (p->error_indicator) {
12212 return NULL;
12213 }
12214 void *res = NULL;
12215 int mark = p->mark;
12216 int start_mark = p->mark;
12217 void **children = PyMem_Malloc(sizeof(void *));
12218 if (!children) {
12219 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12220 return NULL;
12221 }
12222 ssize_t children_capacity = 1;
12223 ssize_t n = 0;
12224 { // ('@' named_expression NEWLINE)
12225 void *_tmp_127_var;
12226 while (
12227 (_tmp_127_var = _tmp_127_rule(p))
12228 )
12229 {
12230 res = _tmp_127_var;
12231 if (n == children_capacity) {
12232 children_capacity *= 2;
12233 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12234 if (!children) {
12235 PyErr_Format(PyExc_MemoryError, "realloc None");
12236 return NULL;
12237 }
12238 }
12239 children[n++] = res;
12240 mark = p->mark;
12241 }
12242 p->mark = mark;
12243 }
12244 if (n == 0) {
12245 PyMem_Free(children);
12246 return NULL;
12247 }
12248 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12249 if (!seq) {
12250 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_57");
12251 PyMem_Free(children);
12252 return NULL;
12253 }
12254 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12255 PyMem_Free(children);
12256 _PyPegen_insert_memo(p, start_mark, _loop1_57_type, seq);
12257 return seq;
12258}
12259
12260// _tmp_58: '(' arguments? ')'
12261static void *
12262_tmp_58_rule(Parser *p)
12263{
12264 if (p->error_indicator) {
12265 return NULL;
12266 }
12267 void * res = NULL;
12268 int mark = p->mark;
12269 { // '(' arguments? ')'
12270 void *literal;
12271 void *literal_1;
12272 void *z;
12273 if (
12274 (literal = _PyPegen_expect_token(p, 7))
12275 &&
12276 (z = arguments_rule(p), 1)
12277 &&
12278 (literal_1 = _PyPegen_expect_token(p, 8))
12279 )
12280 {
12281 res = z;
12282 if (res == NULL && PyErr_Occurred()) {
12283 p->error_indicator = 1;
12284 return NULL;
12285 }
12286 goto done;
12287 }
12288 p->mark = mark;
12289 }
12290 res = NULL;
12291 done:
12292 return res;
12293}
12294
12295// _loop0_60: ',' star_expression
12296static asdl_seq *
12297_loop0_60_rule(Parser *p)
12298{
12299 if (p->error_indicator) {
12300 return NULL;
12301 }
12302 void *res = NULL;
12303 int mark = p->mark;
12304 int start_mark = p->mark;
12305 void **children = PyMem_Malloc(sizeof(void *));
12306 if (!children) {
12307 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12308 return NULL;
12309 }
12310 ssize_t children_capacity = 1;
12311 ssize_t n = 0;
12312 { // ',' star_expression
12313 expr_ty elem;
12314 void *literal;
12315 while (
12316 (literal = _PyPegen_expect_token(p, 12))
12317 &&
12318 (elem = star_expression_rule(p))
12319 )
12320 {
12321 res = elem;
12322 if (res == NULL && PyErr_Occurred()) {
12323 p->error_indicator = 1;
12324 PyMem_Free(children);
12325 return NULL;
12326 }
12327 if (n == children_capacity) {
12328 children_capacity *= 2;
12329 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12330 if (!children) {
12331 PyErr_Format(PyExc_MemoryError, "realloc None");
12332 return NULL;
12333 }
12334 }
12335 children[n++] = res;
12336 mark = p->mark;
12337 }
12338 p->mark = mark;
12339 }
12340 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12341 if (!seq) {
12342 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_60");
12343 PyMem_Free(children);
12344 return NULL;
12345 }
12346 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12347 PyMem_Free(children);
12348 _PyPegen_insert_memo(p, start_mark, _loop0_60_type, seq);
12349 return seq;
12350}
12351
12352// _gather_59: star_expression _loop0_60
12353static asdl_seq *
12354_gather_59_rule(Parser *p)
12355{
12356 if (p->error_indicator) {
12357 return NULL;
12358 }
12359 asdl_seq * res = NULL;
12360 int mark = p->mark;
12361 { // star_expression _loop0_60
12362 expr_ty elem;
12363 asdl_seq * seq;
12364 if (
12365 (elem = star_expression_rule(p))
12366 &&
12367 (seq = _loop0_60_rule(p))
12368 )
12369 {
12370 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12371 goto done;
12372 }
12373 p->mark = mark;
12374 }
12375 res = NULL;
12376 done:
12377 return res;
12378}
12379
12380// _loop1_61: (',' star_expression)
12381static asdl_seq *
12382_loop1_61_rule(Parser *p)
12383{
12384 if (p->error_indicator) {
12385 return NULL;
12386 }
12387 void *res = NULL;
12388 int mark = p->mark;
12389 int start_mark = p->mark;
12390 void **children = PyMem_Malloc(sizeof(void *));
12391 if (!children) {
12392 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12393 return NULL;
12394 }
12395 ssize_t children_capacity = 1;
12396 ssize_t n = 0;
12397 { // (',' star_expression)
12398 void *_tmp_128_var;
12399 while (
12400 (_tmp_128_var = _tmp_128_rule(p))
12401 )
12402 {
12403 res = _tmp_128_var;
12404 if (n == children_capacity) {
12405 children_capacity *= 2;
12406 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12407 if (!children) {
12408 PyErr_Format(PyExc_MemoryError, "realloc None");
12409 return NULL;
12410 }
12411 }
12412 children[n++] = res;
12413 mark = p->mark;
12414 }
12415 p->mark = mark;
12416 }
12417 if (n == 0) {
12418 PyMem_Free(children);
12419 return NULL;
12420 }
12421 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12422 if (!seq) {
12423 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_61");
12424 PyMem_Free(children);
12425 return NULL;
12426 }
12427 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12428 PyMem_Free(children);
12429 _PyPegen_insert_memo(p, start_mark, _loop1_61_type, seq);
12430 return seq;
12431}
12432
12433// _loop0_63: ',' star_named_expression
12434static asdl_seq *
12435_loop0_63_rule(Parser *p)
12436{
12437 if (p->error_indicator) {
12438 return NULL;
12439 }
12440 void *res = NULL;
12441 int mark = p->mark;
12442 int start_mark = p->mark;
12443 void **children = PyMem_Malloc(sizeof(void *));
12444 if (!children) {
12445 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12446 return NULL;
12447 }
12448 ssize_t children_capacity = 1;
12449 ssize_t n = 0;
12450 { // ',' star_named_expression
12451 expr_ty elem;
12452 void *literal;
12453 while (
12454 (literal = _PyPegen_expect_token(p, 12))
12455 &&
12456 (elem = star_named_expression_rule(p))
12457 )
12458 {
12459 res = elem;
12460 if (res == NULL && PyErr_Occurred()) {
12461 p->error_indicator = 1;
12462 PyMem_Free(children);
12463 return NULL;
12464 }
12465 if (n == children_capacity) {
12466 children_capacity *= 2;
12467 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12468 if (!children) {
12469 PyErr_Format(PyExc_MemoryError, "realloc None");
12470 return NULL;
12471 }
12472 }
12473 children[n++] = res;
12474 mark = p->mark;
12475 }
12476 p->mark = mark;
12477 }
12478 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12479 if (!seq) {
12480 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_63");
12481 PyMem_Free(children);
12482 return NULL;
12483 }
12484 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12485 PyMem_Free(children);
12486 _PyPegen_insert_memo(p, start_mark, _loop0_63_type, seq);
12487 return seq;
12488}
12489
12490// _gather_62: star_named_expression _loop0_63
12491static asdl_seq *
12492_gather_62_rule(Parser *p)
12493{
12494 if (p->error_indicator) {
12495 return NULL;
12496 }
12497 asdl_seq * res = NULL;
12498 int mark = p->mark;
12499 { // star_named_expression _loop0_63
12500 expr_ty elem;
12501 asdl_seq * seq;
12502 if (
12503 (elem = star_named_expression_rule(p))
12504 &&
12505 (seq = _loop0_63_rule(p))
12506 )
12507 {
12508 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12509 goto done;
12510 }
12511 p->mark = mark;
12512 }
12513 res = NULL;
12514 done:
12515 return res;
12516}
12517
12518// _loop1_64: (',' expression)
12519static asdl_seq *
12520_loop1_64_rule(Parser *p)
12521{
12522 if (p->error_indicator) {
12523 return NULL;
12524 }
12525 void *res = NULL;
12526 int mark = p->mark;
12527 int start_mark = p->mark;
12528 void **children = PyMem_Malloc(sizeof(void *));
12529 if (!children) {
12530 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12531 return NULL;
12532 }
12533 ssize_t children_capacity = 1;
12534 ssize_t n = 0;
12535 { // (',' expression)
12536 void *_tmp_129_var;
12537 while (
12538 (_tmp_129_var = _tmp_129_rule(p))
12539 )
12540 {
12541 res = _tmp_129_var;
12542 if (n == children_capacity) {
12543 children_capacity *= 2;
12544 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12545 if (!children) {
12546 PyErr_Format(PyExc_MemoryError, "realloc None");
12547 return NULL;
12548 }
12549 }
12550 children[n++] = res;
12551 mark = p->mark;
12552 }
12553 p->mark = mark;
12554 }
12555 if (n == 0) {
12556 PyMem_Free(children);
12557 return NULL;
12558 }
12559 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12560 if (!seq) {
12561 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_64");
12562 PyMem_Free(children);
12563 return NULL;
12564 }
12565 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12566 PyMem_Free(children);
12567 _PyPegen_insert_memo(p, start_mark, _loop1_64_type, seq);
12568 return seq;
12569}
12570
12571// _tmp_65: ',' lambda_plain_names
12572static void *
12573_tmp_65_rule(Parser *p)
12574{
12575 if (p->error_indicator) {
12576 return NULL;
12577 }
12578 void * res = NULL;
12579 int mark = p->mark;
12580 { // ',' lambda_plain_names
12581 void *literal;
12582 asdl_seq* x;
12583 if (
12584 (literal = _PyPegen_expect_token(p, 12))
12585 &&
12586 (x = lambda_plain_names_rule(p))
12587 )
12588 {
12589 res = x;
12590 if (res == NULL && PyErr_Occurred()) {
12591 p->error_indicator = 1;
12592 return NULL;
12593 }
12594 goto done;
12595 }
12596 p->mark = mark;
12597 }
12598 res = NULL;
12599 done:
12600 return res;
12601}
12602
12603// _tmp_66: ',' lambda_names_with_default
12604static void *
12605_tmp_66_rule(Parser *p)
12606{
12607 if (p->error_indicator) {
12608 return NULL;
12609 }
12610 void * res = NULL;
12611 int mark = p->mark;
12612 { // ',' lambda_names_with_default
12613 void *literal;
12614 asdl_seq* y;
12615 if (
12616 (literal = _PyPegen_expect_token(p, 12))
12617 &&
12618 (y = lambda_names_with_default_rule(p))
12619 )
12620 {
12621 res = y;
12622 if (res == NULL && PyErr_Occurred()) {
12623 p->error_indicator = 1;
12624 return NULL;
12625 }
12626 goto done;
12627 }
12628 p->mark = mark;
12629 }
12630 res = NULL;
12631 done:
12632 return res;
12633}
12634
12635// _tmp_67: ',' lambda_star_etc?
12636static void *
12637_tmp_67_rule(Parser *p)
12638{
12639 if (p->error_indicator) {
12640 return NULL;
12641 }
12642 void * res = NULL;
12643 int mark = p->mark;
12644 { // ',' lambda_star_etc?
12645 void *literal;
12646 void *z;
12647 if (
12648 (literal = _PyPegen_expect_token(p, 12))
12649 &&
12650 (z = lambda_star_etc_rule(p), 1)
12651 )
12652 {
12653 res = z;
12654 if (res == NULL && PyErr_Occurred()) {
12655 p->error_indicator = 1;
12656 return NULL;
12657 }
12658 goto done;
12659 }
12660 p->mark = mark;
12661 }
12662 res = NULL;
12663 done:
12664 return res;
12665}
12666
12667// _tmp_68: ',' lambda_names_with_default
12668static void *
12669_tmp_68_rule(Parser *p)
12670{
12671 if (p->error_indicator) {
12672 return NULL;
12673 }
12674 void * res = NULL;
12675 int mark = p->mark;
12676 { // ',' lambda_names_with_default
12677 void *literal;
12678 asdl_seq* y;
12679 if (
12680 (literal = _PyPegen_expect_token(p, 12))
12681 &&
12682 (y = lambda_names_with_default_rule(p))
12683 )
12684 {
12685 res = y;
12686 if (res == NULL && PyErr_Occurred()) {
12687 p->error_indicator = 1;
12688 return NULL;
12689 }
12690 goto done;
12691 }
12692 p->mark = mark;
12693 }
12694 res = NULL;
12695 done:
12696 return res;
12697}
12698
12699// _tmp_69: ',' lambda_star_etc?
12700static void *
12701_tmp_69_rule(Parser *p)
12702{
12703 if (p->error_indicator) {
12704 return NULL;
12705 }
12706 void * res = NULL;
12707 int mark = p->mark;
12708 { // ',' lambda_star_etc?
12709 void *literal;
12710 void *z;
12711 if (
12712 (literal = _PyPegen_expect_token(p, 12))
12713 &&
12714 (z = lambda_star_etc_rule(p), 1)
12715 )
12716 {
12717 res = z;
12718 if (res == NULL && PyErr_Occurred()) {
12719 p->error_indicator = 1;
12720 return NULL;
12721 }
12722 goto done;
12723 }
12724 p->mark = mark;
12725 }
12726 res = NULL;
12727 done:
12728 return res;
12729}
12730
12731// _tmp_70: ',' lambda_names_with_default
12732static void *
12733_tmp_70_rule(Parser *p)
12734{
12735 if (p->error_indicator) {
12736 return NULL;
12737 }
12738 void * res = NULL;
12739 int mark = p->mark;
12740 { // ',' lambda_names_with_default
12741 void *literal;
12742 asdl_seq* y;
12743 if (
12744 (literal = _PyPegen_expect_token(p, 12))
12745 &&
12746 (y = lambda_names_with_default_rule(p))
12747 )
12748 {
12749 res = y;
12750 if (res == NULL && PyErr_Occurred()) {
12751 p->error_indicator = 1;
12752 return NULL;
12753 }
12754 goto done;
12755 }
12756 p->mark = mark;
12757 }
12758 res = NULL;
12759 done:
12760 return res;
12761}
12762
12763// _tmp_71: ',' lambda_star_etc?
12764static void *
12765_tmp_71_rule(Parser *p)
12766{
12767 if (p->error_indicator) {
12768 return NULL;
12769 }
12770 void * res = NULL;
12771 int mark = p->mark;
12772 { // ',' lambda_star_etc?
12773 void *literal;
12774 void *z;
12775 if (
12776 (literal = _PyPegen_expect_token(p, 12))
12777 &&
12778 (z = lambda_star_etc_rule(p), 1)
12779 )
12780 {
12781 res = z;
12782 if (res == NULL && PyErr_Occurred()) {
12783 p->error_indicator = 1;
12784 return NULL;
12785 }
12786 goto done;
12787 }
12788 p->mark = mark;
12789 }
12790 res = NULL;
12791 done:
12792 return res;
12793}
12794
12795// _tmp_72: ',' lambda_star_etc?
12796static void *
12797_tmp_72_rule(Parser *p)
12798{
12799 if (p->error_indicator) {
12800 return NULL;
12801 }
12802 void * res = NULL;
12803 int mark = p->mark;
12804 { // ',' lambda_star_etc?
12805 void *literal;
12806 void *z;
12807 if (
12808 (literal = _PyPegen_expect_token(p, 12))
12809 &&
12810 (z = lambda_star_etc_rule(p), 1)
12811 )
12812 {
12813 res = z;
12814 if (res == NULL && PyErr_Occurred()) {
12815 p->error_indicator = 1;
12816 return NULL;
12817 }
12818 goto done;
12819 }
12820 p->mark = mark;
12821 }
12822 res = NULL;
12823 done:
12824 return res;
12825}
12826
12827// _tmp_73: lambda_plain_names ','
12828static void *
12829_tmp_73_rule(Parser *p)
12830{
12831 if (p->error_indicator) {
12832 return NULL;
12833 }
12834 void * res = NULL;
12835 int mark = p->mark;
12836 { // lambda_plain_names ','
12837 void *literal;
12838 asdl_seq* n;
12839 if (
12840 (n = lambda_plain_names_rule(p))
12841 &&
12842 (literal = _PyPegen_expect_token(p, 12))
12843 )
12844 {
12845 res = n;
12846 if (res == NULL && PyErr_Occurred()) {
12847 p->error_indicator = 1;
12848 return NULL;
12849 }
12850 goto done;
12851 }
12852 p->mark = mark;
12853 }
12854 res = NULL;
12855 done:
12856 return res;
12857}
12858
12859// _loop0_74: lambda_name_with_optional_default
12860static asdl_seq *
12861_loop0_74_rule(Parser *p)
12862{
12863 if (p->error_indicator) {
12864 return NULL;
12865 }
12866 void *res = NULL;
12867 int mark = p->mark;
12868 int start_mark = p->mark;
12869 void **children = PyMem_Malloc(sizeof(void *));
12870 if (!children) {
12871 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12872 return NULL;
12873 }
12874 ssize_t children_capacity = 1;
12875 ssize_t n = 0;
12876 { // lambda_name_with_optional_default
12877 NameDefaultPair* lambda_name_with_optional_default_var;
12878 while (
12879 (lambda_name_with_optional_default_var = lambda_name_with_optional_default_rule(p))
12880 )
12881 {
12882 res = lambda_name_with_optional_default_var;
12883 if (n == children_capacity) {
12884 children_capacity *= 2;
12885 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12886 if (!children) {
12887 PyErr_Format(PyExc_MemoryError, "realloc None");
12888 return NULL;
12889 }
12890 }
12891 children[n++] = res;
12892 mark = p->mark;
12893 }
12894 p->mark = mark;
12895 }
12896 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12897 if (!seq) {
12898 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_74");
12899 PyMem_Free(children);
12900 return NULL;
12901 }
12902 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12903 PyMem_Free(children);
12904 _PyPegen_insert_memo(p, start_mark, _loop0_74_type, seq);
12905 return seq;
12906}
12907
12908// _tmp_75: ',' lambda_kwds
12909static void *
12910_tmp_75_rule(Parser *p)
12911{
12912 if (p->error_indicator) {
12913 return NULL;
12914 }
12915 void * res = NULL;
12916 int mark = p->mark;
12917 { // ',' lambda_kwds
12918 arg_ty d;
12919 void *literal;
12920 if (
12921 (literal = _PyPegen_expect_token(p, 12))
12922 &&
12923 (d = lambda_kwds_rule(p))
12924 )
12925 {
12926 res = d;
12927 if (res == NULL && PyErr_Occurred()) {
12928 p->error_indicator = 1;
12929 return NULL;
12930 }
12931 goto done;
12932 }
12933 p->mark = mark;
12934 }
12935 res = NULL;
12936 done:
12937 return res;
12938}
12939
12940// _loop1_76: lambda_name_with_optional_default
12941static asdl_seq *
12942_loop1_76_rule(Parser *p)
12943{
12944 if (p->error_indicator) {
12945 return NULL;
12946 }
12947 void *res = NULL;
12948 int mark = p->mark;
12949 int start_mark = p->mark;
12950 void **children = PyMem_Malloc(sizeof(void *));
12951 if (!children) {
12952 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12953 return NULL;
12954 }
12955 ssize_t children_capacity = 1;
12956 ssize_t n = 0;
12957 { // lambda_name_with_optional_default
12958 NameDefaultPair* lambda_name_with_optional_default_var;
12959 while (
12960 (lambda_name_with_optional_default_var = lambda_name_with_optional_default_rule(p))
12961 )
12962 {
12963 res = lambda_name_with_optional_default_var;
12964 if (n == children_capacity) {
12965 children_capacity *= 2;
12966 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12967 if (!children) {
12968 PyErr_Format(PyExc_MemoryError, "realloc None");
12969 return NULL;
12970 }
12971 }
12972 children[n++] = res;
12973 mark = p->mark;
12974 }
12975 p->mark = mark;
12976 }
12977 if (n == 0) {
12978 PyMem_Free(children);
12979 return NULL;
12980 }
12981 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12982 if (!seq) {
12983 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_76");
12984 PyMem_Free(children);
12985 return NULL;
12986 }
12987 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12988 PyMem_Free(children);
12989 _PyPegen_insert_memo(p, start_mark, _loop1_76_type, seq);
12990 return seq;
12991}
12992
12993// _tmp_77: ',' lambda_kwds
12994static void *
12995_tmp_77_rule(Parser *p)
12996{
12997 if (p->error_indicator) {
12998 return NULL;
12999 }
13000 void * res = NULL;
13001 int mark = p->mark;
13002 { // ',' lambda_kwds
13003 arg_ty d;
13004 void *literal;
13005 if (
13006 (literal = _PyPegen_expect_token(p, 12))
13007 &&
13008 (d = lambda_kwds_rule(p))
13009 )
13010 {
13011 res = d;
13012 if (res == NULL && PyErr_Occurred()) {
13013 p->error_indicator = 1;
13014 return NULL;
13015 }
13016 goto done;
13017 }
13018 p->mark = mark;
13019 }
13020 res = NULL;
13021 done:
13022 return res;
13023}
13024
13025// _tmp_78: '=' expression
13026static void *
13027_tmp_78_rule(Parser *p)
13028{
13029 if (p->error_indicator) {
13030 return NULL;
13031 }
13032 void * res = NULL;
13033 int mark = p->mark;
13034 { // '=' expression
13035 expr_ty e;
13036 void *literal;
13037 if (
13038 (literal = _PyPegen_expect_token(p, 22))
13039 &&
13040 (e = expression_rule(p))
13041 )
13042 {
13043 res = e;
13044 if (res == NULL && PyErr_Occurred()) {
13045 p->error_indicator = 1;
13046 return NULL;
13047 }
13048 goto done;
13049 }
13050 p->mark = mark;
13051 }
13052 res = NULL;
13053 done:
13054 return res;
13055}
13056
13057// _loop0_80: ',' lambda_name_with_default
13058static asdl_seq *
13059_loop0_80_rule(Parser *p)
13060{
13061 if (p->error_indicator) {
13062 return NULL;
13063 }
13064 void *res = NULL;
13065 int mark = p->mark;
13066 int start_mark = p->mark;
13067 void **children = PyMem_Malloc(sizeof(void *));
13068 if (!children) {
13069 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13070 return NULL;
13071 }
13072 ssize_t children_capacity = 1;
13073 ssize_t n = 0;
13074 { // ',' lambda_name_with_default
13075 NameDefaultPair* elem;
13076 void *literal;
13077 while (
13078 (literal = _PyPegen_expect_token(p, 12))
13079 &&
13080 (elem = lambda_name_with_default_rule(p))
13081 )
13082 {
13083 res = elem;
13084 if (res == NULL && PyErr_Occurred()) {
13085 p->error_indicator = 1;
13086 PyMem_Free(children);
13087 return NULL;
13088 }
13089 if (n == children_capacity) {
13090 children_capacity *= 2;
13091 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13092 if (!children) {
13093 PyErr_Format(PyExc_MemoryError, "realloc None");
13094 return NULL;
13095 }
13096 }
13097 children[n++] = res;
13098 mark = p->mark;
13099 }
13100 p->mark = mark;
13101 }
13102 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13103 if (!seq) {
13104 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_80");
13105 PyMem_Free(children);
13106 return NULL;
13107 }
13108 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13109 PyMem_Free(children);
13110 _PyPegen_insert_memo(p, start_mark, _loop0_80_type, seq);
13111 return seq;
13112}
13113
13114// _gather_79: lambda_name_with_default _loop0_80
13115static asdl_seq *
13116_gather_79_rule(Parser *p)
13117{
13118 if (p->error_indicator) {
13119 return NULL;
13120 }
13121 asdl_seq * res = NULL;
13122 int mark = p->mark;
13123 { // lambda_name_with_default _loop0_80
13124 NameDefaultPair* elem;
13125 asdl_seq * seq;
13126 if (
13127 (elem = lambda_name_with_default_rule(p))
13128 &&
13129 (seq = _loop0_80_rule(p))
13130 )
13131 {
13132 res = _PyPegen_seq_insert_in_front(p, elem, seq);
13133 goto done;
13134 }
13135 p->mark = mark;
13136 }
13137 res = NULL;
13138 done:
13139 return res;
13140}
13141
13142// _loop0_82: ',' (lambda_plain_name !'=')
13143static asdl_seq *
13144_loop0_82_rule(Parser *p)
13145{
13146 if (p->error_indicator) {
13147 return NULL;
13148 }
13149 void *res = NULL;
13150 int mark = p->mark;
13151 int start_mark = p->mark;
13152 void **children = PyMem_Malloc(sizeof(void *));
13153 if (!children) {
13154 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13155 return NULL;
13156 }
13157 ssize_t children_capacity = 1;
13158 ssize_t n = 0;
13159 { // ',' (lambda_plain_name !'=')
13160 void *elem;
13161 void *literal;
13162 while (
13163 (literal = _PyPegen_expect_token(p, 12))
13164 &&
13165 (elem = _tmp_130_rule(p))
13166 )
13167 {
13168 res = elem;
13169 if (res == NULL && PyErr_Occurred()) {
13170 p->error_indicator = 1;
13171 PyMem_Free(children);
13172 return NULL;
13173 }
13174 if (n == children_capacity) {
13175 children_capacity *= 2;
13176 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13177 if (!children) {
13178 PyErr_Format(PyExc_MemoryError, "realloc None");
13179 return NULL;
13180 }
13181 }
13182 children[n++] = res;
13183 mark = p->mark;
13184 }
13185 p->mark = mark;
13186 }
13187 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13188 if (!seq) {
13189 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_82");
13190 PyMem_Free(children);
13191 return NULL;
13192 }
13193 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13194 PyMem_Free(children);
13195 _PyPegen_insert_memo(p, start_mark, _loop0_82_type, seq);
13196 return seq;
13197}
13198
13199// _gather_81: (lambda_plain_name !'=') _loop0_82
13200static asdl_seq *
13201_gather_81_rule(Parser *p)
13202{
13203 if (p->error_indicator) {
13204 return NULL;
13205 }
13206 asdl_seq * res = NULL;
13207 int mark = p->mark;
13208 { // (lambda_plain_name !'=') _loop0_82
13209 void *elem;
13210 asdl_seq * seq;
13211 if (
13212 (elem = _tmp_130_rule(p))
13213 &&
13214 (seq = _loop0_82_rule(p))
13215 )
13216 {
13217 res = _PyPegen_seq_insert_in_front(p, elem, seq);
13218 goto done;
13219 }
13220 p->mark = mark;
13221 }
13222 res = NULL;
13223 done:
13224 return res;
13225}
13226
13227// _loop1_83: ('or' conjunction)
13228static asdl_seq *
13229_loop1_83_rule(Parser *p)
13230{
13231 if (p->error_indicator) {
13232 return NULL;
13233 }
13234 void *res = NULL;
13235 int mark = p->mark;
13236 int start_mark = p->mark;
13237 void **children = PyMem_Malloc(sizeof(void *));
13238 if (!children) {
13239 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13240 return NULL;
13241 }
13242 ssize_t children_capacity = 1;
13243 ssize_t n = 0;
13244 { // ('or' conjunction)
13245 void *_tmp_131_var;
13246 while (
13247 (_tmp_131_var = _tmp_131_rule(p))
13248 )
13249 {
13250 res = _tmp_131_var;
13251 if (n == children_capacity) {
13252 children_capacity *= 2;
13253 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13254 if (!children) {
13255 PyErr_Format(PyExc_MemoryError, "realloc None");
13256 return NULL;
13257 }
13258 }
13259 children[n++] = res;
13260 mark = p->mark;
13261 }
13262 p->mark = mark;
13263 }
13264 if (n == 0) {
13265 PyMem_Free(children);
13266 return NULL;
13267 }
13268 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13269 if (!seq) {
13270 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_83");
13271 PyMem_Free(children);
13272 return NULL;
13273 }
13274 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13275 PyMem_Free(children);
13276 _PyPegen_insert_memo(p, start_mark, _loop1_83_type, seq);
13277 return seq;
13278}
13279
13280// _loop1_84: ('and' inversion)
13281static asdl_seq *
13282_loop1_84_rule(Parser *p)
13283{
13284 if (p->error_indicator) {
13285 return NULL;
13286 }
13287 void *res = NULL;
13288 int mark = p->mark;
13289 int start_mark = p->mark;
13290 void **children = PyMem_Malloc(sizeof(void *));
13291 if (!children) {
13292 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13293 return NULL;
13294 }
13295 ssize_t children_capacity = 1;
13296 ssize_t n = 0;
13297 { // ('and' inversion)
13298 void *_tmp_132_var;
13299 while (
13300 (_tmp_132_var = _tmp_132_rule(p))
13301 )
13302 {
13303 res = _tmp_132_var;
13304 if (n == children_capacity) {
13305 children_capacity *= 2;
13306 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13307 if (!children) {
13308 PyErr_Format(PyExc_MemoryError, "realloc None");
13309 return NULL;
13310 }
13311 }
13312 children[n++] = res;
13313 mark = p->mark;
13314 }
13315 p->mark = mark;
13316 }
13317 if (n == 0) {
13318 PyMem_Free(children);
13319 return NULL;
13320 }
13321 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13322 if (!seq) {
13323 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_84");
13324 PyMem_Free(children);
13325 return NULL;
13326 }
13327 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13328 PyMem_Free(children);
13329 _PyPegen_insert_memo(p, start_mark, _loop1_84_type, seq);
13330 return seq;
13331}
13332
13333// _loop1_85: compare_op_bitwise_or_pair
13334static asdl_seq *
13335_loop1_85_rule(Parser *p)
13336{
13337 if (p->error_indicator) {
13338 return NULL;
13339 }
13340 void *res = NULL;
13341 int mark = p->mark;
13342 int start_mark = p->mark;
13343 void **children = PyMem_Malloc(sizeof(void *));
13344 if (!children) {
13345 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13346 return NULL;
13347 }
13348 ssize_t children_capacity = 1;
13349 ssize_t n = 0;
13350 { // compare_op_bitwise_or_pair
13351 CmpopExprPair* compare_op_bitwise_or_pair_var;
13352 while (
13353 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p))
13354 )
13355 {
13356 res = compare_op_bitwise_or_pair_var;
13357 if (n == children_capacity) {
13358 children_capacity *= 2;
13359 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13360 if (!children) {
13361 PyErr_Format(PyExc_MemoryError, "realloc None");
13362 return NULL;
13363 }
13364 }
13365 children[n++] = res;
13366 mark = p->mark;
13367 }
13368 p->mark = mark;
13369 }
13370 if (n == 0) {
13371 PyMem_Free(children);
13372 return NULL;
13373 }
13374 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13375 if (!seq) {
13376 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_85");
13377 PyMem_Free(children);
13378 return NULL;
13379 }
13380 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13381 PyMem_Free(children);
13382 _PyPegen_insert_memo(p, start_mark, _loop1_85_type, seq);
13383 return seq;
13384}
13385
13386// _loop0_87: ',' slice
13387static asdl_seq *
13388_loop0_87_rule(Parser *p)
13389{
13390 if (p->error_indicator) {
13391 return NULL;
13392 }
13393 void *res = NULL;
13394 int mark = p->mark;
13395 int start_mark = p->mark;
13396 void **children = PyMem_Malloc(sizeof(void *));
13397 if (!children) {
13398 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13399 return NULL;
13400 }
13401 ssize_t children_capacity = 1;
13402 ssize_t n = 0;
13403 { // ',' slice
13404 expr_ty elem;
13405 void *literal;
13406 while (
13407 (literal = _PyPegen_expect_token(p, 12))
13408 &&
13409 (elem = slice_rule(p))
13410 )
13411 {
13412 res = elem;
13413 if (res == NULL && PyErr_Occurred()) {
13414 p->error_indicator = 1;
13415 PyMem_Free(children);
13416 return NULL;
13417 }
13418 if (n == children_capacity) {
13419 children_capacity *= 2;
13420 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13421 if (!children) {
13422 PyErr_Format(PyExc_MemoryError, "realloc None");
13423 return NULL;
13424 }
13425 }
13426 children[n++] = res;
13427 mark = p->mark;
13428 }
13429 p->mark = mark;
13430 }
13431 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13432 if (!seq) {
13433 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_87");
13434 PyMem_Free(children);
13435 return NULL;
13436 }
13437 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13438 PyMem_Free(children);
13439 _PyPegen_insert_memo(p, start_mark, _loop0_87_type, seq);
13440 return seq;
13441}
13442
13443// _gather_86: slice _loop0_87
13444static asdl_seq *
13445_gather_86_rule(Parser *p)
13446{
13447 if (p->error_indicator) {
13448 return NULL;
13449 }
13450 asdl_seq * res = NULL;
13451 int mark = p->mark;
13452 { // slice _loop0_87
13453 expr_ty elem;
13454 asdl_seq * seq;
13455 if (
13456 (elem = slice_rule(p))
13457 &&
13458 (seq = _loop0_87_rule(p))
13459 )
13460 {
13461 res = _PyPegen_seq_insert_in_front(p, elem, seq);
13462 goto done;
13463 }
13464 p->mark = mark;
13465 }
13466 res = NULL;
13467 done:
13468 return res;
13469}
13470
13471// _tmp_88: ':' expression?
13472static void *
13473_tmp_88_rule(Parser *p)
13474{
13475 if (p->error_indicator) {
13476 return NULL;
13477 }
13478 void * res = NULL;
13479 int mark = p->mark;
13480 { // ':' expression?
13481 void *d;
13482 void *literal;
13483 if (
13484 (literal = _PyPegen_expect_token(p, 11))
13485 &&
13486 (d = expression_rule(p), 1)
13487 )
13488 {
13489 res = d;
13490 if (res == NULL && PyErr_Occurred()) {
13491 p->error_indicator = 1;
13492 return NULL;
13493 }
13494 goto done;
13495 }
13496 p->mark = mark;
13497 }
13498 res = NULL;
13499 done:
13500 return res;
13501}
13502
13503// _tmp_89: tuple | group | genexp
13504static void *
13505_tmp_89_rule(Parser *p)
13506{
13507 if (p->error_indicator) {
13508 return NULL;
13509 }
13510 void * res = NULL;
13511 int mark = p->mark;
13512 { // tuple
13513 expr_ty tuple_var;
13514 if (
13515 (tuple_var = tuple_rule(p))
13516 )
13517 {
13518 res = tuple_var;
13519 goto done;
13520 }
13521 p->mark = mark;
13522 }
13523 { // group
13524 expr_ty group_var;
13525 if (
13526 (group_var = group_rule(p))
13527 )
13528 {
13529 res = group_var;
13530 goto done;
13531 }
13532 p->mark = mark;
13533 }
13534 { // genexp
13535 expr_ty genexp_var;
13536 if (
13537 (genexp_var = genexp_rule(p))
13538 )
13539 {
13540 res = genexp_var;
13541 goto done;
13542 }
13543 p->mark = mark;
13544 }
13545 res = NULL;
13546 done:
13547 return res;
13548}
13549
13550// _tmp_90: list | listcomp
13551static void *
13552_tmp_90_rule(Parser *p)
13553{
13554 if (p->error_indicator) {
13555 return NULL;
13556 }
13557 void * res = NULL;
13558 int mark = p->mark;
13559 { // list
13560 expr_ty list_var;
13561 if (
13562 (list_var = list_rule(p))
13563 )
13564 {
13565 res = list_var;
13566 goto done;
13567 }
13568 p->mark = mark;
13569 }
13570 { // listcomp
13571 expr_ty listcomp_var;
13572 if (
13573 (listcomp_var = listcomp_rule(p))
13574 )
13575 {
13576 res = listcomp_var;
13577 goto done;
13578 }
13579 p->mark = mark;
13580 }
13581 res = NULL;
13582 done:
13583 return res;
13584}
13585
13586// _tmp_91: dict | set | dictcomp | setcomp
13587static void *
13588_tmp_91_rule(Parser *p)
13589{
13590 if (p->error_indicator) {
13591 return NULL;
13592 }
13593 void * res = NULL;
13594 int mark = p->mark;
13595 { // dict
13596 expr_ty dict_var;
13597 if (
13598 (dict_var = dict_rule(p))
13599 )
13600 {
13601 res = dict_var;
13602 goto done;
13603 }
13604 p->mark = mark;
13605 }
13606 { // set
13607 expr_ty set_var;
13608 if (
13609 (set_var = set_rule(p))
13610 )
13611 {
13612 res = set_var;
13613 goto done;
13614 }
13615 p->mark = mark;
13616 }
13617 { // dictcomp
13618 expr_ty dictcomp_var;
13619 if (
13620 (dictcomp_var = dictcomp_rule(p))
13621 )
13622 {
13623 res = dictcomp_var;
13624 goto done;
13625 }
13626 p->mark = mark;
13627 }
13628 { // setcomp
13629 expr_ty setcomp_var;
13630 if (
13631 (setcomp_var = setcomp_rule(p))
13632 )
13633 {
13634 res = setcomp_var;
13635 goto done;
13636 }
13637 p->mark = mark;
13638 }
13639 res = NULL;
13640 done:
13641 return res;
13642}
13643
13644// _loop1_92: STRING
13645static asdl_seq *
13646_loop1_92_rule(Parser *p)
13647{
13648 if (p->error_indicator) {
13649 return NULL;
13650 }
13651 void *res = NULL;
13652 int mark = p->mark;
13653 int start_mark = p->mark;
13654 void **children = PyMem_Malloc(sizeof(void *));
13655 if (!children) {
13656 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13657 return NULL;
13658 }
13659 ssize_t children_capacity = 1;
13660 ssize_t n = 0;
13661 { // STRING
13662 expr_ty string_var;
13663 while (
13664 (string_var = _PyPegen_string_token(p))
13665 )
13666 {
13667 res = string_var;
13668 if (n == children_capacity) {
13669 children_capacity *= 2;
13670 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13671 if (!children) {
13672 PyErr_Format(PyExc_MemoryError, "realloc None");
13673 return NULL;
13674 }
13675 }
13676 children[n++] = res;
13677 mark = p->mark;
13678 }
13679 p->mark = mark;
13680 }
13681 if (n == 0) {
13682 PyMem_Free(children);
13683 return NULL;
13684 }
13685 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13686 if (!seq) {
13687 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_92");
13688 PyMem_Free(children);
13689 return NULL;
13690 }
13691 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13692 PyMem_Free(children);
13693 _PyPegen_insert_memo(p, start_mark, _loop1_92_type, seq);
13694 return seq;
13695}
13696
13697// _tmp_93: star_named_expression ',' star_named_expressions?
13698static void *
13699_tmp_93_rule(Parser *p)
13700{
13701 if (p->error_indicator) {
13702 return NULL;
13703 }
13704 void * res = NULL;
13705 int mark = p->mark;
13706 { // star_named_expression ',' star_named_expressions?
13707 void *literal;
13708 expr_ty y;
13709 void *z;
13710 if (
13711 (y = star_named_expression_rule(p))
13712 &&
13713 (literal = _PyPegen_expect_token(p, 12))
13714 &&
13715 (z = star_named_expressions_rule(p), 1)
13716 )
13717 {
13718 res = _PyPegen_seq_insert_in_front ( p , y , z );
13719 if (res == NULL && PyErr_Occurred()) {
13720 p->error_indicator = 1;
13721 return NULL;
13722 }
13723 goto done;
13724 }
13725 p->mark = mark;
13726 }
13727 res = NULL;
13728 done:
13729 return res;
13730}
13731
13732// _tmp_94: yield_expr | named_expression
13733static void *
13734_tmp_94_rule(Parser *p)
13735{
13736 if (p->error_indicator) {
13737 return NULL;
13738 }
13739 void * res = NULL;
13740 int mark = p->mark;
13741 { // yield_expr
13742 expr_ty yield_expr_var;
13743 if (
13744 (yield_expr_var = yield_expr_rule(p))
13745 )
13746 {
13747 res = yield_expr_var;
13748 goto done;
13749 }
13750 p->mark = mark;
13751 }
13752 { // named_expression
13753 expr_ty named_expression_var;
13754 if (
13755 (named_expression_var = named_expression_rule(p))
13756 )
13757 {
13758 res = named_expression_var;
13759 goto done;
13760 }
13761 p->mark = mark;
13762 }
13763 res = NULL;
13764 done:
13765 return res;
13766}
13767
13768// _loop0_96: ',' kvpair
13769static asdl_seq *
13770_loop0_96_rule(Parser *p)
13771{
13772 if (p->error_indicator) {
13773 return NULL;
13774 }
13775 void *res = NULL;
13776 int mark = p->mark;
13777 int start_mark = p->mark;
13778 void **children = PyMem_Malloc(sizeof(void *));
13779 if (!children) {
13780 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13781 return NULL;
13782 }
13783 ssize_t children_capacity = 1;
13784 ssize_t n = 0;
13785 { // ',' kvpair
13786 KeyValuePair* elem;
13787 void *literal;
13788 while (
13789 (literal = _PyPegen_expect_token(p, 12))
13790 &&
13791 (elem = kvpair_rule(p))
13792 )
13793 {
13794 res = elem;
13795 if (res == NULL && PyErr_Occurred()) {
13796 p->error_indicator = 1;
13797 PyMem_Free(children);
13798 return NULL;
13799 }
13800 if (n == children_capacity) {
13801 children_capacity *= 2;
13802 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13803 if (!children) {
13804 PyErr_Format(PyExc_MemoryError, "realloc None");
13805 return NULL;
13806 }
13807 }
13808 children[n++] = res;
13809 mark = p->mark;
13810 }
13811 p->mark = mark;
13812 }
13813 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13814 if (!seq) {
13815 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_96");
13816 PyMem_Free(children);
13817 return NULL;
13818 }
13819 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13820 PyMem_Free(children);
13821 _PyPegen_insert_memo(p, start_mark, _loop0_96_type, seq);
13822 return seq;
13823}
13824
13825// _gather_95: kvpair _loop0_96
13826static asdl_seq *
13827_gather_95_rule(Parser *p)
13828{
13829 if (p->error_indicator) {
13830 return NULL;
13831 }
13832 asdl_seq * res = NULL;
13833 int mark = p->mark;
13834 { // kvpair _loop0_96
13835 KeyValuePair* elem;
13836 asdl_seq * seq;
13837 if (
13838 (elem = kvpair_rule(p))
13839 &&
13840 (seq = _loop0_96_rule(p))
13841 )
13842 {
13843 res = _PyPegen_seq_insert_in_front(p, elem, seq);
13844 goto done;
13845 }
13846 p->mark = mark;
13847 }
13848 res = NULL;
13849 done:
13850 return res;
13851}
13852
13853// _loop1_97: (ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*)
13854static asdl_seq *
13855_loop1_97_rule(Parser *p)
13856{
13857 if (p->error_indicator) {
13858 return NULL;
13859 }
13860 void *res = NULL;
13861 int mark = p->mark;
13862 int start_mark = p->mark;
13863 void **children = PyMem_Malloc(sizeof(void *));
13864 if (!children) {
13865 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13866 return NULL;
13867 }
13868 ssize_t children_capacity = 1;
13869 ssize_t n = 0;
13870 { // (ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*)
13871 void *_tmp_133_var;
13872 while (
13873 (_tmp_133_var = _tmp_133_rule(p))
13874 )
13875 {
13876 res = _tmp_133_var;
13877 if (n == children_capacity) {
13878 children_capacity *= 2;
13879 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13880 if (!children) {
13881 PyErr_Format(PyExc_MemoryError, "realloc None");
13882 return NULL;
13883 }
13884 }
13885 children[n++] = res;
13886 mark = p->mark;
13887 }
13888 p->mark = mark;
13889 }
13890 if (n == 0) {
13891 PyMem_Free(children);
13892 return NULL;
13893 }
13894 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13895 if (!seq) {
13896 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_97");
13897 PyMem_Free(children);
13898 return NULL;
13899 }
13900 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13901 PyMem_Free(children);
13902 _PyPegen_insert_memo(p, start_mark, _loop1_97_type, seq);
13903 return seq;
13904}
13905
13906// _tmp_98: ',' args
13907static void *
13908_tmp_98_rule(Parser *p)
13909{
13910 if (p->error_indicator) {
13911 return NULL;
13912 }
13913 void * res = NULL;
13914 int mark = p->mark;
13915 { // ',' args
13916 expr_ty c;
13917 void *literal;
13918 if (
13919 (literal = _PyPegen_expect_token(p, 12))
13920 &&
13921 (c = args_rule(p))
13922 )
13923 {
13924 res = c;
13925 if (res == NULL && PyErr_Occurred()) {
13926 p->error_indicator = 1;
13927 return NULL;
13928 }
13929 goto done;
13930 }
13931 p->mark = mark;
13932 }
13933 res = NULL;
13934 done:
13935 return res;
13936}
13937
13938// _tmp_99: ',' args
13939static void *
13940_tmp_99_rule(Parser *p)
13941{
13942 if (p->error_indicator) {
13943 return NULL;
13944 }
13945 void * res = NULL;
13946 int mark = p->mark;
13947 { // ',' args
13948 expr_ty c;
13949 void *literal;
13950 if (
13951 (literal = _PyPegen_expect_token(p, 12))
13952 &&
13953 (c = args_rule(p))
13954 )
13955 {
13956 res = c;
13957 if (res == NULL && PyErr_Occurred()) {
13958 p->error_indicator = 1;
13959 return NULL;
13960 }
13961 goto done;
13962 }
13963 p->mark = mark;
13964 }
13965 res = NULL;
13966 done:
13967 return res;
13968}
13969
13970// _loop0_101: ',' kwarg_or_starred
13971static asdl_seq *
13972_loop0_101_rule(Parser *p)
13973{
13974 if (p->error_indicator) {
13975 return NULL;
13976 }
13977 void *res = NULL;
13978 int mark = p->mark;
13979 int start_mark = p->mark;
13980 void **children = PyMem_Malloc(sizeof(void *));
13981 if (!children) {
13982 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13983 return NULL;
13984 }
13985 ssize_t children_capacity = 1;
13986 ssize_t n = 0;
13987 { // ',' kwarg_or_starred
13988 KeywordOrStarred* elem;
13989 void *literal;
13990 while (
13991 (literal = _PyPegen_expect_token(p, 12))
13992 &&
13993 (elem = kwarg_or_starred_rule(p))
13994 )
13995 {
13996 res = elem;
13997 if (res == NULL && PyErr_Occurred()) {
13998 p->error_indicator = 1;
13999 PyMem_Free(children);
14000 return NULL;
14001 }
14002 if (n == children_capacity) {
14003 children_capacity *= 2;
14004 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14005 if (!children) {
14006 PyErr_Format(PyExc_MemoryError, "realloc None");
14007 return NULL;
14008 }
14009 }
14010 children[n++] = res;
14011 mark = p->mark;
14012 }
14013 p->mark = mark;
14014 }
14015 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14016 if (!seq) {
14017 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_101");
14018 PyMem_Free(children);
14019 return NULL;
14020 }
14021 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14022 PyMem_Free(children);
14023 _PyPegen_insert_memo(p, start_mark, _loop0_101_type, seq);
14024 return seq;
14025}
14026
14027// _gather_100: kwarg_or_starred _loop0_101
14028static asdl_seq *
14029_gather_100_rule(Parser *p)
14030{
14031 if (p->error_indicator) {
14032 return NULL;
14033 }
14034 asdl_seq * res = NULL;
14035 int mark = p->mark;
14036 { // kwarg_or_starred _loop0_101
14037 KeywordOrStarred* elem;
14038 asdl_seq * seq;
14039 if (
14040 (elem = kwarg_or_starred_rule(p))
14041 &&
14042 (seq = _loop0_101_rule(p))
14043 )
14044 {
14045 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14046 goto done;
14047 }
14048 p->mark = mark;
14049 }
14050 res = NULL;
14051 done:
14052 return res;
14053}
14054
14055// _loop0_103: ',' kwarg_or_double_starred
14056static asdl_seq *
14057_loop0_103_rule(Parser *p)
14058{
14059 if (p->error_indicator) {
14060 return NULL;
14061 }
14062 void *res = NULL;
14063 int mark = p->mark;
14064 int start_mark = p->mark;
14065 void **children = PyMem_Malloc(sizeof(void *));
14066 if (!children) {
14067 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14068 return NULL;
14069 }
14070 ssize_t children_capacity = 1;
14071 ssize_t n = 0;
14072 { // ',' kwarg_or_double_starred
14073 KeywordOrStarred* elem;
14074 void *literal;
14075 while (
14076 (literal = _PyPegen_expect_token(p, 12))
14077 &&
14078 (elem = kwarg_or_double_starred_rule(p))
14079 )
14080 {
14081 res = elem;
14082 if (res == NULL && PyErr_Occurred()) {
14083 p->error_indicator = 1;
14084 PyMem_Free(children);
14085 return NULL;
14086 }
14087 if (n == children_capacity) {
14088 children_capacity *= 2;
14089 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14090 if (!children) {
14091 PyErr_Format(PyExc_MemoryError, "realloc None");
14092 return NULL;
14093 }
14094 }
14095 children[n++] = res;
14096 mark = p->mark;
14097 }
14098 p->mark = mark;
14099 }
14100 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14101 if (!seq) {
14102 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_103");
14103 PyMem_Free(children);
14104 return NULL;
14105 }
14106 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14107 PyMem_Free(children);
14108 _PyPegen_insert_memo(p, start_mark, _loop0_103_type, seq);
14109 return seq;
14110}
14111
14112// _gather_102: kwarg_or_double_starred _loop0_103
14113static asdl_seq *
14114_gather_102_rule(Parser *p)
14115{
14116 if (p->error_indicator) {
14117 return NULL;
14118 }
14119 asdl_seq * res = NULL;
14120 int mark = p->mark;
14121 { // kwarg_or_double_starred _loop0_103
14122 KeywordOrStarred* elem;
14123 asdl_seq * seq;
14124 if (
14125 (elem = kwarg_or_double_starred_rule(p))
14126 &&
14127 (seq = _loop0_103_rule(p))
14128 )
14129 {
14130 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14131 goto done;
14132 }
14133 p->mark = mark;
14134 }
14135 res = NULL;
14136 done:
14137 return res;
14138}
14139
14140// _loop0_105: ',' kwarg_or_starred
14141static asdl_seq *
14142_loop0_105_rule(Parser *p)
14143{
14144 if (p->error_indicator) {
14145 return NULL;
14146 }
14147 void *res = NULL;
14148 int mark = p->mark;
14149 int start_mark = p->mark;
14150 void **children = PyMem_Malloc(sizeof(void *));
14151 if (!children) {
14152 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14153 return NULL;
14154 }
14155 ssize_t children_capacity = 1;
14156 ssize_t n = 0;
14157 { // ',' kwarg_or_starred
14158 KeywordOrStarred* elem;
14159 void *literal;
14160 while (
14161 (literal = _PyPegen_expect_token(p, 12))
14162 &&
14163 (elem = kwarg_or_starred_rule(p))
14164 )
14165 {
14166 res = elem;
14167 if (res == NULL && PyErr_Occurred()) {
14168 p->error_indicator = 1;
14169 PyMem_Free(children);
14170 return NULL;
14171 }
14172 if (n == children_capacity) {
14173 children_capacity *= 2;
14174 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14175 if (!children) {
14176 PyErr_Format(PyExc_MemoryError, "realloc None");
14177 return NULL;
14178 }
14179 }
14180 children[n++] = res;
14181 mark = p->mark;
14182 }
14183 p->mark = mark;
14184 }
14185 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14186 if (!seq) {
14187 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_105");
14188 PyMem_Free(children);
14189 return NULL;
14190 }
14191 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14192 PyMem_Free(children);
14193 _PyPegen_insert_memo(p, start_mark, _loop0_105_type, seq);
14194 return seq;
14195}
14196
14197// _gather_104: kwarg_or_starred _loop0_105
14198static asdl_seq *
14199_gather_104_rule(Parser *p)
14200{
14201 if (p->error_indicator) {
14202 return NULL;
14203 }
14204 asdl_seq * res = NULL;
14205 int mark = p->mark;
14206 { // kwarg_or_starred _loop0_105
14207 KeywordOrStarred* elem;
14208 asdl_seq * seq;
14209 if (
14210 (elem = kwarg_or_starred_rule(p))
14211 &&
14212 (seq = _loop0_105_rule(p))
14213 )
14214 {
14215 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14216 goto done;
14217 }
14218 p->mark = mark;
14219 }
14220 res = NULL;
14221 done:
14222 return res;
14223}
14224
14225// _loop0_107: ',' kwarg_or_double_starred
14226static asdl_seq *
14227_loop0_107_rule(Parser *p)
14228{
14229 if (p->error_indicator) {
14230 return NULL;
14231 }
14232 void *res = NULL;
14233 int mark = p->mark;
14234 int start_mark = p->mark;
14235 void **children = PyMem_Malloc(sizeof(void *));
14236 if (!children) {
14237 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14238 return NULL;
14239 }
14240 ssize_t children_capacity = 1;
14241 ssize_t n = 0;
14242 { // ',' kwarg_or_double_starred
14243 KeywordOrStarred* elem;
14244 void *literal;
14245 while (
14246 (literal = _PyPegen_expect_token(p, 12))
14247 &&
14248 (elem = kwarg_or_double_starred_rule(p))
14249 )
14250 {
14251 res = elem;
14252 if (res == NULL && PyErr_Occurred()) {
14253 p->error_indicator = 1;
14254 PyMem_Free(children);
14255 return NULL;
14256 }
14257 if (n == children_capacity) {
14258 children_capacity *= 2;
14259 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14260 if (!children) {
14261 PyErr_Format(PyExc_MemoryError, "realloc None");
14262 return NULL;
14263 }
14264 }
14265 children[n++] = res;
14266 mark = p->mark;
14267 }
14268 p->mark = mark;
14269 }
14270 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14271 if (!seq) {
14272 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_107");
14273 PyMem_Free(children);
14274 return NULL;
14275 }
14276 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14277 PyMem_Free(children);
14278 _PyPegen_insert_memo(p, start_mark, _loop0_107_type, seq);
14279 return seq;
14280}
14281
14282// _gather_106: kwarg_or_double_starred _loop0_107
14283static asdl_seq *
14284_gather_106_rule(Parser *p)
14285{
14286 if (p->error_indicator) {
14287 return NULL;
14288 }
14289 asdl_seq * res = NULL;
14290 int mark = p->mark;
14291 { // kwarg_or_double_starred _loop0_107
14292 KeywordOrStarred* elem;
14293 asdl_seq * seq;
14294 if (
14295 (elem = kwarg_or_double_starred_rule(p))
14296 &&
14297 (seq = _loop0_107_rule(p))
14298 )
14299 {
14300 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14301 goto done;
14302 }
14303 p->mark = mark;
14304 }
14305 res = NULL;
14306 done:
14307 return res;
14308}
14309
14310// _loop0_108: (',' star_target)
14311static asdl_seq *
14312_loop0_108_rule(Parser *p)
14313{
14314 if (p->error_indicator) {
14315 return NULL;
14316 }
14317 void *res = NULL;
14318 int mark = p->mark;
14319 int start_mark = p->mark;
14320 void **children = PyMem_Malloc(sizeof(void *));
14321 if (!children) {
14322 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14323 return NULL;
14324 }
14325 ssize_t children_capacity = 1;
14326 ssize_t n = 0;
14327 { // (',' star_target)
14328 void *_tmp_134_var;
14329 while (
14330 (_tmp_134_var = _tmp_134_rule(p))
14331 )
14332 {
14333 res = _tmp_134_var;
14334 if (n == children_capacity) {
14335 children_capacity *= 2;
14336 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14337 if (!children) {
14338 PyErr_Format(PyExc_MemoryError, "realloc None");
14339 return NULL;
14340 }
14341 }
14342 children[n++] = res;
14343 mark = p->mark;
14344 }
14345 p->mark = mark;
14346 }
14347 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14348 if (!seq) {
14349 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_108");
14350 PyMem_Free(children);
14351 return NULL;
14352 }
14353 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14354 PyMem_Free(children);
14355 _PyPegen_insert_memo(p, start_mark, _loop0_108_type, seq);
14356 return seq;
14357}
14358
14359// _loop0_110: ',' star_target
14360static asdl_seq *
14361_loop0_110_rule(Parser *p)
14362{
14363 if (p->error_indicator) {
14364 return NULL;
14365 }
14366 void *res = NULL;
14367 int mark = p->mark;
14368 int start_mark = p->mark;
14369 void **children = PyMem_Malloc(sizeof(void *));
14370 if (!children) {
14371 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14372 return NULL;
14373 }
14374 ssize_t children_capacity = 1;
14375 ssize_t n = 0;
14376 { // ',' star_target
14377 expr_ty elem;
14378 void *literal;
14379 while (
14380 (literal = _PyPegen_expect_token(p, 12))
14381 &&
14382 (elem = star_target_rule(p))
14383 )
14384 {
14385 res = elem;
14386 if (res == NULL && PyErr_Occurred()) {
14387 p->error_indicator = 1;
14388 PyMem_Free(children);
14389 return NULL;
14390 }
14391 if (n == children_capacity) {
14392 children_capacity *= 2;
14393 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14394 if (!children) {
14395 PyErr_Format(PyExc_MemoryError, "realloc None");
14396 return NULL;
14397 }
14398 }
14399 children[n++] = res;
14400 mark = p->mark;
14401 }
14402 p->mark = mark;
14403 }
14404 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14405 if (!seq) {
14406 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_110");
14407 PyMem_Free(children);
14408 return NULL;
14409 }
14410 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14411 PyMem_Free(children);
14412 _PyPegen_insert_memo(p, start_mark, _loop0_110_type, seq);
14413 return seq;
14414}
14415
14416// _gather_109: star_target _loop0_110
14417static asdl_seq *
14418_gather_109_rule(Parser *p)
14419{
14420 if (p->error_indicator) {
14421 return NULL;
14422 }
14423 asdl_seq * res = NULL;
14424 int mark = p->mark;
14425 { // star_target _loop0_110
14426 expr_ty elem;
14427 asdl_seq * seq;
14428 if (
14429 (elem = star_target_rule(p))
14430 &&
14431 (seq = _loop0_110_rule(p))
14432 )
14433 {
14434 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14435 goto done;
14436 }
14437 p->mark = mark;
14438 }
14439 res = NULL;
14440 done:
14441 return res;
14442}
14443
14444// _tmp_111: !'*' star_target
14445static void *
14446_tmp_111_rule(Parser *p)
14447{
14448 if (p->error_indicator) {
14449 return NULL;
14450 }
14451 void * res = NULL;
14452 int mark = p->mark;
14453 { // !'*' star_target
14454 expr_ty star_target_var;
14455 if (
14456 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16)
14457 &&
14458 (star_target_var = star_target_rule(p))
14459 )
14460 {
14461 res = star_target_var;
14462 goto done;
14463 }
14464 p->mark = mark;
14465 }
14466 res = NULL;
14467 done:
14468 return res;
14469}
14470
14471// _loop0_113: ',' del_target
14472static asdl_seq *
14473_loop0_113_rule(Parser *p)
14474{
14475 if (p->error_indicator) {
14476 return NULL;
14477 }
14478 void *res = NULL;
14479 int mark = p->mark;
14480 int start_mark = p->mark;
14481 void **children = PyMem_Malloc(sizeof(void *));
14482 if (!children) {
14483 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14484 return NULL;
14485 }
14486 ssize_t children_capacity = 1;
14487 ssize_t n = 0;
14488 { // ',' del_target
14489 expr_ty elem;
14490 void *literal;
14491 while (
14492 (literal = _PyPegen_expect_token(p, 12))
14493 &&
14494 (elem = del_target_rule(p))
14495 )
14496 {
14497 res = elem;
14498 if (res == NULL && PyErr_Occurred()) {
14499 p->error_indicator = 1;
14500 PyMem_Free(children);
14501 return NULL;
14502 }
14503 if (n == children_capacity) {
14504 children_capacity *= 2;
14505 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14506 if (!children) {
14507 PyErr_Format(PyExc_MemoryError, "realloc None");
14508 return NULL;
14509 }
14510 }
14511 children[n++] = res;
14512 mark = p->mark;
14513 }
14514 p->mark = mark;
14515 }
14516 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14517 if (!seq) {
14518 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_113");
14519 PyMem_Free(children);
14520 return NULL;
14521 }
14522 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14523 PyMem_Free(children);
14524 _PyPegen_insert_memo(p, start_mark, _loop0_113_type, seq);
14525 return seq;
14526}
14527
14528// _gather_112: del_target _loop0_113
14529static asdl_seq *
14530_gather_112_rule(Parser *p)
14531{
14532 if (p->error_indicator) {
14533 return NULL;
14534 }
14535 asdl_seq * res = NULL;
14536 int mark = p->mark;
14537 { // del_target _loop0_113
14538 expr_ty elem;
14539 asdl_seq * seq;
14540 if (
14541 (elem = del_target_rule(p))
14542 &&
14543 (seq = _loop0_113_rule(p))
14544 )
14545 {
14546 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14547 goto done;
14548 }
14549 p->mark = mark;
14550 }
14551 res = NULL;
14552 done:
14553 return res;
14554}
14555
14556// _loop0_115: ',' target
14557static asdl_seq *
14558_loop0_115_rule(Parser *p)
14559{
14560 if (p->error_indicator) {
14561 return NULL;
14562 }
14563 void *res = NULL;
14564 int mark = p->mark;
14565 int start_mark = p->mark;
14566 void **children = PyMem_Malloc(sizeof(void *));
14567 if (!children) {
14568 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14569 return NULL;
14570 }
14571 ssize_t children_capacity = 1;
14572 ssize_t n = 0;
14573 { // ',' target
14574 expr_ty elem;
14575 void *literal;
14576 while (
14577 (literal = _PyPegen_expect_token(p, 12))
14578 &&
14579 (elem = target_rule(p))
14580 )
14581 {
14582 res = elem;
14583 if (res == NULL && PyErr_Occurred()) {
14584 p->error_indicator = 1;
14585 PyMem_Free(children);
14586 return NULL;
14587 }
14588 if (n == children_capacity) {
14589 children_capacity *= 2;
14590 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14591 if (!children) {
14592 PyErr_Format(PyExc_MemoryError, "realloc None");
14593 return NULL;
14594 }
14595 }
14596 children[n++] = res;
14597 mark = p->mark;
14598 }
14599 p->mark = mark;
14600 }
14601 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14602 if (!seq) {
14603 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_115");
14604 PyMem_Free(children);
14605 return NULL;
14606 }
14607 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14608 PyMem_Free(children);
14609 _PyPegen_insert_memo(p, start_mark, _loop0_115_type, seq);
14610 return seq;
14611}
14612
14613// _gather_114: target _loop0_115
14614static asdl_seq *
14615_gather_114_rule(Parser *p)
14616{
14617 if (p->error_indicator) {
14618 return NULL;
14619 }
14620 asdl_seq * res = NULL;
14621 int mark = p->mark;
14622 { // target _loop0_115
14623 expr_ty elem;
14624 asdl_seq * seq;
14625 if (
14626 (elem = target_rule(p))
14627 &&
14628 (seq = _loop0_115_rule(p))
14629 )
14630 {
14631 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14632 goto done;
14633 }
14634 p->mark = mark;
14635 }
14636 res = NULL;
14637 done:
14638 return res;
14639}
14640
14641// _tmp_116: args | expression for_if_clauses
14642static void *
14643_tmp_116_rule(Parser *p)
14644{
14645 if (p->error_indicator) {
14646 return NULL;
14647 }
14648 void * res = NULL;
14649 int mark = p->mark;
14650 { // args
14651 expr_ty args_var;
14652 if (
14653 (args_var = args_rule(p))
14654 )
14655 {
14656 res = args_var;
14657 goto done;
14658 }
14659 p->mark = mark;
14660 }
14661 { // expression for_if_clauses
14662 expr_ty expression_var;
14663 asdl_seq* for_if_clauses_var;
14664 if (
14665 (expression_var = expression_rule(p))
14666 &&
14667 (for_if_clauses_var = for_if_clauses_rule(p))
14668 )
14669 {
14670 res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
14671 goto done;
14672 }
14673 p->mark = mark;
14674 }
14675 res = NULL;
14676 done:
14677 return res;
14678}
14679
14680// _tmp_117: '=' annotated_rhs
14681static void *
14682_tmp_117_rule(Parser *p)
14683{
14684 if (p->error_indicator) {
14685 return NULL;
14686 }
14687 void * res = NULL;
14688 int mark = p->mark;
14689 { // '=' annotated_rhs
14690 expr_ty annotated_rhs_var;
14691 void *literal;
14692 if (
14693 (literal = _PyPegen_expect_token(p, 22))
14694 &&
14695 (annotated_rhs_var = annotated_rhs_rule(p))
14696 )
14697 {
14698 res = _PyPegen_dummy_name(p, literal, annotated_rhs_var);
14699 goto done;
14700 }
14701 p->mark = mark;
14702 }
14703 res = NULL;
14704 done:
14705 return res;
14706}
14707
14708// _tmp_118: '=' | augassign
14709static void *
14710_tmp_118_rule(Parser *p)
14711{
14712 if (p->error_indicator) {
14713 return NULL;
14714 }
14715 void * res = NULL;
14716 int mark = p->mark;
14717 { // '='
14718 void *literal;
14719 if (
14720 (literal = _PyPegen_expect_token(p, 22))
14721 )
14722 {
14723 res = literal;
14724 goto done;
14725 }
14726 p->mark = mark;
14727 }
14728 { // augassign
14729 AugOperator* augassign_var;
14730 if (
14731 (augassign_var = augassign_rule(p))
14732 )
14733 {
14734 res = augassign_var;
14735 goto done;
14736 }
14737 p->mark = mark;
14738 }
14739 res = NULL;
14740 done:
14741 return res;
14742}
14743
14744// _tmp_119: yield_expr | star_expressions
14745static void *
14746_tmp_119_rule(Parser *p)
14747{
14748 if (p->error_indicator) {
14749 return NULL;
14750 }
14751 void * res = NULL;
14752 int mark = p->mark;
14753 { // yield_expr
14754 expr_ty yield_expr_var;
14755 if (
14756 (yield_expr_var = yield_expr_rule(p))
14757 )
14758 {
14759 res = yield_expr_var;
14760 goto done;
14761 }
14762 p->mark = mark;
14763 }
14764 { // star_expressions
14765 expr_ty star_expressions_var;
14766 if (
14767 (star_expressions_var = star_expressions_rule(p))
14768 )
14769 {
14770 res = star_expressions_var;
14771 goto done;
14772 }
14773 p->mark = mark;
14774 }
14775 res = NULL;
14776 done:
14777 return res;
14778}
14779
14780// _tmp_120: '[' | '(' | '{'
14781static void *
14782_tmp_120_rule(Parser *p)
14783{
14784 if (p->error_indicator) {
14785 return NULL;
14786 }
14787 void * res = NULL;
14788 int mark = p->mark;
14789 { // '['
14790 void *literal;
14791 if (
14792 (literal = _PyPegen_expect_token(p, 9))
14793 )
14794 {
14795 res = literal;
14796 goto done;
14797 }
14798 p->mark = mark;
14799 }
14800 { // '('
14801 void *literal;
14802 if (
14803 (literal = _PyPegen_expect_token(p, 7))
14804 )
14805 {
14806 res = literal;
14807 goto done;
14808 }
14809 p->mark = mark;
14810 }
14811 { // '{'
14812 void *literal;
14813 if (
14814 (literal = _PyPegen_expect_token(p, 25))
14815 )
14816 {
14817 res = literal;
14818 goto done;
14819 }
14820 p->mark = mark;
14821 }
14822 res = NULL;
14823 done:
14824 return res;
14825}
14826
14827// _tmp_121: plain_names ','
14828static void *
14829_tmp_121_rule(Parser *p)
14830{
14831 if (p->error_indicator) {
14832 return NULL;
14833 }
14834 void * res = NULL;
14835 int mark = p->mark;
14836 { // plain_names ','
14837 void *literal;
14838 asdl_seq* plain_names_var;
14839 if (
14840 (plain_names_var = plain_names_rule(p))
14841 &&
14842 (literal = _PyPegen_expect_token(p, 12))
14843 )
14844 {
14845 res = _PyPegen_dummy_name(p, plain_names_var, literal);
14846 goto done;
14847 }
14848 p->mark = mark;
14849 }
14850 res = NULL;
14851 done:
14852 return res;
14853}
14854
14855// _tmp_122: slash_with_default | names_with_default
14856static void *
14857_tmp_122_rule(Parser *p)
14858{
14859 if (p->error_indicator) {
14860 return NULL;
14861 }
14862 void * res = NULL;
14863 int mark = p->mark;
14864 { // slash_with_default
14865 SlashWithDefault* slash_with_default_var;
14866 if (
14867 (slash_with_default_var = slash_with_default_rule(p))
14868 )
14869 {
14870 res = slash_with_default_var;
14871 goto done;
14872 }
14873 p->mark = mark;
14874 }
14875 { // names_with_default
14876 asdl_seq* names_with_default_var;
14877 if (
14878 (names_with_default_var = names_with_default_rule(p))
14879 )
14880 {
14881 res = names_with_default_var;
14882 goto done;
14883 }
14884 p->mark = mark;
14885 }
14886 res = NULL;
14887 done:
14888 return res;
14889}
14890
14891// _tmp_123: star_targets '='
14892static void *
14893_tmp_123_rule(Parser *p)
14894{
14895 if (p->error_indicator) {
14896 return NULL;
14897 }
14898 void * res = NULL;
14899 int mark = p->mark;
14900 { // star_targets '='
14901 void *literal;
14902 expr_ty z;
14903 if (
14904 (z = star_targets_rule(p))
14905 &&
14906 (literal = _PyPegen_expect_token(p, 22))
14907 )
14908 {
14909 res = z;
14910 if (res == NULL && PyErr_Occurred()) {
14911 p->error_indicator = 1;
14912 return NULL;
14913 }
14914 goto done;
14915 }
14916 p->mark = mark;
14917 }
14918 res = NULL;
14919 done:
14920 return res;
14921}
14922
14923// _tmp_124: '.' | '...'
14924static void *
14925_tmp_124_rule(Parser *p)
14926{
14927 if (p->error_indicator) {
14928 return NULL;
14929 }
14930 void * res = NULL;
14931 int mark = p->mark;
14932 { // '.'
14933 void *literal;
14934 if (
14935 (literal = _PyPegen_expect_token(p, 23))
14936 )
14937 {
14938 res = literal;
14939 goto done;
14940 }
14941 p->mark = mark;
14942 }
14943 { // '...'
14944 void *literal;
14945 if (
14946 (literal = _PyPegen_expect_token(p, 52))
14947 )
14948 {
14949 res = literal;
14950 goto done;
14951 }
14952 p->mark = mark;
14953 }
14954 res = NULL;
14955 done:
14956 return res;
14957}
14958
14959// _tmp_125: '.' | '...'
14960static void *
14961_tmp_125_rule(Parser *p)
14962{
14963 if (p->error_indicator) {
14964 return NULL;
14965 }
14966 void * res = NULL;
14967 int mark = p->mark;
14968 { // '.'
14969 void *literal;
14970 if (
14971 (literal = _PyPegen_expect_token(p, 23))
14972 )
14973 {
14974 res = literal;
14975 goto done;
14976 }
14977 p->mark = mark;
14978 }
14979 { // '...'
14980 void *literal;
14981 if (
14982 (literal = _PyPegen_expect_token(p, 52))
14983 )
14984 {
14985 res = literal;
14986 goto done;
14987 }
14988 p->mark = mark;
14989 }
14990 res = NULL;
14991 done:
14992 return res;
14993}
14994
14995// _tmp_126: plain_name !'='
14996static void *
14997_tmp_126_rule(Parser *p)
14998{
14999 if (p->error_indicator) {
15000 return NULL;
15001 }
15002 void * res = NULL;
15003 int mark = p->mark;
15004 { // plain_name !'='
15005 arg_ty plain_name_var;
15006 if (
15007 (plain_name_var = plain_name_rule(p))
15008 &&
15009 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22)
15010 )
15011 {
15012 res = plain_name_var;
15013 goto done;
15014 }
15015 p->mark = mark;
15016 }
15017 res = NULL;
15018 done:
15019 return res;
15020}
15021
15022// _tmp_127: '@' named_expression NEWLINE
15023static void *
15024_tmp_127_rule(Parser *p)
15025{
15026 if (p->error_indicator) {
15027 return NULL;
15028 }
15029 void * res = NULL;
15030 int mark = p->mark;
15031 { // '@' named_expression NEWLINE
15032 expr_ty f;
15033 void *literal;
15034 void *newline_var;
15035 if (
15036 (literal = _PyPegen_expect_token(p, 49))
15037 &&
15038 (f = named_expression_rule(p))
15039 &&
15040 (newline_var = _PyPegen_newline_token(p))
15041 )
15042 {
15043 res = f;
15044 if (res == NULL && PyErr_Occurred()) {
15045 p->error_indicator = 1;
15046 return NULL;
15047 }
15048 goto done;
15049 }
15050 p->mark = mark;
15051 }
15052 res = NULL;
15053 done:
15054 return res;
15055}
15056
15057// _tmp_128: ',' star_expression
15058static void *
15059_tmp_128_rule(Parser *p)
15060{
15061 if (p->error_indicator) {
15062 return NULL;
15063 }
15064 void * res = NULL;
15065 int mark = p->mark;
15066 { // ',' star_expression
15067 expr_ty c;
15068 void *literal;
15069 if (
15070 (literal = _PyPegen_expect_token(p, 12))
15071 &&
15072 (c = star_expression_rule(p))
15073 )
15074 {
15075 res = c;
15076 if (res == NULL && PyErr_Occurred()) {
15077 p->error_indicator = 1;
15078 return NULL;
15079 }
15080 goto done;
15081 }
15082 p->mark = mark;
15083 }
15084 res = NULL;
15085 done:
15086 return res;
15087}
15088
15089// _tmp_129: ',' expression
15090static void *
15091_tmp_129_rule(Parser *p)
15092{
15093 if (p->error_indicator) {
15094 return NULL;
15095 }
15096 void * res = NULL;
15097 int mark = p->mark;
15098 { // ',' expression
15099 expr_ty c;
15100 void *literal;
15101 if (
15102 (literal = _PyPegen_expect_token(p, 12))
15103 &&
15104 (c = expression_rule(p))
15105 )
15106 {
15107 res = c;
15108 if (res == NULL && PyErr_Occurred()) {
15109 p->error_indicator = 1;
15110 return NULL;
15111 }
15112 goto done;
15113 }
15114 p->mark = mark;
15115 }
15116 res = NULL;
15117 done:
15118 return res;
15119}
15120
15121// _tmp_130: lambda_plain_name !'='
15122static void *
15123_tmp_130_rule(Parser *p)
15124{
15125 if (p->error_indicator) {
15126 return NULL;
15127 }
15128 void * res = NULL;
15129 int mark = p->mark;
15130 { // lambda_plain_name !'='
15131 arg_ty lambda_plain_name_var;
15132 if (
15133 (lambda_plain_name_var = lambda_plain_name_rule(p))
15134 &&
15135 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22)
15136 )
15137 {
15138 res = lambda_plain_name_var;
15139 goto done;
15140 }
15141 p->mark = mark;
15142 }
15143 res = NULL;
15144 done:
15145 return res;
15146}
15147
15148// _tmp_131: 'or' conjunction
15149static void *
15150_tmp_131_rule(Parser *p)
15151{
15152 if (p->error_indicator) {
15153 return NULL;
15154 }
15155 void * res = NULL;
15156 int mark = p->mark;
15157 { // 'or' conjunction
15158 expr_ty c;
15159 void *keyword;
15160 if (
15161 (keyword = _PyPegen_expect_token(p, 532))
15162 &&
15163 (c = conjunction_rule(p))
15164 )
15165 {
15166 res = c;
15167 if (res == NULL && PyErr_Occurred()) {
15168 p->error_indicator = 1;
15169 return NULL;
15170 }
15171 goto done;
15172 }
15173 p->mark = mark;
15174 }
15175 res = NULL;
15176 done:
15177 return res;
15178}
15179
15180// _tmp_132: 'and' inversion
15181static void *
15182_tmp_132_rule(Parser *p)
15183{
15184 if (p->error_indicator) {
15185 return NULL;
15186 }
15187 void * res = NULL;
15188 int mark = p->mark;
15189 { // 'and' inversion
15190 expr_ty c;
15191 void *keyword;
15192 if (
15193 (keyword = _PyPegen_expect_token(p, 533))
15194 &&
15195 (c = inversion_rule(p))
15196 )
15197 {
15198 res = c;
15199 if (res == NULL && PyErr_Occurred()) {
15200 p->error_indicator = 1;
15201 return NULL;
15202 }
15203 goto done;
15204 }
15205 p->mark = mark;
15206 }
15207 res = NULL;
15208 done:
15209 return res;
15210}
15211
15212// _tmp_133: ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*
15213static void *
15214_tmp_133_rule(Parser *p)
15215{
15216 if (p->error_indicator) {
15217 return NULL;
15218 }
15219 void * res = NULL;
15220 int mark = p->mark;
15221 { // ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*
15222 expr_ty a;
15223 expr_ty b;
15224 asdl_seq * c;
15225 void *keyword;
15226 void *keyword_1;
15227 void *y;
15228 if (
15229 (y = _PyPegen_async_token(p), 1)
15230 &&
15231 (keyword = _PyPegen_expect_token(p, 517))
15232 &&
15233 (a = star_targets_rule(p))
15234 &&
15235 (keyword_1 = _PyPegen_expect_token(p, 518))
15236 &&
15237 (b = disjunction_rule(p))
15238 &&
15239 (c = _loop0_135_rule(p))
15240 )
15241 {
15242 res = _Py_comprehension ( a , b , c , y != NULL , p -> arena );
15243 if (res == NULL && PyErr_Occurred()) {
15244 p->error_indicator = 1;
15245 return NULL;
15246 }
15247 goto done;
15248 }
15249 p->mark = mark;
15250 }
15251 res = NULL;
15252 done:
15253 return res;
15254}
15255
15256// _tmp_134: ',' star_target
15257static void *
15258_tmp_134_rule(Parser *p)
15259{
15260 if (p->error_indicator) {
15261 return NULL;
15262 }
15263 void * res = NULL;
15264 int mark = p->mark;
15265 { // ',' star_target
15266 expr_ty c;
15267 void *literal;
15268 if (
15269 (literal = _PyPegen_expect_token(p, 12))
15270 &&
15271 (c = star_target_rule(p))
15272 )
15273 {
15274 res = c;
15275 if (res == NULL && PyErr_Occurred()) {
15276 p->error_indicator = 1;
15277 return NULL;
15278 }
15279 goto done;
15280 }
15281 p->mark = mark;
15282 }
15283 res = NULL;
15284 done:
15285 return res;
15286}
15287
15288// _loop0_135: ('if' disjunction)
15289static asdl_seq *
15290_loop0_135_rule(Parser *p)
15291{
15292 if (p->error_indicator) {
15293 return NULL;
15294 }
15295 void *res = NULL;
15296 int mark = p->mark;
15297 int start_mark = p->mark;
15298 void **children = PyMem_Malloc(sizeof(void *));
15299 if (!children) {
15300 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15301 return NULL;
15302 }
15303 ssize_t children_capacity = 1;
15304 ssize_t n = 0;
15305 { // ('if' disjunction)
15306 void *_tmp_136_var;
15307 while (
15308 (_tmp_136_var = _tmp_136_rule(p))
15309 )
15310 {
15311 res = _tmp_136_var;
15312 if (n == children_capacity) {
15313 children_capacity *= 2;
15314 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15315 if (!children) {
15316 PyErr_Format(PyExc_MemoryError, "realloc None");
15317 return NULL;
15318 }
15319 }
15320 children[n++] = res;
15321 mark = p->mark;
15322 }
15323 p->mark = mark;
15324 }
15325 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15326 if (!seq) {
15327 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_135");
15328 PyMem_Free(children);
15329 return NULL;
15330 }
15331 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15332 PyMem_Free(children);
15333 _PyPegen_insert_memo(p, start_mark, _loop0_135_type, seq);
15334 return seq;
15335}
15336
15337// _tmp_136: 'if' disjunction
15338static void *
15339_tmp_136_rule(Parser *p)
15340{
15341 if (p->error_indicator) {
15342 return NULL;
15343 }
15344 void * res = NULL;
15345 int mark = p->mark;
15346 { // 'if' disjunction
15347 void *keyword;
15348 expr_ty z;
15349 if (
15350 (keyword = _PyPegen_expect_token(p, 510))
15351 &&
15352 (z = disjunction_rule(p))
15353 )
15354 {
15355 res = z;
15356 if (res == NULL && PyErr_Occurred()) {
15357 p->error_indicator = 1;
15358 return NULL;
15359 }
15360 goto done;
15361 }
15362 p->mark = mark;
15363 }
15364 res = NULL;
15365 done:
15366 return res;
15367}
15368
15369void *
15370_PyPegen_parse(Parser *p)
15371{
15372 // Initialize keywords
15373 p->keywords = reserved_keywords;
15374 p->n_keyword_lists = n_keyword_lists;
15375
15376 // Run parser
15377 void *result = NULL;
15378 if (p->start_rule == Py_file_input) {
15379 result = file_rule(p);
15380 } else if (p->start_rule == Py_single_input) {
15381 result = interactive_rule(p);
15382 } else if (p->start_rule == Py_eval_input) {
15383 result = eval_rule(p);
15384 } else if (p->start_rule == Py_fstring_input) {
15385 result = fstring_rule(p);
15386 }
15387
15388 return result;
15389}
15390
15391// The end