blob: 8ff9a70d3bb8223c0e41e9039b84425bb2cb55ba [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
Guido van Rossumc001c092020-04-30 12:12:19 -070074#define func_type_type 1003
75#define fstring_type 1004
76#define type_expressions_type 1005
77#define statements_type 1006
78#define statement_type 1007
79#define statement_newline_type 1008
80#define simple_stmt_type 1009
81#define small_stmt_type 1010
82#define compound_stmt_type 1011
83#define assignment_type 1012
84#define augassign_type 1013
85#define global_stmt_type 1014
86#define nonlocal_stmt_type 1015
87#define yield_stmt_type 1016
88#define assert_stmt_type 1017
89#define del_stmt_type 1018
90#define import_stmt_type 1019
91#define import_name_type 1020
92#define import_from_type 1021
93#define import_from_targets_type 1022
94#define import_from_as_names_type 1023
95#define import_from_as_name_type 1024
96#define dotted_as_names_type 1025
97#define dotted_as_name_type 1026
98#define dotted_name_type 1027 // Left-recursive
99#define if_stmt_type 1028
100#define elif_stmt_type 1029
101#define else_block_type 1030
102#define while_stmt_type 1031
103#define for_stmt_type 1032
104#define with_stmt_type 1033
105#define with_item_type 1034
106#define try_stmt_type 1035
107#define except_block_type 1036
108#define finally_block_type 1037
109#define return_stmt_type 1038
110#define raise_stmt_type 1039
111#define function_def_type 1040
112#define function_def_raw_type 1041
113#define func_type_comment_type 1042
114#define params_type 1043
115#define parameters_type 1044
116#define slash_no_default_type 1045
117#define slash_with_default_type 1046
118#define star_etc_type 1047
119#define kwds_type 1048
120#define param_no_default_type 1049
121#define param_with_default_type 1050
122#define param_maybe_default_type 1051
123#define param_type 1052
124#define annotation_type 1053
125#define default_type 1054
126#define decorators_type 1055
127#define class_def_type 1056
128#define class_def_raw_type 1057
129#define block_type 1058
130#define expressions_list_type 1059
131#define star_expressions_type 1060
132#define star_expression_type 1061
133#define star_named_expressions_type 1062
134#define star_named_expression_type 1063
135#define named_expression_type 1064
136#define annotated_rhs_type 1065
137#define expressions_type 1066
138#define expression_type 1067
139#define lambdef_type 1068
140#define lambda_parameters_type 1069
141#define lambda_slash_without_default_type 1070
142#define lambda_slash_with_default_type 1071
143#define lambda_star_etc_type 1072
144#define lambda_name_with_optional_default_type 1073
145#define lambda_names_with_default_type 1074
146#define lambda_name_with_default_type 1075
147#define lambda_plain_names_type 1076
148#define lambda_plain_name_type 1077
149#define lambda_kwds_type 1078
150#define disjunction_type 1079
151#define conjunction_type 1080
152#define inversion_type 1081
153#define comparison_type 1082
154#define compare_op_bitwise_or_pair_type 1083
155#define eq_bitwise_or_type 1084
156#define noteq_bitwise_or_type 1085
157#define lte_bitwise_or_type 1086
158#define lt_bitwise_or_type 1087
159#define gte_bitwise_or_type 1088
160#define gt_bitwise_or_type 1089
161#define notin_bitwise_or_type 1090
162#define in_bitwise_or_type 1091
163#define isnot_bitwise_or_type 1092
164#define is_bitwise_or_type 1093
165#define bitwise_or_type 1094 // Left-recursive
166#define bitwise_xor_type 1095 // Left-recursive
167#define bitwise_and_type 1096 // Left-recursive
168#define shift_expr_type 1097 // Left-recursive
169#define sum_type 1098 // Left-recursive
170#define term_type 1099 // Left-recursive
171#define factor_type 1100
172#define power_type 1101
173#define await_primary_type 1102
174#define primary_type 1103 // Left-recursive
175#define slices_type 1104
176#define slice_type 1105
177#define atom_type 1106
178#define strings_type 1107
179#define list_type 1108
180#define listcomp_type 1109
181#define tuple_type 1110
182#define group_type 1111
183#define genexp_type 1112
184#define set_type 1113
185#define setcomp_type 1114
186#define dict_type 1115
187#define dictcomp_type 1116
188#define kvpairs_type 1117
189#define kvpair_type 1118
190#define for_if_clauses_type 1119
191#define yield_expr_type 1120
192#define arguments_type 1121
193#define args_type 1122
194#define kwargs_type 1123
195#define starred_expression_type 1124
196#define kwarg_or_starred_type 1125
197#define kwarg_or_double_starred_type 1126
198#define star_targets_type 1127
199#define star_targets_seq_type 1128
200#define star_target_type 1129
201#define star_atom_type 1130
202#define inside_paren_ann_assign_target_type 1131
203#define ann_assign_subscript_attribute_target_type 1132
204#define del_targets_type 1133
205#define del_target_type 1134
206#define del_t_atom_type 1135
207#define targets_type 1136
208#define target_type 1137
209#define t_primary_type 1138 // Left-recursive
210#define t_lookahead_type 1139
211#define t_atom_type 1140
212#define incorrect_arguments_type 1141
213#define invalid_named_expression_type 1142
214#define invalid_assignment_type 1143
215#define invalid_block_type 1144
216#define invalid_comprehension_type 1145
217#define invalid_parameters_type 1146
218#define invalid_double_type_comments_type 1147
219#define _loop0_1_type 1148
220#define _loop0_2_type 1149
221#define _loop0_4_type 1150
222#define _gather_3_type 1151
223#define _loop0_6_type 1152
224#define _gather_5_type 1153
225#define _loop0_8_type 1154
226#define _gather_7_type 1155
227#define _loop0_10_type 1156
228#define _gather_9_type 1157
229#define _loop1_11_type 1158
230#define _loop0_13_type 1159
231#define _gather_12_type 1160
232#define _tmp_14_type 1161
233#define _tmp_15_type 1162
234#define _tmp_16_type 1163
235#define _tmp_17_type 1164
236#define _tmp_18_type 1165
237#define _tmp_19_type 1166
238#define _tmp_20_type 1167
239#define _tmp_21_type 1168
240#define _loop1_22_type 1169
241#define _tmp_23_type 1170
242#define _tmp_24_type 1171
243#define _loop0_26_type 1172
244#define _gather_25_type 1173
245#define _loop0_28_type 1174
246#define _gather_27_type 1175
247#define _tmp_29_type 1176
248#define _loop0_30_type 1177
249#define _loop1_31_type 1178
250#define _loop0_33_type 1179
251#define _gather_32_type 1180
252#define _tmp_34_type 1181
253#define _loop0_36_type 1182
254#define _gather_35_type 1183
255#define _tmp_37_type 1184
256#define _loop0_39_type 1185
257#define _gather_38_type 1186
258#define _loop0_41_type 1187
259#define _gather_40_type 1188
260#define _tmp_42_type 1189
261#define _loop1_43_type 1190
262#define _tmp_44_type 1191
263#define _tmp_45_type 1192
264#define _tmp_46_type 1193
265#define _tmp_47_type 1194
266#define _loop0_48_type 1195
267#define _loop0_49_type 1196
268#define _loop0_50_type 1197
269#define _loop1_51_type 1198
270#define _loop0_52_type 1199
271#define _loop1_53_type 1200
272#define _loop1_54_type 1201
273#define _loop1_55_type 1202
274#define _loop0_56_type 1203
275#define _loop1_57_type 1204
276#define _loop0_58_type 1205
277#define _loop1_59_type 1206
278#define _loop0_60_type 1207
279#define _loop1_61_type 1208
280#define _loop1_62_type 1209
281#define _tmp_63_type 1210
282#define _loop0_65_type 1211
283#define _gather_64_type 1212
284#define _loop1_66_type 1213
285#define _loop0_68_type 1214
286#define _gather_67_type 1215
287#define _loop1_69_type 1216
288#define _tmp_70_type 1217
289#define _tmp_71_type 1218
290#define _tmp_72_type 1219
291#define _tmp_73_type 1220
292#define _tmp_74_type 1221
293#define _tmp_75_type 1222
294#define _tmp_76_type 1223
295#define _tmp_77_type 1224
296#define _tmp_78_type 1225
297#define _loop0_79_type 1226
298#define _tmp_80_type 1227
299#define _loop1_81_type 1228
300#define _tmp_82_type 1229
301#define _tmp_83_type 1230
302#define _loop0_85_type 1231
303#define _gather_84_type 1232
304#define _loop0_87_type 1233
305#define _gather_86_type 1234
306#define _loop1_88_type 1235
307#define _loop1_89_type 1236
308#define _loop1_90_type 1237
309#define _tmp_91_type 1238
310#define _loop0_93_type 1239
311#define _gather_92_type 1240
312#define _tmp_94_type 1241
313#define _tmp_95_type 1242
314#define _tmp_96_type 1243
315#define _tmp_97_type 1244
316#define _loop1_98_type 1245
317#define _tmp_99_type 1246
318#define _tmp_100_type 1247
319#define _loop0_102_type 1248
320#define _gather_101_type 1249
321#define _loop1_103_type 1250
322#define _tmp_104_type 1251
323#define _tmp_105_type 1252
324#define _loop0_107_type 1253
325#define _gather_106_type 1254
326#define _loop0_109_type 1255
327#define _gather_108_type 1256
328#define _loop0_111_type 1257
329#define _gather_110_type 1258
330#define _loop0_113_type 1259
331#define _gather_112_type 1260
332#define _loop0_114_type 1261
333#define _loop0_116_type 1262
334#define _gather_115_type 1263
335#define _tmp_117_type 1264
336#define _loop0_119_type 1265
337#define _gather_118_type 1266
338#define _loop0_121_type 1267
339#define _gather_120_type 1268
340#define _tmp_122_type 1269
341#define _tmp_123_type 1270
342#define _tmp_124_type 1271
343#define _tmp_125_type 1272
344#define _tmp_126_type 1273
345#define _loop0_127_type 1274
346#define _tmp_128_type 1275
347#define _tmp_129_type 1276
348#define _tmp_130_type 1277
349#define _tmp_131_type 1278
350#define _tmp_132_type 1279
351#define _tmp_133_type 1280
352#define _tmp_134_type 1281
353#define _tmp_135_type 1282
354#define _tmp_136_type 1283
355#define _tmp_137_type 1284
356#define _tmp_138_type 1285
357#define _tmp_139_type 1286
358#define _loop1_140_type 1287
359#define _loop0_141_type 1288
360#define _tmp_142_type 1289
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100361
362static mod_ty file_rule(Parser *p);
363static mod_ty interactive_rule(Parser *p);
364static mod_ty eval_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700365static mod_ty func_type_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100366static expr_ty fstring_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700367static asdl_seq* type_expressions_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100368static asdl_seq* statements_rule(Parser *p);
369static asdl_seq* statement_rule(Parser *p);
370static asdl_seq* statement_newline_rule(Parser *p);
371static asdl_seq* simple_stmt_rule(Parser *p);
372static stmt_ty small_stmt_rule(Parser *p);
373static stmt_ty compound_stmt_rule(Parser *p);
374static void *assignment_rule(Parser *p);
375static AugOperator* augassign_rule(Parser *p);
376static stmt_ty global_stmt_rule(Parser *p);
377static stmt_ty nonlocal_stmt_rule(Parser *p);
378static stmt_ty yield_stmt_rule(Parser *p);
379static stmt_ty assert_stmt_rule(Parser *p);
380static stmt_ty del_stmt_rule(Parser *p);
381static stmt_ty import_stmt_rule(Parser *p);
382static stmt_ty import_name_rule(Parser *p);
383static stmt_ty import_from_rule(Parser *p);
384static asdl_seq* import_from_targets_rule(Parser *p);
385static asdl_seq* import_from_as_names_rule(Parser *p);
386static alias_ty import_from_as_name_rule(Parser *p);
387static asdl_seq* dotted_as_names_rule(Parser *p);
388static alias_ty dotted_as_name_rule(Parser *p);
389static expr_ty dotted_name_rule(Parser *p);
390static stmt_ty if_stmt_rule(Parser *p);
391static stmt_ty elif_stmt_rule(Parser *p);
392static asdl_seq* else_block_rule(Parser *p);
393static stmt_ty while_stmt_rule(Parser *p);
394static stmt_ty for_stmt_rule(Parser *p);
395static stmt_ty with_stmt_rule(Parser *p);
396static withitem_ty with_item_rule(Parser *p);
397static stmt_ty try_stmt_rule(Parser *p);
398static excepthandler_ty except_block_rule(Parser *p);
399static asdl_seq* finally_block_rule(Parser *p);
400static stmt_ty return_stmt_rule(Parser *p);
401static stmt_ty raise_stmt_rule(Parser *p);
402static stmt_ty function_def_rule(Parser *p);
403static stmt_ty function_def_raw_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700404static PyObject* func_type_comment_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100405static arguments_ty params_rule(Parser *p);
406static arguments_ty parameters_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700407static asdl_seq* slash_no_default_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100408static SlashWithDefault* slash_with_default_rule(Parser *p);
409static StarEtc* star_etc_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100410static arg_ty kwds_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700411static arg_ty param_no_default_rule(Parser *p);
412static NameDefaultPair* param_with_default_rule(Parser *p);
413static NameDefaultPair* param_maybe_default_rule(Parser *p);
414static arg_ty param_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100415static expr_ty annotation_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700416static expr_ty default_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100417static asdl_seq* decorators_rule(Parser *p);
418static stmt_ty class_def_rule(Parser *p);
419static stmt_ty class_def_raw_rule(Parser *p);
420static asdl_seq* block_rule(Parser *p);
421static asdl_seq* expressions_list_rule(Parser *p);
422static expr_ty star_expressions_rule(Parser *p);
423static expr_ty star_expression_rule(Parser *p);
424static asdl_seq* star_named_expressions_rule(Parser *p);
425static expr_ty star_named_expression_rule(Parser *p);
426static expr_ty named_expression_rule(Parser *p);
427static expr_ty annotated_rhs_rule(Parser *p);
428static expr_ty expressions_rule(Parser *p);
429static expr_ty expression_rule(Parser *p);
430static expr_ty lambdef_rule(Parser *p);
431static arguments_ty lambda_parameters_rule(Parser *p);
432static asdl_seq* lambda_slash_without_default_rule(Parser *p);
433static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
434static StarEtc* lambda_star_etc_rule(Parser *p);
435static NameDefaultPair* lambda_name_with_optional_default_rule(Parser *p);
436static asdl_seq* lambda_names_with_default_rule(Parser *p);
437static NameDefaultPair* lambda_name_with_default_rule(Parser *p);
438static asdl_seq* lambda_plain_names_rule(Parser *p);
439static arg_ty lambda_plain_name_rule(Parser *p);
440static arg_ty lambda_kwds_rule(Parser *p);
441static expr_ty disjunction_rule(Parser *p);
442static expr_ty conjunction_rule(Parser *p);
443static expr_ty inversion_rule(Parser *p);
444static expr_ty comparison_rule(Parser *p);
445static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
446static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
447static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
448static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
449static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
450static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
451static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
452static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
453static CmpopExprPair* in_bitwise_or_rule(Parser *p);
454static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
455static CmpopExprPair* is_bitwise_or_rule(Parser *p);
456static expr_ty bitwise_or_rule(Parser *p);
457static expr_ty bitwise_xor_rule(Parser *p);
458static expr_ty bitwise_and_rule(Parser *p);
459static expr_ty shift_expr_rule(Parser *p);
460static expr_ty sum_rule(Parser *p);
461static expr_ty term_rule(Parser *p);
462static expr_ty factor_rule(Parser *p);
463static expr_ty power_rule(Parser *p);
464static expr_ty await_primary_rule(Parser *p);
465static expr_ty primary_rule(Parser *p);
466static expr_ty slices_rule(Parser *p);
467static expr_ty slice_rule(Parser *p);
468static expr_ty atom_rule(Parser *p);
469static expr_ty strings_rule(Parser *p);
470static expr_ty list_rule(Parser *p);
471static expr_ty listcomp_rule(Parser *p);
472static expr_ty tuple_rule(Parser *p);
473static expr_ty group_rule(Parser *p);
474static expr_ty genexp_rule(Parser *p);
475static expr_ty set_rule(Parser *p);
476static expr_ty setcomp_rule(Parser *p);
477static expr_ty dict_rule(Parser *p);
478static expr_ty dictcomp_rule(Parser *p);
479static asdl_seq* kvpairs_rule(Parser *p);
480static KeyValuePair* kvpair_rule(Parser *p);
481static asdl_seq* for_if_clauses_rule(Parser *p);
482static expr_ty yield_expr_rule(Parser *p);
483static expr_ty arguments_rule(Parser *p);
484static expr_ty args_rule(Parser *p);
485static asdl_seq* kwargs_rule(Parser *p);
486static expr_ty starred_expression_rule(Parser *p);
487static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
488static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
489static expr_ty star_targets_rule(Parser *p);
490static asdl_seq* star_targets_seq_rule(Parser *p);
491static expr_ty star_target_rule(Parser *p);
492static expr_ty star_atom_rule(Parser *p);
493static expr_ty inside_paren_ann_assign_target_rule(Parser *p);
494static expr_ty ann_assign_subscript_attribute_target_rule(Parser *p);
495static asdl_seq* del_targets_rule(Parser *p);
496static expr_ty del_target_rule(Parser *p);
497static expr_ty del_t_atom_rule(Parser *p);
498static asdl_seq* targets_rule(Parser *p);
499static expr_ty target_rule(Parser *p);
500static expr_ty t_primary_rule(Parser *p);
501static void *t_lookahead_rule(Parser *p);
502static expr_ty t_atom_rule(Parser *p);
503static void *incorrect_arguments_rule(Parser *p);
504static void *invalid_named_expression_rule(Parser *p);
505static void *invalid_assignment_rule(Parser *p);
506static void *invalid_block_rule(Parser *p);
507static void *invalid_comprehension_rule(Parser *p);
508static void *invalid_parameters_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700509static void *invalid_double_type_comments_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100510static asdl_seq *_loop0_1_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700511static asdl_seq *_loop0_2_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100512static asdl_seq *_loop0_4_rule(Parser *p);
513static asdl_seq *_gather_3_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700514static asdl_seq *_loop0_6_rule(Parser *p);
515static asdl_seq *_gather_5_rule(Parser *p);
516static asdl_seq *_loop0_8_rule(Parser *p);
517static asdl_seq *_gather_7_rule(Parser *p);
518static asdl_seq *_loop0_10_rule(Parser *p);
519static asdl_seq *_gather_9_rule(Parser *p);
520static asdl_seq *_loop1_11_rule(Parser *p);
521static asdl_seq *_loop0_13_rule(Parser *p);
522static asdl_seq *_gather_12_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100523static void *_tmp_14_rule(Parser *p);
524static void *_tmp_15_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700525static void *_tmp_16_rule(Parser *p);
526static void *_tmp_17_rule(Parser *p);
527static void *_tmp_18_rule(Parser *p);
528static void *_tmp_19_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100529static void *_tmp_20_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700530static void *_tmp_21_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100531static asdl_seq *_loop1_22_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700532static void *_tmp_23_rule(Parser *p);
533static void *_tmp_24_rule(Parser *p);
534static asdl_seq *_loop0_26_rule(Parser *p);
535static asdl_seq *_gather_25_rule(Parser *p);
536static asdl_seq *_loop0_28_rule(Parser *p);
537static asdl_seq *_gather_27_rule(Parser *p);
538static void *_tmp_29_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100539static asdl_seq *_loop0_30_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700540static asdl_seq *_loop1_31_rule(Parser *p);
541static asdl_seq *_loop0_33_rule(Parser *p);
542static asdl_seq *_gather_32_rule(Parser *p);
543static void *_tmp_34_rule(Parser *p);
544static asdl_seq *_loop0_36_rule(Parser *p);
545static asdl_seq *_gather_35_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100546static void *_tmp_37_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700547static asdl_seq *_loop0_39_rule(Parser *p);
548static asdl_seq *_gather_38_rule(Parser *p);
549static asdl_seq *_loop0_41_rule(Parser *p);
550static asdl_seq *_gather_40_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100551static void *_tmp_42_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700552static asdl_seq *_loop1_43_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100553static void *_tmp_44_rule(Parser *p);
554static void *_tmp_45_rule(Parser *p);
555static void *_tmp_46_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700556static void *_tmp_47_rule(Parser *p);
557static asdl_seq *_loop0_48_rule(Parser *p);
558static asdl_seq *_loop0_49_rule(Parser *p);
559static asdl_seq *_loop0_50_rule(Parser *p);
560static asdl_seq *_loop1_51_rule(Parser *p);
561static asdl_seq *_loop0_52_rule(Parser *p);
562static asdl_seq *_loop1_53_rule(Parser *p);
563static asdl_seq *_loop1_54_rule(Parser *p);
564static asdl_seq *_loop1_55_rule(Parser *p);
565static asdl_seq *_loop0_56_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100566static asdl_seq *_loop1_57_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700567static asdl_seq *_loop0_58_rule(Parser *p);
568static asdl_seq *_loop1_59_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100569static asdl_seq *_loop0_60_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100570static asdl_seq *_loop1_61_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700571static asdl_seq *_loop1_62_rule(Parser *p);
572static void *_tmp_63_rule(Parser *p);
573static asdl_seq *_loop0_65_rule(Parser *p);
574static asdl_seq *_gather_64_rule(Parser *p);
575static asdl_seq *_loop1_66_rule(Parser *p);
576static asdl_seq *_loop0_68_rule(Parser *p);
577static asdl_seq *_gather_67_rule(Parser *p);
578static asdl_seq *_loop1_69_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100579static void *_tmp_70_rule(Parser *p);
580static void *_tmp_71_rule(Parser *p);
581static void *_tmp_72_rule(Parser *p);
582static void *_tmp_73_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700583static void *_tmp_74_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100584static void *_tmp_75_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700585static void *_tmp_76_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100586static void *_tmp_77_rule(Parser *p);
587static void *_tmp_78_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700588static asdl_seq *_loop0_79_rule(Parser *p);
589static void *_tmp_80_rule(Parser *p);
590static asdl_seq *_loop1_81_rule(Parser *p);
591static void *_tmp_82_rule(Parser *p);
592static void *_tmp_83_rule(Parser *p);
593static asdl_seq *_loop0_85_rule(Parser *p);
594static asdl_seq *_gather_84_rule(Parser *p);
595static asdl_seq *_loop0_87_rule(Parser *p);
596static asdl_seq *_gather_86_rule(Parser *p);
597static asdl_seq *_loop1_88_rule(Parser *p);
598static asdl_seq *_loop1_89_rule(Parser *p);
599static asdl_seq *_loop1_90_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100600static void *_tmp_91_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700601static asdl_seq *_loop0_93_rule(Parser *p);
602static asdl_seq *_gather_92_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100603static void *_tmp_94_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100604static void *_tmp_95_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700605static void *_tmp_96_rule(Parser *p);
606static void *_tmp_97_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100607static asdl_seq *_loop1_98_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100608static void *_tmp_99_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100609static void *_tmp_100_rule(Parser *p);
610static asdl_seq *_loop0_102_rule(Parser *p);
611static asdl_seq *_gather_101_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700612static asdl_seq *_loop1_103_rule(Parser *p);
613static void *_tmp_104_rule(Parser *p);
614static void *_tmp_105_rule(Parser *p);
615static asdl_seq *_loop0_107_rule(Parser *p);
616static asdl_seq *_gather_106_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100617static asdl_seq *_loop0_109_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700618static asdl_seq *_gather_108_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100619static asdl_seq *_loop0_111_rule(Parser *p);
620static asdl_seq *_gather_110_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700621static asdl_seq *_loop0_113_rule(Parser *p);
622static asdl_seq *_gather_112_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100623static asdl_seq *_loop0_114_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100624static asdl_seq *_loop0_116_rule(Parser *p);
625static asdl_seq *_gather_115_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100626static void *_tmp_117_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700627static asdl_seq *_loop0_119_rule(Parser *p);
628static asdl_seq *_gather_118_rule(Parser *p);
629static asdl_seq *_loop0_121_rule(Parser *p);
630static asdl_seq *_gather_120_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100631static void *_tmp_122_rule(Parser *p);
632static void *_tmp_123_rule(Parser *p);
633static void *_tmp_124_rule(Parser *p);
634static void *_tmp_125_rule(Parser *p);
635static void *_tmp_126_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700636static asdl_seq *_loop0_127_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100637static void *_tmp_128_rule(Parser *p);
638static void *_tmp_129_rule(Parser *p);
639static void *_tmp_130_rule(Parser *p);
640static void *_tmp_131_rule(Parser *p);
641static void *_tmp_132_rule(Parser *p);
642static void *_tmp_133_rule(Parser *p);
643static void *_tmp_134_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100644static void *_tmp_135_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700645static void *_tmp_136_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100646static void *_tmp_137_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700647static void *_tmp_138_rule(Parser *p);
648static void *_tmp_139_rule(Parser *p);
649static asdl_seq *_loop1_140_rule(Parser *p);
650static asdl_seq *_loop0_141_rule(Parser *p);
651static void *_tmp_142_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100652
653
654// file: statements? $
655static mod_ty
656file_rule(Parser *p)
657{
658 if (p->error_indicator) {
659 return NULL;
660 }
661 mod_ty res = NULL;
662 int mark = p->mark;
663 { // statements? $
664 void *a;
665 void *endmarker_var;
666 if (
667 (a = statements_rule(p), 1)
668 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +0100669 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100670 )
671 {
Guido van Rossumc001c092020-04-30 12:12:19 -0700672 res = _PyPegen_make_module ( p , a );
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100673 if (res == NULL && PyErr_Occurred()) {
674 p->error_indicator = 1;
675 return NULL;
676 }
677 goto done;
678 }
679 p->mark = mark;
680 }
681 res = NULL;
682 done:
683 return res;
684}
685
686// interactive: statement_newline
687static mod_ty
688interactive_rule(Parser *p)
689{
690 if (p->error_indicator) {
691 return NULL;
692 }
693 mod_ty res = NULL;
694 int mark = p->mark;
695 { // statement_newline
696 asdl_seq* a;
697 if (
698 (a = statement_newline_rule(p))
699 )
700 {
701 res = Interactive ( a , p -> arena );
702 if (res == NULL && PyErr_Occurred()) {
703 p->error_indicator = 1;
704 return NULL;
705 }
706 goto done;
707 }
708 p->mark = mark;
709 }
710 res = NULL;
711 done:
712 return res;
713}
714
715// eval: expressions NEWLINE* $
716static mod_ty
717eval_rule(Parser *p)
718{
719 if (p->error_indicator) {
720 return NULL;
721 }
722 mod_ty res = NULL;
723 int mark = p->mark;
724 { // expressions NEWLINE* $
725 asdl_seq * _loop0_1_var;
726 expr_ty a;
727 void *endmarker_var;
728 if (
729 (a = expressions_rule(p))
730 &&
731 (_loop0_1_var = _loop0_1_rule(p))
732 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +0100733 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100734 )
735 {
736 res = Expression ( a , p -> arena );
737 if (res == NULL && PyErr_Occurred()) {
738 p->error_indicator = 1;
739 return NULL;
740 }
741 goto done;
742 }
743 p->mark = mark;
744 }
745 res = NULL;
746 done:
747 return res;
748}
749
Guido van Rossumc001c092020-04-30 12:12:19 -0700750// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
751static mod_ty
752func_type_rule(Parser *p)
753{
754 if (p->error_indicator) {
755 return NULL;
756 }
757 mod_ty res = NULL;
758 int mark = p->mark;
759 { // '(' type_expressions? ')' '->' expression NEWLINE* $
760 asdl_seq * _loop0_2_var;
761 void *a;
762 expr_ty b;
763 void *endmarker_var;
764 void *literal;
765 void *literal_1;
766 void *literal_2;
767 if (
768 (literal = _PyPegen_expect_token(p, 7))
769 &&
770 (a = type_expressions_rule(p), 1)
771 &&
772 (literal_1 = _PyPegen_expect_token(p, 8))
773 &&
774 (literal_2 = _PyPegen_expect_token(p, 51))
775 &&
776 (b = expression_rule(p))
777 &&
778 (_loop0_2_var = _loop0_2_rule(p))
779 &&
780 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
781 )
782 {
783 res = FunctionType ( a , b , p -> arena );
784 if (res == NULL && PyErr_Occurred()) {
785 p->error_indicator = 1;
786 return NULL;
787 }
788 goto done;
789 }
790 p->mark = mark;
791 }
792 res = NULL;
793 done:
794 return res;
795}
796
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100797// fstring: star_expressions
798static expr_ty
799fstring_rule(Parser *p)
800{
801 if (p->error_indicator) {
802 return NULL;
803 }
804 expr_ty res = NULL;
805 int mark = p->mark;
806 { // star_expressions
807 expr_ty star_expressions_var;
808 if (
809 (star_expressions_var = star_expressions_rule(p))
810 )
811 {
812 res = star_expressions_var;
813 goto done;
814 }
815 p->mark = mark;
816 }
817 res = NULL;
818 done:
819 return res;
820}
821
Guido van Rossumc001c092020-04-30 12:12:19 -0700822// type_expressions:
823// | ','.expression+ ',' '*' expression ',' '**' expression
824// | ','.expression+ ',' '*' expression
825// | ','.expression+ ',' '**' expression
826// | ','.expression+
827static asdl_seq*
828type_expressions_rule(Parser *p)
829{
830 if (p->error_indicator) {
831 return NULL;
832 }
833 asdl_seq* res = NULL;
834 int mark = p->mark;
835 { // ','.expression+ ',' '*' expression ',' '**' expression
836 asdl_seq * a;
837 expr_ty b;
838 expr_ty c;
839 void *literal;
840 void *literal_1;
841 void *literal_2;
842 void *literal_3;
843 if (
844 (a = _gather_3_rule(p))
845 &&
846 (literal = _PyPegen_expect_token(p, 12))
847 &&
848 (literal_1 = _PyPegen_expect_token(p, 16))
849 &&
850 (b = expression_rule(p))
851 &&
852 (literal_2 = _PyPegen_expect_token(p, 12))
853 &&
854 (literal_3 = _PyPegen_expect_token(p, 35))
855 &&
856 (c = expression_rule(p))
857 )
858 {
859 res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
860 if (res == NULL && PyErr_Occurred()) {
861 p->error_indicator = 1;
862 return NULL;
863 }
864 goto done;
865 }
866 p->mark = mark;
867 }
868 { // ','.expression+ ',' '*' expression
869 asdl_seq * a;
870 expr_ty b;
871 void *literal;
872 void *literal_1;
873 if (
874 (a = _gather_5_rule(p))
875 &&
876 (literal = _PyPegen_expect_token(p, 12))
877 &&
878 (literal_1 = _PyPegen_expect_token(p, 16))
879 &&
880 (b = expression_rule(p))
881 )
882 {
883 res = _PyPegen_seq_append_to_end ( p , a , b );
884 if (res == NULL && PyErr_Occurred()) {
885 p->error_indicator = 1;
886 return NULL;
887 }
888 goto done;
889 }
890 p->mark = mark;
891 }
892 { // ','.expression+ ',' '**' expression
893 asdl_seq * a;
894 expr_ty b;
895 void *literal;
896 void *literal_1;
897 if (
898 (a = _gather_7_rule(p))
899 &&
900 (literal = _PyPegen_expect_token(p, 12))
901 &&
902 (literal_1 = _PyPegen_expect_token(p, 35))
903 &&
904 (b = expression_rule(p))
905 )
906 {
907 res = _PyPegen_seq_append_to_end ( p , a , b );
908 if (res == NULL && PyErr_Occurred()) {
909 p->error_indicator = 1;
910 return NULL;
911 }
912 goto done;
913 }
914 p->mark = mark;
915 }
916 { // ','.expression+
917 asdl_seq * _gather_9_var;
918 if (
919 (_gather_9_var = _gather_9_rule(p))
920 )
921 {
922 res = _gather_9_var;
923 goto done;
924 }
925 p->mark = mark;
926 }
927 res = NULL;
928 done:
929 return res;
930}
931
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100932// statements: statement+
933static asdl_seq*
934statements_rule(Parser *p)
935{
936 if (p->error_indicator) {
937 return NULL;
938 }
939 asdl_seq* res = NULL;
940 int mark = p->mark;
941 { // statement+
942 asdl_seq * a;
943 if (
Guido van Rossumc001c092020-04-30 12:12:19 -0700944 (a = _loop1_11_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100945 )
946 {
947 res = _PyPegen_seq_flatten ( p , a );
948 if (res == NULL && PyErr_Occurred()) {
949 p->error_indicator = 1;
950 return NULL;
951 }
952 goto done;
953 }
954 p->mark = mark;
955 }
956 res = NULL;
957 done:
958 return res;
959}
960
961// statement: compound_stmt | simple_stmt
962static asdl_seq*
963statement_rule(Parser *p)
964{
965 if (p->error_indicator) {
966 return NULL;
967 }
968 asdl_seq* res = NULL;
969 int mark = p->mark;
970 { // compound_stmt
971 stmt_ty a;
972 if (
973 (a = compound_stmt_rule(p))
974 )
975 {
976 res = _PyPegen_singleton_seq ( p , a );
977 if (res == NULL && PyErr_Occurred()) {
978 p->error_indicator = 1;
979 return NULL;
980 }
981 goto done;
982 }
983 p->mark = mark;
984 }
985 { // simple_stmt
986 asdl_seq* simple_stmt_var;
987 if (
988 (simple_stmt_var = simple_stmt_rule(p))
989 )
990 {
991 res = simple_stmt_var;
992 goto done;
993 }
994 p->mark = mark;
995 }
996 res = NULL;
997 done:
998 return res;
999}
1000
1001// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
1002static asdl_seq*
1003statement_newline_rule(Parser *p)
1004{
1005 if (p->error_indicator) {
1006 return NULL;
1007 }
1008 asdl_seq* res = NULL;
1009 int mark = p->mark;
1010 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1011 p->error_indicator = 1;
1012 return NULL;
1013 }
1014 int start_lineno = p->tokens[mark]->lineno;
1015 UNUSED(start_lineno); // Only used by EXTRA macro
1016 int start_col_offset = p->tokens[mark]->col_offset;
1017 UNUSED(start_col_offset); // Only used by EXTRA macro
1018 { // compound_stmt NEWLINE
1019 stmt_ty a;
1020 void *newline_var;
1021 if (
1022 (a = compound_stmt_rule(p))
1023 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01001024 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001025 )
1026 {
1027 res = _PyPegen_singleton_seq ( p , a );
1028 if (res == NULL && PyErr_Occurred()) {
1029 p->error_indicator = 1;
1030 return NULL;
1031 }
1032 goto done;
1033 }
1034 p->mark = mark;
1035 }
1036 { // simple_stmt
1037 asdl_seq* simple_stmt_var;
1038 if (
1039 (simple_stmt_var = simple_stmt_rule(p))
1040 )
1041 {
1042 res = simple_stmt_var;
1043 goto done;
1044 }
1045 p->mark = mark;
1046 }
1047 { // NEWLINE
1048 void *newline_var;
1049 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01001050 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001051 )
1052 {
1053 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1054 if (token == NULL) {
1055 return NULL;
1056 }
1057 int end_lineno = token->end_lineno;
1058 UNUSED(end_lineno); // Only used by EXTRA macro
1059 int end_col_offset = token->end_col_offset;
1060 UNUSED(end_col_offset); // Only used by EXTRA macro
1061 res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
1062 if (res == NULL && PyErr_Occurred()) {
1063 p->error_indicator = 1;
1064 return NULL;
1065 }
1066 goto done;
1067 }
1068 p->mark = mark;
1069 }
1070 { // $
1071 void *endmarker_var;
1072 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01001073 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001074 )
1075 {
1076 res = _PyPegen_interactive_exit ( p );
1077 if (res == NULL && PyErr_Occurred()) {
1078 p->error_indicator = 1;
1079 return NULL;
1080 }
1081 goto done;
1082 }
1083 p->mark = mark;
1084 }
1085 res = NULL;
1086 done:
1087 return res;
1088}
1089
1090// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
1091static asdl_seq*
1092simple_stmt_rule(Parser *p)
1093{
1094 if (p->error_indicator) {
1095 return NULL;
1096 }
1097 asdl_seq* res = NULL;
1098 int mark = p->mark;
1099 { // small_stmt !';' NEWLINE
1100 stmt_ty a;
1101 void *newline_var;
1102 if (
1103 (a = small_stmt_rule(p))
1104 &&
1105 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13)
1106 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01001107 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001108 )
1109 {
1110 res = _PyPegen_singleton_seq ( p , a );
1111 if (res == NULL && PyErr_Occurred()) {
1112 p->error_indicator = 1;
1113 return NULL;
1114 }
1115 goto done;
1116 }
1117 p->mark = mark;
1118 }
1119 { // ';'.small_stmt+ ';'? NEWLINE
1120 asdl_seq * a;
1121 void *newline_var;
1122 void *opt_var;
1123 UNUSED(opt_var); // Silence compiler warnings
1124 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001125 (a = _gather_12_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001126 &&
1127 (opt_var = _PyPegen_expect_token(p, 13), 1)
1128 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01001129 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001130 )
1131 {
1132 res = a;
1133 if (res == NULL && PyErr_Occurred()) {
1134 p->error_indicator = 1;
1135 return NULL;
1136 }
1137 goto done;
1138 }
1139 p->mark = mark;
1140 }
1141 res = NULL;
1142 done:
1143 return res;
1144}
1145
1146// small_stmt:
1147// | assignment
1148// | star_expressions
1149// | &'return' return_stmt
1150// | &('import' | 'from') import_stmt
1151// | &'raise' raise_stmt
1152// | 'pass'
1153// | &'del' del_stmt
1154// | &'yield' yield_stmt
1155// | &'assert' assert_stmt
1156// | 'break'
1157// | 'continue'
1158// | &'global' global_stmt
1159// | &'nonlocal' nonlocal_stmt
1160static stmt_ty
1161small_stmt_rule(Parser *p)
1162{
1163 if (p->error_indicator) {
1164 return NULL;
1165 }
1166 stmt_ty res = NULL;
1167 if (_PyPegen_is_memoized(p, small_stmt_type, &res))
1168 return res;
1169 int mark = p->mark;
1170 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1171 p->error_indicator = 1;
1172 return NULL;
1173 }
1174 int start_lineno = p->tokens[mark]->lineno;
1175 UNUSED(start_lineno); // Only used by EXTRA macro
1176 int start_col_offset = p->tokens[mark]->col_offset;
1177 UNUSED(start_col_offset); // Only used by EXTRA macro
1178 { // assignment
1179 void *assignment_var;
1180 if (
1181 (assignment_var = assignment_rule(p))
1182 )
1183 {
1184 res = assignment_var;
1185 goto done;
1186 }
1187 p->mark = mark;
1188 }
1189 { // star_expressions
1190 expr_ty e;
1191 if (
1192 (e = star_expressions_rule(p))
1193 )
1194 {
1195 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1196 if (token == NULL) {
1197 return NULL;
1198 }
1199 int end_lineno = token->end_lineno;
1200 UNUSED(end_lineno); // Only used by EXTRA macro
1201 int end_col_offset = token->end_col_offset;
1202 UNUSED(end_col_offset); // Only used by EXTRA macro
1203 res = _Py_Expr ( e , EXTRA );
1204 if (res == NULL && PyErr_Occurred()) {
1205 p->error_indicator = 1;
1206 return NULL;
1207 }
1208 goto done;
1209 }
1210 p->mark = mark;
1211 }
1212 { // &'return' return_stmt
1213 stmt_ty return_stmt_var;
1214 if (
1215 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500)
1216 &&
1217 (return_stmt_var = return_stmt_rule(p))
1218 )
1219 {
1220 res = return_stmt_var;
1221 goto done;
1222 }
1223 p->mark = mark;
1224 }
1225 { // &('import' | 'from') import_stmt
1226 stmt_ty import_stmt_var;
1227 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001228 _PyPegen_lookahead(1, _tmp_14_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001229 &&
1230 (import_stmt_var = import_stmt_rule(p))
1231 )
1232 {
1233 res = import_stmt_var;
1234 goto done;
1235 }
1236 p->mark = mark;
1237 }
1238 { // &'raise' raise_stmt
1239 stmt_ty raise_stmt_var;
1240 if (
1241 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501)
1242 &&
1243 (raise_stmt_var = raise_stmt_rule(p))
1244 )
1245 {
1246 res = raise_stmt_var;
1247 goto done;
1248 }
1249 p->mark = mark;
1250 }
1251 { // 'pass'
1252 void *keyword;
1253 if (
1254 (keyword = _PyPegen_expect_token(p, 502))
1255 )
1256 {
1257 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1258 if (token == NULL) {
1259 return NULL;
1260 }
1261 int end_lineno = token->end_lineno;
1262 UNUSED(end_lineno); // Only used by EXTRA macro
1263 int end_col_offset = token->end_col_offset;
1264 UNUSED(end_col_offset); // Only used by EXTRA macro
1265 res = _Py_Pass ( EXTRA );
1266 if (res == NULL && PyErr_Occurred()) {
1267 p->error_indicator = 1;
1268 return NULL;
1269 }
1270 goto done;
1271 }
1272 p->mark = mark;
1273 }
1274 { // &'del' del_stmt
1275 stmt_ty del_stmt_var;
1276 if (
1277 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503)
1278 &&
1279 (del_stmt_var = del_stmt_rule(p))
1280 )
1281 {
1282 res = del_stmt_var;
1283 goto done;
1284 }
1285 p->mark = mark;
1286 }
1287 { // &'yield' yield_stmt
1288 stmt_ty yield_stmt_var;
1289 if (
1290 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504)
1291 &&
1292 (yield_stmt_var = yield_stmt_rule(p))
1293 )
1294 {
1295 res = yield_stmt_var;
1296 goto done;
1297 }
1298 p->mark = mark;
1299 }
1300 { // &'assert' assert_stmt
1301 stmt_ty assert_stmt_var;
1302 if (
1303 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505)
1304 &&
1305 (assert_stmt_var = assert_stmt_rule(p))
1306 )
1307 {
1308 res = assert_stmt_var;
1309 goto done;
1310 }
1311 p->mark = mark;
1312 }
1313 { // 'break'
1314 void *keyword;
1315 if (
1316 (keyword = _PyPegen_expect_token(p, 506))
1317 )
1318 {
1319 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1320 if (token == NULL) {
1321 return NULL;
1322 }
1323 int end_lineno = token->end_lineno;
1324 UNUSED(end_lineno); // Only used by EXTRA macro
1325 int end_col_offset = token->end_col_offset;
1326 UNUSED(end_col_offset); // Only used by EXTRA macro
1327 res = _Py_Break ( EXTRA );
1328 if (res == NULL && PyErr_Occurred()) {
1329 p->error_indicator = 1;
1330 return NULL;
1331 }
1332 goto done;
1333 }
1334 p->mark = mark;
1335 }
1336 { // 'continue'
1337 void *keyword;
1338 if (
1339 (keyword = _PyPegen_expect_token(p, 507))
1340 )
1341 {
1342 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1343 if (token == NULL) {
1344 return NULL;
1345 }
1346 int end_lineno = token->end_lineno;
1347 UNUSED(end_lineno); // Only used by EXTRA macro
1348 int end_col_offset = token->end_col_offset;
1349 UNUSED(end_col_offset); // Only used by EXTRA macro
1350 res = _Py_Continue ( EXTRA );
1351 if (res == NULL && PyErr_Occurred()) {
1352 p->error_indicator = 1;
1353 return NULL;
1354 }
1355 goto done;
1356 }
1357 p->mark = mark;
1358 }
1359 { // &'global' global_stmt
1360 stmt_ty global_stmt_var;
1361 if (
1362 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508)
1363 &&
1364 (global_stmt_var = global_stmt_rule(p))
1365 )
1366 {
1367 res = global_stmt_var;
1368 goto done;
1369 }
1370 p->mark = mark;
1371 }
1372 { // &'nonlocal' nonlocal_stmt
1373 stmt_ty nonlocal_stmt_var;
1374 if (
1375 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509)
1376 &&
1377 (nonlocal_stmt_var = nonlocal_stmt_rule(p))
1378 )
1379 {
1380 res = nonlocal_stmt_var;
1381 goto done;
1382 }
1383 p->mark = mark;
1384 }
1385 res = NULL;
1386 done:
1387 _PyPegen_insert_memo(p, mark, small_stmt_type, res);
1388 return res;
1389}
1390
1391// compound_stmt:
1392// | &('def' | '@' | ASYNC) function_def
1393// | &'if' if_stmt
1394// | &('class' | '@') class_def
1395// | &('with' | ASYNC) with_stmt
1396// | &('for' | ASYNC) for_stmt
1397// | &'try' try_stmt
1398// | &'while' while_stmt
1399static stmt_ty
1400compound_stmt_rule(Parser *p)
1401{
1402 if (p->error_indicator) {
1403 return NULL;
1404 }
1405 stmt_ty res = NULL;
1406 int mark = p->mark;
1407 { // &('def' | '@' | ASYNC) function_def
1408 stmt_ty function_def_var;
1409 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001410 _PyPegen_lookahead(1, _tmp_15_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001411 &&
1412 (function_def_var = function_def_rule(p))
1413 )
1414 {
1415 res = function_def_var;
1416 goto done;
1417 }
1418 p->mark = mark;
1419 }
1420 { // &'if' if_stmt
1421 stmt_ty if_stmt_var;
1422 if (
1423 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510)
1424 &&
1425 (if_stmt_var = if_stmt_rule(p))
1426 )
1427 {
1428 res = if_stmt_var;
1429 goto done;
1430 }
1431 p->mark = mark;
1432 }
1433 { // &('class' | '@') class_def
1434 stmt_ty class_def_var;
1435 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001436 _PyPegen_lookahead(1, _tmp_16_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001437 &&
1438 (class_def_var = class_def_rule(p))
1439 )
1440 {
1441 res = class_def_var;
1442 goto done;
1443 }
1444 p->mark = mark;
1445 }
1446 { // &('with' | ASYNC) with_stmt
1447 stmt_ty with_stmt_var;
1448 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001449 _PyPegen_lookahead(1, _tmp_17_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001450 &&
1451 (with_stmt_var = with_stmt_rule(p))
1452 )
1453 {
1454 res = with_stmt_var;
1455 goto done;
1456 }
1457 p->mark = mark;
1458 }
1459 { // &('for' | ASYNC) for_stmt
1460 stmt_ty for_stmt_var;
1461 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001462 _PyPegen_lookahead(1, _tmp_18_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001463 &&
1464 (for_stmt_var = for_stmt_rule(p))
1465 )
1466 {
1467 res = for_stmt_var;
1468 goto done;
1469 }
1470 p->mark = mark;
1471 }
1472 { // &'try' try_stmt
1473 stmt_ty try_stmt_var;
1474 if (
1475 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511)
1476 &&
1477 (try_stmt_var = try_stmt_rule(p))
1478 )
1479 {
1480 res = try_stmt_var;
1481 goto done;
1482 }
1483 p->mark = mark;
1484 }
1485 { // &'while' while_stmt
1486 stmt_ty while_stmt_var;
1487 if (
1488 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512)
1489 &&
1490 (while_stmt_var = while_stmt_rule(p))
1491 )
1492 {
1493 res = while_stmt_var;
1494 goto done;
1495 }
1496 p->mark = mark;
1497 }
1498 res = NULL;
1499 done:
1500 return res;
1501}
1502
1503// assignment:
1504// | NAME ':' expression ['=' annotated_rhs]
1505// | ('(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target) ':' expression ['=' annotated_rhs]
Guido van Rossumc001c092020-04-30 12:12:19 -07001506// | ((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001507// | target augassign (yield_expr | star_expressions)
1508// | invalid_assignment
1509static void *
1510assignment_rule(Parser *p)
1511{
1512 if (p->error_indicator) {
1513 return NULL;
1514 }
1515 void * res = NULL;
1516 int mark = p->mark;
1517 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1518 p->error_indicator = 1;
1519 return NULL;
1520 }
1521 int start_lineno = p->tokens[mark]->lineno;
1522 UNUSED(start_lineno); // Only used by EXTRA macro
1523 int start_col_offset = p->tokens[mark]->col_offset;
1524 UNUSED(start_col_offset); // Only used by EXTRA macro
1525 { // NAME ':' expression ['=' annotated_rhs]
1526 expr_ty a;
1527 expr_ty b;
1528 void *c;
1529 void *literal;
1530 if (
1531 (a = _PyPegen_name_token(p))
1532 &&
1533 (literal = _PyPegen_expect_token(p, 11))
1534 &&
1535 (b = expression_rule(p))
1536 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001537 (c = _tmp_19_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001538 )
1539 {
1540 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1541 if (token == NULL) {
1542 return NULL;
1543 }
1544 int end_lineno = token->end_lineno;
1545 UNUSED(end_lineno); // Only used by EXTRA macro
1546 int end_col_offset = token->end_col_offset;
1547 UNUSED(end_col_offset); // Only used by EXTRA macro
1548 res = _Py_AnnAssign ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA );
1549 if (res == NULL && PyErr_Occurred()) {
1550 p->error_indicator = 1;
1551 return NULL;
1552 }
1553 goto done;
1554 }
1555 p->mark = mark;
1556 }
1557 { // ('(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target) ':' expression ['=' annotated_rhs]
1558 void *a;
1559 expr_ty b;
1560 void *c;
1561 void *literal;
1562 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001563 (a = _tmp_20_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001564 &&
1565 (literal = _PyPegen_expect_token(p, 11))
1566 &&
1567 (b = expression_rule(p))
1568 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001569 (c = _tmp_21_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001570 )
1571 {
1572 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1573 if (token == NULL) {
1574 return NULL;
1575 }
1576 int end_lineno = token->end_lineno;
1577 UNUSED(end_lineno); // Only used by EXTRA macro
1578 int end_col_offset = token->end_col_offset;
1579 UNUSED(end_col_offset); // Only used by EXTRA macro
1580 res = _Py_AnnAssign ( a , b , c , 0 , EXTRA );
1581 if (res == NULL && PyErr_Occurred()) {
1582 p->error_indicator = 1;
1583 return NULL;
1584 }
1585 goto done;
1586 }
1587 p->mark = mark;
1588 }
Guido van Rossumc001c092020-04-30 12:12:19 -07001589 { // ((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001590 asdl_seq * a;
1591 void *b;
Guido van Rossumc001c092020-04-30 12:12:19 -07001592 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001593 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001594 (a = _loop1_22_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001595 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001596 (b = _tmp_23_rule(p))
1597 &&
1598 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001599 )
1600 {
1601 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1602 if (token == NULL) {
1603 return NULL;
1604 }
1605 int end_lineno = token->end_lineno;
1606 UNUSED(end_lineno); // Only used by EXTRA macro
1607 int end_col_offset = token->end_col_offset;
1608 UNUSED(end_col_offset); // Only used by EXTRA macro
Guido van Rossumc001c092020-04-30 12:12:19 -07001609 res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001610 if (res == NULL && PyErr_Occurred()) {
1611 p->error_indicator = 1;
1612 return NULL;
1613 }
1614 goto done;
1615 }
1616 p->mark = mark;
1617 }
1618 { // target augassign (yield_expr | star_expressions)
1619 expr_ty a;
1620 AugOperator* b;
1621 void *c;
1622 if (
1623 (a = target_rule(p))
1624 &&
1625 (b = augassign_rule(p))
1626 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001627 (c = _tmp_24_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001628 )
1629 {
1630 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1631 if (token == NULL) {
1632 return NULL;
1633 }
1634 int end_lineno = token->end_lineno;
1635 UNUSED(end_lineno); // Only used by EXTRA macro
1636 int end_col_offset = token->end_col_offset;
1637 UNUSED(end_col_offset); // Only used by EXTRA macro
1638 res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
1639 if (res == NULL && PyErr_Occurred()) {
1640 p->error_indicator = 1;
1641 return NULL;
1642 }
1643 goto done;
1644 }
1645 p->mark = mark;
1646 }
1647 { // invalid_assignment
1648 void *invalid_assignment_var;
1649 if (
1650 (invalid_assignment_var = invalid_assignment_rule(p))
1651 )
1652 {
1653 res = invalid_assignment_var;
1654 goto done;
1655 }
1656 p->mark = mark;
1657 }
1658 res = NULL;
1659 done:
1660 return res;
1661}
1662
1663// augassign:
1664// | '+='
1665// | '-='
1666// | '*='
1667// | '@='
1668// | '/='
1669// | '%='
1670// | '&='
1671// | '|='
1672// | '^='
1673// | '<<='
1674// | '>>='
1675// | '**='
1676// | '//='
1677static AugOperator*
1678augassign_rule(Parser *p)
1679{
1680 if (p->error_indicator) {
1681 return NULL;
1682 }
1683 AugOperator* res = NULL;
1684 int mark = p->mark;
1685 { // '+='
1686 void *literal;
1687 if (
1688 (literal = _PyPegen_expect_token(p, 36))
1689 )
1690 {
1691 res = _PyPegen_augoperator ( p , Add );
1692 if (res == NULL && PyErr_Occurred()) {
1693 p->error_indicator = 1;
1694 return NULL;
1695 }
1696 goto done;
1697 }
1698 p->mark = mark;
1699 }
1700 { // '-='
1701 void *literal;
1702 if (
1703 (literal = _PyPegen_expect_token(p, 37))
1704 )
1705 {
1706 res = _PyPegen_augoperator ( p , Sub );
1707 if (res == NULL && PyErr_Occurred()) {
1708 p->error_indicator = 1;
1709 return NULL;
1710 }
1711 goto done;
1712 }
1713 p->mark = mark;
1714 }
1715 { // '*='
1716 void *literal;
1717 if (
1718 (literal = _PyPegen_expect_token(p, 38))
1719 )
1720 {
1721 res = _PyPegen_augoperator ( p , Mult );
1722 if (res == NULL && PyErr_Occurred()) {
1723 p->error_indicator = 1;
1724 return NULL;
1725 }
1726 goto done;
1727 }
1728 p->mark = mark;
1729 }
1730 { // '@='
1731 void *literal;
1732 if (
1733 (literal = _PyPegen_expect_token(p, 50))
1734 )
1735 {
1736 res = _PyPegen_augoperator ( p , MatMult );
1737 if (res == NULL && PyErr_Occurred()) {
1738 p->error_indicator = 1;
1739 return NULL;
1740 }
1741 goto done;
1742 }
1743 p->mark = mark;
1744 }
1745 { // '/='
1746 void *literal;
1747 if (
1748 (literal = _PyPegen_expect_token(p, 39))
1749 )
1750 {
1751 res = _PyPegen_augoperator ( p , Div );
1752 if (res == NULL && PyErr_Occurred()) {
1753 p->error_indicator = 1;
1754 return NULL;
1755 }
1756 goto done;
1757 }
1758 p->mark = mark;
1759 }
1760 { // '%='
1761 void *literal;
1762 if (
1763 (literal = _PyPegen_expect_token(p, 40))
1764 )
1765 {
1766 res = _PyPegen_augoperator ( p , Mod );
1767 if (res == NULL && PyErr_Occurred()) {
1768 p->error_indicator = 1;
1769 return NULL;
1770 }
1771 goto done;
1772 }
1773 p->mark = mark;
1774 }
1775 { // '&='
1776 void *literal;
1777 if (
1778 (literal = _PyPegen_expect_token(p, 41))
1779 )
1780 {
1781 res = _PyPegen_augoperator ( p , BitAnd );
1782 if (res == NULL && PyErr_Occurred()) {
1783 p->error_indicator = 1;
1784 return NULL;
1785 }
1786 goto done;
1787 }
1788 p->mark = mark;
1789 }
1790 { // '|='
1791 void *literal;
1792 if (
1793 (literal = _PyPegen_expect_token(p, 42))
1794 )
1795 {
1796 res = _PyPegen_augoperator ( p , BitOr );
1797 if (res == NULL && PyErr_Occurred()) {
1798 p->error_indicator = 1;
1799 return NULL;
1800 }
1801 goto done;
1802 }
1803 p->mark = mark;
1804 }
1805 { // '^='
1806 void *literal;
1807 if (
1808 (literal = _PyPegen_expect_token(p, 43))
1809 )
1810 {
1811 res = _PyPegen_augoperator ( p , BitXor );
1812 if (res == NULL && PyErr_Occurred()) {
1813 p->error_indicator = 1;
1814 return NULL;
1815 }
1816 goto done;
1817 }
1818 p->mark = mark;
1819 }
1820 { // '<<='
1821 void *literal;
1822 if (
1823 (literal = _PyPegen_expect_token(p, 44))
1824 )
1825 {
1826 res = _PyPegen_augoperator ( p , LShift );
1827 if (res == NULL && PyErr_Occurred()) {
1828 p->error_indicator = 1;
1829 return NULL;
1830 }
1831 goto done;
1832 }
1833 p->mark = mark;
1834 }
1835 { // '>>='
1836 void *literal;
1837 if (
1838 (literal = _PyPegen_expect_token(p, 45))
1839 )
1840 {
1841 res = _PyPegen_augoperator ( p , RShift );
1842 if (res == NULL && PyErr_Occurred()) {
1843 p->error_indicator = 1;
1844 return NULL;
1845 }
1846 goto done;
1847 }
1848 p->mark = mark;
1849 }
1850 { // '**='
1851 void *literal;
1852 if (
1853 (literal = _PyPegen_expect_token(p, 46))
1854 )
1855 {
1856 res = _PyPegen_augoperator ( p , Pow );
1857 if (res == NULL && PyErr_Occurred()) {
1858 p->error_indicator = 1;
1859 return NULL;
1860 }
1861 goto done;
1862 }
1863 p->mark = mark;
1864 }
1865 { // '//='
1866 void *literal;
1867 if (
1868 (literal = _PyPegen_expect_token(p, 48))
1869 )
1870 {
1871 res = _PyPegen_augoperator ( p , FloorDiv );
1872 if (res == NULL && PyErr_Occurred()) {
1873 p->error_indicator = 1;
1874 return NULL;
1875 }
1876 goto done;
1877 }
1878 p->mark = mark;
1879 }
1880 res = NULL;
1881 done:
1882 return res;
1883}
1884
1885// global_stmt: 'global' ','.NAME+
1886static stmt_ty
1887global_stmt_rule(Parser *p)
1888{
1889 if (p->error_indicator) {
1890 return NULL;
1891 }
1892 stmt_ty res = NULL;
1893 int mark = p->mark;
1894 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1895 p->error_indicator = 1;
1896 return NULL;
1897 }
1898 int start_lineno = p->tokens[mark]->lineno;
1899 UNUSED(start_lineno); // Only used by EXTRA macro
1900 int start_col_offset = p->tokens[mark]->col_offset;
1901 UNUSED(start_col_offset); // Only used by EXTRA macro
1902 { // 'global' ','.NAME+
1903 asdl_seq * a;
1904 void *keyword;
1905 if (
1906 (keyword = _PyPegen_expect_token(p, 508))
1907 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001908 (a = _gather_25_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001909 )
1910 {
1911 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1912 if (token == NULL) {
1913 return NULL;
1914 }
1915 int end_lineno = token->end_lineno;
1916 UNUSED(end_lineno); // Only used by EXTRA macro
1917 int end_col_offset = token->end_col_offset;
1918 UNUSED(end_col_offset); // Only used by EXTRA macro
1919 res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
1920 if (res == NULL && PyErr_Occurred()) {
1921 p->error_indicator = 1;
1922 return NULL;
1923 }
1924 goto done;
1925 }
1926 p->mark = mark;
1927 }
1928 res = NULL;
1929 done:
1930 return res;
1931}
1932
1933// nonlocal_stmt: 'nonlocal' ','.NAME+
1934static stmt_ty
1935nonlocal_stmt_rule(Parser *p)
1936{
1937 if (p->error_indicator) {
1938 return NULL;
1939 }
1940 stmt_ty res = NULL;
1941 int mark = p->mark;
1942 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1943 p->error_indicator = 1;
1944 return NULL;
1945 }
1946 int start_lineno = p->tokens[mark]->lineno;
1947 UNUSED(start_lineno); // Only used by EXTRA macro
1948 int start_col_offset = p->tokens[mark]->col_offset;
1949 UNUSED(start_col_offset); // Only used by EXTRA macro
1950 { // 'nonlocal' ','.NAME+
1951 asdl_seq * a;
1952 void *keyword;
1953 if (
1954 (keyword = _PyPegen_expect_token(p, 509))
1955 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001956 (a = _gather_27_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001957 )
1958 {
1959 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1960 if (token == NULL) {
1961 return NULL;
1962 }
1963 int end_lineno = token->end_lineno;
1964 UNUSED(end_lineno); // Only used by EXTRA macro
1965 int end_col_offset = token->end_col_offset;
1966 UNUSED(end_col_offset); // Only used by EXTRA macro
1967 res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
1968 if (res == NULL && PyErr_Occurred()) {
1969 p->error_indicator = 1;
1970 return NULL;
1971 }
1972 goto done;
1973 }
1974 p->mark = mark;
1975 }
1976 res = NULL;
1977 done:
1978 return res;
1979}
1980
1981// yield_stmt: yield_expr
1982static stmt_ty
1983yield_stmt_rule(Parser *p)
1984{
1985 if (p->error_indicator) {
1986 return NULL;
1987 }
1988 stmt_ty res = NULL;
1989 int mark = p->mark;
1990 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1991 p->error_indicator = 1;
1992 return NULL;
1993 }
1994 int start_lineno = p->tokens[mark]->lineno;
1995 UNUSED(start_lineno); // Only used by EXTRA macro
1996 int start_col_offset = p->tokens[mark]->col_offset;
1997 UNUSED(start_col_offset); // Only used by EXTRA macro
1998 { // yield_expr
1999 expr_ty y;
2000 if (
2001 (y = yield_expr_rule(p))
2002 )
2003 {
2004 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2005 if (token == NULL) {
2006 return NULL;
2007 }
2008 int end_lineno = token->end_lineno;
2009 UNUSED(end_lineno); // Only used by EXTRA macro
2010 int end_col_offset = token->end_col_offset;
2011 UNUSED(end_col_offset); // Only used by EXTRA macro
2012 res = _Py_Expr ( y , EXTRA );
2013 if (res == NULL && PyErr_Occurred()) {
2014 p->error_indicator = 1;
2015 return NULL;
2016 }
2017 goto done;
2018 }
2019 p->mark = mark;
2020 }
2021 res = NULL;
2022 done:
2023 return res;
2024}
2025
2026// assert_stmt: 'assert' expression [',' expression]
2027static stmt_ty
2028assert_stmt_rule(Parser *p)
2029{
2030 if (p->error_indicator) {
2031 return NULL;
2032 }
2033 stmt_ty res = NULL;
2034 int mark = p->mark;
2035 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2036 p->error_indicator = 1;
2037 return NULL;
2038 }
2039 int start_lineno = p->tokens[mark]->lineno;
2040 UNUSED(start_lineno); // Only used by EXTRA macro
2041 int start_col_offset = p->tokens[mark]->col_offset;
2042 UNUSED(start_col_offset); // Only used by EXTRA macro
2043 { // 'assert' expression [',' expression]
2044 expr_ty a;
2045 void *b;
2046 void *keyword;
2047 if (
2048 (keyword = _PyPegen_expect_token(p, 505))
2049 &&
2050 (a = expression_rule(p))
2051 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002052 (b = _tmp_29_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002053 )
2054 {
2055 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2056 if (token == NULL) {
2057 return NULL;
2058 }
2059 int end_lineno = token->end_lineno;
2060 UNUSED(end_lineno); // Only used by EXTRA macro
2061 int end_col_offset = token->end_col_offset;
2062 UNUSED(end_col_offset); // Only used by EXTRA macro
2063 res = _Py_Assert ( a , b , EXTRA );
2064 if (res == NULL && PyErr_Occurred()) {
2065 p->error_indicator = 1;
2066 return NULL;
2067 }
2068 goto done;
2069 }
2070 p->mark = mark;
2071 }
2072 res = NULL;
2073 done:
2074 return res;
2075}
2076
2077// del_stmt: 'del' del_targets
2078static stmt_ty
2079del_stmt_rule(Parser *p)
2080{
2081 if (p->error_indicator) {
2082 return NULL;
2083 }
2084 stmt_ty res = NULL;
2085 int mark = p->mark;
2086 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2087 p->error_indicator = 1;
2088 return NULL;
2089 }
2090 int start_lineno = p->tokens[mark]->lineno;
2091 UNUSED(start_lineno); // Only used by EXTRA macro
2092 int start_col_offset = p->tokens[mark]->col_offset;
2093 UNUSED(start_col_offset); // Only used by EXTRA macro
2094 { // 'del' del_targets
2095 asdl_seq* a;
2096 void *keyword;
2097 if (
2098 (keyword = _PyPegen_expect_token(p, 503))
2099 &&
2100 (a = del_targets_rule(p))
2101 )
2102 {
2103 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2104 if (token == NULL) {
2105 return NULL;
2106 }
2107 int end_lineno = token->end_lineno;
2108 UNUSED(end_lineno); // Only used by EXTRA macro
2109 int end_col_offset = token->end_col_offset;
2110 UNUSED(end_col_offset); // Only used by EXTRA macro
2111 res = _Py_Delete ( a , EXTRA );
2112 if (res == NULL && PyErr_Occurred()) {
2113 p->error_indicator = 1;
2114 return NULL;
2115 }
2116 goto done;
2117 }
2118 p->mark = mark;
2119 }
2120 res = NULL;
2121 done:
2122 return res;
2123}
2124
2125// import_stmt: import_name | import_from
2126static stmt_ty
2127import_stmt_rule(Parser *p)
2128{
2129 if (p->error_indicator) {
2130 return NULL;
2131 }
2132 stmt_ty res = NULL;
2133 int mark = p->mark;
2134 { // import_name
2135 stmt_ty import_name_var;
2136 if (
2137 (import_name_var = import_name_rule(p))
2138 )
2139 {
2140 res = import_name_var;
2141 goto done;
2142 }
2143 p->mark = mark;
2144 }
2145 { // import_from
2146 stmt_ty import_from_var;
2147 if (
2148 (import_from_var = import_from_rule(p))
2149 )
2150 {
2151 res = import_from_var;
2152 goto done;
2153 }
2154 p->mark = mark;
2155 }
2156 res = NULL;
2157 done:
2158 return res;
2159}
2160
2161// import_name: 'import' dotted_as_names
2162static stmt_ty
2163import_name_rule(Parser *p)
2164{
2165 if (p->error_indicator) {
2166 return NULL;
2167 }
2168 stmt_ty res = NULL;
2169 int mark = p->mark;
2170 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2171 p->error_indicator = 1;
2172 return NULL;
2173 }
2174 int start_lineno = p->tokens[mark]->lineno;
2175 UNUSED(start_lineno); // Only used by EXTRA macro
2176 int start_col_offset = p->tokens[mark]->col_offset;
2177 UNUSED(start_col_offset); // Only used by EXTRA macro
2178 { // 'import' dotted_as_names
2179 asdl_seq* a;
2180 void *keyword;
2181 if (
2182 (keyword = _PyPegen_expect_token(p, 513))
2183 &&
2184 (a = dotted_as_names_rule(p))
2185 )
2186 {
2187 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2188 if (token == NULL) {
2189 return NULL;
2190 }
2191 int end_lineno = token->end_lineno;
2192 UNUSED(end_lineno); // Only used by EXTRA macro
2193 int end_col_offset = token->end_col_offset;
2194 UNUSED(end_col_offset); // Only used by EXTRA macro
2195 res = _Py_Import ( a , EXTRA );
2196 if (res == NULL && PyErr_Occurred()) {
2197 p->error_indicator = 1;
2198 return NULL;
2199 }
2200 goto done;
2201 }
2202 p->mark = mark;
2203 }
2204 res = NULL;
2205 done:
2206 return res;
2207}
2208
2209// import_from:
2210// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
2211// | 'from' (('.' | '...'))+ 'import' import_from_targets
2212static stmt_ty
2213import_from_rule(Parser *p)
2214{
2215 if (p->error_indicator) {
2216 return NULL;
2217 }
2218 stmt_ty res = NULL;
2219 int mark = p->mark;
2220 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2221 p->error_indicator = 1;
2222 return NULL;
2223 }
2224 int start_lineno = p->tokens[mark]->lineno;
2225 UNUSED(start_lineno); // Only used by EXTRA macro
2226 int start_col_offset = p->tokens[mark]->col_offset;
2227 UNUSED(start_col_offset); // Only used by EXTRA macro
2228 { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
2229 asdl_seq * a;
2230 expr_ty b;
2231 asdl_seq* c;
2232 void *keyword;
2233 void *keyword_1;
2234 if (
2235 (keyword = _PyPegen_expect_token(p, 514))
2236 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002237 (a = _loop0_30_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002238 &&
2239 (b = dotted_name_rule(p))
2240 &&
2241 (keyword_1 = _PyPegen_expect_token(p, 513))
2242 &&
2243 (c = import_from_targets_rule(p))
2244 )
2245 {
2246 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2247 if (token == NULL) {
2248 return NULL;
2249 }
2250 int end_lineno = token->end_lineno;
2251 UNUSED(end_lineno); // Only used by EXTRA macro
2252 int end_col_offset = token->end_col_offset;
2253 UNUSED(end_col_offset); // Only used by EXTRA macro
2254 res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
2255 if (res == NULL && PyErr_Occurred()) {
2256 p->error_indicator = 1;
2257 return NULL;
2258 }
2259 goto done;
2260 }
2261 p->mark = mark;
2262 }
2263 { // 'from' (('.' | '...'))+ 'import' import_from_targets
2264 asdl_seq * a;
2265 asdl_seq* b;
2266 void *keyword;
2267 void *keyword_1;
2268 if (
2269 (keyword = _PyPegen_expect_token(p, 514))
2270 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002271 (a = _loop1_31_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002272 &&
2273 (keyword_1 = _PyPegen_expect_token(p, 513))
2274 &&
2275 (b = import_from_targets_rule(p))
2276 )
2277 {
2278 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2279 if (token == NULL) {
2280 return NULL;
2281 }
2282 int end_lineno = token->end_lineno;
2283 UNUSED(end_lineno); // Only used by EXTRA macro
2284 int end_col_offset = token->end_col_offset;
2285 UNUSED(end_col_offset); // Only used by EXTRA macro
2286 res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
2287 if (res == NULL && PyErr_Occurred()) {
2288 p->error_indicator = 1;
2289 return NULL;
2290 }
2291 goto done;
2292 }
2293 p->mark = mark;
2294 }
2295 res = NULL;
2296 done:
2297 return res;
2298}
2299
2300// import_from_targets: '(' import_from_as_names ','? ')' | import_from_as_names | '*'
2301static asdl_seq*
2302import_from_targets_rule(Parser *p)
2303{
2304 if (p->error_indicator) {
2305 return NULL;
2306 }
2307 asdl_seq* res = NULL;
2308 int mark = p->mark;
2309 { // '(' import_from_as_names ','? ')'
2310 asdl_seq* a;
2311 void *literal;
2312 void *literal_1;
2313 void *opt_var;
2314 UNUSED(opt_var); // Silence compiler warnings
2315 if (
2316 (literal = _PyPegen_expect_token(p, 7))
2317 &&
2318 (a = import_from_as_names_rule(p))
2319 &&
2320 (opt_var = _PyPegen_expect_token(p, 12), 1)
2321 &&
2322 (literal_1 = _PyPegen_expect_token(p, 8))
2323 )
2324 {
2325 res = a;
2326 if (res == NULL && PyErr_Occurred()) {
2327 p->error_indicator = 1;
2328 return NULL;
2329 }
2330 goto done;
2331 }
2332 p->mark = mark;
2333 }
2334 { // import_from_as_names
2335 asdl_seq* import_from_as_names_var;
2336 if (
2337 (import_from_as_names_var = import_from_as_names_rule(p))
2338 )
2339 {
2340 res = import_from_as_names_var;
2341 goto done;
2342 }
2343 p->mark = mark;
2344 }
2345 { // '*'
2346 void *literal;
2347 if (
2348 (literal = _PyPegen_expect_token(p, 16))
2349 )
2350 {
2351 res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
2352 if (res == NULL && PyErr_Occurred()) {
2353 p->error_indicator = 1;
2354 return NULL;
2355 }
2356 goto done;
2357 }
2358 p->mark = mark;
2359 }
2360 res = NULL;
2361 done:
2362 return res;
2363}
2364
2365// import_from_as_names: ','.import_from_as_name+
2366static asdl_seq*
2367import_from_as_names_rule(Parser *p)
2368{
2369 if (p->error_indicator) {
2370 return NULL;
2371 }
2372 asdl_seq* res = NULL;
2373 int mark = p->mark;
2374 { // ','.import_from_as_name+
2375 asdl_seq * a;
2376 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07002377 (a = _gather_32_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002378 )
2379 {
2380 res = a;
2381 if (res == NULL && PyErr_Occurred()) {
2382 p->error_indicator = 1;
2383 return NULL;
2384 }
2385 goto done;
2386 }
2387 p->mark = mark;
2388 }
2389 res = NULL;
2390 done:
2391 return res;
2392}
2393
2394// import_from_as_name: NAME ['as' NAME]
2395static alias_ty
2396import_from_as_name_rule(Parser *p)
2397{
2398 if (p->error_indicator) {
2399 return NULL;
2400 }
2401 alias_ty res = NULL;
2402 int mark = p->mark;
2403 { // NAME ['as' NAME]
2404 expr_ty a;
2405 void *b;
2406 if (
2407 (a = _PyPegen_name_token(p))
2408 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002409 (b = _tmp_34_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002410 )
2411 {
2412 res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
2413 if (res == NULL && PyErr_Occurred()) {
2414 p->error_indicator = 1;
2415 return NULL;
2416 }
2417 goto done;
2418 }
2419 p->mark = mark;
2420 }
2421 res = NULL;
2422 done:
2423 return res;
2424}
2425
2426// dotted_as_names: ','.dotted_as_name+
2427static asdl_seq*
2428dotted_as_names_rule(Parser *p)
2429{
2430 if (p->error_indicator) {
2431 return NULL;
2432 }
2433 asdl_seq* res = NULL;
2434 int mark = p->mark;
2435 { // ','.dotted_as_name+
2436 asdl_seq * a;
2437 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07002438 (a = _gather_35_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002439 )
2440 {
2441 res = a;
2442 if (res == NULL && PyErr_Occurred()) {
2443 p->error_indicator = 1;
2444 return NULL;
2445 }
2446 goto done;
2447 }
2448 p->mark = mark;
2449 }
2450 res = NULL;
2451 done:
2452 return res;
2453}
2454
2455// dotted_as_name: dotted_name ['as' NAME]
2456static alias_ty
2457dotted_as_name_rule(Parser *p)
2458{
2459 if (p->error_indicator) {
2460 return NULL;
2461 }
2462 alias_ty res = NULL;
2463 int mark = p->mark;
2464 { // dotted_name ['as' NAME]
2465 expr_ty a;
2466 void *b;
2467 if (
2468 (a = dotted_name_rule(p))
2469 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002470 (b = _tmp_37_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002471 )
2472 {
2473 res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
2474 if (res == NULL && PyErr_Occurred()) {
2475 p->error_indicator = 1;
2476 return NULL;
2477 }
2478 goto done;
2479 }
2480 p->mark = mark;
2481 }
2482 res = NULL;
2483 done:
2484 return res;
2485}
2486
2487// Left-recursive
2488// dotted_name: dotted_name '.' NAME | NAME
2489static expr_ty dotted_name_raw(Parser *);
2490static expr_ty
2491dotted_name_rule(Parser *p)
2492{
2493 expr_ty res = NULL;
2494 if (_PyPegen_is_memoized(p, dotted_name_type, &res))
2495 return res;
2496 int mark = p->mark;
2497 int resmark = p->mark;
2498 while (1) {
2499 int tmpvar_0 = _PyPegen_update_memo(p, mark, dotted_name_type, res);
2500 if (tmpvar_0) {
2501 return res;
2502 }
2503 p->mark = mark;
2504 void *raw = dotted_name_raw(p);
2505 if (raw == NULL || p->mark <= resmark)
2506 break;
2507 resmark = p->mark;
2508 res = raw;
2509 }
2510 p->mark = resmark;
2511 return res;
2512}
2513static expr_ty
2514dotted_name_raw(Parser *p)
2515{
2516 if (p->error_indicator) {
2517 return NULL;
2518 }
2519 expr_ty res = NULL;
2520 int mark = p->mark;
2521 { // dotted_name '.' NAME
2522 expr_ty a;
2523 expr_ty b;
2524 void *literal;
2525 if (
2526 (a = dotted_name_rule(p))
2527 &&
2528 (literal = _PyPegen_expect_token(p, 23))
2529 &&
2530 (b = _PyPegen_name_token(p))
2531 )
2532 {
2533 res = _PyPegen_join_names_with_dot ( p , a , b );
2534 if (res == NULL && PyErr_Occurred()) {
2535 p->error_indicator = 1;
2536 return NULL;
2537 }
2538 goto done;
2539 }
2540 p->mark = mark;
2541 }
2542 { // NAME
2543 expr_ty name_var;
2544 if (
2545 (name_var = _PyPegen_name_token(p))
2546 )
2547 {
2548 res = name_var;
2549 goto done;
2550 }
2551 p->mark = mark;
2552 }
2553 res = NULL;
2554 done:
2555 return res;
2556}
2557
2558// if_stmt:
2559// | 'if' named_expression ':' block elif_stmt
2560// | 'if' named_expression ':' block else_block?
2561static stmt_ty
2562if_stmt_rule(Parser *p)
2563{
2564 if (p->error_indicator) {
2565 return NULL;
2566 }
2567 stmt_ty res = NULL;
2568 int mark = p->mark;
2569 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2570 p->error_indicator = 1;
2571 return NULL;
2572 }
2573 int start_lineno = p->tokens[mark]->lineno;
2574 UNUSED(start_lineno); // Only used by EXTRA macro
2575 int start_col_offset = p->tokens[mark]->col_offset;
2576 UNUSED(start_col_offset); // Only used by EXTRA macro
2577 { // 'if' named_expression ':' block elif_stmt
2578 expr_ty a;
2579 asdl_seq* b;
2580 stmt_ty c;
2581 void *keyword;
2582 void *literal;
2583 if (
2584 (keyword = _PyPegen_expect_token(p, 510))
2585 &&
2586 (a = named_expression_rule(p))
2587 &&
2588 (literal = _PyPegen_expect_token(p, 11))
2589 &&
2590 (b = block_rule(p))
2591 &&
2592 (c = elif_stmt_rule(p))
2593 )
2594 {
2595 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2596 if (token == NULL) {
2597 return NULL;
2598 }
2599 int end_lineno = token->end_lineno;
2600 UNUSED(end_lineno); // Only used by EXTRA macro
2601 int end_col_offset = token->end_col_offset;
2602 UNUSED(end_col_offset); // Only used by EXTRA macro
2603 res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
2604 if (res == NULL && PyErr_Occurred()) {
2605 p->error_indicator = 1;
2606 return NULL;
2607 }
2608 goto done;
2609 }
2610 p->mark = mark;
2611 }
2612 { // 'if' named_expression ':' block else_block?
2613 expr_ty a;
2614 asdl_seq* b;
2615 void *c;
2616 void *keyword;
2617 void *literal;
2618 if (
2619 (keyword = _PyPegen_expect_token(p, 510))
2620 &&
2621 (a = named_expression_rule(p))
2622 &&
2623 (literal = _PyPegen_expect_token(p, 11))
2624 &&
2625 (b = block_rule(p))
2626 &&
2627 (c = else_block_rule(p), 1)
2628 )
2629 {
2630 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2631 if (token == NULL) {
2632 return NULL;
2633 }
2634 int end_lineno = token->end_lineno;
2635 UNUSED(end_lineno); // Only used by EXTRA macro
2636 int end_col_offset = token->end_col_offset;
2637 UNUSED(end_col_offset); // Only used by EXTRA macro
2638 res = _Py_If ( a , b , c , EXTRA );
2639 if (res == NULL && PyErr_Occurred()) {
2640 p->error_indicator = 1;
2641 return NULL;
2642 }
2643 goto done;
2644 }
2645 p->mark = mark;
2646 }
2647 res = NULL;
2648 done:
2649 return res;
2650}
2651
2652// elif_stmt:
2653// | 'elif' named_expression ':' block elif_stmt
2654// | 'elif' named_expression ':' block else_block?
2655static stmt_ty
2656elif_stmt_rule(Parser *p)
2657{
2658 if (p->error_indicator) {
2659 return NULL;
2660 }
2661 stmt_ty res = NULL;
2662 int mark = p->mark;
2663 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2664 p->error_indicator = 1;
2665 return NULL;
2666 }
2667 int start_lineno = p->tokens[mark]->lineno;
2668 UNUSED(start_lineno); // Only used by EXTRA macro
2669 int start_col_offset = p->tokens[mark]->col_offset;
2670 UNUSED(start_col_offset); // Only used by EXTRA macro
2671 { // 'elif' named_expression ':' block elif_stmt
2672 expr_ty a;
2673 asdl_seq* b;
2674 stmt_ty c;
2675 void *keyword;
2676 void *literal;
2677 if (
2678 (keyword = _PyPegen_expect_token(p, 515))
2679 &&
2680 (a = named_expression_rule(p))
2681 &&
2682 (literal = _PyPegen_expect_token(p, 11))
2683 &&
2684 (b = block_rule(p))
2685 &&
2686 (c = elif_stmt_rule(p))
2687 )
2688 {
2689 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2690 if (token == NULL) {
2691 return NULL;
2692 }
2693 int end_lineno = token->end_lineno;
2694 UNUSED(end_lineno); // Only used by EXTRA macro
2695 int end_col_offset = token->end_col_offset;
2696 UNUSED(end_col_offset); // Only used by EXTRA macro
2697 res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
2698 if (res == NULL && PyErr_Occurred()) {
2699 p->error_indicator = 1;
2700 return NULL;
2701 }
2702 goto done;
2703 }
2704 p->mark = mark;
2705 }
2706 { // 'elif' named_expression ':' block else_block?
2707 expr_ty a;
2708 asdl_seq* b;
2709 void *c;
2710 void *keyword;
2711 void *literal;
2712 if (
2713 (keyword = _PyPegen_expect_token(p, 515))
2714 &&
2715 (a = named_expression_rule(p))
2716 &&
2717 (literal = _PyPegen_expect_token(p, 11))
2718 &&
2719 (b = block_rule(p))
2720 &&
2721 (c = else_block_rule(p), 1)
2722 )
2723 {
2724 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2725 if (token == NULL) {
2726 return NULL;
2727 }
2728 int end_lineno = token->end_lineno;
2729 UNUSED(end_lineno); // Only used by EXTRA macro
2730 int end_col_offset = token->end_col_offset;
2731 UNUSED(end_col_offset); // Only used by EXTRA macro
2732 res = _Py_If ( a , b , c , EXTRA );
2733 if (res == NULL && PyErr_Occurred()) {
2734 p->error_indicator = 1;
2735 return NULL;
2736 }
2737 goto done;
2738 }
2739 p->mark = mark;
2740 }
2741 res = NULL;
2742 done:
2743 return res;
2744}
2745
2746// else_block: 'else' ':' block
2747static asdl_seq*
2748else_block_rule(Parser *p)
2749{
2750 if (p->error_indicator) {
2751 return NULL;
2752 }
2753 asdl_seq* res = NULL;
2754 int mark = p->mark;
2755 { // 'else' ':' block
2756 asdl_seq* b;
2757 void *keyword;
2758 void *literal;
2759 if (
2760 (keyword = _PyPegen_expect_token(p, 516))
2761 &&
2762 (literal = _PyPegen_expect_token(p, 11))
2763 &&
2764 (b = block_rule(p))
2765 )
2766 {
2767 res = b;
2768 if (res == NULL && PyErr_Occurred()) {
2769 p->error_indicator = 1;
2770 return NULL;
2771 }
2772 goto done;
2773 }
2774 p->mark = mark;
2775 }
2776 res = NULL;
2777 done:
2778 return res;
2779}
2780
2781// while_stmt: 'while' named_expression ':' block else_block?
2782static stmt_ty
2783while_stmt_rule(Parser *p)
2784{
2785 if (p->error_indicator) {
2786 return NULL;
2787 }
2788 stmt_ty res = NULL;
2789 int mark = p->mark;
2790 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2791 p->error_indicator = 1;
2792 return NULL;
2793 }
2794 int start_lineno = p->tokens[mark]->lineno;
2795 UNUSED(start_lineno); // Only used by EXTRA macro
2796 int start_col_offset = p->tokens[mark]->col_offset;
2797 UNUSED(start_col_offset); // Only used by EXTRA macro
2798 { // 'while' named_expression ':' block else_block?
2799 expr_ty a;
2800 asdl_seq* b;
2801 void *c;
2802 void *keyword;
2803 void *literal;
2804 if (
2805 (keyword = _PyPegen_expect_token(p, 512))
2806 &&
2807 (a = named_expression_rule(p))
2808 &&
2809 (literal = _PyPegen_expect_token(p, 11))
2810 &&
2811 (b = block_rule(p))
2812 &&
2813 (c = else_block_rule(p), 1)
2814 )
2815 {
2816 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2817 if (token == NULL) {
2818 return NULL;
2819 }
2820 int end_lineno = token->end_lineno;
2821 UNUSED(end_lineno); // Only used by EXTRA macro
2822 int end_col_offset = token->end_col_offset;
2823 UNUSED(end_col_offset); // Only used by EXTRA macro
2824 res = _Py_While ( a , b , c , EXTRA );
2825 if (res == NULL && PyErr_Occurred()) {
2826 p->error_indicator = 1;
2827 return NULL;
2828 }
2829 goto done;
2830 }
2831 p->mark = mark;
2832 }
2833 res = NULL;
2834 done:
2835 return res;
2836}
2837
Guido van Rossumc001c092020-04-30 12:12:19 -07002838// for_stmt:
2839// | ASYNC? 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002840static stmt_ty
2841for_stmt_rule(Parser *p)
2842{
2843 if (p->error_indicator) {
2844 return NULL;
2845 }
2846 stmt_ty res = NULL;
2847 int mark = p->mark;
2848 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2849 p->error_indicator = 1;
2850 return NULL;
2851 }
2852 int start_lineno = p->tokens[mark]->lineno;
2853 UNUSED(start_lineno); // Only used by EXTRA macro
2854 int start_col_offset = p->tokens[mark]->col_offset;
2855 UNUSED(start_col_offset); // Only used by EXTRA macro
Guido van Rossumc001c092020-04-30 12:12:19 -07002856 { // ASYNC? 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002857 asdl_seq* b;
2858 void *el;
2859 expr_ty ex;
2860 void *is_async;
2861 void *keyword;
2862 void *keyword_1;
2863 void *literal;
2864 expr_ty t;
Guido van Rossumc001c092020-04-30 12:12:19 -07002865 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002866 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01002867 (is_async = _PyPegen_expect_token(p, ASYNC), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002868 &&
2869 (keyword = _PyPegen_expect_token(p, 517))
2870 &&
2871 (t = star_targets_rule(p))
2872 &&
2873 (keyword_1 = _PyPegen_expect_token(p, 518))
2874 &&
2875 (ex = star_expressions_rule(p))
2876 &&
2877 (literal = _PyPegen_expect_token(p, 11))
2878 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002879 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
2880 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002881 (b = block_rule(p))
2882 &&
2883 (el = else_block_rule(p), 1)
2884 )
2885 {
2886 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2887 if (token == NULL) {
2888 return NULL;
2889 }
2890 int end_lineno = token->end_lineno;
2891 UNUSED(end_lineno); // Only used by EXTRA macro
2892 int end_col_offset = token->end_col_offset;
2893 UNUSED(end_col_offset); // Only used by EXTRA macro
Guido van Rossumc001c092020-04-30 12:12:19 -07002894 res = ( is_async ? _Py_AsyncFor : _Py_For ) ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002895 if (res == NULL && PyErr_Occurred()) {
2896 p->error_indicator = 1;
2897 return NULL;
2898 }
2899 goto done;
2900 }
2901 p->mark = mark;
2902 }
2903 res = NULL;
2904 done:
2905 return res;
2906}
2907
2908// with_stmt:
2909// | ASYNC? 'with' '(' ','.with_item+ ')' ':' block
Guido van Rossumc001c092020-04-30 12:12:19 -07002910// | ASYNC? 'with' ','.with_item+ ':' TYPE_COMMENT? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002911static stmt_ty
2912with_stmt_rule(Parser *p)
2913{
2914 if (p->error_indicator) {
2915 return NULL;
2916 }
2917 stmt_ty res = NULL;
2918 int mark = p->mark;
2919 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2920 p->error_indicator = 1;
2921 return NULL;
2922 }
2923 int start_lineno = p->tokens[mark]->lineno;
2924 UNUSED(start_lineno); // Only used by EXTRA macro
2925 int start_col_offset = p->tokens[mark]->col_offset;
2926 UNUSED(start_col_offset); // Only used by EXTRA macro
2927 { // ASYNC? 'with' '(' ','.with_item+ ')' ':' block
2928 asdl_seq * a;
2929 asdl_seq* b;
2930 void *is_async;
2931 void *keyword;
2932 void *literal;
2933 void *literal_1;
2934 void *literal_2;
2935 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01002936 (is_async = _PyPegen_expect_token(p, ASYNC), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002937 &&
2938 (keyword = _PyPegen_expect_token(p, 519))
2939 &&
2940 (literal = _PyPegen_expect_token(p, 7))
2941 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002942 (a = _gather_38_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002943 &&
2944 (literal_1 = _PyPegen_expect_token(p, 8))
2945 &&
2946 (literal_2 = _PyPegen_expect_token(p, 11))
2947 &&
2948 (b = block_rule(p))
2949 )
2950 {
2951 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2952 if (token == NULL) {
2953 return NULL;
2954 }
2955 int end_lineno = token->end_lineno;
2956 UNUSED(end_lineno); // Only used by EXTRA macro
2957 int end_col_offset = token->end_col_offset;
2958 UNUSED(end_col_offset); // Only used by EXTRA macro
2959 res = ( is_async ? _Py_AsyncWith : _Py_With ) ( a , b , NULL , EXTRA );
2960 if (res == NULL && PyErr_Occurred()) {
2961 p->error_indicator = 1;
2962 return NULL;
2963 }
2964 goto done;
2965 }
2966 p->mark = mark;
2967 }
Guido van Rossumc001c092020-04-30 12:12:19 -07002968 { // ASYNC? 'with' ','.with_item+ ':' TYPE_COMMENT? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002969 asdl_seq * a;
2970 asdl_seq* b;
2971 void *is_async;
2972 void *keyword;
2973 void *literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07002974 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002975 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01002976 (is_async = _PyPegen_expect_token(p, ASYNC), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002977 &&
2978 (keyword = _PyPegen_expect_token(p, 519))
2979 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002980 (a = _gather_40_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002981 &&
2982 (literal = _PyPegen_expect_token(p, 11))
2983 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002984 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
2985 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002986 (b = block_rule(p))
2987 )
2988 {
2989 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2990 if (token == NULL) {
2991 return NULL;
2992 }
2993 int end_lineno = token->end_lineno;
2994 UNUSED(end_lineno); // Only used by EXTRA macro
2995 int end_col_offset = token->end_col_offset;
2996 UNUSED(end_col_offset); // Only used by EXTRA macro
Guido van Rossumc001c092020-04-30 12:12:19 -07002997 res = ( is_async ? _Py_AsyncWith : _Py_With ) ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002998 if (res == NULL && PyErr_Occurred()) {
2999 p->error_indicator = 1;
3000 return NULL;
3001 }
3002 goto done;
3003 }
3004 p->mark = mark;
3005 }
3006 res = NULL;
3007 done:
3008 return res;
3009}
3010
3011// with_item: expression ['as' target]
3012static withitem_ty
3013with_item_rule(Parser *p)
3014{
3015 if (p->error_indicator) {
3016 return NULL;
3017 }
3018 withitem_ty res = NULL;
3019 int mark = p->mark;
3020 { // expression ['as' target]
3021 expr_ty e;
3022 void *o;
3023 if (
3024 (e = expression_rule(p))
3025 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003026 (o = _tmp_42_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003027 )
3028 {
3029 res = _Py_withitem ( e , o , p -> arena );
3030 if (res == NULL && PyErr_Occurred()) {
3031 p->error_indicator = 1;
3032 return NULL;
3033 }
3034 goto done;
3035 }
3036 p->mark = mark;
3037 }
3038 res = NULL;
3039 done:
3040 return res;
3041}
3042
3043// try_stmt:
3044// | 'try' ':' block finally_block
3045// | 'try' ':' block except_block+ else_block? finally_block?
3046static stmt_ty
3047try_stmt_rule(Parser *p)
3048{
3049 if (p->error_indicator) {
3050 return NULL;
3051 }
3052 stmt_ty res = NULL;
3053 int mark = p->mark;
3054 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3055 p->error_indicator = 1;
3056 return NULL;
3057 }
3058 int start_lineno = p->tokens[mark]->lineno;
3059 UNUSED(start_lineno); // Only used by EXTRA macro
3060 int start_col_offset = p->tokens[mark]->col_offset;
3061 UNUSED(start_col_offset); // Only used by EXTRA macro
3062 { // 'try' ':' block finally_block
3063 asdl_seq* b;
3064 asdl_seq* f;
3065 void *keyword;
3066 void *literal;
3067 if (
3068 (keyword = _PyPegen_expect_token(p, 511))
3069 &&
3070 (literal = _PyPegen_expect_token(p, 11))
3071 &&
3072 (b = block_rule(p))
3073 &&
3074 (f = finally_block_rule(p))
3075 )
3076 {
3077 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3078 if (token == NULL) {
3079 return NULL;
3080 }
3081 int end_lineno = token->end_lineno;
3082 UNUSED(end_lineno); // Only used by EXTRA macro
3083 int end_col_offset = token->end_col_offset;
3084 UNUSED(end_col_offset); // Only used by EXTRA macro
3085 res = _Py_Try ( b , NULL , NULL , f , EXTRA );
3086 if (res == NULL && PyErr_Occurred()) {
3087 p->error_indicator = 1;
3088 return NULL;
3089 }
3090 goto done;
3091 }
3092 p->mark = mark;
3093 }
3094 { // 'try' ':' block except_block+ else_block? finally_block?
3095 asdl_seq* b;
3096 void *el;
3097 asdl_seq * ex;
3098 void *f;
3099 void *keyword;
3100 void *literal;
3101 if (
3102 (keyword = _PyPegen_expect_token(p, 511))
3103 &&
3104 (literal = _PyPegen_expect_token(p, 11))
3105 &&
3106 (b = block_rule(p))
3107 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003108 (ex = _loop1_43_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003109 &&
3110 (el = else_block_rule(p), 1)
3111 &&
3112 (f = finally_block_rule(p), 1)
3113 )
3114 {
3115 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3116 if (token == NULL) {
3117 return NULL;
3118 }
3119 int end_lineno = token->end_lineno;
3120 UNUSED(end_lineno); // Only used by EXTRA macro
3121 int end_col_offset = token->end_col_offset;
3122 UNUSED(end_col_offset); // Only used by EXTRA macro
3123 res = _Py_Try ( b , ex , el , f , EXTRA );
3124 if (res == NULL && PyErr_Occurred()) {
3125 p->error_indicator = 1;
3126 return NULL;
3127 }
3128 goto done;
3129 }
3130 p->mark = mark;
3131 }
3132 res = NULL;
3133 done:
3134 return res;
3135}
3136
3137// except_block: 'except' expression ['as' target] ':' block | 'except' ':' block
3138static excepthandler_ty
3139except_block_rule(Parser *p)
3140{
3141 if (p->error_indicator) {
3142 return NULL;
3143 }
3144 excepthandler_ty res = NULL;
3145 int mark = p->mark;
3146 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3147 p->error_indicator = 1;
3148 return NULL;
3149 }
3150 int start_lineno = p->tokens[mark]->lineno;
3151 UNUSED(start_lineno); // Only used by EXTRA macro
3152 int start_col_offset = p->tokens[mark]->col_offset;
3153 UNUSED(start_col_offset); // Only used by EXTRA macro
3154 { // 'except' expression ['as' target] ':' block
3155 asdl_seq* b;
3156 expr_ty e;
3157 void *keyword;
3158 void *literal;
3159 void *t;
3160 if (
3161 (keyword = _PyPegen_expect_token(p, 520))
3162 &&
3163 (e = expression_rule(p))
3164 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003165 (t = _tmp_44_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003166 &&
3167 (literal = _PyPegen_expect_token(p, 11))
3168 &&
3169 (b = block_rule(p))
3170 )
3171 {
3172 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3173 if (token == NULL) {
3174 return NULL;
3175 }
3176 int end_lineno = token->end_lineno;
3177 UNUSED(end_lineno); // Only used by EXTRA macro
3178 int end_col_offset = token->end_col_offset;
3179 UNUSED(end_col_offset); // Only used by EXTRA macro
3180 res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
3181 if (res == NULL && PyErr_Occurred()) {
3182 p->error_indicator = 1;
3183 return NULL;
3184 }
3185 goto done;
3186 }
3187 p->mark = mark;
3188 }
3189 { // 'except' ':' block
3190 asdl_seq* b;
3191 void *keyword;
3192 void *literal;
3193 if (
3194 (keyword = _PyPegen_expect_token(p, 520))
3195 &&
3196 (literal = _PyPegen_expect_token(p, 11))
3197 &&
3198 (b = block_rule(p))
3199 )
3200 {
3201 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3202 if (token == NULL) {
3203 return NULL;
3204 }
3205 int end_lineno = token->end_lineno;
3206 UNUSED(end_lineno); // Only used by EXTRA macro
3207 int end_col_offset = token->end_col_offset;
3208 UNUSED(end_col_offset); // Only used by EXTRA macro
3209 res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
3210 if (res == NULL && PyErr_Occurred()) {
3211 p->error_indicator = 1;
3212 return NULL;
3213 }
3214 goto done;
3215 }
3216 p->mark = mark;
3217 }
3218 res = NULL;
3219 done:
3220 return res;
3221}
3222
3223// finally_block: 'finally' ':' block
3224static asdl_seq*
3225finally_block_rule(Parser *p)
3226{
3227 if (p->error_indicator) {
3228 return NULL;
3229 }
3230 asdl_seq* res = NULL;
3231 int mark = p->mark;
3232 { // 'finally' ':' block
3233 asdl_seq* a;
3234 void *keyword;
3235 void *literal;
3236 if (
3237 (keyword = _PyPegen_expect_token(p, 521))
3238 &&
3239 (literal = _PyPegen_expect_token(p, 11))
3240 &&
3241 (a = block_rule(p))
3242 )
3243 {
3244 res = a;
3245 if (res == NULL && PyErr_Occurred()) {
3246 p->error_indicator = 1;
3247 return NULL;
3248 }
3249 goto done;
3250 }
3251 p->mark = mark;
3252 }
3253 res = NULL;
3254 done:
3255 return res;
3256}
3257
3258// return_stmt: 'return' star_expressions?
3259static stmt_ty
3260return_stmt_rule(Parser *p)
3261{
3262 if (p->error_indicator) {
3263 return NULL;
3264 }
3265 stmt_ty res = NULL;
3266 int mark = p->mark;
3267 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3268 p->error_indicator = 1;
3269 return NULL;
3270 }
3271 int start_lineno = p->tokens[mark]->lineno;
3272 UNUSED(start_lineno); // Only used by EXTRA macro
3273 int start_col_offset = p->tokens[mark]->col_offset;
3274 UNUSED(start_col_offset); // Only used by EXTRA macro
3275 { // 'return' star_expressions?
3276 void *a;
3277 void *keyword;
3278 if (
3279 (keyword = _PyPegen_expect_token(p, 500))
3280 &&
3281 (a = star_expressions_rule(p), 1)
3282 )
3283 {
3284 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3285 if (token == NULL) {
3286 return NULL;
3287 }
3288 int end_lineno = token->end_lineno;
3289 UNUSED(end_lineno); // Only used by EXTRA macro
3290 int end_col_offset = token->end_col_offset;
3291 UNUSED(end_col_offset); // Only used by EXTRA macro
3292 res = _Py_Return ( a , EXTRA );
3293 if (res == NULL && PyErr_Occurred()) {
3294 p->error_indicator = 1;
3295 return NULL;
3296 }
3297 goto done;
3298 }
3299 p->mark = mark;
3300 }
3301 res = NULL;
3302 done:
3303 return res;
3304}
3305
3306// raise_stmt: 'raise' expression ['from' expression] | 'raise'
3307static stmt_ty
3308raise_stmt_rule(Parser *p)
3309{
3310 if (p->error_indicator) {
3311 return NULL;
3312 }
3313 stmt_ty res = NULL;
3314 int mark = p->mark;
3315 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3316 p->error_indicator = 1;
3317 return NULL;
3318 }
3319 int start_lineno = p->tokens[mark]->lineno;
3320 UNUSED(start_lineno); // Only used by EXTRA macro
3321 int start_col_offset = p->tokens[mark]->col_offset;
3322 UNUSED(start_col_offset); // Only used by EXTRA macro
3323 { // 'raise' expression ['from' expression]
3324 expr_ty a;
3325 void *b;
3326 void *keyword;
3327 if (
3328 (keyword = _PyPegen_expect_token(p, 501))
3329 &&
3330 (a = expression_rule(p))
3331 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003332 (b = _tmp_45_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003333 )
3334 {
3335 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3336 if (token == NULL) {
3337 return NULL;
3338 }
3339 int end_lineno = token->end_lineno;
3340 UNUSED(end_lineno); // Only used by EXTRA macro
3341 int end_col_offset = token->end_col_offset;
3342 UNUSED(end_col_offset); // Only used by EXTRA macro
3343 res = _Py_Raise ( a , b , EXTRA );
3344 if (res == NULL && PyErr_Occurred()) {
3345 p->error_indicator = 1;
3346 return NULL;
3347 }
3348 goto done;
3349 }
3350 p->mark = mark;
3351 }
3352 { // 'raise'
3353 void *keyword;
3354 if (
3355 (keyword = _PyPegen_expect_token(p, 501))
3356 )
3357 {
3358 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3359 if (token == NULL) {
3360 return NULL;
3361 }
3362 int end_lineno = token->end_lineno;
3363 UNUSED(end_lineno); // Only used by EXTRA macro
3364 int end_col_offset = token->end_col_offset;
3365 UNUSED(end_col_offset); // Only used by EXTRA macro
3366 res = _Py_Raise ( NULL , NULL , EXTRA );
3367 if (res == NULL && PyErr_Occurred()) {
3368 p->error_indicator = 1;
3369 return NULL;
3370 }
3371 goto done;
3372 }
3373 p->mark = mark;
3374 }
3375 res = NULL;
3376 done:
3377 return res;
3378}
3379
3380// function_def: decorators function_def_raw | function_def_raw
3381static stmt_ty
3382function_def_rule(Parser *p)
3383{
3384 if (p->error_indicator) {
3385 return NULL;
3386 }
3387 stmt_ty res = NULL;
3388 int mark = p->mark;
3389 { // decorators function_def_raw
3390 asdl_seq* d;
3391 stmt_ty f;
3392 if (
3393 (d = decorators_rule(p))
3394 &&
3395 (f = function_def_raw_rule(p))
3396 )
3397 {
3398 res = _PyPegen_function_def_decorators ( p , d , f );
3399 if (res == NULL && PyErr_Occurred()) {
3400 p->error_indicator = 1;
3401 return NULL;
3402 }
3403 goto done;
3404 }
3405 p->mark = mark;
3406 }
3407 { // function_def_raw
3408 stmt_ty function_def_raw_var;
3409 if (
3410 (function_def_raw_var = function_def_raw_rule(p))
3411 )
3412 {
3413 res = function_def_raw_var;
3414 goto done;
3415 }
3416 p->mark = mark;
3417 }
3418 res = NULL;
3419 done:
3420 return res;
3421}
3422
Guido van Rossumc001c092020-04-30 12:12:19 -07003423// function_def_raw:
3424// | ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003425static stmt_ty
3426function_def_raw_rule(Parser *p)
3427{
3428 if (p->error_indicator) {
3429 return NULL;
3430 }
3431 stmt_ty res = NULL;
3432 int mark = p->mark;
3433 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3434 p->error_indicator = 1;
3435 return NULL;
3436 }
3437 int start_lineno = p->tokens[mark]->lineno;
3438 UNUSED(start_lineno); // Only used by EXTRA macro
3439 int start_col_offset = p->tokens[mark]->col_offset;
3440 UNUSED(start_col_offset); // Only used by EXTRA macro
Guido van Rossumc001c092020-04-30 12:12:19 -07003441 { // ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003442 void *a;
3443 asdl_seq* b;
3444 void *is_async;
3445 void *keyword;
3446 void *literal;
3447 void *literal_1;
3448 void *literal_2;
3449 expr_ty n;
3450 void *params;
Guido van Rossumc001c092020-04-30 12:12:19 -07003451 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003452 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01003453 (is_async = _PyPegen_expect_token(p, ASYNC), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003454 &&
3455 (keyword = _PyPegen_expect_token(p, 522))
3456 &&
3457 (n = _PyPegen_name_token(p))
3458 &&
3459 (literal = _PyPegen_expect_token(p, 7))
3460 &&
3461 (params = params_rule(p), 1)
3462 &&
3463 (literal_1 = _PyPegen_expect_token(p, 8))
3464 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003465 (a = _tmp_46_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003466 &&
3467 (literal_2 = _PyPegen_expect_token(p, 11))
3468 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003469 (tc = func_type_comment_rule(p), 1)
3470 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003471 (b = block_rule(p))
3472 )
3473 {
3474 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3475 if (token == NULL) {
3476 return NULL;
3477 }
3478 int end_lineno = token->end_lineno;
3479 UNUSED(end_lineno); // Only used by EXTRA macro
3480 int end_col_offset = token->end_col_offset;
3481 UNUSED(end_col_offset); // Only used by EXTRA macro
Guido van Rossumc001c092020-04-30 12:12:19 -07003482 res = ( is_async ? _Py_AsyncFunctionDef : _Py_FunctionDef ) ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003483 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
Guido van Rossumc001c092020-04-30 12:12:19 -07003496// func_type_comment:
3497// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
3498// | invalid_double_type_comments
3499// | TYPE_COMMENT
3500static PyObject*
3501func_type_comment_rule(Parser *p)
3502{
3503 if (p->error_indicator) {
3504 return NULL;
3505 }
3506 PyObject* res = NULL;
3507 int mark = p->mark;
3508 { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
3509 void *newline_var;
3510 void *t;
3511 if (
3512 (newline_var = _PyPegen_expect_token(p, NEWLINE))
3513 &&
3514 (t = _PyPegen_expect_token(p, TYPE_COMMENT))
3515 &&
3516 _PyPegen_lookahead(1, _tmp_47_rule, p)
3517 )
3518 {
3519 res = t;
3520 if (res == NULL && PyErr_Occurred()) {
3521 p->error_indicator = 1;
3522 return NULL;
3523 }
3524 goto done;
3525 }
3526 p->mark = mark;
3527 }
3528 { // invalid_double_type_comments
3529 void *invalid_double_type_comments_var;
3530 if (
3531 (invalid_double_type_comments_var = invalid_double_type_comments_rule(p))
3532 )
3533 {
3534 res = invalid_double_type_comments_var;
3535 goto done;
3536 }
3537 p->mark = mark;
3538 }
3539 { // TYPE_COMMENT
3540 void *type_comment_var;
3541 if (
3542 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))
3543 )
3544 {
3545 res = type_comment_var;
3546 goto done;
3547 }
3548 p->mark = mark;
3549 }
3550 res = NULL;
3551 done:
3552 return res;
3553}
3554
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003555// params: invalid_parameters | parameters
3556static arguments_ty
3557params_rule(Parser *p)
3558{
3559 if (p->error_indicator) {
3560 return NULL;
3561 }
3562 arguments_ty res = NULL;
3563 int mark = p->mark;
3564 { // invalid_parameters
3565 void *invalid_parameters_var;
3566 if (
3567 (invalid_parameters_var = invalid_parameters_rule(p))
3568 )
3569 {
3570 res = invalid_parameters_var;
3571 goto done;
3572 }
3573 p->mark = mark;
3574 }
3575 { // parameters
3576 arguments_ty parameters_var;
3577 if (
3578 (parameters_var = parameters_rule(p))
3579 )
3580 {
3581 res = parameters_var;
3582 goto done;
3583 }
3584 p->mark = mark;
3585 }
3586 res = NULL;
3587 done:
3588 return res;
3589}
3590
3591// parameters:
Guido van Rossumc001c092020-04-30 12:12:19 -07003592// | slash_no_default param_no_default* param_with_default* star_etc?
3593// | slash_with_default param_with_default* star_etc?
3594// | param_no_default+ param_with_default* star_etc?
3595// | param_with_default+ star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003596// | star_etc
3597static arguments_ty
3598parameters_rule(Parser *p)
3599{
3600 if (p->error_indicator) {
3601 return NULL;
3602 }
3603 arguments_ty res = NULL;
3604 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07003605 { // slash_no_default param_no_default* param_with_default* star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003606 asdl_seq* a;
Guido van Rossumc001c092020-04-30 12:12:19 -07003607 asdl_seq * b;
3608 asdl_seq * c;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003609 void *d;
3610 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07003611 (a = slash_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003612 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003613 (b = _loop0_48_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003614 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003615 (c = _loop0_49_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003616 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003617 (d = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003618 )
3619 {
3620 res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
3621 if (res == NULL && PyErr_Occurred()) {
3622 p->error_indicator = 1;
3623 return NULL;
3624 }
3625 goto done;
3626 }
3627 p->mark = mark;
3628 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003629 { // slash_with_default param_with_default* star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003630 SlashWithDefault* a;
Guido van Rossumc001c092020-04-30 12:12:19 -07003631 asdl_seq * b;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003632 void *c;
3633 if (
3634 (a = slash_with_default_rule(p))
3635 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003636 (b = _loop0_50_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003637 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003638 (c = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003639 )
3640 {
3641 res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
3642 if (res == NULL && PyErr_Occurred()) {
3643 p->error_indicator = 1;
3644 return NULL;
3645 }
3646 goto done;
3647 }
3648 p->mark = mark;
3649 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003650 { // param_no_default+ param_with_default* star_etc?
3651 asdl_seq * a;
3652 asdl_seq * b;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003653 void *c;
3654 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07003655 (a = _loop1_51_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003656 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003657 (b = _loop0_52_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003658 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003659 (c = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003660 )
3661 {
3662 res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
3663 if (res == NULL && PyErr_Occurred()) {
3664 p->error_indicator = 1;
3665 return NULL;
3666 }
3667 goto done;
3668 }
3669 p->mark = mark;
3670 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003671 { // param_with_default+ star_etc?
3672 asdl_seq * a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003673 void *b;
3674 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07003675 (a = _loop1_53_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003676 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003677 (b = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003678 )
3679 {
3680 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
3681 if (res == NULL && PyErr_Occurred()) {
3682 p->error_indicator = 1;
3683 return NULL;
3684 }
3685 goto done;
3686 }
3687 p->mark = mark;
3688 }
3689 { // star_etc
3690 StarEtc* a;
3691 if (
3692 (a = star_etc_rule(p))
3693 )
3694 {
3695 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
3696 if (res == NULL && PyErr_Occurred()) {
3697 p->error_indicator = 1;
3698 return NULL;
3699 }
3700 goto done;
3701 }
3702 p->mark = mark;
3703 }
3704 res = NULL;
3705 done:
3706 return res;
3707}
3708
Guido van Rossumc001c092020-04-30 12:12:19 -07003709// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003710static asdl_seq*
Guido van Rossumc001c092020-04-30 12:12:19 -07003711slash_no_default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003712{
3713 if (p->error_indicator) {
3714 return NULL;
3715 }
3716 asdl_seq* res = NULL;
3717 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07003718 { // param_no_default+ '/' ','
3719 asdl_seq * a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003720 void *literal;
3721 void *literal_1;
3722 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07003723 (a = _loop1_54_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003724 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003725 (literal = _PyPegen_expect_token(p, 17))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003726 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003727 (literal_1 = _PyPegen_expect_token(p, 12))
3728 )
3729 {
3730 res = a;
3731 if (res == NULL && PyErr_Occurred()) {
3732 p->error_indicator = 1;
3733 return NULL;
3734 }
3735 goto done;
3736 }
3737 p->mark = mark;
3738 }
3739 { // param_no_default+ '/' &')'
3740 asdl_seq * a;
3741 void *literal;
3742 if (
3743 (a = _loop1_55_rule(p))
3744 &&
3745 (literal = _PyPegen_expect_token(p, 17))
3746 &&
3747 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003748 )
3749 {
3750 res = a;
3751 if (res == NULL && PyErr_Occurred()) {
3752 p->error_indicator = 1;
3753 return NULL;
3754 }
3755 goto done;
3756 }
3757 p->mark = mark;
3758 }
3759 res = NULL;
3760 done:
3761 return res;
3762}
3763
Guido van Rossumc001c092020-04-30 12:12:19 -07003764// slash_with_default:
3765// | param_no_default* param_with_default+ '/' ','
3766// | param_no_default* param_with_default+ '/' &')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003767static SlashWithDefault*
3768slash_with_default_rule(Parser *p)
3769{
3770 if (p->error_indicator) {
3771 return NULL;
3772 }
3773 SlashWithDefault* res = NULL;
3774 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07003775 { // param_no_default* param_with_default+ '/' ','
3776 asdl_seq * a;
3777 asdl_seq * b;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003778 void *literal;
3779 void *literal_1;
3780 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07003781 (a = _loop0_56_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003782 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003783 (b = _loop1_57_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003784 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003785 (literal = _PyPegen_expect_token(p, 17))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003786 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003787 (literal_1 = _PyPegen_expect_token(p, 12))
3788 )
3789 {
3790 res = _PyPegen_slash_with_default ( p , a , b );
3791 if (res == NULL && PyErr_Occurred()) {
3792 p->error_indicator = 1;
3793 return NULL;
3794 }
3795 goto done;
3796 }
3797 p->mark = mark;
3798 }
3799 { // param_no_default* param_with_default+ '/' &')'
3800 asdl_seq * a;
3801 asdl_seq * b;
3802 void *literal;
3803 if (
3804 (a = _loop0_58_rule(p))
3805 &&
3806 (b = _loop1_59_rule(p))
3807 &&
3808 (literal = _PyPegen_expect_token(p, 17))
3809 &&
3810 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003811 )
3812 {
3813 res = _PyPegen_slash_with_default ( p , a , b );
3814 if (res == NULL && PyErr_Occurred()) {
3815 p->error_indicator = 1;
3816 return NULL;
3817 }
3818 goto done;
3819 }
3820 p->mark = mark;
3821 }
3822 res = NULL;
3823 done:
3824 return res;
3825}
3826
3827// star_etc:
Guido van Rossumc001c092020-04-30 12:12:19 -07003828// | '*' param_no_default param_maybe_default* kwds?
3829// | '*' ',' param_maybe_default+ kwds?
3830// | kwds
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003831static StarEtc*
3832star_etc_rule(Parser *p)
3833{
3834 if (p->error_indicator) {
3835 return NULL;
3836 }
3837 StarEtc* res = NULL;
3838 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07003839 { // '*' param_no_default param_maybe_default* kwds?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003840 arg_ty a;
3841 asdl_seq * b;
3842 void *c;
3843 void *literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003844 if (
3845 (literal = _PyPegen_expect_token(p, 16))
3846 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003847 (a = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003848 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003849 (b = _loop0_60_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003850 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003851 (c = kwds_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003852 )
3853 {
3854 res = _PyPegen_star_etc ( p , a , b , c );
3855 if (res == NULL && PyErr_Occurred()) {
3856 p->error_indicator = 1;
3857 return NULL;
3858 }
3859 goto done;
3860 }
3861 p->mark = mark;
3862 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003863 { // '*' ',' param_maybe_default+ kwds?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003864 asdl_seq * b;
3865 void *c;
3866 void *literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07003867 void *literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003868 if (
3869 (literal = _PyPegen_expect_token(p, 16))
3870 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003871 (literal_1 = _PyPegen_expect_token(p, 12))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003872 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003873 (b = _loop1_61_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003874 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003875 (c = kwds_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003876 )
3877 {
3878 res = _PyPegen_star_etc ( p , NULL , b , c );
3879 if (res == NULL && PyErr_Occurred()) {
3880 p->error_indicator = 1;
3881 return NULL;
3882 }
3883 goto done;
3884 }
3885 p->mark = mark;
3886 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003887 { // kwds
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003888 arg_ty a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003889 if (
3890 (a = kwds_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003891 )
3892 {
3893 res = _PyPegen_star_etc ( p , NULL , NULL , a );
3894 if (res == NULL && PyErr_Occurred()) {
3895 p->error_indicator = 1;
3896 return NULL;
3897 }
3898 goto done;
3899 }
3900 p->mark = mark;
3901 }
3902 res = NULL;
3903 done:
3904 return res;
3905}
3906
Guido van Rossumc001c092020-04-30 12:12:19 -07003907// kwds: '**' param_no_default
3908static arg_ty
3909kwds_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003910{
3911 if (p->error_indicator) {
3912 return NULL;
3913 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003914 arg_ty res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003915 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07003916 { // '**' param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003917 arg_ty a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003918 void *literal;
3919 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07003920 (literal = _PyPegen_expect_token(p, 35))
3921 &&
3922 (a = param_no_default_rule(p))
3923 )
3924 {
3925 res = a;
3926 if (res == NULL && PyErr_Occurred()) {
3927 p->error_indicator = 1;
3928 return NULL;
3929 }
3930 goto done;
3931 }
3932 p->mark = mark;
3933 }
3934 res = NULL;
3935 done:
3936 return res;
3937}
3938
3939// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
3940static arg_ty
3941param_no_default_rule(Parser *p)
3942{
3943 if (p->error_indicator) {
3944 return NULL;
3945 }
3946 arg_ty res = NULL;
3947 int mark = p->mark;
3948 { // param ',' TYPE_COMMENT?
3949 arg_ty a;
3950 void *literal;
3951 void *tc;
3952 if (
3953 (a = param_rule(p))
3954 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003955 (literal = _PyPegen_expect_token(p, 12))
3956 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003957 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003958 )
3959 {
Guido van Rossumc001c092020-04-30 12:12:19 -07003960 res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003961 if (res == NULL && PyErr_Occurred()) {
3962 p->error_indicator = 1;
3963 return NULL;
3964 }
3965 goto done;
3966 }
3967 p->mark = mark;
3968 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003969 { // param TYPE_COMMENT? &')'
3970 arg_ty a;
3971 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003972 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07003973 (a = param_rule(p))
3974 &&
3975 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
3976 &&
3977 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003978 )
3979 {
Guido van Rossumc001c092020-04-30 12:12:19 -07003980 res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003981 if (res == NULL && PyErr_Occurred()) {
3982 p->error_indicator = 1;
3983 return NULL;
3984 }
3985 goto done;
3986 }
3987 p->mark = mark;
3988 }
3989 res = NULL;
3990 done:
3991 return res;
3992}
3993
Guido van Rossumc001c092020-04-30 12:12:19 -07003994// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003995static NameDefaultPair*
Guido van Rossumc001c092020-04-30 12:12:19 -07003996param_with_default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003997{
3998 if (p->error_indicator) {
3999 return NULL;
4000 }
4001 NameDefaultPair* res = NULL;
4002 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004003 { // param default ',' TYPE_COMMENT?
4004 arg_ty a;
4005 expr_ty c;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004006 void *literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07004007 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004008 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004009 (a = param_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004010 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004011 (c = default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004012 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004013 (literal = _PyPegen_expect_token(p, 12))
4014 &&
4015 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004016 )
4017 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004018 res = _PyPegen_name_default_pair ( p , a , c , tc );
4019 if (res == NULL && PyErr_Occurred()) {
4020 p->error_indicator = 1;
4021 return NULL;
4022 }
4023 goto done;
4024 }
4025 p->mark = mark;
4026 }
4027 { // param default TYPE_COMMENT? &')'
4028 arg_ty a;
4029 expr_ty c;
4030 void *tc;
4031 if (
4032 (a = param_rule(p))
4033 &&
4034 (c = default_rule(p))
4035 &&
4036 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
4037 &&
4038 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
4039 )
4040 {
4041 res = _PyPegen_name_default_pair ( p , a , c , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004042 if (res == NULL && PyErr_Occurred()) {
4043 p->error_indicator = 1;
4044 return NULL;
4045 }
4046 goto done;
4047 }
4048 p->mark = mark;
4049 }
4050 res = NULL;
4051 done:
4052 return res;
4053}
4054
Guido van Rossumc001c092020-04-30 12:12:19 -07004055// param_maybe_default:
4056// | param default? ',' TYPE_COMMENT?
4057// | param default? TYPE_COMMENT? &')'
4058static NameDefaultPair*
4059param_maybe_default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004060{
4061 if (p->error_indicator) {
4062 return NULL;
4063 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004064 NameDefaultPair* res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004065 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004066 { // param default? ',' TYPE_COMMENT?
4067 arg_ty a;
4068 void *c;
4069 void *literal;
4070 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004071 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004072 (a = param_rule(p))
4073 &&
4074 (c = default_rule(p), 1)
4075 &&
4076 (literal = _PyPegen_expect_token(p, 12))
4077 &&
4078 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004079 )
4080 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004081 res = _PyPegen_name_default_pair ( p , a , c , tc );
4082 if (res == NULL && PyErr_Occurred()) {
4083 p->error_indicator = 1;
4084 return NULL;
4085 }
4086 goto done;
4087 }
4088 p->mark = mark;
4089 }
4090 { // param default? TYPE_COMMENT? &')'
4091 arg_ty a;
4092 void *c;
4093 void *tc;
4094 if (
4095 (a = param_rule(p))
4096 &&
4097 (c = default_rule(p), 1)
4098 &&
4099 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
4100 &&
4101 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
4102 )
4103 {
4104 res = _PyPegen_name_default_pair ( p , a , c , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004105 if (res == NULL && PyErr_Occurred()) {
4106 p->error_indicator = 1;
4107 return NULL;
4108 }
4109 goto done;
4110 }
4111 p->mark = mark;
4112 }
4113 res = NULL;
4114 done:
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004115 return res;
4116}
4117
Guido van Rossumc001c092020-04-30 12:12:19 -07004118// param: NAME annotation?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004119static arg_ty
Guido van Rossumc001c092020-04-30 12:12:19 -07004120param_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004121{
4122 if (p->error_indicator) {
4123 return NULL;
4124 }
4125 arg_ty res = NULL;
4126 int mark = p->mark;
4127 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4128 p->error_indicator = 1;
4129 return NULL;
4130 }
4131 int start_lineno = p->tokens[mark]->lineno;
4132 UNUSED(start_lineno); // Only used by EXTRA macro
4133 int start_col_offset = p->tokens[mark]->col_offset;
4134 UNUSED(start_col_offset); // Only used by EXTRA macro
Guido van Rossumc001c092020-04-30 12:12:19 -07004135 { // NAME annotation?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004136 expr_ty a;
4137 void *b;
4138 if (
4139 (a = _PyPegen_name_token(p))
4140 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004141 (b = annotation_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004142 )
4143 {
4144 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4145 if (token == NULL) {
4146 return NULL;
4147 }
4148 int end_lineno = token->end_lineno;
4149 UNUSED(end_lineno); // Only used by EXTRA macro
4150 int end_col_offset = token->end_col_offset;
4151 UNUSED(end_col_offset); // Only used by EXTRA macro
4152 res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
4153 if (res == NULL && PyErr_Occurred()) {
4154 p->error_indicator = 1;
4155 return NULL;
4156 }
4157 goto done;
4158 }
4159 p->mark = mark;
4160 }
4161 res = NULL;
4162 done:
4163 return res;
4164}
4165
Guido van Rossumc001c092020-04-30 12:12:19 -07004166// annotation: ':' expression
4167static expr_ty
4168annotation_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004169{
4170 if (p->error_indicator) {
4171 return NULL;
4172 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004173 expr_ty res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004174 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004175 { // ':' expression
4176 expr_ty a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004177 void *literal;
4178 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004179 (literal = _PyPegen_expect_token(p, 11))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004180 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004181 (a = expression_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004182 )
4183 {
4184 res = a;
4185 if (res == NULL && PyErr_Occurred()) {
4186 p->error_indicator = 1;
4187 return NULL;
4188 }
4189 goto done;
4190 }
4191 p->mark = mark;
4192 }
4193 res = NULL;
4194 done:
4195 return res;
4196}
4197
Guido van Rossumc001c092020-04-30 12:12:19 -07004198// default: '=' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004199static expr_ty
Guido van Rossumc001c092020-04-30 12:12:19 -07004200default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004201{
4202 if (p->error_indicator) {
4203 return NULL;
4204 }
4205 expr_ty res = NULL;
4206 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004207 { // '=' expression
4208 expr_ty a;
4209 void *literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004210 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004211 (literal = _PyPegen_expect_token(p, 22))
4212 &&
4213 (a = expression_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004214 )
4215 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004216 res = a;
4217 if (res == NULL && PyErr_Occurred()) {
4218 p->error_indicator = 1;
4219 return NULL;
4220 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004221 goto done;
4222 }
4223 p->mark = mark;
4224 }
4225 res = NULL;
4226 done:
4227 return res;
4228}
4229
4230// decorators: (('@' named_expression NEWLINE))+
4231static asdl_seq*
4232decorators_rule(Parser *p)
4233{
4234 if (p->error_indicator) {
4235 return NULL;
4236 }
4237 asdl_seq* res = NULL;
4238 int mark = p->mark;
4239 { // (('@' named_expression NEWLINE))+
4240 asdl_seq * a;
4241 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004242 (a = _loop1_62_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004243 )
4244 {
4245 res = a;
4246 if (res == NULL && PyErr_Occurred()) {
4247 p->error_indicator = 1;
4248 return NULL;
4249 }
4250 goto done;
4251 }
4252 p->mark = mark;
4253 }
4254 res = NULL;
4255 done:
4256 return res;
4257}
4258
4259// class_def: decorators class_def_raw | class_def_raw
4260static stmt_ty
4261class_def_rule(Parser *p)
4262{
4263 if (p->error_indicator) {
4264 return NULL;
4265 }
4266 stmt_ty res = NULL;
4267 int mark = p->mark;
4268 { // decorators class_def_raw
4269 asdl_seq* a;
4270 stmt_ty b;
4271 if (
4272 (a = decorators_rule(p))
4273 &&
4274 (b = class_def_raw_rule(p))
4275 )
4276 {
4277 res = _PyPegen_class_def_decorators ( p , a , b );
4278 if (res == NULL && PyErr_Occurred()) {
4279 p->error_indicator = 1;
4280 return NULL;
4281 }
4282 goto done;
4283 }
4284 p->mark = mark;
4285 }
4286 { // class_def_raw
4287 stmt_ty class_def_raw_var;
4288 if (
4289 (class_def_raw_var = class_def_raw_rule(p))
4290 )
4291 {
4292 res = class_def_raw_var;
4293 goto done;
4294 }
4295 p->mark = mark;
4296 }
4297 res = NULL;
4298 done:
4299 return res;
4300}
4301
4302// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
4303static stmt_ty
4304class_def_raw_rule(Parser *p)
4305{
4306 if (p->error_indicator) {
4307 return NULL;
4308 }
4309 stmt_ty res = NULL;
4310 int mark = p->mark;
4311 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4312 p->error_indicator = 1;
4313 return NULL;
4314 }
4315 int start_lineno = p->tokens[mark]->lineno;
4316 UNUSED(start_lineno); // Only used by EXTRA macro
4317 int start_col_offset = p->tokens[mark]->col_offset;
4318 UNUSED(start_col_offset); // Only used by EXTRA macro
4319 { // 'class' NAME ['(' arguments? ')'] ':' block
4320 expr_ty a;
4321 void *b;
4322 asdl_seq* c;
4323 void *keyword;
4324 void *literal;
4325 if (
4326 (keyword = _PyPegen_expect_token(p, 523))
4327 &&
4328 (a = _PyPegen_name_token(p))
4329 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004330 (b = _tmp_63_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004331 &&
4332 (literal = _PyPegen_expect_token(p, 11))
4333 &&
4334 (c = block_rule(p))
4335 )
4336 {
4337 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4338 if (token == NULL) {
4339 return NULL;
4340 }
4341 int end_lineno = token->end_lineno;
4342 UNUSED(end_lineno); // Only used by EXTRA macro
4343 int end_col_offset = token->end_col_offset;
4344 UNUSED(end_col_offset); // Only used by EXTRA macro
4345 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 );
4346 if (res == NULL && PyErr_Occurred()) {
4347 p->error_indicator = 1;
4348 return NULL;
4349 }
4350 goto done;
4351 }
4352 p->mark = mark;
4353 }
4354 res = NULL;
4355 done:
4356 return res;
4357}
4358
4359// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
4360static asdl_seq*
4361block_rule(Parser *p)
4362{
4363 if (p->error_indicator) {
4364 return NULL;
4365 }
4366 asdl_seq* res = NULL;
4367 if (_PyPegen_is_memoized(p, block_type, &res))
4368 return res;
4369 int mark = p->mark;
4370 { // NEWLINE INDENT statements DEDENT
4371 asdl_seq* a;
4372 void *dedent_var;
4373 void *indent_var;
4374 void *newline_var;
4375 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01004376 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004377 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01004378 (indent_var = _PyPegen_expect_token(p, INDENT))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004379 &&
4380 (a = statements_rule(p))
4381 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01004382 (dedent_var = _PyPegen_expect_token(p, DEDENT))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004383 )
4384 {
4385 res = a;
4386 if (res == NULL && PyErr_Occurred()) {
4387 p->error_indicator = 1;
4388 return NULL;
4389 }
4390 goto done;
4391 }
4392 p->mark = mark;
4393 }
4394 { // simple_stmt
4395 asdl_seq* simple_stmt_var;
4396 if (
4397 (simple_stmt_var = simple_stmt_rule(p))
4398 )
4399 {
4400 res = simple_stmt_var;
4401 goto done;
4402 }
4403 p->mark = mark;
4404 }
4405 { // invalid_block
4406 void *invalid_block_var;
4407 if (
4408 (invalid_block_var = invalid_block_rule(p))
4409 )
4410 {
4411 res = invalid_block_var;
4412 goto done;
4413 }
4414 p->mark = mark;
4415 }
4416 res = NULL;
4417 done:
4418 _PyPegen_insert_memo(p, mark, block_type, res);
4419 return res;
4420}
4421
4422// expressions_list: ','.star_expression+ ','?
4423static asdl_seq*
4424expressions_list_rule(Parser *p)
4425{
4426 if (p->error_indicator) {
4427 return NULL;
4428 }
4429 asdl_seq* res = NULL;
4430 int mark = p->mark;
4431 { // ','.star_expression+ ','?
4432 asdl_seq * a;
4433 void *opt_var;
4434 UNUSED(opt_var); // Silence compiler warnings
4435 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004436 (a = _gather_64_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004437 &&
4438 (opt_var = _PyPegen_expect_token(p, 12), 1)
4439 )
4440 {
4441 res = a;
4442 if (res == NULL && PyErr_Occurred()) {
4443 p->error_indicator = 1;
4444 return NULL;
4445 }
4446 goto done;
4447 }
4448 p->mark = mark;
4449 }
4450 res = NULL;
4451 done:
4452 return res;
4453}
4454
4455// star_expressions:
4456// | star_expression ((',' star_expression))+ ','?
4457// | star_expression ','
4458// | star_expression
4459static expr_ty
4460star_expressions_rule(Parser *p)
4461{
4462 if (p->error_indicator) {
4463 return NULL;
4464 }
4465 expr_ty res = NULL;
4466 int mark = p->mark;
4467 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4468 p->error_indicator = 1;
4469 return NULL;
4470 }
4471 int start_lineno = p->tokens[mark]->lineno;
4472 UNUSED(start_lineno); // Only used by EXTRA macro
4473 int start_col_offset = p->tokens[mark]->col_offset;
4474 UNUSED(start_col_offset); // Only used by EXTRA macro
4475 { // star_expression ((',' star_expression))+ ','?
4476 expr_ty a;
4477 asdl_seq * b;
4478 void *opt_var;
4479 UNUSED(opt_var); // Silence compiler warnings
4480 if (
4481 (a = star_expression_rule(p))
4482 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004483 (b = _loop1_66_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004484 &&
4485 (opt_var = _PyPegen_expect_token(p, 12), 1)
4486 )
4487 {
4488 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4489 if (token == NULL) {
4490 return NULL;
4491 }
4492 int end_lineno = token->end_lineno;
4493 UNUSED(end_lineno); // Only used by EXTRA macro
4494 int end_col_offset = token->end_col_offset;
4495 UNUSED(end_col_offset); // Only used by EXTRA macro
4496 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
4497 if (res == NULL && PyErr_Occurred()) {
4498 p->error_indicator = 1;
4499 return NULL;
4500 }
4501 goto done;
4502 }
4503 p->mark = mark;
4504 }
4505 { // star_expression ','
4506 expr_ty a;
4507 void *literal;
4508 if (
4509 (a = star_expression_rule(p))
4510 &&
4511 (literal = _PyPegen_expect_token(p, 12))
4512 )
4513 {
4514 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4515 if (token == NULL) {
4516 return NULL;
4517 }
4518 int end_lineno = token->end_lineno;
4519 UNUSED(end_lineno); // Only used by EXTRA macro
4520 int end_col_offset = token->end_col_offset;
4521 UNUSED(end_col_offset); // Only used by EXTRA macro
4522 res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
4523 if (res == NULL && PyErr_Occurred()) {
4524 p->error_indicator = 1;
4525 return NULL;
4526 }
4527 goto done;
4528 }
4529 p->mark = mark;
4530 }
4531 { // star_expression
4532 expr_ty star_expression_var;
4533 if (
4534 (star_expression_var = star_expression_rule(p))
4535 )
4536 {
4537 res = star_expression_var;
4538 goto done;
4539 }
4540 p->mark = mark;
4541 }
4542 res = NULL;
4543 done:
4544 return res;
4545}
4546
4547// star_expression: '*' bitwise_or | expression
4548static expr_ty
4549star_expression_rule(Parser *p)
4550{
4551 if (p->error_indicator) {
4552 return NULL;
4553 }
4554 expr_ty res = NULL;
4555 if (_PyPegen_is_memoized(p, star_expression_type, &res))
4556 return res;
4557 int mark = p->mark;
4558 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4559 p->error_indicator = 1;
4560 return NULL;
4561 }
4562 int start_lineno = p->tokens[mark]->lineno;
4563 UNUSED(start_lineno); // Only used by EXTRA macro
4564 int start_col_offset = p->tokens[mark]->col_offset;
4565 UNUSED(start_col_offset); // Only used by EXTRA macro
4566 { // '*' bitwise_or
4567 expr_ty a;
4568 void *literal;
4569 if (
4570 (literal = _PyPegen_expect_token(p, 16))
4571 &&
4572 (a = bitwise_or_rule(p))
4573 )
4574 {
4575 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4576 if (token == NULL) {
4577 return NULL;
4578 }
4579 int end_lineno = token->end_lineno;
4580 UNUSED(end_lineno); // Only used by EXTRA macro
4581 int end_col_offset = token->end_col_offset;
4582 UNUSED(end_col_offset); // Only used by EXTRA macro
4583 res = _Py_Starred ( a , Load , EXTRA );
4584 if (res == NULL && PyErr_Occurred()) {
4585 p->error_indicator = 1;
4586 return NULL;
4587 }
4588 goto done;
4589 }
4590 p->mark = mark;
4591 }
4592 { // expression
4593 expr_ty expression_var;
4594 if (
4595 (expression_var = expression_rule(p))
4596 )
4597 {
4598 res = expression_var;
4599 goto done;
4600 }
4601 p->mark = mark;
4602 }
4603 res = NULL;
4604 done:
4605 _PyPegen_insert_memo(p, mark, star_expression_type, res);
4606 return res;
4607}
4608
4609// star_named_expressions: ','.star_named_expression+ ','?
4610static asdl_seq*
4611star_named_expressions_rule(Parser *p)
4612{
4613 if (p->error_indicator) {
4614 return NULL;
4615 }
4616 asdl_seq* res = NULL;
4617 int mark = p->mark;
4618 { // ','.star_named_expression+ ','?
4619 asdl_seq * a;
4620 void *opt_var;
4621 UNUSED(opt_var); // Silence compiler warnings
4622 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004623 (a = _gather_67_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004624 &&
4625 (opt_var = _PyPegen_expect_token(p, 12), 1)
4626 )
4627 {
4628 res = a;
4629 if (res == NULL && PyErr_Occurred()) {
4630 p->error_indicator = 1;
4631 return NULL;
4632 }
4633 goto done;
4634 }
4635 p->mark = mark;
4636 }
4637 res = NULL;
4638 done:
4639 return res;
4640}
4641
4642// star_named_expression: '*' bitwise_or | named_expression
4643static expr_ty
4644star_named_expression_rule(Parser *p)
4645{
4646 if (p->error_indicator) {
4647 return NULL;
4648 }
4649 expr_ty res = NULL;
4650 int mark = p->mark;
4651 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4652 p->error_indicator = 1;
4653 return NULL;
4654 }
4655 int start_lineno = p->tokens[mark]->lineno;
4656 UNUSED(start_lineno); // Only used by EXTRA macro
4657 int start_col_offset = p->tokens[mark]->col_offset;
4658 UNUSED(start_col_offset); // Only used by EXTRA macro
4659 { // '*' bitwise_or
4660 expr_ty a;
4661 void *literal;
4662 if (
4663 (literal = _PyPegen_expect_token(p, 16))
4664 &&
4665 (a = bitwise_or_rule(p))
4666 )
4667 {
4668 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4669 if (token == NULL) {
4670 return NULL;
4671 }
4672 int end_lineno = token->end_lineno;
4673 UNUSED(end_lineno); // Only used by EXTRA macro
4674 int end_col_offset = token->end_col_offset;
4675 UNUSED(end_col_offset); // Only used by EXTRA macro
4676 res = _Py_Starred ( a , Load , EXTRA );
4677 if (res == NULL && PyErr_Occurred()) {
4678 p->error_indicator = 1;
4679 return NULL;
4680 }
4681 goto done;
4682 }
4683 p->mark = mark;
4684 }
4685 { // named_expression
4686 expr_ty named_expression_var;
4687 if (
4688 (named_expression_var = named_expression_rule(p))
4689 )
4690 {
4691 res = named_expression_var;
4692 goto done;
4693 }
4694 p->mark = mark;
4695 }
4696 res = NULL;
4697 done:
4698 return res;
4699}
4700
4701// named_expression: NAME ':=' expression | expression !':=' | invalid_named_expression
4702static expr_ty
4703named_expression_rule(Parser *p)
4704{
4705 if (p->error_indicator) {
4706 return NULL;
4707 }
4708 expr_ty res = NULL;
4709 int mark = p->mark;
4710 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4711 p->error_indicator = 1;
4712 return NULL;
4713 }
4714 int start_lineno = p->tokens[mark]->lineno;
4715 UNUSED(start_lineno); // Only used by EXTRA macro
4716 int start_col_offset = p->tokens[mark]->col_offset;
4717 UNUSED(start_col_offset); // Only used by EXTRA macro
4718 { // NAME ':=' expression
4719 expr_ty a;
4720 expr_ty b;
4721 void *literal;
4722 if (
4723 (a = _PyPegen_name_token(p))
4724 &&
4725 (literal = _PyPegen_expect_token(p, 53))
4726 &&
4727 (b = expression_rule(p))
4728 )
4729 {
4730 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4731 if (token == NULL) {
4732 return NULL;
4733 }
4734 int end_lineno = token->end_lineno;
4735 UNUSED(end_lineno); // Only used by EXTRA macro
4736 int end_col_offset = token->end_col_offset;
4737 UNUSED(end_col_offset); // Only used by EXTRA macro
4738 res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
4739 if (res == NULL && PyErr_Occurred()) {
4740 p->error_indicator = 1;
4741 return NULL;
4742 }
4743 goto done;
4744 }
4745 p->mark = mark;
4746 }
4747 { // expression !':='
4748 expr_ty expression_var;
4749 if (
4750 (expression_var = expression_rule(p))
4751 &&
4752 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53)
4753 )
4754 {
4755 res = expression_var;
4756 goto done;
4757 }
4758 p->mark = mark;
4759 }
4760 { // invalid_named_expression
4761 void *invalid_named_expression_var;
4762 if (
4763 (invalid_named_expression_var = invalid_named_expression_rule(p))
4764 )
4765 {
4766 res = invalid_named_expression_var;
4767 goto done;
4768 }
4769 p->mark = mark;
4770 }
4771 res = NULL;
4772 done:
4773 return res;
4774}
4775
4776// annotated_rhs: yield_expr | star_expressions
4777static expr_ty
4778annotated_rhs_rule(Parser *p)
4779{
4780 if (p->error_indicator) {
4781 return NULL;
4782 }
4783 expr_ty res = NULL;
4784 int mark = p->mark;
4785 { // yield_expr
4786 expr_ty yield_expr_var;
4787 if (
4788 (yield_expr_var = yield_expr_rule(p))
4789 )
4790 {
4791 res = yield_expr_var;
4792 goto done;
4793 }
4794 p->mark = mark;
4795 }
4796 { // star_expressions
4797 expr_ty star_expressions_var;
4798 if (
4799 (star_expressions_var = star_expressions_rule(p))
4800 )
4801 {
4802 res = star_expressions_var;
4803 goto done;
4804 }
4805 p->mark = mark;
4806 }
4807 res = NULL;
4808 done:
4809 return res;
4810}
4811
4812// expressions: expression ((',' expression))+ ','? | expression ',' | expression
4813static expr_ty
4814expressions_rule(Parser *p)
4815{
4816 if (p->error_indicator) {
4817 return NULL;
4818 }
4819 expr_ty res = NULL;
4820 int mark = p->mark;
4821 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4822 p->error_indicator = 1;
4823 return NULL;
4824 }
4825 int start_lineno = p->tokens[mark]->lineno;
4826 UNUSED(start_lineno); // Only used by EXTRA macro
4827 int start_col_offset = p->tokens[mark]->col_offset;
4828 UNUSED(start_col_offset); // Only used by EXTRA macro
4829 { // expression ((',' expression))+ ','?
4830 expr_ty a;
4831 asdl_seq * b;
4832 void *opt_var;
4833 UNUSED(opt_var); // Silence compiler warnings
4834 if (
4835 (a = expression_rule(p))
4836 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004837 (b = _loop1_69_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004838 &&
4839 (opt_var = _PyPegen_expect_token(p, 12), 1)
4840 )
4841 {
4842 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4843 if (token == NULL) {
4844 return NULL;
4845 }
4846 int end_lineno = token->end_lineno;
4847 UNUSED(end_lineno); // Only used by EXTRA macro
4848 int end_col_offset = token->end_col_offset;
4849 UNUSED(end_col_offset); // Only used by EXTRA macro
4850 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
4851 if (res == NULL && PyErr_Occurred()) {
4852 p->error_indicator = 1;
4853 return NULL;
4854 }
4855 goto done;
4856 }
4857 p->mark = mark;
4858 }
4859 { // expression ','
4860 expr_ty a;
4861 void *literal;
4862 if (
4863 (a = expression_rule(p))
4864 &&
4865 (literal = _PyPegen_expect_token(p, 12))
4866 )
4867 {
4868 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4869 if (token == NULL) {
4870 return NULL;
4871 }
4872 int end_lineno = token->end_lineno;
4873 UNUSED(end_lineno); // Only used by EXTRA macro
4874 int end_col_offset = token->end_col_offset;
4875 UNUSED(end_col_offset); // Only used by EXTRA macro
4876 res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
4877 if (res == NULL && PyErr_Occurred()) {
4878 p->error_indicator = 1;
4879 return NULL;
4880 }
4881 goto done;
4882 }
4883 p->mark = mark;
4884 }
4885 { // expression
4886 expr_ty expression_var;
4887 if (
4888 (expression_var = expression_rule(p))
4889 )
4890 {
4891 res = expression_var;
4892 goto done;
4893 }
4894 p->mark = mark;
4895 }
4896 res = NULL;
4897 done:
4898 return res;
4899}
4900
4901// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
4902static expr_ty
4903expression_rule(Parser *p)
4904{
4905 if (p->error_indicator) {
4906 return NULL;
4907 }
4908 expr_ty res = NULL;
4909 if (_PyPegen_is_memoized(p, expression_type, &res))
4910 return res;
4911 int mark = p->mark;
4912 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4913 p->error_indicator = 1;
4914 return NULL;
4915 }
4916 int start_lineno = p->tokens[mark]->lineno;
4917 UNUSED(start_lineno); // Only used by EXTRA macro
4918 int start_col_offset = p->tokens[mark]->col_offset;
4919 UNUSED(start_col_offset); // Only used by EXTRA macro
4920 { // disjunction 'if' disjunction 'else' expression
4921 expr_ty a;
4922 expr_ty b;
4923 expr_ty c;
4924 void *keyword;
4925 void *keyword_1;
4926 if (
4927 (a = disjunction_rule(p))
4928 &&
4929 (keyword = _PyPegen_expect_token(p, 510))
4930 &&
4931 (b = disjunction_rule(p))
4932 &&
4933 (keyword_1 = _PyPegen_expect_token(p, 516))
4934 &&
4935 (c = expression_rule(p))
4936 )
4937 {
4938 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4939 if (token == NULL) {
4940 return NULL;
4941 }
4942 int end_lineno = token->end_lineno;
4943 UNUSED(end_lineno); // Only used by EXTRA macro
4944 int end_col_offset = token->end_col_offset;
4945 UNUSED(end_col_offset); // Only used by EXTRA macro
4946 res = _Py_IfExp ( b , a , c , EXTRA );
4947 if (res == NULL && PyErr_Occurred()) {
4948 p->error_indicator = 1;
4949 return NULL;
4950 }
4951 goto done;
4952 }
4953 p->mark = mark;
4954 }
4955 { // disjunction
4956 expr_ty disjunction_var;
4957 if (
4958 (disjunction_var = disjunction_rule(p))
4959 )
4960 {
4961 res = disjunction_var;
4962 goto done;
4963 }
4964 p->mark = mark;
4965 }
4966 { // lambdef
4967 expr_ty lambdef_var;
4968 if (
4969 (lambdef_var = lambdef_rule(p))
4970 )
4971 {
4972 res = lambdef_var;
4973 goto done;
4974 }
4975 p->mark = mark;
4976 }
4977 res = NULL;
4978 done:
4979 _PyPegen_insert_memo(p, mark, expression_type, res);
4980 return res;
4981}
4982
4983// lambdef: 'lambda' lambda_parameters? ':' expression
4984static expr_ty
4985lambdef_rule(Parser *p)
4986{
4987 if (p->error_indicator) {
4988 return NULL;
4989 }
4990 expr_ty res = NULL;
4991 int mark = p->mark;
4992 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4993 p->error_indicator = 1;
4994 return NULL;
4995 }
4996 int start_lineno = p->tokens[mark]->lineno;
4997 UNUSED(start_lineno); // Only used by EXTRA macro
4998 int start_col_offset = p->tokens[mark]->col_offset;
4999 UNUSED(start_col_offset); // Only used by EXTRA macro
5000 { // 'lambda' lambda_parameters? ':' expression
5001 void *a;
5002 expr_ty b;
5003 void *keyword;
5004 void *literal;
5005 if (
5006 (keyword = _PyPegen_expect_token(p, 524))
5007 &&
5008 (a = lambda_parameters_rule(p), 1)
5009 &&
5010 (literal = _PyPegen_expect_token(p, 11))
5011 &&
5012 (b = expression_rule(p))
5013 )
5014 {
5015 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5016 if (token == NULL) {
5017 return NULL;
5018 }
5019 int end_lineno = token->end_lineno;
5020 UNUSED(end_lineno); // Only used by EXTRA macro
5021 int end_col_offset = token->end_col_offset;
5022 UNUSED(end_col_offset); // Only used by EXTRA macro
5023 res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
5024 if (res == NULL && PyErr_Occurred()) {
5025 p->error_indicator = 1;
5026 return NULL;
5027 }
5028 goto done;
5029 }
5030 p->mark = mark;
5031 }
5032 res = NULL;
5033 done:
5034 return res;
5035}
5036
5037// lambda_parameters:
5038// | lambda_slash_without_default [',' lambda_plain_names] [',' lambda_names_with_default] [',' lambda_star_etc?]
5039// | lambda_slash_with_default [',' lambda_names_with_default] [',' lambda_star_etc?]
5040// | lambda_plain_names [',' lambda_names_with_default] [',' lambda_star_etc?]
5041// | lambda_names_with_default [',' lambda_star_etc?]
5042// | lambda_star_etc
5043static arguments_ty
5044lambda_parameters_rule(Parser *p)
5045{
5046 if (p->error_indicator) {
5047 return NULL;
5048 }
5049 arguments_ty res = NULL;
5050 int mark = p->mark;
5051 { // lambda_slash_without_default [',' lambda_plain_names] [',' lambda_names_with_default] [',' lambda_star_etc?]
5052 asdl_seq* a;
5053 void *b;
5054 void *c;
5055 void *d;
5056 if (
5057 (a = lambda_slash_without_default_rule(p))
5058 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005059 (b = _tmp_70_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005060 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005061 (c = _tmp_71_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005062 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005063 (d = _tmp_72_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005064 )
5065 {
5066 res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
5067 if (res == NULL && PyErr_Occurred()) {
5068 p->error_indicator = 1;
5069 return NULL;
5070 }
5071 goto done;
5072 }
5073 p->mark = mark;
5074 }
5075 { // lambda_slash_with_default [',' lambda_names_with_default] [',' lambda_star_etc?]
5076 SlashWithDefault* a;
5077 void *b;
5078 void *c;
5079 if (
5080 (a = lambda_slash_with_default_rule(p))
5081 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005082 (b = _tmp_73_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005083 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005084 (c = _tmp_74_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005085 )
5086 {
5087 res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
5088 if (res == NULL && PyErr_Occurred()) {
5089 p->error_indicator = 1;
5090 return NULL;
5091 }
5092 goto done;
5093 }
5094 p->mark = mark;
5095 }
5096 { // lambda_plain_names [',' lambda_names_with_default] [',' lambda_star_etc?]
5097 asdl_seq* a;
5098 void *b;
5099 void *c;
5100 if (
5101 (a = lambda_plain_names_rule(p))
5102 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005103 (b = _tmp_75_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005104 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005105 (c = _tmp_76_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005106 )
5107 {
5108 res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
5109 if (res == NULL && PyErr_Occurred()) {
5110 p->error_indicator = 1;
5111 return NULL;
5112 }
5113 goto done;
5114 }
5115 p->mark = mark;
5116 }
5117 { // lambda_names_with_default [',' lambda_star_etc?]
5118 asdl_seq* a;
5119 void *b;
5120 if (
5121 (a = lambda_names_with_default_rule(p))
5122 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005123 (b = _tmp_77_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005124 )
5125 {
5126 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
5127 if (res == NULL && PyErr_Occurred()) {
5128 p->error_indicator = 1;
5129 return NULL;
5130 }
5131 goto done;
5132 }
5133 p->mark = mark;
5134 }
5135 { // lambda_star_etc
5136 StarEtc* a;
5137 if (
5138 (a = lambda_star_etc_rule(p))
5139 )
5140 {
5141 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
5142 if (res == NULL && PyErr_Occurred()) {
5143 p->error_indicator = 1;
5144 return NULL;
5145 }
5146 goto done;
5147 }
5148 p->mark = mark;
5149 }
5150 res = NULL;
5151 done:
5152 return res;
5153}
5154
5155// lambda_slash_without_default: lambda_plain_names ',' '/'
5156static asdl_seq*
5157lambda_slash_without_default_rule(Parser *p)
5158{
5159 if (p->error_indicator) {
5160 return NULL;
5161 }
5162 asdl_seq* res = NULL;
5163 int mark = p->mark;
5164 { // lambda_plain_names ',' '/'
5165 asdl_seq* a;
5166 void *literal;
5167 void *literal_1;
5168 if (
5169 (a = lambda_plain_names_rule(p))
5170 &&
5171 (literal = _PyPegen_expect_token(p, 12))
5172 &&
5173 (literal_1 = _PyPegen_expect_token(p, 17))
5174 )
5175 {
5176 res = a;
5177 if (res == NULL && PyErr_Occurred()) {
5178 p->error_indicator = 1;
5179 return NULL;
5180 }
5181 goto done;
5182 }
5183 p->mark = mark;
5184 }
5185 res = NULL;
5186 done:
5187 return res;
5188}
5189
5190// lambda_slash_with_default: [lambda_plain_names ','] lambda_names_with_default ',' '/'
5191static SlashWithDefault*
5192lambda_slash_with_default_rule(Parser *p)
5193{
5194 if (p->error_indicator) {
5195 return NULL;
5196 }
5197 SlashWithDefault* res = NULL;
5198 int mark = p->mark;
5199 { // [lambda_plain_names ','] lambda_names_with_default ',' '/'
5200 void *a;
5201 asdl_seq* b;
5202 void *literal;
5203 void *literal_1;
5204 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07005205 (a = _tmp_78_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005206 &&
5207 (b = lambda_names_with_default_rule(p))
5208 &&
5209 (literal = _PyPegen_expect_token(p, 12))
5210 &&
5211 (literal_1 = _PyPegen_expect_token(p, 17))
5212 )
5213 {
5214 res = _PyPegen_slash_with_default ( p , a , b );
5215 if (res == NULL && PyErr_Occurred()) {
5216 p->error_indicator = 1;
5217 return NULL;
5218 }
5219 goto done;
5220 }
5221 p->mark = mark;
5222 }
5223 res = NULL;
5224 done:
5225 return res;
5226}
5227
5228// lambda_star_etc:
5229// | '*' lambda_plain_name lambda_name_with_optional_default* [',' lambda_kwds] ','?
5230// | '*' lambda_name_with_optional_default+ [',' lambda_kwds] ','?
5231// | lambda_kwds ','?
5232static StarEtc*
5233lambda_star_etc_rule(Parser *p)
5234{
5235 if (p->error_indicator) {
5236 return NULL;
5237 }
5238 StarEtc* res = NULL;
5239 int mark = p->mark;
5240 { // '*' lambda_plain_name lambda_name_with_optional_default* [',' lambda_kwds] ','?
5241 arg_ty a;
5242 asdl_seq * b;
5243 void *c;
5244 void *literal;
5245 void *opt_var;
5246 UNUSED(opt_var); // Silence compiler warnings
5247 if (
5248 (literal = _PyPegen_expect_token(p, 16))
5249 &&
5250 (a = lambda_plain_name_rule(p))
5251 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005252 (b = _loop0_79_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005253 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005254 (c = _tmp_80_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005255 &&
5256 (opt_var = _PyPegen_expect_token(p, 12), 1)
5257 )
5258 {
5259 res = _PyPegen_star_etc ( p , a , b , c );
5260 if (res == NULL && PyErr_Occurred()) {
5261 p->error_indicator = 1;
5262 return NULL;
5263 }
5264 goto done;
5265 }
5266 p->mark = mark;
5267 }
5268 { // '*' lambda_name_with_optional_default+ [',' lambda_kwds] ','?
5269 asdl_seq * b;
5270 void *c;
5271 void *literal;
5272 void *opt_var;
5273 UNUSED(opt_var); // Silence compiler warnings
5274 if (
5275 (literal = _PyPegen_expect_token(p, 16))
5276 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005277 (b = _loop1_81_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005278 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005279 (c = _tmp_82_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005280 &&
5281 (opt_var = _PyPegen_expect_token(p, 12), 1)
5282 )
5283 {
5284 res = _PyPegen_star_etc ( p , NULL , b , c );
5285 if (res == NULL && PyErr_Occurred()) {
5286 p->error_indicator = 1;
5287 return NULL;
5288 }
5289 goto done;
5290 }
5291 p->mark = mark;
5292 }
5293 { // lambda_kwds ','?
5294 arg_ty a;
5295 void *opt_var;
5296 UNUSED(opt_var); // Silence compiler warnings
5297 if (
5298 (a = lambda_kwds_rule(p))
5299 &&
5300 (opt_var = _PyPegen_expect_token(p, 12), 1)
5301 )
5302 {
5303 res = _PyPegen_star_etc ( p , NULL , NULL , a );
5304 if (res == NULL && PyErr_Occurred()) {
5305 p->error_indicator = 1;
5306 return NULL;
5307 }
5308 goto done;
5309 }
5310 p->mark = mark;
5311 }
5312 res = NULL;
5313 done:
5314 return res;
5315}
5316
5317// lambda_name_with_optional_default: ',' lambda_plain_name ['=' expression]
5318static NameDefaultPair*
5319lambda_name_with_optional_default_rule(Parser *p)
5320{
5321 if (p->error_indicator) {
5322 return NULL;
5323 }
5324 NameDefaultPair* res = NULL;
5325 int mark = p->mark;
5326 { // ',' lambda_plain_name ['=' expression]
5327 arg_ty a;
5328 void *b;
5329 void *literal;
5330 if (
5331 (literal = _PyPegen_expect_token(p, 12))
5332 &&
5333 (a = lambda_plain_name_rule(p))
5334 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005335 (b = _tmp_83_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005336 )
5337 {
Guido van Rossumc001c092020-04-30 12:12:19 -07005338 res = _PyPegen_name_default_pair ( p , a , b , NULL );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005339 if (res == NULL && PyErr_Occurred()) {
5340 p->error_indicator = 1;
5341 return NULL;
5342 }
5343 goto done;
5344 }
5345 p->mark = mark;
5346 }
5347 res = NULL;
5348 done:
5349 return res;
5350}
5351
5352// lambda_names_with_default: ','.lambda_name_with_default+
5353static asdl_seq*
5354lambda_names_with_default_rule(Parser *p)
5355{
5356 if (p->error_indicator) {
5357 return NULL;
5358 }
5359 asdl_seq* res = NULL;
5360 int mark = p->mark;
5361 { // ','.lambda_name_with_default+
5362 asdl_seq * a;
5363 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07005364 (a = _gather_84_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005365 )
5366 {
5367 res = a;
5368 if (res == NULL && PyErr_Occurred()) {
5369 p->error_indicator = 1;
5370 return NULL;
5371 }
5372 goto done;
5373 }
5374 p->mark = mark;
5375 }
5376 res = NULL;
5377 done:
5378 return res;
5379}
5380
5381// lambda_name_with_default: lambda_plain_name '=' expression
5382static NameDefaultPair*
5383lambda_name_with_default_rule(Parser *p)
5384{
5385 if (p->error_indicator) {
5386 return NULL;
5387 }
5388 NameDefaultPair* res = NULL;
5389 int mark = p->mark;
5390 { // lambda_plain_name '=' expression
5391 expr_ty e;
5392 void *literal;
5393 arg_ty n;
5394 if (
5395 (n = lambda_plain_name_rule(p))
5396 &&
5397 (literal = _PyPegen_expect_token(p, 22))
5398 &&
5399 (e = expression_rule(p))
5400 )
5401 {
Guido van Rossumc001c092020-04-30 12:12:19 -07005402 res = _PyPegen_name_default_pair ( p , n , e , NULL );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005403 if (res == NULL && PyErr_Occurred()) {
5404 p->error_indicator = 1;
5405 return NULL;
5406 }
5407 goto done;
5408 }
5409 p->mark = mark;
5410 }
5411 res = NULL;
5412 done:
5413 return res;
5414}
5415
5416// lambda_plain_names: ','.(lambda_plain_name !'=')+
5417static asdl_seq*
5418lambda_plain_names_rule(Parser *p)
5419{
5420 if (p->error_indicator) {
5421 return NULL;
5422 }
5423 asdl_seq* res = NULL;
5424 int mark = p->mark;
5425 { // ','.(lambda_plain_name !'=')+
5426 asdl_seq * a;
5427 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07005428 (a = _gather_86_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005429 )
5430 {
5431 res = a;
5432 if (res == NULL && PyErr_Occurred()) {
5433 p->error_indicator = 1;
5434 return NULL;
5435 }
5436 goto done;
5437 }
5438 p->mark = mark;
5439 }
5440 res = NULL;
5441 done:
5442 return res;
5443}
5444
5445// lambda_plain_name: NAME
5446static arg_ty
5447lambda_plain_name_rule(Parser *p)
5448{
5449 if (p->error_indicator) {
5450 return NULL;
5451 }
5452 arg_ty res = NULL;
5453 int mark = p->mark;
5454 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5455 p->error_indicator = 1;
5456 return NULL;
5457 }
5458 int start_lineno = p->tokens[mark]->lineno;
5459 UNUSED(start_lineno); // Only used by EXTRA macro
5460 int start_col_offset = p->tokens[mark]->col_offset;
5461 UNUSED(start_col_offset); // Only used by EXTRA macro
5462 { // NAME
5463 expr_ty a;
5464 if (
5465 (a = _PyPegen_name_token(p))
5466 )
5467 {
5468 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5469 if (token == NULL) {
5470 return NULL;
5471 }
5472 int end_lineno = token->end_lineno;
5473 UNUSED(end_lineno); // Only used by EXTRA macro
5474 int end_col_offset = token->end_col_offset;
5475 UNUSED(end_col_offset); // Only used by EXTRA macro
5476 res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
5477 if (res == NULL && PyErr_Occurred()) {
5478 p->error_indicator = 1;
5479 return NULL;
5480 }
5481 goto done;
5482 }
5483 p->mark = mark;
5484 }
5485 res = NULL;
5486 done:
5487 return res;
5488}
5489
5490// lambda_kwds: '**' lambda_plain_name
5491static arg_ty
5492lambda_kwds_rule(Parser *p)
5493{
5494 if (p->error_indicator) {
5495 return NULL;
5496 }
5497 arg_ty res = NULL;
5498 int mark = p->mark;
5499 { // '**' lambda_plain_name
5500 arg_ty a;
5501 void *literal;
5502 if (
5503 (literal = _PyPegen_expect_token(p, 35))
5504 &&
5505 (a = lambda_plain_name_rule(p))
5506 )
5507 {
5508 res = a;
5509 if (res == NULL && PyErr_Occurred()) {
5510 p->error_indicator = 1;
5511 return NULL;
5512 }
5513 goto done;
5514 }
5515 p->mark = mark;
5516 }
5517 res = NULL;
5518 done:
5519 return res;
5520}
5521
5522// disjunction: conjunction (('or' conjunction))+ | conjunction
5523static expr_ty
5524disjunction_rule(Parser *p)
5525{
5526 if (p->error_indicator) {
5527 return NULL;
5528 }
5529 expr_ty res = NULL;
5530 if (_PyPegen_is_memoized(p, disjunction_type, &res))
5531 return res;
5532 int mark = p->mark;
5533 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5534 p->error_indicator = 1;
5535 return NULL;
5536 }
5537 int start_lineno = p->tokens[mark]->lineno;
5538 UNUSED(start_lineno); // Only used by EXTRA macro
5539 int start_col_offset = p->tokens[mark]->col_offset;
5540 UNUSED(start_col_offset); // Only used by EXTRA macro
5541 { // conjunction (('or' conjunction))+
5542 expr_ty a;
5543 asdl_seq * b;
5544 if (
5545 (a = conjunction_rule(p))
5546 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005547 (b = _loop1_88_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005548 )
5549 {
5550 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5551 if (token == NULL) {
5552 return NULL;
5553 }
5554 int end_lineno = token->end_lineno;
5555 UNUSED(end_lineno); // Only used by EXTRA macro
5556 int end_col_offset = token->end_col_offset;
5557 UNUSED(end_col_offset); // Only used by EXTRA macro
5558 res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
5559 if (res == NULL && PyErr_Occurred()) {
5560 p->error_indicator = 1;
5561 return NULL;
5562 }
5563 goto done;
5564 }
5565 p->mark = mark;
5566 }
5567 { // conjunction
5568 expr_ty conjunction_var;
5569 if (
5570 (conjunction_var = conjunction_rule(p))
5571 )
5572 {
5573 res = conjunction_var;
5574 goto done;
5575 }
5576 p->mark = mark;
5577 }
5578 res = NULL;
5579 done:
5580 _PyPegen_insert_memo(p, mark, disjunction_type, res);
5581 return res;
5582}
5583
5584// conjunction: inversion (('and' inversion))+ | inversion
5585static expr_ty
5586conjunction_rule(Parser *p)
5587{
5588 if (p->error_indicator) {
5589 return NULL;
5590 }
5591 expr_ty res = NULL;
5592 if (_PyPegen_is_memoized(p, conjunction_type, &res))
5593 return res;
5594 int mark = p->mark;
5595 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5596 p->error_indicator = 1;
5597 return NULL;
5598 }
5599 int start_lineno = p->tokens[mark]->lineno;
5600 UNUSED(start_lineno); // Only used by EXTRA macro
5601 int start_col_offset = p->tokens[mark]->col_offset;
5602 UNUSED(start_col_offset); // Only used by EXTRA macro
5603 { // inversion (('and' inversion))+
5604 expr_ty a;
5605 asdl_seq * b;
5606 if (
5607 (a = inversion_rule(p))
5608 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005609 (b = _loop1_89_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005610 )
5611 {
5612 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5613 if (token == NULL) {
5614 return NULL;
5615 }
5616 int end_lineno = token->end_lineno;
5617 UNUSED(end_lineno); // Only used by EXTRA macro
5618 int end_col_offset = token->end_col_offset;
5619 UNUSED(end_col_offset); // Only used by EXTRA macro
5620 res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
5621 if (res == NULL && PyErr_Occurred()) {
5622 p->error_indicator = 1;
5623 return NULL;
5624 }
5625 goto done;
5626 }
5627 p->mark = mark;
5628 }
5629 { // inversion
5630 expr_ty inversion_var;
5631 if (
5632 (inversion_var = inversion_rule(p))
5633 )
5634 {
5635 res = inversion_var;
5636 goto done;
5637 }
5638 p->mark = mark;
5639 }
5640 res = NULL;
5641 done:
5642 _PyPegen_insert_memo(p, mark, conjunction_type, res);
5643 return res;
5644}
5645
5646// inversion: 'not' inversion | comparison
5647static expr_ty
5648inversion_rule(Parser *p)
5649{
5650 if (p->error_indicator) {
5651 return NULL;
5652 }
5653 expr_ty res = NULL;
5654 if (_PyPegen_is_memoized(p, inversion_type, &res))
5655 return res;
5656 int mark = p->mark;
5657 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5658 p->error_indicator = 1;
5659 return NULL;
5660 }
5661 int start_lineno = p->tokens[mark]->lineno;
5662 UNUSED(start_lineno); // Only used by EXTRA macro
5663 int start_col_offset = p->tokens[mark]->col_offset;
5664 UNUSED(start_col_offset); // Only used by EXTRA macro
5665 { // 'not' inversion
5666 expr_ty a;
5667 void *keyword;
5668 if (
5669 (keyword = _PyPegen_expect_token(p, 525))
5670 &&
5671 (a = inversion_rule(p))
5672 )
5673 {
5674 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5675 if (token == NULL) {
5676 return NULL;
5677 }
5678 int end_lineno = token->end_lineno;
5679 UNUSED(end_lineno); // Only used by EXTRA macro
5680 int end_col_offset = token->end_col_offset;
5681 UNUSED(end_col_offset); // Only used by EXTRA macro
5682 res = _Py_UnaryOp ( Not , a , EXTRA );
5683 if (res == NULL && PyErr_Occurred()) {
5684 p->error_indicator = 1;
5685 return NULL;
5686 }
5687 goto done;
5688 }
5689 p->mark = mark;
5690 }
5691 { // comparison
5692 expr_ty comparison_var;
5693 if (
5694 (comparison_var = comparison_rule(p))
5695 )
5696 {
5697 res = comparison_var;
5698 goto done;
5699 }
5700 p->mark = mark;
5701 }
5702 res = NULL;
5703 done:
5704 _PyPegen_insert_memo(p, mark, inversion_type, res);
5705 return res;
5706}
5707
5708// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
5709static expr_ty
5710comparison_rule(Parser *p)
5711{
5712 if (p->error_indicator) {
5713 return NULL;
5714 }
5715 expr_ty res = NULL;
5716 int mark = p->mark;
5717 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5718 p->error_indicator = 1;
5719 return NULL;
5720 }
5721 int start_lineno = p->tokens[mark]->lineno;
5722 UNUSED(start_lineno); // Only used by EXTRA macro
5723 int start_col_offset = p->tokens[mark]->col_offset;
5724 UNUSED(start_col_offset); // Only used by EXTRA macro
5725 { // bitwise_or compare_op_bitwise_or_pair+
5726 expr_ty a;
5727 asdl_seq * b;
5728 if (
5729 (a = bitwise_or_rule(p))
5730 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07005731 (b = _loop1_90_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005732 )
5733 {
5734 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5735 if (token == NULL) {
5736 return NULL;
5737 }
5738 int end_lineno = token->end_lineno;
5739 UNUSED(end_lineno); // Only used by EXTRA macro
5740 int end_col_offset = token->end_col_offset;
5741 UNUSED(end_col_offset); // Only used by EXTRA macro
5742 res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA );
5743 if (res == NULL && PyErr_Occurred()) {
5744 p->error_indicator = 1;
5745 return NULL;
5746 }
5747 goto done;
5748 }
5749 p->mark = mark;
5750 }
5751 { // bitwise_or
5752 expr_ty bitwise_or_var;
5753 if (
5754 (bitwise_or_var = bitwise_or_rule(p))
5755 )
5756 {
5757 res = bitwise_or_var;
5758 goto done;
5759 }
5760 p->mark = mark;
5761 }
5762 res = NULL;
5763 done:
5764 return res;
5765}
5766
5767// compare_op_bitwise_or_pair:
5768// | eq_bitwise_or
5769// | noteq_bitwise_or
5770// | lte_bitwise_or
5771// | lt_bitwise_or
5772// | gte_bitwise_or
5773// | gt_bitwise_or
5774// | notin_bitwise_or
5775// | in_bitwise_or
5776// | isnot_bitwise_or
5777// | is_bitwise_or
5778static CmpopExprPair*
5779compare_op_bitwise_or_pair_rule(Parser *p)
5780{
5781 if (p->error_indicator) {
5782 return NULL;
5783 }
5784 CmpopExprPair* res = NULL;
5785 int mark = p->mark;
5786 { // eq_bitwise_or
5787 CmpopExprPair* eq_bitwise_or_var;
5788 if (
5789 (eq_bitwise_or_var = eq_bitwise_or_rule(p))
5790 )
5791 {
5792 res = eq_bitwise_or_var;
5793 goto done;
5794 }
5795 p->mark = mark;
5796 }
5797 { // noteq_bitwise_or
5798 CmpopExprPair* noteq_bitwise_or_var;
5799 if (
5800 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p))
5801 )
5802 {
5803 res = noteq_bitwise_or_var;
5804 goto done;
5805 }
5806 p->mark = mark;
5807 }
5808 { // lte_bitwise_or
5809 CmpopExprPair* lte_bitwise_or_var;
5810 if (
5811 (lte_bitwise_or_var = lte_bitwise_or_rule(p))
5812 )
5813 {
5814 res = lte_bitwise_or_var;
5815 goto done;
5816 }
5817 p->mark = mark;
5818 }
5819 { // lt_bitwise_or
5820 CmpopExprPair* lt_bitwise_or_var;
5821 if (
5822 (lt_bitwise_or_var = lt_bitwise_or_rule(p))
5823 )
5824 {
5825 res = lt_bitwise_or_var;
5826 goto done;
5827 }
5828 p->mark = mark;
5829 }
5830 { // gte_bitwise_or
5831 CmpopExprPair* gte_bitwise_or_var;
5832 if (
5833 (gte_bitwise_or_var = gte_bitwise_or_rule(p))
5834 )
5835 {
5836 res = gte_bitwise_or_var;
5837 goto done;
5838 }
5839 p->mark = mark;
5840 }
5841 { // gt_bitwise_or
5842 CmpopExprPair* gt_bitwise_or_var;
5843 if (
5844 (gt_bitwise_or_var = gt_bitwise_or_rule(p))
5845 )
5846 {
5847 res = gt_bitwise_or_var;
5848 goto done;
5849 }
5850 p->mark = mark;
5851 }
5852 { // notin_bitwise_or
5853 CmpopExprPair* notin_bitwise_or_var;
5854 if (
5855 (notin_bitwise_or_var = notin_bitwise_or_rule(p))
5856 )
5857 {
5858 res = notin_bitwise_or_var;
5859 goto done;
5860 }
5861 p->mark = mark;
5862 }
5863 { // in_bitwise_or
5864 CmpopExprPair* in_bitwise_or_var;
5865 if (
5866 (in_bitwise_or_var = in_bitwise_or_rule(p))
5867 )
5868 {
5869 res = in_bitwise_or_var;
5870 goto done;
5871 }
5872 p->mark = mark;
5873 }
5874 { // isnot_bitwise_or
5875 CmpopExprPair* isnot_bitwise_or_var;
5876 if (
5877 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p))
5878 )
5879 {
5880 res = isnot_bitwise_or_var;
5881 goto done;
5882 }
5883 p->mark = mark;
5884 }
5885 { // is_bitwise_or
5886 CmpopExprPair* is_bitwise_or_var;
5887 if (
5888 (is_bitwise_or_var = is_bitwise_or_rule(p))
5889 )
5890 {
5891 res = is_bitwise_or_var;
5892 goto done;
5893 }
5894 p->mark = mark;
5895 }
5896 res = NULL;
5897 done:
5898 return res;
5899}
5900
5901// eq_bitwise_or: '==' bitwise_or
5902static CmpopExprPair*
5903eq_bitwise_or_rule(Parser *p)
5904{
5905 if (p->error_indicator) {
5906 return NULL;
5907 }
5908 CmpopExprPair* res = NULL;
5909 int mark = p->mark;
5910 { // '==' bitwise_or
5911 expr_ty a;
5912 void *literal;
5913 if (
5914 (literal = _PyPegen_expect_token(p, 27))
5915 &&
5916 (a = bitwise_or_rule(p))
5917 )
5918 {
5919 res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
5920 if (res == NULL && PyErr_Occurred()) {
5921 p->error_indicator = 1;
5922 return NULL;
5923 }
5924 goto done;
5925 }
5926 p->mark = mark;
5927 }
5928 res = NULL;
5929 done:
5930 return res;
5931}
5932
Pablo Galindo2b74c832020-04-27 18:02:07 +01005933// noteq_bitwise_or: ('!=') bitwise_or
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005934static CmpopExprPair*
5935noteq_bitwise_or_rule(Parser *p)
5936{
5937 if (p->error_indicator) {
5938 return NULL;
5939 }
5940 CmpopExprPair* res = NULL;
5941 int mark = p->mark;
Pablo Galindo2b74c832020-04-27 18:02:07 +01005942 { // ('!=') bitwise_or
Guido van Rossumc001c092020-04-30 12:12:19 -07005943 void *_tmp_91_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005944 expr_ty a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005945 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07005946 (_tmp_91_var = _tmp_91_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005947 &&
5948 (a = bitwise_or_rule(p))
5949 )
5950 {
5951 res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
5952 if (res == NULL && PyErr_Occurred()) {
5953 p->error_indicator = 1;
5954 return NULL;
5955 }
5956 goto done;
5957 }
5958 p->mark = mark;
5959 }
5960 res = NULL;
5961 done:
5962 return res;
5963}
5964
5965// lte_bitwise_or: '<=' bitwise_or
5966static CmpopExprPair*
5967lte_bitwise_or_rule(Parser *p)
5968{
5969 if (p->error_indicator) {
5970 return NULL;
5971 }
5972 CmpopExprPair* res = NULL;
5973 int mark = p->mark;
5974 { // '<=' bitwise_or
5975 expr_ty a;
5976 void *literal;
5977 if (
5978 (literal = _PyPegen_expect_token(p, 29))
5979 &&
5980 (a = bitwise_or_rule(p))
5981 )
5982 {
5983 res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
5984 if (res == NULL && PyErr_Occurred()) {
5985 p->error_indicator = 1;
5986 return NULL;
5987 }
5988 goto done;
5989 }
5990 p->mark = mark;
5991 }
5992 res = NULL;
5993 done:
5994 return res;
5995}
5996
5997// lt_bitwise_or: '<' bitwise_or
5998static CmpopExprPair*
5999lt_bitwise_or_rule(Parser *p)
6000{
6001 if (p->error_indicator) {
6002 return NULL;
6003 }
6004 CmpopExprPair* res = NULL;
6005 int mark = p->mark;
6006 { // '<' bitwise_or
6007 expr_ty a;
6008 void *literal;
6009 if (
6010 (literal = _PyPegen_expect_token(p, 20))
6011 &&
6012 (a = bitwise_or_rule(p))
6013 )
6014 {
6015 res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
6016 if (res == NULL && PyErr_Occurred()) {
6017 p->error_indicator = 1;
6018 return NULL;
6019 }
6020 goto done;
6021 }
6022 p->mark = mark;
6023 }
6024 res = NULL;
6025 done:
6026 return res;
6027}
6028
6029// gte_bitwise_or: '>=' bitwise_or
6030static CmpopExprPair*
6031gte_bitwise_or_rule(Parser *p)
6032{
6033 if (p->error_indicator) {
6034 return NULL;
6035 }
6036 CmpopExprPair* res = NULL;
6037 int mark = p->mark;
6038 { // '>=' bitwise_or
6039 expr_ty a;
6040 void *literal;
6041 if (
6042 (literal = _PyPegen_expect_token(p, 30))
6043 &&
6044 (a = bitwise_or_rule(p))
6045 )
6046 {
6047 res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
6048 if (res == NULL && PyErr_Occurred()) {
6049 p->error_indicator = 1;
6050 return NULL;
6051 }
6052 goto done;
6053 }
6054 p->mark = mark;
6055 }
6056 res = NULL;
6057 done:
6058 return res;
6059}
6060
6061// gt_bitwise_or: '>' bitwise_or
6062static CmpopExprPair*
6063gt_bitwise_or_rule(Parser *p)
6064{
6065 if (p->error_indicator) {
6066 return NULL;
6067 }
6068 CmpopExprPair* res = NULL;
6069 int mark = p->mark;
6070 { // '>' bitwise_or
6071 expr_ty a;
6072 void *literal;
6073 if (
6074 (literal = _PyPegen_expect_token(p, 21))
6075 &&
6076 (a = bitwise_or_rule(p))
6077 )
6078 {
6079 res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
6080 if (res == NULL && PyErr_Occurred()) {
6081 p->error_indicator = 1;
6082 return NULL;
6083 }
6084 goto done;
6085 }
6086 p->mark = mark;
6087 }
6088 res = NULL;
6089 done:
6090 return res;
6091}
6092
6093// notin_bitwise_or: 'not' 'in' bitwise_or
6094static CmpopExprPair*
6095notin_bitwise_or_rule(Parser *p)
6096{
6097 if (p->error_indicator) {
6098 return NULL;
6099 }
6100 CmpopExprPair* res = NULL;
6101 int mark = p->mark;
6102 { // 'not' 'in' bitwise_or
6103 expr_ty a;
6104 void *keyword;
6105 void *keyword_1;
6106 if (
6107 (keyword = _PyPegen_expect_token(p, 525))
6108 &&
6109 (keyword_1 = _PyPegen_expect_token(p, 518))
6110 &&
6111 (a = bitwise_or_rule(p))
6112 )
6113 {
6114 res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
6115 if (res == NULL && PyErr_Occurred()) {
6116 p->error_indicator = 1;
6117 return NULL;
6118 }
6119 goto done;
6120 }
6121 p->mark = mark;
6122 }
6123 res = NULL;
6124 done:
6125 return res;
6126}
6127
6128// in_bitwise_or: 'in' bitwise_or
6129static CmpopExprPair*
6130in_bitwise_or_rule(Parser *p)
6131{
6132 if (p->error_indicator) {
6133 return NULL;
6134 }
6135 CmpopExprPair* res = NULL;
6136 int mark = p->mark;
6137 { // 'in' bitwise_or
6138 expr_ty a;
6139 void *keyword;
6140 if (
6141 (keyword = _PyPegen_expect_token(p, 518))
6142 &&
6143 (a = bitwise_or_rule(p))
6144 )
6145 {
6146 res = _PyPegen_cmpop_expr_pair ( p , In , a );
6147 if (res == NULL && PyErr_Occurred()) {
6148 p->error_indicator = 1;
6149 return NULL;
6150 }
6151 goto done;
6152 }
6153 p->mark = mark;
6154 }
6155 res = NULL;
6156 done:
6157 return res;
6158}
6159
6160// isnot_bitwise_or: 'is' 'not' bitwise_or
6161static CmpopExprPair*
6162isnot_bitwise_or_rule(Parser *p)
6163{
6164 if (p->error_indicator) {
6165 return NULL;
6166 }
6167 CmpopExprPair* res = NULL;
6168 int mark = p->mark;
6169 { // 'is' 'not' bitwise_or
6170 expr_ty a;
6171 void *keyword;
6172 void *keyword_1;
6173 if (
6174 (keyword = _PyPegen_expect_token(p, 526))
6175 &&
6176 (keyword_1 = _PyPegen_expect_token(p, 525))
6177 &&
6178 (a = bitwise_or_rule(p))
6179 )
6180 {
6181 res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
6182 if (res == NULL && PyErr_Occurred()) {
6183 p->error_indicator = 1;
6184 return NULL;
6185 }
6186 goto done;
6187 }
6188 p->mark = mark;
6189 }
6190 res = NULL;
6191 done:
6192 return res;
6193}
6194
6195// is_bitwise_or: 'is' bitwise_or
6196static CmpopExprPair*
6197is_bitwise_or_rule(Parser *p)
6198{
6199 if (p->error_indicator) {
6200 return NULL;
6201 }
6202 CmpopExprPair* res = NULL;
6203 int mark = p->mark;
6204 { // 'is' bitwise_or
6205 expr_ty a;
6206 void *keyword;
6207 if (
6208 (keyword = _PyPegen_expect_token(p, 526))
6209 &&
6210 (a = bitwise_or_rule(p))
6211 )
6212 {
6213 res = _PyPegen_cmpop_expr_pair ( p , Is , a );
6214 if (res == NULL && PyErr_Occurred()) {
6215 p->error_indicator = 1;
6216 return NULL;
6217 }
6218 goto done;
6219 }
6220 p->mark = mark;
6221 }
6222 res = NULL;
6223 done:
6224 return res;
6225}
6226
6227// Left-recursive
6228// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
6229static expr_ty bitwise_or_raw(Parser *);
6230static expr_ty
6231bitwise_or_rule(Parser *p)
6232{
6233 expr_ty res = NULL;
6234 if (_PyPegen_is_memoized(p, bitwise_or_type, &res))
6235 return res;
6236 int mark = p->mark;
6237 int resmark = p->mark;
6238 while (1) {
6239 int tmpvar_1 = _PyPegen_update_memo(p, mark, bitwise_or_type, res);
6240 if (tmpvar_1) {
6241 return res;
6242 }
6243 p->mark = mark;
6244 void *raw = bitwise_or_raw(p);
6245 if (raw == NULL || p->mark <= resmark)
6246 break;
6247 resmark = p->mark;
6248 res = raw;
6249 }
6250 p->mark = resmark;
6251 return res;
6252}
6253static expr_ty
6254bitwise_or_raw(Parser *p)
6255{
6256 if (p->error_indicator) {
6257 return NULL;
6258 }
6259 expr_ty res = NULL;
6260 int mark = p->mark;
6261 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6262 p->error_indicator = 1;
6263 return NULL;
6264 }
6265 int start_lineno = p->tokens[mark]->lineno;
6266 UNUSED(start_lineno); // Only used by EXTRA macro
6267 int start_col_offset = p->tokens[mark]->col_offset;
6268 UNUSED(start_col_offset); // Only used by EXTRA macro
6269 { // bitwise_or '|' bitwise_xor
6270 expr_ty a;
6271 expr_ty b;
6272 void *literal;
6273 if (
6274 (a = bitwise_or_rule(p))
6275 &&
6276 (literal = _PyPegen_expect_token(p, 18))
6277 &&
6278 (b = bitwise_xor_rule(p))
6279 )
6280 {
6281 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6282 if (token == NULL) {
6283 return NULL;
6284 }
6285 int end_lineno = token->end_lineno;
6286 UNUSED(end_lineno); // Only used by EXTRA macro
6287 int end_col_offset = token->end_col_offset;
6288 UNUSED(end_col_offset); // Only used by EXTRA macro
6289 res = _Py_BinOp ( a , BitOr , b , EXTRA );
6290 if (res == NULL && PyErr_Occurred()) {
6291 p->error_indicator = 1;
6292 return NULL;
6293 }
6294 goto done;
6295 }
6296 p->mark = mark;
6297 }
6298 { // bitwise_xor
6299 expr_ty bitwise_xor_var;
6300 if (
6301 (bitwise_xor_var = bitwise_xor_rule(p))
6302 )
6303 {
6304 res = bitwise_xor_var;
6305 goto done;
6306 }
6307 p->mark = mark;
6308 }
6309 res = NULL;
6310 done:
6311 return res;
6312}
6313
6314// Left-recursive
6315// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
6316static expr_ty bitwise_xor_raw(Parser *);
6317static expr_ty
6318bitwise_xor_rule(Parser *p)
6319{
6320 expr_ty res = NULL;
6321 if (_PyPegen_is_memoized(p, bitwise_xor_type, &res))
6322 return res;
6323 int mark = p->mark;
6324 int resmark = p->mark;
6325 while (1) {
6326 int tmpvar_2 = _PyPegen_update_memo(p, mark, bitwise_xor_type, res);
6327 if (tmpvar_2) {
6328 return res;
6329 }
6330 p->mark = mark;
6331 void *raw = bitwise_xor_raw(p);
6332 if (raw == NULL || p->mark <= resmark)
6333 break;
6334 resmark = p->mark;
6335 res = raw;
6336 }
6337 p->mark = resmark;
6338 return res;
6339}
6340static expr_ty
6341bitwise_xor_raw(Parser *p)
6342{
6343 if (p->error_indicator) {
6344 return NULL;
6345 }
6346 expr_ty res = NULL;
6347 int mark = p->mark;
6348 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6349 p->error_indicator = 1;
6350 return NULL;
6351 }
6352 int start_lineno = p->tokens[mark]->lineno;
6353 UNUSED(start_lineno); // Only used by EXTRA macro
6354 int start_col_offset = p->tokens[mark]->col_offset;
6355 UNUSED(start_col_offset); // Only used by EXTRA macro
6356 { // bitwise_xor '^' bitwise_and
6357 expr_ty a;
6358 expr_ty b;
6359 void *literal;
6360 if (
6361 (a = bitwise_xor_rule(p))
6362 &&
6363 (literal = _PyPegen_expect_token(p, 32))
6364 &&
6365 (b = bitwise_and_rule(p))
6366 )
6367 {
6368 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6369 if (token == NULL) {
6370 return NULL;
6371 }
6372 int end_lineno = token->end_lineno;
6373 UNUSED(end_lineno); // Only used by EXTRA macro
6374 int end_col_offset = token->end_col_offset;
6375 UNUSED(end_col_offset); // Only used by EXTRA macro
6376 res = _Py_BinOp ( a , BitXor , b , EXTRA );
6377 if (res == NULL && PyErr_Occurred()) {
6378 p->error_indicator = 1;
6379 return NULL;
6380 }
6381 goto done;
6382 }
6383 p->mark = mark;
6384 }
6385 { // bitwise_and
6386 expr_ty bitwise_and_var;
6387 if (
6388 (bitwise_and_var = bitwise_and_rule(p))
6389 )
6390 {
6391 res = bitwise_and_var;
6392 goto done;
6393 }
6394 p->mark = mark;
6395 }
6396 res = NULL;
6397 done:
6398 return res;
6399}
6400
6401// Left-recursive
6402// bitwise_and: bitwise_and '&' shift_expr | shift_expr
6403static expr_ty bitwise_and_raw(Parser *);
6404static expr_ty
6405bitwise_and_rule(Parser *p)
6406{
6407 expr_ty res = NULL;
6408 if (_PyPegen_is_memoized(p, bitwise_and_type, &res))
6409 return res;
6410 int mark = p->mark;
6411 int resmark = p->mark;
6412 while (1) {
6413 int tmpvar_3 = _PyPegen_update_memo(p, mark, bitwise_and_type, res);
6414 if (tmpvar_3) {
6415 return res;
6416 }
6417 p->mark = mark;
6418 void *raw = bitwise_and_raw(p);
6419 if (raw == NULL || p->mark <= resmark)
6420 break;
6421 resmark = p->mark;
6422 res = raw;
6423 }
6424 p->mark = resmark;
6425 return res;
6426}
6427static expr_ty
6428bitwise_and_raw(Parser *p)
6429{
6430 if (p->error_indicator) {
6431 return NULL;
6432 }
6433 expr_ty res = NULL;
6434 int mark = p->mark;
6435 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6436 p->error_indicator = 1;
6437 return NULL;
6438 }
6439 int start_lineno = p->tokens[mark]->lineno;
6440 UNUSED(start_lineno); // Only used by EXTRA macro
6441 int start_col_offset = p->tokens[mark]->col_offset;
6442 UNUSED(start_col_offset); // Only used by EXTRA macro
6443 { // bitwise_and '&' shift_expr
6444 expr_ty a;
6445 expr_ty b;
6446 void *literal;
6447 if (
6448 (a = bitwise_and_rule(p))
6449 &&
6450 (literal = _PyPegen_expect_token(p, 19))
6451 &&
6452 (b = shift_expr_rule(p))
6453 )
6454 {
6455 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6456 if (token == NULL) {
6457 return NULL;
6458 }
6459 int end_lineno = token->end_lineno;
6460 UNUSED(end_lineno); // Only used by EXTRA macro
6461 int end_col_offset = token->end_col_offset;
6462 UNUSED(end_col_offset); // Only used by EXTRA macro
6463 res = _Py_BinOp ( a , BitAnd , b , EXTRA );
6464 if (res == NULL && PyErr_Occurred()) {
6465 p->error_indicator = 1;
6466 return NULL;
6467 }
6468 goto done;
6469 }
6470 p->mark = mark;
6471 }
6472 { // shift_expr
6473 expr_ty shift_expr_var;
6474 if (
6475 (shift_expr_var = shift_expr_rule(p))
6476 )
6477 {
6478 res = shift_expr_var;
6479 goto done;
6480 }
6481 p->mark = mark;
6482 }
6483 res = NULL;
6484 done:
6485 return res;
6486}
6487
6488// Left-recursive
6489// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
6490static expr_ty shift_expr_raw(Parser *);
6491static expr_ty
6492shift_expr_rule(Parser *p)
6493{
6494 expr_ty res = NULL;
6495 if (_PyPegen_is_memoized(p, shift_expr_type, &res))
6496 return res;
6497 int mark = p->mark;
6498 int resmark = p->mark;
6499 while (1) {
6500 int tmpvar_4 = _PyPegen_update_memo(p, mark, shift_expr_type, res);
6501 if (tmpvar_4) {
6502 return res;
6503 }
6504 p->mark = mark;
6505 void *raw = shift_expr_raw(p);
6506 if (raw == NULL || p->mark <= resmark)
6507 break;
6508 resmark = p->mark;
6509 res = raw;
6510 }
6511 p->mark = resmark;
6512 return res;
6513}
6514static expr_ty
6515shift_expr_raw(Parser *p)
6516{
6517 if (p->error_indicator) {
6518 return NULL;
6519 }
6520 expr_ty res = NULL;
6521 int mark = p->mark;
6522 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6523 p->error_indicator = 1;
6524 return NULL;
6525 }
6526 int start_lineno = p->tokens[mark]->lineno;
6527 UNUSED(start_lineno); // Only used by EXTRA macro
6528 int start_col_offset = p->tokens[mark]->col_offset;
6529 UNUSED(start_col_offset); // Only used by EXTRA macro
6530 { // shift_expr '<<' sum
6531 expr_ty a;
6532 expr_ty b;
6533 void *literal;
6534 if (
6535 (a = shift_expr_rule(p))
6536 &&
6537 (literal = _PyPegen_expect_token(p, 33))
6538 &&
6539 (b = sum_rule(p))
6540 )
6541 {
6542 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6543 if (token == NULL) {
6544 return NULL;
6545 }
6546 int end_lineno = token->end_lineno;
6547 UNUSED(end_lineno); // Only used by EXTRA macro
6548 int end_col_offset = token->end_col_offset;
6549 UNUSED(end_col_offset); // Only used by EXTRA macro
6550 res = _Py_BinOp ( a , LShift , b , EXTRA );
6551 if (res == NULL && PyErr_Occurred()) {
6552 p->error_indicator = 1;
6553 return NULL;
6554 }
6555 goto done;
6556 }
6557 p->mark = mark;
6558 }
6559 { // shift_expr '>>' sum
6560 expr_ty a;
6561 expr_ty b;
6562 void *literal;
6563 if (
6564 (a = shift_expr_rule(p))
6565 &&
6566 (literal = _PyPegen_expect_token(p, 34))
6567 &&
6568 (b = sum_rule(p))
6569 )
6570 {
6571 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6572 if (token == NULL) {
6573 return NULL;
6574 }
6575 int end_lineno = token->end_lineno;
6576 UNUSED(end_lineno); // Only used by EXTRA macro
6577 int end_col_offset = token->end_col_offset;
6578 UNUSED(end_col_offset); // Only used by EXTRA macro
6579 res = _Py_BinOp ( a , RShift , b , EXTRA );
6580 if (res == NULL && PyErr_Occurred()) {
6581 p->error_indicator = 1;
6582 return NULL;
6583 }
6584 goto done;
6585 }
6586 p->mark = mark;
6587 }
6588 { // sum
6589 expr_ty sum_var;
6590 if (
6591 (sum_var = sum_rule(p))
6592 )
6593 {
6594 res = sum_var;
6595 goto done;
6596 }
6597 p->mark = mark;
6598 }
6599 res = NULL;
6600 done:
6601 return res;
6602}
6603
6604// Left-recursive
6605// sum: sum '+' term | sum '-' term | term
6606static expr_ty sum_raw(Parser *);
6607static expr_ty
6608sum_rule(Parser *p)
6609{
6610 expr_ty res = NULL;
6611 if (_PyPegen_is_memoized(p, sum_type, &res))
6612 return res;
6613 int mark = p->mark;
6614 int resmark = p->mark;
6615 while (1) {
6616 int tmpvar_5 = _PyPegen_update_memo(p, mark, sum_type, res);
6617 if (tmpvar_5) {
6618 return res;
6619 }
6620 p->mark = mark;
6621 void *raw = sum_raw(p);
6622 if (raw == NULL || p->mark <= resmark)
6623 break;
6624 resmark = p->mark;
6625 res = raw;
6626 }
6627 p->mark = resmark;
6628 return res;
6629}
6630static expr_ty
6631sum_raw(Parser *p)
6632{
6633 if (p->error_indicator) {
6634 return NULL;
6635 }
6636 expr_ty res = NULL;
6637 int mark = p->mark;
6638 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6639 p->error_indicator = 1;
6640 return NULL;
6641 }
6642 int start_lineno = p->tokens[mark]->lineno;
6643 UNUSED(start_lineno); // Only used by EXTRA macro
6644 int start_col_offset = p->tokens[mark]->col_offset;
6645 UNUSED(start_col_offset); // Only used by EXTRA macro
6646 { // sum '+' term
6647 expr_ty a;
6648 expr_ty b;
6649 void *literal;
6650 if (
6651 (a = sum_rule(p))
6652 &&
6653 (literal = _PyPegen_expect_token(p, 14))
6654 &&
6655 (b = term_rule(p))
6656 )
6657 {
6658 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6659 if (token == NULL) {
6660 return NULL;
6661 }
6662 int end_lineno = token->end_lineno;
6663 UNUSED(end_lineno); // Only used by EXTRA macro
6664 int end_col_offset = token->end_col_offset;
6665 UNUSED(end_col_offset); // Only used by EXTRA macro
6666 res = _Py_BinOp ( a , Add , b , EXTRA );
6667 if (res == NULL && PyErr_Occurred()) {
6668 p->error_indicator = 1;
6669 return NULL;
6670 }
6671 goto done;
6672 }
6673 p->mark = mark;
6674 }
6675 { // sum '-' term
6676 expr_ty a;
6677 expr_ty b;
6678 void *literal;
6679 if (
6680 (a = sum_rule(p))
6681 &&
6682 (literal = _PyPegen_expect_token(p, 15))
6683 &&
6684 (b = term_rule(p))
6685 )
6686 {
6687 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6688 if (token == NULL) {
6689 return NULL;
6690 }
6691 int end_lineno = token->end_lineno;
6692 UNUSED(end_lineno); // Only used by EXTRA macro
6693 int end_col_offset = token->end_col_offset;
6694 UNUSED(end_col_offset); // Only used by EXTRA macro
6695 res = _Py_BinOp ( a , Sub , b , EXTRA );
6696 if (res == NULL && PyErr_Occurred()) {
6697 p->error_indicator = 1;
6698 return NULL;
6699 }
6700 goto done;
6701 }
6702 p->mark = mark;
6703 }
6704 { // term
6705 expr_ty term_var;
6706 if (
6707 (term_var = term_rule(p))
6708 )
6709 {
6710 res = term_var;
6711 goto done;
6712 }
6713 p->mark = mark;
6714 }
6715 res = NULL;
6716 done:
6717 return res;
6718}
6719
6720// Left-recursive
6721// term:
6722// | term '*' factor
6723// | term '/' factor
6724// | term '//' factor
6725// | term '%' factor
6726// | term '@' factor
6727// | factor
6728static expr_ty term_raw(Parser *);
6729static expr_ty
6730term_rule(Parser *p)
6731{
6732 expr_ty res = NULL;
6733 if (_PyPegen_is_memoized(p, term_type, &res))
6734 return res;
6735 int mark = p->mark;
6736 int resmark = p->mark;
6737 while (1) {
6738 int tmpvar_6 = _PyPegen_update_memo(p, mark, term_type, res);
6739 if (tmpvar_6) {
6740 return res;
6741 }
6742 p->mark = mark;
6743 void *raw = term_raw(p);
6744 if (raw == NULL || p->mark <= resmark)
6745 break;
6746 resmark = p->mark;
6747 res = raw;
6748 }
6749 p->mark = resmark;
6750 return res;
6751}
6752static expr_ty
6753term_raw(Parser *p)
6754{
6755 if (p->error_indicator) {
6756 return NULL;
6757 }
6758 expr_ty res = NULL;
6759 int mark = p->mark;
6760 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6761 p->error_indicator = 1;
6762 return NULL;
6763 }
6764 int start_lineno = p->tokens[mark]->lineno;
6765 UNUSED(start_lineno); // Only used by EXTRA macro
6766 int start_col_offset = p->tokens[mark]->col_offset;
6767 UNUSED(start_col_offset); // Only used by EXTRA macro
6768 { // term '*' factor
6769 expr_ty a;
6770 expr_ty b;
6771 void *literal;
6772 if (
6773 (a = term_rule(p))
6774 &&
6775 (literal = _PyPegen_expect_token(p, 16))
6776 &&
6777 (b = factor_rule(p))
6778 )
6779 {
6780 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6781 if (token == NULL) {
6782 return NULL;
6783 }
6784 int end_lineno = token->end_lineno;
6785 UNUSED(end_lineno); // Only used by EXTRA macro
6786 int end_col_offset = token->end_col_offset;
6787 UNUSED(end_col_offset); // Only used by EXTRA macro
6788 res = _Py_BinOp ( a , Mult , b , EXTRA );
6789 if (res == NULL && PyErr_Occurred()) {
6790 p->error_indicator = 1;
6791 return NULL;
6792 }
6793 goto done;
6794 }
6795 p->mark = mark;
6796 }
6797 { // term '/' factor
6798 expr_ty a;
6799 expr_ty b;
6800 void *literal;
6801 if (
6802 (a = term_rule(p))
6803 &&
6804 (literal = _PyPegen_expect_token(p, 17))
6805 &&
6806 (b = factor_rule(p))
6807 )
6808 {
6809 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6810 if (token == NULL) {
6811 return NULL;
6812 }
6813 int end_lineno = token->end_lineno;
6814 UNUSED(end_lineno); // Only used by EXTRA macro
6815 int end_col_offset = token->end_col_offset;
6816 UNUSED(end_col_offset); // Only used by EXTRA macro
6817 res = _Py_BinOp ( a , Div , b , EXTRA );
6818 if (res == NULL && PyErr_Occurred()) {
6819 p->error_indicator = 1;
6820 return NULL;
6821 }
6822 goto done;
6823 }
6824 p->mark = mark;
6825 }
6826 { // term '//' factor
6827 expr_ty a;
6828 expr_ty b;
6829 void *literal;
6830 if (
6831 (a = term_rule(p))
6832 &&
6833 (literal = _PyPegen_expect_token(p, 47))
6834 &&
6835 (b = factor_rule(p))
6836 )
6837 {
6838 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6839 if (token == NULL) {
6840 return NULL;
6841 }
6842 int end_lineno = token->end_lineno;
6843 UNUSED(end_lineno); // Only used by EXTRA macro
6844 int end_col_offset = token->end_col_offset;
6845 UNUSED(end_col_offset); // Only used by EXTRA macro
6846 res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
6847 if (res == NULL && PyErr_Occurred()) {
6848 p->error_indicator = 1;
6849 return NULL;
6850 }
6851 goto done;
6852 }
6853 p->mark = mark;
6854 }
6855 { // term '%' factor
6856 expr_ty a;
6857 expr_ty b;
6858 void *literal;
6859 if (
6860 (a = term_rule(p))
6861 &&
6862 (literal = _PyPegen_expect_token(p, 24))
6863 &&
6864 (b = factor_rule(p))
6865 )
6866 {
6867 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6868 if (token == NULL) {
6869 return NULL;
6870 }
6871 int end_lineno = token->end_lineno;
6872 UNUSED(end_lineno); // Only used by EXTRA macro
6873 int end_col_offset = token->end_col_offset;
6874 UNUSED(end_col_offset); // Only used by EXTRA macro
6875 res = _Py_BinOp ( a , Mod , b , EXTRA );
6876 if (res == NULL && PyErr_Occurred()) {
6877 p->error_indicator = 1;
6878 return NULL;
6879 }
6880 goto done;
6881 }
6882 p->mark = mark;
6883 }
6884 { // term '@' factor
6885 expr_ty a;
6886 expr_ty b;
6887 void *literal;
6888 if (
6889 (a = term_rule(p))
6890 &&
6891 (literal = _PyPegen_expect_token(p, 49))
6892 &&
6893 (b = factor_rule(p))
6894 )
6895 {
6896 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6897 if (token == NULL) {
6898 return NULL;
6899 }
6900 int end_lineno = token->end_lineno;
6901 UNUSED(end_lineno); // Only used by EXTRA macro
6902 int end_col_offset = token->end_col_offset;
6903 UNUSED(end_col_offset); // Only used by EXTRA macro
6904 res = _Py_BinOp ( a , MatMult , b , EXTRA );
6905 if (res == NULL && PyErr_Occurred()) {
6906 p->error_indicator = 1;
6907 return NULL;
6908 }
6909 goto done;
6910 }
6911 p->mark = mark;
6912 }
6913 { // factor
6914 expr_ty factor_var;
6915 if (
6916 (factor_var = factor_rule(p))
6917 )
6918 {
6919 res = factor_var;
6920 goto done;
6921 }
6922 p->mark = mark;
6923 }
6924 res = NULL;
6925 done:
6926 return res;
6927}
6928
6929// factor: '+' factor | '-' factor | '~' factor | power
6930static expr_ty
6931factor_rule(Parser *p)
6932{
6933 if (p->error_indicator) {
6934 return NULL;
6935 }
6936 expr_ty res = NULL;
6937 if (_PyPegen_is_memoized(p, factor_type, &res))
6938 return res;
6939 int mark = p->mark;
6940 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6941 p->error_indicator = 1;
6942 return NULL;
6943 }
6944 int start_lineno = p->tokens[mark]->lineno;
6945 UNUSED(start_lineno); // Only used by EXTRA macro
6946 int start_col_offset = p->tokens[mark]->col_offset;
6947 UNUSED(start_col_offset); // Only used by EXTRA macro
6948 { // '+' factor
6949 expr_ty a;
6950 void *literal;
6951 if (
6952 (literal = _PyPegen_expect_token(p, 14))
6953 &&
6954 (a = factor_rule(p))
6955 )
6956 {
6957 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6958 if (token == NULL) {
6959 return NULL;
6960 }
6961 int end_lineno = token->end_lineno;
6962 UNUSED(end_lineno); // Only used by EXTRA macro
6963 int end_col_offset = token->end_col_offset;
6964 UNUSED(end_col_offset); // Only used by EXTRA macro
6965 res = _Py_UnaryOp ( UAdd , a , EXTRA );
6966 if (res == NULL && PyErr_Occurred()) {
6967 p->error_indicator = 1;
6968 return NULL;
6969 }
6970 goto done;
6971 }
6972 p->mark = mark;
6973 }
6974 { // '-' factor
6975 expr_ty a;
6976 void *literal;
6977 if (
6978 (literal = _PyPegen_expect_token(p, 15))
6979 &&
6980 (a = factor_rule(p))
6981 )
6982 {
6983 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6984 if (token == NULL) {
6985 return NULL;
6986 }
6987 int end_lineno = token->end_lineno;
6988 UNUSED(end_lineno); // Only used by EXTRA macro
6989 int end_col_offset = token->end_col_offset;
6990 UNUSED(end_col_offset); // Only used by EXTRA macro
6991 res = _Py_UnaryOp ( USub , a , EXTRA );
6992 if (res == NULL && PyErr_Occurred()) {
6993 p->error_indicator = 1;
6994 return NULL;
6995 }
6996 goto done;
6997 }
6998 p->mark = mark;
6999 }
7000 { // '~' factor
7001 expr_ty a;
7002 void *literal;
7003 if (
7004 (literal = _PyPegen_expect_token(p, 31))
7005 &&
7006 (a = factor_rule(p))
7007 )
7008 {
7009 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7010 if (token == NULL) {
7011 return NULL;
7012 }
7013 int end_lineno = token->end_lineno;
7014 UNUSED(end_lineno); // Only used by EXTRA macro
7015 int end_col_offset = token->end_col_offset;
7016 UNUSED(end_col_offset); // Only used by EXTRA macro
7017 res = _Py_UnaryOp ( Invert , a , EXTRA );
7018 if (res == NULL && PyErr_Occurred()) {
7019 p->error_indicator = 1;
7020 return NULL;
7021 }
7022 goto done;
7023 }
7024 p->mark = mark;
7025 }
7026 { // power
7027 expr_ty power_var;
7028 if (
7029 (power_var = power_rule(p))
7030 )
7031 {
7032 res = power_var;
7033 goto done;
7034 }
7035 p->mark = mark;
7036 }
7037 res = NULL;
7038 done:
7039 _PyPegen_insert_memo(p, mark, factor_type, res);
7040 return res;
7041}
7042
7043// power: await_primary '**' factor | await_primary
7044static expr_ty
7045power_rule(Parser *p)
7046{
7047 if (p->error_indicator) {
7048 return NULL;
7049 }
7050 expr_ty res = NULL;
7051 int mark = p->mark;
7052 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7053 p->error_indicator = 1;
7054 return NULL;
7055 }
7056 int start_lineno = p->tokens[mark]->lineno;
7057 UNUSED(start_lineno); // Only used by EXTRA macro
7058 int start_col_offset = p->tokens[mark]->col_offset;
7059 UNUSED(start_col_offset); // Only used by EXTRA macro
7060 { // await_primary '**' factor
7061 expr_ty a;
7062 expr_ty b;
7063 void *literal;
7064 if (
7065 (a = await_primary_rule(p))
7066 &&
7067 (literal = _PyPegen_expect_token(p, 35))
7068 &&
7069 (b = factor_rule(p))
7070 )
7071 {
7072 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7073 if (token == NULL) {
7074 return NULL;
7075 }
7076 int end_lineno = token->end_lineno;
7077 UNUSED(end_lineno); // Only used by EXTRA macro
7078 int end_col_offset = token->end_col_offset;
7079 UNUSED(end_col_offset); // Only used by EXTRA macro
7080 res = _Py_BinOp ( a , Pow , b , EXTRA );
7081 if (res == NULL && PyErr_Occurred()) {
7082 p->error_indicator = 1;
7083 return NULL;
7084 }
7085 goto done;
7086 }
7087 p->mark = mark;
7088 }
7089 { // await_primary
7090 expr_ty await_primary_var;
7091 if (
7092 (await_primary_var = await_primary_rule(p))
7093 )
7094 {
7095 res = await_primary_var;
7096 goto done;
7097 }
7098 p->mark = mark;
7099 }
7100 res = NULL;
7101 done:
7102 return res;
7103}
7104
7105// await_primary: AWAIT primary | primary
7106static expr_ty
7107await_primary_rule(Parser *p)
7108{
7109 if (p->error_indicator) {
7110 return NULL;
7111 }
7112 expr_ty res = NULL;
7113 if (_PyPegen_is_memoized(p, await_primary_type, &res))
7114 return res;
7115 int mark = p->mark;
7116 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7117 p->error_indicator = 1;
7118 return NULL;
7119 }
7120 int start_lineno = p->tokens[mark]->lineno;
7121 UNUSED(start_lineno); // Only used by EXTRA macro
7122 int start_col_offset = p->tokens[mark]->col_offset;
7123 UNUSED(start_col_offset); // Only used by EXTRA macro
7124 { // AWAIT primary
7125 expr_ty a;
7126 void *await_var;
7127 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01007128 (await_var = _PyPegen_expect_token(p, AWAIT))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007129 &&
7130 (a = primary_rule(p))
7131 )
7132 {
7133 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7134 if (token == NULL) {
7135 return NULL;
7136 }
7137 int end_lineno = token->end_lineno;
7138 UNUSED(end_lineno); // Only used by EXTRA macro
7139 int end_col_offset = token->end_col_offset;
7140 UNUSED(end_col_offset); // Only used by EXTRA macro
7141 res = _Py_Await ( a , EXTRA );
7142 if (res == NULL && PyErr_Occurred()) {
7143 p->error_indicator = 1;
7144 return NULL;
7145 }
7146 goto done;
7147 }
7148 p->mark = mark;
7149 }
7150 { // primary
7151 expr_ty primary_var;
7152 if (
7153 (primary_var = primary_rule(p))
7154 )
7155 {
7156 res = primary_var;
7157 goto done;
7158 }
7159 p->mark = mark;
7160 }
7161 res = NULL;
7162 done:
7163 _PyPegen_insert_memo(p, mark, await_primary_type, res);
7164 return res;
7165}
7166
7167// Left-recursive
7168// primary:
7169// | primary '.' NAME
7170// | primary genexp
7171// | primary '(' arguments? ')'
7172// | primary '[' slices ']'
7173// | atom
7174static expr_ty primary_raw(Parser *);
7175static expr_ty
7176primary_rule(Parser *p)
7177{
7178 expr_ty res = NULL;
7179 if (_PyPegen_is_memoized(p, primary_type, &res))
7180 return res;
7181 int mark = p->mark;
7182 int resmark = p->mark;
7183 while (1) {
7184 int tmpvar_7 = _PyPegen_update_memo(p, mark, primary_type, res);
7185 if (tmpvar_7) {
7186 return res;
7187 }
7188 p->mark = mark;
7189 void *raw = primary_raw(p);
7190 if (raw == NULL || p->mark <= resmark)
7191 break;
7192 resmark = p->mark;
7193 res = raw;
7194 }
7195 p->mark = resmark;
7196 return res;
7197}
7198static expr_ty
7199primary_raw(Parser *p)
7200{
7201 if (p->error_indicator) {
7202 return NULL;
7203 }
7204 expr_ty res = NULL;
7205 int mark = p->mark;
7206 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7207 p->error_indicator = 1;
7208 return NULL;
7209 }
7210 int start_lineno = p->tokens[mark]->lineno;
7211 UNUSED(start_lineno); // Only used by EXTRA macro
7212 int start_col_offset = p->tokens[mark]->col_offset;
7213 UNUSED(start_col_offset); // Only used by EXTRA macro
7214 { // primary '.' NAME
7215 expr_ty a;
7216 expr_ty b;
7217 void *literal;
7218 if (
7219 (a = primary_rule(p))
7220 &&
7221 (literal = _PyPegen_expect_token(p, 23))
7222 &&
7223 (b = _PyPegen_name_token(p))
7224 )
7225 {
7226 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7227 if (token == NULL) {
7228 return NULL;
7229 }
7230 int end_lineno = token->end_lineno;
7231 UNUSED(end_lineno); // Only used by EXTRA macro
7232 int end_col_offset = token->end_col_offset;
7233 UNUSED(end_col_offset); // Only used by EXTRA macro
7234 res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
7235 if (res == NULL && PyErr_Occurred()) {
7236 p->error_indicator = 1;
7237 return NULL;
7238 }
7239 goto done;
7240 }
7241 p->mark = mark;
7242 }
7243 { // primary genexp
7244 expr_ty a;
7245 expr_ty b;
7246 if (
7247 (a = primary_rule(p))
7248 &&
7249 (b = genexp_rule(p))
7250 )
7251 {
7252 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7253 if (token == NULL) {
7254 return NULL;
7255 }
7256 int end_lineno = token->end_lineno;
7257 UNUSED(end_lineno); // Only used by EXTRA macro
7258 int end_col_offset = token->end_col_offset;
7259 UNUSED(end_col_offset); // Only used by EXTRA macro
7260 res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
7261 if (res == NULL && PyErr_Occurred()) {
7262 p->error_indicator = 1;
7263 return NULL;
7264 }
7265 goto done;
7266 }
7267 p->mark = mark;
7268 }
7269 { // primary '(' arguments? ')'
7270 expr_ty a;
7271 void *b;
7272 void *literal;
7273 void *literal_1;
7274 if (
7275 (a = primary_rule(p))
7276 &&
7277 (literal = _PyPegen_expect_token(p, 7))
7278 &&
7279 (b = arguments_rule(p), 1)
7280 &&
7281 (literal_1 = _PyPegen_expect_token(p, 8))
7282 )
7283 {
7284 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7285 if (token == NULL) {
7286 return NULL;
7287 }
7288 int end_lineno = token->end_lineno;
7289 UNUSED(end_lineno); // Only used by EXTRA macro
7290 int end_col_offset = token->end_col_offset;
7291 UNUSED(end_col_offset); // Only used by EXTRA macro
7292 res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
7293 if (res == NULL && PyErr_Occurred()) {
7294 p->error_indicator = 1;
7295 return NULL;
7296 }
7297 goto done;
7298 }
7299 p->mark = mark;
7300 }
7301 { // primary '[' slices ']'
7302 expr_ty a;
7303 expr_ty b;
7304 void *literal;
7305 void *literal_1;
7306 if (
7307 (a = primary_rule(p))
7308 &&
7309 (literal = _PyPegen_expect_token(p, 9))
7310 &&
7311 (b = slices_rule(p))
7312 &&
7313 (literal_1 = _PyPegen_expect_token(p, 10))
7314 )
7315 {
7316 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7317 if (token == NULL) {
7318 return NULL;
7319 }
7320 int end_lineno = token->end_lineno;
7321 UNUSED(end_lineno); // Only used by EXTRA macro
7322 int end_col_offset = token->end_col_offset;
7323 UNUSED(end_col_offset); // Only used by EXTRA macro
7324 res = _Py_Subscript ( a , b , Load , EXTRA );
7325 if (res == NULL && PyErr_Occurred()) {
7326 p->error_indicator = 1;
7327 return NULL;
7328 }
7329 goto done;
7330 }
7331 p->mark = mark;
7332 }
7333 { // atom
7334 expr_ty atom_var;
7335 if (
7336 (atom_var = atom_rule(p))
7337 )
7338 {
7339 res = atom_var;
7340 goto done;
7341 }
7342 p->mark = mark;
7343 }
7344 res = NULL;
7345 done:
7346 return res;
7347}
7348
7349// slices: slice !',' | ','.slice+ ','?
7350static expr_ty
7351slices_rule(Parser *p)
7352{
7353 if (p->error_indicator) {
7354 return NULL;
7355 }
7356 expr_ty res = NULL;
7357 int mark = p->mark;
7358 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7359 p->error_indicator = 1;
7360 return NULL;
7361 }
7362 int start_lineno = p->tokens[mark]->lineno;
7363 UNUSED(start_lineno); // Only used by EXTRA macro
7364 int start_col_offset = p->tokens[mark]->col_offset;
7365 UNUSED(start_col_offset); // Only used by EXTRA macro
7366 { // slice !','
7367 expr_ty a;
7368 if (
7369 (a = slice_rule(p))
7370 &&
7371 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)
7372 )
7373 {
7374 res = a;
7375 if (res == NULL && PyErr_Occurred()) {
7376 p->error_indicator = 1;
7377 return NULL;
7378 }
7379 goto done;
7380 }
7381 p->mark = mark;
7382 }
7383 { // ','.slice+ ','?
7384 asdl_seq * a;
7385 void *opt_var;
7386 UNUSED(opt_var); // Silence compiler warnings
7387 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07007388 (a = _gather_92_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007389 &&
7390 (opt_var = _PyPegen_expect_token(p, 12), 1)
7391 )
7392 {
7393 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7394 if (token == NULL) {
7395 return NULL;
7396 }
7397 int end_lineno = token->end_lineno;
7398 UNUSED(end_lineno); // Only used by EXTRA macro
7399 int end_col_offset = token->end_col_offset;
7400 UNUSED(end_col_offset); // Only used by EXTRA macro
7401 res = _Py_Tuple ( a , Load , EXTRA );
7402 if (res == NULL && PyErr_Occurred()) {
7403 p->error_indicator = 1;
7404 return NULL;
7405 }
7406 goto done;
7407 }
7408 p->mark = mark;
7409 }
7410 res = NULL;
7411 done:
7412 return res;
7413}
7414
7415// slice: expression? ':' expression? [':' expression?] | expression
7416static expr_ty
7417slice_rule(Parser *p)
7418{
7419 if (p->error_indicator) {
7420 return NULL;
7421 }
7422 expr_ty res = NULL;
7423 int mark = p->mark;
7424 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7425 p->error_indicator = 1;
7426 return NULL;
7427 }
7428 int start_lineno = p->tokens[mark]->lineno;
7429 UNUSED(start_lineno); // Only used by EXTRA macro
7430 int start_col_offset = p->tokens[mark]->col_offset;
7431 UNUSED(start_col_offset); // Only used by EXTRA macro
7432 { // expression? ':' expression? [':' expression?]
7433 void *a;
7434 void *b;
7435 void *c;
7436 void *literal;
7437 if (
7438 (a = expression_rule(p), 1)
7439 &&
7440 (literal = _PyPegen_expect_token(p, 11))
7441 &&
7442 (b = expression_rule(p), 1)
7443 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07007444 (c = _tmp_94_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007445 )
7446 {
7447 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7448 if (token == NULL) {
7449 return NULL;
7450 }
7451 int end_lineno = token->end_lineno;
7452 UNUSED(end_lineno); // Only used by EXTRA macro
7453 int end_col_offset = token->end_col_offset;
7454 UNUSED(end_col_offset); // Only used by EXTRA macro
7455 res = _Py_Slice ( a , b , c , EXTRA );
7456 if (res == NULL && PyErr_Occurred()) {
7457 p->error_indicator = 1;
7458 return NULL;
7459 }
7460 goto done;
7461 }
7462 p->mark = mark;
7463 }
7464 { // expression
7465 expr_ty a;
7466 if (
7467 (a = expression_rule(p))
7468 )
7469 {
7470 res = a;
7471 if (res == NULL && PyErr_Occurred()) {
7472 p->error_indicator = 1;
7473 return NULL;
7474 }
7475 goto done;
7476 }
7477 p->mark = mark;
7478 }
7479 res = NULL;
7480 done:
7481 return res;
7482}
7483
7484// atom:
7485// | NAME
7486// | 'True'
7487// | 'False'
7488// | 'None'
7489// | '__new_parser__'
7490// | &STRING strings
7491// | NUMBER
7492// | &'(' (tuple | group | genexp)
7493// | &'[' (list | listcomp)
7494// | &'{' (dict | set | dictcomp | setcomp)
7495// | '...'
7496static expr_ty
7497atom_rule(Parser *p)
7498{
7499 if (p->error_indicator) {
7500 return NULL;
7501 }
7502 expr_ty res = NULL;
7503 int mark = p->mark;
7504 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7505 p->error_indicator = 1;
7506 return NULL;
7507 }
7508 int start_lineno = p->tokens[mark]->lineno;
7509 UNUSED(start_lineno); // Only used by EXTRA macro
7510 int start_col_offset = p->tokens[mark]->col_offset;
7511 UNUSED(start_col_offset); // Only used by EXTRA macro
7512 { // NAME
7513 expr_ty name_var;
7514 if (
7515 (name_var = _PyPegen_name_token(p))
7516 )
7517 {
7518 res = name_var;
7519 goto done;
7520 }
7521 p->mark = mark;
7522 }
7523 { // 'True'
7524 void *keyword;
7525 if (
7526 (keyword = _PyPegen_expect_token(p, 527))
7527 )
7528 {
7529 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7530 if (token == NULL) {
7531 return NULL;
7532 }
7533 int end_lineno = token->end_lineno;
7534 UNUSED(end_lineno); // Only used by EXTRA macro
7535 int end_col_offset = token->end_col_offset;
7536 UNUSED(end_col_offset); // Only used by EXTRA macro
7537 res = _Py_Constant ( Py_True , NULL , EXTRA );
7538 if (res == NULL && PyErr_Occurred()) {
7539 p->error_indicator = 1;
7540 return NULL;
7541 }
7542 goto done;
7543 }
7544 p->mark = mark;
7545 }
7546 { // 'False'
7547 void *keyword;
7548 if (
7549 (keyword = _PyPegen_expect_token(p, 528))
7550 )
7551 {
7552 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7553 if (token == NULL) {
7554 return NULL;
7555 }
7556 int end_lineno = token->end_lineno;
7557 UNUSED(end_lineno); // Only used by EXTRA macro
7558 int end_col_offset = token->end_col_offset;
7559 UNUSED(end_col_offset); // Only used by EXTRA macro
7560 res = _Py_Constant ( Py_False , NULL , EXTRA );
7561 if (res == NULL && PyErr_Occurred()) {
7562 p->error_indicator = 1;
7563 return NULL;
7564 }
7565 goto done;
7566 }
7567 p->mark = mark;
7568 }
7569 { // 'None'
7570 void *keyword;
7571 if (
7572 (keyword = _PyPegen_expect_token(p, 529))
7573 )
7574 {
7575 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7576 if (token == NULL) {
7577 return NULL;
7578 }
7579 int end_lineno = token->end_lineno;
7580 UNUSED(end_lineno); // Only used by EXTRA macro
7581 int end_col_offset = token->end_col_offset;
7582 UNUSED(end_col_offset); // Only used by EXTRA macro
7583 res = _Py_Constant ( Py_None , NULL , EXTRA );
7584 if (res == NULL && PyErr_Occurred()) {
7585 p->error_indicator = 1;
7586 return NULL;
7587 }
7588 goto done;
7589 }
7590 p->mark = mark;
7591 }
7592 { // '__new_parser__'
7593 void *keyword;
7594 if (
7595 (keyword = _PyPegen_expect_token(p, 530))
7596 )
7597 {
7598 res = RAISE_SYNTAX_ERROR ( "You found it!" );
7599 if (res == NULL && PyErr_Occurred()) {
7600 p->error_indicator = 1;
7601 return NULL;
7602 }
7603 goto done;
7604 }
7605 p->mark = mark;
7606 }
7607 { // &STRING strings
7608 expr_ty strings_var;
7609 if (
7610 _PyPegen_lookahead(1, _PyPegen_string_token, p)
7611 &&
7612 (strings_var = strings_rule(p))
7613 )
7614 {
7615 res = strings_var;
7616 goto done;
7617 }
7618 p->mark = mark;
7619 }
7620 { // NUMBER
7621 expr_ty number_var;
7622 if (
7623 (number_var = _PyPegen_number_token(p))
7624 )
7625 {
7626 res = number_var;
7627 goto done;
7628 }
7629 p->mark = mark;
7630 }
7631 { // &'(' (tuple | group | genexp)
Guido van Rossumc001c092020-04-30 12:12:19 -07007632 void *_tmp_95_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007633 if (
Pablo Galindo2b74c832020-04-27 18:02:07 +01007634 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007635 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07007636 (_tmp_95_var = _tmp_95_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007637 )
7638 {
Guido van Rossumc001c092020-04-30 12:12:19 -07007639 res = _tmp_95_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007640 goto done;
7641 }
7642 p->mark = mark;
7643 }
Pablo Galindo2b74c832020-04-27 18:02:07 +01007644 { // &'[' (list | listcomp)
Guido van Rossumc001c092020-04-30 12:12:19 -07007645 void *_tmp_96_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007646 if (
Pablo Galindo2b74c832020-04-27 18:02:07 +01007647 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007648 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07007649 (_tmp_96_var = _tmp_96_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007650 )
7651 {
Guido van Rossumc001c092020-04-30 12:12:19 -07007652 res = _tmp_96_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007653 goto done;
7654 }
7655 p->mark = mark;
7656 }
Pablo Galindo2b74c832020-04-27 18:02:07 +01007657 { // &'{' (dict | set | dictcomp | setcomp)
Guido van Rossumc001c092020-04-30 12:12:19 -07007658 void *_tmp_97_var;
Pablo Galindo2b74c832020-04-27 18:02:07 +01007659 if (
7660 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25)
7661 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07007662 (_tmp_97_var = _tmp_97_rule(p))
Pablo Galindo2b74c832020-04-27 18:02:07 +01007663 )
7664 {
Guido van Rossumc001c092020-04-30 12:12:19 -07007665 res = _tmp_97_var;
Pablo Galindo2b74c832020-04-27 18:02:07 +01007666 goto done;
7667 }
7668 p->mark = mark;
7669 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007670 { // '...'
7671 void *literal;
7672 if (
7673 (literal = _PyPegen_expect_token(p, 52))
7674 )
7675 {
7676 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7677 if (token == NULL) {
7678 return NULL;
7679 }
7680 int end_lineno = token->end_lineno;
7681 UNUSED(end_lineno); // Only used by EXTRA macro
7682 int end_col_offset = token->end_col_offset;
7683 UNUSED(end_col_offset); // Only used by EXTRA macro
7684 res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
7685 if (res == NULL && PyErr_Occurred()) {
7686 p->error_indicator = 1;
7687 return NULL;
7688 }
7689 goto done;
7690 }
7691 p->mark = mark;
7692 }
7693 res = NULL;
7694 done:
7695 return res;
7696}
7697
7698// strings: STRING+
7699static expr_ty
7700strings_rule(Parser *p)
7701{
7702 if (p->error_indicator) {
7703 return NULL;
7704 }
7705 expr_ty res = NULL;
7706 if (_PyPegen_is_memoized(p, strings_type, &res))
7707 return res;
7708 int mark = p->mark;
7709 { // STRING+
7710 asdl_seq * a;
7711 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07007712 (a = _loop1_98_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007713 )
7714 {
7715 res = _PyPegen_concatenate_strings ( p , a );
7716 if (res == NULL && PyErr_Occurred()) {
7717 p->error_indicator = 1;
7718 return NULL;
7719 }
7720 goto done;
7721 }
7722 p->mark = mark;
7723 }
7724 res = NULL;
7725 done:
7726 _PyPegen_insert_memo(p, mark, strings_type, res);
7727 return res;
7728}
7729
7730// list: '[' star_named_expressions? ']'
7731static expr_ty
7732list_rule(Parser *p)
7733{
7734 if (p->error_indicator) {
7735 return NULL;
7736 }
7737 expr_ty res = NULL;
7738 int mark = p->mark;
7739 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7740 p->error_indicator = 1;
7741 return NULL;
7742 }
7743 int start_lineno = p->tokens[mark]->lineno;
7744 UNUSED(start_lineno); // Only used by EXTRA macro
7745 int start_col_offset = p->tokens[mark]->col_offset;
7746 UNUSED(start_col_offset); // Only used by EXTRA macro
7747 { // '[' star_named_expressions? ']'
7748 void *a;
7749 void *literal;
7750 void *literal_1;
7751 if (
7752 (literal = _PyPegen_expect_token(p, 9))
7753 &&
7754 (a = star_named_expressions_rule(p), 1)
7755 &&
7756 (literal_1 = _PyPegen_expect_token(p, 10))
7757 )
7758 {
7759 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7760 if (token == NULL) {
7761 return NULL;
7762 }
7763 int end_lineno = token->end_lineno;
7764 UNUSED(end_lineno); // Only used by EXTRA macro
7765 int end_col_offset = token->end_col_offset;
7766 UNUSED(end_col_offset); // Only used by EXTRA macro
7767 res = _Py_List ( a , Load , EXTRA );
7768 if (res == NULL && PyErr_Occurred()) {
7769 p->error_indicator = 1;
7770 return NULL;
7771 }
7772 goto done;
7773 }
7774 p->mark = mark;
7775 }
7776 res = NULL;
7777 done:
7778 return res;
7779}
7780
7781// listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension
7782static expr_ty
7783listcomp_rule(Parser *p)
7784{
7785 if (p->error_indicator) {
7786 return NULL;
7787 }
7788 expr_ty res = NULL;
7789 int mark = p->mark;
7790 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7791 p->error_indicator = 1;
7792 return NULL;
7793 }
7794 int start_lineno = p->tokens[mark]->lineno;
7795 UNUSED(start_lineno); // Only used by EXTRA macro
7796 int start_col_offset = p->tokens[mark]->col_offset;
7797 UNUSED(start_col_offset); // Only used by EXTRA macro
7798 { // '[' named_expression for_if_clauses ']'
7799 expr_ty a;
7800 asdl_seq* b;
7801 void *literal;
7802 void *literal_1;
7803 if (
7804 (literal = _PyPegen_expect_token(p, 9))
7805 &&
7806 (a = named_expression_rule(p))
7807 &&
7808 (b = for_if_clauses_rule(p))
7809 &&
7810 (literal_1 = _PyPegen_expect_token(p, 10))
7811 )
7812 {
7813 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7814 if (token == NULL) {
7815 return NULL;
7816 }
7817 int end_lineno = token->end_lineno;
7818 UNUSED(end_lineno); // Only used by EXTRA macro
7819 int end_col_offset = token->end_col_offset;
7820 UNUSED(end_col_offset); // Only used by EXTRA macro
7821 res = _Py_ListComp ( a , b , EXTRA );
7822 if (res == NULL && PyErr_Occurred()) {
7823 p->error_indicator = 1;
7824 return NULL;
7825 }
7826 goto done;
7827 }
7828 p->mark = mark;
7829 }
7830 { // invalid_comprehension
7831 void *invalid_comprehension_var;
7832 if (
7833 (invalid_comprehension_var = invalid_comprehension_rule(p))
7834 )
7835 {
7836 res = invalid_comprehension_var;
7837 goto done;
7838 }
7839 p->mark = mark;
7840 }
7841 res = NULL;
7842 done:
7843 return res;
7844}
7845
7846// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
7847static expr_ty
7848tuple_rule(Parser *p)
7849{
7850 if (p->error_indicator) {
7851 return NULL;
7852 }
7853 expr_ty res = NULL;
7854 int mark = p->mark;
7855 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7856 p->error_indicator = 1;
7857 return NULL;
7858 }
7859 int start_lineno = p->tokens[mark]->lineno;
7860 UNUSED(start_lineno); // Only used by EXTRA macro
7861 int start_col_offset = p->tokens[mark]->col_offset;
7862 UNUSED(start_col_offset); // Only used by EXTRA macro
7863 { // '(' [star_named_expression ',' star_named_expressions?] ')'
7864 void *a;
7865 void *literal;
7866 void *literal_1;
7867 if (
7868 (literal = _PyPegen_expect_token(p, 7))
7869 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07007870 (a = _tmp_99_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007871 &&
7872 (literal_1 = _PyPegen_expect_token(p, 8))
7873 )
7874 {
7875 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7876 if (token == NULL) {
7877 return NULL;
7878 }
7879 int end_lineno = token->end_lineno;
7880 UNUSED(end_lineno); // Only used by EXTRA macro
7881 int end_col_offset = token->end_col_offset;
7882 UNUSED(end_col_offset); // Only used by EXTRA macro
7883 res = _Py_Tuple ( a , Load , EXTRA );
7884 if (res == NULL && PyErr_Occurred()) {
7885 p->error_indicator = 1;
7886 return NULL;
7887 }
7888 goto done;
7889 }
7890 p->mark = mark;
7891 }
7892 res = NULL;
7893 done:
7894 return res;
7895}
7896
7897// group: '(' (yield_expr | named_expression) ')'
7898static expr_ty
7899group_rule(Parser *p)
7900{
7901 if (p->error_indicator) {
7902 return NULL;
7903 }
7904 expr_ty res = NULL;
7905 int mark = p->mark;
7906 { // '(' (yield_expr | named_expression) ')'
7907 void *a;
7908 void *literal;
7909 void *literal_1;
7910 if (
7911 (literal = _PyPegen_expect_token(p, 7))
7912 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07007913 (a = _tmp_100_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007914 &&
7915 (literal_1 = _PyPegen_expect_token(p, 8))
7916 )
7917 {
7918 res = a;
7919 if (res == NULL && PyErr_Occurred()) {
7920 p->error_indicator = 1;
7921 return NULL;
7922 }
7923 goto done;
7924 }
7925 p->mark = mark;
7926 }
7927 res = NULL;
7928 done:
7929 return res;
7930}
7931
7932// genexp: '(' expression for_if_clauses ')' | invalid_comprehension
7933static expr_ty
7934genexp_rule(Parser *p)
7935{
7936 if (p->error_indicator) {
7937 return NULL;
7938 }
7939 expr_ty res = NULL;
7940 int mark = p->mark;
7941 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7942 p->error_indicator = 1;
7943 return NULL;
7944 }
7945 int start_lineno = p->tokens[mark]->lineno;
7946 UNUSED(start_lineno); // Only used by EXTRA macro
7947 int start_col_offset = p->tokens[mark]->col_offset;
7948 UNUSED(start_col_offset); // Only used by EXTRA macro
7949 { // '(' expression for_if_clauses ')'
7950 expr_ty a;
7951 asdl_seq* b;
7952 void *literal;
7953 void *literal_1;
7954 if (
7955 (literal = _PyPegen_expect_token(p, 7))
7956 &&
7957 (a = expression_rule(p))
7958 &&
7959 (b = for_if_clauses_rule(p))
7960 &&
7961 (literal_1 = _PyPegen_expect_token(p, 8))
7962 )
7963 {
7964 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7965 if (token == NULL) {
7966 return NULL;
7967 }
7968 int end_lineno = token->end_lineno;
7969 UNUSED(end_lineno); // Only used by EXTRA macro
7970 int end_col_offset = token->end_col_offset;
7971 UNUSED(end_col_offset); // Only used by EXTRA macro
7972 res = _Py_GeneratorExp ( a , b , EXTRA );
7973 if (res == NULL && PyErr_Occurred()) {
7974 p->error_indicator = 1;
7975 return NULL;
7976 }
7977 goto done;
7978 }
7979 p->mark = mark;
7980 }
7981 { // invalid_comprehension
7982 void *invalid_comprehension_var;
7983 if (
7984 (invalid_comprehension_var = invalid_comprehension_rule(p))
7985 )
7986 {
7987 res = invalid_comprehension_var;
7988 goto done;
7989 }
7990 p->mark = mark;
7991 }
7992 res = NULL;
7993 done:
7994 return res;
7995}
7996
7997// set: '{' expressions_list '}'
7998static expr_ty
7999set_rule(Parser *p)
8000{
8001 if (p->error_indicator) {
8002 return NULL;
8003 }
8004 expr_ty res = NULL;
8005 int mark = p->mark;
8006 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8007 p->error_indicator = 1;
8008 return NULL;
8009 }
8010 int start_lineno = p->tokens[mark]->lineno;
8011 UNUSED(start_lineno); // Only used by EXTRA macro
8012 int start_col_offset = p->tokens[mark]->col_offset;
8013 UNUSED(start_col_offset); // Only used by EXTRA macro
8014 { // '{' expressions_list '}'
8015 asdl_seq* a;
8016 void *literal;
8017 void *literal_1;
8018 if (
8019 (literal = _PyPegen_expect_token(p, 25))
8020 &&
8021 (a = expressions_list_rule(p))
8022 &&
8023 (literal_1 = _PyPegen_expect_token(p, 26))
8024 )
8025 {
8026 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8027 if (token == NULL) {
8028 return NULL;
8029 }
8030 int end_lineno = token->end_lineno;
8031 UNUSED(end_lineno); // Only used by EXTRA macro
8032 int end_col_offset = token->end_col_offset;
8033 UNUSED(end_col_offset); // Only used by EXTRA macro
8034 res = _Py_Set ( a , EXTRA );
8035 if (res == NULL && PyErr_Occurred()) {
8036 p->error_indicator = 1;
8037 return NULL;
8038 }
8039 goto done;
8040 }
8041 p->mark = mark;
8042 }
8043 res = NULL;
8044 done:
8045 return res;
8046}
8047
8048// setcomp: '{' expression for_if_clauses '}' | invalid_comprehension
8049static expr_ty
8050setcomp_rule(Parser *p)
8051{
8052 if (p->error_indicator) {
8053 return NULL;
8054 }
8055 expr_ty res = NULL;
8056 int mark = p->mark;
8057 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8058 p->error_indicator = 1;
8059 return NULL;
8060 }
8061 int start_lineno = p->tokens[mark]->lineno;
8062 UNUSED(start_lineno); // Only used by EXTRA macro
8063 int start_col_offset = p->tokens[mark]->col_offset;
8064 UNUSED(start_col_offset); // Only used by EXTRA macro
8065 { // '{' expression for_if_clauses '}'
8066 expr_ty a;
8067 asdl_seq* b;
8068 void *literal;
8069 void *literal_1;
8070 if (
8071 (literal = _PyPegen_expect_token(p, 25))
8072 &&
8073 (a = expression_rule(p))
8074 &&
8075 (b = for_if_clauses_rule(p))
8076 &&
8077 (literal_1 = _PyPegen_expect_token(p, 26))
8078 )
8079 {
8080 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8081 if (token == NULL) {
8082 return NULL;
8083 }
8084 int end_lineno = token->end_lineno;
8085 UNUSED(end_lineno); // Only used by EXTRA macro
8086 int end_col_offset = token->end_col_offset;
8087 UNUSED(end_col_offset); // Only used by EXTRA macro
8088 res = _Py_SetComp ( a , b , EXTRA );
8089 if (res == NULL && PyErr_Occurred()) {
8090 p->error_indicator = 1;
8091 return NULL;
8092 }
8093 goto done;
8094 }
8095 p->mark = mark;
8096 }
8097 { // invalid_comprehension
8098 void *invalid_comprehension_var;
8099 if (
8100 (invalid_comprehension_var = invalid_comprehension_rule(p))
8101 )
8102 {
8103 res = invalid_comprehension_var;
8104 goto done;
8105 }
8106 p->mark = mark;
8107 }
8108 res = NULL;
8109 done:
8110 return res;
8111}
8112
8113// dict: '{' kvpairs? '}'
8114static expr_ty
8115dict_rule(Parser *p)
8116{
8117 if (p->error_indicator) {
8118 return NULL;
8119 }
8120 expr_ty res = NULL;
8121 int mark = p->mark;
8122 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8123 p->error_indicator = 1;
8124 return NULL;
8125 }
8126 int start_lineno = p->tokens[mark]->lineno;
8127 UNUSED(start_lineno); // Only used by EXTRA macro
8128 int start_col_offset = p->tokens[mark]->col_offset;
8129 UNUSED(start_col_offset); // Only used by EXTRA macro
8130 { // '{' kvpairs? '}'
8131 void *a;
8132 void *literal;
8133 void *literal_1;
8134 if (
8135 (literal = _PyPegen_expect_token(p, 25))
8136 &&
8137 (a = kvpairs_rule(p), 1)
8138 &&
8139 (literal_1 = _PyPegen_expect_token(p, 26))
8140 )
8141 {
8142 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8143 if (token == NULL) {
8144 return NULL;
8145 }
8146 int end_lineno = token->end_lineno;
8147 UNUSED(end_lineno); // Only used by EXTRA macro
8148 int end_col_offset = token->end_col_offset;
8149 UNUSED(end_col_offset); // Only used by EXTRA macro
8150 res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA );
8151 if (res == NULL && PyErr_Occurred()) {
8152 p->error_indicator = 1;
8153 return NULL;
8154 }
8155 goto done;
8156 }
8157 p->mark = mark;
8158 }
8159 res = NULL;
8160 done:
8161 return res;
8162}
8163
8164// dictcomp: '{' kvpair for_if_clauses '}'
8165static expr_ty
8166dictcomp_rule(Parser *p)
8167{
8168 if (p->error_indicator) {
8169 return NULL;
8170 }
8171 expr_ty res = NULL;
8172 int mark = p->mark;
8173 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8174 p->error_indicator = 1;
8175 return NULL;
8176 }
8177 int start_lineno = p->tokens[mark]->lineno;
8178 UNUSED(start_lineno); // Only used by EXTRA macro
8179 int start_col_offset = p->tokens[mark]->col_offset;
8180 UNUSED(start_col_offset); // Only used by EXTRA macro
8181 { // '{' kvpair for_if_clauses '}'
8182 KeyValuePair* a;
8183 asdl_seq* b;
8184 void *literal;
8185 void *literal_1;
8186 if (
8187 (literal = _PyPegen_expect_token(p, 25))
8188 &&
8189 (a = kvpair_rule(p))
8190 &&
8191 (b = for_if_clauses_rule(p))
8192 &&
8193 (literal_1 = _PyPegen_expect_token(p, 26))
8194 )
8195 {
8196 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8197 if (token == NULL) {
8198 return NULL;
8199 }
8200 int end_lineno = token->end_lineno;
8201 UNUSED(end_lineno); // Only used by EXTRA macro
8202 int end_col_offset = token->end_col_offset;
8203 UNUSED(end_col_offset); // Only used by EXTRA macro
8204 res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
8205 if (res == NULL && PyErr_Occurred()) {
8206 p->error_indicator = 1;
8207 return NULL;
8208 }
8209 goto done;
8210 }
8211 p->mark = mark;
8212 }
8213 res = NULL;
8214 done:
8215 return res;
8216}
8217
8218// kvpairs: ','.kvpair+ ','?
8219static asdl_seq*
8220kvpairs_rule(Parser *p)
8221{
8222 if (p->error_indicator) {
8223 return NULL;
8224 }
8225 asdl_seq* res = NULL;
8226 int mark = p->mark;
8227 { // ','.kvpair+ ','?
8228 asdl_seq * a;
8229 void *opt_var;
8230 UNUSED(opt_var); // Silence compiler warnings
8231 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07008232 (a = _gather_101_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008233 &&
8234 (opt_var = _PyPegen_expect_token(p, 12), 1)
8235 )
8236 {
8237 res = a;
8238 if (res == NULL && PyErr_Occurred()) {
8239 p->error_indicator = 1;
8240 return NULL;
8241 }
8242 goto done;
8243 }
8244 p->mark = mark;
8245 }
8246 res = NULL;
8247 done:
8248 return res;
8249}
8250
8251// kvpair: '**' bitwise_or | expression ':' expression
8252static KeyValuePair*
8253kvpair_rule(Parser *p)
8254{
8255 if (p->error_indicator) {
8256 return NULL;
8257 }
8258 KeyValuePair* res = NULL;
8259 int mark = p->mark;
8260 { // '**' bitwise_or
8261 expr_ty a;
8262 void *literal;
8263 if (
8264 (literal = _PyPegen_expect_token(p, 35))
8265 &&
8266 (a = bitwise_or_rule(p))
8267 )
8268 {
8269 res = _PyPegen_key_value_pair ( p , NULL , a );
8270 if (res == NULL && PyErr_Occurred()) {
8271 p->error_indicator = 1;
8272 return NULL;
8273 }
8274 goto done;
8275 }
8276 p->mark = mark;
8277 }
8278 { // expression ':' expression
8279 expr_ty a;
8280 expr_ty b;
8281 void *literal;
8282 if (
8283 (a = expression_rule(p))
8284 &&
8285 (literal = _PyPegen_expect_token(p, 11))
8286 &&
8287 (b = expression_rule(p))
8288 )
8289 {
8290 res = _PyPegen_key_value_pair ( p , a , b );
8291 if (res == NULL && PyErr_Occurred()) {
8292 p->error_indicator = 1;
8293 return NULL;
8294 }
8295 goto done;
8296 }
8297 p->mark = mark;
8298 }
8299 res = NULL;
8300 done:
8301 return res;
8302}
8303
8304// for_if_clauses: ((ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*))+
8305static asdl_seq*
8306for_if_clauses_rule(Parser *p)
8307{
8308 if (p->error_indicator) {
8309 return NULL;
8310 }
8311 asdl_seq* res = NULL;
8312 int mark = p->mark;
8313 { // ((ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*))+
8314 asdl_seq * a;
8315 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07008316 (a = _loop1_103_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008317 )
8318 {
8319 res = a;
8320 if (res == NULL && PyErr_Occurred()) {
8321 p->error_indicator = 1;
8322 return NULL;
8323 }
8324 goto done;
8325 }
8326 p->mark = mark;
8327 }
8328 res = NULL;
8329 done:
8330 return res;
8331}
8332
8333// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
8334static expr_ty
8335yield_expr_rule(Parser *p)
8336{
8337 if (p->error_indicator) {
8338 return NULL;
8339 }
8340 expr_ty res = NULL;
8341 int mark = p->mark;
8342 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8343 p->error_indicator = 1;
8344 return NULL;
8345 }
8346 int start_lineno = p->tokens[mark]->lineno;
8347 UNUSED(start_lineno); // Only used by EXTRA macro
8348 int start_col_offset = p->tokens[mark]->col_offset;
8349 UNUSED(start_col_offset); // Only used by EXTRA macro
8350 { // 'yield' 'from' expression
8351 expr_ty a;
8352 void *keyword;
8353 void *keyword_1;
8354 if (
8355 (keyword = _PyPegen_expect_token(p, 504))
8356 &&
8357 (keyword_1 = _PyPegen_expect_token(p, 514))
8358 &&
8359 (a = expression_rule(p))
8360 )
8361 {
8362 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8363 if (token == NULL) {
8364 return NULL;
8365 }
8366 int end_lineno = token->end_lineno;
8367 UNUSED(end_lineno); // Only used by EXTRA macro
8368 int end_col_offset = token->end_col_offset;
8369 UNUSED(end_col_offset); // Only used by EXTRA macro
8370 res = _Py_YieldFrom ( a , EXTRA );
8371 if (res == NULL && PyErr_Occurred()) {
8372 p->error_indicator = 1;
8373 return NULL;
8374 }
8375 goto done;
8376 }
8377 p->mark = mark;
8378 }
8379 { // 'yield' star_expressions?
8380 void *a;
8381 void *keyword;
8382 if (
8383 (keyword = _PyPegen_expect_token(p, 504))
8384 &&
8385 (a = star_expressions_rule(p), 1)
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 = _Py_Yield ( a , EXTRA );
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 res = NULL;
8406 done:
8407 return res;
8408}
8409
8410// arguments: args ','? &')' | incorrect_arguments
8411static expr_ty
8412arguments_rule(Parser *p)
8413{
8414 if (p->error_indicator) {
8415 return NULL;
8416 }
8417 expr_ty res = NULL;
8418 if (_PyPegen_is_memoized(p, arguments_type, &res))
8419 return res;
8420 int mark = p->mark;
8421 { // args ','? &')'
8422 expr_ty a;
8423 void *opt_var;
8424 UNUSED(opt_var); // Silence compiler warnings
8425 if (
8426 (a = args_rule(p))
8427 &&
8428 (opt_var = _PyPegen_expect_token(p, 12), 1)
8429 &&
8430 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
8431 )
8432 {
8433 res = a;
8434 if (res == NULL && PyErr_Occurred()) {
8435 p->error_indicator = 1;
8436 return NULL;
8437 }
8438 goto done;
8439 }
8440 p->mark = mark;
8441 }
8442 { // incorrect_arguments
8443 void *incorrect_arguments_var;
8444 if (
8445 (incorrect_arguments_var = incorrect_arguments_rule(p))
8446 )
8447 {
8448 res = incorrect_arguments_var;
8449 goto done;
8450 }
8451 p->mark = mark;
8452 }
8453 res = NULL;
8454 done:
8455 _PyPegen_insert_memo(p, mark, arguments_type, res);
8456 return res;
8457}
8458
8459// args: starred_expression [',' args] | kwargs | named_expression [',' args]
8460static expr_ty
8461args_rule(Parser *p)
8462{
8463 if (p->error_indicator) {
8464 return NULL;
8465 }
8466 expr_ty res = NULL;
8467 int mark = p->mark;
8468 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8469 p->error_indicator = 1;
8470 return NULL;
8471 }
8472 int start_lineno = p->tokens[mark]->lineno;
8473 UNUSED(start_lineno); // Only used by EXTRA macro
8474 int start_col_offset = p->tokens[mark]->col_offset;
8475 UNUSED(start_col_offset); // Only used by EXTRA macro
8476 { // starred_expression [',' args]
8477 expr_ty a;
8478 void *b;
8479 if (
8480 (a = starred_expression_rule(p))
8481 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07008482 (b = _tmp_104_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008483 )
8484 {
8485 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8486 if (token == NULL) {
8487 return NULL;
8488 }
8489 int end_lineno = token->end_lineno;
8490 UNUSED(end_lineno); // Only used by EXTRA macro
8491 int end_col_offset = token->end_col_offset;
8492 UNUSED(end_col_offset); // Only used by EXTRA macro
8493 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 );
8494 if (res == NULL && PyErr_Occurred()) {
8495 p->error_indicator = 1;
8496 return NULL;
8497 }
8498 goto done;
8499 }
8500 p->mark = mark;
8501 }
8502 { // kwargs
8503 asdl_seq* a;
8504 if (
8505 (a = kwargs_rule(p))
8506 )
8507 {
8508 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8509 if (token == NULL) {
8510 return NULL;
8511 }
8512 int end_lineno = token->end_lineno;
8513 UNUSED(end_lineno); // Only used by EXTRA macro
8514 int end_col_offset = token->end_col_offset;
8515 UNUSED(end_col_offset); // Only used by EXTRA macro
8516 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 );
8517 if (res == NULL && PyErr_Occurred()) {
8518 p->error_indicator = 1;
8519 return NULL;
8520 }
8521 goto done;
8522 }
8523 p->mark = mark;
8524 }
8525 { // named_expression [',' args]
8526 expr_ty a;
8527 void *b;
8528 if (
8529 (a = named_expression_rule(p))
8530 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07008531 (b = _tmp_105_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008532 )
8533 {
8534 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8535 if (token == NULL) {
8536 return NULL;
8537 }
8538 int end_lineno = token->end_lineno;
8539 UNUSED(end_lineno); // Only used by EXTRA macro
8540 int end_col_offset = token->end_col_offset;
8541 UNUSED(end_col_offset); // Only used by EXTRA macro
8542 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 );
8543 if (res == NULL && PyErr_Occurred()) {
8544 p->error_indicator = 1;
8545 return NULL;
8546 }
8547 goto done;
8548 }
8549 p->mark = mark;
8550 }
8551 res = NULL;
8552 done:
8553 return res;
8554}
8555
8556// kwargs:
8557// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
8558// | ','.kwarg_or_starred+
8559// | ','.kwarg_or_double_starred+
8560static asdl_seq*
8561kwargs_rule(Parser *p)
8562{
8563 if (p->error_indicator) {
8564 return NULL;
8565 }
8566 asdl_seq* res = NULL;
8567 int mark = p->mark;
8568 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
8569 asdl_seq * a;
8570 asdl_seq * b;
8571 void *literal;
8572 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07008573 (a = _gather_106_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008574 &&
8575 (literal = _PyPegen_expect_token(p, 12))
8576 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07008577 (b = _gather_108_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008578 )
8579 {
8580 res = _PyPegen_join_sequences ( p , a , b );
8581 if (res == NULL && PyErr_Occurred()) {
8582 p->error_indicator = 1;
8583 return NULL;
8584 }
8585 goto done;
8586 }
8587 p->mark = mark;
8588 }
8589 { // ','.kwarg_or_starred+
Guido van Rossumc001c092020-04-30 12:12:19 -07008590 asdl_seq * _gather_110_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008591 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07008592 (_gather_110_var = _gather_110_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008593 )
8594 {
Guido van Rossumc001c092020-04-30 12:12:19 -07008595 res = _gather_110_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008596 goto done;
8597 }
8598 p->mark = mark;
8599 }
8600 { // ','.kwarg_or_double_starred+
Guido van Rossumc001c092020-04-30 12:12:19 -07008601 asdl_seq * _gather_112_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008602 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07008603 (_gather_112_var = _gather_112_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008604 )
8605 {
Guido van Rossumc001c092020-04-30 12:12:19 -07008606 res = _gather_112_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008607 goto done;
8608 }
8609 p->mark = mark;
8610 }
8611 res = NULL;
8612 done:
8613 return res;
8614}
8615
8616// starred_expression: '*' expression
8617static expr_ty
8618starred_expression_rule(Parser *p)
8619{
8620 if (p->error_indicator) {
8621 return NULL;
8622 }
8623 expr_ty res = NULL;
8624 int mark = p->mark;
8625 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8626 p->error_indicator = 1;
8627 return NULL;
8628 }
8629 int start_lineno = p->tokens[mark]->lineno;
8630 UNUSED(start_lineno); // Only used by EXTRA macro
8631 int start_col_offset = p->tokens[mark]->col_offset;
8632 UNUSED(start_col_offset); // Only used by EXTRA macro
8633 { // '*' expression
8634 expr_ty a;
8635 void *literal;
8636 if (
8637 (literal = _PyPegen_expect_token(p, 16))
8638 &&
8639 (a = expression_rule(p))
8640 )
8641 {
8642 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8643 if (token == NULL) {
8644 return NULL;
8645 }
8646 int end_lineno = token->end_lineno;
8647 UNUSED(end_lineno); // Only used by EXTRA macro
8648 int end_col_offset = token->end_col_offset;
8649 UNUSED(end_col_offset); // Only used by EXTRA macro
8650 res = _Py_Starred ( a , Load , EXTRA );
8651 if (res == NULL && PyErr_Occurred()) {
8652 p->error_indicator = 1;
8653 return NULL;
8654 }
8655 goto done;
8656 }
8657 p->mark = mark;
8658 }
8659 res = NULL;
8660 done:
8661 return res;
8662}
8663
8664// kwarg_or_starred: NAME '=' expression | starred_expression
8665static KeywordOrStarred*
8666kwarg_or_starred_rule(Parser *p)
8667{
8668 if (p->error_indicator) {
8669 return NULL;
8670 }
8671 KeywordOrStarred* res = NULL;
8672 int mark = p->mark;
8673 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8674 p->error_indicator = 1;
8675 return NULL;
8676 }
8677 int start_lineno = p->tokens[mark]->lineno;
8678 UNUSED(start_lineno); // Only used by EXTRA macro
8679 int start_col_offset = p->tokens[mark]->col_offset;
8680 UNUSED(start_col_offset); // Only used by EXTRA macro
8681 { // NAME '=' expression
8682 expr_ty a;
8683 expr_ty b;
8684 void *literal;
8685 if (
8686 (a = _PyPegen_name_token(p))
8687 &&
8688 (literal = _PyPegen_expect_token(p, 22))
8689 &&
8690 (b = expression_rule(p))
8691 )
8692 {
8693 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8694 if (token == NULL) {
8695 return NULL;
8696 }
8697 int end_lineno = token->end_lineno;
8698 UNUSED(end_lineno); // Only used by EXTRA macro
8699 int end_col_offset = token->end_col_offset;
8700 UNUSED(end_col_offset); // Only used by EXTRA macro
8701 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
8702 if (res == NULL && PyErr_Occurred()) {
8703 p->error_indicator = 1;
8704 return NULL;
8705 }
8706 goto done;
8707 }
8708 p->mark = mark;
8709 }
8710 { // starred_expression
8711 expr_ty a;
8712 if (
8713 (a = starred_expression_rule(p))
8714 )
8715 {
8716 res = _PyPegen_keyword_or_starred ( p , a , 0 );
8717 if (res == NULL && PyErr_Occurred()) {
8718 p->error_indicator = 1;
8719 return NULL;
8720 }
8721 goto done;
8722 }
8723 p->mark = mark;
8724 }
8725 res = NULL;
8726 done:
8727 return res;
8728}
8729
8730// kwarg_or_double_starred: NAME '=' expression | '**' expression
8731static KeywordOrStarred*
8732kwarg_or_double_starred_rule(Parser *p)
8733{
8734 if (p->error_indicator) {
8735 return NULL;
8736 }
8737 KeywordOrStarred* res = NULL;
8738 int mark = p->mark;
8739 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8740 p->error_indicator = 1;
8741 return NULL;
8742 }
8743 int start_lineno = p->tokens[mark]->lineno;
8744 UNUSED(start_lineno); // Only used by EXTRA macro
8745 int start_col_offset = p->tokens[mark]->col_offset;
8746 UNUSED(start_col_offset); // Only used by EXTRA macro
8747 { // NAME '=' expression
8748 expr_ty a;
8749 expr_ty b;
8750 void *literal;
8751 if (
8752 (a = _PyPegen_name_token(p))
8753 &&
8754 (literal = _PyPegen_expect_token(p, 22))
8755 &&
8756 (b = expression_rule(p))
8757 )
8758 {
8759 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8760 if (token == NULL) {
8761 return NULL;
8762 }
8763 int end_lineno = token->end_lineno;
8764 UNUSED(end_lineno); // Only used by EXTRA macro
8765 int end_col_offset = token->end_col_offset;
8766 UNUSED(end_col_offset); // Only used by EXTRA macro
8767 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
8768 if (res == NULL && PyErr_Occurred()) {
8769 p->error_indicator = 1;
8770 return NULL;
8771 }
8772 goto done;
8773 }
8774 p->mark = mark;
8775 }
8776 { // '**' expression
8777 expr_ty a;
8778 void *literal;
8779 if (
8780 (literal = _PyPegen_expect_token(p, 35))
8781 &&
8782 (a = expression_rule(p))
8783 )
8784 {
8785 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8786 if (token == NULL) {
8787 return NULL;
8788 }
8789 int end_lineno = token->end_lineno;
8790 UNUSED(end_lineno); // Only used by EXTRA macro
8791 int end_col_offset = token->end_col_offset;
8792 UNUSED(end_col_offset); // Only used by EXTRA macro
8793 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
8794 if (res == NULL && PyErr_Occurred()) {
8795 p->error_indicator = 1;
8796 return NULL;
8797 }
8798 goto done;
8799 }
8800 p->mark = mark;
8801 }
8802 res = NULL;
8803 done:
8804 return res;
8805}
8806
8807// star_targets: star_target !',' | star_target ((',' star_target))* ','?
8808static expr_ty
8809star_targets_rule(Parser *p)
8810{
8811 if (p->error_indicator) {
8812 return NULL;
8813 }
8814 expr_ty res = NULL;
8815 int mark = p->mark;
8816 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8817 p->error_indicator = 1;
8818 return NULL;
8819 }
8820 int start_lineno = p->tokens[mark]->lineno;
8821 UNUSED(start_lineno); // Only used by EXTRA macro
8822 int start_col_offset = p->tokens[mark]->col_offset;
8823 UNUSED(start_col_offset); // Only used by EXTRA macro
8824 { // star_target !','
8825 expr_ty a;
8826 if (
8827 (a = star_target_rule(p))
8828 &&
8829 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)
8830 )
8831 {
8832 res = a;
8833 if (res == NULL && PyErr_Occurred()) {
8834 p->error_indicator = 1;
8835 return NULL;
8836 }
8837 goto done;
8838 }
8839 p->mark = mark;
8840 }
8841 { // star_target ((',' star_target))* ','?
8842 expr_ty a;
8843 asdl_seq * b;
8844 void *opt_var;
8845 UNUSED(opt_var); // Silence compiler warnings
8846 if (
8847 (a = star_target_rule(p))
8848 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07008849 (b = _loop0_114_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008850 &&
8851 (opt_var = _PyPegen_expect_token(p, 12), 1)
8852 )
8853 {
8854 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8855 if (token == NULL) {
8856 return NULL;
8857 }
8858 int end_lineno = token->end_lineno;
8859 UNUSED(end_lineno); // Only used by EXTRA macro
8860 int end_col_offset = token->end_col_offset;
8861 UNUSED(end_col_offset); // Only used by EXTRA macro
8862 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
8863 if (res == NULL && PyErr_Occurred()) {
8864 p->error_indicator = 1;
8865 return NULL;
8866 }
8867 goto done;
8868 }
8869 p->mark = mark;
8870 }
8871 res = NULL;
8872 done:
8873 return res;
8874}
8875
8876// star_targets_seq: ','.star_target+ ','?
8877static asdl_seq*
8878star_targets_seq_rule(Parser *p)
8879{
8880 if (p->error_indicator) {
8881 return NULL;
8882 }
8883 asdl_seq* res = NULL;
8884 int mark = p->mark;
8885 { // ','.star_target+ ','?
8886 asdl_seq * a;
8887 void *opt_var;
8888 UNUSED(opt_var); // Silence compiler warnings
8889 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07008890 (a = _gather_115_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008891 &&
8892 (opt_var = _PyPegen_expect_token(p, 12), 1)
8893 )
8894 {
8895 res = a;
8896 if (res == NULL && PyErr_Occurred()) {
8897 p->error_indicator = 1;
8898 return NULL;
8899 }
8900 goto done;
8901 }
8902 p->mark = mark;
8903 }
8904 res = NULL;
8905 done:
8906 return res;
8907}
8908
8909// star_target:
8910// | '*' (!'*' star_target)
8911// | t_primary '.' NAME !t_lookahead
8912// | t_primary '[' slices ']' !t_lookahead
8913// | star_atom
8914static expr_ty
8915star_target_rule(Parser *p)
8916{
8917 if (p->error_indicator) {
8918 return NULL;
8919 }
8920 expr_ty res = NULL;
8921 if (_PyPegen_is_memoized(p, star_target_type, &res))
8922 return res;
8923 int mark = p->mark;
8924 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8925 p->error_indicator = 1;
8926 return NULL;
8927 }
8928 int start_lineno = p->tokens[mark]->lineno;
8929 UNUSED(start_lineno); // Only used by EXTRA macro
8930 int start_col_offset = p->tokens[mark]->col_offset;
8931 UNUSED(start_col_offset); // Only used by EXTRA macro
8932 { // '*' (!'*' star_target)
8933 void *a;
8934 void *literal;
8935 if (
8936 (literal = _PyPegen_expect_token(p, 16))
8937 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07008938 (a = _tmp_117_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008939 )
8940 {
8941 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8942 if (token == NULL) {
8943 return NULL;
8944 }
8945 int end_lineno = token->end_lineno;
8946 UNUSED(end_lineno); // Only used by EXTRA macro
8947 int end_col_offset = token->end_col_offset;
8948 UNUSED(end_col_offset); // Only used by EXTRA macro
8949 res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
8950 if (res == NULL && PyErr_Occurred()) {
8951 p->error_indicator = 1;
8952 return NULL;
8953 }
8954 goto done;
8955 }
8956 p->mark = mark;
8957 }
8958 { // t_primary '.' NAME !t_lookahead
8959 expr_ty a;
8960 expr_ty b;
8961 void *literal;
8962 if (
8963 (a = t_primary_rule(p))
8964 &&
8965 (literal = _PyPegen_expect_token(p, 23))
8966 &&
8967 (b = _PyPegen_name_token(p))
8968 &&
8969 _PyPegen_lookahead(0, t_lookahead_rule, p)
8970 )
8971 {
8972 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8973 if (token == NULL) {
8974 return NULL;
8975 }
8976 int end_lineno = token->end_lineno;
8977 UNUSED(end_lineno); // Only used by EXTRA macro
8978 int end_col_offset = token->end_col_offset;
8979 UNUSED(end_col_offset); // Only used by EXTRA macro
8980 res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
8981 if (res == NULL && PyErr_Occurred()) {
8982 p->error_indicator = 1;
8983 return NULL;
8984 }
8985 goto done;
8986 }
8987 p->mark = mark;
8988 }
8989 { // t_primary '[' slices ']' !t_lookahead
8990 expr_ty a;
8991 expr_ty b;
8992 void *literal;
8993 void *literal_1;
8994 if (
8995 (a = t_primary_rule(p))
8996 &&
8997 (literal = _PyPegen_expect_token(p, 9))
8998 &&
8999 (b = slices_rule(p))
9000 &&
9001 (literal_1 = _PyPegen_expect_token(p, 10))
9002 &&
9003 _PyPegen_lookahead(0, t_lookahead_rule, p)
9004 )
9005 {
9006 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9007 if (token == NULL) {
9008 return NULL;
9009 }
9010 int end_lineno = token->end_lineno;
9011 UNUSED(end_lineno); // Only used by EXTRA macro
9012 int end_col_offset = token->end_col_offset;
9013 UNUSED(end_col_offset); // Only used by EXTRA macro
9014 res = _Py_Subscript ( a , b , Store , EXTRA );
9015 if (res == NULL && PyErr_Occurred()) {
9016 p->error_indicator = 1;
9017 return NULL;
9018 }
9019 goto done;
9020 }
9021 p->mark = mark;
9022 }
9023 { // star_atom
9024 expr_ty star_atom_var;
9025 if (
9026 (star_atom_var = star_atom_rule(p))
9027 )
9028 {
9029 res = star_atom_var;
9030 goto done;
9031 }
9032 p->mark = mark;
9033 }
9034 res = NULL;
9035 done:
9036 _PyPegen_insert_memo(p, mark, star_target_type, res);
9037 return res;
9038}
9039
9040// star_atom:
9041// | NAME
9042// | '(' star_target ')'
9043// | '(' star_targets_seq? ')'
9044// | '[' star_targets_seq? ']'
9045static expr_ty
9046star_atom_rule(Parser *p)
9047{
9048 if (p->error_indicator) {
9049 return NULL;
9050 }
9051 expr_ty res = NULL;
9052 int mark = p->mark;
9053 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9054 p->error_indicator = 1;
9055 return NULL;
9056 }
9057 int start_lineno = p->tokens[mark]->lineno;
9058 UNUSED(start_lineno); // Only used by EXTRA macro
9059 int start_col_offset = p->tokens[mark]->col_offset;
9060 UNUSED(start_col_offset); // Only used by EXTRA macro
9061 { // NAME
9062 expr_ty a;
9063 if (
9064 (a = _PyPegen_name_token(p))
9065 )
9066 {
9067 res = _PyPegen_set_expr_context ( p , a , Store );
9068 if (res == NULL && PyErr_Occurred()) {
9069 p->error_indicator = 1;
9070 return NULL;
9071 }
9072 goto done;
9073 }
9074 p->mark = mark;
9075 }
9076 { // '(' star_target ')'
9077 expr_ty a;
9078 void *literal;
9079 void *literal_1;
9080 if (
9081 (literal = _PyPegen_expect_token(p, 7))
9082 &&
9083 (a = star_target_rule(p))
9084 &&
9085 (literal_1 = _PyPegen_expect_token(p, 8))
9086 )
9087 {
9088 res = _PyPegen_set_expr_context ( p , a , Store );
9089 if (res == NULL && PyErr_Occurred()) {
9090 p->error_indicator = 1;
9091 return NULL;
9092 }
9093 goto done;
9094 }
9095 p->mark = mark;
9096 }
9097 { // '(' star_targets_seq? ')'
9098 void *a;
9099 void *literal;
9100 void *literal_1;
9101 if (
9102 (literal = _PyPegen_expect_token(p, 7))
9103 &&
9104 (a = star_targets_seq_rule(p), 1)
9105 &&
9106 (literal_1 = _PyPegen_expect_token(p, 8))
9107 )
9108 {
9109 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9110 if (token == NULL) {
9111 return NULL;
9112 }
9113 int end_lineno = token->end_lineno;
9114 UNUSED(end_lineno); // Only used by EXTRA macro
9115 int end_col_offset = token->end_col_offset;
9116 UNUSED(end_col_offset); // Only used by EXTRA macro
9117 res = _Py_Tuple ( a , Store , EXTRA );
9118 if (res == NULL && PyErr_Occurred()) {
9119 p->error_indicator = 1;
9120 return NULL;
9121 }
9122 goto done;
9123 }
9124 p->mark = mark;
9125 }
9126 { // '[' star_targets_seq? ']'
9127 void *a;
9128 void *literal;
9129 void *literal_1;
9130 if (
9131 (literal = _PyPegen_expect_token(p, 9))
9132 &&
9133 (a = star_targets_seq_rule(p), 1)
9134 &&
9135 (literal_1 = _PyPegen_expect_token(p, 10))
9136 )
9137 {
9138 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9139 if (token == NULL) {
9140 return NULL;
9141 }
9142 int end_lineno = token->end_lineno;
9143 UNUSED(end_lineno); // Only used by EXTRA macro
9144 int end_col_offset = token->end_col_offset;
9145 UNUSED(end_col_offset); // Only used by EXTRA macro
9146 res = _Py_List ( a , Store , EXTRA );
9147 if (res == NULL && PyErr_Occurred()) {
9148 p->error_indicator = 1;
9149 return NULL;
9150 }
9151 goto done;
9152 }
9153 p->mark = mark;
9154 }
9155 res = NULL;
9156 done:
9157 return res;
9158}
9159
9160// inside_paren_ann_assign_target:
9161// | ann_assign_subscript_attribute_target
9162// | NAME
9163// | '(' inside_paren_ann_assign_target ')'
9164static expr_ty
9165inside_paren_ann_assign_target_rule(Parser *p)
9166{
9167 if (p->error_indicator) {
9168 return NULL;
9169 }
9170 expr_ty res = NULL;
9171 int mark = p->mark;
9172 { // ann_assign_subscript_attribute_target
9173 expr_ty ann_assign_subscript_attribute_target_var;
9174 if (
9175 (ann_assign_subscript_attribute_target_var = ann_assign_subscript_attribute_target_rule(p))
9176 )
9177 {
9178 res = ann_assign_subscript_attribute_target_var;
9179 goto done;
9180 }
9181 p->mark = mark;
9182 }
9183 { // NAME
9184 expr_ty a;
9185 if (
9186 (a = _PyPegen_name_token(p))
9187 )
9188 {
9189 res = _PyPegen_set_expr_context ( p , a , Store );
9190 if (res == NULL && PyErr_Occurred()) {
9191 p->error_indicator = 1;
9192 return NULL;
9193 }
9194 goto done;
9195 }
9196 p->mark = mark;
9197 }
9198 { // '(' inside_paren_ann_assign_target ')'
9199 expr_ty a;
9200 void *literal;
9201 void *literal_1;
9202 if (
9203 (literal = _PyPegen_expect_token(p, 7))
9204 &&
9205 (a = inside_paren_ann_assign_target_rule(p))
9206 &&
9207 (literal_1 = _PyPegen_expect_token(p, 8))
9208 )
9209 {
9210 res = a;
9211 if (res == NULL && PyErr_Occurred()) {
9212 p->error_indicator = 1;
9213 return NULL;
9214 }
9215 goto done;
9216 }
9217 p->mark = mark;
9218 }
9219 res = NULL;
9220 done:
9221 return res;
9222}
9223
9224// ann_assign_subscript_attribute_target:
9225// | t_primary '.' NAME !t_lookahead
9226// | t_primary '[' slices ']' !t_lookahead
9227static expr_ty
9228ann_assign_subscript_attribute_target_rule(Parser *p)
9229{
9230 if (p->error_indicator) {
9231 return NULL;
9232 }
9233 expr_ty res = NULL;
9234 int mark = p->mark;
9235 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9236 p->error_indicator = 1;
9237 return NULL;
9238 }
9239 int start_lineno = p->tokens[mark]->lineno;
9240 UNUSED(start_lineno); // Only used by EXTRA macro
9241 int start_col_offset = p->tokens[mark]->col_offset;
9242 UNUSED(start_col_offset); // Only used by EXTRA macro
9243 { // t_primary '.' NAME !t_lookahead
9244 expr_ty a;
9245 expr_ty b;
9246 void *literal;
9247 if (
9248 (a = t_primary_rule(p))
9249 &&
9250 (literal = _PyPegen_expect_token(p, 23))
9251 &&
9252 (b = _PyPegen_name_token(p))
9253 &&
9254 _PyPegen_lookahead(0, t_lookahead_rule, p)
9255 )
9256 {
9257 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9258 if (token == NULL) {
9259 return NULL;
9260 }
9261 int end_lineno = token->end_lineno;
9262 UNUSED(end_lineno); // Only used by EXTRA macro
9263 int end_col_offset = token->end_col_offset;
9264 UNUSED(end_col_offset); // Only used by EXTRA macro
9265 res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
9266 if (res == NULL && PyErr_Occurred()) {
9267 p->error_indicator = 1;
9268 return NULL;
9269 }
9270 goto done;
9271 }
9272 p->mark = mark;
9273 }
9274 { // t_primary '[' slices ']' !t_lookahead
9275 expr_ty a;
9276 expr_ty b;
9277 void *literal;
9278 void *literal_1;
9279 if (
9280 (a = t_primary_rule(p))
9281 &&
9282 (literal = _PyPegen_expect_token(p, 9))
9283 &&
9284 (b = slices_rule(p))
9285 &&
9286 (literal_1 = _PyPegen_expect_token(p, 10))
9287 &&
9288 _PyPegen_lookahead(0, t_lookahead_rule, p)
9289 )
9290 {
9291 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9292 if (token == NULL) {
9293 return NULL;
9294 }
9295 int end_lineno = token->end_lineno;
9296 UNUSED(end_lineno); // Only used by EXTRA macro
9297 int end_col_offset = token->end_col_offset;
9298 UNUSED(end_col_offset); // Only used by EXTRA macro
9299 res = _Py_Subscript ( a , b , Store , EXTRA );
9300 if (res == NULL && PyErr_Occurred()) {
9301 p->error_indicator = 1;
9302 return NULL;
9303 }
9304 goto done;
9305 }
9306 p->mark = mark;
9307 }
9308 res = NULL;
9309 done:
9310 return res;
9311}
9312
9313// del_targets: ','.del_target+ ','?
9314static asdl_seq*
9315del_targets_rule(Parser *p)
9316{
9317 if (p->error_indicator) {
9318 return NULL;
9319 }
9320 asdl_seq* res = NULL;
9321 int mark = p->mark;
9322 { // ','.del_target+ ','?
9323 asdl_seq * a;
9324 void *opt_var;
9325 UNUSED(opt_var); // Silence compiler warnings
9326 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07009327 (a = _gather_118_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009328 &&
9329 (opt_var = _PyPegen_expect_token(p, 12), 1)
9330 )
9331 {
9332 res = a;
9333 if (res == NULL && PyErr_Occurred()) {
9334 p->error_indicator = 1;
9335 return NULL;
9336 }
9337 goto done;
9338 }
9339 p->mark = mark;
9340 }
9341 res = NULL;
9342 done:
9343 return res;
9344}
9345
9346// del_target:
9347// | t_primary '.' NAME !t_lookahead
9348// | t_primary '[' slices ']' !t_lookahead
9349// | del_t_atom
9350static expr_ty
9351del_target_rule(Parser *p)
9352{
9353 if (p->error_indicator) {
9354 return NULL;
9355 }
9356 expr_ty res = NULL;
9357 if (_PyPegen_is_memoized(p, del_target_type, &res))
9358 return res;
9359 int mark = p->mark;
9360 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9361 p->error_indicator = 1;
9362 return NULL;
9363 }
9364 int start_lineno = p->tokens[mark]->lineno;
9365 UNUSED(start_lineno); // Only used by EXTRA macro
9366 int start_col_offset = p->tokens[mark]->col_offset;
9367 UNUSED(start_col_offset); // Only used by EXTRA macro
9368 { // t_primary '.' NAME !t_lookahead
9369 expr_ty a;
9370 expr_ty b;
9371 void *literal;
9372 if (
9373 (a = t_primary_rule(p))
9374 &&
9375 (literal = _PyPegen_expect_token(p, 23))
9376 &&
9377 (b = _PyPegen_name_token(p))
9378 &&
9379 _PyPegen_lookahead(0, t_lookahead_rule, p)
9380 )
9381 {
9382 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9383 if (token == NULL) {
9384 return NULL;
9385 }
9386 int end_lineno = token->end_lineno;
9387 UNUSED(end_lineno); // Only used by EXTRA macro
9388 int end_col_offset = token->end_col_offset;
9389 UNUSED(end_col_offset); // Only used by EXTRA macro
9390 res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
9391 if (res == NULL && PyErr_Occurred()) {
9392 p->error_indicator = 1;
9393 return NULL;
9394 }
9395 goto done;
9396 }
9397 p->mark = mark;
9398 }
9399 { // t_primary '[' slices ']' !t_lookahead
9400 expr_ty a;
9401 expr_ty b;
9402 void *literal;
9403 void *literal_1;
9404 if (
9405 (a = t_primary_rule(p))
9406 &&
9407 (literal = _PyPegen_expect_token(p, 9))
9408 &&
9409 (b = slices_rule(p))
9410 &&
9411 (literal_1 = _PyPegen_expect_token(p, 10))
9412 &&
9413 _PyPegen_lookahead(0, t_lookahead_rule, p)
9414 )
9415 {
9416 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9417 if (token == NULL) {
9418 return NULL;
9419 }
9420 int end_lineno = token->end_lineno;
9421 UNUSED(end_lineno); // Only used by EXTRA macro
9422 int end_col_offset = token->end_col_offset;
9423 UNUSED(end_col_offset); // Only used by EXTRA macro
9424 res = _Py_Subscript ( a , b , Del , EXTRA );
9425 if (res == NULL && PyErr_Occurred()) {
9426 p->error_indicator = 1;
9427 return NULL;
9428 }
9429 goto done;
9430 }
9431 p->mark = mark;
9432 }
9433 { // del_t_atom
9434 expr_ty del_t_atom_var;
9435 if (
9436 (del_t_atom_var = del_t_atom_rule(p))
9437 )
9438 {
9439 res = del_t_atom_var;
9440 goto done;
9441 }
9442 p->mark = mark;
9443 }
9444 res = NULL;
9445 done:
9446 _PyPegen_insert_memo(p, mark, del_target_type, res);
9447 return res;
9448}
9449
9450// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
9451static expr_ty
9452del_t_atom_rule(Parser *p)
9453{
9454 if (p->error_indicator) {
9455 return NULL;
9456 }
9457 expr_ty res = NULL;
9458 int mark = p->mark;
9459 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9460 p->error_indicator = 1;
9461 return NULL;
9462 }
9463 int start_lineno = p->tokens[mark]->lineno;
9464 UNUSED(start_lineno); // Only used by EXTRA macro
9465 int start_col_offset = p->tokens[mark]->col_offset;
9466 UNUSED(start_col_offset); // Only used by EXTRA macro
9467 { // NAME
9468 expr_ty a;
9469 if (
9470 (a = _PyPegen_name_token(p))
9471 )
9472 {
9473 res = _PyPegen_set_expr_context ( p , a , Del );
9474 if (res == NULL && PyErr_Occurred()) {
9475 p->error_indicator = 1;
9476 return NULL;
9477 }
9478 goto done;
9479 }
9480 p->mark = mark;
9481 }
9482 { // '(' del_target ')'
9483 expr_ty a;
9484 void *literal;
9485 void *literal_1;
9486 if (
9487 (literal = _PyPegen_expect_token(p, 7))
9488 &&
9489 (a = del_target_rule(p))
9490 &&
9491 (literal_1 = _PyPegen_expect_token(p, 8))
9492 )
9493 {
9494 res = _PyPegen_set_expr_context ( p , a , Del );
9495 if (res == NULL && PyErr_Occurred()) {
9496 p->error_indicator = 1;
9497 return NULL;
9498 }
9499 goto done;
9500 }
9501 p->mark = mark;
9502 }
9503 { // '(' del_targets? ')'
9504 void *a;
9505 void *literal;
9506 void *literal_1;
9507 if (
9508 (literal = _PyPegen_expect_token(p, 7))
9509 &&
9510 (a = del_targets_rule(p), 1)
9511 &&
9512 (literal_1 = _PyPegen_expect_token(p, 8))
9513 )
9514 {
9515 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9516 if (token == NULL) {
9517 return NULL;
9518 }
9519 int end_lineno = token->end_lineno;
9520 UNUSED(end_lineno); // Only used by EXTRA macro
9521 int end_col_offset = token->end_col_offset;
9522 UNUSED(end_col_offset); // Only used by EXTRA macro
9523 res = _Py_Tuple ( a , Del , EXTRA );
9524 if (res == NULL && PyErr_Occurred()) {
9525 p->error_indicator = 1;
9526 return NULL;
9527 }
9528 goto done;
9529 }
9530 p->mark = mark;
9531 }
9532 { // '[' del_targets? ']'
9533 void *a;
9534 void *literal;
9535 void *literal_1;
9536 if (
9537 (literal = _PyPegen_expect_token(p, 9))
9538 &&
9539 (a = del_targets_rule(p), 1)
9540 &&
9541 (literal_1 = _PyPegen_expect_token(p, 10))
9542 )
9543 {
9544 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9545 if (token == NULL) {
9546 return NULL;
9547 }
9548 int end_lineno = token->end_lineno;
9549 UNUSED(end_lineno); // Only used by EXTRA macro
9550 int end_col_offset = token->end_col_offset;
9551 UNUSED(end_col_offset); // Only used by EXTRA macro
9552 res = _Py_List ( a , Del , EXTRA );
9553 if (res == NULL && PyErr_Occurred()) {
9554 p->error_indicator = 1;
9555 return NULL;
9556 }
9557 goto done;
9558 }
9559 p->mark = mark;
9560 }
9561 res = NULL;
9562 done:
9563 return res;
9564}
9565
9566// targets: ','.target+ ','?
9567static asdl_seq*
9568targets_rule(Parser *p)
9569{
9570 if (p->error_indicator) {
9571 return NULL;
9572 }
9573 asdl_seq* res = NULL;
9574 int mark = p->mark;
9575 { // ','.target+ ','?
9576 asdl_seq * a;
9577 void *opt_var;
9578 UNUSED(opt_var); // Silence compiler warnings
9579 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07009580 (a = _gather_120_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009581 &&
9582 (opt_var = _PyPegen_expect_token(p, 12), 1)
9583 )
9584 {
9585 res = a;
9586 if (res == NULL && PyErr_Occurred()) {
9587 p->error_indicator = 1;
9588 return NULL;
9589 }
9590 goto done;
9591 }
9592 p->mark = mark;
9593 }
9594 res = NULL;
9595 done:
9596 return res;
9597}
9598
9599// target:
9600// | t_primary '.' NAME !t_lookahead
9601// | t_primary '[' slices ']' !t_lookahead
9602// | t_atom
9603static expr_ty
9604target_rule(Parser *p)
9605{
9606 if (p->error_indicator) {
9607 return NULL;
9608 }
9609 expr_ty res = NULL;
9610 if (_PyPegen_is_memoized(p, target_type, &res))
9611 return res;
9612 int mark = p->mark;
9613 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9614 p->error_indicator = 1;
9615 return NULL;
9616 }
9617 int start_lineno = p->tokens[mark]->lineno;
9618 UNUSED(start_lineno); // Only used by EXTRA macro
9619 int start_col_offset = p->tokens[mark]->col_offset;
9620 UNUSED(start_col_offset); // Only used by EXTRA macro
9621 { // t_primary '.' NAME !t_lookahead
9622 expr_ty a;
9623 expr_ty b;
9624 void *literal;
9625 if (
9626 (a = t_primary_rule(p))
9627 &&
9628 (literal = _PyPegen_expect_token(p, 23))
9629 &&
9630 (b = _PyPegen_name_token(p))
9631 &&
9632 _PyPegen_lookahead(0, t_lookahead_rule, p)
9633 )
9634 {
9635 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9636 if (token == NULL) {
9637 return NULL;
9638 }
9639 int end_lineno = token->end_lineno;
9640 UNUSED(end_lineno); // Only used by EXTRA macro
9641 int end_col_offset = token->end_col_offset;
9642 UNUSED(end_col_offset); // Only used by EXTRA macro
9643 res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
9644 if (res == NULL && PyErr_Occurred()) {
9645 p->error_indicator = 1;
9646 return NULL;
9647 }
9648 goto done;
9649 }
9650 p->mark = mark;
9651 }
9652 { // t_primary '[' slices ']' !t_lookahead
9653 expr_ty a;
9654 expr_ty b;
9655 void *literal;
9656 void *literal_1;
9657 if (
9658 (a = t_primary_rule(p))
9659 &&
9660 (literal = _PyPegen_expect_token(p, 9))
9661 &&
9662 (b = slices_rule(p))
9663 &&
9664 (literal_1 = _PyPegen_expect_token(p, 10))
9665 &&
9666 _PyPegen_lookahead(0, t_lookahead_rule, p)
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_Subscript ( a , 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 { // t_atom
9687 expr_ty t_atom_var;
9688 if (
9689 (t_atom_var = t_atom_rule(p))
9690 )
9691 {
9692 res = t_atom_var;
9693 goto done;
9694 }
9695 p->mark = mark;
9696 }
9697 res = NULL;
9698 done:
9699 _PyPegen_insert_memo(p, mark, target_type, res);
9700 return res;
9701}
9702
9703// Left-recursive
9704// t_primary:
9705// | t_primary '.' NAME &t_lookahead
9706// | t_primary '[' slices ']' &t_lookahead
9707// | t_primary genexp &t_lookahead
9708// | t_primary '(' arguments? ')' &t_lookahead
9709// | atom &t_lookahead
9710static expr_ty t_primary_raw(Parser *);
9711static expr_ty
9712t_primary_rule(Parser *p)
9713{
9714 expr_ty res = NULL;
9715 if (_PyPegen_is_memoized(p, t_primary_type, &res))
9716 return res;
9717 int mark = p->mark;
9718 int resmark = p->mark;
9719 while (1) {
9720 int tmpvar_8 = _PyPegen_update_memo(p, mark, t_primary_type, res);
9721 if (tmpvar_8) {
9722 return res;
9723 }
9724 p->mark = mark;
9725 void *raw = t_primary_raw(p);
9726 if (raw == NULL || p->mark <= resmark)
9727 break;
9728 resmark = p->mark;
9729 res = raw;
9730 }
9731 p->mark = resmark;
9732 return res;
9733}
9734static expr_ty
9735t_primary_raw(Parser *p)
9736{
9737 if (p->error_indicator) {
9738 return NULL;
9739 }
9740 expr_ty res = NULL;
9741 int mark = p->mark;
9742 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9743 p->error_indicator = 1;
9744 return NULL;
9745 }
9746 int start_lineno = p->tokens[mark]->lineno;
9747 UNUSED(start_lineno); // Only used by EXTRA macro
9748 int start_col_offset = p->tokens[mark]->col_offset;
9749 UNUSED(start_col_offset); // Only used by EXTRA macro
9750 { // t_primary '.' NAME &t_lookahead
9751 expr_ty a;
9752 expr_ty b;
9753 void *literal;
9754 if (
9755 (a = t_primary_rule(p))
9756 &&
9757 (literal = _PyPegen_expect_token(p, 23))
9758 &&
9759 (b = _PyPegen_name_token(p))
9760 &&
9761 _PyPegen_lookahead(1, t_lookahead_rule, p)
9762 )
9763 {
9764 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9765 if (token == NULL) {
9766 return NULL;
9767 }
9768 int end_lineno = token->end_lineno;
9769 UNUSED(end_lineno); // Only used by EXTRA macro
9770 int end_col_offset = token->end_col_offset;
9771 UNUSED(end_col_offset); // Only used by EXTRA macro
9772 res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
9773 if (res == NULL && PyErr_Occurred()) {
9774 p->error_indicator = 1;
9775 return NULL;
9776 }
9777 goto done;
9778 }
9779 p->mark = mark;
9780 }
9781 { // t_primary '[' slices ']' &t_lookahead
9782 expr_ty a;
9783 expr_ty b;
9784 void *literal;
9785 void *literal_1;
9786 if (
9787 (a = t_primary_rule(p))
9788 &&
9789 (literal = _PyPegen_expect_token(p, 9))
9790 &&
9791 (b = slices_rule(p))
9792 &&
9793 (literal_1 = _PyPegen_expect_token(p, 10))
9794 &&
9795 _PyPegen_lookahead(1, t_lookahead_rule, p)
9796 )
9797 {
9798 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9799 if (token == NULL) {
9800 return NULL;
9801 }
9802 int end_lineno = token->end_lineno;
9803 UNUSED(end_lineno); // Only used by EXTRA macro
9804 int end_col_offset = token->end_col_offset;
9805 UNUSED(end_col_offset); // Only used by EXTRA macro
9806 res = _Py_Subscript ( a , b , Load , EXTRA );
9807 if (res == NULL && PyErr_Occurred()) {
9808 p->error_indicator = 1;
9809 return NULL;
9810 }
9811 goto done;
9812 }
9813 p->mark = mark;
9814 }
9815 { // t_primary genexp &t_lookahead
9816 expr_ty a;
9817 expr_ty b;
9818 if (
9819 (a = t_primary_rule(p))
9820 &&
9821 (b = genexp_rule(p))
9822 &&
9823 _PyPegen_lookahead(1, t_lookahead_rule, p)
9824 )
9825 {
9826 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9827 if (token == NULL) {
9828 return NULL;
9829 }
9830 int end_lineno = token->end_lineno;
9831 UNUSED(end_lineno); // Only used by EXTRA macro
9832 int end_col_offset = token->end_col_offset;
9833 UNUSED(end_col_offset); // Only used by EXTRA macro
9834 res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
9835 if (res == NULL && PyErr_Occurred()) {
9836 p->error_indicator = 1;
9837 return NULL;
9838 }
9839 goto done;
9840 }
9841 p->mark = mark;
9842 }
9843 { // t_primary '(' arguments? ')' &t_lookahead
9844 expr_ty a;
9845 void *b;
9846 void *literal;
9847 void *literal_1;
9848 if (
9849 (a = t_primary_rule(p))
9850 &&
9851 (literal = _PyPegen_expect_token(p, 7))
9852 &&
9853 (b = arguments_rule(p), 1)
9854 &&
9855 (literal_1 = _PyPegen_expect_token(p, 8))
9856 &&
9857 _PyPegen_lookahead(1, t_lookahead_rule, p)
9858 )
9859 {
9860 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9861 if (token == NULL) {
9862 return NULL;
9863 }
9864 int end_lineno = token->end_lineno;
9865 UNUSED(end_lineno); // Only used by EXTRA macro
9866 int end_col_offset = token->end_col_offset;
9867 UNUSED(end_col_offset); // Only used by EXTRA macro
9868 res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
9869 if (res == NULL && PyErr_Occurred()) {
9870 p->error_indicator = 1;
9871 return NULL;
9872 }
9873 goto done;
9874 }
9875 p->mark = mark;
9876 }
9877 { // atom &t_lookahead
9878 expr_ty a;
9879 if (
9880 (a = atom_rule(p))
9881 &&
9882 _PyPegen_lookahead(1, t_lookahead_rule, p)
9883 )
9884 {
9885 res = a;
9886 if (res == NULL && PyErr_Occurred()) {
9887 p->error_indicator = 1;
9888 return NULL;
9889 }
9890 goto done;
9891 }
9892 p->mark = mark;
9893 }
9894 res = NULL;
9895 done:
9896 return res;
9897}
9898
9899// t_lookahead: '(' | '[' | '.'
9900static void *
9901t_lookahead_rule(Parser *p)
9902{
9903 if (p->error_indicator) {
9904 return NULL;
9905 }
9906 void * res = NULL;
9907 int mark = p->mark;
9908 { // '('
9909 void *literal;
9910 if (
9911 (literal = _PyPegen_expect_token(p, 7))
9912 )
9913 {
9914 res = literal;
9915 goto done;
9916 }
9917 p->mark = mark;
9918 }
9919 { // '['
9920 void *literal;
9921 if (
9922 (literal = _PyPegen_expect_token(p, 9))
9923 )
9924 {
9925 res = literal;
9926 goto done;
9927 }
9928 p->mark = mark;
9929 }
9930 { // '.'
9931 void *literal;
9932 if (
9933 (literal = _PyPegen_expect_token(p, 23))
9934 )
9935 {
9936 res = literal;
9937 goto done;
9938 }
9939 p->mark = mark;
9940 }
9941 res = NULL;
9942 done:
9943 return res;
9944}
9945
9946// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
9947static expr_ty
9948t_atom_rule(Parser *p)
9949{
9950 if (p->error_indicator) {
9951 return NULL;
9952 }
9953 expr_ty res = NULL;
9954 int mark = p->mark;
9955 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9956 p->error_indicator = 1;
9957 return NULL;
9958 }
9959 int start_lineno = p->tokens[mark]->lineno;
9960 UNUSED(start_lineno); // Only used by EXTRA macro
9961 int start_col_offset = p->tokens[mark]->col_offset;
9962 UNUSED(start_col_offset); // Only used by EXTRA macro
9963 { // NAME
9964 expr_ty a;
9965 if (
9966 (a = _PyPegen_name_token(p))
9967 )
9968 {
9969 res = _PyPegen_set_expr_context ( p , a , Store );
9970 if (res == NULL && PyErr_Occurred()) {
9971 p->error_indicator = 1;
9972 return NULL;
9973 }
9974 goto done;
9975 }
9976 p->mark = mark;
9977 }
9978 { // '(' target ')'
9979 expr_ty a;
9980 void *literal;
9981 void *literal_1;
9982 if (
9983 (literal = _PyPegen_expect_token(p, 7))
9984 &&
9985 (a = target_rule(p))
9986 &&
9987 (literal_1 = _PyPegen_expect_token(p, 8))
9988 )
9989 {
9990 res = _PyPegen_set_expr_context ( p , a , Store );
9991 if (res == NULL && PyErr_Occurred()) {
9992 p->error_indicator = 1;
9993 return NULL;
9994 }
9995 goto done;
9996 }
9997 p->mark = mark;
9998 }
9999 { // '(' targets? ')'
10000 void *b;
10001 void *literal;
10002 void *literal_1;
10003 if (
10004 (literal = _PyPegen_expect_token(p, 7))
10005 &&
10006 (b = targets_rule(p), 1)
10007 &&
10008 (literal_1 = _PyPegen_expect_token(p, 8))
10009 )
10010 {
10011 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10012 if (token == NULL) {
10013 return NULL;
10014 }
10015 int end_lineno = token->end_lineno;
10016 UNUSED(end_lineno); // Only used by EXTRA macro
10017 int end_col_offset = token->end_col_offset;
10018 UNUSED(end_col_offset); // Only used by EXTRA macro
10019 res = _Py_Tuple ( b , Store , EXTRA );
10020 if (res == NULL && PyErr_Occurred()) {
10021 p->error_indicator = 1;
10022 return NULL;
10023 }
10024 goto done;
10025 }
10026 p->mark = mark;
10027 }
10028 { // '[' targets? ']'
10029 void *b;
10030 void *literal;
10031 void *literal_1;
10032 if (
10033 (literal = _PyPegen_expect_token(p, 9))
10034 &&
10035 (b = targets_rule(p), 1)
10036 &&
10037 (literal_1 = _PyPegen_expect_token(p, 10))
10038 )
10039 {
10040 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10041 if (token == NULL) {
10042 return NULL;
10043 }
10044 int end_lineno = token->end_lineno;
10045 UNUSED(end_lineno); // Only used by EXTRA macro
10046 int end_col_offset = token->end_col_offset;
10047 UNUSED(end_col_offset); // Only used by EXTRA macro
10048 res = _Py_List ( b , Store , EXTRA );
10049 if (res == NULL && PyErr_Occurred()) {
10050 p->error_indicator = 1;
10051 return NULL;
10052 }
10053 goto done;
10054 }
10055 p->mark = mark;
10056 }
10057 res = NULL;
10058 done:
10059 return res;
10060}
10061
10062// incorrect_arguments:
10063// | args ',' '*'
10064// | expression for_if_clauses ',' [args | expression for_if_clauses]
10065// | args ',' args
10066static void *
10067incorrect_arguments_rule(Parser *p)
10068{
10069 if (p->error_indicator) {
10070 return NULL;
10071 }
10072 void * res = NULL;
10073 int mark = p->mark;
10074 { // args ',' '*'
10075 expr_ty args_var;
10076 void *literal;
10077 void *literal_1;
10078 if (
10079 (args_var = args_rule(p))
10080 &&
10081 (literal = _PyPegen_expect_token(p, 12))
10082 &&
10083 (literal_1 = _PyPegen_expect_token(p, 16))
10084 )
10085 {
10086 res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
10087 if (res == NULL && PyErr_Occurred()) {
10088 p->error_indicator = 1;
10089 return NULL;
10090 }
10091 goto done;
10092 }
10093 p->mark = mark;
10094 }
10095 { // expression for_if_clauses ',' [args | expression for_if_clauses]
10096 expr_ty expression_var;
10097 asdl_seq* for_if_clauses_var;
10098 void *literal;
10099 void *opt_var;
10100 UNUSED(opt_var); // Silence compiler warnings
10101 if (
10102 (expression_var = expression_rule(p))
10103 &&
10104 (for_if_clauses_var = for_if_clauses_rule(p))
10105 &&
10106 (literal = _PyPegen_expect_token(p, 12))
10107 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070010108 (opt_var = _tmp_122_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010109 )
10110 {
10111 res = RAISE_SYNTAX_ERROR ( "Generator expression must be parenthesized" );
10112 if (res == NULL && PyErr_Occurred()) {
10113 p->error_indicator = 1;
10114 return NULL;
10115 }
10116 goto done;
10117 }
10118 p->mark = mark;
10119 }
10120 { // args ',' args
10121 expr_ty a;
10122 expr_ty args_var;
10123 void *literal;
10124 if (
10125 (a = args_rule(p))
10126 &&
10127 (literal = _PyPegen_expect_token(p, 12))
10128 &&
10129 (args_var = args_rule(p))
10130 )
10131 {
10132 res = _PyPegen_arguments_parsing_error ( p , a );
10133 if (res == NULL && PyErr_Occurred()) {
10134 p->error_indicator = 1;
10135 return NULL;
10136 }
10137 goto done;
10138 }
10139 p->mark = mark;
10140 }
10141 res = NULL;
10142 done:
10143 return res;
10144}
10145
10146// invalid_named_expression: expression ':=' expression
10147static void *
10148invalid_named_expression_rule(Parser *p)
10149{
10150 if (p->error_indicator) {
10151 return NULL;
10152 }
10153 void * res = NULL;
10154 int mark = p->mark;
10155 { // expression ':=' expression
10156 expr_ty a;
10157 expr_ty expression_var;
10158 void *literal;
10159 if (
10160 (a = expression_rule(p))
10161 &&
10162 (literal = _PyPegen_expect_token(p, 53))
10163 &&
10164 (expression_var = expression_rule(p))
10165 )
10166 {
10167 res = RAISE_SYNTAX_ERROR ( "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
10168 if (res == NULL && PyErr_Occurred()) {
10169 p->error_indicator = 1;
10170 return NULL;
10171 }
10172 goto done;
10173 }
10174 p->mark = mark;
10175 }
10176 res = NULL;
10177 done:
10178 return res;
10179}
10180
10181// invalid_assignment:
10182// | list ':'
10183// | tuple ':'
10184// | expression ':' expression ['=' annotated_rhs]
10185// | expression ('=' | augassign) (yield_expr | star_expressions)
10186static void *
10187invalid_assignment_rule(Parser *p)
10188{
10189 if (p->error_indicator) {
10190 return NULL;
10191 }
10192 void * res = NULL;
10193 int mark = p->mark;
10194 { // list ':'
10195 expr_ty list_var;
10196 void *literal;
10197 if (
10198 (list_var = list_rule(p))
10199 &&
10200 (literal = _PyPegen_expect_token(p, 11))
10201 )
10202 {
10203 res = RAISE_SYNTAX_ERROR ( "only single target (not list) can be annotated" );
10204 if (res == NULL && PyErr_Occurred()) {
10205 p->error_indicator = 1;
10206 return NULL;
10207 }
10208 goto done;
10209 }
10210 p->mark = mark;
10211 }
10212 { // tuple ':'
10213 void *literal;
10214 expr_ty tuple_var;
10215 if (
10216 (tuple_var = tuple_rule(p))
10217 &&
10218 (literal = _PyPegen_expect_token(p, 11))
10219 )
10220 {
10221 res = RAISE_SYNTAX_ERROR ( "only single target (not tuple) can be annotated" );
10222 if (res == NULL && PyErr_Occurred()) {
10223 p->error_indicator = 1;
10224 return NULL;
10225 }
10226 goto done;
10227 }
10228 p->mark = mark;
10229 }
10230 { // expression ':' expression ['=' annotated_rhs]
10231 expr_ty expression_var;
10232 expr_ty expression_var_1;
10233 void *literal;
10234 void *opt_var;
10235 UNUSED(opt_var); // Silence compiler warnings
10236 if (
10237 (expression_var = expression_rule(p))
10238 &&
10239 (literal = _PyPegen_expect_token(p, 11))
10240 &&
10241 (expression_var_1 = expression_rule(p))
10242 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070010243 (opt_var = _tmp_123_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010244 )
10245 {
10246 res = RAISE_SYNTAX_ERROR ( "illegal target for annotation" );
10247 if (res == NULL && PyErr_Occurred()) {
10248 p->error_indicator = 1;
10249 return NULL;
10250 }
10251 goto done;
10252 }
10253 p->mark = mark;
10254 }
10255 { // expression ('=' | augassign) (yield_expr | star_expressions)
Guido van Rossumc001c092020-04-30 12:12:19 -070010256 void *_tmp_124_var;
10257 void *_tmp_125_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010258 expr_ty a;
10259 if (
10260 (a = expression_rule(p))
10261 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070010262 (_tmp_124_var = _tmp_124_rule(p))
Pablo Galindo2b74c832020-04-27 18:02:07 +010010263 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070010264 (_tmp_125_var = _tmp_125_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010265 )
10266 {
10267 res = RAISE_SYNTAX_ERROR ( "cannot assign to %s" , _PyPegen_get_expr_name ( a ) );
10268 if (res == NULL && PyErr_Occurred()) {
10269 p->error_indicator = 1;
10270 return NULL;
10271 }
10272 goto done;
10273 }
10274 p->mark = mark;
10275 }
10276 res = NULL;
10277 done:
10278 return res;
10279}
10280
10281// invalid_block: NEWLINE !INDENT
10282static void *
10283invalid_block_rule(Parser *p)
10284{
10285 if (p->error_indicator) {
10286 return NULL;
10287 }
10288 void * res = NULL;
10289 int mark = p->mark;
10290 { // NEWLINE !INDENT
10291 void *newline_var;
10292 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010010293 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010294 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +010010295 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010296 )
10297 {
10298 res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
10299 if (res == NULL && PyErr_Occurred()) {
10300 p->error_indicator = 1;
10301 return NULL;
10302 }
10303 goto done;
10304 }
10305 p->mark = mark;
10306 }
10307 res = NULL;
10308 done:
10309 return res;
10310}
10311
10312// invalid_comprehension: ('[' | '(' | '{') '*' expression for_if_clauses
10313static void *
10314invalid_comprehension_rule(Parser *p)
10315{
10316 if (p->error_indicator) {
10317 return NULL;
10318 }
10319 void * res = NULL;
10320 int mark = p->mark;
10321 { // ('[' | '(' | '{') '*' expression for_if_clauses
Guido van Rossumc001c092020-04-30 12:12:19 -070010322 void *_tmp_126_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010323 expr_ty expression_var;
10324 asdl_seq* for_if_clauses_var;
10325 void *literal;
10326 if (
Guido van Rossumc001c092020-04-30 12:12:19 -070010327 (_tmp_126_var = _tmp_126_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010328 &&
10329 (literal = _PyPegen_expect_token(p, 16))
10330 &&
10331 (expression_var = expression_rule(p))
10332 &&
10333 (for_if_clauses_var = for_if_clauses_rule(p))
10334 )
10335 {
10336 res = RAISE_SYNTAX_ERROR ( "iterable unpacking cannot be used in comprehension" );
10337 if (res == NULL && PyErr_Occurred()) {
10338 p->error_indicator = 1;
10339 return NULL;
10340 }
10341 goto done;
10342 }
10343 p->mark = mark;
10344 }
10345 res = NULL;
10346 done:
10347 return res;
10348}
10349
10350// invalid_parameters:
Guido van Rossumc001c092020-04-30 12:12:19 -070010351// | param_no_default* (slash_with_default | param_with_default+) param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010352static void *
10353invalid_parameters_rule(Parser *p)
10354{
10355 if (p->error_indicator) {
10356 return NULL;
10357 }
10358 void * res = NULL;
10359 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070010360 { // param_no_default* (slash_with_default | param_with_default+) param_no_default
10361 asdl_seq * _loop0_127_var;
10362 void *_tmp_128_var;
10363 arg_ty param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010364 if (
Guido van Rossumc001c092020-04-30 12:12:19 -070010365 (_loop0_127_var = _loop0_127_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010366 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070010367 (_tmp_128_var = _tmp_128_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010368 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070010369 (param_no_default_var = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010370 )
10371 {
10372 res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
10373 if (res == NULL && PyErr_Occurred()) {
10374 p->error_indicator = 1;
10375 return NULL;
10376 }
10377 goto done;
10378 }
10379 p->mark = mark;
10380 }
10381 res = NULL;
10382 done:
10383 return res;
10384}
10385
Guido van Rossumc001c092020-04-30 12:12:19 -070010386// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
10387static void *
10388invalid_double_type_comments_rule(Parser *p)
10389{
10390 if (p->error_indicator) {
10391 return NULL;
10392 }
10393 void * res = NULL;
10394 int mark = p->mark;
10395 { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
10396 void *indent_var;
10397 void *newline_var;
10398 void *newline_var_1;
10399 void *type_comment_var;
10400 void *type_comment_var_1;
10401 if (
10402 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))
10403 &&
10404 (newline_var = _PyPegen_expect_token(p, NEWLINE))
10405 &&
10406 (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT))
10407 &&
10408 (newline_var_1 = _PyPegen_expect_token(p, NEWLINE))
10409 &&
10410 (indent_var = _PyPegen_expect_token(p, INDENT))
10411 )
10412 {
10413 res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
10414 if (res == NULL && PyErr_Occurred()) {
10415 p->error_indicator = 1;
10416 return NULL;
10417 }
10418 goto done;
10419 }
10420 p->mark = mark;
10421 }
10422 res = NULL;
10423 done:
10424 return res;
10425}
10426
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010427// _loop0_1: NEWLINE
10428static asdl_seq *
10429_loop0_1_rule(Parser *p)
10430{
10431 if (p->error_indicator) {
10432 return NULL;
10433 }
10434 void *res = NULL;
10435 int mark = p->mark;
10436 int start_mark = p->mark;
10437 void **children = PyMem_Malloc(sizeof(void *));
10438 if (!children) {
10439 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10440 return NULL;
10441 }
10442 ssize_t children_capacity = 1;
10443 ssize_t n = 0;
10444 { // NEWLINE
10445 void *newline_var;
10446 while (
Pablo Galindo4db245e2020-04-29 10:42:21 +010010447 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010448 )
10449 {
10450 res = newline_var;
10451 if (n == children_capacity) {
10452 children_capacity *= 2;
10453 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10454 if (!children) {
10455 PyErr_Format(PyExc_MemoryError, "realloc None");
10456 return NULL;
10457 }
10458 }
10459 children[n++] = res;
10460 mark = p->mark;
10461 }
10462 p->mark = mark;
10463 }
10464 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10465 if (!seq) {
10466 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_1");
10467 PyMem_Free(children);
10468 return NULL;
10469 }
10470 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10471 PyMem_Free(children);
10472 _PyPegen_insert_memo(p, start_mark, _loop0_1_type, seq);
10473 return seq;
10474}
10475
Guido van Rossumc001c092020-04-30 12:12:19 -070010476// _loop0_2: NEWLINE
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010477static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070010478_loop0_2_rule(Parser *p)
10479{
10480 if (p->error_indicator) {
10481 return NULL;
10482 }
10483 void *res = NULL;
10484 int mark = p->mark;
10485 int start_mark = p->mark;
10486 void **children = PyMem_Malloc(sizeof(void *));
10487 if (!children) {
10488 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10489 return NULL;
10490 }
10491 ssize_t children_capacity = 1;
10492 ssize_t n = 0;
10493 { // NEWLINE
10494 void *newline_var;
10495 while (
10496 (newline_var = _PyPegen_expect_token(p, NEWLINE))
10497 )
10498 {
10499 res = newline_var;
10500 if (n == children_capacity) {
10501 children_capacity *= 2;
10502 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10503 if (!children) {
10504 PyErr_Format(PyExc_MemoryError, "realloc None");
10505 return NULL;
10506 }
10507 }
10508 children[n++] = res;
10509 mark = p->mark;
10510 }
10511 p->mark = mark;
10512 }
10513 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10514 if (!seq) {
10515 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_2");
10516 PyMem_Free(children);
10517 return NULL;
10518 }
10519 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10520 PyMem_Free(children);
10521 _PyPegen_insert_memo(p, start_mark, _loop0_2_type, seq);
10522 return seq;
10523}
10524
10525// _loop0_4: ',' expression
10526static asdl_seq *
10527_loop0_4_rule(Parser *p)
10528{
10529 if (p->error_indicator) {
10530 return NULL;
10531 }
10532 void *res = NULL;
10533 int mark = p->mark;
10534 int start_mark = p->mark;
10535 void **children = PyMem_Malloc(sizeof(void *));
10536 if (!children) {
10537 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10538 return NULL;
10539 }
10540 ssize_t children_capacity = 1;
10541 ssize_t n = 0;
10542 { // ',' expression
10543 expr_ty elem;
10544 void *literal;
10545 while (
10546 (literal = _PyPegen_expect_token(p, 12))
10547 &&
10548 (elem = expression_rule(p))
10549 )
10550 {
10551 res = elem;
10552 if (res == NULL && PyErr_Occurred()) {
10553 p->error_indicator = 1;
10554 PyMem_Free(children);
10555 return NULL;
10556 }
10557 if (n == children_capacity) {
10558 children_capacity *= 2;
10559 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10560 if (!children) {
10561 PyErr_Format(PyExc_MemoryError, "realloc None");
10562 return NULL;
10563 }
10564 }
10565 children[n++] = res;
10566 mark = p->mark;
10567 }
10568 p->mark = mark;
10569 }
10570 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10571 if (!seq) {
10572 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_4");
10573 PyMem_Free(children);
10574 return NULL;
10575 }
10576 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10577 PyMem_Free(children);
10578 _PyPegen_insert_memo(p, start_mark, _loop0_4_type, seq);
10579 return seq;
10580}
10581
10582// _gather_3: expression _loop0_4
10583static asdl_seq *
10584_gather_3_rule(Parser *p)
10585{
10586 if (p->error_indicator) {
10587 return NULL;
10588 }
10589 asdl_seq * res = NULL;
10590 int mark = p->mark;
10591 { // expression _loop0_4
10592 expr_ty elem;
10593 asdl_seq * seq;
10594 if (
10595 (elem = expression_rule(p))
10596 &&
10597 (seq = _loop0_4_rule(p))
10598 )
10599 {
10600 res = _PyPegen_seq_insert_in_front(p, elem, seq);
10601 goto done;
10602 }
10603 p->mark = mark;
10604 }
10605 res = NULL;
10606 done:
10607 return res;
10608}
10609
10610// _loop0_6: ',' expression
10611static asdl_seq *
10612_loop0_6_rule(Parser *p)
10613{
10614 if (p->error_indicator) {
10615 return NULL;
10616 }
10617 void *res = NULL;
10618 int mark = p->mark;
10619 int start_mark = p->mark;
10620 void **children = PyMem_Malloc(sizeof(void *));
10621 if (!children) {
10622 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10623 return NULL;
10624 }
10625 ssize_t children_capacity = 1;
10626 ssize_t n = 0;
10627 { // ',' expression
10628 expr_ty elem;
10629 void *literal;
10630 while (
10631 (literal = _PyPegen_expect_token(p, 12))
10632 &&
10633 (elem = expression_rule(p))
10634 )
10635 {
10636 res = elem;
10637 if (res == NULL && PyErr_Occurred()) {
10638 p->error_indicator = 1;
10639 PyMem_Free(children);
10640 return NULL;
10641 }
10642 if (n == children_capacity) {
10643 children_capacity *= 2;
10644 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10645 if (!children) {
10646 PyErr_Format(PyExc_MemoryError, "realloc None");
10647 return NULL;
10648 }
10649 }
10650 children[n++] = res;
10651 mark = p->mark;
10652 }
10653 p->mark = mark;
10654 }
10655 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10656 if (!seq) {
10657 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_6");
10658 PyMem_Free(children);
10659 return NULL;
10660 }
10661 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10662 PyMem_Free(children);
10663 _PyPegen_insert_memo(p, start_mark, _loop0_6_type, seq);
10664 return seq;
10665}
10666
10667// _gather_5: expression _loop0_6
10668static asdl_seq *
10669_gather_5_rule(Parser *p)
10670{
10671 if (p->error_indicator) {
10672 return NULL;
10673 }
10674 asdl_seq * res = NULL;
10675 int mark = p->mark;
10676 { // expression _loop0_6
10677 expr_ty elem;
10678 asdl_seq * seq;
10679 if (
10680 (elem = expression_rule(p))
10681 &&
10682 (seq = _loop0_6_rule(p))
10683 )
10684 {
10685 res = _PyPegen_seq_insert_in_front(p, elem, seq);
10686 goto done;
10687 }
10688 p->mark = mark;
10689 }
10690 res = NULL;
10691 done:
10692 return res;
10693}
10694
10695// _loop0_8: ',' expression
10696static asdl_seq *
10697_loop0_8_rule(Parser *p)
10698{
10699 if (p->error_indicator) {
10700 return NULL;
10701 }
10702 void *res = NULL;
10703 int mark = p->mark;
10704 int start_mark = p->mark;
10705 void **children = PyMem_Malloc(sizeof(void *));
10706 if (!children) {
10707 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10708 return NULL;
10709 }
10710 ssize_t children_capacity = 1;
10711 ssize_t n = 0;
10712 { // ',' expression
10713 expr_ty elem;
10714 void *literal;
10715 while (
10716 (literal = _PyPegen_expect_token(p, 12))
10717 &&
10718 (elem = expression_rule(p))
10719 )
10720 {
10721 res = elem;
10722 if (res == NULL && PyErr_Occurred()) {
10723 p->error_indicator = 1;
10724 PyMem_Free(children);
10725 return NULL;
10726 }
10727 if (n == children_capacity) {
10728 children_capacity *= 2;
10729 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10730 if (!children) {
10731 PyErr_Format(PyExc_MemoryError, "realloc None");
10732 return NULL;
10733 }
10734 }
10735 children[n++] = res;
10736 mark = p->mark;
10737 }
10738 p->mark = mark;
10739 }
10740 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10741 if (!seq) {
10742 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_8");
10743 PyMem_Free(children);
10744 return NULL;
10745 }
10746 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10747 PyMem_Free(children);
10748 _PyPegen_insert_memo(p, start_mark, _loop0_8_type, seq);
10749 return seq;
10750}
10751
10752// _gather_7: expression _loop0_8
10753static asdl_seq *
10754_gather_7_rule(Parser *p)
10755{
10756 if (p->error_indicator) {
10757 return NULL;
10758 }
10759 asdl_seq * res = NULL;
10760 int mark = p->mark;
10761 { // expression _loop0_8
10762 expr_ty elem;
10763 asdl_seq * seq;
10764 if (
10765 (elem = expression_rule(p))
10766 &&
10767 (seq = _loop0_8_rule(p))
10768 )
10769 {
10770 res = _PyPegen_seq_insert_in_front(p, elem, seq);
10771 goto done;
10772 }
10773 p->mark = mark;
10774 }
10775 res = NULL;
10776 done:
10777 return res;
10778}
10779
10780// _loop0_10: ',' expression
10781static asdl_seq *
10782_loop0_10_rule(Parser *p)
10783{
10784 if (p->error_indicator) {
10785 return NULL;
10786 }
10787 void *res = NULL;
10788 int mark = p->mark;
10789 int start_mark = p->mark;
10790 void **children = PyMem_Malloc(sizeof(void *));
10791 if (!children) {
10792 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10793 return NULL;
10794 }
10795 ssize_t children_capacity = 1;
10796 ssize_t n = 0;
10797 { // ',' expression
10798 expr_ty elem;
10799 void *literal;
10800 while (
10801 (literal = _PyPegen_expect_token(p, 12))
10802 &&
10803 (elem = expression_rule(p))
10804 )
10805 {
10806 res = elem;
10807 if (res == NULL && PyErr_Occurred()) {
10808 p->error_indicator = 1;
10809 PyMem_Free(children);
10810 return NULL;
10811 }
10812 if (n == children_capacity) {
10813 children_capacity *= 2;
10814 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10815 if (!children) {
10816 PyErr_Format(PyExc_MemoryError, "realloc None");
10817 return NULL;
10818 }
10819 }
10820 children[n++] = res;
10821 mark = p->mark;
10822 }
10823 p->mark = mark;
10824 }
10825 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10826 if (!seq) {
10827 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_10");
10828 PyMem_Free(children);
10829 return NULL;
10830 }
10831 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10832 PyMem_Free(children);
10833 _PyPegen_insert_memo(p, start_mark, _loop0_10_type, seq);
10834 return seq;
10835}
10836
10837// _gather_9: expression _loop0_10
10838static asdl_seq *
10839_gather_9_rule(Parser *p)
10840{
10841 if (p->error_indicator) {
10842 return NULL;
10843 }
10844 asdl_seq * res = NULL;
10845 int mark = p->mark;
10846 { // expression _loop0_10
10847 expr_ty elem;
10848 asdl_seq * seq;
10849 if (
10850 (elem = expression_rule(p))
10851 &&
10852 (seq = _loop0_10_rule(p))
10853 )
10854 {
10855 res = _PyPegen_seq_insert_in_front(p, elem, seq);
10856 goto done;
10857 }
10858 p->mark = mark;
10859 }
10860 res = NULL;
10861 done:
10862 return res;
10863}
10864
10865// _loop1_11: statement
10866static asdl_seq *
10867_loop1_11_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010868{
10869 if (p->error_indicator) {
10870 return NULL;
10871 }
10872 void *res = NULL;
10873 int mark = p->mark;
10874 int start_mark = p->mark;
10875 void **children = PyMem_Malloc(sizeof(void *));
10876 if (!children) {
10877 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10878 return NULL;
10879 }
10880 ssize_t children_capacity = 1;
10881 ssize_t n = 0;
10882 { // statement
10883 asdl_seq* statement_var;
10884 while (
10885 (statement_var = statement_rule(p))
10886 )
10887 {
10888 res = statement_var;
10889 if (n == children_capacity) {
10890 children_capacity *= 2;
10891 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10892 if (!children) {
10893 PyErr_Format(PyExc_MemoryError, "realloc None");
10894 return NULL;
10895 }
10896 }
10897 children[n++] = res;
10898 mark = p->mark;
10899 }
10900 p->mark = mark;
10901 }
10902 if (n == 0) {
10903 PyMem_Free(children);
10904 return NULL;
10905 }
10906 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10907 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070010908 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_11");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010909 PyMem_Free(children);
10910 return NULL;
10911 }
10912 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10913 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070010914 _PyPegen_insert_memo(p, start_mark, _loop1_11_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010915 return seq;
10916}
10917
Guido van Rossumc001c092020-04-30 12:12:19 -070010918// _loop0_13: ';' small_stmt
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010919static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070010920_loop0_13_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010921{
10922 if (p->error_indicator) {
10923 return NULL;
10924 }
10925 void *res = NULL;
10926 int mark = p->mark;
10927 int start_mark = p->mark;
10928 void **children = PyMem_Malloc(sizeof(void *));
10929 if (!children) {
10930 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10931 return NULL;
10932 }
10933 ssize_t children_capacity = 1;
10934 ssize_t n = 0;
10935 { // ';' small_stmt
10936 stmt_ty elem;
10937 void *literal;
10938 while (
10939 (literal = _PyPegen_expect_token(p, 13))
10940 &&
10941 (elem = small_stmt_rule(p))
10942 )
10943 {
10944 res = elem;
10945 if (res == NULL && PyErr_Occurred()) {
10946 p->error_indicator = 1;
10947 PyMem_Free(children);
10948 return NULL;
10949 }
10950 if (n == children_capacity) {
10951 children_capacity *= 2;
10952 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10953 if (!children) {
10954 PyErr_Format(PyExc_MemoryError, "realloc None");
10955 return NULL;
10956 }
10957 }
10958 children[n++] = res;
10959 mark = p->mark;
10960 }
10961 p->mark = mark;
10962 }
10963 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10964 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070010965 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_13");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010966 PyMem_Free(children);
10967 return NULL;
10968 }
10969 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10970 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070010971 _PyPegen_insert_memo(p, start_mark, _loop0_13_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010972 return seq;
10973}
10974
Guido van Rossumc001c092020-04-30 12:12:19 -070010975// _gather_12: small_stmt _loop0_13
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010976static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070010977_gather_12_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010978{
10979 if (p->error_indicator) {
10980 return NULL;
10981 }
10982 asdl_seq * res = NULL;
10983 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070010984 { // small_stmt _loop0_13
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010985 stmt_ty elem;
10986 asdl_seq * seq;
10987 if (
10988 (elem = small_stmt_rule(p))
10989 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070010990 (seq = _loop0_13_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010991 )
10992 {
10993 res = _PyPegen_seq_insert_in_front(p, elem, seq);
10994 goto done;
10995 }
10996 p->mark = mark;
10997 }
10998 res = NULL;
10999 done:
11000 return res;
11001}
11002
Guido van Rossumc001c092020-04-30 12:12:19 -070011003// _tmp_14: 'import' | 'from'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011004static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011005_tmp_14_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011006{
11007 if (p->error_indicator) {
11008 return NULL;
11009 }
11010 void * res = NULL;
11011 int mark = p->mark;
11012 { // 'import'
11013 void *keyword;
11014 if (
11015 (keyword = _PyPegen_expect_token(p, 513))
11016 )
11017 {
11018 res = keyword;
11019 goto done;
11020 }
11021 p->mark = mark;
11022 }
11023 { // 'from'
11024 void *keyword;
11025 if (
11026 (keyword = _PyPegen_expect_token(p, 514))
11027 )
11028 {
11029 res = keyword;
11030 goto done;
11031 }
11032 p->mark = mark;
11033 }
11034 res = NULL;
11035 done:
11036 return res;
11037}
11038
Guido van Rossumc001c092020-04-30 12:12:19 -070011039// _tmp_15: 'def' | '@' | ASYNC
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011040static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011041_tmp_15_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011042{
11043 if (p->error_indicator) {
11044 return NULL;
11045 }
11046 void * res = NULL;
11047 int mark = p->mark;
11048 { // 'def'
11049 void *keyword;
11050 if (
11051 (keyword = _PyPegen_expect_token(p, 522))
11052 )
11053 {
11054 res = keyword;
11055 goto done;
11056 }
11057 p->mark = mark;
11058 }
11059 { // '@'
11060 void *literal;
11061 if (
11062 (literal = _PyPegen_expect_token(p, 49))
11063 )
11064 {
11065 res = literal;
11066 goto done;
11067 }
11068 p->mark = mark;
11069 }
11070 { // ASYNC
11071 void *async_var;
11072 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010011073 (async_var = _PyPegen_expect_token(p, ASYNC))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011074 )
11075 {
11076 res = async_var;
11077 goto done;
11078 }
11079 p->mark = mark;
11080 }
11081 res = NULL;
11082 done:
11083 return res;
11084}
11085
Guido van Rossumc001c092020-04-30 12:12:19 -070011086// _tmp_16: 'class' | '@'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011087static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011088_tmp_16_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011089{
11090 if (p->error_indicator) {
11091 return NULL;
11092 }
11093 void * res = NULL;
11094 int mark = p->mark;
11095 { // 'class'
11096 void *keyword;
11097 if (
11098 (keyword = _PyPegen_expect_token(p, 523))
11099 )
11100 {
11101 res = keyword;
11102 goto done;
11103 }
11104 p->mark = mark;
11105 }
11106 { // '@'
11107 void *literal;
11108 if (
11109 (literal = _PyPegen_expect_token(p, 49))
11110 )
11111 {
11112 res = literal;
11113 goto done;
11114 }
11115 p->mark = mark;
11116 }
11117 res = NULL;
11118 done:
11119 return res;
11120}
11121
Guido van Rossumc001c092020-04-30 12:12:19 -070011122// _tmp_17: 'with' | ASYNC
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011123static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011124_tmp_17_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011125{
11126 if (p->error_indicator) {
11127 return NULL;
11128 }
11129 void * res = NULL;
11130 int mark = p->mark;
11131 { // 'with'
11132 void *keyword;
11133 if (
11134 (keyword = _PyPegen_expect_token(p, 519))
11135 )
11136 {
11137 res = keyword;
11138 goto done;
11139 }
11140 p->mark = mark;
11141 }
11142 { // ASYNC
11143 void *async_var;
11144 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010011145 (async_var = _PyPegen_expect_token(p, ASYNC))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011146 )
11147 {
11148 res = async_var;
11149 goto done;
11150 }
11151 p->mark = mark;
11152 }
11153 res = NULL;
11154 done:
11155 return res;
11156}
11157
Guido van Rossumc001c092020-04-30 12:12:19 -070011158// _tmp_18: 'for' | ASYNC
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011159static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011160_tmp_18_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011161{
11162 if (p->error_indicator) {
11163 return NULL;
11164 }
11165 void * res = NULL;
11166 int mark = p->mark;
11167 { // 'for'
11168 void *keyword;
11169 if (
11170 (keyword = _PyPegen_expect_token(p, 517))
11171 )
11172 {
11173 res = keyword;
11174 goto done;
11175 }
11176 p->mark = mark;
11177 }
11178 { // ASYNC
11179 void *async_var;
11180 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010011181 (async_var = _PyPegen_expect_token(p, ASYNC))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011182 )
11183 {
11184 res = async_var;
11185 goto done;
11186 }
11187 p->mark = mark;
11188 }
11189 res = NULL;
11190 done:
11191 return res;
11192}
11193
Guido van Rossumc001c092020-04-30 12:12:19 -070011194// _tmp_19: '=' annotated_rhs
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011195static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011196_tmp_19_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011197{
11198 if (p->error_indicator) {
11199 return NULL;
11200 }
11201 void * res = NULL;
11202 int mark = p->mark;
11203 { // '=' annotated_rhs
11204 expr_ty d;
11205 void *literal;
11206 if (
11207 (literal = _PyPegen_expect_token(p, 22))
11208 &&
11209 (d = annotated_rhs_rule(p))
11210 )
11211 {
11212 res = d;
11213 if (res == NULL && PyErr_Occurred()) {
11214 p->error_indicator = 1;
11215 return NULL;
11216 }
11217 goto done;
11218 }
11219 p->mark = mark;
11220 }
11221 res = NULL;
11222 done:
11223 return res;
11224}
11225
Guido van Rossumc001c092020-04-30 12:12:19 -070011226// _tmp_20: '(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011227static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011228_tmp_20_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011229{
11230 if (p->error_indicator) {
11231 return NULL;
11232 }
11233 void * res = NULL;
11234 int mark = p->mark;
11235 { // '(' inside_paren_ann_assign_target ')'
11236 expr_ty b;
11237 void *literal;
11238 void *literal_1;
11239 if (
11240 (literal = _PyPegen_expect_token(p, 7))
11241 &&
11242 (b = inside_paren_ann_assign_target_rule(p))
11243 &&
11244 (literal_1 = _PyPegen_expect_token(p, 8))
11245 )
11246 {
11247 res = b;
11248 if (res == NULL && PyErr_Occurred()) {
11249 p->error_indicator = 1;
11250 return NULL;
11251 }
11252 goto done;
11253 }
11254 p->mark = mark;
11255 }
11256 { // ann_assign_subscript_attribute_target
11257 expr_ty ann_assign_subscript_attribute_target_var;
11258 if (
11259 (ann_assign_subscript_attribute_target_var = ann_assign_subscript_attribute_target_rule(p))
11260 )
11261 {
11262 res = ann_assign_subscript_attribute_target_var;
11263 goto done;
11264 }
11265 p->mark = mark;
11266 }
11267 res = NULL;
11268 done:
11269 return res;
11270}
11271
Guido van Rossumc001c092020-04-30 12:12:19 -070011272// _tmp_21: '=' annotated_rhs
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011273static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011274_tmp_21_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011275{
11276 if (p->error_indicator) {
11277 return NULL;
11278 }
11279 void * res = NULL;
11280 int mark = p->mark;
11281 { // '=' annotated_rhs
11282 expr_ty d;
11283 void *literal;
11284 if (
11285 (literal = _PyPegen_expect_token(p, 22))
11286 &&
11287 (d = annotated_rhs_rule(p))
11288 )
11289 {
11290 res = d;
11291 if (res == NULL && PyErr_Occurred()) {
11292 p->error_indicator = 1;
11293 return NULL;
11294 }
11295 goto done;
11296 }
11297 p->mark = mark;
11298 }
11299 res = NULL;
11300 done:
11301 return res;
11302}
11303
Guido van Rossumc001c092020-04-30 12:12:19 -070011304// _loop1_22: (star_targets '=')
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011305static asdl_seq *
11306_loop1_22_rule(Parser *p)
11307{
11308 if (p->error_indicator) {
11309 return NULL;
11310 }
11311 void *res = NULL;
11312 int mark = p->mark;
11313 int start_mark = p->mark;
11314 void **children = PyMem_Malloc(sizeof(void *));
11315 if (!children) {
11316 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11317 return NULL;
11318 }
11319 ssize_t children_capacity = 1;
11320 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070011321 { // (star_targets '=')
11322 void *_tmp_129_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011323 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070011324 (_tmp_129_var = _tmp_129_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011325 )
11326 {
Guido van Rossumc001c092020-04-30 12:12:19 -070011327 res = _tmp_129_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011328 if (n == children_capacity) {
11329 children_capacity *= 2;
11330 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11331 if (!children) {
11332 PyErr_Format(PyExc_MemoryError, "realloc None");
11333 return NULL;
11334 }
11335 }
11336 children[n++] = res;
11337 mark = p->mark;
11338 }
11339 p->mark = mark;
11340 }
11341 if (n == 0) {
11342 PyMem_Free(children);
11343 return NULL;
11344 }
11345 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11346 if (!seq) {
11347 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_22");
11348 PyMem_Free(children);
11349 return NULL;
11350 }
11351 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11352 PyMem_Free(children);
11353 _PyPegen_insert_memo(p, start_mark, _loop1_22_type, seq);
11354 return seq;
11355}
11356
Guido van Rossumc001c092020-04-30 12:12:19 -070011357// _tmp_23: yield_expr | star_expressions
11358static void *
11359_tmp_23_rule(Parser *p)
11360{
11361 if (p->error_indicator) {
11362 return NULL;
11363 }
11364 void * res = NULL;
11365 int mark = p->mark;
11366 { // yield_expr
11367 expr_ty yield_expr_var;
11368 if (
11369 (yield_expr_var = yield_expr_rule(p))
11370 )
11371 {
11372 res = yield_expr_var;
11373 goto done;
11374 }
11375 p->mark = mark;
11376 }
11377 { // star_expressions
11378 expr_ty star_expressions_var;
11379 if (
11380 (star_expressions_var = star_expressions_rule(p))
11381 )
11382 {
11383 res = star_expressions_var;
11384 goto done;
11385 }
11386 p->mark = mark;
11387 }
11388 res = NULL;
11389 done:
11390 return res;
11391}
11392
11393// _tmp_24: yield_expr | star_expressions
11394static void *
11395_tmp_24_rule(Parser *p)
11396{
11397 if (p->error_indicator) {
11398 return NULL;
11399 }
11400 void * res = NULL;
11401 int mark = p->mark;
11402 { // yield_expr
11403 expr_ty yield_expr_var;
11404 if (
11405 (yield_expr_var = yield_expr_rule(p))
11406 )
11407 {
11408 res = yield_expr_var;
11409 goto done;
11410 }
11411 p->mark = mark;
11412 }
11413 { // star_expressions
11414 expr_ty star_expressions_var;
11415 if (
11416 (star_expressions_var = star_expressions_rule(p))
11417 )
11418 {
11419 res = star_expressions_var;
11420 goto done;
11421 }
11422 p->mark = mark;
11423 }
11424 res = NULL;
11425 done:
11426 return res;
11427}
11428
11429// _loop0_26: ',' NAME
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011430static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070011431_loop0_26_rule(Parser *p)
11432{
11433 if (p->error_indicator) {
11434 return NULL;
11435 }
11436 void *res = NULL;
11437 int mark = p->mark;
11438 int start_mark = p->mark;
11439 void **children = PyMem_Malloc(sizeof(void *));
11440 if (!children) {
11441 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11442 return NULL;
11443 }
11444 ssize_t children_capacity = 1;
11445 ssize_t n = 0;
11446 { // ',' NAME
11447 expr_ty elem;
11448 void *literal;
11449 while (
11450 (literal = _PyPegen_expect_token(p, 12))
11451 &&
11452 (elem = _PyPegen_name_token(p))
11453 )
11454 {
11455 res = elem;
11456 if (res == NULL && PyErr_Occurred()) {
11457 p->error_indicator = 1;
11458 PyMem_Free(children);
11459 return NULL;
11460 }
11461 if (n == children_capacity) {
11462 children_capacity *= 2;
11463 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11464 if (!children) {
11465 PyErr_Format(PyExc_MemoryError, "realloc None");
11466 return NULL;
11467 }
11468 }
11469 children[n++] = res;
11470 mark = p->mark;
11471 }
11472 p->mark = mark;
11473 }
11474 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11475 if (!seq) {
11476 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_26");
11477 PyMem_Free(children);
11478 return NULL;
11479 }
11480 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11481 PyMem_Free(children);
11482 _PyPegen_insert_memo(p, start_mark, _loop0_26_type, seq);
11483 return seq;
11484}
11485
11486// _gather_25: NAME _loop0_26
11487static asdl_seq *
11488_gather_25_rule(Parser *p)
11489{
11490 if (p->error_indicator) {
11491 return NULL;
11492 }
11493 asdl_seq * res = NULL;
11494 int mark = p->mark;
11495 { // NAME _loop0_26
11496 expr_ty elem;
11497 asdl_seq * seq;
11498 if (
11499 (elem = _PyPegen_name_token(p))
11500 &&
11501 (seq = _loop0_26_rule(p))
11502 )
11503 {
11504 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11505 goto done;
11506 }
11507 p->mark = mark;
11508 }
11509 res = NULL;
11510 done:
11511 return res;
11512}
11513
11514// _loop0_28: ',' NAME
11515static asdl_seq *
11516_loop0_28_rule(Parser *p)
11517{
11518 if (p->error_indicator) {
11519 return NULL;
11520 }
11521 void *res = NULL;
11522 int mark = p->mark;
11523 int start_mark = p->mark;
11524 void **children = PyMem_Malloc(sizeof(void *));
11525 if (!children) {
11526 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11527 return NULL;
11528 }
11529 ssize_t children_capacity = 1;
11530 ssize_t n = 0;
11531 { // ',' NAME
11532 expr_ty elem;
11533 void *literal;
11534 while (
11535 (literal = _PyPegen_expect_token(p, 12))
11536 &&
11537 (elem = _PyPegen_name_token(p))
11538 )
11539 {
11540 res = elem;
11541 if (res == NULL && PyErr_Occurred()) {
11542 p->error_indicator = 1;
11543 PyMem_Free(children);
11544 return NULL;
11545 }
11546 if (n == children_capacity) {
11547 children_capacity *= 2;
11548 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11549 if (!children) {
11550 PyErr_Format(PyExc_MemoryError, "realloc None");
11551 return NULL;
11552 }
11553 }
11554 children[n++] = res;
11555 mark = p->mark;
11556 }
11557 p->mark = mark;
11558 }
11559 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11560 if (!seq) {
11561 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_28");
11562 PyMem_Free(children);
11563 return NULL;
11564 }
11565 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11566 PyMem_Free(children);
11567 _PyPegen_insert_memo(p, start_mark, _loop0_28_type, seq);
11568 return seq;
11569}
11570
11571// _gather_27: NAME _loop0_28
11572static asdl_seq *
11573_gather_27_rule(Parser *p)
11574{
11575 if (p->error_indicator) {
11576 return NULL;
11577 }
11578 asdl_seq * res = NULL;
11579 int mark = p->mark;
11580 { // NAME _loop0_28
11581 expr_ty elem;
11582 asdl_seq * seq;
11583 if (
11584 (elem = _PyPegen_name_token(p))
11585 &&
11586 (seq = _loop0_28_rule(p))
11587 )
11588 {
11589 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11590 goto done;
11591 }
11592 p->mark = mark;
11593 }
11594 res = NULL;
11595 done:
11596 return res;
11597}
11598
11599// _tmp_29: ',' expression
11600static void *
11601_tmp_29_rule(Parser *p)
11602{
11603 if (p->error_indicator) {
11604 return NULL;
11605 }
11606 void * res = NULL;
11607 int mark = p->mark;
11608 { // ',' expression
11609 void *literal;
11610 expr_ty z;
11611 if (
11612 (literal = _PyPegen_expect_token(p, 12))
11613 &&
11614 (z = expression_rule(p))
11615 )
11616 {
11617 res = z;
11618 if (res == NULL && PyErr_Occurred()) {
11619 p->error_indicator = 1;
11620 return NULL;
11621 }
11622 goto done;
11623 }
11624 p->mark = mark;
11625 }
11626 res = NULL;
11627 done:
11628 return res;
11629}
11630
11631// _loop0_30: ('.' | '...')
11632static asdl_seq *
11633_loop0_30_rule(Parser *p)
11634{
11635 if (p->error_indicator) {
11636 return NULL;
11637 }
11638 void *res = NULL;
11639 int mark = p->mark;
11640 int start_mark = p->mark;
11641 void **children = PyMem_Malloc(sizeof(void *));
11642 if (!children) {
11643 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11644 return NULL;
11645 }
11646 ssize_t children_capacity = 1;
11647 ssize_t n = 0;
11648 { // ('.' | '...')
11649 void *_tmp_130_var;
11650 while (
11651 (_tmp_130_var = _tmp_130_rule(p))
11652 )
11653 {
11654 res = _tmp_130_var;
11655 if (n == children_capacity) {
11656 children_capacity *= 2;
11657 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11658 if (!children) {
11659 PyErr_Format(PyExc_MemoryError, "realloc None");
11660 return NULL;
11661 }
11662 }
11663 children[n++] = res;
11664 mark = p->mark;
11665 }
11666 p->mark = mark;
11667 }
11668 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11669 if (!seq) {
11670 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_30");
11671 PyMem_Free(children);
11672 return NULL;
11673 }
11674 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11675 PyMem_Free(children);
11676 _PyPegen_insert_memo(p, start_mark, _loop0_30_type, seq);
11677 return seq;
11678}
11679
11680// _loop1_31: ('.' | '...')
11681static asdl_seq *
11682_loop1_31_rule(Parser *p)
11683{
11684 if (p->error_indicator) {
11685 return NULL;
11686 }
11687 void *res = NULL;
11688 int mark = p->mark;
11689 int start_mark = p->mark;
11690 void **children = PyMem_Malloc(sizeof(void *));
11691 if (!children) {
11692 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11693 return NULL;
11694 }
11695 ssize_t children_capacity = 1;
11696 ssize_t n = 0;
11697 { // ('.' | '...')
11698 void *_tmp_131_var;
11699 while (
11700 (_tmp_131_var = _tmp_131_rule(p))
11701 )
11702 {
11703 res = _tmp_131_var;
11704 if (n == children_capacity) {
11705 children_capacity *= 2;
11706 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11707 if (!children) {
11708 PyErr_Format(PyExc_MemoryError, "realloc None");
11709 return NULL;
11710 }
11711 }
11712 children[n++] = res;
11713 mark = p->mark;
11714 }
11715 p->mark = mark;
11716 }
11717 if (n == 0) {
11718 PyMem_Free(children);
11719 return NULL;
11720 }
11721 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11722 if (!seq) {
11723 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_31");
11724 PyMem_Free(children);
11725 return NULL;
11726 }
11727 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11728 PyMem_Free(children);
11729 _PyPegen_insert_memo(p, start_mark, _loop1_31_type, seq);
11730 return seq;
11731}
11732
11733// _loop0_33: ',' import_from_as_name
11734static asdl_seq *
11735_loop0_33_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011736{
11737 if (p->error_indicator) {
11738 return NULL;
11739 }
11740 void *res = NULL;
11741 int mark = p->mark;
11742 int start_mark = p->mark;
11743 void **children = PyMem_Malloc(sizeof(void *));
11744 if (!children) {
11745 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11746 return NULL;
11747 }
11748 ssize_t children_capacity = 1;
11749 ssize_t n = 0;
11750 { // ',' import_from_as_name
11751 alias_ty elem;
11752 void *literal;
11753 while (
11754 (literal = _PyPegen_expect_token(p, 12))
11755 &&
11756 (elem = import_from_as_name_rule(p))
11757 )
11758 {
11759 res = elem;
11760 if (res == NULL && PyErr_Occurred()) {
11761 p->error_indicator = 1;
11762 PyMem_Free(children);
11763 return NULL;
11764 }
11765 if (n == children_capacity) {
11766 children_capacity *= 2;
11767 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11768 if (!children) {
11769 PyErr_Format(PyExc_MemoryError, "realloc None");
11770 return NULL;
11771 }
11772 }
11773 children[n++] = res;
11774 mark = p->mark;
11775 }
11776 p->mark = mark;
11777 }
11778 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11779 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070011780 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_33");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011781 PyMem_Free(children);
11782 return NULL;
11783 }
11784 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11785 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070011786 _PyPegen_insert_memo(p, start_mark, _loop0_33_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011787 return seq;
11788}
11789
Guido van Rossumc001c092020-04-30 12:12:19 -070011790// _gather_32: import_from_as_name _loop0_33
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011791static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070011792_gather_32_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011793{
11794 if (p->error_indicator) {
11795 return NULL;
11796 }
11797 asdl_seq * res = NULL;
11798 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070011799 { // import_from_as_name _loop0_33
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011800 alias_ty elem;
11801 asdl_seq * seq;
11802 if (
11803 (elem = import_from_as_name_rule(p))
11804 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070011805 (seq = _loop0_33_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011806 )
11807 {
11808 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11809 goto done;
11810 }
11811 p->mark = mark;
11812 }
11813 res = NULL;
11814 done:
11815 return res;
11816}
11817
Guido van Rossumc001c092020-04-30 12:12:19 -070011818// _tmp_34: 'as' NAME
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011819static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011820_tmp_34_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011821{
11822 if (p->error_indicator) {
11823 return NULL;
11824 }
11825 void * res = NULL;
11826 int mark = p->mark;
11827 { // 'as' NAME
11828 void *keyword;
11829 expr_ty z;
11830 if (
11831 (keyword = _PyPegen_expect_token(p, 531))
11832 &&
11833 (z = _PyPegen_name_token(p))
11834 )
11835 {
11836 res = z;
11837 if (res == NULL && PyErr_Occurred()) {
11838 p->error_indicator = 1;
11839 return NULL;
11840 }
11841 goto done;
11842 }
11843 p->mark = mark;
11844 }
11845 res = NULL;
11846 done:
11847 return res;
11848}
11849
Guido van Rossumc001c092020-04-30 12:12:19 -070011850// _loop0_36: ',' dotted_as_name
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011851static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070011852_loop0_36_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011853{
11854 if (p->error_indicator) {
11855 return NULL;
11856 }
11857 void *res = NULL;
11858 int mark = p->mark;
11859 int start_mark = p->mark;
11860 void **children = PyMem_Malloc(sizeof(void *));
11861 if (!children) {
11862 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11863 return NULL;
11864 }
11865 ssize_t children_capacity = 1;
11866 ssize_t n = 0;
11867 { // ',' dotted_as_name
11868 alias_ty elem;
11869 void *literal;
11870 while (
11871 (literal = _PyPegen_expect_token(p, 12))
11872 &&
11873 (elem = dotted_as_name_rule(p))
11874 )
11875 {
11876 res = elem;
11877 if (res == NULL && PyErr_Occurred()) {
11878 p->error_indicator = 1;
11879 PyMem_Free(children);
11880 return NULL;
11881 }
11882 if (n == children_capacity) {
11883 children_capacity *= 2;
11884 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11885 if (!children) {
11886 PyErr_Format(PyExc_MemoryError, "realloc None");
11887 return NULL;
11888 }
11889 }
11890 children[n++] = res;
11891 mark = p->mark;
11892 }
11893 p->mark = mark;
11894 }
11895 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11896 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070011897 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_36");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011898 PyMem_Free(children);
11899 return NULL;
11900 }
11901 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11902 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070011903 _PyPegen_insert_memo(p, start_mark, _loop0_36_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011904 return seq;
11905}
11906
Guido van Rossumc001c092020-04-30 12:12:19 -070011907// _gather_35: dotted_as_name _loop0_36
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011908static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070011909_gather_35_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011910{
11911 if (p->error_indicator) {
11912 return NULL;
11913 }
11914 asdl_seq * res = NULL;
11915 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070011916 { // dotted_as_name _loop0_36
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011917 alias_ty elem;
11918 asdl_seq * seq;
11919 if (
11920 (elem = dotted_as_name_rule(p))
11921 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070011922 (seq = _loop0_36_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011923 )
11924 {
11925 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11926 goto done;
11927 }
11928 p->mark = mark;
11929 }
11930 res = NULL;
11931 done:
11932 return res;
11933}
11934
Guido van Rossumc001c092020-04-30 12:12:19 -070011935// _tmp_37: 'as' NAME
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011936static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011937_tmp_37_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011938{
11939 if (p->error_indicator) {
11940 return NULL;
11941 }
11942 void * res = NULL;
11943 int mark = p->mark;
11944 { // 'as' NAME
11945 void *keyword;
11946 expr_ty z;
11947 if (
11948 (keyword = _PyPegen_expect_token(p, 531))
11949 &&
11950 (z = _PyPegen_name_token(p))
11951 )
11952 {
11953 res = z;
11954 if (res == NULL && PyErr_Occurred()) {
11955 p->error_indicator = 1;
11956 return NULL;
11957 }
11958 goto done;
11959 }
11960 p->mark = mark;
11961 }
11962 res = NULL;
11963 done:
11964 return res;
11965}
11966
Guido van Rossumc001c092020-04-30 12:12:19 -070011967// _loop0_39: ',' with_item
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011968static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070011969_loop0_39_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011970{
11971 if (p->error_indicator) {
11972 return NULL;
11973 }
11974 void *res = NULL;
11975 int mark = p->mark;
11976 int start_mark = p->mark;
11977 void **children = PyMem_Malloc(sizeof(void *));
11978 if (!children) {
11979 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11980 return NULL;
11981 }
11982 ssize_t children_capacity = 1;
11983 ssize_t n = 0;
11984 { // ',' with_item
11985 withitem_ty elem;
11986 void *literal;
11987 while (
11988 (literal = _PyPegen_expect_token(p, 12))
11989 &&
11990 (elem = with_item_rule(p))
11991 )
11992 {
11993 res = elem;
11994 if (res == NULL && PyErr_Occurred()) {
11995 p->error_indicator = 1;
11996 PyMem_Free(children);
11997 return NULL;
11998 }
11999 if (n == children_capacity) {
12000 children_capacity *= 2;
12001 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12002 if (!children) {
12003 PyErr_Format(PyExc_MemoryError, "realloc None");
12004 return NULL;
12005 }
12006 }
12007 children[n++] = res;
12008 mark = p->mark;
12009 }
12010 p->mark = mark;
12011 }
12012 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12013 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012014 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_39");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012015 PyMem_Free(children);
12016 return NULL;
12017 }
12018 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12019 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012020 _PyPegen_insert_memo(p, start_mark, _loop0_39_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012021 return seq;
12022}
12023
Guido van Rossumc001c092020-04-30 12:12:19 -070012024// _gather_38: with_item _loop0_39
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012025static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012026_gather_38_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012027{
12028 if (p->error_indicator) {
12029 return NULL;
12030 }
12031 asdl_seq * res = NULL;
12032 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012033 { // with_item _loop0_39
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012034 withitem_ty elem;
12035 asdl_seq * seq;
12036 if (
12037 (elem = with_item_rule(p))
12038 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012039 (seq = _loop0_39_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012040 )
12041 {
12042 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12043 goto done;
12044 }
12045 p->mark = mark;
12046 }
12047 res = NULL;
12048 done:
12049 return res;
12050}
12051
Guido van Rossumc001c092020-04-30 12:12:19 -070012052// _loop0_41: ',' with_item
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012053static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012054_loop0_41_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012055{
12056 if (p->error_indicator) {
12057 return NULL;
12058 }
12059 void *res = NULL;
12060 int mark = p->mark;
12061 int start_mark = p->mark;
12062 void **children = PyMem_Malloc(sizeof(void *));
12063 if (!children) {
12064 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12065 return NULL;
12066 }
12067 ssize_t children_capacity = 1;
12068 ssize_t n = 0;
12069 { // ',' with_item
12070 withitem_ty elem;
12071 void *literal;
12072 while (
12073 (literal = _PyPegen_expect_token(p, 12))
12074 &&
12075 (elem = with_item_rule(p))
12076 )
12077 {
12078 res = elem;
12079 if (res == NULL && PyErr_Occurred()) {
12080 p->error_indicator = 1;
12081 PyMem_Free(children);
12082 return NULL;
12083 }
12084 if (n == children_capacity) {
12085 children_capacity *= 2;
12086 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12087 if (!children) {
12088 PyErr_Format(PyExc_MemoryError, "realloc None");
12089 return NULL;
12090 }
12091 }
12092 children[n++] = res;
12093 mark = p->mark;
12094 }
12095 p->mark = mark;
12096 }
12097 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12098 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012099 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_41");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012100 PyMem_Free(children);
12101 return NULL;
12102 }
12103 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12104 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012105 _PyPegen_insert_memo(p, start_mark, _loop0_41_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012106 return seq;
12107}
12108
Guido van Rossumc001c092020-04-30 12:12:19 -070012109// _gather_40: with_item _loop0_41
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012110static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012111_gather_40_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012112{
12113 if (p->error_indicator) {
12114 return NULL;
12115 }
12116 asdl_seq * res = NULL;
12117 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012118 { // with_item _loop0_41
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012119 withitem_ty elem;
12120 asdl_seq * seq;
12121 if (
12122 (elem = with_item_rule(p))
12123 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012124 (seq = _loop0_41_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012125 )
12126 {
12127 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12128 goto done;
12129 }
12130 p->mark = mark;
12131 }
12132 res = NULL;
12133 done:
12134 return res;
12135}
12136
Guido van Rossumc001c092020-04-30 12:12:19 -070012137// _tmp_42: 'as' target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012138static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070012139_tmp_42_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012140{
12141 if (p->error_indicator) {
12142 return NULL;
12143 }
12144 void * res = NULL;
12145 int mark = p->mark;
12146 { // 'as' target
12147 void *keyword;
12148 expr_ty t;
12149 if (
12150 (keyword = _PyPegen_expect_token(p, 531))
12151 &&
12152 (t = target_rule(p))
12153 )
12154 {
12155 res = t;
12156 if (res == NULL && PyErr_Occurred()) {
12157 p->error_indicator = 1;
12158 return NULL;
12159 }
12160 goto done;
12161 }
12162 p->mark = mark;
12163 }
12164 res = NULL;
12165 done:
12166 return res;
12167}
12168
Guido van Rossumc001c092020-04-30 12:12:19 -070012169// _loop1_43: except_block
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012170static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012171_loop1_43_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012172{
12173 if (p->error_indicator) {
12174 return NULL;
12175 }
12176 void *res = NULL;
12177 int mark = p->mark;
12178 int start_mark = p->mark;
12179 void **children = PyMem_Malloc(sizeof(void *));
12180 if (!children) {
12181 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12182 return NULL;
12183 }
12184 ssize_t children_capacity = 1;
12185 ssize_t n = 0;
12186 { // except_block
12187 excepthandler_ty except_block_var;
12188 while (
12189 (except_block_var = except_block_rule(p))
12190 )
12191 {
12192 res = except_block_var;
12193 if (n == children_capacity) {
12194 children_capacity *= 2;
12195 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12196 if (!children) {
12197 PyErr_Format(PyExc_MemoryError, "realloc None");
12198 return NULL;
12199 }
12200 }
12201 children[n++] = res;
12202 mark = p->mark;
12203 }
12204 p->mark = mark;
12205 }
12206 if (n == 0) {
12207 PyMem_Free(children);
12208 return NULL;
12209 }
12210 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12211 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012212 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_43");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012213 PyMem_Free(children);
12214 return NULL;
12215 }
12216 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12217 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012218 _PyPegen_insert_memo(p, start_mark, _loop1_43_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012219 return seq;
12220}
12221
Guido van Rossumc001c092020-04-30 12:12:19 -070012222// _tmp_44: 'as' target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012223static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070012224_tmp_44_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012225{
12226 if (p->error_indicator) {
12227 return NULL;
12228 }
12229 void * res = NULL;
12230 int mark = p->mark;
12231 { // 'as' target
12232 void *keyword;
12233 expr_ty z;
12234 if (
12235 (keyword = _PyPegen_expect_token(p, 531))
12236 &&
12237 (z = target_rule(p))
12238 )
12239 {
12240 res = z;
12241 if (res == NULL && PyErr_Occurred()) {
12242 p->error_indicator = 1;
12243 return NULL;
12244 }
12245 goto done;
12246 }
12247 p->mark = mark;
12248 }
12249 res = NULL;
12250 done:
12251 return res;
12252}
12253
Guido van Rossumc001c092020-04-30 12:12:19 -070012254// _tmp_45: 'from' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012255static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070012256_tmp_45_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012257{
12258 if (p->error_indicator) {
12259 return NULL;
12260 }
12261 void * res = NULL;
12262 int mark = p->mark;
12263 { // 'from' expression
12264 void *keyword;
12265 expr_ty z;
12266 if (
12267 (keyword = _PyPegen_expect_token(p, 514))
12268 &&
12269 (z = expression_rule(p))
12270 )
12271 {
12272 res = z;
12273 if (res == NULL && PyErr_Occurred()) {
12274 p->error_indicator = 1;
12275 return NULL;
12276 }
12277 goto done;
12278 }
12279 p->mark = mark;
12280 }
12281 res = NULL;
12282 done:
12283 return res;
12284}
12285
Guido van Rossumc001c092020-04-30 12:12:19 -070012286// _tmp_46: '->' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012287static void *
12288_tmp_46_rule(Parser *p)
12289{
12290 if (p->error_indicator) {
12291 return NULL;
12292 }
12293 void * res = NULL;
12294 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012295 { // '->' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012296 void *literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070012297 expr_ty z;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012298 if (
Guido van Rossumc001c092020-04-30 12:12:19 -070012299 (literal = _PyPegen_expect_token(p, 51))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012300 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012301 (z = expression_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012302 )
12303 {
Guido van Rossumc001c092020-04-30 12:12:19 -070012304 res = z;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012305 if (res == NULL && PyErr_Occurred()) {
12306 p->error_indicator = 1;
12307 return NULL;
12308 }
12309 goto done;
12310 }
12311 p->mark = mark;
12312 }
12313 res = NULL;
12314 done:
12315 return res;
12316}
12317
Guido van Rossumc001c092020-04-30 12:12:19 -070012318// _tmp_47: NEWLINE INDENT
12319static void *
12320_tmp_47_rule(Parser *p)
12321{
12322 if (p->error_indicator) {
12323 return NULL;
12324 }
12325 void * res = NULL;
12326 int mark = p->mark;
12327 { // NEWLINE INDENT
12328 void *indent_var;
12329 void *newline_var;
12330 if (
12331 (newline_var = _PyPegen_expect_token(p, NEWLINE))
12332 &&
12333 (indent_var = _PyPegen_expect_token(p, INDENT))
12334 )
12335 {
12336 res = _PyPegen_dummy_name(p, newline_var, indent_var);
12337 goto done;
12338 }
12339 p->mark = mark;
12340 }
12341 res = NULL;
12342 done:
12343 return res;
12344}
12345
12346// _loop0_48: param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012347static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012348_loop0_48_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012349{
12350 if (p->error_indicator) {
12351 return NULL;
12352 }
12353 void *res = NULL;
12354 int mark = p->mark;
12355 int start_mark = p->mark;
12356 void **children = PyMem_Malloc(sizeof(void *));
12357 if (!children) {
12358 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12359 return NULL;
12360 }
12361 ssize_t children_capacity = 1;
12362 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070012363 { // param_no_default
12364 arg_ty param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012365 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070012366 (param_no_default_var = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012367 )
12368 {
Guido van Rossumc001c092020-04-30 12:12:19 -070012369 res = param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012370 if (n == children_capacity) {
12371 children_capacity *= 2;
12372 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12373 if (!children) {
12374 PyErr_Format(PyExc_MemoryError, "realloc None");
12375 return NULL;
12376 }
12377 }
12378 children[n++] = res;
12379 mark = p->mark;
12380 }
12381 p->mark = mark;
12382 }
12383 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12384 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012385 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_48");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012386 PyMem_Free(children);
12387 return NULL;
12388 }
12389 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12390 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012391 _PyPegen_insert_memo(p, start_mark, _loop0_48_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012392 return seq;
12393}
12394
Guido van Rossumc001c092020-04-30 12:12:19 -070012395// _loop0_49: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012396static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012397_loop0_49_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012398{
12399 if (p->error_indicator) {
12400 return NULL;
12401 }
12402 void *res = NULL;
12403 int mark = p->mark;
12404 int start_mark = p->mark;
12405 void **children = PyMem_Malloc(sizeof(void *));
12406 if (!children) {
12407 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12408 return NULL;
12409 }
12410 ssize_t children_capacity = 1;
12411 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070012412 { // param_with_default
12413 NameDefaultPair* param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012414 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070012415 (param_with_default_var = param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012416 )
12417 {
Guido van Rossumc001c092020-04-30 12:12:19 -070012418 res = param_with_default_var;
12419 if (n == children_capacity) {
12420 children_capacity *= 2;
12421 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12422 if (!children) {
12423 PyErr_Format(PyExc_MemoryError, "realloc None");
12424 return NULL;
12425 }
12426 }
12427 children[n++] = res;
12428 mark = p->mark;
12429 }
12430 p->mark = mark;
12431 }
12432 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12433 if (!seq) {
12434 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_49");
12435 PyMem_Free(children);
12436 return NULL;
12437 }
12438 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12439 PyMem_Free(children);
12440 _PyPegen_insert_memo(p, start_mark, _loop0_49_type, seq);
12441 return seq;
12442}
12443
12444// _loop0_50: param_with_default
12445static asdl_seq *
12446_loop0_50_rule(Parser *p)
12447{
12448 if (p->error_indicator) {
12449 return NULL;
12450 }
12451 void *res = NULL;
12452 int mark = p->mark;
12453 int start_mark = p->mark;
12454 void **children = PyMem_Malloc(sizeof(void *));
12455 if (!children) {
12456 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12457 return NULL;
12458 }
12459 ssize_t children_capacity = 1;
12460 ssize_t n = 0;
12461 { // param_with_default
12462 NameDefaultPair* param_with_default_var;
12463 while (
12464 (param_with_default_var = param_with_default_rule(p))
12465 )
12466 {
12467 res = param_with_default_var;
12468 if (n == children_capacity) {
12469 children_capacity *= 2;
12470 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12471 if (!children) {
12472 PyErr_Format(PyExc_MemoryError, "realloc None");
12473 return NULL;
12474 }
12475 }
12476 children[n++] = res;
12477 mark = p->mark;
12478 }
12479 p->mark = mark;
12480 }
12481 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12482 if (!seq) {
12483 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_50");
12484 PyMem_Free(children);
12485 return NULL;
12486 }
12487 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12488 PyMem_Free(children);
12489 _PyPegen_insert_memo(p, start_mark, _loop0_50_type, seq);
12490 return seq;
12491}
12492
12493// _loop1_51: param_no_default
12494static asdl_seq *
12495_loop1_51_rule(Parser *p)
12496{
12497 if (p->error_indicator) {
12498 return NULL;
12499 }
12500 void *res = NULL;
12501 int mark = p->mark;
12502 int start_mark = p->mark;
12503 void **children = PyMem_Malloc(sizeof(void *));
12504 if (!children) {
12505 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12506 return NULL;
12507 }
12508 ssize_t children_capacity = 1;
12509 ssize_t n = 0;
12510 { // param_no_default
12511 arg_ty param_no_default_var;
12512 while (
12513 (param_no_default_var = param_no_default_rule(p))
12514 )
12515 {
12516 res = param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012517 if (n == children_capacity) {
12518 children_capacity *= 2;
12519 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12520 if (!children) {
12521 PyErr_Format(PyExc_MemoryError, "realloc None");
12522 return NULL;
12523 }
12524 }
12525 children[n++] = res;
12526 mark = p->mark;
12527 }
12528 p->mark = mark;
12529 }
12530 if (n == 0) {
12531 PyMem_Free(children);
12532 return NULL;
12533 }
12534 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12535 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012536 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_51");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012537 PyMem_Free(children);
12538 return NULL;
12539 }
12540 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12541 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012542 _PyPegen_insert_memo(p, start_mark, _loop1_51_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012543 return seq;
12544}
12545
Guido van Rossumc001c092020-04-30 12:12:19 -070012546// _loop0_52: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012547static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012548_loop0_52_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012549{
12550 if (p->error_indicator) {
12551 return NULL;
12552 }
12553 void *res = NULL;
12554 int mark = p->mark;
12555 int start_mark = p->mark;
12556 void **children = PyMem_Malloc(sizeof(void *));
12557 if (!children) {
12558 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12559 return NULL;
12560 }
12561 ssize_t children_capacity = 1;
12562 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070012563 { // param_with_default
12564 NameDefaultPair* param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012565 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070012566 (param_with_default_var = param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012567 )
12568 {
Guido van Rossumc001c092020-04-30 12:12:19 -070012569 res = param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012570 if (n == children_capacity) {
12571 children_capacity *= 2;
12572 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12573 if (!children) {
12574 PyErr_Format(PyExc_MemoryError, "realloc None");
12575 return NULL;
12576 }
12577 }
12578 children[n++] = res;
12579 mark = p->mark;
12580 }
12581 p->mark = mark;
12582 }
12583 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12584 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012585 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_52");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012586 PyMem_Free(children);
12587 return NULL;
12588 }
12589 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12590 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012591 _PyPegen_insert_memo(p, start_mark, _loop0_52_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012592 return seq;
12593}
12594
Guido van Rossumc001c092020-04-30 12:12:19 -070012595// _loop1_53: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012596static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012597_loop1_53_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012598{
12599 if (p->error_indicator) {
12600 return NULL;
12601 }
12602 void *res = NULL;
12603 int mark = p->mark;
12604 int start_mark = p->mark;
12605 void **children = PyMem_Malloc(sizeof(void *));
12606 if (!children) {
12607 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12608 return NULL;
12609 }
12610 ssize_t children_capacity = 1;
12611 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070012612 { // param_with_default
12613 NameDefaultPair* param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012614 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070012615 (param_with_default_var = param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012616 )
12617 {
Guido van Rossumc001c092020-04-30 12:12:19 -070012618 res = param_with_default_var;
12619 if (n == children_capacity) {
12620 children_capacity *= 2;
12621 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12622 if (!children) {
12623 PyErr_Format(PyExc_MemoryError, "realloc None");
12624 return NULL;
12625 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012626 }
Guido van Rossumc001c092020-04-30 12:12:19 -070012627 children[n++] = res;
12628 mark = p->mark;
12629 }
12630 p->mark = mark;
12631 }
12632 if (n == 0) {
12633 PyMem_Free(children);
12634 return NULL;
12635 }
12636 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12637 if (!seq) {
12638 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_53");
12639 PyMem_Free(children);
12640 return NULL;
12641 }
12642 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12643 PyMem_Free(children);
12644 _PyPegen_insert_memo(p, start_mark, _loop1_53_type, seq);
12645 return seq;
12646}
12647
12648// _loop1_54: param_no_default
12649static asdl_seq *
12650_loop1_54_rule(Parser *p)
12651{
12652 if (p->error_indicator) {
12653 return NULL;
12654 }
12655 void *res = NULL;
12656 int mark = p->mark;
12657 int start_mark = p->mark;
12658 void **children = PyMem_Malloc(sizeof(void *));
12659 if (!children) {
12660 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12661 return NULL;
12662 }
12663 ssize_t children_capacity = 1;
12664 ssize_t n = 0;
12665 { // param_no_default
12666 arg_ty param_no_default_var;
12667 while (
12668 (param_no_default_var = param_no_default_rule(p))
12669 )
12670 {
12671 res = param_no_default_var;
12672 if (n == children_capacity) {
12673 children_capacity *= 2;
12674 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12675 if (!children) {
12676 PyErr_Format(PyExc_MemoryError, "realloc None");
12677 return NULL;
12678 }
12679 }
12680 children[n++] = res;
12681 mark = p->mark;
12682 }
12683 p->mark = mark;
12684 }
12685 if (n == 0) {
12686 PyMem_Free(children);
12687 return NULL;
12688 }
12689 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12690 if (!seq) {
12691 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_54");
12692 PyMem_Free(children);
12693 return NULL;
12694 }
12695 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12696 PyMem_Free(children);
12697 _PyPegen_insert_memo(p, start_mark, _loop1_54_type, seq);
12698 return seq;
12699}
12700
12701// _loop1_55: param_no_default
12702static asdl_seq *
12703_loop1_55_rule(Parser *p)
12704{
12705 if (p->error_indicator) {
12706 return NULL;
12707 }
12708 void *res = NULL;
12709 int mark = p->mark;
12710 int start_mark = p->mark;
12711 void **children = PyMem_Malloc(sizeof(void *));
12712 if (!children) {
12713 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12714 return NULL;
12715 }
12716 ssize_t children_capacity = 1;
12717 ssize_t n = 0;
12718 { // param_no_default
12719 arg_ty param_no_default_var;
12720 while (
12721 (param_no_default_var = param_no_default_rule(p))
12722 )
12723 {
12724 res = param_no_default_var;
12725 if (n == children_capacity) {
12726 children_capacity *= 2;
12727 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12728 if (!children) {
12729 PyErr_Format(PyExc_MemoryError, "realloc None");
12730 return NULL;
12731 }
12732 }
12733 children[n++] = res;
12734 mark = p->mark;
12735 }
12736 p->mark = mark;
12737 }
12738 if (n == 0) {
12739 PyMem_Free(children);
12740 return NULL;
12741 }
12742 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12743 if (!seq) {
12744 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_55");
12745 PyMem_Free(children);
12746 return NULL;
12747 }
12748 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12749 PyMem_Free(children);
12750 _PyPegen_insert_memo(p, start_mark, _loop1_55_type, seq);
12751 return seq;
12752}
12753
12754// _loop0_56: param_no_default
12755static asdl_seq *
12756_loop0_56_rule(Parser *p)
12757{
12758 if (p->error_indicator) {
12759 return NULL;
12760 }
12761 void *res = NULL;
12762 int mark = p->mark;
12763 int start_mark = p->mark;
12764 void **children = PyMem_Malloc(sizeof(void *));
12765 if (!children) {
12766 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12767 return NULL;
12768 }
12769 ssize_t children_capacity = 1;
12770 ssize_t n = 0;
12771 { // param_no_default
12772 arg_ty param_no_default_var;
12773 while (
12774 (param_no_default_var = param_no_default_rule(p))
12775 )
12776 {
12777 res = param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012778 if (n == children_capacity) {
12779 children_capacity *= 2;
12780 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12781 if (!children) {
12782 PyErr_Format(PyExc_MemoryError, "realloc None");
12783 return NULL;
12784 }
12785 }
12786 children[n++] = res;
12787 mark = p->mark;
12788 }
12789 p->mark = mark;
12790 }
12791 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12792 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012793 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_56");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012794 PyMem_Free(children);
12795 return NULL;
12796 }
12797 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12798 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012799 _PyPegen_insert_memo(p, start_mark, _loop0_56_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012800 return seq;
12801}
12802
Guido van Rossumc001c092020-04-30 12:12:19 -070012803// _loop1_57: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012804static asdl_seq *
12805_loop1_57_rule(Parser *p)
12806{
12807 if (p->error_indicator) {
12808 return NULL;
12809 }
12810 void *res = NULL;
12811 int mark = p->mark;
12812 int start_mark = p->mark;
12813 void **children = PyMem_Malloc(sizeof(void *));
12814 if (!children) {
12815 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12816 return NULL;
12817 }
12818 ssize_t children_capacity = 1;
12819 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070012820 { // param_with_default
12821 NameDefaultPair* param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012822 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070012823 (param_with_default_var = param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012824 )
12825 {
Guido van Rossumc001c092020-04-30 12:12:19 -070012826 res = param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012827 if (n == children_capacity) {
12828 children_capacity *= 2;
12829 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12830 if (!children) {
12831 PyErr_Format(PyExc_MemoryError, "realloc None");
12832 return NULL;
12833 }
12834 }
12835 children[n++] = res;
12836 mark = p->mark;
12837 }
12838 p->mark = mark;
12839 }
12840 if (n == 0) {
12841 PyMem_Free(children);
12842 return NULL;
12843 }
12844 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12845 if (!seq) {
12846 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_57");
12847 PyMem_Free(children);
12848 return NULL;
12849 }
12850 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12851 PyMem_Free(children);
12852 _PyPegen_insert_memo(p, start_mark, _loop1_57_type, seq);
12853 return seq;
12854}
12855
Guido van Rossumc001c092020-04-30 12:12:19 -070012856// _loop0_58: param_no_default
12857static asdl_seq *
12858_loop0_58_rule(Parser *p)
12859{
12860 if (p->error_indicator) {
12861 return NULL;
12862 }
12863 void *res = NULL;
12864 int mark = p->mark;
12865 int start_mark = p->mark;
12866 void **children = PyMem_Malloc(sizeof(void *));
12867 if (!children) {
12868 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12869 return NULL;
12870 }
12871 ssize_t children_capacity = 1;
12872 ssize_t n = 0;
12873 { // param_no_default
12874 arg_ty param_no_default_var;
12875 while (
12876 (param_no_default_var = param_no_default_rule(p))
12877 )
12878 {
12879 res = param_no_default_var;
12880 if (n == children_capacity) {
12881 children_capacity *= 2;
12882 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12883 if (!children) {
12884 PyErr_Format(PyExc_MemoryError, "realloc None");
12885 return NULL;
12886 }
12887 }
12888 children[n++] = res;
12889 mark = p->mark;
12890 }
12891 p->mark = mark;
12892 }
12893 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12894 if (!seq) {
12895 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_58");
12896 PyMem_Free(children);
12897 return NULL;
12898 }
12899 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12900 PyMem_Free(children);
12901 _PyPegen_insert_memo(p, start_mark, _loop0_58_type, seq);
12902 return seq;
12903}
12904
12905// _loop1_59: param_with_default
12906static asdl_seq *
12907_loop1_59_rule(Parser *p)
12908{
12909 if (p->error_indicator) {
12910 return NULL;
12911 }
12912 void *res = NULL;
12913 int mark = p->mark;
12914 int start_mark = p->mark;
12915 void **children = PyMem_Malloc(sizeof(void *));
12916 if (!children) {
12917 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12918 return NULL;
12919 }
12920 ssize_t children_capacity = 1;
12921 ssize_t n = 0;
12922 { // param_with_default
12923 NameDefaultPair* param_with_default_var;
12924 while (
12925 (param_with_default_var = param_with_default_rule(p))
12926 )
12927 {
12928 res = param_with_default_var;
12929 if (n == children_capacity) {
12930 children_capacity *= 2;
12931 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12932 if (!children) {
12933 PyErr_Format(PyExc_MemoryError, "realloc None");
12934 return NULL;
12935 }
12936 }
12937 children[n++] = res;
12938 mark = p->mark;
12939 }
12940 p->mark = mark;
12941 }
12942 if (n == 0) {
12943 PyMem_Free(children);
12944 return NULL;
12945 }
12946 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12947 if (!seq) {
12948 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_59");
12949 PyMem_Free(children);
12950 return NULL;
12951 }
12952 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12953 PyMem_Free(children);
12954 _PyPegen_insert_memo(p, start_mark, _loop1_59_type, seq);
12955 return seq;
12956}
12957
12958// _loop0_60: param_maybe_default
12959static asdl_seq *
12960_loop0_60_rule(Parser *p)
12961{
12962 if (p->error_indicator) {
12963 return NULL;
12964 }
12965 void *res = NULL;
12966 int mark = p->mark;
12967 int start_mark = p->mark;
12968 void **children = PyMem_Malloc(sizeof(void *));
12969 if (!children) {
12970 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12971 return NULL;
12972 }
12973 ssize_t children_capacity = 1;
12974 ssize_t n = 0;
12975 { // param_maybe_default
12976 NameDefaultPair* param_maybe_default_var;
12977 while (
12978 (param_maybe_default_var = param_maybe_default_rule(p))
12979 )
12980 {
12981 res = param_maybe_default_var;
12982 if (n == children_capacity) {
12983 children_capacity *= 2;
12984 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12985 if (!children) {
12986 PyErr_Format(PyExc_MemoryError, "realloc None");
12987 return NULL;
12988 }
12989 }
12990 children[n++] = res;
12991 mark = p->mark;
12992 }
12993 p->mark = mark;
12994 }
12995 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12996 if (!seq) {
12997 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_60");
12998 PyMem_Free(children);
12999 return NULL;
13000 }
13001 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13002 PyMem_Free(children);
13003 _PyPegen_insert_memo(p, start_mark, _loop0_60_type, seq);
13004 return seq;
13005}
13006
13007// _loop1_61: param_maybe_default
13008static asdl_seq *
13009_loop1_61_rule(Parser *p)
13010{
13011 if (p->error_indicator) {
13012 return NULL;
13013 }
13014 void *res = NULL;
13015 int mark = p->mark;
13016 int start_mark = p->mark;
13017 void **children = PyMem_Malloc(sizeof(void *));
13018 if (!children) {
13019 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13020 return NULL;
13021 }
13022 ssize_t children_capacity = 1;
13023 ssize_t n = 0;
13024 { // param_maybe_default
13025 NameDefaultPair* param_maybe_default_var;
13026 while (
13027 (param_maybe_default_var = param_maybe_default_rule(p))
13028 )
13029 {
13030 res = param_maybe_default_var;
13031 if (n == children_capacity) {
13032 children_capacity *= 2;
13033 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13034 if (!children) {
13035 PyErr_Format(PyExc_MemoryError, "realloc None");
13036 return NULL;
13037 }
13038 }
13039 children[n++] = res;
13040 mark = p->mark;
13041 }
13042 p->mark = mark;
13043 }
13044 if (n == 0) {
13045 PyMem_Free(children);
13046 return NULL;
13047 }
13048 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13049 if (!seq) {
13050 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_61");
13051 PyMem_Free(children);
13052 return NULL;
13053 }
13054 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13055 PyMem_Free(children);
13056 _PyPegen_insert_memo(p, start_mark, _loop1_61_type, seq);
13057 return seq;
13058}
13059
13060// _loop1_62: ('@' named_expression NEWLINE)
13061static asdl_seq *
13062_loop1_62_rule(Parser *p)
13063{
13064 if (p->error_indicator) {
13065 return NULL;
13066 }
13067 void *res = NULL;
13068 int mark = p->mark;
13069 int start_mark = p->mark;
13070 void **children = PyMem_Malloc(sizeof(void *));
13071 if (!children) {
13072 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13073 return NULL;
13074 }
13075 ssize_t children_capacity = 1;
13076 ssize_t n = 0;
13077 { // ('@' named_expression NEWLINE)
13078 void *_tmp_132_var;
13079 while (
13080 (_tmp_132_var = _tmp_132_rule(p))
13081 )
13082 {
13083 res = _tmp_132_var;
13084 if (n == children_capacity) {
13085 children_capacity *= 2;
13086 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13087 if (!children) {
13088 PyErr_Format(PyExc_MemoryError, "realloc None");
13089 return NULL;
13090 }
13091 }
13092 children[n++] = res;
13093 mark = p->mark;
13094 }
13095 p->mark = mark;
13096 }
13097 if (n == 0) {
13098 PyMem_Free(children);
13099 return NULL;
13100 }
13101 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13102 if (!seq) {
13103 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_62");
13104 PyMem_Free(children);
13105 return NULL;
13106 }
13107 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13108 PyMem_Free(children);
13109 _PyPegen_insert_memo(p, start_mark, _loop1_62_type, seq);
13110 return seq;
13111}
13112
13113// _tmp_63: '(' arguments? ')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013114static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070013115_tmp_63_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013116{
13117 if (p->error_indicator) {
13118 return NULL;
13119 }
13120 void * res = NULL;
13121 int mark = p->mark;
13122 { // '(' arguments? ')'
13123 void *literal;
13124 void *literal_1;
13125 void *z;
13126 if (
13127 (literal = _PyPegen_expect_token(p, 7))
13128 &&
13129 (z = arguments_rule(p), 1)
13130 &&
13131 (literal_1 = _PyPegen_expect_token(p, 8))
13132 )
13133 {
13134 res = z;
13135 if (res == NULL && PyErr_Occurred()) {
13136 p->error_indicator = 1;
13137 return NULL;
13138 }
13139 goto done;
13140 }
13141 p->mark = mark;
13142 }
13143 res = NULL;
13144 done:
13145 return res;
13146}
13147
Guido van Rossumc001c092020-04-30 12:12:19 -070013148// _loop0_65: ',' star_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013149static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070013150_loop0_65_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013151{
13152 if (p->error_indicator) {
13153 return NULL;
13154 }
13155 void *res = NULL;
13156 int mark = p->mark;
13157 int start_mark = p->mark;
13158 void **children = PyMem_Malloc(sizeof(void *));
13159 if (!children) {
13160 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13161 return NULL;
13162 }
13163 ssize_t children_capacity = 1;
13164 ssize_t n = 0;
13165 { // ',' star_expression
13166 expr_ty elem;
13167 void *literal;
13168 while (
13169 (literal = _PyPegen_expect_token(p, 12))
13170 &&
13171 (elem = star_expression_rule(p))
13172 )
13173 {
13174 res = elem;
13175 if (res == NULL && PyErr_Occurred()) {
13176 p->error_indicator = 1;
13177 PyMem_Free(children);
13178 return NULL;
13179 }
13180 if (n == children_capacity) {
13181 children_capacity *= 2;
13182 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13183 if (!children) {
13184 PyErr_Format(PyExc_MemoryError, "realloc None");
13185 return NULL;
13186 }
13187 }
13188 children[n++] = res;
13189 mark = p->mark;
13190 }
13191 p->mark = mark;
13192 }
13193 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13194 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070013195 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_65");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013196 PyMem_Free(children);
13197 return NULL;
13198 }
13199 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13200 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070013201 _PyPegen_insert_memo(p, start_mark, _loop0_65_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013202 return seq;
13203}
13204
Guido van Rossumc001c092020-04-30 12:12:19 -070013205// _gather_64: star_expression _loop0_65
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013206static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070013207_gather_64_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013208{
13209 if (p->error_indicator) {
13210 return NULL;
13211 }
13212 asdl_seq * res = NULL;
13213 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070013214 { // star_expression _loop0_65
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013215 expr_ty elem;
13216 asdl_seq * seq;
13217 if (
13218 (elem = star_expression_rule(p))
13219 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070013220 (seq = _loop0_65_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013221 )
13222 {
13223 res = _PyPegen_seq_insert_in_front(p, elem, seq);
13224 goto done;
13225 }
13226 p->mark = mark;
13227 }
13228 res = NULL;
13229 done:
13230 return res;
13231}
13232
Guido van Rossumc001c092020-04-30 12:12:19 -070013233// _loop1_66: (',' star_expression)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013234static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070013235_loop1_66_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013236{
13237 if (p->error_indicator) {
13238 return NULL;
13239 }
13240 void *res = NULL;
13241 int mark = p->mark;
13242 int start_mark = p->mark;
13243 void **children = PyMem_Malloc(sizeof(void *));
13244 if (!children) {
13245 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13246 return NULL;
13247 }
13248 ssize_t children_capacity = 1;
13249 ssize_t n = 0;
13250 { // (',' star_expression)
Guido van Rossumc001c092020-04-30 12:12:19 -070013251 void *_tmp_133_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013252 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070013253 (_tmp_133_var = _tmp_133_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013254 )
13255 {
Guido van Rossumc001c092020-04-30 12:12:19 -070013256 res = _tmp_133_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013257 if (n == children_capacity) {
13258 children_capacity *= 2;
13259 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13260 if (!children) {
13261 PyErr_Format(PyExc_MemoryError, "realloc None");
13262 return NULL;
13263 }
13264 }
13265 children[n++] = res;
13266 mark = p->mark;
13267 }
13268 p->mark = mark;
13269 }
13270 if (n == 0) {
13271 PyMem_Free(children);
13272 return NULL;
13273 }
13274 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13275 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070013276 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_66");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013277 PyMem_Free(children);
13278 return NULL;
13279 }
13280 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13281 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070013282 _PyPegen_insert_memo(p, start_mark, _loop1_66_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013283 return seq;
13284}
13285
Guido van Rossumc001c092020-04-30 12:12:19 -070013286// _loop0_68: ',' star_named_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013287static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070013288_loop0_68_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013289{
13290 if (p->error_indicator) {
13291 return NULL;
13292 }
13293 void *res = NULL;
13294 int mark = p->mark;
13295 int start_mark = p->mark;
13296 void **children = PyMem_Malloc(sizeof(void *));
13297 if (!children) {
13298 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13299 return NULL;
13300 }
13301 ssize_t children_capacity = 1;
13302 ssize_t n = 0;
13303 { // ',' star_named_expression
13304 expr_ty elem;
13305 void *literal;
13306 while (
13307 (literal = _PyPegen_expect_token(p, 12))
13308 &&
13309 (elem = star_named_expression_rule(p))
13310 )
13311 {
13312 res = elem;
13313 if (res == NULL && PyErr_Occurred()) {
13314 p->error_indicator = 1;
13315 PyMem_Free(children);
13316 return NULL;
13317 }
13318 if (n == children_capacity) {
13319 children_capacity *= 2;
13320 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13321 if (!children) {
13322 PyErr_Format(PyExc_MemoryError, "realloc None");
13323 return NULL;
13324 }
13325 }
13326 children[n++] = res;
13327 mark = p->mark;
13328 }
13329 p->mark = mark;
13330 }
13331 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13332 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070013333 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_68");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013334 PyMem_Free(children);
13335 return NULL;
13336 }
13337 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13338 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070013339 _PyPegen_insert_memo(p, start_mark, _loop0_68_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013340 return seq;
13341}
13342
Guido van Rossumc001c092020-04-30 12:12:19 -070013343// _gather_67: star_named_expression _loop0_68
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013344static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070013345_gather_67_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013346{
13347 if (p->error_indicator) {
13348 return NULL;
13349 }
13350 asdl_seq * res = NULL;
13351 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070013352 { // star_named_expression _loop0_68
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013353 expr_ty elem;
13354 asdl_seq * seq;
13355 if (
13356 (elem = star_named_expression_rule(p))
13357 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070013358 (seq = _loop0_68_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013359 )
13360 {
13361 res = _PyPegen_seq_insert_in_front(p, elem, seq);
13362 goto done;
13363 }
13364 p->mark = mark;
13365 }
13366 res = NULL;
13367 done:
13368 return res;
13369}
13370
Guido van Rossumc001c092020-04-30 12:12:19 -070013371// _loop1_69: (',' expression)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013372static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070013373_loop1_69_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013374{
13375 if (p->error_indicator) {
13376 return NULL;
13377 }
13378 void *res = NULL;
13379 int mark = p->mark;
13380 int start_mark = p->mark;
13381 void **children = PyMem_Malloc(sizeof(void *));
13382 if (!children) {
13383 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13384 return NULL;
13385 }
13386 ssize_t children_capacity = 1;
13387 ssize_t n = 0;
13388 { // (',' expression)
Guido van Rossumc001c092020-04-30 12:12:19 -070013389 void *_tmp_134_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013390 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070013391 (_tmp_134_var = _tmp_134_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013392 )
13393 {
Guido van Rossumc001c092020-04-30 12:12:19 -070013394 res = _tmp_134_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013395 if (n == children_capacity) {
13396 children_capacity *= 2;
13397 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13398 if (!children) {
13399 PyErr_Format(PyExc_MemoryError, "realloc None");
13400 return NULL;
13401 }
13402 }
13403 children[n++] = res;
13404 mark = p->mark;
13405 }
13406 p->mark = mark;
13407 }
13408 if (n == 0) {
13409 PyMem_Free(children);
13410 return NULL;
13411 }
13412 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13413 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070013414 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_69");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013415 PyMem_Free(children);
13416 return NULL;
13417 }
13418 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13419 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070013420 _PyPegen_insert_memo(p, start_mark, _loop1_69_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013421 return seq;
13422}
13423
Guido van Rossumc001c092020-04-30 12:12:19 -070013424// _tmp_70: ',' lambda_plain_names
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013425static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070013426_tmp_70_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013427{
13428 if (p->error_indicator) {
13429 return NULL;
13430 }
13431 void * res = NULL;
13432 int mark = p->mark;
13433 { // ',' lambda_plain_names
13434 void *literal;
13435 asdl_seq* x;
13436 if (
13437 (literal = _PyPegen_expect_token(p, 12))
13438 &&
13439 (x = lambda_plain_names_rule(p))
13440 )
13441 {
13442 res = x;
13443 if (res == NULL && PyErr_Occurred()) {
13444 p->error_indicator = 1;
13445 return NULL;
13446 }
13447 goto done;
13448 }
13449 p->mark = mark;
13450 }
13451 res = NULL;
13452 done:
13453 return res;
13454}
13455
Guido van Rossumc001c092020-04-30 12:12:19 -070013456// _tmp_71: ',' lambda_names_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013457static void *
13458_tmp_71_rule(Parser *p)
13459{
13460 if (p->error_indicator) {
13461 return NULL;
13462 }
13463 void * res = NULL;
13464 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070013465 { // ',' lambda_names_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013466 void *literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070013467 asdl_seq* y;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013468 if (
13469 (literal = _PyPegen_expect_token(p, 12))
13470 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070013471 (y = lambda_names_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013472 )
13473 {
Guido van Rossumc001c092020-04-30 12:12:19 -070013474 res = y;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013475 if (res == NULL && PyErr_Occurred()) {
13476 p->error_indicator = 1;
13477 return NULL;
13478 }
13479 goto done;
13480 }
13481 p->mark = mark;
13482 }
13483 res = NULL;
13484 done:
13485 return res;
13486}
13487
13488// _tmp_72: ',' lambda_star_etc?
13489static void *
13490_tmp_72_rule(Parser *p)
13491{
13492 if (p->error_indicator) {
13493 return NULL;
13494 }
13495 void * res = NULL;
13496 int mark = p->mark;
13497 { // ',' lambda_star_etc?
13498 void *literal;
13499 void *z;
13500 if (
13501 (literal = _PyPegen_expect_token(p, 12))
13502 &&
13503 (z = lambda_star_etc_rule(p), 1)
13504 )
13505 {
13506 res = z;
13507 if (res == NULL && PyErr_Occurred()) {
13508 p->error_indicator = 1;
13509 return NULL;
13510 }
13511 goto done;
13512 }
13513 p->mark = mark;
13514 }
13515 res = NULL;
13516 done:
13517 return res;
13518}
13519
Guido van Rossumc001c092020-04-30 12:12:19 -070013520// _tmp_73: ',' lambda_names_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013521static void *
13522_tmp_73_rule(Parser *p)
13523{
13524 if (p->error_indicator) {
13525 return NULL;
13526 }
13527 void * res = NULL;
13528 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070013529 { // ',' lambda_names_with_default
13530 void *literal;
13531 asdl_seq* y;
13532 if (
13533 (literal = _PyPegen_expect_token(p, 12))
13534 &&
13535 (y = lambda_names_with_default_rule(p))
13536 )
13537 {
13538 res = y;
13539 if (res == NULL && PyErr_Occurred()) {
13540 p->error_indicator = 1;
13541 return NULL;
13542 }
13543 goto done;
13544 }
13545 p->mark = mark;
13546 }
13547 res = NULL;
13548 done:
13549 return res;
13550}
13551
13552// _tmp_74: ',' lambda_star_etc?
13553static void *
13554_tmp_74_rule(Parser *p)
13555{
13556 if (p->error_indicator) {
13557 return NULL;
13558 }
13559 void * res = NULL;
13560 int mark = p->mark;
13561 { // ',' lambda_star_etc?
13562 void *literal;
13563 void *z;
13564 if (
13565 (literal = _PyPegen_expect_token(p, 12))
13566 &&
13567 (z = lambda_star_etc_rule(p), 1)
13568 )
13569 {
13570 res = z;
13571 if (res == NULL && PyErr_Occurred()) {
13572 p->error_indicator = 1;
13573 return NULL;
13574 }
13575 goto done;
13576 }
13577 p->mark = mark;
13578 }
13579 res = NULL;
13580 done:
13581 return res;
13582}
13583
13584// _tmp_75: ',' lambda_names_with_default
13585static void *
13586_tmp_75_rule(Parser *p)
13587{
13588 if (p->error_indicator) {
13589 return NULL;
13590 }
13591 void * res = NULL;
13592 int mark = p->mark;
13593 { // ',' lambda_names_with_default
13594 void *literal;
13595 asdl_seq* y;
13596 if (
13597 (literal = _PyPegen_expect_token(p, 12))
13598 &&
13599 (y = lambda_names_with_default_rule(p))
13600 )
13601 {
13602 res = y;
13603 if (res == NULL && PyErr_Occurred()) {
13604 p->error_indicator = 1;
13605 return NULL;
13606 }
13607 goto done;
13608 }
13609 p->mark = mark;
13610 }
13611 res = NULL;
13612 done:
13613 return res;
13614}
13615
13616// _tmp_76: ',' lambda_star_etc?
13617static void *
13618_tmp_76_rule(Parser *p)
13619{
13620 if (p->error_indicator) {
13621 return NULL;
13622 }
13623 void * res = NULL;
13624 int mark = p->mark;
13625 { // ',' lambda_star_etc?
13626 void *literal;
13627 void *z;
13628 if (
13629 (literal = _PyPegen_expect_token(p, 12))
13630 &&
13631 (z = lambda_star_etc_rule(p), 1)
13632 )
13633 {
13634 res = z;
13635 if (res == NULL && PyErr_Occurred()) {
13636 p->error_indicator = 1;
13637 return NULL;
13638 }
13639 goto done;
13640 }
13641 p->mark = mark;
13642 }
13643 res = NULL;
13644 done:
13645 return res;
13646}
13647
13648// _tmp_77: ',' lambda_star_etc?
13649static void *
13650_tmp_77_rule(Parser *p)
13651{
13652 if (p->error_indicator) {
13653 return NULL;
13654 }
13655 void * res = NULL;
13656 int mark = p->mark;
13657 { // ',' lambda_star_etc?
13658 void *literal;
13659 void *z;
13660 if (
13661 (literal = _PyPegen_expect_token(p, 12))
13662 &&
13663 (z = lambda_star_etc_rule(p), 1)
13664 )
13665 {
13666 res = z;
13667 if (res == NULL && PyErr_Occurred()) {
13668 p->error_indicator = 1;
13669 return NULL;
13670 }
13671 goto done;
13672 }
13673 p->mark = mark;
13674 }
13675 res = NULL;
13676 done:
13677 return res;
13678}
13679
13680// _tmp_78: lambda_plain_names ','
13681static void *
13682_tmp_78_rule(Parser *p)
13683{
13684 if (p->error_indicator) {
13685 return NULL;
13686 }
13687 void * res = NULL;
13688 int mark = p->mark;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013689 { // lambda_plain_names ','
13690 void *literal;
13691 asdl_seq* n;
13692 if (
13693 (n = lambda_plain_names_rule(p))
13694 &&
13695 (literal = _PyPegen_expect_token(p, 12))
13696 )
13697 {
13698 res = n;
13699 if (res == NULL && PyErr_Occurred()) {
13700 p->error_indicator = 1;
13701 return NULL;
13702 }
13703 goto done;
13704 }
13705 p->mark = mark;
13706 }
13707 res = NULL;
13708 done:
13709 return res;
13710}
13711
Guido van Rossumc001c092020-04-30 12:12:19 -070013712// _loop0_79: lambda_name_with_optional_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013713static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070013714_loop0_79_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013715{
13716 if (p->error_indicator) {
13717 return NULL;
13718 }
13719 void *res = NULL;
13720 int mark = p->mark;
13721 int start_mark = p->mark;
13722 void **children = PyMem_Malloc(sizeof(void *));
13723 if (!children) {
13724 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13725 return NULL;
13726 }
13727 ssize_t children_capacity = 1;
13728 ssize_t n = 0;
13729 { // lambda_name_with_optional_default
13730 NameDefaultPair* lambda_name_with_optional_default_var;
13731 while (
13732 (lambda_name_with_optional_default_var = lambda_name_with_optional_default_rule(p))
13733 )
13734 {
13735 res = lambda_name_with_optional_default_var;
13736 if (n == children_capacity) {
13737 children_capacity *= 2;
13738 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13739 if (!children) {
13740 PyErr_Format(PyExc_MemoryError, "realloc None");
13741 return NULL;
13742 }
13743 }
13744 children[n++] = res;
13745 mark = p->mark;
13746 }
13747 p->mark = mark;
13748 }
13749 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13750 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070013751 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_79");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013752 PyMem_Free(children);
13753 return NULL;
13754 }
13755 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13756 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070013757 _PyPegen_insert_memo(p, start_mark, _loop0_79_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013758 return seq;
13759}
13760
Guido van Rossumc001c092020-04-30 12:12:19 -070013761// _tmp_80: ',' lambda_kwds
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013762static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070013763_tmp_80_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013764{
13765 if (p->error_indicator) {
13766 return NULL;
13767 }
13768 void * res = NULL;
13769 int mark = p->mark;
13770 { // ',' lambda_kwds
13771 arg_ty d;
13772 void *literal;
13773 if (
13774 (literal = _PyPegen_expect_token(p, 12))
13775 &&
13776 (d = lambda_kwds_rule(p))
13777 )
13778 {
13779 res = d;
13780 if (res == NULL && PyErr_Occurred()) {
13781 p->error_indicator = 1;
13782 return NULL;
13783 }
13784 goto done;
13785 }
13786 p->mark = mark;
13787 }
13788 res = NULL;
13789 done:
13790 return res;
13791}
13792
Guido van Rossumc001c092020-04-30 12:12:19 -070013793// _loop1_81: lambda_name_with_optional_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013794static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070013795_loop1_81_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013796{
13797 if (p->error_indicator) {
13798 return NULL;
13799 }
13800 void *res = NULL;
13801 int mark = p->mark;
13802 int start_mark = p->mark;
13803 void **children = PyMem_Malloc(sizeof(void *));
13804 if (!children) {
13805 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13806 return NULL;
13807 }
13808 ssize_t children_capacity = 1;
13809 ssize_t n = 0;
13810 { // lambda_name_with_optional_default
13811 NameDefaultPair* lambda_name_with_optional_default_var;
13812 while (
13813 (lambda_name_with_optional_default_var = lambda_name_with_optional_default_rule(p))
13814 )
13815 {
13816 res = lambda_name_with_optional_default_var;
13817 if (n == children_capacity) {
13818 children_capacity *= 2;
13819 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13820 if (!children) {
13821 PyErr_Format(PyExc_MemoryError, "realloc None");
13822 return NULL;
13823 }
13824 }
13825 children[n++] = res;
13826 mark = p->mark;
13827 }
13828 p->mark = mark;
13829 }
13830 if (n == 0) {
13831 PyMem_Free(children);
13832 return NULL;
13833 }
13834 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13835 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070013836 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_81");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013837 PyMem_Free(children);
13838 return NULL;
13839 }
13840 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13841 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070013842 _PyPegen_insert_memo(p, start_mark, _loop1_81_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013843 return seq;
13844}
13845
Guido van Rossumc001c092020-04-30 12:12:19 -070013846// _tmp_82: ',' lambda_kwds
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013847static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070013848_tmp_82_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013849{
13850 if (p->error_indicator) {
13851 return NULL;
13852 }
13853 void * res = NULL;
13854 int mark = p->mark;
13855 { // ',' lambda_kwds
13856 arg_ty d;
13857 void *literal;
13858 if (
13859 (literal = _PyPegen_expect_token(p, 12))
13860 &&
13861 (d = lambda_kwds_rule(p))
13862 )
13863 {
13864 res = d;
13865 if (res == NULL && PyErr_Occurred()) {
13866 p->error_indicator = 1;
13867 return NULL;
13868 }
13869 goto done;
13870 }
13871 p->mark = mark;
13872 }
13873 res = NULL;
13874 done:
13875 return res;
13876}
13877
Guido van Rossumc001c092020-04-30 12:12:19 -070013878// _tmp_83: '=' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013879static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070013880_tmp_83_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013881{
13882 if (p->error_indicator) {
13883 return NULL;
13884 }
13885 void * res = NULL;
13886 int mark = p->mark;
13887 { // '=' expression
13888 expr_ty e;
13889 void *literal;
13890 if (
13891 (literal = _PyPegen_expect_token(p, 22))
13892 &&
13893 (e = expression_rule(p))
13894 )
13895 {
13896 res = e;
13897 if (res == NULL && PyErr_Occurred()) {
13898 p->error_indicator = 1;
13899 return NULL;
13900 }
13901 goto done;
13902 }
13903 p->mark = mark;
13904 }
13905 res = NULL;
13906 done:
13907 return res;
13908}
13909
Guido van Rossumc001c092020-04-30 12:12:19 -070013910// _loop0_85: ',' lambda_name_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013911static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070013912_loop0_85_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013913{
13914 if (p->error_indicator) {
13915 return NULL;
13916 }
13917 void *res = NULL;
13918 int mark = p->mark;
13919 int start_mark = p->mark;
13920 void **children = PyMem_Malloc(sizeof(void *));
13921 if (!children) {
13922 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13923 return NULL;
13924 }
13925 ssize_t children_capacity = 1;
13926 ssize_t n = 0;
13927 { // ',' lambda_name_with_default
13928 NameDefaultPair* elem;
13929 void *literal;
13930 while (
13931 (literal = _PyPegen_expect_token(p, 12))
13932 &&
13933 (elem = lambda_name_with_default_rule(p))
13934 )
13935 {
13936 res = elem;
13937 if (res == NULL && PyErr_Occurred()) {
13938 p->error_indicator = 1;
13939 PyMem_Free(children);
13940 return NULL;
13941 }
13942 if (n == children_capacity) {
13943 children_capacity *= 2;
13944 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13945 if (!children) {
13946 PyErr_Format(PyExc_MemoryError, "realloc None");
13947 return NULL;
13948 }
13949 }
13950 children[n++] = res;
13951 mark = p->mark;
13952 }
13953 p->mark = mark;
13954 }
13955 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13956 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070013957 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_85");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013958 PyMem_Free(children);
13959 return NULL;
13960 }
13961 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13962 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070013963 _PyPegen_insert_memo(p, start_mark, _loop0_85_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013964 return seq;
13965}
13966
Guido van Rossumc001c092020-04-30 12:12:19 -070013967// _gather_84: lambda_name_with_default _loop0_85
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013968static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070013969_gather_84_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013970{
13971 if (p->error_indicator) {
13972 return NULL;
13973 }
13974 asdl_seq * res = NULL;
13975 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070013976 { // lambda_name_with_default _loop0_85
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013977 NameDefaultPair* elem;
13978 asdl_seq * seq;
13979 if (
13980 (elem = lambda_name_with_default_rule(p))
13981 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070013982 (seq = _loop0_85_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013983 )
13984 {
13985 res = _PyPegen_seq_insert_in_front(p, elem, seq);
13986 goto done;
13987 }
13988 p->mark = mark;
13989 }
13990 res = NULL;
13991 done:
13992 return res;
13993}
13994
Guido van Rossumc001c092020-04-30 12:12:19 -070013995// _loop0_87: ',' (lambda_plain_name !'=')
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013996static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070013997_loop0_87_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013998{
13999 if (p->error_indicator) {
14000 return NULL;
14001 }
14002 void *res = NULL;
14003 int mark = p->mark;
14004 int start_mark = p->mark;
14005 void **children = PyMem_Malloc(sizeof(void *));
14006 if (!children) {
14007 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14008 return NULL;
14009 }
14010 ssize_t children_capacity = 1;
14011 ssize_t n = 0;
14012 { // ',' (lambda_plain_name !'=')
14013 void *elem;
14014 void *literal;
14015 while (
14016 (literal = _PyPegen_expect_token(p, 12))
14017 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070014018 (elem = _tmp_135_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014019 )
14020 {
14021 res = elem;
14022 if (res == NULL && PyErr_Occurred()) {
14023 p->error_indicator = 1;
14024 PyMem_Free(children);
14025 return NULL;
14026 }
14027 if (n == children_capacity) {
14028 children_capacity *= 2;
14029 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14030 if (!children) {
14031 PyErr_Format(PyExc_MemoryError, "realloc None");
14032 return NULL;
14033 }
14034 }
14035 children[n++] = res;
14036 mark = p->mark;
14037 }
14038 p->mark = mark;
14039 }
14040 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14041 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070014042 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_87");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014043 PyMem_Free(children);
14044 return NULL;
14045 }
14046 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14047 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070014048 _PyPegen_insert_memo(p, start_mark, _loop0_87_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014049 return seq;
14050}
14051
Guido van Rossumc001c092020-04-30 12:12:19 -070014052// _gather_86: (lambda_plain_name !'=') _loop0_87
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014053static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014054_gather_86_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014055{
14056 if (p->error_indicator) {
14057 return NULL;
14058 }
14059 asdl_seq * res = NULL;
14060 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070014061 { // (lambda_plain_name !'=') _loop0_87
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014062 void *elem;
14063 asdl_seq * seq;
14064 if (
Guido van Rossumc001c092020-04-30 12:12:19 -070014065 (elem = _tmp_135_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014066 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070014067 (seq = _loop0_87_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014068 )
14069 {
14070 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14071 goto done;
14072 }
14073 p->mark = mark;
14074 }
14075 res = NULL;
14076 done:
14077 return res;
14078}
14079
Guido van Rossumc001c092020-04-30 12:12:19 -070014080// _loop1_88: ('or' conjunction)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014081static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014082_loop1_88_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014083{
14084 if (p->error_indicator) {
14085 return NULL;
14086 }
14087 void *res = NULL;
14088 int mark = p->mark;
14089 int start_mark = p->mark;
14090 void **children = PyMem_Malloc(sizeof(void *));
14091 if (!children) {
14092 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14093 return NULL;
14094 }
14095 ssize_t children_capacity = 1;
14096 ssize_t n = 0;
14097 { // ('or' conjunction)
Guido van Rossumc001c092020-04-30 12:12:19 -070014098 void *_tmp_136_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014099 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070014100 (_tmp_136_var = _tmp_136_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014101 )
14102 {
Guido van Rossumc001c092020-04-30 12:12:19 -070014103 res = _tmp_136_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014104 if (n == children_capacity) {
14105 children_capacity *= 2;
14106 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14107 if (!children) {
14108 PyErr_Format(PyExc_MemoryError, "realloc None");
14109 return NULL;
14110 }
14111 }
14112 children[n++] = res;
14113 mark = p->mark;
14114 }
14115 p->mark = mark;
14116 }
14117 if (n == 0) {
14118 PyMem_Free(children);
14119 return NULL;
14120 }
14121 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14122 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070014123 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_88");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014124 PyMem_Free(children);
14125 return NULL;
14126 }
14127 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14128 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070014129 _PyPegen_insert_memo(p, start_mark, _loop1_88_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014130 return seq;
14131}
14132
Guido van Rossumc001c092020-04-30 12:12:19 -070014133// _loop1_89: ('and' inversion)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014134static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014135_loop1_89_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014136{
14137 if (p->error_indicator) {
14138 return NULL;
14139 }
14140 void *res = NULL;
14141 int mark = p->mark;
14142 int start_mark = p->mark;
14143 void **children = PyMem_Malloc(sizeof(void *));
14144 if (!children) {
14145 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14146 return NULL;
14147 }
14148 ssize_t children_capacity = 1;
14149 ssize_t n = 0;
14150 { // ('and' inversion)
Guido van Rossumc001c092020-04-30 12:12:19 -070014151 void *_tmp_137_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014152 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070014153 (_tmp_137_var = _tmp_137_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014154 )
14155 {
Guido van Rossumc001c092020-04-30 12:12:19 -070014156 res = _tmp_137_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014157 if (n == children_capacity) {
14158 children_capacity *= 2;
14159 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14160 if (!children) {
14161 PyErr_Format(PyExc_MemoryError, "realloc None");
14162 return NULL;
14163 }
14164 }
14165 children[n++] = res;
14166 mark = p->mark;
14167 }
14168 p->mark = mark;
14169 }
14170 if (n == 0) {
14171 PyMem_Free(children);
14172 return NULL;
14173 }
14174 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14175 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070014176 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_89");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014177 PyMem_Free(children);
14178 return NULL;
14179 }
14180 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14181 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070014182 _PyPegen_insert_memo(p, start_mark, _loop1_89_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014183 return seq;
14184}
14185
Guido van Rossumc001c092020-04-30 12:12:19 -070014186// _loop1_90: compare_op_bitwise_or_pair
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014187static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014188_loop1_90_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014189{
14190 if (p->error_indicator) {
14191 return NULL;
14192 }
14193 void *res = NULL;
14194 int mark = p->mark;
14195 int start_mark = p->mark;
14196 void **children = PyMem_Malloc(sizeof(void *));
14197 if (!children) {
14198 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14199 return NULL;
14200 }
14201 ssize_t children_capacity = 1;
14202 ssize_t n = 0;
14203 { // compare_op_bitwise_or_pair
14204 CmpopExprPair* compare_op_bitwise_or_pair_var;
14205 while (
14206 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p))
14207 )
14208 {
14209 res = compare_op_bitwise_or_pair_var;
14210 if (n == children_capacity) {
14211 children_capacity *= 2;
14212 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14213 if (!children) {
14214 PyErr_Format(PyExc_MemoryError, "realloc None");
14215 return NULL;
14216 }
14217 }
14218 children[n++] = res;
14219 mark = p->mark;
14220 }
14221 p->mark = mark;
14222 }
14223 if (n == 0) {
14224 PyMem_Free(children);
14225 return NULL;
14226 }
14227 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14228 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070014229 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_90");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014230 PyMem_Free(children);
14231 return NULL;
14232 }
14233 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14234 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070014235 _PyPegen_insert_memo(p, start_mark, _loop1_90_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014236 return seq;
14237}
14238
Guido van Rossumc001c092020-04-30 12:12:19 -070014239// _tmp_91: '!='
Pablo Galindo2b74c832020-04-27 18:02:07 +010014240static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070014241_tmp_91_rule(Parser *p)
Pablo Galindo2b74c832020-04-27 18:02:07 +010014242{
14243 if (p->error_indicator) {
14244 return NULL;
14245 }
14246 void * res = NULL;
14247 int mark = p->mark;
14248 { // '!='
14249 void *tok;
14250 if (
14251 (tok = _PyPegen_expect_token(p, 28))
14252 )
14253 {
14254 res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok;
14255 if (res == NULL && PyErr_Occurred()) {
14256 p->error_indicator = 1;
14257 return NULL;
14258 }
14259 goto done;
14260 }
14261 p->mark = mark;
14262 }
14263 res = NULL;
14264 done:
14265 return res;
14266}
14267
Guido van Rossumc001c092020-04-30 12:12:19 -070014268// _loop0_93: ',' slice
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014269static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014270_loop0_93_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014271{
14272 if (p->error_indicator) {
14273 return NULL;
14274 }
14275 void *res = NULL;
14276 int mark = p->mark;
14277 int start_mark = p->mark;
14278 void **children = PyMem_Malloc(sizeof(void *));
14279 if (!children) {
14280 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14281 return NULL;
14282 }
14283 ssize_t children_capacity = 1;
14284 ssize_t n = 0;
14285 { // ',' slice
14286 expr_ty elem;
14287 void *literal;
14288 while (
14289 (literal = _PyPegen_expect_token(p, 12))
14290 &&
14291 (elem = slice_rule(p))
14292 )
14293 {
14294 res = elem;
14295 if (res == NULL && PyErr_Occurred()) {
14296 p->error_indicator = 1;
14297 PyMem_Free(children);
14298 return NULL;
14299 }
14300 if (n == children_capacity) {
14301 children_capacity *= 2;
14302 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14303 if (!children) {
14304 PyErr_Format(PyExc_MemoryError, "realloc None");
14305 return NULL;
14306 }
14307 }
14308 children[n++] = res;
14309 mark = p->mark;
14310 }
14311 p->mark = mark;
14312 }
14313 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14314 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070014315 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_93");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014316 PyMem_Free(children);
14317 return NULL;
14318 }
14319 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14320 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070014321 _PyPegen_insert_memo(p, start_mark, _loop0_93_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014322 return seq;
14323}
14324
Guido van Rossumc001c092020-04-30 12:12:19 -070014325// _gather_92: slice _loop0_93
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014326static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014327_gather_92_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014328{
14329 if (p->error_indicator) {
14330 return NULL;
14331 }
14332 asdl_seq * res = NULL;
14333 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070014334 { // slice _loop0_93
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014335 expr_ty elem;
14336 asdl_seq * seq;
14337 if (
14338 (elem = slice_rule(p))
14339 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070014340 (seq = _loop0_93_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014341 )
14342 {
14343 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14344 goto done;
14345 }
14346 p->mark = mark;
14347 }
14348 res = NULL;
14349 done:
14350 return res;
14351}
14352
Guido van Rossumc001c092020-04-30 12:12:19 -070014353// _tmp_94: ':' expression?
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014354static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070014355_tmp_94_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014356{
14357 if (p->error_indicator) {
14358 return NULL;
14359 }
14360 void * res = NULL;
14361 int mark = p->mark;
14362 { // ':' expression?
14363 void *d;
14364 void *literal;
14365 if (
14366 (literal = _PyPegen_expect_token(p, 11))
14367 &&
14368 (d = expression_rule(p), 1)
14369 )
14370 {
14371 res = d;
14372 if (res == NULL && PyErr_Occurred()) {
14373 p->error_indicator = 1;
14374 return NULL;
14375 }
14376 goto done;
14377 }
14378 p->mark = mark;
14379 }
14380 res = NULL;
14381 done:
14382 return res;
14383}
14384
Guido van Rossumc001c092020-04-30 12:12:19 -070014385// _tmp_95: tuple | group | genexp
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014386static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070014387_tmp_95_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014388{
14389 if (p->error_indicator) {
14390 return NULL;
14391 }
14392 void * res = NULL;
14393 int mark = p->mark;
14394 { // tuple
14395 expr_ty tuple_var;
14396 if (
14397 (tuple_var = tuple_rule(p))
14398 )
14399 {
14400 res = tuple_var;
14401 goto done;
14402 }
14403 p->mark = mark;
14404 }
14405 { // group
14406 expr_ty group_var;
14407 if (
14408 (group_var = group_rule(p))
14409 )
14410 {
14411 res = group_var;
14412 goto done;
14413 }
14414 p->mark = mark;
14415 }
14416 { // genexp
14417 expr_ty genexp_var;
14418 if (
14419 (genexp_var = genexp_rule(p))
14420 )
14421 {
14422 res = genexp_var;
14423 goto done;
14424 }
14425 p->mark = mark;
14426 }
14427 res = NULL;
14428 done:
14429 return res;
14430}
14431
Guido van Rossumc001c092020-04-30 12:12:19 -070014432// _tmp_96: list | listcomp
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014433static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070014434_tmp_96_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014435{
14436 if (p->error_indicator) {
14437 return NULL;
14438 }
14439 void * res = NULL;
14440 int mark = p->mark;
14441 { // list
14442 expr_ty list_var;
14443 if (
14444 (list_var = list_rule(p))
14445 )
14446 {
14447 res = list_var;
14448 goto done;
14449 }
14450 p->mark = mark;
14451 }
14452 { // listcomp
14453 expr_ty listcomp_var;
14454 if (
14455 (listcomp_var = listcomp_rule(p))
14456 )
14457 {
14458 res = listcomp_var;
14459 goto done;
14460 }
14461 p->mark = mark;
14462 }
14463 res = NULL;
14464 done:
14465 return res;
14466}
14467
Guido van Rossumc001c092020-04-30 12:12:19 -070014468// _tmp_97: dict | set | dictcomp | setcomp
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014469static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070014470_tmp_97_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014471{
14472 if (p->error_indicator) {
14473 return NULL;
14474 }
14475 void * res = NULL;
14476 int mark = p->mark;
14477 { // dict
14478 expr_ty dict_var;
14479 if (
14480 (dict_var = dict_rule(p))
14481 )
14482 {
14483 res = dict_var;
14484 goto done;
14485 }
14486 p->mark = mark;
14487 }
14488 { // set
14489 expr_ty set_var;
14490 if (
14491 (set_var = set_rule(p))
14492 )
14493 {
14494 res = set_var;
14495 goto done;
14496 }
14497 p->mark = mark;
14498 }
14499 { // dictcomp
14500 expr_ty dictcomp_var;
14501 if (
14502 (dictcomp_var = dictcomp_rule(p))
14503 )
14504 {
14505 res = dictcomp_var;
14506 goto done;
14507 }
14508 p->mark = mark;
14509 }
14510 { // setcomp
14511 expr_ty setcomp_var;
14512 if (
14513 (setcomp_var = setcomp_rule(p))
14514 )
14515 {
14516 res = setcomp_var;
14517 goto done;
14518 }
14519 p->mark = mark;
14520 }
14521 res = NULL;
14522 done:
14523 return res;
14524}
14525
Guido van Rossumc001c092020-04-30 12:12:19 -070014526// _loop1_98: STRING
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014527static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014528_loop1_98_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014529{
14530 if (p->error_indicator) {
14531 return NULL;
14532 }
14533 void *res = NULL;
14534 int mark = p->mark;
14535 int start_mark = p->mark;
14536 void **children = PyMem_Malloc(sizeof(void *));
14537 if (!children) {
14538 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14539 return NULL;
14540 }
14541 ssize_t children_capacity = 1;
14542 ssize_t n = 0;
14543 { // STRING
14544 expr_ty string_var;
14545 while (
14546 (string_var = _PyPegen_string_token(p))
14547 )
14548 {
14549 res = string_var;
14550 if (n == children_capacity) {
14551 children_capacity *= 2;
14552 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14553 if (!children) {
14554 PyErr_Format(PyExc_MemoryError, "realloc None");
14555 return NULL;
14556 }
14557 }
14558 children[n++] = res;
14559 mark = p->mark;
14560 }
14561 p->mark = mark;
14562 }
14563 if (n == 0) {
14564 PyMem_Free(children);
14565 return NULL;
14566 }
14567 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14568 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070014569 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_98");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014570 PyMem_Free(children);
14571 return NULL;
14572 }
14573 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14574 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070014575 _PyPegen_insert_memo(p, start_mark, _loop1_98_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014576 return seq;
14577}
14578
Guido van Rossumc001c092020-04-30 12:12:19 -070014579// _tmp_99: star_named_expression ',' star_named_expressions?
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014580static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070014581_tmp_99_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014582{
14583 if (p->error_indicator) {
14584 return NULL;
14585 }
14586 void * res = NULL;
14587 int mark = p->mark;
14588 { // star_named_expression ',' star_named_expressions?
14589 void *literal;
14590 expr_ty y;
14591 void *z;
14592 if (
14593 (y = star_named_expression_rule(p))
14594 &&
14595 (literal = _PyPegen_expect_token(p, 12))
14596 &&
14597 (z = star_named_expressions_rule(p), 1)
14598 )
14599 {
14600 res = _PyPegen_seq_insert_in_front ( p , y , z );
14601 if (res == NULL && PyErr_Occurred()) {
14602 p->error_indicator = 1;
14603 return NULL;
14604 }
14605 goto done;
14606 }
14607 p->mark = mark;
14608 }
14609 res = NULL;
14610 done:
14611 return res;
14612}
14613
Guido van Rossumc001c092020-04-30 12:12:19 -070014614// _tmp_100: yield_expr | named_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014615static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070014616_tmp_100_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014617{
14618 if (p->error_indicator) {
14619 return NULL;
14620 }
14621 void * res = NULL;
14622 int mark = p->mark;
14623 { // yield_expr
14624 expr_ty yield_expr_var;
14625 if (
14626 (yield_expr_var = yield_expr_rule(p))
14627 )
14628 {
14629 res = yield_expr_var;
14630 goto done;
14631 }
14632 p->mark = mark;
14633 }
14634 { // named_expression
14635 expr_ty named_expression_var;
14636 if (
14637 (named_expression_var = named_expression_rule(p))
14638 )
14639 {
14640 res = named_expression_var;
14641 goto done;
14642 }
14643 p->mark = mark;
14644 }
14645 res = NULL;
14646 done:
14647 return res;
14648}
14649
Guido van Rossumc001c092020-04-30 12:12:19 -070014650// _loop0_102: ',' kvpair
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014651static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014652_loop0_102_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014653{
14654 if (p->error_indicator) {
14655 return NULL;
14656 }
14657 void *res = NULL;
14658 int mark = p->mark;
14659 int start_mark = p->mark;
14660 void **children = PyMem_Malloc(sizeof(void *));
14661 if (!children) {
14662 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14663 return NULL;
14664 }
14665 ssize_t children_capacity = 1;
14666 ssize_t n = 0;
14667 { // ',' kvpair
14668 KeyValuePair* elem;
14669 void *literal;
14670 while (
14671 (literal = _PyPegen_expect_token(p, 12))
14672 &&
14673 (elem = kvpair_rule(p))
14674 )
14675 {
14676 res = elem;
14677 if (res == NULL && PyErr_Occurred()) {
14678 p->error_indicator = 1;
14679 PyMem_Free(children);
14680 return NULL;
14681 }
14682 if (n == children_capacity) {
14683 children_capacity *= 2;
14684 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14685 if (!children) {
14686 PyErr_Format(PyExc_MemoryError, "realloc None");
14687 return NULL;
14688 }
14689 }
14690 children[n++] = res;
14691 mark = p->mark;
14692 }
14693 p->mark = mark;
14694 }
14695 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14696 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070014697 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_102");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014698 PyMem_Free(children);
14699 return NULL;
14700 }
14701 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14702 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070014703 _PyPegen_insert_memo(p, start_mark, _loop0_102_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014704 return seq;
14705}
14706
Guido van Rossumc001c092020-04-30 12:12:19 -070014707// _gather_101: kvpair _loop0_102
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014708static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014709_gather_101_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014710{
14711 if (p->error_indicator) {
14712 return NULL;
14713 }
14714 asdl_seq * res = NULL;
14715 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070014716 { // kvpair _loop0_102
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014717 KeyValuePair* elem;
14718 asdl_seq * seq;
14719 if (
14720 (elem = kvpair_rule(p))
14721 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070014722 (seq = _loop0_102_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014723 )
14724 {
14725 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14726 goto done;
14727 }
14728 p->mark = mark;
14729 }
14730 res = NULL;
14731 done:
14732 return res;
14733}
14734
Guido van Rossumc001c092020-04-30 12:12:19 -070014735// _loop1_103: (ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014736static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014737_loop1_103_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014738{
14739 if (p->error_indicator) {
14740 return NULL;
14741 }
14742 void *res = NULL;
14743 int mark = p->mark;
14744 int start_mark = p->mark;
14745 void **children = PyMem_Malloc(sizeof(void *));
14746 if (!children) {
14747 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14748 return NULL;
14749 }
14750 ssize_t children_capacity = 1;
14751 ssize_t n = 0;
14752 { // (ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*)
Guido van Rossumc001c092020-04-30 12:12:19 -070014753 void *_tmp_138_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014754 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070014755 (_tmp_138_var = _tmp_138_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014756 )
14757 {
Guido van Rossumc001c092020-04-30 12:12:19 -070014758 res = _tmp_138_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014759 if (n == children_capacity) {
14760 children_capacity *= 2;
14761 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14762 if (!children) {
14763 PyErr_Format(PyExc_MemoryError, "realloc None");
14764 return NULL;
14765 }
14766 }
14767 children[n++] = res;
14768 mark = p->mark;
14769 }
14770 p->mark = mark;
14771 }
14772 if (n == 0) {
14773 PyMem_Free(children);
14774 return NULL;
14775 }
14776 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14777 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070014778 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_103");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014779 PyMem_Free(children);
14780 return NULL;
14781 }
14782 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14783 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070014784 _PyPegen_insert_memo(p, start_mark, _loop1_103_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014785 return seq;
14786}
14787
Guido van Rossumc001c092020-04-30 12:12:19 -070014788// _tmp_104: ',' args
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014789static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070014790_tmp_104_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014791{
14792 if (p->error_indicator) {
14793 return NULL;
14794 }
14795 void * res = NULL;
14796 int mark = p->mark;
14797 { // ',' args
14798 expr_ty c;
14799 void *literal;
14800 if (
14801 (literal = _PyPegen_expect_token(p, 12))
14802 &&
14803 (c = args_rule(p))
14804 )
14805 {
14806 res = c;
14807 if (res == NULL && PyErr_Occurred()) {
14808 p->error_indicator = 1;
14809 return NULL;
14810 }
14811 goto done;
14812 }
14813 p->mark = mark;
14814 }
14815 res = NULL;
14816 done:
14817 return res;
14818}
14819
Guido van Rossumc001c092020-04-30 12:12:19 -070014820// _tmp_105: ',' args
Pablo Galindo2b74c832020-04-27 18:02:07 +010014821static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070014822_tmp_105_rule(Parser *p)
Pablo Galindo2b74c832020-04-27 18:02:07 +010014823{
14824 if (p->error_indicator) {
14825 return NULL;
14826 }
14827 void * res = NULL;
14828 int mark = p->mark;
14829 { // ',' args
14830 expr_ty c;
14831 void *literal;
14832 if (
14833 (literal = _PyPegen_expect_token(p, 12))
14834 &&
14835 (c = args_rule(p))
14836 )
14837 {
14838 res = c;
14839 if (res == NULL && PyErr_Occurred()) {
14840 p->error_indicator = 1;
14841 return NULL;
14842 }
14843 goto done;
14844 }
14845 p->mark = mark;
14846 }
14847 res = NULL;
14848 done:
14849 return res;
14850}
14851
Guido van Rossumc001c092020-04-30 12:12:19 -070014852// _loop0_107: ',' kwarg_or_starred
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014853static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014854_loop0_107_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014855{
14856 if (p->error_indicator) {
14857 return NULL;
14858 }
14859 void *res = NULL;
14860 int mark = p->mark;
14861 int start_mark = p->mark;
14862 void **children = PyMem_Malloc(sizeof(void *));
14863 if (!children) {
14864 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14865 return NULL;
14866 }
14867 ssize_t children_capacity = 1;
14868 ssize_t n = 0;
14869 { // ',' kwarg_or_starred
14870 KeywordOrStarred* elem;
14871 void *literal;
14872 while (
14873 (literal = _PyPegen_expect_token(p, 12))
14874 &&
14875 (elem = kwarg_or_starred_rule(p))
14876 )
14877 {
14878 res = elem;
14879 if (res == NULL && PyErr_Occurred()) {
14880 p->error_indicator = 1;
14881 PyMem_Free(children);
14882 return NULL;
14883 }
14884 if (n == children_capacity) {
14885 children_capacity *= 2;
14886 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14887 if (!children) {
14888 PyErr_Format(PyExc_MemoryError, "realloc None");
14889 return NULL;
14890 }
14891 }
14892 children[n++] = res;
14893 mark = p->mark;
14894 }
14895 p->mark = mark;
14896 }
14897 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14898 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070014899 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_107");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014900 PyMem_Free(children);
14901 return NULL;
14902 }
14903 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14904 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070014905 _PyPegen_insert_memo(p, start_mark, _loop0_107_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014906 return seq;
14907}
14908
Guido van Rossumc001c092020-04-30 12:12:19 -070014909// _gather_106: kwarg_or_starred _loop0_107
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014910static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070014911_gather_106_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014912{
14913 if (p->error_indicator) {
14914 return NULL;
14915 }
14916 asdl_seq * res = NULL;
14917 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070014918 { // kwarg_or_starred _loop0_107
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014919 KeywordOrStarred* elem;
14920 asdl_seq * seq;
14921 if (
14922 (elem = kwarg_or_starred_rule(p))
14923 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070014924 (seq = _loop0_107_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014925 )
14926 {
14927 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14928 goto done;
14929 }
14930 p->mark = mark;
14931 }
14932 res = NULL;
14933 done:
14934 return res;
14935}
14936
Guido van Rossumc001c092020-04-30 12:12:19 -070014937// _loop0_109: ',' kwarg_or_double_starred
Pablo Galindo2b74c832020-04-27 18:02:07 +010014938static asdl_seq *
14939_loop0_109_rule(Parser *p)
14940{
14941 if (p->error_indicator) {
14942 return NULL;
14943 }
14944 void *res = NULL;
14945 int mark = p->mark;
14946 int start_mark = p->mark;
14947 void **children = PyMem_Malloc(sizeof(void *));
14948 if (!children) {
14949 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14950 return NULL;
14951 }
14952 ssize_t children_capacity = 1;
14953 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070014954 { // ',' kwarg_or_double_starred
14955 KeywordOrStarred* elem;
14956 void *literal;
Pablo Galindo2b74c832020-04-27 18:02:07 +010014957 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070014958 (literal = _PyPegen_expect_token(p, 12))
14959 &&
14960 (elem = kwarg_or_double_starred_rule(p))
Pablo Galindo2b74c832020-04-27 18:02:07 +010014961 )
14962 {
Guido van Rossumc001c092020-04-30 12:12:19 -070014963 res = elem;
14964 if (res == NULL && PyErr_Occurred()) {
14965 p->error_indicator = 1;
14966 PyMem_Free(children);
14967 return NULL;
14968 }
Pablo Galindo2b74c832020-04-27 18:02:07 +010014969 if (n == children_capacity) {
14970 children_capacity *= 2;
14971 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14972 if (!children) {
14973 PyErr_Format(PyExc_MemoryError, "realloc None");
14974 return NULL;
14975 }
14976 }
14977 children[n++] = res;
14978 mark = p->mark;
14979 }
14980 p->mark = mark;
14981 }
14982 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14983 if (!seq) {
14984 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_109");
14985 PyMem_Free(children);
14986 return NULL;
14987 }
14988 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14989 PyMem_Free(children);
14990 _PyPegen_insert_memo(p, start_mark, _loop0_109_type, seq);
14991 return seq;
14992}
14993
Guido van Rossumc001c092020-04-30 12:12:19 -070014994// _gather_108: kwarg_or_double_starred _loop0_109
14995static asdl_seq *
14996_gather_108_rule(Parser *p)
14997{
14998 if (p->error_indicator) {
14999 return NULL;
15000 }
15001 asdl_seq * res = NULL;
15002 int mark = p->mark;
15003 { // kwarg_or_double_starred _loop0_109
15004 KeywordOrStarred* elem;
15005 asdl_seq * seq;
15006 if (
15007 (elem = kwarg_or_double_starred_rule(p))
15008 &&
15009 (seq = _loop0_109_rule(p))
15010 )
15011 {
15012 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15013 goto done;
15014 }
15015 p->mark = mark;
15016 }
15017 res = NULL;
15018 done:
15019 return res;
15020}
15021
15022// _loop0_111: ',' kwarg_or_starred
Pablo Galindo2b74c832020-04-27 18:02:07 +010015023static asdl_seq *
15024_loop0_111_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015025{
15026 if (p->error_indicator) {
15027 return NULL;
15028 }
15029 void *res = NULL;
15030 int mark = p->mark;
15031 int start_mark = p->mark;
15032 void **children = PyMem_Malloc(sizeof(void *));
15033 if (!children) {
15034 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15035 return NULL;
15036 }
15037 ssize_t children_capacity = 1;
15038 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070015039 { // ',' kwarg_or_starred
15040 KeywordOrStarred* elem;
15041 void *literal;
15042 while (
15043 (literal = _PyPegen_expect_token(p, 12))
15044 &&
15045 (elem = kwarg_or_starred_rule(p))
15046 )
15047 {
15048 res = elem;
15049 if (res == NULL && PyErr_Occurred()) {
15050 p->error_indicator = 1;
15051 PyMem_Free(children);
15052 return NULL;
15053 }
15054 if (n == children_capacity) {
15055 children_capacity *= 2;
15056 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15057 if (!children) {
15058 PyErr_Format(PyExc_MemoryError, "realloc None");
15059 return NULL;
15060 }
15061 }
15062 children[n++] = res;
15063 mark = p->mark;
15064 }
15065 p->mark = mark;
15066 }
15067 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15068 if (!seq) {
15069 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_111");
15070 PyMem_Free(children);
15071 return NULL;
15072 }
15073 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15074 PyMem_Free(children);
15075 _PyPegen_insert_memo(p, start_mark, _loop0_111_type, seq);
15076 return seq;
15077}
15078
15079// _gather_110: kwarg_or_starred _loop0_111
15080static asdl_seq *
15081_gather_110_rule(Parser *p)
15082{
15083 if (p->error_indicator) {
15084 return NULL;
15085 }
15086 asdl_seq * res = NULL;
15087 int mark = p->mark;
15088 { // kwarg_or_starred _loop0_111
15089 KeywordOrStarred* elem;
15090 asdl_seq * seq;
15091 if (
15092 (elem = kwarg_or_starred_rule(p))
15093 &&
15094 (seq = _loop0_111_rule(p))
15095 )
15096 {
15097 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15098 goto done;
15099 }
15100 p->mark = mark;
15101 }
15102 res = NULL;
15103 done:
15104 return res;
15105}
15106
15107// _loop0_113: ',' kwarg_or_double_starred
15108static asdl_seq *
15109_loop0_113_rule(Parser *p)
15110{
15111 if (p->error_indicator) {
15112 return NULL;
15113 }
15114 void *res = NULL;
15115 int mark = p->mark;
15116 int start_mark = p->mark;
15117 void **children = PyMem_Malloc(sizeof(void *));
15118 if (!children) {
15119 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15120 return NULL;
15121 }
15122 ssize_t children_capacity = 1;
15123 ssize_t n = 0;
15124 { // ',' kwarg_or_double_starred
15125 KeywordOrStarred* elem;
15126 void *literal;
15127 while (
15128 (literal = _PyPegen_expect_token(p, 12))
15129 &&
15130 (elem = kwarg_or_double_starred_rule(p))
15131 )
15132 {
15133 res = elem;
15134 if (res == NULL && PyErr_Occurred()) {
15135 p->error_indicator = 1;
15136 PyMem_Free(children);
15137 return NULL;
15138 }
15139 if (n == children_capacity) {
15140 children_capacity *= 2;
15141 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15142 if (!children) {
15143 PyErr_Format(PyExc_MemoryError, "realloc None");
15144 return NULL;
15145 }
15146 }
15147 children[n++] = res;
15148 mark = p->mark;
15149 }
15150 p->mark = mark;
15151 }
15152 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15153 if (!seq) {
15154 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_113");
15155 PyMem_Free(children);
15156 return NULL;
15157 }
15158 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15159 PyMem_Free(children);
15160 _PyPegen_insert_memo(p, start_mark, _loop0_113_type, seq);
15161 return seq;
15162}
15163
15164// _gather_112: kwarg_or_double_starred _loop0_113
15165static asdl_seq *
15166_gather_112_rule(Parser *p)
15167{
15168 if (p->error_indicator) {
15169 return NULL;
15170 }
15171 asdl_seq * res = NULL;
15172 int mark = p->mark;
15173 { // kwarg_or_double_starred _loop0_113
15174 KeywordOrStarred* elem;
15175 asdl_seq * seq;
15176 if (
15177 (elem = kwarg_or_double_starred_rule(p))
15178 &&
15179 (seq = _loop0_113_rule(p))
15180 )
15181 {
15182 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15183 goto done;
15184 }
15185 p->mark = mark;
15186 }
15187 res = NULL;
15188 done:
15189 return res;
15190}
15191
15192// _loop0_114: (',' star_target)
15193static asdl_seq *
15194_loop0_114_rule(Parser *p)
15195{
15196 if (p->error_indicator) {
15197 return NULL;
15198 }
15199 void *res = NULL;
15200 int mark = p->mark;
15201 int start_mark = p->mark;
15202 void **children = PyMem_Malloc(sizeof(void *));
15203 if (!children) {
15204 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15205 return NULL;
15206 }
15207 ssize_t children_capacity = 1;
15208 ssize_t n = 0;
15209 { // (',' star_target)
15210 void *_tmp_139_var;
15211 while (
15212 (_tmp_139_var = _tmp_139_rule(p))
15213 )
15214 {
15215 res = _tmp_139_var;
15216 if (n == children_capacity) {
15217 children_capacity *= 2;
15218 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15219 if (!children) {
15220 PyErr_Format(PyExc_MemoryError, "realloc None");
15221 return NULL;
15222 }
15223 }
15224 children[n++] = res;
15225 mark = p->mark;
15226 }
15227 p->mark = mark;
15228 }
15229 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15230 if (!seq) {
15231 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_114");
15232 PyMem_Free(children);
15233 return NULL;
15234 }
15235 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15236 PyMem_Free(children);
15237 _PyPegen_insert_memo(p, start_mark, _loop0_114_type, seq);
15238 return seq;
15239}
15240
15241// _loop0_116: ',' star_target
15242static asdl_seq *
15243_loop0_116_rule(Parser *p)
15244{
15245 if (p->error_indicator) {
15246 return NULL;
15247 }
15248 void *res = NULL;
15249 int mark = p->mark;
15250 int start_mark = p->mark;
15251 void **children = PyMem_Malloc(sizeof(void *));
15252 if (!children) {
15253 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15254 return NULL;
15255 }
15256 ssize_t children_capacity = 1;
15257 ssize_t n = 0;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015258 { // ',' star_target
15259 expr_ty elem;
15260 void *literal;
15261 while (
15262 (literal = _PyPegen_expect_token(p, 12))
15263 &&
15264 (elem = star_target_rule(p))
15265 )
15266 {
15267 res = elem;
15268 if (res == NULL && PyErr_Occurred()) {
15269 p->error_indicator = 1;
15270 PyMem_Free(children);
15271 return NULL;
15272 }
15273 if (n == children_capacity) {
15274 children_capacity *= 2;
15275 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15276 if (!children) {
15277 PyErr_Format(PyExc_MemoryError, "realloc None");
15278 return NULL;
15279 }
15280 }
15281 children[n++] = res;
15282 mark = p->mark;
15283 }
15284 p->mark = mark;
15285 }
15286 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15287 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070015288 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_116");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015289 PyMem_Free(children);
15290 return NULL;
15291 }
15292 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15293 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070015294 _PyPegen_insert_memo(p, start_mark, _loop0_116_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015295 return seq;
15296}
15297
Guido van Rossumc001c092020-04-30 12:12:19 -070015298// _gather_115: star_target _loop0_116
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015299static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070015300_gather_115_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015301{
15302 if (p->error_indicator) {
15303 return NULL;
15304 }
15305 asdl_seq * res = NULL;
15306 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070015307 { // star_target _loop0_116
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015308 expr_ty elem;
15309 asdl_seq * seq;
15310 if (
15311 (elem = star_target_rule(p))
15312 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070015313 (seq = _loop0_116_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015314 )
15315 {
15316 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15317 goto done;
15318 }
15319 p->mark = mark;
15320 }
15321 res = NULL;
15322 done:
15323 return res;
15324}
15325
Guido van Rossumc001c092020-04-30 12:12:19 -070015326// _tmp_117: !'*' star_target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015327static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015328_tmp_117_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015329{
15330 if (p->error_indicator) {
15331 return NULL;
15332 }
15333 void * res = NULL;
15334 int mark = p->mark;
15335 { // !'*' star_target
15336 expr_ty star_target_var;
15337 if (
15338 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16)
15339 &&
15340 (star_target_var = star_target_rule(p))
15341 )
15342 {
15343 res = star_target_var;
15344 goto done;
15345 }
15346 p->mark = mark;
15347 }
15348 res = NULL;
15349 done:
15350 return res;
15351}
15352
Guido van Rossumc001c092020-04-30 12:12:19 -070015353// _loop0_119: ',' del_target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015354static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070015355_loop0_119_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015356{
15357 if (p->error_indicator) {
15358 return NULL;
15359 }
15360 void *res = NULL;
15361 int mark = p->mark;
15362 int start_mark = p->mark;
15363 void **children = PyMem_Malloc(sizeof(void *));
15364 if (!children) {
15365 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15366 return NULL;
15367 }
15368 ssize_t children_capacity = 1;
15369 ssize_t n = 0;
15370 { // ',' del_target
15371 expr_ty elem;
15372 void *literal;
15373 while (
15374 (literal = _PyPegen_expect_token(p, 12))
15375 &&
15376 (elem = del_target_rule(p))
15377 )
15378 {
15379 res = elem;
15380 if (res == NULL && PyErr_Occurred()) {
15381 p->error_indicator = 1;
15382 PyMem_Free(children);
15383 return NULL;
15384 }
15385 if (n == children_capacity) {
15386 children_capacity *= 2;
15387 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15388 if (!children) {
15389 PyErr_Format(PyExc_MemoryError, "realloc None");
15390 return NULL;
15391 }
15392 }
15393 children[n++] = res;
15394 mark = p->mark;
15395 }
15396 p->mark = mark;
15397 }
15398 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15399 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070015400 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_119");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015401 PyMem_Free(children);
15402 return NULL;
15403 }
15404 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15405 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070015406 _PyPegen_insert_memo(p, start_mark, _loop0_119_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015407 return seq;
15408}
15409
Guido van Rossumc001c092020-04-30 12:12:19 -070015410// _gather_118: del_target _loop0_119
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015411static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070015412_gather_118_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015413{
15414 if (p->error_indicator) {
15415 return NULL;
15416 }
15417 asdl_seq * res = NULL;
15418 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070015419 { // del_target _loop0_119
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015420 expr_ty elem;
15421 asdl_seq * seq;
15422 if (
15423 (elem = del_target_rule(p))
15424 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070015425 (seq = _loop0_119_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015426 )
15427 {
15428 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15429 goto done;
15430 }
15431 p->mark = mark;
15432 }
15433 res = NULL;
15434 done:
15435 return res;
15436}
15437
Guido van Rossumc001c092020-04-30 12:12:19 -070015438// _loop0_121: ',' target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015439static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070015440_loop0_121_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015441{
15442 if (p->error_indicator) {
15443 return NULL;
15444 }
15445 void *res = NULL;
15446 int mark = p->mark;
15447 int start_mark = p->mark;
15448 void **children = PyMem_Malloc(sizeof(void *));
15449 if (!children) {
15450 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15451 return NULL;
15452 }
15453 ssize_t children_capacity = 1;
15454 ssize_t n = 0;
15455 { // ',' target
15456 expr_ty elem;
15457 void *literal;
15458 while (
15459 (literal = _PyPegen_expect_token(p, 12))
15460 &&
15461 (elem = target_rule(p))
15462 )
15463 {
15464 res = elem;
15465 if (res == NULL && PyErr_Occurred()) {
15466 p->error_indicator = 1;
15467 PyMem_Free(children);
15468 return NULL;
15469 }
15470 if (n == children_capacity) {
15471 children_capacity *= 2;
15472 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15473 if (!children) {
15474 PyErr_Format(PyExc_MemoryError, "realloc None");
15475 return NULL;
15476 }
15477 }
15478 children[n++] = res;
15479 mark = p->mark;
15480 }
15481 p->mark = mark;
15482 }
15483 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15484 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070015485 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_121");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015486 PyMem_Free(children);
15487 return NULL;
15488 }
15489 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15490 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070015491 _PyPegen_insert_memo(p, start_mark, _loop0_121_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015492 return seq;
15493}
15494
Guido van Rossumc001c092020-04-30 12:12:19 -070015495// _gather_120: target _loop0_121
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015496static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070015497_gather_120_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015498{
15499 if (p->error_indicator) {
15500 return NULL;
15501 }
15502 asdl_seq * res = NULL;
15503 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070015504 { // target _loop0_121
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015505 expr_ty elem;
15506 asdl_seq * seq;
15507 if (
15508 (elem = target_rule(p))
15509 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070015510 (seq = _loop0_121_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015511 )
15512 {
15513 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15514 goto done;
15515 }
15516 p->mark = mark;
15517 }
15518 res = NULL;
15519 done:
15520 return res;
15521}
15522
Guido van Rossumc001c092020-04-30 12:12:19 -070015523// _tmp_122: args | expression for_if_clauses
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015524static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015525_tmp_122_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015526{
15527 if (p->error_indicator) {
15528 return NULL;
15529 }
15530 void * res = NULL;
15531 int mark = p->mark;
15532 { // args
15533 expr_ty args_var;
15534 if (
15535 (args_var = args_rule(p))
15536 )
15537 {
15538 res = args_var;
15539 goto done;
15540 }
15541 p->mark = mark;
15542 }
15543 { // expression for_if_clauses
15544 expr_ty expression_var;
15545 asdl_seq* for_if_clauses_var;
15546 if (
15547 (expression_var = expression_rule(p))
15548 &&
15549 (for_if_clauses_var = for_if_clauses_rule(p))
15550 )
15551 {
15552 res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
15553 goto done;
15554 }
15555 p->mark = mark;
15556 }
15557 res = NULL;
15558 done:
15559 return res;
15560}
15561
Guido van Rossumc001c092020-04-30 12:12:19 -070015562// _tmp_123: '=' annotated_rhs
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015563static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015564_tmp_123_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015565{
15566 if (p->error_indicator) {
15567 return NULL;
15568 }
15569 void * res = NULL;
15570 int mark = p->mark;
15571 { // '=' annotated_rhs
15572 expr_ty annotated_rhs_var;
15573 void *literal;
15574 if (
15575 (literal = _PyPegen_expect_token(p, 22))
15576 &&
15577 (annotated_rhs_var = annotated_rhs_rule(p))
15578 )
15579 {
15580 res = _PyPegen_dummy_name(p, literal, annotated_rhs_var);
15581 goto done;
15582 }
15583 p->mark = mark;
15584 }
15585 res = NULL;
15586 done:
15587 return res;
15588}
15589
Guido van Rossumc001c092020-04-30 12:12:19 -070015590// _tmp_124: '=' | augassign
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015591static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015592_tmp_124_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015593{
15594 if (p->error_indicator) {
15595 return NULL;
15596 }
15597 void * res = NULL;
15598 int mark = p->mark;
15599 { // '='
15600 void *literal;
15601 if (
15602 (literal = _PyPegen_expect_token(p, 22))
15603 )
15604 {
15605 res = literal;
15606 goto done;
15607 }
15608 p->mark = mark;
15609 }
15610 { // augassign
15611 AugOperator* augassign_var;
15612 if (
15613 (augassign_var = augassign_rule(p))
15614 )
15615 {
15616 res = augassign_var;
15617 goto done;
15618 }
15619 p->mark = mark;
15620 }
15621 res = NULL;
15622 done:
15623 return res;
15624}
15625
Guido van Rossumc001c092020-04-30 12:12:19 -070015626// _tmp_125: yield_expr | star_expressions
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015627static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015628_tmp_125_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015629{
15630 if (p->error_indicator) {
15631 return NULL;
15632 }
15633 void * res = NULL;
15634 int mark = p->mark;
15635 { // yield_expr
15636 expr_ty yield_expr_var;
15637 if (
15638 (yield_expr_var = yield_expr_rule(p))
15639 )
15640 {
15641 res = yield_expr_var;
15642 goto done;
15643 }
15644 p->mark = mark;
15645 }
15646 { // star_expressions
15647 expr_ty star_expressions_var;
15648 if (
15649 (star_expressions_var = star_expressions_rule(p))
15650 )
15651 {
15652 res = star_expressions_var;
15653 goto done;
15654 }
15655 p->mark = mark;
15656 }
15657 res = NULL;
15658 done:
15659 return res;
15660}
15661
Guido van Rossumc001c092020-04-30 12:12:19 -070015662// _tmp_126: '[' | '(' | '{'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015663static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015664_tmp_126_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015665{
15666 if (p->error_indicator) {
15667 return NULL;
15668 }
15669 void * res = NULL;
15670 int mark = p->mark;
15671 { // '['
15672 void *literal;
15673 if (
15674 (literal = _PyPegen_expect_token(p, 9))
15675 )
15676 {
15677 res = literal;
15678 goto done;
15679 }
15680 p->mark = mark;
15681 }
15682 { // '('
15683 void *literal;
15684 if (
15685 (literal = _PyPegen_expect_token(p, 7))
15686 )
15687 {
15688 res = literal;
15689 goto done;
15690 }
15691 p->mark = mark;
15692 }
15693 { // '{'
15694 void *literal;
15695 if (
15696 (literal = _PyPegen_expect_token(p, 25))
15697 )
15698 {
15699 res = literal;
15700 goto done;
15701 }
15702 p->mark = mark;
15703 }
15704 res = NULL;
15705 done:
15706 return res;
15707}
15708
Guido van Rossumc001c092020-04-30 12:12:19 -070015709// _loop0_127: param_no_default
15710static asdl_seq *
15711_loop0_127_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015712{
15713 if (p->error_indicator) {
15714 return NULL;
15715 }
Guido van Rossumc001c092020-04-30 12:12:19 -070015716 void *res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015717 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070015718 int start_mark = p->mark;
15719 void **children = PyMem_Malloc(sizeof(void *));
15720 if (!children) {
15721 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15722 return NULL;
15723 }
15724 ssize_t children_capacity = 1;
15725 ssize_t n = 0;
15726 { // param_no_default
15727 arg_ty param_no_default_var;
15728 while (
15729 (param_no_default_var = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015730 )
15731 {
Guido van Rossumc001c092020-04-30 12:12:19 -070015732 res = param_no_default_var;
15733 if (n == children_capacity) {
15734 children_capacity *= 2;
15735 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15736 if (!children) {
15737 PyErr_Format(PyExc_MemoryError, "realloc None");
15738 return NULL;
15739 }
15740 }
15741 children[n++] = res;
15742 mark = p->mark;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015743 }
15744 p->mark = mark;
15745 }
Guido van Rossumc001c092020-04-30 12:12:19 -070015746 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15747 if (!seq) {
15748 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_127");
15749 PyMem_Free(children);
15750 return NULL;
15751 }
15752 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15753 PyMem_Free(children);
15754 _PyPegen_insert_memo(p, start_mark, _loop0_127_type, seq);
15755 return seq;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015756}
15757
Guido van Rossumc001c092020-04-30 12:12:19 -070015758// _tmp_128: slash_with_default | param_with_default+
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015759static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015760_tmp_128_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015761{
15762 if (p->error_indicator) {
15763 return NULL;
15764 }
15765 void * res = NULL;
15766 int mark = p->mark;
15767 { // slash_with_default
15768 SlashWithDefault* slash_with_default_var;
15769 if (
15770 (slash_with_default_var = slash_with_default_rule(p))
15771 )
15772 {
15773 res = slash_with_default_var;
15774 goto done;
15775 }
15776 p->mark = mark;
15777 }
Guido van Rossumc001c092020-04-30 12:12:19 -070015778 { // param_with_default+
15779 asdl_seq * _loop1_140_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015780 if (
Guido van Rossumc001c092020-04-30 12:12:19 -070015781 (_loop1_140_var = _loop1_140_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015782 )
15783 {
Guido van Rossumc001c092020-04-30 12:12:19 -070015784 res = _loop1_140_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015785 goto done;
15786 }
15787 p->mark = mark;
15788 }
15789 res = NULL;
15790 done:
15791 return res;
15792}
15793
Guido van Rossumc001c092020-04-30 12:12:19 -070015794// _tmp_129: star_targets '='
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015795static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015796_tmp_129_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015797{
15798 if (p->error_indicator) {
15799 return NULL;
15800 }
15801 void * res = NULL;
15802 int mark = p->mark;
15803 { // star_targets '='
15804 void *literal;
15805 expr_ty z;
15806 if (
15807 (z = star_targets_rule(p))
15808 &&
15809 (literal = _PyPegen_expect_token(p, 22))
15810 )
15811 {
15812 res = z;
15813 if (res == NULL && PyErr_Occurred()) {
15814 p->error_indicator = 1;
15815 return NULL;
15816 }
15817 goto done;
15818 }
15819 p->mark = mark;
15820 }
15821 res = NULL;
15822 done:
15823 return res;
15824}
15825
Guido van Rossumc001c092020-04-30 12:12:19 -070015826// _tmp_130: '.' | '...'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015827static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015828_tmp_130_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015829{
15830 if (p->error_indicator) {
15831 return NULL;
15832 }
15833 void * res = NULL;
15834 int mark = p->mark;
15835 { // '.'
15836 void *literal;
15837 if (
15838 (literal = _PyPegen_expect_token(p, 23))
15839 )
15840 {
15841 res = literal;
15842 goto done;
15843 }
15844 p->mark = mark;
15845 }
15846 { // '...'
15847 void *literal;
15848 if (
15849 (literal = _PyPegen_expect_token(p, 52))
15850 )
15851 {
15852 res = literal;
15853 goto done;
15854 }
15855 p->mark = mark;
15856 }
15857 res = NULL;
15858 done:
15859 return res;
15860}
15861
Guido van Rossumc001c092020-04-30 12:12:19 -070015862// _tmp_131: '.' | '...'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015863static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015864_tmp_131_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015865{
15866 if (p->error_indicator) {
15867 return NULL;
15868 }
15869 void * res = NULL;
15870 int mark = p->mark;
Pablo Galindo2b74c832020-04-27 18:02:07 +010015871 { // '.'
15872 void *literal;
15873 if (
15874 (literal = _PyPegen_expect_token(p, 23))
15875 )
15876 {
15877 res = literal;
15878 goto done;
15879 }
15880 p->mark = mark;
15881 }
15882 { // '...'
15883 void *literal;
15884 if (
15885 (literal = _PyPegen_expect_token(p, 52))
15886 )
15887 {
15888 res = literal;
15889 goto done;
15890 }
15891 p->mark = mark;
15892 }
15893 res = NULL;
15894 done:
15895 return res;
15896}
15897
Guido van Rossumc001c092020-04-30 12:12:19 -070015898// _tmp_132: '@' named_expression NEWLINE
Pablo Galindo2b74c832020-04-27 18:02:07 +010015899static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015900_tmp_132_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015901{
15902 if (p->error_indicator) {
15903 return NULL;
15904 }
15905 void * res = NULL;
15906 int mark = p->mark;
15907 { // '@' named_expression NEWLINE
15908 expr_ty f;
15909 void *literal;
15910 void *newline_var;
15911 if (
15912 (literal = _PyPegen_expect_token(p, 49))
15913 &&
15914 (f = named_expression_rule(p))
15915 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +010015916 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015917 )
15918 {
15919 res = f;
15920 if (res == NULL && PyErr_Occurred()) {
15921 p->error_indicator = 1;
15922 return NULL;
15923 }
15924 goto done;
15925 }
15926 p->mark = mark;
15927 }
15928 res = NULL;
15929 done:
15930 return res;
15931}
15932
Guido van Rossumc001c092020-04-30 12:12:19 -070015933// _tmp_133: ',' star_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015934static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015935_tmp_133_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015936{
15937 if (p->error_indicator) {
15938 return NULL;
15939 }
15940 void * res = NULL;
15941 int mark = p->mark;
15942 { // ',' star_expression
15943 expr_ty c;
15944 void *literal;
15945 if (
15946 (literal = _PyPegen_expect_token(p, 12))
15947 &&
15948 (c = star_expression_rule(p))
15949 )
15950 {
15951 res = c;
15952 if (res == NULL && PyErr_Occurred()) {
15953 p->error_indicator = 1;
15954 return NULL;
15955 }
15956 goto done;
15957 }
15958 p->mark = mark;
15959 }
15960 res = NULL;
15961 done:
15962 return res;
15963}
15964
Guido van Rossumc001c092020-04-30 12:12:19 -070015965// _tmp_134: ',' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015966static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015967_tmp_134_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015968{
15969 if (p->error_indicator) {
15970 return NULL;
15971 }
15972 void * res = NULL;
15973 int mark = p->mark;
15974 { // ',' expression
15975 expr_ty c;
15976 void *literal;
15977 if (
15978 (literal = _PyPegen_expect_token(p, 12))
15979 &&
15980 (c = expression_rule(p))
15981 )
15982 {
15983 res = c;
15984 if (res == NULL && PyErr_Occurred()) {
15985 p->error_indicator = 1;
15986 return NULL;
15987 }
15988 goto done;
15989 }
15990 p->mark = mark;
15991 }
15992 res = NULL;
15993 done:
15994 return res;
15995}
15996
Guido van Rossumc001c092020-04-30 12:12:19 -070015997// _tmp_135: lambda_plain_name !'='
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015998static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070015999_tmp_135_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016000{
16001 if (p->error_indicator) {
16002 return NULL;
16003 }
16004 void * res = NULL;
16005 int mark = p->mark;
16006 { // lambda_plain_name !'='
16007 arg_ty lambda_plain_name_var;
16008 if (
16009 (lambda_plain_name_var = lambda_plain_name_rule(p))
16010 &&
16011 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22)
16012 )
16013 {
16014 res = lambda_plain_name_var;
16015 goto done;
16016 }
16017 p->mark = mark;
16018 }
16019 res = NULL;
16020 done:
16021 return res;
16022}
16023
Guido van Rossumc001c092020-04-30 12:12:19 -070016024// _tmp_136: 'or' conjunction
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016025static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070016026_tmp_136_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016027{
16028 if (p->error_indicator) {
16029 return NULL;
16030 }
16031 void * res = NULL;
16032 int mark = p->mark;
16033 { // 'or' conjunction
16034 expr_ty c;
16035 void *keyword;
16036 if (
16037 (keyword = _PyPegen_expect_token(p, 532))
16038 &&
16039 (c = conjunction_rule(p))
16040 )
16041 {
16042 res = c;
16043 if (res == NULL && PyErr_Occurred()) {
16044 p->error_indicator = 1;
16045 return NULL;
16046 }
16047 goto done;
16048 }
16049 p->mark = mark;
16050 }
16051 res = NULL;
16052 done:
16053 return res;
16054}
16055
Guido van Rossumc001c092020-04-30 12:12:19 -070016056// _tmp_137: 'and' inversion
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016057static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070016058_tmp_137_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016059{
16060 if (p->error_indicator) {
16061 return NULL;
16062 }
16063 void * res = NULL;
16064 int mark = p->mark;
16065 { // 'and' inversion
16066 expr_ty c;
16067 void *keyword;
16068 if (
16069 (keyword = _PyPegen_expect_token(p, 533))
16070 &&
16071 (c = inversion_rule(p))
16072 )
16073 {
16074 res = c;
16075 if (res == NULL && PyErr_Occurred()) {
16076 p->error_indicator = 1;
16077 return NULL;
16078 }
16079 goto done;
16080 }
16081 p->mark = mark;
16082 }
16083 res = NULL;
16084 done:
16085 return res;
16086}
16087
Guido van Rossumc001c092020-04-30 12:12:19 -070016088// _tmp_138: ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016089static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070016090_tmp_138_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016091{
16092 if (p->error_indicator) {
16093 return NULL;
16094 }
16095 void * res = NULL;
16096 int mark = p->mark;
16097 { // ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*
16098 expr_ty a;
16099 expr_ty b;
16100 asdl_seq * c;
16101 void *keyword;
16102 void *keyword_1;
16103 void *y;
16104 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010016105 (y = _PyPegen_expect_token(p, ASYNC), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016106 &&
16107 (keyword = _PyPegen_expect_token(p, 517))
16108 &&
16109 (a = star_targets_rule(p))
16110 &&
16111 (keyword_1 = _PyPegen_expect_token(p, 518))
16112 &&
16113 (b = disjunction_rule(p))
16114 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070016115 (c = _loop0_141_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016116 )
16117 {
16118 res = _Py_comprehension ( a , b , c , y != NULL , p -> arena );
16119 if (res == NULL && PyErr_Occurred()) {
16120 p->error_indicator = 1;
16121 return NULL;
16122 }
16123 goto done;
16124 }
16125 p->mark = mark;
16126 }
16127 res = NULL;
16128 done:
16129 return res;
16130}
16131
Guido van Rossumc001c092020-04-30 12:12:19 -070016132// _tmp_139: ',' star_target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016133static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070016134_tmp_139_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016135{
16136 if (p->error_indicator) {
16137 return NULL;
16138 }
16139 void * res = NULL;
16140 int mark = p->mark;
16141 { // ',' star_target
16142 expr_ty c;
16143 void *literal;
16144 if (
16145 (literal = _PyPegen_expect_token(p, 12))
16146 &&
16147 (c = star_target_rule(p))
16148 )
16149 {
16150 res = c;
16151 if (res == NULL && PyErr_Occurred()) {
16152 p->error_indicator = 1;
16153 return NULL;
16154 }
16155 goto done;
16156 }
16157 p->mark = mark;
16158 }
16159 res = NULL;
16160 done:
16161 return res;
16162}
16163
Guido van Rossumc001c092020-04-30 12:12:19 -070016164// _loop1_140: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016165static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070016166_loop1_140_rule(Parser *p)
16167{
16168 if (p->error_indicator) {
16169 return NULL;
16170 }
16171 void *res = NULL;
16172 int mark = p->mark;
16173 int start_mark = p->mark;
16174 void **children = PyMem_Malloc(sizeof(void *));
16175 if (!children) {
16176 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
16177 return NULL;
16178 }
16179 ssize_t children_capacity = 1;
16180 ssize_t n = 0;
16181 { // param_with_default
16182 NameDefaultPair* param_with_default_var;
16183 while (
16184 (param_with_default_var = param_with_default_rule(p))
16185 )
16186 {
16187 res = param_with_default_var;
16188 if (n == children_capacity) {
16189 children_capacity *= 2;
16190 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
16191 if (!children) {
16192 PyErr_Format(PyExc_MemoryError, "realloc None");
16193 return NULL;
16194 }
16195 }
16196 children[n++] = res;
16197 mark = p->mark;
16198 }
16199 p->mark = mark;
16200 }
16201 if (n == 0) {
16202 PyMem_Free(children);
16203 return NULL;
16204 }
16205 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
16206 if (!seq) {
16207 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_140");
16208 PyMem_Free(children);
16209 return NULL;
16210 }
16211 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
16212 PyMem_Free(children);
16213 _PyPegen_insert_memo(p, start_mark, _loop1_140_type, seq);
16214 return seq;
16215}
16216
16217// _loop0_141: ('if' disjunction)
16218static asdl_seq *
16219_loop0_141_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016220{
16221 if (p->error_indicator) {
16222 return NULL;
16223 }
16224 void *res = NULL;
16225 int mark = p->mark;
16226 int start_mark = p->mark;
16227 void **children = PyMem_Malloc(sizeof(void *));
16228 if (!children) {
16229 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
16230 return NULL;
16231 }
16232 ssize_t children_capacity = 1;
16233 ssize_t n = 0;
16234 { // ('if' disjunction)
Guido van Rossumc001c092020-04-30 12:12:19 -070016235 void *_tmp_142_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016236 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070016237 (_tmp_142_var = _tmp_142_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016238 )
16239 {
Guido van Rossumc001c092020-04-30 12:12:19 -070016240 res = _tmp_142_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016241 if (n == children_capacity) {
16242 children_capacity *= 2;
16243 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
16244 if (!children) {
16245 PyErr_Format(PyExc_MemoryError, "realloc None");
16246 return NULL;
16247 }
16248 }
16249 children[n++] = res;
16250 mark = p->mark;
16251 }
16252 p->mark = mark;
16253 }
16254 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
16255 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070016256 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_141");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016257 PyMem_Free(children);
16258 return NULL;
16259 }
16260 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
16261 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070016262 _PyPegen_insert_memo(p, start_mark, _loop0_141_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016263 return seq;
16264}
16265
Guido van Rossumc001c092020-04-30 12:12:19 -070016266// _tmp_142: 'if' disjunction
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016267static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070016268_tmp_142_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016269{
16270 if (p->error_indicator) {
16271 return NULL;
16272 }
16273 void * res = NULL;
16274 int mark = p->mark;
16275 { // 'if' disjunction
16276 void *keyword;
16277 expr_ty z;
16278 if (
16279 (keyword = _PyPegen_expect_token(p, 510))
16280 &&
16281 (z = disjunction_rule(p))
16282 )
16283 {
16284 res = z;
16285 if (res == NULL && PyErr_Occurred()) {
16286 p->error_indicator = 1;
16287 return NULL;
16288 }
16289 goto done;
16290 }
16291 p->mark = mark;
16292 }
16293 res = NULL;
16294 done:
16295 return res;
16296}
16297
16298void *
16299_PyPegen_parse(Parser *p)
16300{
16301 // Initialize keywords
16302 p->keywords = reserved_keywords;
16303 p->n_keyword_lists = n_keyword_lists;
16304
16305 // Run parser
16306 void *result = NULL;
16307 if (p->start_rule == Py_file_input) {
16308 result = file_rule(p);
16309 } else if (p->start_rule == Py_single_input) {
16310 result = interactive_rule(p);
16311 } else if (p->start_rule == Py_eval_input) {
16312 result = eval_rule(p);
Guido van Rossumc001c092020-04-30 12:12:19 -070016313 } else if (p->start_rule == Py_func_type_input) {
16314 result = func_type_rule(p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016315 } else if (p->start_rule == Py_fstring_input) {
16316 result = fstring_rule(p);
16317 }
16318
16319 return result;
16320}
16321
16322// The end