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