blob: 55605d5770f1e64b3106b4002952d445326ef1fa [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
Guido van Rossum3941d972020-05-01 09:42:03 -0700141#define lambda_slash_no_default_type 1070
Guido van Rossumc001c092020-04-30 12:12:19 -0700142#define lambda_slash_with_default_type 1071
143#define lambda_star_etc_type 1072
Guido van Rossum3941d972020-05-01 09:42:03 -0700144#define lambda_kwds_type 1073
145#define lambda_param_no_default_type 1074
146#define lambda_param_with_default_type 1075
147#define lambda_param_maybe_default_type 1076
148#define lambda_param_type 1077
149#define disjunction_type 1078
150#define conjunction_type 1079
151#define inversion_type 1080
152#define comparison_type 1081
153#define compare_op_bitwise_or_pair_type 1082
154#define eq_bitwise_or_type 1083
155#define noteq_bitwise_or_type 1084
156#define lte_bitwise_or_type 1085
157#define lt_bitwise_or_type 1086
158#define gte_bitwise_or_type 1087
159#define gt_bitwise_or_type 1088
160#define notin_bitwise_or_type 1089
161#define in_bitwise_or_type 1090
162#define isnot_bitwise_or_type 1091
163#define is_bitwise_or_type 1092
164#define bitwise_or_type 1093 // Left-recursive
165#define bitwise_xor_type 1094 // Left-recursive
166#define bitwise_and_type 1095 // Left-recursive
167#define shift_expr_type 1096 // Left-recursive
168#define sum_type 1097 // Left-recursive
169#define term_type 1098 // Left-recursive
170#define factor_type 1099
171#define power_type 1100
172#define await_primary_type 1101
173#define primary_type 1102 // Left-recursive
174#define slices_type 1103
175#define slice_type 1104
176#define atom_type 1105
177#define strings_type 1106
178#define list_type 1107
179#define listcomp_type 1108
180#define tuple_type 1109
181#define group_type 1110
182#define genexp_type 1111
183#define set_type 1112
184#define setcomp_type 1113
185#define dict_type 1114
186#define dictcomp_type 1115
187#define kvpairs_type 1116
188#define kvpair_type 1117
189#define for_if_clauses_type 1118
190#define for_if_clause_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
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +0300218#define invalid_star_etc_type 1147
219#define invalid_lambda_star_etc_type 1148
220#define invalid_double_type_comments_type 1149
221#define _loop0_1_type 1150
222#define _loop0_2_type 1151
223#define _loop0_4_type 1152
224#define _gather_3_type 1153
225#define _loop0_6_type 1154
226#define _gather_5_type 1155
227#define _loop0_8_type 1156
228#define _gather_7_type 1157
229#define _loop0_10_type 1158
230#define _gather_9_type 1159
231#define _loop1_11_type 1160
232#define _loop0_13_type 1161
233#define _gather_12_type 1162
234#define _tmp_14_type 1163
235#define _tmp_15_type 1164
236#define _tmp_16_type 1165
237#define _tmp_17_type 1166
238#define _tmp_18_type 1167
239#define _tmp_19_type 1168
240#define _tmp_20_type 1169
241#define _tmp_21_type 1170
242#define _loop1_22_type 1171
243#define _tmp_23_type 1172
244#define _tmp_24_type 1173
245#define _loop0_26_type 1174
246#define _gather_25_type 1175
247#define _loop0_28_type 1176
248#define _gather_27_type 1177
249#define _tmp_29_type 1178
250#define _loop0_30_type 1179
251#define _loop1_31_type 1180
252#define _loop0_33_type 1181
253#define _gather_32_type 1182
254#define _tmp_34_type 1183
255#define _loop0_36_type 1184
256#define _gather_35_type 1185
257#define _tmp_37_type 1186
258#define _loop0_39_type 1187
259#define _gather_38_type 1188
260#define _loop0_41_type 1189
261#define _gather_40_type 1190
262#define _loop0_43_type 1191
263#define _gather_42_type 1192
264#define _loop0_45_type 1193
265#define _gather_44_type 1194
266#define _tmp_46_type 1195
267#define _loop1_47_type 1196
268#define _tmp_48_type 1197
269#define _tmp_49_type 1198
270#define _tmp_50_type 1199
271#define _tmp_51_type 1200
272#define _tmp_52_type 1201
273#define _loop0_53_type 1202
274#define _loop0_54_type 1203
275#define _loop0_55_type 1204
276#define _loop1_56_type 1205
277#define _loop0_57_type 1206
278#define _loop1_58_type 1207
279#define _loop1_59_type 1208
280#define _loop1_60_type 1209
281#define _loop0_61_type 1210
282#define _loop1_62_type 1211
283#define _loop0_63_type 1212
284#define _loop1_64_type 1213
285#define _loop0_65_type 1214
286#define _loop1_66_type 1215
287#define _loop1_67_type 1216
288#define _tmp_68_type 1217
289#define _loop0_70_type 1218
290#define _gather_69_type 1219
291#define _loop1_71_type 1220
292#define _loop0_73_type 1221
293#define _gather_72_type 1222
294#define _loop1_74_type 1223
295#define _loop0_75_type 1224
296#define _loop0_76_type 1225
297#define _loop0_77_type 1226
298#define _loop1_78_type 1227
299#define _loop0_79_type 1228
300#define _loop1_80_type 1229
301#define _loop1_81_type 1230
302#define _loop1_82_type 1231
303#define _loop0_83_type 1232
304#define _loop1_84_type 1233
305#define _loop0_85_type 1234
306#define _loop1_86_type 1235
307#define _loop0_87_type 1236
308#define _loop1_88_type 1237
309#define _loop1_89_type 1238
310#define _loop1_90_type 1239
311#define _loop1_91_type 1240
312#define _tmp_92_type 1241
313#define _loop0_94_type 1242
314#define _gather_93_type 1243
315#define _tmp_95_type 1244
316#define _tmp_96_type 1245
317#define _tmp_97_type 1246
318#define _tmp_98_type 1247
319#define _loop1_99_type 1248
320#define _tmp_100_type 1249
321#define _tmp_101_type 1250
322#define _loop0_103_type 1251
323#define _gather_102_type 1252
324#define _loop1_104_type 1253
325#define _loop0_105_type 1254
326#define _loop0_106_type 1255
327#define _tmp_107_type 1256
328#define _tmp_108_type 1257
329#define _loop0_110_type 1258
330#define _gather_109_type 1259
331#define _loop0_112_type 1260
332#define _gather_111_type 1261
333#define _loop0_114_type 1262
334#define _gather_113_type 1263
335#define _loop0_116_type 1264
336#define _gather_115_type 1265
337#define _loop0_117_type 1266
338#define _loop0_119_type 1267
339#define _gather_118_type 1268
340#define _tmp_120_type 1269
341#define _loop0_122_type 1270
342#define _gather_121_type 1271
343#define _loop0_124_type 1272
344#define _gather_123_type 1273
345#define _tmp_125_type 1274
346#define _tmp_126_type 1275
347#define _tmp_127_type 1276
348#define _tmp_128_type 1277
349#define _tmp_129_type 1278
350#define _loop0_130_type 1279
351#define _tmp_131_type 1280
352#define _tmp_132_type 1281
353#define _tmp_133_type 1282
354#define _tmp_134_type 1283
355#define _tmp_135_type 1284
356#define _tmp_136_type 1285
357#define _tmp_137_type 1286
358#define _tmp_138_type 1287
359#define _tmp_139_type 1288
360#define _tmp_140_type 1289
361#define _tmp_141_type 1290
362#define _tmp_142_type 1291
363#define _tmp_143_type 1292
364#define _tmp_144_type 1293
365#define _loop1_145_type 1294
366#define _tmp_146_type 1295
367#define _tmp_147_type 1296
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100368
369static mod_ty file_rule(Parser *p);
370static mod_ty interactive_rule(Parser *p);
371static mod_ty eval_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700372static mod_ty func_type_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100373static expr_ty fstring_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700374static asdl_seq* type_expressions_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100375static asdl_seq* statements_rule(Parser *p);
376static asdl_seq* statement_rule(Parser *p);
377static asdl_seq* statement_newline_rule(Parser *p);
378static asdl_seq* simple_stmt_rule(Parser *p);
379static stmt_ty small_stmt_rule(Parser *p);
380static stmt_ty compound_stmt_rule(Parser *p);
381static void *assignment_rule(Parser *p);
382static AugOperator* augassign_rule(Parser *p);
383static stmt_ty global_stmt_rule(Parser *p);
384static stmt_ty nonlocal_stmt_rule(Parser *p);
385static stmt_ty yield_stmt_rule(Parser *p);
386static stmt_ty assert_stmt_rule(Parser *p);
387static stmt_ty del_stmt_rule(Parser *p);
388static stmt_ty import_stmt_rule(Parser *p);
389static stmt_ty import_name_rule(Parser *p);
390static stmt_ty import_from_rule(Parser *p);
391static asdl_seq* import_from_targets_rule(Parser *p);
392static asdl_seq* import_from_as_names_rule(Parser *p);
393static alias_ty import_from_as_name_rule(Parser *p);
394static asdl_seq* dotted_as_names_rule(Parser *p);
395static alias_ty dotted_as_name_rule(Parser *p);
396static expr_ty dotted_name_rule(Parser *p);
397static stmt_ty if_stmt_rule(Parser *p);
398static stmt_ty elif_stmt_rule(Parser *p);
399static asdl_seq* else_block_rule(Parser *p);
400static stmt_ty while_stmt_rule(Parser *p);
401static stmt_ty for_stmt_rule(Parser *p);
402static stmt_ty with_stmt_rule(Parser *p);
403static withitem_ty with_item_rule(Parser *p);
404static stmt_ty try_stmt_rule(Parser *p);
405static excepthandler_ty except_block_rule(Parser *p);
406static asdl_seq* finally_block_rule(Parser *p);
407static stmt_ty return_stmt_rule(Parser *p);
408static stmt_ty raise_stmt_rule(Parser *p);
409static stmt_ty function_def_rule(Parser *p);
410static stmt_ty function_def_raw_rule(Parser *p);
Pablo Galindod9552412020-05-01 16:32:09 +0100411static Token* func_type_comment_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100412static arguments_ty params_rule(Parser *p);
413static arguments_ty parameters_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700414static asdl_seq* slash_no_default_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100415static SlashWithDefault* slash_with_default_rule(Parser *p);
416static StarEtc* star_etc_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100417static arg_ty kwds_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700418static arg_ty param_no_default_rule(Parser *p);
419static NameDefaultPair* param_with_default_rule(Parser *p);
420static NameDefaultPair* param_maybe_default_rule(Parser *p);
421static arg_ty param_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100422static expr_ty annotation_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700423static expr_ty default_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100424static asdl_seq* decorators_rule(Parser *p);
425static stmt_ty class_def_rule(Parser *p);
426static stmt_ty class_def_raw_rule(Parser *p);
427static asdl_seq* block_rule(Parser *p);
428static asdl_seq* expressions_list_rule(Parser *p);
429static expr_ty star_expressions_rule(Parser *p);
430static expr_ty star_expression_rule(Parser *p);
431static asdl_seq* star_named_expressions_rule(Parser *p);
432static expr_ty star_named_expression_rule(Parser *p);
433static expr_ty named_expression_rule(Parser *p);
434static expr_ty annotated_rhs_rule(Parser *p);
435static expr_ty expressions_rule(Parser *p);
436static expr_ty expression_rule(Parser *p);
437static expr_ty lambdef_rule(Parser *p);
438static arguments_ty lambda_parameters_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700439static asdl_seq* lambda_slash_no_default_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100440static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
441static StarEtc* lambda_star_etc_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100442static arg_ty lambda_kwds_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700443static arg_ty lambda_param_no_default_rule(Parser *p);
444static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
445static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
446static arg_ty lambda_param_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100447static expr_ty disjunction_rule(Parser *p);
448static expr_ty conjunction_rule(Parser *p);
449static expr_ty inversion_rule(Parser *p);
450static expr_ty comparison_rule(Parser *p);
451static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
452static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
453static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
454static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
455static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
456static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
457static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
458static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
459static CmpopExprPair* in_bitwise_or_rule(Parser *p);
460static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
461static CmpopExprPair* is_bitwise_or_rule(Parser *p);
462static expr_ty bitwise_or_rule(Parser *p);
463static expr_ty bitwise_xor_rule(Parser *p);
464static expr_ty bitwise_and_rule(Parser *p);
465static expr_ty shift_expr_rule(Parser *p);
466static expr_ty sum_rule(Parser *p);
467static expr_ty term_rule(Parser *p);
468static expr_ty factor_rule(Parser *p);
469static expr_ty power_rule(Parser *p);
470static expr_ty await_primary_rule(Parser *p);
471static expr_ty primary_rule(Parser *p);
472static expr_ty slices_rule(Parser *p);
473static expr_ty slice_rule(Parser *p);
474static expr_ty atom_rule(Parser *p);
475static expr_ty strings_rule(Parser *p);
476static expr_ty list_rule(Parser *p);
477static expr_ty listcomp_rule(Parser *p);
478static expr_ty tuple_rule(Parser *p);
479static expr_ty group_rule(Parser *p);
480static expr_ty genexp_rule(Parser *p);
481static expr_ty set_rule(Parser *p);
482static expr_ty setcomp_rule(Parser *p);
483static expr_ty dict_rule(Parser *p);
484static expr_ty dictcomp_rule(Parser *p);
485static asdl_seq* kvpairs_rule(Parser *p);
486static KeyValuePair* kvpair_rule(Parser *p);
487static asdl_seq* for_if_clauses_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300488static comprehension_ty for_if_clause_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100489static expr_ty yield_expr_rule(Parser *p);
490static expr_ty arguments_rule(Parser *p);
491static expr_ty args_rule(Parser *p);
492static asdl_seq* kwargs_rule(Parser *p);
493static expr_ty starred_expression_rule(Parser *p);
494static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
495static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
496static expr_ty star_targets_rule(Parser *p);
497static asdl_seq* star_targets_seq_rule(Parser *p);
498static expr_ty star_target_rule(Parser *p);
499static expr_ty star_atom_rule(Parser *p);
500static expr_ty inside_paren_ann_assign_target_rule(Parser *p);
501static expr_ty ann_assign_subscript_attribute_target_rule(Parser *p);
502static asdl_seq* del_targets_rule(Parser *p);
503static expr_ty del_target_rule(Parser *p);
504static expr_ty del_t_atom_rule(Parser *p);
505static asdl_seq* targets_rule(Parser *p);
506static expr_ty target_rule(Parser *p);
507static expr_ty t_primary_rule(Parser *p);
508static void *t_lookahead_rule(Parser *p);
509static expr_ty t_atom_rule(Parser *p);
510static void *incorrect_arguments_rule(Parser *p);
511static void *invalid_named_expression_rule(Parser *p);
512static void *invalid_assignment_rule(Parser *p);
513static void *invalid_block_rule(Parser *p);
514static void *invalid_comprehension_rule(Parser *p);
515static void *invalid_parameters_rule(Parser *p);
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +0300516static void *invalid_star_etc_rule(Parser *p);
517static void *invalid_lambda_star_etc_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700518static void *invalid_double_type_comments_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100519static asdl_seq *_loop0_1_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700520static asdl_seq *_loop0_2_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100521static asdl_seq *_loop0_4_rule(Parser *p);
522static asdl_seq *_gather_3_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700523static asdl_seq *_loop0_6_rule(Parser *p);
524static asdl_seq *_gather_5_rule(Parser *p);
525static asdl_seq *_loop0_8_rule(Parser *p);
526static asdl_seq *_gather_7_rule(Parser *p);
527static asdl_seq *_loop0_10_rule(Parser *p);
528static asdl_seq *_gather_9_rule(Parser *p);
529static asdl_seq *_loop1_11_rule(Parser *p);
530static asdl_seq *_loop0_13_rule(Parser *p);
531static asdl_seq *_gather_12_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100532static void *_tmp_14_rule(Parser *p);
533static void *_tmp_15_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700534static void *_tmp_16_rule(Parser *p);
535static void *_tmp_17_rule(Parser *p);
536static void *_tmp_18_rule(Parser *p);
537static void *_tmp_19_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100538static void *_tmp_20_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700539static void *_tmp_21_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100540static asdl_seq *_loop1_22_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700541static void *_tmp_23_rule(Parser *p);
542static void *_tmp_24_rule(Parser *p);
543static asdl_seq *_loop0_26_rule(Parser *p);
544static asdl_seq *_gather_25_rule(Parser *p);
545static asdl_seq *_loop0_28_rule(Parser *p);
546static asdl_seq *_gather_27_rule(Parser *p);
547static void *_tmp_29_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100548static asdl_seq *_loop0_30_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700549static asdl_seq *_loop1_31_rule(Parser *p);
550static asdl_seq *_loop0_33_rule(Parser *p);
551static asdl_seq *_gather_32_rule(Parser *p);
552static void *_tmp_34_rule(Parser *p);
553static asdl_seq *_loop0_36_rule(Parser *p);
554static asdl_seq *_gather_35_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100555static void *_tmp_37_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700556static asdl_seq *_loop0_39_rule(Parser *p);
557static asdl_seq *_gather_38_rule(Parser *p);
558static asdl_seq *_loop0_41_rule(Parser *p);
559static asdl_seq *_gather_40_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300560static asdl_seq *_loop0_43_rule(Parser *p);
561static asdl_seq *_gather_42_rule(Parser *p);
562static asdl_seq *_loop0_45_rule(Parser *p);
563static asdl_seq *_gather_44_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100564static void *_tmp_46_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300565static asdl_seq *_loop1_47_rule(Parser *p);
566static void *_tmp_48_rule(Parser *p);
567static void *_tmp_49_rule(Parser *p);
568static void *_tmp_50_rule(Parser *p);
569static void *_tmp_51_rule(Parser *p);
570static void *_tmp_52_rule(Parser *p);
571static asdl_seq *_loop0_53_rule(Parser *p);
572static asdl_seq *_loop0_54_rule(Parser *p);
573static asdl_seq *_loop0_55_rule(Parser *p);
574static asdl_seq *_loop1_56_rule(Parser *p);
575static asdl_seq *_loop0_57_rule(Parser *p);
576static asdl_seq *_loop1_58_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700577static asdl_seq *_loop1_59_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300578static asdl_seq *_loop1_60_rule(Parser *p);
579static asdl_seq *_loop0_61_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700580static asdl_seq *_loop1_62_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300581static asdl_seq *_loop0_63_rule(Parser *p);
582static asdl_seq *_loop1_64_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700583static asdl_seq *_loop0_65_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700584static asdl_seq *_loop1_66_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300585static asdl_seq *_loop1_67_rule(Parser *p);
586static void *_tmp_68_rule(Parser *p);
587static asdl_seq *_loop0_70_rule(Parser *p);
588static asdl_seq *_gather_69_rule(Parser *p);
589static asdl_seq *_loop1_71_rule(Parser *p);
590static asdl_seq *_loop0_73_rule(Parser *p);
591static asdl_seq *_gather_72_rule(Parser *p);
592static asdl_seq *_loop1_74_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700593static asdl_seq *_loop0_75_rule(Parser *p);
594static asdl_seq *_loop0_76_rule(Parser *p);
595static asdl_seq *_loop0_77_rule(Parser *p);
596static asdl_seq *_loop1_78_rule(Parser *p);
597static asdl_seq *_loop0_79_rule(Parser *p);
598static asdl_seq *_loop1_80_rule(Parser *p);
599static asdl_seq *_loop1_81_rule(Parser *p);
600static asdl_seq *_loop1_82_rule(Parser *p);
601static asdl_seq *_loop0_83_rule(Parser *p);
602static asdl_seq *_loop1_84_rule(Parser *p);
603static asdl_seq *_loop0_85_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300604static asdl_seq *_loop1_86_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700605static asdl_seq *_loop0_87_rule(Parser *p);
606static asdl_seq *_loop1_88_rule(Parser *p);
607static asdl_seq *_loop1_89_rule(Parser *p);
608static asdl_seq *_loop1_90_rule(Parser *p);
609static asdl_seq *_loop1_91_rule(Parser *p);
610static void *_tmp_92_rule(Parser *p);
611static asdl_seq *_loop0_94_rule(Parser *p);
612static asdl_seq *_gather_93_rule(Parser *p);
613static void *_tmp_95_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700614static void *_tmp_96_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700615static void *_tmp_97_rule(Parser *p);
616static void *_tmp_98_rule(Parser *p);
617static asdl_seq *_loop1_99_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100618static void *_tmp_100_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300619static void *_tmp_101_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700620static asdl_seq *_loop0_103_rule(Parser *p);
621static asdl_seq *_gather_102_rule(Parser *p);
622static asdl_seq *_loop1_104_rule(Parser *p);
623static asdl_seq *_loop0_105_rule(Parser *p);
624static asdl_seq *_loop0_106_rule(Parser *p);
625static void *_tmp_107_rule(Parser *p);
626static void *_tmp_108_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300627static asdl_seq *_loop0_110_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700628static asdl_seq *_gather_109_rule(Parser *p);
629static asdl_seq *_loop0_112_rule(Parser *p);
630static asdl_seq *_gather_111_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100631static asdl_seq *_loop0_114_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300632static asdl_seq *_gather_113_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100633static asdl_seq *_loop0_116_rule(Parser *p);
634static asdl_seq *_gather_115_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700635static asdl_seq *_loop0_117_rule(Parser *p);
636static asdl_seq *_loop0_119_rule(Parser *p);
637static asdl_seq *_gather_118_rule(Parser *p);
638static void *_tmp_120_rule(Parser *p);
639static asdl_seq *_loop0_122_rule(Parser *p);
640static asdl_seq *_gather_121_rule(Parser *p);
641static asdl_seq *_loop0_124_rule(Parser *p);
642static asdl_seq *_gather_123_rule(Parser *p);
643static void *_tmp_125_rule(Parser *p);
644static void *_tmp_126_rule(Parser *p);
645static void *_tmp_127_rule(Parser *p);
646static void *_tmp_128_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100647static void *_tmp_129_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700648static asdl_seq *_loop0_130_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100649static void *_tmp_131_rule(Parser *p);
650static void *_tmp_132_rule(Parser *p);
651static void *_tmp_133_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700652static void *_tmp_134_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100653static void *_tmp_135_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700654static void *_tmp_136_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100655static void *_tmp_137_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700656static void *_tmp_138_rule(Parser *p);
657static void *_tmp_139_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300658static void *_tmp_140_rule(Parser *p);
659static void *_tmp_141_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700660static void *_tmp_142_rule(Parser *p);
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +0300661static void *_tmp_143_rule(Parser *p);
662static void *_tmp_144_rule(Parser *p);
663static asdl_seq *_loop1_145_rule(Parser *p);
664static void *_tmp_146_rule(Parser *p);
665static void *_tmp_147_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100666
667
668// file: statements? $
669static mod_ty
670file_rule(Parser *p)
671{
672 if (p->error_indicator) {
673 return NULL;
674 }
675 mod_ty res = NULL;
676 int mark = p->mark;
677 { // statements? $
678 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100679 Token * endmarker_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100680 if (
681 (a = statements_rule(p), 1)
682 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +0100683 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100684 )
685 {
Guido van Rossumc001c092020-04-30 12:12:19 -0700686 res = _PyPegen_make_module ( p , a );
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100687 if (res == NULL && PyErr_Occurred()) {
688 p->error_indicator = 1;
689 return NULL;
690 }
691 goto done;
692 }
693 p->mark = mark;
694 }
695 res = NULL;
696 done:
697 return res;
698}
699
700// interactive: statement_newline
701static mod_ty
702interactive_rule(Parser *p)
703{
704 if (p->error_indicator) {
705 return NULL;
706 }
707 mod_ty res = NULL;
708 int mark = p->mark;
709 { // statement_newline
710 asdl_seq* a;
711 if (
712 (a = statement_newline_rule(p))
713 )
714 {
715 res = Interactive ( a , p -> arena );
716 if (res == NULL && PyErr_Occurred()) {
717 p->error_indicator = 1;
718 return NULL;
719 }
720 goto done;
721 }
722 p->mark = mark;
723 }
724 res = NULL;
725 done:
726 return res;
727}
728
729// eval: expressions NEWLINE* $
730static mod_ty
731eval_rule(Parser *p)
732{
733 if (p->error_indicator) {
734 return NULL;
735 }
736 mod_ty res = NULL;
737 int mark = p->mark;
738 { // expressions NEWLINE* $
739 asdl_seq * _loop0_1_var;
740 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100741 Token * endmarker_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100742 if (
743 (a = expressions_rule(p))
744 &&
745 (_loop0_1_var = _loop0_1_rule(p))
746 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +0100747 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100748 )
749 {
750 res = Expression ( a , p -> arena );
751 if (res == NULL && PyErr_Occurred()) {
752 p->error_indicator = 1;
753 return NULL;
754 }
755 goto done;
756 }
757 p->mark = mark;
758 }
759 res = NULL;
760 done:
761 return res;
762}
763
Guido van Rossumc001c092020-04-30 12:12:19 -0700764// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
765static mod_ty
766func_type_rule(Parser *p)
767{
768 if (p->error_indicator) {
769 return NULL;
770 }
771 mod_ty res = NULL;
772 int mark = p->mark;
773 { // '(' type_expressions? ')' '->' expression NEWLINE* $
774 asdl_seq * _loop0_2_var;
775 void *a;
776 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100777 Token * endmarker_var;
778 Token * literal;
779 Token * literal_1;
780 Token * literal_2;
Guido van Rossumc001c092020-04-30 12:12:19 -0700781 if (
782 (literal = _PyPegen_expect_token(p, 7))
783 &&
784 (a = type_expressions_rule(p), 1)
785 &&
786 (literal_1 = _PyPegen_expect_token(p, 8))
787 &&
788 (literal_2 = _PyPegen_expect_token(p, 51))
789 &&
790 (b = expression_rule(p))
791 &&
792 (_loop0_2_var = _loop0_2_rule(p))
793 &&
794 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
795 )
796 {
797 res = FunctionType ( a , b , p -> arena );
798 if (res == NULL && PyErr_Occurred()) {
799 p->error_indicator = 1;
800 return NULL;
801 }
802 goto done;
803 }
804 p->mark = mark;
805 }
806 res = NULL;
807 done:
808 return res;
809}
810
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100811// fstring: star_expressions
812static expr_ty
813fstring_rule(Parser *p)
814{
815 if (p->error_indicator) {
816 return NULL;
817 }
818 expr_ty res = NULL;
819 int mark = p->mark;
820 { // star_expressions
821 expr_ty star_expressions_var;
822 if (
823 (star_expressions_var = star_expressions_rule(p))
824 )
825 {
826 res = star_expressions_var;
827 goto done;
828 }
829 p->mark = mark;
830 }
831 res = NULL;
832 done:
833 return res;
834}
835
Guido van Rossumc001c092020-04-30 12:12:19 -0700836// type_expressions:
837// | ','.expression+ ',' '*' expression ',' '**' expression
838// | ','.expression+ ',' '*' expression
839// | ','.expression+ ',' '**' expression
Shantanu603d3542020-05-03 22:08:14 -0700840// | '*' expression ',' '**' expression
841// | '*' expression
842// | '**' expression
Guido van Rossumc001c092020-04-30 12:12:19 -0700843// | ','.expression+
844static asdl_seq*
845type_expressions_rule(Parser *p)
846{
847 if (p->error_indicator) {
848 return NULL;
849 }
850 asdl_seq* res = NULL;
851 int mark = p->mark;
852 { // ','.expression+ ',' '*' expression ',' '**' expression
853 asdl_seq * a;
854 expr_ty b;
855 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100856 Token * literal;
857 Token * literal_1;
858 Token * literal_2;
859 Token * literal_3;
Guido van Rossumc001c092020-04-30 12:12:19 -0700860 if (
861 (a = _gather_3_rule(p))
862 &&
863 (literal = _PyPegen_expect_token(p, 12))
864 &&
865 (literal_1 = _PyPegen_expect_token(p, 16))
866 &&
867 (b = expression_rule(p))
868 &&
869 (literal_2 = _PyPegen_expect_token(p, 12))
870 &&
871 (literal_3 = _PyPegen_expect_token(p, 35))
872 &&
873 (c = expression_rule(p))
874 )
875 {
876 res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
877 if (res == NULL && PyErr_Occurred()) {
878 p->error_indicator = 1;
879 return NULL;
880 }
881 goto done;
882 }
883 p->mark = mark;
884 }
885 { // ','.expression+ ',' '*' expression
886 asdl_seq * a;
887 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100888 Token * literal;
889 Token * literal_1;
Guido van Rossumc001c092020-04-30 12:12:19 -0700890 if (
891 (a = _gather_5_rule(p))
892 &&
893 (literal = _PyPegen_expect_token(p, 12))
894 &&
895 (literal_1 = _PyPegen_expect_token(p, 16))
896 &&
897 (b = expression_rule(p))
898 )
899 {
900 res = _PyPegen_seq_append_to_end ( p , a , b );
901 if (res == NULL && PyErr_Occurred()) {
902 p->error_indicator = 1;
903 return NULL;
904 }
905 goto done;
906 }
907 p->mark = mark;
908 }
909 { // ','.expression+ ',' '**' expression
910 asdl_seq * a;
911 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100912 Token * literal;
913 Token * literal_1;
Guido van Rossumc001c092020-04-30 12:12:19 -0700914 if (
915 (a = _gather_7_rule(p))
916 &&
917 (literal = _PyPegen_expect_token(p, 12))
918 &&
919 (literal_1 = _PyPegen_expect_token(p, 35))
920 &&
921 (b = expression_rule(p))
922 )
923 {
924 res = _PyPegen_seq_append_to_end ( p , a , b );
925 if (res == NULL && PyErr_Occurred()) {
926 p->error_indicator = 1;
927 return NULL;
928 }
929 goto done;
930 }
931 p->mark = mark;
932 }
Shantanu603d3542020-05-03 22:08:14 -0700933 { // '*' expression ',' '**' expression
934 expr_ty a;
935 expr_ty b;
936 Token * literal;
937 Token * literal_1;
938 Token * literal_2;
939 if (
940 (literal = _PyPegen_expect_token(p, 16))
941 &&
942 (a = expression_rule(p))
943 &&
944 (literal_1 = _PyPegen_expect_token(p, 12))
945 &&
946 (literal_2 = _PyPegen_expect_token(p, 35))
947 &&
948 (b = expression_rule(p))
949 )
950 {
951 res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b );
952 if (res == NULL && PyErr_Occurred()) {
953 p->error_indicator = 1;
954 return NULL;
955 }
956 goto done;
957 }
958 p->mark = mark;
959 }
960 { // '*' expression
961 expr_ty a;
962 Token * literal;
963 if (
964 (literal = _PyPegen_expect_token(p, 16))
965 &&
966 (a = expression_rule(p))
967 )
968 {
969 res = _PyPegen_singleton_seq ( p , a );
970 if (res == NULL && PyErr_Occurred()) {
971 p->error_indicator = 1;
972 return NULL;
973 }
974 goto done;
975 }
976 p->mark = mark;
977 }
978 { // '**' expression
979 expr_ty a;
980 Token * literal;
981 if (
982 (literal = _PyPegen_expect_token(p, 35))
983 &&
984 (a = expression_rule(p))
985 )
986 {
987 res = _PyPegen_singleton_seq ( p , a );
988 if (res == NULL && PyErr_Occurred()) {
989 p->error_indicator = 1;
990 return NULL;
991 }
992 goto done;
993 }
994 p->mark = mark;
995 }
Guido van Rossumc001c092020-04-30 12:12:19 -0700996 { // ','.expression+
997 asdl_seq * _gather_9_var;
998 if (
999 (_gather_9_var = _gather_9_rule(p))
1000 )
1001 {
1002 res = _gather_9_var;
1003 goto done;
1004 }
1005 p->mark = mark;
1006 }
1007 res = NULL;
1008 done:
1009 return res;
1010}
1011
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001012// statements: statement+
1013static asdl_seq*
1014statements_rule(Parser *p)
1015{
1016 if (p->error_indicator) {
1017 return NULL;
1018 }
1019 asdl_seq* res = NULL;
1020 int mark = p->mark;
1021 { // statement+
1022 asdl_seq * a;
1023 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001024 (a = _loop1_11_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001025 )
1026 {
1027 res = _PyPegen_seq_flatten ( 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 res = NULL;
1037 done:
1038 return res;
1039}
1040
1041// statement: compound_stmt | simple_stmt
1042static asdl_seq*
1043statement_rule(Parser *p)
1044{
1045 if (p->error_indicator) {
1046 return NULL;
1047 }
1048 asdl_seq* res = NULL;
1049 int mark = p->mark;
1050 { // compound_stmt
1051 stmt_ty a;
1052 if (
1053 (a = compound_stmt_rule(p))
1054 )
1055 {
1056 res = _PyPegen_singleton_seq ( p , a );
1057 if (res == NULL && PyErr_Occurred()) {
1058 p->error_indicator = 1;
1059 return NULL;
1060 }
1061 goto done;
1062 }
1063 p->mark = mark;
1064 }
1065 { // simple_stmt
1066 asdl_seq* simple_stmt_var;
1067 if (
1068 (simple_stmt_var = simple_stmt_rule(p))
1069 )
1070 {
1071 res = simple_stmt_var;
1072 goto done;
1073 }
1074 p->mark = mark;
1075 }
1076 res = NULL;
1077 done:
1078 return res;
1079}
1080
1081// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
1082static asdl_seq*
1083statement_newline_rule(Parser *p)
1084{
1085 if (p->error_indicator) {
1086 return NULL;
1087 }
1088 asdl_seq* res = NULL;
1089 int mark = p->mark;
1090 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1091 p->error_indicator = 1;
1092 return NULL;
1093 }
1094 int start_lineno = p->tokens[mark]->lineno;
1095 UNUSED(start_lineno); // Only used by EXTRA macro
1096 int start_col_offset = p->tokens[mark]->col_offset;
1097 UNUSED(start_col_offset); // Only used by EXTRA macro
1098 { // compound_stmt NEWLINE
1099 stmt_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001100 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001101 if (
1102 (a = compound_stmt_rule(p))
1103 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01001104 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001105 )
1106 {
1107 res = _PyPegen_singleton_seq ( p , a );
1108 if (res == NULL && PyErr_Occurred()) {
1109 p->error_indicator = 1;
1110 return NULL;
1111 }
1112 goto done;
1113 }
1114 p->mark = mark;
1115 }
1116 { // simple_stmt
1117 asdl_seq* simple_stmt_var;
1118 if (
1119 (simple_stmt_var = simple_stmt_rule(p))
1120 )
1121 {
1122 res = simple_stmt_var;
1123 goto done;
1124 }
1125 p->mark = mark;
1126 }
1127 { // NEWLINE
Pablo Galindob796b3f2020-05-01 12:32:26 +01001128 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001129 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01001130 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001131 )
1132 {
1133 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1134 if (token == NULL) {
1135 return NULL;
1136 }
1137 int end_lineno = token->end_lineno;
1138 UNUSED(end_lineno); // Only used by EXTRA macro
1139 int end_col_offset = token->end_col_offset;
1140 UNUSED(end_col_offset); // Only used by EXTRA macro
1141 res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
1142 if (res == NULL && PyErr_Occurred()) {
1143 p->error_indicator = 1;
1144 return NULL;
1145 }
1146 goto done;
1147 }
1148 p->mark = mark;
1149 }
1150 { // $
Pablo Galindob796b3f2020-05-01 12:32:26 +01001151 Token * endmarker_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001152 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01001153 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001154 )
1155 {
1156 res = _PyPegen_interactive_exit ( p );
1157 if (res == NULL && PyErr_Occurred()) {
1158 p->error_indicator = 1;
1159 return NULL;
1160 }
1161 goto done;
1162 }
1163 p->mark = mark;
1164 }
1165 res = NULL;
1166 done:
1167 return res;
1168}
1169
1170// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
1171static asdl_seq*
1172simple_stmt_rule(Parser *p)
1173{
1174 if (p->error_indicator) {
1175 return NULL;
1176 }
1177 asdl_seq* res = NULL;
1178 int mark = p->mark;
1179 { // small_stmt !';' NEWLINE
1180 stmt_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001181 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001182 if (
1183 (a = small_stmt_rule(p))
1184 &&
1185 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13)
1186 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01001187 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001188 )
1189 {
1190 res = _PyPegen_singleton_seq ( p , a );
1191 if (res == NULL && PyErr_Occurred()) {
1192 p->error_indicator = 1;
1193 return NULL;
1194 }
1195 goto done;
1196 }
1197 p->mark = mark;
1198 }
1199 { // ';'.small_stmt+ ';'? NEWLINE
1200 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001201 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001202 void *opt_var;
1203 UNUSED(opt_var); // Silence compiler warnings
1204 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001205 (a = _gather_12_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001206 &&
1207 (opt_var = _PyPegen_expect_token(p, 13), 1)
1208 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01001209 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001210 )
1211 {
1212 res = a;
1213 if (res == NULL && PyErr_Occurred()) {
1214 p->error_indicator = 1;
1215 return NULL;
1216 }
1217 goto done;
1218 }
1219 p->mark = mark;
1220 }
1221 res = NULL;
1222 done:
1223 return res;
1224}
1225
1226// small_stmt:
1227// | assignment
1228// | star_expressions
1229// | &'return' return_stmt
1230// | &('import' | 'from') import_stmt
1231// | &'raise' raise_stmt
1232// | 'pass'
1233// | &'del' del_stmt
1234// | &'yield' yield_stmt
1235// | &'assert' assert_stmt
1236// | 'break'
1237// | 'continue'
1238// | &'global' global_stmt
1239// | &'nonlocal' nonlocal_stmt
1240static stmt_ty
1241small_stmt_rule(Parser *p)
1242{
1243 if (p->error_indicator) {
1244 return NULL;
1245 }
1246 stmt_ty res = NULL;
1247 if (_PyPegen_is_memoized(p, small_stmt_type, &res))
1248 return res;
1249 int mark = p->mark;
1250 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1251 p->error_indicator = 1;
1252 return NULL;
1253 }
1254 int start_lineno = p->tokens[mark]->lineno;
1255 UNUSED(start_lineno); // Only used by EXTRA macro
1256 int start_col_offset = p->tokens[mark]->col_offset;
1257 UNUSED(start_col_offset); // Only used by EXTRA macro
1258 { // assignment
1259 void *assignment_var;
1260 if (
1261 (assignment_var = assignment_rule(p))
1262 )
1263 {
1264 res = assignment_var;
1265 goto done;
1266 }
1267 p->mark = mark;
1268 }
1269 { // star_expressions
1270 expr_ty e;
1271 if (
1272 (e = star_expressions_rule(p))
1273 )
1274 {
1275 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1276 if (token == NULL) {
1277 return NULL;
1278 }
1279 int end_lineno = token->end_lineno;
1280 UNUSED(end_lineno); // Only used by EXTRA macro
1281 int end_col_offset = token->end_col_offset;
1282 UNUSED(end_col_offset); // Only used by EXTRA macro
1283 res = _Py_Expr ( e , EXTRA );
1284 if (res == NULL && PyErr_Occurred()) {
1285 p->error_indicator = 1;
1286 return NULL;
1287 }
1288 goto done;
1289 }
1290 p->mark = mark;
1291 }
1292 { // &'return' return_stmt
1293 stmt_ty return_stmt_var;
1294 if (
1295 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500)
1296 &&
1297 (return_stmt_var = return_stmt_rule(p))
1298 )
1299 {
1300 res = return_stmt_var;
1301 goto done;
1302 }
1303 p->mark = mark;
1304 }
1305 { // &('import' | 'from') import_stmt
1306 stmt_ty import_stmt_var;
1307 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001308 _PyPegen_lookahead(1, _tmp_14_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001309 &&
1310 (import_stmt_var = import_stmt_rule(p))
1311 )
1312 {
1313 res = import_stmt_var;
1314 goto done;
1315 }
1316 p->mark = mark;
1317 }
1318 { // &'raise' raise_stmt
1319 stmt_ty raise_stmt_var;
1320 if (
1321 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501)
1322 &&
1323 (raise_stmt_var = raise_stmt_rule(p))
1324 )
1325 {
1326 res = raise_stmt_var;
1327 goto done;
1328 }
1329 p->mark = mark;
1330 }
1331 { // 'pass'
Pablo Galindob796b3f2020-05-01 12:32:26 +01001332 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001333 if (
1334 (keyword = _PyPegen_expect_token(p, 502))
1335 )
1336 {
1337 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1338 if (token == NULL) {
1339 return NULL;
1340 }
1341 int end_lineno = token->end_lineno;
1342 UNUSED(end_lineno); // Only used by EXTRA macro
1343 int end_col_offset = token->end_col_offset;
1344 UNUSED(end_col_offset); // Only used by EXTRA macro
1345 res = _Py_Pass ( EXTRA );
1346 if (res == NULL && PyErr_Occurred()) {
1347 p->error_indicator = 1;
1348 return NULL;
1349 }
1350 goto done;
1351 }
1352 p->mark = mark;
1353 }
1354 { // &'del' del_stmt
1355 stmt_ty del_stmt_var;
1356 if (
1357 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503)
1358 &&
1359 (del_stmt_var = del_stmt_rule(p))
1360 )
1361 {
1362 res = del_stmt_var;
1363 goto done;
1364 }
1365 p->mark = mark;
1366 }
1367 { // &'yield' yield_stmt
1368 stmt_ty yield_stmt_var;
1369 if (
1370 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504)
1371 &&
1372 (yield_stmt_var = yield_stmt_rule(p))
1373 )
1374 {
1375 res = yield_stmt_var;
1376 goto done;
1377 }
1378 p->mark = mark;
1379 }
1380 { // &'assert' assert_stmt
1381 stmt_ty assert_stmt_var;
1382 if (
1383 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505)
1384 &&
1385 (assert_stmt_var = assert_stmt_rule(p))
1386 )
1387 {
1388 res = assert_stmt_var;
1389 goto done;
1390 }
1391 p->mark = mark;
1392 }
1393 { // 'break'
Pablo Galindob796b3f2020-05-01 12:32:26 +01001394 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001395 if (
1396 (keyword = _PyPegen_expect_token(p, 506))
1397 )
1398 {
1399 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1400 if (token == NULL) {
1401 return NULL;
1402 }
1403 int end_lineno = token->end_lineno;
1404 UNUSED(end_lineno); // Only used by EXTRA macro
1405 int end_col_offset = token->end_col_offset;
1406 UNUSED(end_col_offset); // Only used by EXTRA macro
1407 res = _Py_Break ( EXTRA );
1408 if (res == NULL && PyErr_Occurred()) {
1409 p->error_indicator = 1;
1410 return NULL;
1411 }
1412 goto done;
1413 }
1414 p->mark = mark;
1415 }
1416 { // 'continue'
Pablo Galindob796b3f2020-05-01 12:32:26 +01001417 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001418 if (
1419 (keyword = _PyPegen_expect_token(p, 507))
1420 )
1421 {
1422 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1423 if (token == NULL) {
1424 return NULL;
1425 }
1426 int end_lineno = token->end_lineno;
1427 UNUSED(end_lineno); // Only used by EXTRA macro
1428 int end_col_offset = token->end_col_offset;
1429 UNUSED(end_col_offset); // Only used by EXTRA macro
1430 res = _Py_Continue ( EXTRA );
1431 if (res == NULL && PyErr_Occurred()) {
1432 p->error_indicator = 1;
1433 return NULL;
1434 }
1435 goto done;
1436 }
1437 p->mark = mark;
1438 }
1439 { // &'global' global_stmt
1440 stmt_ty global_stmt_var;
1441 if (
1442 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508)
1443 &&
1444 (global_stmt_var = global_stmt_rule(p))
1445 )
1446 {
1447 res = global_stmt_var;
1448 goto done;
1449 }
1450 p->mark = mark;
1451 }
1452 { // &'nonlocal' nonlocal_stmt
1453 stmt_ty nonlocal_stmt_var;
1454 if (
1455 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509)
1456 &&
1457 (nonlocal_stmt_var = nonlocal_stmt_rule(p))
1458 )
1459 {
1460 res = nonlocal_stmt_var;
1461 goto done;
1462 }
1463 p->mark = mark;
1464 }
1465 res = NULL;
1466 done:
1467 _PyPegen_insert_memo(p, mark, small_stmt_type, res);
1468 return res;
1469}
1470
1471// compound_stmt:
1472// | &('def' | '@' | ASYNC) function_def
1473// | &'if' if_stmt
1474// | &('class' | '@') class_def
1475// | &('with' | ASYNC) with_stmt
1476// | &('for' | ASYNC) for_stmt
1477// | &'try' try_stmt
1478// | &'while' while_stmt
1479static stmt_ty
1480compound_stmt_rule(Parser *p)
1481{
1482 if (p->error_indicator) {
1483 return NULL;
1484 }
1485 stmt_ty res = NULL;
1486 int mark = p->mark;
1487 { // &('def' | '@' | ASYNC) function_def
1488 stmt_ty function_def_var;
1489 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001490 _PyPegen_lookahead(1, _tmp_15_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001491 &&
1492 (function_def_var = function_def_rule(p))
1493 )
1494 {
1495 res = function_def_var;
1496 goto done;
1497 }
1498 p->mark = mark;
1499 }
1500 { // &'if' if_stmt
1501 stmt_ty if_stmt_var;
1502 if (
1503 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510)
1504 &&
1505 (if_stmt_var = if_stmt_rule(p))
1506 )
1507 {
1508 res = if_stmt_var;
1509 goto done;
1510 }
1511 p->mark = mark;
1512 }
1513 { // &('class' | '@') class_def
1514 stmt_ty class_def_var;
1515 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001516 _PyPegen_lookahead(1, _tmp_16_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001517 &&
1518 (class_def_var = class_def_rule(p))
1519 )
1520 {
1521 res = class_def_var;
1522 goto done;
1523 }
1524 p->mark = mark;
1525 }
1526 { // &('with' | ASYNC) with_stmt
1527 stmt_ty with_stmt_var;
1528 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001529 _PyPegen_lookahead(1, _tmp_17_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001530 &&
1531 (with_stmt_var = with_stmt_rule(p))
1532 )
1533 {
1534 res = with_stmt_var;
1535 goto done;
1536 }
1537 p->mark = mark;
1538 }
1539 { // &('for' | ASYNC) for_stmt
1540 stmt_ty for_stmt_var;
1541 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001542 _PyPegen_lookahead(1, _tmp_18_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001543 &&
1544 (for_stmt_var = for_stmt_rule(p))
1545 )
1546 {
1547 res = for_stmt_var;
1548 goto done;
1549 }
1550 p->mark = mark;
1551 }
1552 { // &'try' try_stmt
1553 stmt_ty try_stmt_var;
1554 if (
1555 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511)
1556 &&
1557 (try_stmt_var = try_stmt_rule(p))
1558 )
1559 {
1560 res = try_stmt_var;
1561 goto done;
1562 }
1563 p->mark = mark;
1564 }
1565 { // &'while' while_stmt
1566 stmt_ty while_stmt_var;
1567 if (
1568 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512)
1569 &&
1570 (while_stmt_var = while_stmt_rule(p))
1571 )
1572 {
1573 res = while_stmt_var;
1574 goto done;
1575 }
1576 p->mark = mark;
1577 }
1578 res = NULL;
1579 done:
1580 return res;
1581}
1582
1583// assignment:
1584// | NAME ':' expression ['=' annotated_rhs]
1585// | ('(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target) ':' expression ['=' annotated_rhs]
Guido van Rossumc001c092020-04-30 12:12:19 -07001586// | ((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001587// | target augassign (yield_expr | star_expressions)
1588// | invalid_assignment
1589static void *
1590assignment_rule(Parser *p)
1591{
1592 if (p->error_indicator) {
1593 return NULL;
1594 }
1595 void * res = NULL;
1596 int mark = p->mark;
1597 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1598 p->error_indicator = 1;
1599 return NULL;
1600 }
1601 int start_lineno = p->tokens[mark]->lineno;
1602 UNUSED(start_lineno); // Only used by EXTRA macro
1603 int start_col_offset = p->tokens[mark]->col_offset;
1604 UNUSED(start_col_offset); // Only used by EXTRA macro
1605 { // NAME ':' expression ['=' annotated_rhs]
1606 expr_ty a;
1607 expr_ty b;
1608 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001609 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001610 if (
1611 (a = _PyPegen_name_token(p))
1612 &&
1613 (literal = _PyPegen_expect_token(p, 11))
1614 &&
1615 (b = expression_rule(p))
1616 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001617 (c = _tmp_19_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001618 )
1619 {
1620 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1621 if (token == NULL) {
1622 return NULL;
1623 }
1624 int end_lineno = token->end_lineno;
1625 UNUSED(end_lineno); // Only used by EXTRA macro
1626 int end_col_offset = token->end_col_offset;
1627 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03001628 res = CHECK_VERSION ( 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001629 if (res == NULL && PyErr_Occurred()) {
1630 p->error_indicator = 1;
1631 return NULL;
1632 }
1633 goto done;
1634 }
1635 p->mark = mark;
1636 }
1637 { // ('(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target) ':' expression ['=' annotated_rhs]
1638 void *a;
1639 expr_ty b;
1640 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001641 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001642 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001643 (a = _tmp_20_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001644 &&
1645 (literal = _PyPegen_expect_token(p, 11))
1646 &&
1647 (b = expression_rule(p))
1648 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001649 (c = _tmp_21_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001650 )
1651 {
1652 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1653 if (token == NULL) {
1654 return NULL;
1655 }
1656 int end_lineno = token->end_lineno;
1657 UNUSED(end_lineno); // Only used by EXTRA macro
1658 int end_col_offset = token->end_col_offset;
1659 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03001660 res = CHECK_VERSION ( 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001661 if (res == NULL && PyErr_Occurred()) {
1662 p->error_indicator = 1;
1663 return NULL;
1664 }
1665 goto done;
1666 }
1667 p->mark = mark;
1668 }
Guido van Rossumc001c092020-04-30 12:12:19 -07001669 { // ((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001670 asdl_seq * a;
1671 void *b;
Guido van Rossumc001c092020-04-30 12:12:19 -07001672 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001673 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001674 (a = _loop1_22_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001675 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001676 (b = _tmp_23_rule(p))
1677 &&
1678 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001679 )
1680 {
1681 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1682 if (token == NULL) {
1683 return NULL;
1684 }
1685 int end_lineno = token->end_lineno;
1686 UNUSED(end_lineno); // Only used by EXTRA macro
1687 int end_col_offset = token->end_col_offset;
1688 UNUSED(end_col_offset); // Only used by EXTRA macro
Guido van Rossumc001c092020-04-30 12:12:19 -07001689 res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001690 if (res == NULL && PyErr_Occurred()) {
1691 p->error_indicator = 1;
1692 return NULL;
1693 }
1694 goto done;
1695 }
1696 p->mark = mark;
1697 }
1698 { // target augassign (yield_expr | star_expressions)
1699 expr_ty a;
1700 AugOperator* b;
1701 void *c;
1702 if (
1703 (a = target_rule(p))
1704 &&
1705 (b = augassign_rule(p))
1706 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001707 (c = _tmp_24_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001708 )
1709 {
1710 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1711 if (token == NULL) {
1712 return NULL;
1713 }
1714 int end_lineno = token->end_lineno;
1715 UNUSED(end_lineno); // Only used by EXTRA macro
1716 int end_col_offset = token->end_col_offset;
1717 UNUSED(end_col_offset); // Only used by EXTRA macro
1718 res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
1719 if (res == NULL && PyErr_Occurred()) {
1720 p->error_indicator = 1;
1721 return NULL;
1722 }
1723 goto done;
1724 }
1725 p->mark = mark;
1726 }
1727 { // invalid_assignment
1728 void *invalid_assignment_var;
1729 if (
1730 (invalid_assignment_var = invalid_assignment_rule(p))
1731 )
1732 {
1733 res = invalid_assignment_var;
1734 goto done;
1735 }
1736 p->mark = mark;
1737 }
1738 res = NULL;
1739 done:
1740 return res;
1741}
1742
1743// augassign:
1744// | '+='
1745// | '-='
1746// | '*='
1747// | '@='
1748// | '/='
1749// | '%='
1750// | '&='
1751// | '|='
1752// | '^='
1753// | '<<='
1754// | '>>='
1755// | '**='
1756// | '//='
1757static AugOperator*
1758augassign_rule(Parser *p)
1759{
1760 if (p->error_indicator) {
1761 return NULL;
1762 }
1763 AugOperator* res = NULL;
1764 int mark = p->mark;
1765 { // '+='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001766 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001767 if (
1768 (literal = _PyPegen_expect_token(p, 36))
1769 )
1770 {
1771 res = _PyPegen_augoperator ( p , Add );
1772 if (res == NULL && PyErr_Occurred()) {
1773 p->error_indicator = 1;
1774 return NULL;
1775 }
1776 goto done;
1777 }
1778 p->mark = mark;
1779 }
1780 { // '-='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001781 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001782 if (
1783 (literal = _PyPegen_expect_token(p, 37))
1784 )
1785 {
1786 res = _PyPegen_augoperator ( p , Sub );
1787 if (res == NULL && PyErr_Occurred()) {
1788 p->error_indicator = 1;
1789 return NULL;
1790 }
1791 goto done;
1792 }
1793 p->mark = mark;
1794 }
1795 { // '*='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001796 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001797 if (
1798 (literal = _PyPegen_expect_token(p, 38))
1799 )
1800 {
1801 res = _PyPegen_augoperator ( p , Mult );
1802 if (res == NULL && PyErr_Occurred()) {
1803 p->error_indicator = 1;
1804 return NULL;
1805 }
1806 goto done;
1807 }
1808 p->mark = mark;
1809 }
1810 { // '@='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001811 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001812 if (
1813 (literal = _PyPegen_expect_token(p, 50))
1814 )
1815 {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03001816 res = CHECK_VERSION ( 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001817 if (res == NULL && PyErr_Occurred()) {
1818 p->error_indicator = 1;
1819 return NULL;
1820 }
1821 goto done;
1822 }
1823 p->mark = mark;
1824 }
1825 { // '/='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001826 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001827 if (
1828 (literal = _PyPegen_expect_token(p, 39))
1829 )
1830 {
1831 res = _PyPegen_augoperator ( p , Div );
1832 if (res == NULL && PyErr_Occurred()) {
1833 p->error_indicator = 1;
1834 return NULL;
1835 }
1836 goto done;
1837 }
1838 p->mark = mark;
1839 }
1840 { // '%='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001841 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001842 if (
1843 (literal = _PyPegen_expect_token(p, 40))
1844 )
1845 {
1846 res = _PyPegen_augoperator ( p , Mod );
1847 if (res == NULL && PyErr_Occurred()) {
1848 p->error_indicator = 1;
1849 return NULL;
1850 }
1851 goto done;
1852 }
1853 p->mark = mark;
1854 }
1855 { // '&='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001856 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001857 if (
1858 (literal = _PyPegen_expect_token(p, 41))
1859 )
1860 {
1861 res = _PyPegen_augoperator ( p , BitAnd );
1862 if (res == NULL && PyErr_Occurred()) {
1863 p->error_indicator = 1;
1864 return NULL;
1865 }
1866 goto done;
1867 }
1868 p->mark = mark;
1869 }
1870 { // '|='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001871 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001872 if (
1873 (literal = _PyPegen_expect_token(p, 42))
1874 )
1875 {
1876 res = _PyPegen_augoperator ( p , BitOr );
1877 if (res == NULL && PyErr_Occurred()) {
1878 p->error_indicator = 1;
1879 return NULL;
1880 }
1881 goto done;
1882 }
1883 p->mark = mark;
1884 }
1885 { // '^='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001886 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001887 if (
1888 (literal = _PyPegen_expect_token(p, 43))
1889 )
1890 {
1891 res = _PyPegen_augoperator ( p , BitXor );
1892 if (res == NULL && PyErr_Occurred()) {
1893 p->error_indicator = 1;
1894 return NULL;
1895 }
1896 goto done;
1897 }
1898 p->mark = mark;
1899 }
1900 { // '<<='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001901 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001902 if (
1903 (literal = _PyPegen_expect_token(p, 44))
1904 )
1905 {
1906 res = _PyPegen_augoperator ( p , LShift );
1907 if (res == NULL && PyErr_Occurred()) {
1908 p->error_indicator = 1;
1909 return NULL;
1910 }
1911 goto done;
1912 }
1913 p->mark = mark;
1914 }
1915 { // '>>='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001916 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001917 if (
1918 (literal = _PyPegen_expect_token(p, 45))
1919 )
1920 {
1921 res = _PyPegen_augoperator ( p , RShift );
1922 if (res == NULL && PyErr_Occurred()) {
1923 p->error_indicator = 1;
1924 return NULL;
1925 }
1926 goto done;
1927 }
1928 p->mark = mark;
1929 }
1930 { // '**='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001931 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001932 if (
1933 (literal = _PyPegen_expect_token(p, 46))
1934 )
1935 {
1936 res = _PyPegen_augoperator ( p , Pow );
1937 if (res == NULL && PyErr_Occurred()) {
1938 p->error_indicator = 1;
1939 return NULL;
1940 }
1941 goto done;
1942 }
1943 p->mark = mark;
1944 }
1945 { // '//='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001946 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001947 if (
1948 (literal = _PyPegen_expect_token(p, 48))
1949 )
1950 {
1951 res = _PyPegen_augoperator ( p , FloorDiv );
1952 if (res == NULL && PyErr_Occurred()) {
1953 p->error_indicator = 1;
1954 return NULL;
1955 }
1956 goto done;
1957 }
1958 p->mark = mark;
1959 }
1960 res = NULL;
1961 done:
1962 return res;
1963}
1964
1965// global_stmt: 'global' ','.NAME+
1966static stmt_ty
1967global_stmt_rule(Parser *p)
1968{
1969 if (p->error_indicator) {
1970 return NULL;
1971 }
1972 stmt_ty res = NULL;
1973 int mark = p->mark;
1974 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1975 p->error_indicator = 1;
1976 return NULL;
1977 }
1978 int start_lineno = p->tokens[mark]->lineno;
1979 UNUSED(start_lineno); // Only used by EXTRA macro
1980 int start_col_offset = p->tokens[mark]->col_offset;
1981 UNUSED(start_col_offset); // Only used by EXTRA macro
1982 { // 'global' ','.NAME+
1983 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001984 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001985 if (
1986 (keyword = _PyPegen_expect_token(p, 508))
1987 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001988 (a = _gather_25_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001989 )
1990 {
1991 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1992 if (token == NULL) {
1993 return NULL;
1994 }
1995 int end_lineno = token->end_lineno;
1996 UNUSED(end_lineno); // Only used by EXTRA macro
1997 int end_col_offset = token->end_col_offset;
1998 UNUSED(end_col_offset); // Only used by EXTRA macro
1999 res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2000 if (res == NULL && PyErr_Occurred()) {
2001 p->error_indicator = 1;
2002 return NULL;
2003 }
2004 goto done;
2005 }
2006 p->mark = mark;
2007 }
2008 res = NULL;
2009 done:
2010 return res;
2011}
2012
2013// nonlocal_stmt: 'nonlocal' ','.NAME+
2014static stmt_ty
2015nonlocal_stmt_rule(Parser *p)
2016{
2017 if (p->error_indicator) {
2018 return NULL;
2019 }
2020 stmt_ty res = NULL;
2021 int mark = p->mark;
2022 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2023 p->error_indicator = 1;
2024 return NULL;
2025 }
2026 int start_lineno = p->tokens[mark]->lineno;
2027 UNUSED(start_lineno); // Only used by EXTRA macro
2028 int start_col_offset = p->tokens[mark]->col_offset;
2029 UNUSED(start_col_offset); // Only used by EXTRA macro
2030 { // 'nonlocal' ','.NAME+
2031 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002032 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002033 if (
2034 (keyword = _PyPegen_expect_token(p, 509))
2035 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002036 (a = _gather_27_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002037 )
2038 {
2039 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2040 if (token == NULL) {
2041 return NULL;
2042 }
2043 int end_lineno = token->end_lineno;
2044 UNUSED(end_lineno); // Only used by EXTRA macro
2045 int end_col_offset = token->end_col_offset;
2046 UNUSED(end_col_offset); // Only used by EXTRA macro
2047 res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2048 if (res == NULL && PyErr_Occurred()) {
2049 p->error_indicator = 1;
2050 return NULL;
2051 }
2052 goto done;
2053 }
2054 p->mark = mark;
2055 }
2056 res = NULL;
2057 done:
2058 return res;
2059}
2060
2061// yield_stmt: yield_expr
2062static stmt_ty
2063yield_stmt_rule(Parser *p)
2064{
2065 if (p->error_indicator) {
2066 return NULL;
2067 }
2068 stmt_ty res = NULL;
2069 int mark = p->mark;
2070 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2071 p->error_indicator = 1;
2072 return NULL;
2073 }
2074 int start_lineno = p->tokens[mark]->lineno;
2075 UNUSED(start_lineno); // Only used by EXTRA macro
2076 int start_col_offset = p->tokens[mark]->col_offset;
2077 UNUSED(start_col_offset); // Only used by EXTRA macro
2078 { // yield_expr
2079 expr_ty y;
2080 if (
2081 (y = yield_expr_rule(p))
2082 )
2083 {
2084 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2085 if (token == NULL) {
2086 return NULL;
2087 }
2088 int end_lineno = token->end_lineno;
2089 UNUSED(end_lineno); // Only used by EXTRA macro
2090 int end_col_offset = token->end_col_offset;
2091 UNUSED(end_col_offset); // Only used by EXTRA macro
2092 res = _Py_Expr ( y , EXTRA );
2093 if (res == NULL && PyErr_Occurred()) {
2094 p->error_indicator = 1;
2095 return NULL;
2096 }
2097 goto done;
2098 }
2099 p->mark = mark;
2100 }
2101 res = NULL;
2102 done:
2103 return res;
2104}
2105
2106// assert_stmt: 'assert' expression [',' expression]
2107static stmt_ty
2108assert_stmt_rule(Parser *p)
2109{
2110 if (p->error_indicator) {
2111 return NULL;
2112 }
2113 stmt_ty res = NULL;
2114 int mark = p->mark;
2115 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2116 p->error_indicator = 1;
2117 return NULL;
2118 }
2119 int start_lineno = p->tokens[mark]->lineno;
2120 UNUSED(start_lineno); // Only used by EXTRA macro
2121 int start_col_offset = p->tokens[mark]->col_offset;
2122 UNUSED(start_col_offset); // Only used by EXTRA macro
2123 { // 'assert' expression [',' expression]
2124 expr_ty a;
2125 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002126 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002127 if (
2128 (keyword = _PyPegen_expect_token(p, 505))
2129 &&
2130 (a = expression_rule(p))
2131 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002132 (b = _tmp_29_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002133 )
2134 {
2135 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2136 if (token == NULL) {
2137 return NULL;
2138 }
2139 int end_lineno = token->end_lineno;
2140 UNUSED(end_lineno); // Only used by EXTRA macro
2141 int end_col_offset = token->end_col_offset;
2142 UNUSED(end_col_offset); // Only used by EXTRA macro
2143 res = _Py_Assert ( a , b , EXTRA );
2144 if (res == NULL && PyErr_Occurred()) {
2145 p->error_indicator = 1;
2146 return NULL;
2147 }
2148 goto done;
2149 }
2150 p->mark = mark;
2151 }
2152 res = NULL;
2153 done:
2154 return res;
2155}
2156
2157// del_stmt: 'del' del_targets
2158static stmt_ty
2159del_stmt_rule(Parser *p)
2160{
2161 if (p->error_indicator) {
2162 return NULL;
2163 }
2164 stmt_ty res = NULL;
2165 int mark = p->mark;
2166 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2167 p->error_indicator = 1;
2168 return NULL;
2169 }
2170 int start_lineno = p->tokens[mark]->lineno;
2171 UNUSED(start_lineno); // Only used by EXTRA macro
2172 int start_col_offset = p->tokens[mark]->col_offset;
2173 UNUSED(start_col_offset); // Only used by EXTRA macro
2174 { // 'del' del_targets
2175 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002176 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002177 if (
2178 (keyword = _PyPegen_expect_token(p, 503))
2179 &&
2180 (a = del_targets_rule(p))
2181 )
2182 {
2183 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2184 if (token == NULL) {
2185 return NULL;
2186 }
2187 int end_lineno = token->end_lineno;
2188 UNUSED(end_lineno); // Only used by EXTRA macro
2189 int end_col_offset = token->end_col_offset;
2190 UNUSED(end_col_offset); // Only used by EXTRA macro
2191 res = _Py_Delete ( a , EXTRA );
2192 if (res == NULL && PyErr_Occurred()) {
2193 p->error_indicator = 1;
2194 return NULL;
2195 }
2196 goto done;
2197 }
2198 p->mark = mark;
2199 }
2200 res = NULL;
2201 done:
2202 return res;
2203}
2204
2205// import_stmt: import_name | import_from
2206static stmt_ty
2207import_stmt_rule(Parser *p)
2208{
2209 if (p->error_indicator) {
2210 return NULL;
2211 }
2212 stmt_ty res = NULL;
2213 int mark = p->mark;
2214 { // import_name
2215 stmt_ty import_name_var;
2216 if (
2217 (import_name_var = import_name_rule(p))
2218 )
2219 {
2220 res = import_name_var;
2221 goto done;
2222 }
2223 p->mark = mark;
2224 }
2225 { // import_from
2226 stmt_ty import_from_var;
2227 if (
2228 (import_from_var = import_from_rule(p))
2229 )
2230 {
2231 res = import_from_var;
2232 goto done;
2233 }
2234 p->mark = mark;
2235 }
2236 res = NULL;
2237 done:
2238 return res;
2239}
2240
2241// import_name: 'import' dotted_as_names
2242static stmt_ty
2243import_name_rule(Parser *p)
2244{
2245 if (p->error_indicator) {
2246 return NULL;
2247 }
2248 stmt_ty res = NULL;
2249 int mark = p->mark;
2250 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2251 p->error_indicator = 1;
2252 return NULL;
2253 }
2254 int start_lineno = p->tokens[mark]->lineno;
2255 UNUSED(start_lineno); // Only used by EXTRA macro
2256 int start_col_offset = p->tokens[mark]->col_offset;
2257 UNUSED(start_col_offset); // Only used by EXTRA macro
2258 { // 'import' dotted_as_names
2259 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002260 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002261 if (
2262 (keyword = _PyPegen_expect_token(p, 513))
2263 &&
2264 (a = dotted_as_names_rule(p))
2265 )
2266 {
2267 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2268 if (token == NULL) {
2269 return NULL;
2270 }
2271 int end_lineno = token->end_lineno;
2272 UNUSED(end_lineno); // Only used by EXTRA macro
2273 int end_col_offset = token->end_col_offset;
2274 UNUSED(end_col_offset); // Only used by EXTRA macro
2275 res = _Py_Import ( a , EXTRA );
2276 if (res == NULL && PyErr_Occurred()) {
2277 p->error_indicator = 1;
2278 return NULL;
2279 }
2280 goto done;
2281 }
2282 p->mark = mark;
2283 }
2284 res = NULL;
2285 done:
2286 return res;
2287}
2288
2289// import_from:
2290// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
2291// | 'from' (('.' | '...'))+ 'import' import_from_targets
2292static stmt_ty
2293import_from_rule(Parser *p)
2294{
2295 if (p->error_indicator) {
2296 return NULL;
2297 }
2298 stmt_ty res = NULL;
2299 int mark = p->mark;
2300 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2301 p->error_indicator = 1;
2302 return NULL;
2303 }
2304 int start_lineno = p->tokens[mark]->lineno;
2305 UNUSED(start_lineno); // Only used by EXTRA macro
2306 int start_col_offset = p->tokens[mark]->col_offset;
2307 UNUSED(start_col_offset); // Only used by EXTRA macro
2308 { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
2309 asdl_seq * a;
2310 expr_ty b;
2311 asdl_seq* c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002312 Token * keyword;
2313 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002314 if (
2315 (keyword = _PyPegen_expect_token(p, 514))
2316 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002317 (a = _loop0_30_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002318 &&
2319 (b = dotted_name_rule(p))
2320 &&
2321 (keyword_1 = _PyPegen_expect_token(p, 513))
2322 &&
2323 (c = import_from_targets_rule(p))
2324 )
2325 {
2326 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2327 if (token == NULL) {
2328 return NULL;
2329 }
2330 int end_lineno = token->end_lineno;
2331 UNUSED(end_lineno); // Only used by EXTRA macro
2332 int end_col_offset = token->end_col_offset;
2333 UNUSED(end_col_offset); // Only used by EXTRA macro
2334 res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
2335 if (res == NULL && PyErr_Occurred()) {
2336 p->error_indicator = 1;
2337 return NULL;
2338 }
2339 goto done;
2340 }
2341 p->mark = mark;
2342 }
2343 { // 'from' (('.' | '...'))+ 'import' import_from_targets
2344 asdl_seq * a;
2345 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002346 Token * keyword;
2347 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002348 if (
2349 (keyword = _PyPegen_expect_token(p, 514))
2350 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002351 (a = _loop1_31_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002352 &&
2353 (keyword_1 = _PyPegen_expect_token(p, 513))
2354 &&
2355 (b = import_from_targets_rule(p))
2356 )
2357 {
2358 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2359 if (token == NULL) {
2360 return NULL;
2361 }
2362 int end_lineno = token->end_lineno;
2363 UNUSED(end_lineno); // Only used by EXTRA macro
2364 int end_col_offset = token->end_col_offset;
2365 UNUSED(end_col_offset); // Only used by EXTRA macro
2366 res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
2367 if (res == NULL && PyErr_Occurred()) {
2368 p->error_indicator = 1;
2369 return NULL;
2370 }
2371 goto done;
2372 }
2373 p->mark = mark;
2374 }
2375 res = NULL;
2376 done:
2377 return res;
2378}
2379
2380// import_from_targets: '(' import_from_as_names ','? ')' | import_from_as_names | '*'
2381static asdl_seq*
2382import_from_targets_rule(Parser *p)
2383{
2384 if (p->error_indicator) {
2385 return NULL;
2386 }
2387 asdl_seq* res = NULL;
2388 int mark = p->mark;
2389 { // '(' import_from_as_names ','? ')'
2390 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002391 Token * literal;
2392 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002393 void *opt_var;
2394 UNUSED(opt_var); // Silence compiler warnings
2395 if (
2396 (literal = _PyPegen_expect_token(p, 7))
2397 &&
2398 (a = import_from_as_names_rule(p))
2399 &&
2400 (opt_var = _PyPegen_expect_token(p, 12), 1)
2401 &&
2402 (literal_1 = _PyPegen_expect_token(p, 8))
2403 )
2404 {
2405 res = a;
2406 if (res == NULL && PyErr_Occurred()) {
2407 p->error_indicator = 1;
2408 return NULL;
2409 }
2410 goto done;
2411 }
2412 p->mark = mark;
2413 }
2414 { // import_from_as_names
2415 asdl_seq* import_from_as_names_var;
2416 if (
2417 (import_from_as_names_var = import_from_as_names_rule(p))
2418 )
2419 {
2420 res = import_from_as_names_var;
2421 goto done;
2422 }
2423 p->mark = mark;
2424 }
2425 { // '*'
Pablo Galindob796b3f2020-05-01 12:32:26 +01002426 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002427 if (
2428 (literal = _PyPegen_expect_token(p, 16))
2429 )
2430 {
2431 res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
2432 if (res == NULL && PyErr_Occurred()) {
2433 p->error_indicator = 1;
2434 return NULL;
2435 }
2436 goto done;
2437 }
2438 p->mark = mark;
2439 }
2440 res = NULL;
2441 done:
2442 return res;
2443}
2444
2445// import_from_as_names: ','.import_from_as_name+
2446static asdl_seq*
2447import_from_as_names_rule(Parser *p)
2448{
2449 if (p->error_indicator) {
2450 return NULL;
2451 }
2452 asdl_seq* res = NULL;
2453 int mark = p->mark;
2454 { // ','.import_from_as_name+
2455 asdl_seq * a;
2456 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07002457 (a = _gather_32_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002458 )
2459 {
2460 res = a;
2461 if (res == NULL && PyErr_Occurred()) {
2462 p->error_indicator = 1;
2463 return NULL;
2464 }
2465 goto done;
2466 }
2467 p->mark = mark;
2468 }
2469 res = NULL;
2470 done:
2471 return res;
2472}
2473
2474// import_from_as_name: NAME ['as' NAME]
2475static alias_ty
2476import_from_as_name_rule(Parser *p)
2477{
2478 if (p->error_indicator) {
2479 return NULL;
2480 }
2481 alias_ty res = NULL;
2482 int mark = p->mark;
2483 { // NAME ['as' NAME]
2484 expr_ty a;
2485 void *b;
2486 if (
2487 (a = _PyPegen_name_token(p))
2488 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002489 (b = _tmp_34_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002490 )
2491 {
2492 res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
2493 if (res == NULL && PyErr_Occurred()) {
2494 p->error_indicator = 1;
2495 return NULL;
2496 }
2497 goto done;
2498 }
2499 p->mark = mark;
2500 }
2501 res = NULL;
2502 done:
2503 return res;
2504}
2505
2506// dotted_as_names: ','.dotted_as_name+
2507static asdl_seq*
2508dotted_as_names_rule(Parser *p)
2509{
2510 if (p->error_indicator) {
2511 return NULL;
2512 }
2513 asdl_seq* res = NULL;
2514 int mark = p->mark;
2515 { // ','.dotted_as_name+
2516 asdl_seq * a;
2517 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07002518 (a = _gather_35_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002519 )
2520 {
2521 res = a;
2522 if (res == NULL && PyErr_Occurred()) {
2523 p->error_indicator = 1;
2524 return NULL;
2525 }
2526 goto done;
2527 }
2528 p->mark = mark;
2529 }
2530 res = NULL;
2531 done:
2532 return res;
2533}
2534
2535// dotted_as_name: dotted_name ['as' NAME]
2536static alias_ty
2537dotted_as_name_rule(Parser *p)
2538{
2539 if (p->error_indicator) {
2540 return NULL;
2541 }
2542 alias_ty res = NULL;
2543 int mark = p->mark;
2544 { // dotted_name ['as' NAME]
2545 expr_ty a;
2546 void *b;
2547 if (
2548 (a = dotted_name_rule(p))
2549 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002550 (b = _tmp_37_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002551 )
2552 {
2553 res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
2554 if (res == NULL && PyErr_Occurred()) {
2555 p->error_indicator = 1;
2556 return NULL;
2557 }
2558 goto done;
2559 }
2560 p->mark = mark;
2561 }
2562 res = NULL;
2563 done:
2564 return res;
2565}
2566
2567// Left-recursive
2568// dotted_name: dotted_name '.' NAME | NAME
2569static expr_ty dotted_name_raw(Parser *);
2570static expr_ty
2571dotted_name_rule(Parser *p)
2572{
2573 expr_ty res = NULL;
2574 if (_PyPegen_is_memoized(p, dotted_name_type, &res))
2575 return res;
2576 int mark = p->mark;
2577 int resmark = p->mark;
2578 while (1) {
2579 int tmpvar_0 = _PyPegen_update_memo(p, mark, dotted_name_type, res);
2580 if (tmpvar_0) {
2581 return res;
2582 }
2583 p->mark = mark;
2584 void *raw = dotted_name_raw(p);
2585 if (raw == NULL || p->mark <= resmark)
2586 break;
2587 resmark = p->mark;
2588 res = raw;
2589 }
2590 p->mark = resmark;
2591 return res;
2592}
2593static expr_ty
2594dotted_name_raw(Parser *p)
2595{
2596 if (p->error_indicator) {
2597 return NULL;
2598 }
2599 expr_ty res = NULL;
2600 int mark = p->mark;
2601 { // dotted_name '.' NAME
2602 expr_ty a;
2603 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002604 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002605 if (
2606 (a = dotted_name_rule(p))
2607 &&
2608 (literal = _PyPegen_expect_token(p, 23))
2609 &&
2610 (b = _PyPegen_name_token(p))
2611 )
2612 {
2613 res = _PyPegen_join_names_with_dot ( p , a , b );
2614 if (res == NULL && PyErr_Occurred()) {
2615 p->error_indicator = 1;
2616 return NULL;
2617 }
2618 goto done;
2619 }
2620 p->mark = mark;
2621 }
2622 { // NAME
2623 expr_ty name_var;
2624 if (
2625 (name_var = _PyPegen_name_token(p))
2626 )
2627 {
2628 res = name_var;
2629 goto done;
2630 }
2631 p->mark = mark;
2632 }
2633 res = NULL;
2634 done:
2635 return res;
2636}
2637
2638// if_stmt:
2639// | 'if' named_expression ':' block elif_stmt
2640// | 'if' named_expression ':' block else_block?
2641static stmt_ty
2642if_stmt_rule(Parser *p)
2643{
2644 if (p->error_indicator) {
2645 return NULL;
2646 }
2647 stmt_ty res = NULL;
2648 int mark = p->mark;
2649 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2650 p->error_indicator = 1;
2651 return NULL;
2652 }
2653 int start_lineno = p->tokens[mark]->lineno;
2654 UNUSED(start_lineno); // Only used by EXTRA macro
2655 int start_col_offset = p->tokens[mark]->col_offset;
2656 UNUSED(start_col_offset); // Only used by EXTRA macro
2657 { // 'if' named_expression ':' block elif_stmt
2658 expr_ty a;
2659 asdl_seq* b;
2660 stmt_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002661 Token * keyword;
2662 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002663 if (
2664 (keyword = _PyPegen_expect_token(p, 510))
2665 &&
2666 (a = named_expression_rule(p))
2667 &&
2668 (literal = _PyPegen_expect_token(p, 11))
2669 &&
2670 (b = block_rule(p))
2671 &&
2672 (c = elif_stmt_rule(p))
2673 )
2674 {
2675 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2676 if (token == NULL) {
2677 return NULL;
2678 }
2679 int end_lineno = token->end_lineno;
2680 UNUSED(end_lineno); // Only used by EXTRA macro
2681 int end_col_offset = token->end_col_offset;
2682 UNUSED(end_col_offset); // Only used by EXTRA macro
2683 res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
2684 if (res == NULL && PyErr_Occurred()) {
2685 p->error_indicator = 1;
2686 return NULL;
2687 }
2688 goto done;
2689 }
2690 p->mark = mark;
2691 }
2692 { // 'if' named_expression ':' block else_block?
2693 expr_ty a;
2694 asdl_seq* b;
2695 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002696 Token * keyword;
2697 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002698 if (
2699 (keyword = _PyPegen_expect_token(p, 510))
2700 &&
2701 (a = named_expression_rule(p))
2702 &&
2703 (literal = _PyPegen_expect_token(p, 11))
2704 &&
2705 (b = block_rule(p))
2706 &&
2707 (c = else_block_rule(p), 1)
2708 )
2709 {
2710 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2711 if (token == NULL) {
2712 return NULL;
2713 }
2714 int end_lineno = token->end_lineno;
2715 UNUSED(end_lineno); // Only used by EXTRA macro
2716 int end_col_offset = token->end_col_offset;
2717 UNUSED(end_col_offset); // Only used by EXTRA macro
2718 res = _Py_If ( a , b , c , EXTRA );
2719 if (res == NULL && PyErr_Occurred()) {
2720 p->error_indicator = 1;
2721 return NULL;
2722 }
2723 goto done;
2724 }
2725 p->mark = mark;
2726 }
2727 res = NULL;
2728 done:
2729 return res;
2730}
2731
2732// elif_stmt:
2733// | 'elif' named_expression ':' block elif_stmt
2734// | 'elif' named_expression ':' block else_block?
2735static stmt_ty
2736elif_stmt_rule(Parser *p)
2737{
2738 if (p->error_indicator) {
2739 return NULL;
2740 }
2741 stmt_ty res = NULL;
2742 int mark = p->mark;
2743 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2744 p->error_indicator = 1;
2745 return NULL;
2746 }
2747 int start_lineno = p->tokens[mark]->lineno;
2748 UNUSED(start_lineno); // Only used by EXTRA macro
2749 int start_col_offset = p->tokens[mark]->col_offset;
2750 UNUSED(start_col_offset); // Only used by EXTRA macro
2751 { // 'elif' named_expression ':' block elif_stmt
2752 expr_ty a;
2753 asdl_seq* b;
2754 stmt_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002755 Token * keyword;
2756 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002757 if (
2758 (keyword = _PyPegen_expect_token(p, 515))
2759 &&
2760 (a = named_expression_rule(p))
2761 &&
2762 (literal = _PyPegen_expect_token(p, 11))
2763 &&
2764 (b = block_rule(p))
2765 &&
2766 (c = elif_stmt_rule(p))
2767 )
2768 {
2769 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2770 if (token == NULL) {
2771 return NULL;
2772 }
2773 int end_lineno = token->end_lineno;
2774 UNUSED(end_lineno); // Only used by EXTRA macro
2775 int end_col_offset = token->end_col_offset;
2776 UNUSED(end_col_offset); // Only used by EXTRA macro
2777 res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
2778 if (res == NULL && PyErr_Occurred()) {
2779 p->error_indicator = 1;
2780 return NULL;
2781 }
2782 goto done;
2783 }
2784 p->mark = mark;
2785 }
2786 { // 'elif' named_expression ':' block else_block?
2787 expr_ty a;
2788 asdl_seq* b;
2789 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002790 Token * keyword;
2791 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002792 if (
2793 (keyword = _PyPegen_expect_token(p, 515))
2794 &&
2795 (a = named_expression_rule(p))
2796 &&
2797 (literal = _PyPegen_expect_token(p, 11))
2798 &&
2799 (b = block_rule(p))
2800 &&
2801 (c = else_block_rule(p), 1)
2802 )
2803 {
2804 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2805 if (token == NULL) {
2806 return NULL;
2807 }
2808 int end_lineno = token->end_lineno;
2809 UNUSED(end_lineno); // Only used by EXTRA macro
2810 int end_col_offset = token->end_col_offset;
2811 UNUSED(end_col_offset); // Only used by EXTRA macro
2812 res = _Py_If ( a , b , c , EXTRA );
2813 if (res == NULL && PyErr_Occurred()) {
2814 p->error_indicator = 1;
2815 return NULL;
2816 }
2817 goto done;
2818 }
2819 p->mark = mark;
2820 }
2821 res = NULL;
2822 done:
2823 return res;
2824}
2825
2826// else_block: 'else' ':' block
2827static asdl_seq*
2828else_block_rule(Parser *p)
2829{
2830 if (p->error_indicator) {
2831 return NULL;
2832 }
2833 asdl_seq* res = NULL;
2834 int mark = p->mark;
2835 { // 'else' ':' block
2836 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002837 Token * keyword;
2838 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002839 if (
2840 (keyword = _PyPegen_expect_token(p, 516))
2841 &&
2842 (literal = _PyPegen_expect_token(p, 11))
2843 &&
2844 (b = block_rule(p))
2845 )
2846 {
2847 res = b;
2848 if (res == NULL && PyErr_Occurred()) {
2849 p->error_indicator = 1;
2850 return NULL;
2851 }
2852 goto done;
2853 }
2854 p->mark = mark;
2855 }
2856 res = NULL;
2857 done:
2858 return res;
2859}
2860
2861// while_stmt: 'while' named_expression ':' block else_block?
2862static stmt_ty
2863while_stmt_rule(Parser *p)
2864{
2865 if (p->error_indicator) {
2866 return NULL;
2867 }
2868 stmt_ty res = NULL;
2869 int mark = p->mark;
2870 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2871 p->error_indicator = 1;
2872 return NULL;
2873 }
2874 int start_lineno = p->tokens[mark]->lineno;
2875 UNUSED(start_lineno); // Only used by EXTRA macro
2876 int start_col_offset = p->tokens[mark]->col_offset;
2877 UNUSED(start_col_offset); // Only used by EXTRA macro
2878 { // 'while' named_expression ':' block else_block?
2879 expr_ty a;
2880 asdl_seq* b;
2881 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002882 Token * keyword;
2883 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002884 if (
2885 (keyword = _PyPegen_expect_token(p, 512))
2886 &&
2887 (a = named_expression_rule(p))
2888 &&
2889 (literal = _PyPegen_expect_token(p, 11))
2890 &&
2891 (b = block_rule(p))
2892 &&
2893 (c = else_block_rule(p), 1)
2894 )
2895 {
2896 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2897 if (token == NULL) {
2898 return NULL;
2899 }
2900 int end_lineno = token->end_lineno;
2901 UNUSED(end_lineno); // Only used by EXTRA macro
2902 int end_col_offset = token->end_col_offset;
2903 UNUSED(end_col_offset); // Only used by EXTRA macro
2904 res = _Py_While ( a , b , c , EXTRA );
2905 if (res == NULL && PyErr_Occurred()) {
2906 p->error_indicator = 1;
2907 return NULL;
2908 }
2909 goto done;
2910 }
2911 p->mark = mark;
2912 }
2913 res = NULL;
2914 done:
2915 return res;
2916}
2917
Guido van Rossumc001c092020-04-30 12:12:19 -07002918// for_stmt:
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002919// | 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
2920// | ASYNC 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002921static stmt_ty
2922for_stmt_rule(Parser *p)
2923{
2924 if (p->error_indicator) {
2925 return NULL;
2926 }
2927 stmt_ty res = NULL;
2928 int mark = p->mark;
2929 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2930 p->error_indicator = 1;
2931 return NULL;
2932 }
2933 int start_lineno = p->tokens[mark]->lineno;
2934 UNUSED(start_lineno); // Only used by EXTRA macro
2935 int start_col_offset = p->tokens[mark]->col_offset;
2936 UNUSED(start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002937 { // 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002938 asdl_seq* b;
2939 void *el;
2940 expr_ty ex;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002941 Token * keyword;
2942 Token * keyword_1;
2943 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002944 expr_ty t;
Guido van Rossumc001c092020-04-30 12:12:19 -07002945 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002946 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002947 (keyword = _PyPegen_expect_token(p, 517))
2948 &&
2949 (t = star_targets_rule(p))
2950 &&
2951 (keyword_1 = _PyPegen_expect_token(p, 518))
2952 &&
2953 (ex = star_expressions_rule(p))
2954 &&
2955 (literal = _PyPegen_expect_token(p, 11))
2956 &&
2957 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
2958 &&
2959 (b = block_rule(p))
2960 &&
2961 (el = else_block_rule(p), 1)
2962 )
2963 {
2964 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2965 if (token == NULL) {
2966 return NULL;
2967 }
2968 int end_lineno = token->end_lineno;
2969 UNUSED(end_lineno); // Only used by EXTRA macro
2970 int end_col_offset = token->end_col_offset;
2971 UNUSED(end_col_offset); // Only used by EXTRA macro
2972 res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
2973 if (res == NULL && PyErr_Occurred()) {
2974 p->error_indicator = 1;
2975 return NULL;
2976 }
2977 goto done;
2978 }
2979 p->mark = mark;
2980 }
2981 { // ASYNC 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindob796b3f2020-05-01 12:32:26 +01002982 Token * async_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002983 asdl_seq* b;
2984 void *el;
2985 expr_ty ex;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002986 Token * keyword;
2987 Token * keyword_1;
2988 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002989 expr_ty t;
2990 void *tc;
2991 if (
2992 (async_var = _PyPegen_expect_token(p, ASYNC))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002993 &&
2994 (keyword = _PyPegen_expect_token(p, 517))
2995 &&
2996 (t = star_targets_rule(p))
2997 &&
2998 (keyword_1 = _PyPegen_expect_token(p, 518))
2999 &&
3000 (ex = star_expressions_rule(p))
3001 &&
3002 (literal = _PyPegen_expect_token(p, 11))
3003 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003004 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
3005 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003006 (b = block_rule(p))
3007 &&
3008 (el = else_block_rule(p), 1)
3009 )
3010 {
3011 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3012 if (token == NULL) {
3013 return NULL;
3014 }
3015 int end_lineno = token->end_lineno;
3016 UNUSED(end_lineno); // Only used by EXTRA macro
3017 int end_col_offset = token->end_col_offset;
3018 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003019 res = CHECK_VERSION ( 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003020 if (res == NULL && PyErr_Occurred()) {
3021 p->error_indicator = 1;
3022 return NULL;
3023 }
3024 goto done;
3025 }
3026 p->mark = mark;
3027 }
3028 res = NULL;
3029 done:
3030 return res;
3031}
3032
3033// with_stmt:
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003034// | 'with' '(' ','.with_item+ ')' ':' block
3035// | 'with' ','.with_item+ ':' TYPE_COMMENT? block
3036// | ASYNC 'with' '(' ','.with_item+ ')' ':' block
3037// | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003038static stmt_ty
3039with_stmt_rule(Parser *p)
3040{
3041 if (p->error_indicator) {
3042 return NULL;
3043 }
3044 stmt_ty res = NULL;
3045 int mark = p->mark;
3046 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3047 p->error_indicator = 1;
3048 return NULL;
3049 }
3050 int start_lineno = p->tokens[mark]->lineno;
3051 UNUSED(start_lineno); // Only used by EXTRA macro
3052 int start_col_offset = p->tokens[mark]->col_offset;
3053 UNUSED(start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003054 { // 'with' '(' ','.with_item+ ')' ':' block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003055 asdl_seq * a;
3056 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003057 Token * keyword;
3058 Token * literal;
3059 Token * literal_1;
3060 Token * literal_2;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003061 if (
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003062 (keyword = _PyPegen_expect_token(p, 519))
3063 &&
3064 (literal = _PyPegen_expect_token(p, 7))
3065 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003066 (a = _gather_38_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003067 &&
3068 (literal_1 = _PyPegen_expect_token(p, 8))
3069 &&
3070 (literal_2 = _PyPegen_expect_token(p, 11))
3071 &&
3072 (b = block_rule(p))
3073 )
3074 {
3075 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3076 if (token == NULL) {
3077 return NULL;
3078 }
3079 int end_lineno = token->end_lineno;
3080 UNUSED(end_lineno); // Only used by EXTRA macro
3081 int end_col_offset = token->end_col_offset;
3082 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003083 res = _Py_With ( a , b , NULL , EXTRA );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003084 if (res == NULL && PyErr_Occurred()) {
3085 p->error_indicator = 1;
3086 return NULL;
3087 }
3088 goto done;
3089 }
3090 p->mark = mark;
3091 }
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003092 { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003093 asdl_seq * a;
3094 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003095 Token * keyword;
3096 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07003097 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003098 if (
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003099 (keyword = _PyPegen_expect_token(p, 519))
3100 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003101 (a = _gather_40_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003102 &&
3103 (literal = _PyPegen_expect_token(p, 11))
3104 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003105 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
3106 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003107 (b = block_rule(p))
3108 )
3109 {
3110 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3111 if (token == NULL) {
3112 return NULL;
3113 }
3114 int end_lineno = token->end_lineno;
3115 UNUSED(end_lineno); // Only used by EXTRA macro
3116 int end_col_offset = token->end_col_offset;
3117 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003118 res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
3119 if (res == NULL && PyErr_Occurred()) {
3120 p->error_indicator = 1;
3121 return NULL;
3122 }
3123 goto done;
3124 }
3125 p->mark = mark;
3126 }
3127 { // ASYNC 'with' '(' ','.with_item+ ')' ':' block
3128 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003129 Token * async_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003130 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003131 Token * keyword;
3132 Token * literal;
3133 Token * literal_1;
3134 Token * literal_2;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003135 if (
3136 (async_var = _PyPegen_expect_token(p, ASYNC))
3137 &&
3138 (keyword = _PyPegen_expect_token(p, 519))
3139 &&
3140 (literal = _PyPegen_expect_token(p, 7))
3141 &&
3142 (a = _gather_42_rule(p))
3143 &&
3144 (literal_1 = _PyPegen_expect_token(p, 8))
3145 &&
3146 (literal_2 = _PyPegen_expect_token(p, 11))
3147 &&
3148 (b = block_rule(p))
3149 )
3150 {
3151 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3152 if (token == NULL) {
3153 return NULL;
3154 }
3155 int end_lineno = token->end_lineno;
3156 UNUSED(end_lineno); // Only used by EXTRA macro
3157 int end_col_offset = token->end_col_offset;
3158 UNUSED(end_col_offset); // Only used by EXTRA macro
3159 res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) );
3160 if (res == NULL && PyErr_Occurred()) {
3161 p->error_indicator = 1;
3162 return NULL;
3163 }
3164 goto done;
3165 }
3166 p->mark = mark;
3167 }
3168 { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
3169 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003170 Token * async_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003171 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003172 Token * keyword;
3173 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003174 void *tc;
3175 if (
3176 (async_var = _PyPegen_expect_token(p, ASYNC))
3177 &&
3178 (keyword = _PyPegen_expect_token(p, 519))
3179 &&
3180 (a = _gather_44_rule(p))
3181 &&
3182 (literal = _PyPegen_expect_token(p, 11))
3183 &&
3184 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
3185 &&
3186 (b = block_rule(p))
3187 )
3188 {
3189 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3190 if (token == NULL) {
3191 return NULL;
3192 }
3193 int end_lineno = token->end_lineno;
3194 UNUSED(end_lineno); // Only used by EXTRA macro
3195 int end_col_offset = token->end_col_offset;
3196 UNUSED(end_col_offset); // Only used by EXTRA macro
3197 res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003198 if (res == NULL && PyErr_Occurred()) {
3199 p->error_indicator = 1;
3200 return NULL;
3201 }
3202 goto done;
3203 }
3204 p->mark = mark;
3205 }
3206 res = NULL;
3207 done:
3208 return res;
3209}
3210
3211// with_item: expression ['as' target]
3212static withitem_ty
3213with_item_rule(Parser *p)
3214{
3215 if (p->error_indicator) {
3216 return NULL;
3217 }
3218 withitem_ty res = NULL;
3219 int mark = p->mark;
3220 { // expression ['as' target]
3221 expr_ty e;
3222 void *o;
3223 if (
3224 (e = expression_rule(p))
3225 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003226 (o = _tmp_46_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003227 )
3228 {
3229 res = _Py_withitem ( e , o , p -> arena );
3230 if (res == NULL && PyErr_Occurred()) {
3231 p->error_indicator = 1;
3232 return NULL;
3233 }
3234 goto done;
3235 }
3236 p->mark = mark;
3237 }
3238 res = NULL;
3239 done:
3240 return res;
3241}
3242
3243// try_stmt:
3244// | 'try' ':' block finally_block
3245// | 'try' ':' block except_block+ else_block? finally_block?
3246static stmt_ty
3247try_stmt_rule(Parser *p)
3248{
3249 if (p->error_indicator) {
3250 return NULL;
3251 }
3252 stmt_ty res = NULL;
3253 int mark = p->mark;
3254 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3255 p->error_indicator = 1;
3256 return NULL;
3257 }
3258 int start_lineno = p->tokens[mark]->lineno;
3259 UNUSED(start_lineno); // Only used by EXTRA macro
3260 int start_col_offset = p->tokens[mark]->col_offset;
3261 UNUSED(start_col_offset); // Only used by EXTRA macro
3262 { // 'try' ':' block finally_block
3263 asdl_seq* b;
3264 asdl_seq* f;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003265 Token * keyword;
3266 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003267 if (
3268 (keyword = _PyPegen_expect_token(p, 511))
3269 &&
3270 (literal = _PyPegen_expect_token(p, 11))
3271 &&
3272 (b = block_rule(p))
3273 &&
3274 (f = finally_block_rule(p))
3275 )
3276 {
3277 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3278 if (token == NULL) {
3279 return NULL;
3280 }
3281 int end_lineno = token->end_lineno;
3282 UNUSED(end_lineno); // Only used by EXTRA macro
3283 int end_col_offset = token->end_col_offset;
3284 UNUSED(end_col_offset); // Only used by EXTRA macro
3285 res = _Py_Try ( b , NULL , NULL , f , EXTRA );
3286 if (res == NULL && PyErr_Occurred()) {
3287 p->error_indicator = 1;
3288 return NULL;
3289 }
3290 goto done;
3291 }
3292 p->mark = mark;
3293 }
3294 { // 'try' ':' block except_block+ else_block? finally_block?
3295 asdl_seq* b;
3296 void *el;
3297 asdl_seq * ex;
3298 void *f;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003299 Token * keyword;
3300 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003301 if (
3302 (keyword = _PyPegen_expect_token(p, 511))
3303 &&
3304 (literal = _PyPegen_expect_token(p, 11))
3305 &&
3306 (b = block_rule(p))
3307 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003308 (ex = _loop1_47_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003309 &&
3310 (el = else_block_rule(p), 1)
3311 &&
3312 (f = finally_block_rule(p), 1)
3313 )
3314 {
3315 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3316 if (token == NULL) {
3317 return NULL;
3318 }
3319 int end_lineno = token->end_lineno;
3320 UNUSED(end_lineno); // Only used by EXTRA macro
3321 int end_col_offset = token->end_col_offset;
3322 UNUSED(end_col_offset); // Only used by EXTRA macro
3323 res = _Py_Try ( b , ex , el , f , EXTRA );
3324 if (res == NULL && PyErr_Occurred()) {
3325 p->error_indicator = 1;
3326 return NULL;
3327 }
3328 goto done;
3329 }
3330 p->mark = mark;
3331 }
3332 res = NULL;
3333 done:
3334 return res;
3335}
3336
3337// except_block: 'except' expression ['as' target] ':' block | 'except' ':' block
3338static excepthandler_ty
3339except_block_rule(Parser *p)
3340{
3341 if (p->error_indicator) {
3342 return NULL;
3343 }
3344 excepthandler_ty res = NULL;
3345 int mark = p->mark;
3346 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3347 p->error_indicator = 1;
3348 return NULL;
3349 }
3350 int start_lineno = p->tokens[mark]->lineno;
3351 UNUSED(start_lineno); // Only used by EXTRA macro
3352 int start_col_offset = p->tokens[mark]->col_offset;
3353 UNUSED(start_col_offset); // Only used by EXTRA macro
3354 { // 'except' expression ['as' target] ':' block
3355 asdl_seq* b;
3356 expr_ty e;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003357 Token * keyword;
3358 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003359 void *t;
3360 if (
3361 (keyword = _PyPegen_expect_token(p, 520))
3362 &&
3363 (e = expression_rule(p))
3364 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003365 (t = _tmp_48_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003366 &&
3367 (literal = _PyPegen_expect_token(p, 11))
3368 &&
3369 (b = block_rule(p))
3370 )
3371 {
3372 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3373 if (token == NULL) {
3374 return NULL;
3375 }
3376 int end_lineno = token->end_lineno;
3377 UNUSED(end_lineno); // Only used by EXTRA macro
3378 int end_col_offset = token->end_col_offset;
3379 UNUSED(end_col_offset); // Only used by EXTRA macro
3380 res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
3381 if (res == NULL && PyErr_Occurred()) {
3382 p->error_indicator = 1;
3383 return NULL;
3384 }
3385 goto done;
3386 }
3387 p->mark = mark;
3388 }
3389 { // 'except' ':' block
3390 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003391 Token * keyword;
3392 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003393 if (
3394 (keyword = _PyPegen_expect_token(p, 520))
3395 &&
3396 (literal = _PyPegen_expect_token(p, 11))
3397 &&
3398 (b = block_rule(p))
3399 )
3400 {
3401 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3402 if (token == NULL) {
3403 return NULL;
3404 }
3405 int end_lineno = token->end_lineno;
3406 UNUSED(end_lineno); // Only used by EXTRA macro
3407 int end_col_offset = token->end_col_offset;
3408 UNUSED(end_col_offset); // Only used by EXTRA macro
3409 res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
3410 if (res == NULL && PyErr_Occurred()) {
3411 p->error_indicator = 1;
3412 return NULL;
3413 }
3414 goto done;
3415 }
3416 p->mark = mark;
3417 }
3418 res = NULL;
3419 done:
3420 return res;
3421}
3422
3423// finally_block: 'finally' ':' block
3424static asdl_seq*
3425finally_block_rule(Parser *p)
3426{
3427 if (p->error_indicator) {
3428 return NULL;
3429 }
3430 asdl_seq* res = NULL;
3431 int mark = p->mark;
3432 { // 'finally' ':' block
3433 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003434 Token * keyword;
3435 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003436 if (
3437 (keyword = _PyPegen_expect_token(p, 521))
3438 &&
3439 (literal = _PyPegen_expect_token(p, 11))
3440 &&
3441 (a = block_rule(p))
3442 )
3443 {
3444 res = a;
3445 if (res == NULL && PyErr_Occurred()) {
3446 p->error_indicator = 1;
3447 return NULL;
3448 }
3449 goto done;
3450 }
3451 p->mark = mark;
3452 }
3453 res = NULL;
3454 done:
3455 return res;
3456}
3457
3458// return_stmt: 'return' star_expressions?
3459static stmt_ty
3460return_stmt_rule(Parser *p)
3461{
3462 if (p->error_indicator) {
3463 return NULL;
3464 }
3465 stmt_ty res = NULL;
3466 int mark = p->mark;
3467 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3468 p->error_indicator = 1;
3469 return NULL;
3470 }
3471 int start_lineno = p->tokens[mark]->lineno;
3472 UNUSED(start_lineno); // Only used by EXTRA macro
3473 int start_col_offset = p->tokens[mark]->col_offset;
3474 UNUSED(start_col_offset); // Only used by EXTRA macro
3475 { // 'return' star_expressions?
3476 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003477 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003478 if (
3479 (keyword = _PyPegen_expect_token(p, 500))
3480 &&
3481 (a = star_expressions_rule(p), 1)
3482 )
3483 {
3484 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3485 if (token == NULL) {
3486 return NULL;
3487 }
3488 int end_lineno = token->end_lineno;
3489 UNUSED(end_lineno); // Only used by EXTRA macro
3490 int end_col_offset = token->end_col_offset;
3491 UNUSED(end_col_offset); // Only used by EXTRA macro
3492 res = _Py_Return ( a , EXTRA );
3493 if (res == NULL && PyErr_Occurred()) {
3494 p->error_indicator = 1;
3495 return NULL;
3496 }
3497 goto done;
3498 }
3499 p->mark = mark;
3500 }
3501 res = NULL;
3502 done:
3503 return res;
3504}
3505
3506// raise_stmt: 'raise' expression ['from' expression] | 'raise'
3507static stmt_ty
3508raise_stmt_rule(Parser *p)
3509{
3510 if (p->error_indicator) {
3511 return NULL;
3512 }
3513 stmt_ty res = NULL;
3514 int mark = p->mark;
3515 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3516 p->error_indicator = 1;
3517 return NULL;
3518 }
3519 int start_lineno = p->tokens[mark]->lineno;
3520 UNUSED(start_lineno); // Only used by EXTRA macro
3521 int start_col_offset = p->tokens[mark]->col_offset;
3522 UNUSED(start_col_offset); // Only used by EXTRA macro
3523 { // 'raise' expression ['from' expression]
3524 expr_ty a;
3525 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003526 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003527 if (
3528 (keyword = _PyPegen_expect_token(p, 501))
3529 &&
3530 (a = expression_rule(p))
3531 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003532 (b = _tmp_49_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003533 )
3534 {
3535 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3536 if (token == NULL) {
3537 return NULL;
3538 }
3539 int end_lineno = token->end_lineno;
3540 UNUSED(end_lineno); // Only used by EXTRA macro
3541 int end_col_offset = token->end_col_offset;
3542 UNUSED(end_col_offset); // Only used by EXTRA macro
3543 res = _Py_Raise ( a , b , EXTRA );
3544 if (res == NULL && PyErr_Occurred()) {
3545 p->error_indicator = 1;
3546 return NULL;
3547 }
3548 goto done;
3549 }
3550 p->mark = mark;
3551 }
3552 { // 'raise'
Pablo Galindob796b3f2020-05-01 12:32:26 +01003553 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003554 if (
3555 (keyword = _PyPegen_expect_token(p, 501))
3556 )
3557 {
3558 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3559 if (token == NULL) {
3560 return NULL;
3561 }
3562 int end_lineno = token->end_lineno;
3563 UNUSED(end_lineno); // Only used by EXTRA macro
3564 int end_col_offset = token->end_col_offset;
3565 UNUSED(end_col_offset); // Only used by EXTRA macro
3566 res = _Py_Raise ( NULL , NULL , EXTRA );
3567 if (res == NULL && PyErr_Occurred()) {
3568 p->error_indicator = 1;
3569 return NULL;
3570 }
3571 goto done;
3572 }
3573 p->mark = mark;
3574 }
3575 res = NULL;
3576 done:
3577 return res;
3578}
3579
3580// function_def: decorators function_def_raw | function_def_raw
3581static stmt_ty
3582function_def_rule(Parser *p)
3583{
3584 if (p->error_indicator) {
3585 return NULL;
3586 }
3587 stmt_ty res = NULL;
3588 int mark = p->mark;
3589 { // decorators function_def_raw
3590 asdl_seq* d;
3591 stmt_ty f;
3592 if (
3593 (d = decorators_rule(p))
3594 &&
3595 (f = function_def_raw_rule(p))
3596 )
3597 {
3598 res = _PyPegen_function_def_decorators ( p , d , f );
3599 if (res == NULL && PyErr_Occurred()) {
3600 p->error_indicator = 1;
3601 return NULL;
3602 }
3603 goto done;
3604 }
3605 p->mark = mark;
3606 }
3607 { // function_def_raw
3608 stmt_ty function_def_raw_var;
3609 if (
3610 (function_def_raw_var = function_def_raw_rule(p))
3611 )
3612 {
3613 res = function_def_raw_var;
3614 goto done;
3615 }
3616 p->mark = mark;
3617 }
3618 res = NULL;
3619 done:
3620 return res;
3621}
3622
Guido van Rossumc001c092020-04-30 12:12:19 -07003623// function_def_raw:
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003624// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
3625// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003626static stmt_ty
3627function_def_raw_rule(Parser *p)
3628{
3629 if (p->error_indicator) {
3630 return NULL;
3631 }
3632 stmt_ty res = NULL;
3633 int mark = p->mark;
3634 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3635 p->error_indicator = 1;
3636 return NULL;
3637 }
3638 int start_lineno = p->tokens[mark]->lineno;
3639 UNUSED(start_lineno); // Only used by EXTRA macro
3640 int start_col_offset = p->tokens[mark]->col_offset;
3641 UNUSED(start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003642 { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003643 void *a;
3644 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003645 Token * keyword;
3646 Token * literal;
3647 Token * literal_1;
3648 Token * literal_2;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003649 expr_ty n;
3650 void *params;
Guido van Rossumc001c092020-04-30 12:12:19 -07003651 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003652 if (
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003653 (keyword = _PyPegen_expect_token(p, 522))
3654 &&
3655 (n = _PyPegen_name_token(p))
3656 &&
3657 (literal = _PyPegen_expect_token(p, 7))
3658 &&
3659 (params = params_rule(p), 1)
3660 &&
3661 (literal_1 = _PyPegen_expect_token(p, 8))
3662 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003663 (a = _tmp_50_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003664 &&
3665 (literal_2 = _PyPegen_expect_token(p, 11))
3666 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003667 (tc = func_type_comment_rule(p), 1)
3668 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003669 (b = block_rule(p))
3670 )
3671 {
3672 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3673 if (token == NULL) {
3674 return NULL;
3675 }
3676 int end_lineno = token->end_lineno;
3677 UNUSED(end_lineno); // Only used by EXTRA macro
3678 int end_col_offset = token->end_col_offset;
3679 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003680 res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
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 { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
3690 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003691 Token * async_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003692 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003693 Token * keyword;
3694 Token * literal;
3695 Token * literal_1;
3696 Token * literal_2;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003697 expr_ty n;
3698 void *params;
3699 void *tc;
3700 if (
3701 (async_var = _PyPegen_expect_token(p, ASYNC))
3702 &&
3703 (keyword = _PyPegen_expect_token(p, 522))
3704 &&
3705 (n = _PyPegen_name_token(p))
3706 &&
3707 (literal = _PyPegen_expect_token(p, 7))
3708 &&
3709 (params = params_rule(p), 1)
3710 &&
3711 (literal_1 = _PyPegen_expect_token(p, 8))
3712 &&
3713 (a = _tmp_51_rule(p), 1)
3714 &&
3715 (literal_2 = _PyPegen_expect_token(p, 11))
3716 &&
3717 (tc = func_type_comment_rule(p), 1)
3718 &&
3719 (b = block_rule(p))
3720 )
3721 {
3722 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3723 if (token == NULL) {
3724 return NULL;
3725 }
3726 int end_lineno = token->end_lineno;
3727 UNUSED(end_lineno); // Only used by EXTRA macro
3728 int end_col_offset = token->end_col_offset;
3729 UNUSED(end_col_offset); // Only used by EXTRA macro
3730 res = CHECK_VERSION ( 5 , "Async functions are" , _Py_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003731 if (res == NULL && PyErr_Occurred()) {
3732 p->error_indicator = 1;
3733 return NULL;
3734 }
3735 goto done;
3736 }
3737 p->mark = mark;
3738 }
3739 res = NULL;
3740 done:
3741 return res;
3742}
3743
Guido van Rossumc001c092020-04-30 12:12:19 -07003744// func_type_comment:
3745// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
3746// | invalid_double_type_comments
3747// | TYPE_COMMENT
Pablo Galindod9552412020-05-01 16:32:09 +01003748static Token*
Guido van Rossumc001c092020-04-30 12:12:19 -07003749func_type_comment_rule(Parser *p)
3750{
3751 if (p->error_indicator) {
3752 return NULL;
3753 }
Pablo Galindod9552412020-05-01 16:32:09 +01003754 Token* res = NULL;
Guido van Rossumc001c092020-04-30 12:12:19 -07003755 int mark = p->mark;
3756 { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
Pablo Galindob796b3f2020-05-01 12:32:26 +01003757 Token * newline_var;
3758 Token * t;
Guido van Rossumc001c092020-04-30 12:12:19 -07003759 if (
3760 (newline_var = _PyPegen_expect_token(p, NEWLINE))
3761 &&
3762 (t = _PyPegen_expect_token(p, TYPE_COMMENT))
3763 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003764 _PyPegen_lookahead(1, _tmp_52_rule, p)
Guido van Rossumc001c092020-04-30 12:12:19 -07003765 )
3766 {
3767 res = t;
3768 if (res == NULL && PyErr_Occurred()) {
3769 p->error_indicator = 1;
3770 return NULL;
3771 }
3772 goto done;
3773 }
3774 p->mark = mark;
3775 }
3776 { // invalid_double_type_comments
3777 void *invalid_double_type_comments_var;
3778 if (
3779 (invalid_double_type_comments_var = invalid_double_type_comments_rule(p))
3780 )
3781 {
3782 res = invalid_double_type_comments_var;
3783 goto done;
3784 }
3785 p->mark = mark;
3786 }
3787 { // TYPE_COMMENT
Pablo Galindob796b3f2020-05-01 12:32:26 +01003788 Token * type_comment_var;
Guido van Rossumc001c092020-04-30 12:12:19 -07003789 if (
3790 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))
3791 )
3792 {
3793 res = type_comment_var;
3794 goto done;
3795 }
3796 p->mark = mark;
3797 }
3798 res = NULL;
3799 done:
3800 return res;
3801}
3802
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003803// params: invalid_parameters | parameters
3804static arguments_ty
3805params_rule(Parser *p)
3806{
3807 if (p->error_indicator) {
3808 return NULL;
3809 }
3810 arguments_ty res = NULL;
3811 int mark = p->mark;
3812 { // invalid_parameters
3813 void *invalid_parameters_var;
3814 if (
3815 (invalid_parameters_var = invalid_parameters_rule(p))
3816 )
3817 {
3818 res = invalid_parameters_var;
3819 goto done;
3820 }
3821 p->mark = mark;
3822 }
3823 { // parameters
3824 arguments_ty parameters_var;
3825 if (
3826 (parameters_var = parameters_rule(p))
3827 )
3828 {
3829 res = parameters_var;
3830 goto done;
3831 }
3832 p->mark = mark;
3833 }
3834 res = NULL;
3835 done:
3836 return res;
3837}
3838
3839// parameters:
Guido van Rossumc001c092020-04-30 12:12:19 -07003840// | slash_no_default param_no_default* param_with_default* star_etc?
3841// | slash_with_default param_with_default* star_etc?
3842// | param_no_default+ param_with_default* star_etc?
3843// | param_with_default+ star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003844// | star_etc
3845static arguments_ty
3846parameters_rule(Parser *p)
3847{
3848 if (p->error_indicator) {
3849 return NULL;
3850 }
3851 arguments_ty res = NULL;
3852 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07003853 { // slash_no_default param_no_default* param_with_default* star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003854 asdl_seq* a;
Guido van Rossumc001c092020-04-30 12:12:19 -07003855 asdl_seq * b;
3856 asdl_seq * c;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003857 void *d;
3858 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07003859 (a = slash_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003860 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003861 (b = _loop0_53_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003862 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003863 (c = _loop0_54_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003864 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003865 (d = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003866 )
3867 {
3868 res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
3869 if (res == NULL && PyErr_Occurred()) {
3870 p->error_indicator = 1;
3871 return NULL;
3872 }
3873 goto done;
3874 }
3875 p->mark = mark;
3876 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003877 { // slash_with_default param_with_default* star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003878 SlashWithDefault* a;
Guido van Rossumc001c092020-04-30 12:12:19 -07003879 asdl_seq * b;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003880 void *c;
3881 if (
3882 (a = slash_with_default_rule(p))
3883 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003884 (b = _loop0_55_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003885 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003886 (c = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003887 )
3888 {
3889 res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
3890 if (res == NULL && PyErr_Occurred()) {
3891 p->error_indicator = 1;
3892 return NULL;
3893 }
3894 goto done;
3895 }
3896 p->mark = mark;
3897 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003898 { // param_no_default+ param_with_default* star_etc?
3899 asdl_seq * a;
3900 asdl_seq * b;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003901 void *c;
3902 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003903 (a = _loop1_56_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003904 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003905 (b = _loop0_57_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003906 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003907 (c = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003908 )
3909 {
3910 res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
3911 if (res == NULL && PyErr_Occurred()) {
3912 p->error_indicator = 1;
3913 return NULL;
3914 }
3915 goto done;
3916 }
3917 p->mark = mark;
3918 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003919 { // param_with_default+ star_etc?
3920 asdl_seq * a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003921 void *b;
3922 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003923 (a = _loop1_58_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003924 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003925 (b = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003926 )
3927 {
3928 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
3929 if (res == NULL && PyErr_Occurred()) {
3930 p->error_indicator = 1;
3931 return NULL;
3932 }
3933 goto done;
3934 }
3935 p->mark = mark;
3936 }
3937 { // star_etc
3938 StarEtc* a;
3939 if (
3940 (a = star_etc_rule(p))
3941 )
3942 {
3943 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
3944 if (res == NULL && PyErr_Occurred()) {
3945 p->error_indicator = 1;
3946 return NULL;
3947 }
3948 goto done;
3949 }
3950 p->mark = mark;
3951 }
3952 res = NULL;
3953 done:
3954 return res;
3955}
3956
Guido van Rossumc001c092020-04-30 12:12:19 -07003957// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003958static asdl_seq*
Guido van Rossumc001c092020-04-30 12:12:19 -07003959slash_no_default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003960{
3961 if (p->error_indicator) {
3962 return NULL;
3963 }
3964 asdl_seq* res = NULL;
3965 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07003966 { // param_no_default+ '/' ','
3967 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003968 Token * literal;
3969 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003970 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003971 (a = _loop1_59_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003972 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003973 (literal = _PyPegen_expect_token(p, 17))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003974 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003975 (literal_1 = _PyPegen_expect_token(p, 12))
3976 )
3977 {
3978 res = a;
3979 if (res == NULL && PyErr_Occurred()) {
3980 p->error_indicator = 1;
3981 return NULL;
3982 }
3983 goto done;
3984 }
3985 p->mark = mark;
3986 }
3987 { // param_no_default+ '/' &')'
3988 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003989 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07003990 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003991 (a = _loop1_60_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -07003992 &&
3993 (literal = _PyPegen_expect_token(p, 17))
3994 &&
3995 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003996 )
3997 {
3998 res = a;
3999 if (res == NULL && PyErr_Occurred()) {
4000 p->error_indicator = 1;
4001 return NULL;
4002 }
4003 goto done;
4004 }
4005 p->mark = mark;
4006 }
4007 res = NULL;
4008 done:
4009 return res;
4010}
4011
Guido van Rossumc001c092020-04-30 12:12:19 -07004012// slash_with_default:
4013// | param_no_default* param_with_default+ '/' ','
4014// | param_no_default* param_with_default+ '/' &')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004015static SlashWithDefault*
4016slash_with_default_rule(Parser *p)
4017{
4018 if (p->error_indicator) {
4019 return NULL;
4020 }
4021 SlashWithDefault* res = NULL;
4022 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004023 { // param_no_default* param_with_default+ '/' ','
4024 asdl_seq * a;
4025 asdl_seq * b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004026 Token * literal;
4027 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004028 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004029 (a = _loop0_61_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004030 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004031 (b = _loop1_62_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004032 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004033 (literal = _PyPegen_expect_token(p, 17))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004034 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004035 (literal_1 = _PyPegen_expect_token(p, 12))
4036 )
4037 {
4038 res = _PyPegen_slash_with_default ( p , a , b );
4039 if (res == NULL && PyErr_Occurred()) {
4040 p->error_indicator = 1;
4041 return NULL;
4042 }
4043 goto done;
4044 }
4045 p->mark = mark;
4046 }
4047 { // param_no_default* param_with_default+ '/' &')'
4048 asdl_seq * a;
4049 asdl_seq * b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004050 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07004051 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004052 (a = _loop0_63_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -07004053 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004054 (b = _loop1_64_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -07004055 &&
4056 (literal = _PyPegen_expect_token(p, 17))
4057 &&
4058 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004059 )
4060 {
4061 res = _PyPegen_slash_with_default ( p , a , b );
4062 if (res == NULL && PyErr_Occurred()) {
4063 p->error_indicator = 1;
4064 return NULL;
4065 }
4066 goto done;
4067 }
4068 p->mark = mark;
4069 }
4070 res = NULL;
4071 done:
4072 return res;
4073}
4074
4075// star_etc:
Guido van Rossumc001c092020-04-30 12:12:19 -07004076// | '*' param_no_default param_maybe_default* kwds?
4077// | '*' ',' param_maybe_default+ kwds?
4078// | kwds
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +03004079// | invalid_star_etc
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004080static StarEtc*
4081star_etc_rule(Parser *p)
4082{
4083 if (p->error_indicator) {
4084 return NULL;
4085 }
4086 StarEtc* res = NULL;
4087 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004088 { // '*' param_no_default param_maybe_default* kwds?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004089 arg_ty a;
4090 asdl_seq * b;
4091 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004092 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004093 if (
4094 (literal = _PyPegen_expect_token(p, 16))
4095 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004096 (a = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004097 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004098 (b = _loop0_65_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004099 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004100 (c = kwds_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004101 )
4102 {
4103 res = _PyPegen_star_etc ( p , a , b , c );
4104 if (res == NULL && PyErr_Occurred()) {
4105 p->error_indicator = 1;
4106 return NULL;
4107 }
4108 goto done;
4109 }
4110 p->mark = mark;
4111 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004112 { // '*' ',' param_maybe_default+ kwds?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004113 asdl_seq * b;
4114 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004115 Token * literal;
4116 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004117 if (
4118 (literal = _PyPegen_expect_token(p, 16))
4119 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004120 (literal_1 = _PyPegen_expect_token(p, 12))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004121 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004122 (b = _loop1_66_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004123 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004124 (c = kwds_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004125 )
4126 {
4127 res = _PyPegen_star_etc ( p , NULL , b , c );
4128 if (res == NULL && PyErr_Occurred()) {
4129 p->error_indicator = 1;
4130 return NULL;
4131 }
4132 goto done;
4133 }
4134 p->mark = mark;
4135 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004136 { // kwds
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004137 arg_ty a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004138 if (
4139 (a = kwds_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004140 )
4141 {
4142 res = _PyPegen_star_etc ( p , NULL , NULL , a );
4143 if (res == NULL && PyErr_Occurred()) {
4144 p->error_indicator = 1;
4145 return NULL;
4146 }
4147 goto done;
4148 }
4149 p->mark = mark;
4150 }
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +03004151 { // invalid_star_etc
4152 void *invalid_star_etc_var;
4153 if (
4154 (invalid_star_etc_var = invalid_star_etc_rule(p))
4155 )
4156 {
4157 res = invalid_star_etc_var;
4158 goto done;
4159 }
4160 p->mark = mark;
4161 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004162 res = NULL;
4163 done:
4164 return res;
4165}
4166
Guido van Rossumc001c092020-04-30 12:12:19 -07004167// kwds: '**' param_no_default
4168static arg_ty
4169kwds_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004170{
4171 if (p->error_indicator) {
4172 return NULL;
4173 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004174 arg_ty res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004175 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004176 { // '**' param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004177 arg_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004178 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004179 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004180 (literal = _PyPegen_expect_token(p, 35))
4181 &&
4182 (a = param_no_default_rule(p))
4183 )
4184 {
4185 res = a;
4186 if (res == NULL && PyErr_Occurred()) {
4187 p->error_indicator = 1;
4188 return NULL;
4189 }
4190 goto done;
4191 }
4192 p->mark = mark;
4193 }
4194 res = NULL;
4195 done:
4196 return res;
4197}
4198
4199// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
4200static arg_ty
4201param_no_default_rule(Parser *p)
4202{
4203 if (p->error_indicator) {
4204 return NULL;
4205 }
4206 arg_ty res = NULL;
4207 int mark = p->mark;
4208 { // param ',' TYPE_COMMENT?
4209 arg_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004210 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07004211 void *tc;
4212 if (
4213 (a = param_rule(p))
4214 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004215 (literal = _PyPegen_expect_token(p, 12))
4216 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004217 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004218 )
4219 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004220 res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004221 if (res == NULL && PyErr_Occurred()) {
4222 p->error_indicator = 1;
4223 return NULL;
4224 }
4225 goto done;
4226 }
4227 p->mark = mark;
4228 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004229 { // param TYPE_COMMENT? &')'
4230 arg_ty a;
4231 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004232 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004233 (a = param_rule(p))
4234 &&
4235 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
4236 &&
4237 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004238 )
4239 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004240 res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004241 if (res == NULL && PyErr_Occurred()) {
4242 p->error_indicator = 1;
4243 return NULL;
4244 }
4245 goto done;
4246 }
4247 p->mark = mark;
4248 }
4249 res = NULL;
4250 done:
4251 return res;
4252}
4253
Guido van Rossumc001c092020-04-30 12:12:19 -07004254// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004255static NameDefaultPair*
Guido van Rossumc001c092020-04-30 12:12:19 -07004256param_with_default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004257{
4258 if (p->error_indicator) {
4259 return NULL;
4260 }
4261 NameDefaultPair* res = NULL;
4262 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004263 { // param default ',' TYPE_COMMENT?
4264 arg_ty a;
4265 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004266 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07004267 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004268 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004269 (a = param_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004270 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004271 (c = default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004272 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004273 (literal = _PyPegen_expect_token(p, 12))
4274 &&
4275 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004276 )
4277 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004278 res = _PyPegen_name_default_pair ( p , a , c , tc );
4279 if (res == NULL && PyErr_Occurred()) {
4280 p->error_indicator = 1;
4281 return NULL;
4282 }
4283 goto done;
4284 }
4285 p->mark = mark;
4286 }
4287 { // param default TYPE_COMMENT? &')'
4288 arg_ty a;
4289 expr_ty c;
4290 void *tc;
4291 if (
4292 (a = param_rule(p))
4293 &&
4294 (c = default_rule(p))
4295 &&
4296 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
4297 &&
4298 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
4299 )
4300 {
4301 res = _PyPegen_name_default_pair ( p , a , c , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004302 if (res == NULL && PyErr_Occurred()) {
4303 p->error_indicator = 1;
4304 return NULL;
4305 }
4306 goto done;
4307 }
4308 p->mark = mark;
4309 }
4310 res = NULL;
4311 done:
4312 return res;
4313}
4314
Guido van Rossumc001c092020-04-30 12:12:19 -07004315// param_maybe_default:
4316// | param default? ',' TYPE_COMMENT?
4317// | param default? TYPE_COMMENT? &')'
4318static NameDefaultPair*
4319param_maybe_default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004320{
4321 if (p->error_indicator) {
4322 return NULL;
4323 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004324 NameDefaultPair* res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004325 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004326 { // param default? ',' TYPE_COMMENT?
4327 arg_ty a;
4328 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004329 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07004330 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004331 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004332 (a = param_rule(p))
4333 &&
4334 (c = default_rule(p), 1)
4335 &&
4336 (literal = _PyPegen_expect_token(p, 12))
4337 &&
4338 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004339 )
4340 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004341 res = _PyPegen_name_default_pair ( p , a , c , tc );
4342 if (res == NULL && PyErr_Occurred()) {
4343 p->error_indicator = 1;
4344 return NULL;
4345 }
4346 goto done;
4347 }
4348 p->mark = mark;
4349 }
4350 { // param default? TYPE_COMMENT? &')'
4351 arg_ty a;
4352 void *c;
4353 void *tc;
4354 if (
4355 (a = param_rule(p))
4356 &&
4357 (c = default_rule(p), 1)
4358 &&
4359 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
4360 &&
4361 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
4362 )
4363 {
4364 res = _PyPegen_name_default_pair ( p , a , c , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004365 if (res == NULL && PyErr_Occurred()) {
4366 p->error_indicator = 1;
4367 return NULL;
4368 }
4369 goto done;
4370 }
4371 p->mark = mark;
4372 }
4373 res = NULL;
4374 done:
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004375 return res;
4376}
4377
Guido van Rossumc001c092020-04-30 12:12:19 -07004378// param: NAME annotation?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004379static arg_ty
Guido van Rossumc001c092020-04-30 12:12:19 -07004380param_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004381{
4382 if (p->error_indicator) {
4383 return NULL;
4384 }
4385 arg_ty res = NULL;
4386 int mark = p->mark;
4387 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4388 p->error_indicator = 1;
4389 return NULL;
4390 }
4391 int start_lineno = p->tokens[mark]->lineno;
4392 UNUSED(start_lineno); // Only used by EXTRA macro
4393 int start_col_offset = p->tokens[mark]->col_offset;
4394 UNUSED(start_col_offset); // Only used by EXTRA macro
Guido van Rossumc001c092020-04-30 12:12:19 -07004395 { // NAME annotation?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004396 expr_ty a;
4397 void *b;
4398 if (
4399 (a = _PyPegen_name_token(p))
4400 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004401 (b = annotation_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004402 )
4403 {
4404 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4405 if (token == NULL) {
4406 return NULL;
4407 }
4408 int end_lineno = token->end_lineno;
4409 UNUSED(end_lineno); // Only used by EXTRA macro
4410 int end_col_offset = token->end_col_offset;
4411 UNUSED(end_col_offset); // Only used by EXTRA macro
4412 res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
4413 if (res == NULL && PyErr_Occurred()) {
4414 p->error_indicator = 1;
4415 return NULL;
4416 }
4417 goto done;
4418 }
4419 p->mark = mark;
4420 }
4421 res = NULL;
4422 done:
4423 return res;
4424}
4425
Guido van Rossumc001c092020-04-30 12:12:19 -07004426// annotation: ':' expression
4427static expr_ty
4428annotation_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004429{
4430 if (p->error_indicator) {
4431 return NULL;
4432 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004433 expr_ty res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004434 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004435 { // ':' expression
4436 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004437 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004438 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004439 (literal = _PyPegen_expect_token(p, 11))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004440 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004441 (a = expression_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004442 )
4443 {
4444 res = a;
4445 if (res == NULL && PyErr_Occurred()) {
4446 p->error_indicator = 1;
4447 return NULL;
4448 }
4449 goto done;
4450 }
4451 p->mark = mark;
4452 }
4453 res = NULL;
4454 done:
4455 return res;
4456}
4457
Guido van Rossumc001c092020-04-30 12:12:19 -07004458// default: '=' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004459static expr_ty
Guido van Rossumc001c092020-04-30 12:12:19 -07004460default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004461{
4462 if (p->error_indicator) {
4463 return NULL;
4464 }
4465 expr_ty res = NULL;
4466 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004467 { // '=' expression
4468 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004469 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004470 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004471 (literal = _PyPegen_expect_token(p, 22))
4472 &&
4473 (a = expression_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004474 )
4475 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004476 res = a;
4477 if (res == NULL && PyErr_Occurred()) {
4478 p->error_indicator = 1;
4479 return NULL;
4480 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004481 goto done;
4482 }
4483 p->mark = mark;
4484 }
4485 res = NULL;
4486 done:
4487 return res;
4488}
4489
4490// decorators: (('@' named_expression NEWLINE))+
4491static asdl_seq*
4492decorators_rule(Parser *p)
4493{
4494 if (p->error_indicator) {
4495 return NULL;
4496 }
4497 asdl_seq* res = NULL;
4498 int mark = p->mark;
4499 { // (('@' named_expression NEWLINE))+
4500 asdl_seq * a;
4501 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004502 (a = _loop1_67_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004503 )
4504 {
4505 res = a;
4506 if (res == NULL && PyErr_Occurred()) {
4507 p->error_indicator = 1;
4508 return NULL;
4509 }
4510 goto done;
4511 }
4512 p->mark = mark;
4513 }
4514 res = NULL;
4515 done:
4516 return res;
4517}
4518
4519// class_def: decorators class_def_raw | class_def_raw
4520static stmt_ty
4521class_def_rule(Parser *p)
4522{
4523 if (p->error_indicator) {
4524 return NULL;
4525 }
4526 stmt_ty res = NULL;
4527 int mark = p->mark;
4528 { // decorators class_def_raw
4529 asdl_seq* a;
4530 stmt_ty b;
4531 if (
4532 (a = decorators_rule(p))
4533 &&
4534 (b = class_def_raw_rule(p))
4535 )
4536 {
4537 res = _PyPegen_class_def_decorators ( p , a , b );
4538 if (res == NULL && PyErr_Occurred()) {
4539 p->error_indicator = 1;
4540 return NULL;
4541 }
4542 goto done;
4543 }
4544 p->mark = mark;
4545 }
4546 { // class_def_raw
4547 stmt_ty class_def_raw_var;
4548 if (
4549 (class_def_raw_var = class_def_raw_rule(p))
4550 )
4551 {
4552 res = class_def_raw_var;
4553 goto done;
4554 }
4555 p->mark = mark;
4556 }
4557 res = NULL;
4558 done:
4559 return res;
4560}
4561
4562// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
4563static stmt_ty
4564class_def_raw_rule(Parser *p)
4565{
4566 if (p->error_indicator) {
4567 return NULL;
4568 }
4569 stmt_ty res = NULL;
4570 int mark = p->mark;
4571 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4572 p->error_indicator = 1;
4573 return NULL;
4574 }
4575 int start_lineno = p->tokens[mark]->lineno;
4576 UNUSED(start_lineno); // Only used by EXTRA macro
4577 int start_col_offset = p->tokens[mark]->col_offset;
4578 UNUSED(start_col_offset); // Only used by EXTRA macro
4579 { // 'class' NAME ['(' arguments? ')'] ':' block
4580 expr_ty a;
4581 void *b;
4582 asdl_seq* c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004583 Token * keyword;
4584 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004585 if (
4586 (keyword = _PyPegen_expect_token(p, 523))
4587 &&
4588 (a = _PyPegen_name_token(p))
4589 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004590 (b = _tmp_68_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004591 &&
4592 (literal = _PyPegen_expect_token(p, 11))
4593 &&
4594 (c = block_rule(p))
4595 )
4596 {
4597 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4598 if (token == NULL) {
4599 return NULL;
4600 }
4601 int end_lineno = token->end_lineno;
4602 UNUSED(end_lineno); // Only used by EXTRA macro
4603 int end_col_offset = token->end_col_offset;
4604 UNUSED(end_col_offset); // Only used by EXTRA macro
4605 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 );
4606 if (res == NULL && PyErr_Occurred()) {
4607 p->error_indicator = 1;
4608 return NULL;
4609 }
4610 goto done;
4611 }
4612 p->mark = mark;
4613 }
4614 res = NULL;
4615 done:
4616 return res;
4617}
4618
4619// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
4620static asdl_seq*
4621block_rule(Parser *p)
4622{
4623 if (p->error_indicator) {
4624 return NULL;
4625 }
4626 asdl_seq* res = NULL;
4627 if (_PyPegen_is_memoized(p, block_type, &res))
4628 return res;
4629 int mark = p->mark;
4630 { // NEWLINE INDENT statements DEDENT
4631 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004632 Token * dedent_var;
4633 Token * indent_var;
4634 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004635 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01004636 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004637 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01004638 (indent_var = _PyPegen_expect_token(p, INDENT))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004639 &&
4640 (a = statements_rule(p))
4641 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01004642 (dedent_var = _PyPegen_expect_token(p, DEDENT))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004643 )
4644 {
4645 res = a;
4646 if (res == NULL && PyErr_Occurred()) {
4647 p->error_indicator = 1;
4648 return NULL;
4649 }
4650 goto done;
4651 }
4652 p->mark = mark;
4653 }
4654 { // simple_stmt
4655 asdl_seq* simple_stmt_var;
4656 if (
4657 (simple_stmt_var = simple_stmt_rule(p))
4658 )
4659 {
4660 res = simple_stmt_var;
4661 goto done;
4662 }
4663 p->mark = mark;
4664 }
4665 { // invalid_block
4666 void *invalid_block_var;
4667 if (
4668 (invalid_block_var = invalid_block_rule(p))
4669 )
4670 {
4671 res = invalid_block_var;
4672 goto done;
4673 }
4674 p->mark = mark;
4675 }
4676 res = NULL;
4677 done:
4678 _PyPegen_insert_memo(p, mark, block_type, res);
4679 return res;
4680}
4681
4682// expressions_list: ','.star_expression+ ','?
4683static asdl_seq*
4684expressions_list_rule(Parser *p)
4685{
4686 if (p->error_indicator) {
4687 return NULL;
4688 }
4689 asdl_seq* res = NULL;
4690 int mark = p->mark;
4691 { // ','.star_expression+ ','?
4692 asdl_seq * a;
4693 void *opt_var;
4694 UNUSED(opt_var); // Silence compiler warnings
4695 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004696 (a = _gather_69_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004697 &&
4698 (opt_var = _PyPegen_expect_token(p, 12), 1)
4699 )
4700 {
4701 res = a;
4702 if (res == NULL && PyErr_Occurred()) {
4703 p->error_indicator = 1;
4704 return NULL;
4705 }
4706 goto done;
4707 }
4708 p->mark = mark;
4709 }
4710 res = NULL;
4711 done:
4712 return res;
4713}
4714
4715// star_expressions:
4716// | star_expression ((',' star_expression))+ ','?
4717// | star_expression ','
4718// | star_expression
4719static expr_ty
4720star_expressions_rule(Parser *p)
4721{
4722 if (p->error_indicator) {
4723 return NULL;
4724 }
4725 expr_ty res = NULL;
4726 int mark = p->mark;
4727 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4728 p->error_indicator = 1;
4729 return NULL;
4730 }
4731 int start_lineno = p->tokens[mark]->lineno;
4732 UNUSED(start_lineno); // Only used by EXTRA macro
4733 int start_col_offset = p->tokens[mark]->col_offset;
4734 UNUSED(start_col_offset); // Only used by EXTRA macro
4735 { // star_expression ((',' star_expression))+ ','?
4736 expr_ty a;
4737 asdl_seq * b;
4738 void *opt_var;
4739 UNUSED(opt_var); // Silence compiler warnings
4740 if (
4741 (a = star_expression_rule(p))
4742 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004743 (b = _loop1_71_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004744 &&
4745 (opt_var = _PyPegen_expect_token(p, 12), 1)
4746 )
4747 {
4748 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4749 if (token == NULL) {
4750 return NULL;
4751 }
4752 int end_lineno = token->end_lineno;
4753 UNUSED(end_lineno); // Only used by EXTRA macro
4754 int end_col_offset = token->end_col_offset;
4755 UNUSED(end_col_offset); // Only used by EXTRA macro
4756 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
4757 if (res == NULL && PyErr_Occurred()) {
4758 p->error_indicator = 1;
4759 return NULL;
4760 }
4761 goto done;
4762 }
4763 p->mark = mark;
4764 }
4765 { // star_expression ','
4766 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004767 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004768 if (
4769 (a = star_expression_rule(p))
4770 &&
4771 (literal = _PyPegen_expect_token(p, 12))
4772 )
4773 {
4774 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4775 if (token == NULL) {
4776 return NULL;
4777 }
4778 int end_lineno = token->end_lineno;
4779 UNUSED(end_lineno); // Only used by EXTRA macro
4780 int end_col_offset = token->end_col_offset;
4781 UNUSED(end_col_offset); // Only used by EXTRA macro
4782 res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
4783 if (res == NULL && PyErr_Occurred()) {
4784 p->error_indicator = 1;
4785 return NULL;
4786 }
4787 goto done;
4788 }
4789 p->mark = mark;
4790 }
4791 { // star_expression
4792 expr_ty star_expression_var;
4793 if (
4794 (star_expression_var = star_expression_rule(p))
4795 )
4796 {
4797 res = star_expression_var;
4798 goto done;
4799 }
4800 p->mark = mark;
4801 }
4802 res = NULL;
4803 done:
4804 return res;
4805}
4806
4807// star_expression: '*' bitwise_or | expression
4808static expr_ty
4809star_expression_rule(Parser *p)
4810{
4811 if (p->error_indicator) {
4812 return NULL;
4813 }
4814 expr_ty res = NULL;
4815 if (_PyPegen_is_memoized(p, star_expression_type, &res))
4816 return res;
4817 int mark = p->mark;
4818 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4819 p->error_indicator = 1;
4820 return NULL;
4821 }
4822 int start_lineno = p->tokens[mark]->lineno;
4823 UNUSED(start_lineno); // Only used by EXTRA macro
4824 int start_col_offset = p->tokens[mark]->col_offset;
4825 UNUSED(start_col_offset); // Only used by EXTRA macro
4826 { // '*' bitwise_or
4827 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004828 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004829 if (
4830 (literal = _PyPegen_expect_token(p, 16))
4831 &&
4832 (a = bitwise_or_rule(p))
4833 )
4834 {
4835 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4836 if (token == NULL) {
4837 return NULL;
4838 }
4839 int end_lineno = token->end_lineno;
4840 UNUSED(end_lineno); // Only used by EXTRA macro
4841 int end_col_offset = token->end_col_offset;
4842 UNUSED(end_col_offset); // Only used by EXTRA macro
4843 res = _Py_Starred ( a , Load , EXTRA );
4844 if (res == NULL && PyErr_Occurred()) {
4845 p->error_indicator = 1;
4846 return NULL;
4847 }
4848 goto done;
4849 }
4850 p->mark = mark;
4851 }
4852 { // expression
4853 expr_ty expression_var;
4854 if (
4855 (expression_var = expression_rule(p))
4856 )
4857 {
4858 res = expression_var;
4859 goto done;
4860 }
4861 p->mark = mark;
4862 }
4863 res = NULL;
4864 done:
4865 _PyPegen_insert_memo(p, mark, star_expression_type, res);
4866 return res;
4867}
4868
4869// star_named_expressions: ','.star_named_expression+ ','?
4870static asdl_seq*
4871star_named_expressions_rule(Parser *p)
4872{
4873 if (p->error_indicator) {
4874 return NULL;
4875 }
4876 asdl_seq* res = NULL;
4877 int mark = p->mark;
4878 { // ','.star_named_expression+ ','?
4879 asdl_seq * a;
4880 void *opt_var;
4881 UNUSED(opt_var); // Silence compiler warnings
4882 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004883 (a = _gather_72_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004884 &&
4885 (opt_var = _PyPegen_expect_token(p, 12), 1)
4886 )
4887 {
4888 res = a;
4889 if (res == NULL && PyErr_Occurred()) {
4890 p->error_indicator = 1;
4891 return NULL;
4892 }
4893 goto done;
4894 }
4895 p->mark = mark;
4896 }
4897 res = NULL;
4898 done:
4899 return res;
4900}
4901
4902// star_named_expression: '*' bitwise_or | named_expression
4903static expr_ty
4904star_named_expression_rule(Parser *p)
4905{
4906 if (p->error_indicator) {
4907 return NULL;
4908 }
4909 expr_ty res = NULL;
4910 int mark = p->mark;
4911 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4912 p->error_indicator = 1;
4913 return NULL;
4914 }
4915 int start_lineno = p->tokens[mark]->lineno;
4916 UNUSED(start_lineno); // Only used by EXTRA macro
4917 int start_col_offset = p->tokens[mark]->col_offset;
4918 UNUSED(start_col_offset); // Only used by EXTRA macro
4919 { // '*' bitwise_or
4920 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004921 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004922 if (
4923 (literal = _PyPegen_expect_token(p, 16))
4924 &&
4925 (a = bitwise_or_rule(p))
4926 )
4927 {
4928 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4929 if (token == NULL) {
4930 return NULL;
4931 }
4932 int end_lineno = token->end_lineno;
4933 UNUSED(end_lineno); // Only used by EXTRA macro
4934 int end_col_offset = token->end_col_offset;
4935 UNUSED(end_col_offset); // Only used by EXTRA macro
4936 res = _Py_Starred ( a , Load , EXTRA );
4937 if (res == NULL && PyErr_Occurred()) {
4938 p->error_indicator = 1;
4939 return NULL;
4940 }
4941 goto done;
4942 }
4943 p->mark = mark;
4944 }
4945 { // named_expression
4946 expr_ty named_expression_var;
4947 if (
4948 (named_expression_var = named_expression_rule(p))
4949 )
4950 {
4951 res = named_expression_var;
4952 goto done;
4953 }
4954 p->mark = mark;
4955 }
4956 res = NULL;
4957 done:
4958 return res;
4959}
4960
4961// named_expression: NAME ':=' expression | expression !':=' | invalid_named_expression
4962static expr_ty
4963named_expression_rule(Parser *p)
4964{
4965 if (p->error_indicator) {
4966 return NULL;
4967 }
4968 expr_ty res = NULL;
4969 int mark = p->mark;
4970 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4971 p->error_indicator = 1;
4972 return NULL;
4973 }
4974 int start_lineno = p->tokens[mark]->lineno;
4975 UNUSED(start_lineno); // Only used by EXTRA macro
4976 int start_col_offset = p->tokens[mark]->col_offset;
4977 UNUSED(start_col_offset); // Only used by EXTRA macro
4978 { // NAME ':=' expression
4979 expr_ty a;
4980 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004981 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004982 if (
4983 (a = _PyPegen_name_token(p))
4984 &&
4985 (literal = _PyPegen_expect_token(p, 53))
4986 &&
4987 (b = expression_rule(p))
4988 )
4989 {
4990 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4991 if (token == NULL) {
4992 return NULL;
4993 }
4994 int end_lineno = token->end_lineno;
4995 UNUSED(end_lineno); // Only used by EXTRA macro
4996 int end_col_offset = token->end_col_offset;
4997 UNUSED(end_col_offset); // Only used by EXTRA macro
4998 res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
4999 if (res == NULL && PyErr_Occurred()) {
5000 p->error_indicator = 1;
5001 return NULL;
5002 }
5003 goto done;
5004 }
5005 p->mark = mark;
5006 }
5007 { // expression !':='
5008 expr_ty expression_var;
5009 if (
5010 (expression_var = expression_rule(p))
5011 &&
5012 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53)
5013 )
5014 {
5015 res = expression_var;
5016 goto done;
5017 }
5018 p->mark = mark;
5019 }
5020 { // invalid_named_expression
5021 void *invalid_named_expression_var;
5022 if (
5023 (invalid_named_expression_var = invalid_named_expression_rule(p))
5024 )
5025 {
5026 res = invalid_named_expression_var;
5027 goto done;
5028 }
5029 p->mark = mark;
5030 }
5031 res = NULL;
5032 done:
5033 return res;
5034}
5035
5036// annotated_rhs: yield_expr | star_expressions
5037static expr_ty
5038annotated_rhs_rule(Parser *p)
5039{
5040 if (p->error_indicator) {
5041 return NULL;
5042 }
5043 expr_ty res = NULL;
5044 int mark = p->mark;
5045 { // yield_expr
5046 expr_ty yield_expr_var;
5047 if (
5048 (yield_expr_var = yield_expr_rule(p))
5049 )
5050 {
5051 res = yield_expr_var;
5052 goto done;
5053 }
5054 p->mark = mark;
5055 }
5056 { // star_expressions
5057 expr_ty star_expressions_var;
5058 if (
5059 (star_expressions_var = star_expressions_rule(p))
5060 )
5061 {
5062 res = star_expressions_var;
5063 goto done;
5064 }
5065 p->mark = mark;
5066 }
5067 res = NULL;
5068 done:
5069 return res;
5070}
5071
5072// expressions: expression ((',' expression))+ ','? | expression ',' | expression
5073static expr_ty
5074expressions_rule(Parser *p)
5075{
5076 if (p->error_indicator) {
5077 return NULL;
5078 }
5079 expr_ty res = NULL;
5080 int mark = p->mark;
5081 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5082 p->error_indicator = 1;
5083 return NULL;
5084 }
5085 int start_lineno = p->tokens[mark]->lineno;
5086 UNUSED(start_lineno); // Only used by EXTRA macro
5087 int start_col_offset = p->tokens[mark]->col_offset;
5088 UNUSED(start_col_offset); // Only used by EXTRA macro
5089 { // expression ((',' expression))+ ','?
5090 expr_ty a;
5091 asdl_seq * b;
5092 void *opt_var;
5093 UNUSED(opt_var); // Silence compiler warnings
5094 if (
5095 (a = expression_rule(p))
5096 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03005097 (b = _loop1_74_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005098 &&
5099 (opt_var = _PyPegen_expect_token(p, 12), 1)
5100 )
5101 {
5102 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5103 if (token == NULL) {
5104 return NULL;
5105 }
5106 int end_lineno = token->end_lineno;
5107 UNUSED(end_lineno); // Only used by EXTRA macro
5108 int end_col_offset = token->end_col_offset;
5109 UNUSED(end_col_offset); // Only used by EXTRA macro
5110 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
5111 if (res == NULL && PyErr_Occurred()) {
5112 p->error_indicator = 1;
5113 return NULL;
5114 }
5115 goto done;
5116 }
5117 p->mark = mark;
5118 }
5119 { // expression ','
5120 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005121 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005122 if (
5123 (a = expression_rule(p))
5124 &&
5125 (literal = _PyPegen_expect_token(p, 12))
5126 )
5127 {
5128 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5129 if (token == NULL) {
5130 return NULL;
5131 }
5132 int end_lineno = token->end_lineno;
5133 UNUSED(end_lineno); // Only used by EXTRA macro
5134 int end_col_offset = token->end_col_offset;
5135 UNUSED(end_col_offset); // Only used by EXTRA macro
5136 res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
5137 if (res == NULL && PyErr_Occurred()) {
5138 p->error_indicator = 1;
5139 return NULL;
5140 }
5141 goto done;
5142 }
5143 p->mark = mark;
5144 }
5145 { // expression
5146 expr_ty expression_var;
5147 if (
5148 (expression_var = expression_rule(p))
5149 )
5150 {
5151 res = expression_var;
5152 goto done;
5153 }
5154 p->mark = mark;
5155 }
5156 res = NULL;
5157 done:
5158 return res;
5159}
5160
5161// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
5162static expr_ty
5163expression_rule(Parser *p)
5164{
5165 if (p->error_indicator) {
5166 return NULL;
5167 }
5168 expr_ty res = NULL;
5169 if (_PyPegen_is_memoized(p, expression_type, &res))
5170 return res;
5171 int mark = p->mark;
5172 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5173 p->error_indicator = 1;
5174 return NULL;
5175 }
5176 int start_lineno = p->tokens[mark]->lineno;
5177 UNUSED(start_lineno); // Only used by EXTRA macro
5178 int start_col_offset = p->tokens[mark]->col_offset;
5179 UNUSED(start_col_offset); // Only used by EXTRA macro
5180 { // disjunction 'if' disjunction 'else' expression
5181 expr_ty a;
5182 expr_ty b;
5183 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005184 Token * keyword;
5185 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005186 if (
5187 (a = disjunction_rule(p))
5188 &&
5189 (keyword = _PyPegen_expect_token(p, 510))
5190 &&
5191 (b = disjunction_rule(p))
5192 &&
5193 (keyword_1 = _PyPegen_expect_token(p, 516))
5194 &&
5195 (c = expression_rule(p))
5196 )
5197 {
5198 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5199 if (token == NULL) {
5200 return NULL;
5201 }
5202 int end_lineno = token->end_lineno;
5203 UNUSED(end_lineno); // Only used by EXTRA macro
5204 int end_col_offset = token->end_col_offset;
5205 UNUSED(end_col_offset); // Only used by EXTRA macro
5206 res = _Py_IfExp ( b , a , c , EXTRA );
5207 if (res == NULL && PyErr_Occurred()) {
5208 p->error_indicator = 1;
5209 return NULL;
5210 }
5211 goto done;
5212 }
5213 p->mark = mark;
5214 }
5215 { // disjunction
5216 expr_ty disjunction_var;
5217 if (
5218 (disjunction_var = disjunction_rule(p))
5219 )
5220 {
5221 res = disjunction_var;
5222 goto done;
5223 }
5224 p->mark = mark;
5225 }
5226 { // lambdef
5227 expr_ty lambdef_var;
5228 if (
5229 (lambdef_var = lambdef_rule(p))
5230 )
5231 {
5232 res = lambdef_var;
5233 goto done;
5234 }
5235 p->mark = mark;
5236 }
5237 res = NULL;
5238 done:
5239 _PyPegen_insert_memo(p, mark, expression_type, res);
5240 return res;
5241}
5242
5243// lambdef: 'lambda' lambda_parameters? ':' expression
5244static expr_ty
5245lambdef_rule(Parser *p)
5246{
5247 if (p->error_indicator) {
5248 return NULL;
5249 }
5250 expr_ty res = NULL;
5251 int mark = p->mark;
5252 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5253 p->error_indicator = 1;
5254 return NULL;
5255 }
5256 int start_lineno = p->tokens[mark]->lineno;
5257 UNUSED(start_lineno); // Only used by EXTRA macro
5258 int start_col_offset = p->tokens[mark]->col_offset;
5259 UNUSED(start_col_offset); // Only used by EXTRA macro
5260 { // 'lambda' lambda_parameters? ':' expression
5261 void *a;
5262 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005263 Token * keyword;
5264 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005265 if (
5266 (keyword = _PyPegen_expect_token(p, 524))
5267 &&
5268 (a = lambda_parameters_rule(p), 1)
5269 &&
5270 (literal = _PyPegen_expect_token(p, 11))
5271 &&
5272 (b = expression_rule(p))
5273 )
5274 {
5275 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5276 if (token == NULL) {
5277 return NULL;
5278 }
5279 int end_lineno = token->end_lineno;
5280 UNUSED(end_lineno); // Only used by EXTRA macro
5281 int end_col_offset = token->end_col_offset;
5282 UNUSED(end_col_offset); // Only used by EXTRA macro
5283 res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
5284 if (res == NULL && PyErr_Occurred()) {
5285 p->error_indicator = 1;
5286 return NULL;
5287 }
5288 goto done;
5289 }
5290 p->mark = mark;
5291 }
5292 res = NULL;
5293 done:
5294 return res;
5295}
5296
5297// lambda_parameters:
Guido van Rossum3941d972020-05-01 09:42:03 -07005298// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
5299// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
5300// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
5301// | lambda_param_with_default+ lambda_star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005302// | lambda_star_etc
5303static arguments_ty
5304lambda_parameters_rule(Parser *p)
5305{
5306 if (p->error_indicator) {
5307 return NULL;
5308 }
5309 arguments_ty res = NULL;
5310 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -07005311 { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005312 asdl_seq* a;
Guido van Rossum3941d972020-05-01 09:42:03 -07005313 asdl_seq * b;
5314 asdl_seq * c;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005315 void *d;
5316 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07005317 (a = lambda_slash_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005318 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005319 (b = _loop0_75_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005320 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005321 (c = _loop0_76_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005322 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005323 (d = lambda_star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005324 )
5325 {
5326 res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
5327 if (res == NULL && PyErr_Occurred()) {
5328 p->error_indicator = 1;
5329 return NULL;
5330 }
5331 goto done;
5332 }
5333 p->mark = mark;
5334 }
Guido van Rossum3941d972020-05-01 09:42:03 -07005335 { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005336 SlashWithDefault* a;
Guido van Rossum3941d972020-05-01 09:42:03 -07005337 asdl_seq * b;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005338 void *c;
5339 if (
5340 (a = lambda_slash_with_default_rule(p))
5341 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005342 (b = _loop0_77_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005343 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005344 (c = lambda_star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005345 )
5346 {
5347 res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
5348 if (res == NULL && PyErr_Occurred()) {
5349 p->error_indicator = 1;
5350 return NULL;
5351 }
5352 goto done;
5353 }
5354 p->mark = mark;
5355 }
Guido van Rossum3941d972020-05-01 09:42:03 -07005356 { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
5357 asdl_seq * a;
5358 asdl_seq * b;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005359 void *c;
5360 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07005361 (a = _loop1_78_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005362 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005363 (b = _loop0_79_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005364 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005365 (c = lambda_star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005366 )
5367 {
5368 res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
5369 if (res == NULL && PyErr_Occurred()) {
5370 p->error_indicator = 1;
5371 return NULL;
5372 }
5373 goto done;
5374 }
5375 p->mark = mark;
5376 }
Guido van Rossum3941d972020-05-01 09:42:03 -07005377 { // lambda_param_with_default+ lambda_star_etc?
5378 asdl_seq * a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005379 void *b;
5380 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07005381 (a = _loop1_80_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005382 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005383 (b = lambda_star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005384 )
5385 {
5386 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
5387 if (res == NULL && PyErr_Occurred()) {
5388 p->error_indicator = 1;
5389 return NULL;
5390 }
5391 goto done;
5392 }
5393 p->mark = mark;
5394 }
5395 { // lambda_star_etc
5396 StarEtc* a;
5397 if (
5398 (a = lambda_star_etc_rule(p))
5399 )
5400 {
5401 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
5402 if (res == NULL && PyErr_Occurred()) {
5403 p->error_indicator = 1;
5404 return NULL;
5405 }
5406 goto done;
5407 }
5408 p->mark = mark;
5409 }
5410 res = NULL;
5411 done:
5412 return res;
5413}
5414
Guido van Rossum3941d972020-05-01 09:42:03 -07005415// lambda_slash_no_default:
5416// | lambda_param_no_default+ '/' ','
5417// | lambda_param_no_default+ '/' &':'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005418static asdl_seq*
Guido van Rossum3941d972020-05-01 09:42:03 -07005419lambda_slash_no_default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005420{
5421 if (p->error_indicator) {
5422 return NULL;
5423 }
5424 asdl_seq* res = NULL;
5425 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -07005426 { // lambda_param_no_default+ '/' ','
5427 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005428 Token * literal;
5429 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005430 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07005431 (a = _loop1_81_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005432 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005433 (literal = _PyPegen_expect_token(p, 17))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005434 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005435 (literal_1 = _PyPegen_expect_token(p, 12))
5436 )
5437 {
5438 res = a;
5439 if (res == NULL && PyErr_Occurred()) {
5440 p->error_indicator = 1;
5441 return NULL;
5442 }
5443 goto done;
5444 }
5445 p->mark = mark;
5446 }
5447 { // lambda_param_no_default+ '/' &':'
5448 asdl_seq * a;
5449 Token * literal;
5450 if (
5451 (a = _loop1_82_rule(p))
5452 &&
5453 (literal = _PyPegen_expect_token(p, 17))
5454 &&
5455 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005456 )
5457 {
5458 res = a;
5459 if (res == NULL && PyErr_Occurred()) {
5460 p->error_indicator = 1;
5461 return NULL;
5462 }
5463 goto done;
5464 }
5465 p->mark = mark;
5466 }
5467 res = NULL;
5468 done:
5469 return res;
5470}
5471
Guido van Rossum3941d972020-05-01 09:42:03 -07005472// lambda_slash_with_default:
5473// | lambda_param_no_default* lambda_param_with_default+ '/' ','
5474// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005475static SlashWithDefault*
5476lambda_slash_with_default_rule(Parser *p)
5477{
5478 if (p->error_indicator) {
5479 return NULL;
5480 }
5481 SlashWithDefault* res = NULL;
5482 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -07005483 { // lambda_param_no_default* lambda_param_with_default+ '/' ','
5484 asdl_seq * a;
5485 asdl_seq * b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005486 Token * literal;
5487 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005488 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07005489 (a = _loop0_83_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005490 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005491 (b = _loop1_84_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005492 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005493 (literal = _PyPegen_expect_token(p, 17))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005494 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005495 (literal_1 = _PyPegen_expect_token(p, 12))
5496 )
5497 {
5498 res = _PyPegen_slash_with_default ( p , a , b );
5499 if (res == NULL && PyErr_Occurred()) {
5500 p->error_indicator = 1;
5501 return NULL;
5502 }
5503 goto done;
5504 }
5505 p->mark = mark;
5506 }
5507 { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
5508 asdl_seq * a;
5509 asdl_seq * b;
5510 Token * literal;
5511 if (
5512 (a = _loop0_85_rule(p))
5513 &&
5514 (b = _loop1_86_rule(p))
5515 &&
5516 (literal = _PyPegen_expect_token(p, 17))
5517 &&
5518 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005519 )
5520 {
5521 res = _PyPegen_slash_with_default ( p , a , b );
5522 if (res == NULL && PyErr_Occurred()) {
5523 p->error_indicator = 1;
5524 return NULL;
5525 }
5526 goto done;
5527 }
5528 p->mark = mark;
5529 }
5530 res = NULL;
5531 done:
5532 return res;
5533}
5534
5535// lambda_star_etc:
Guido van Rossum3941d972020-05-01 09:42:03 -07005536// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
5537// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
5538// | lambda_kwds
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +03005539// | invalid_lambda_star_etc
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005540static StarEtc*
5541lambda_star_etc_rule(Parser *p)
5542{
5543 if (p->error_indicator) {
5544 return NULL;
5545 }
5546 StarEtc* res = NULL;
5547 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -07005548 { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005549 arg_ty a;
5550 asdl_seq * b;
5551 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005552 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005553 if (
5554 (literal = _PyPegen_expect_token(p, 16))
5555 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005556 (a = lambda_param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005557 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005558 (b = _loop0_87_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005559 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005560 (c = lambda_kwds_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005561 )
5562 {
5563 res = _PyPegen_star_etc ( p , a , b , c );
5564 if (res == NULL && PyErr_Occurred()) {
5565 p->error_indicator = 1;
5566 return NULL;
5567 }
5568 goto done;
5569 }
5570 p->mark = mark;
5571 }
Guido van Rossum3941d972020-05-01 09:42:03 -07005572 { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005573 asdl_seq * b;
5574 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005575 Token * literal;
Guido van Rossum3941d972020-05-01 09:42:03 -07005576 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005577 if (
5578 (literal = _PyPegen_expect_token(p, 16))
5579 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005580 (literal_1 = _PyPegen_expect_token(p, 12))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005581 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005582 (b = _loop1_88_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005583 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005584 (c = lambda_kwds_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005585 )
5586 {
5587 res = _PyPegen_star_etc ( p , NULL , b , c );
5588 if (res == NULL && PyErr_Occurred()) {
5589 p->error_indicator = 1;
5590 return NULL;
5591 }
5592 goto done;
5593 }
5594 p->mark = mark;
5595 }
Guido van Rossum3941d972020-05-01 09:42:03 -07005596 { // lambda_kwds
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005597 arg_ty a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005598 if (
5599 (a = lambda_kwds_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005600 )
5601 {
5602 res = _PyPegen_star_etc ( p , NULL , NULL , a );
5603 if (res == NULL && PyErr_Occurred()) {
5604 p->error_indicator = 1;
5605 return NULL;
5606 }
5607 goto done;
5608 }
5609 p->mark = mark;
5610 }
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +03005611 { // invalid_lambda_star_etc
5612 void *invalid_lambda_star_etc_var;
5613 if (
5614 (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p))
5615 )
5616 {
5617 res = invalid_lambda_star_etc_var;
5618 goto done;
5619 }
5620 p->mark = mark;
5621 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005622 res = NULL;
5623 done:
5624 return res;
5625}
5626
Guido van Rossum3941d972020-05-01 09:42:03 -07005627// lambda_kwds: '**' lambda_param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005628static arg_ty
Guido van Rossum3941d972020-05-01 09:42:03 -07005629lambda_kwds_rule(Parser *p)
5630{
5631 if (p->error_indicator) {
5632 return NULL;
5633 }
5634 arg_ty res = NULL;
5635 int mark = p->mark;
5636 { // '**' lambda_param_no_default
5637 arg_ty a;
5638 Token * literal;
5639 if (
5640 (literal = _PyPegen_expect_token(p, 35))
5641 &&
5642 (a = lambda_param_no_default_rule(p))
5643 )
5644 {
5645 res = a;
5646 if (res == NULL && PyErr_Occurred()) {
5647 p->error_indicator = 1;
5648 return NULL;
5649 }
5650 goto done;
5651 }
5652 p->mark = mark;
5653 }
5654 res = NULL;
5655 done:
5656 return res;
5657}
5658
5659// lambda_param_no_default: lambda_param ',' | lambda_param &':'
5660static arg_ty
5661lambda_param_no_default_rule(Parser *p)
5662{
5663 if (p->error_indicator) {
5664 return NULL;
5665 }
5666 arg_ty res = NULL;
5667 int mark = p->mark;
5668 { // lambda_param ','
5669 arg_ty a;
5670 Token * literal;
5671 if (
5672 (a = lambda_param_rule(p))
5673 &&
5674 (literal = _PyPegen_expect_token(p, 12))
5675 )
5676 {
5677 res = a;
5678 if (res == NULL && PyErr_Occurred()) {
5679 p->error_indicator = 1;
5680 return NULL;
5681 }
5682 goto done;
5683 }
5684 p->mark = mark;
5685 }
5686 { // lambda_param &':'
5687 arg_ty a;
5688 if (
5689 (a = lambda_param_rule(p))
5690 &&
5691 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)
5692 )
5693 {
5694 res = a;
5695 if (res == NULL && PyErr_Occurred()) {
5696 p->error_indicator = 1;
5697 return NULL;
5698 }
5699 goto done;
5700 }
5701 p->mark = mark;
5702 }
5703 res = NULL;
5704 done:
5705 return res;
5706}
5707
5708// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
5709static NameDefaultPair*
5710lambda_param_with_default_rule(Parser *p)
5711{
5712 if (p->error_indicator) {
5713 return NULL;
5714 }
5715 NameDefaultPair* res = NULL;
5716 int mark = p->mark;
5717 { // lambda_param default ','
5718 arg_ty a;
5719 expr_ty c;
5720 Token * literal;
5721 if (
5722 (a = lambda_param_rule(p))
5723 &&
5724 (c = default_rule(p))
5725 &&
5726 (literal = _PyPegen_expect_token(p, 12))
5727 )
5728 {
5729 res = _PyPegen_name_default_pair ( p , a , c , NULL );
5730 if (res == NULL && PyErr_Occurred()) {
5731 p->error_indicator = 1;
5732 return NULL;
5733 }
5734 goto done;
5735 }
5736 p->mark = mark;
5737 }
5738 { // lambda_param default &':'
5739 arg_ty a;
5740 expr_ty c;
5741 if (
5742 (a = lambda_param_rule(p))
5743 &&
5744 (c = default_rule(p))
5745 &&
5746 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)
5747 )
5748 {
5749 res = _PyPegen_name_default_pair ( p , a , c , NULL );
5750 if (res == NULL && PyErr_Occurred()) {
5751 p->error_indicator = 1;
5752 return NULL;
5753 }
5754 goto done;
5755 }
5756 p->mark = mark;
5757 }
5758 res = NULL;
5759 done:
5760 return res;
5761}
5762
5763// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
5764static NameDefaultPair*
5765lambda_param_maybe_default_rule(Parser *p)
5766{
5767 if (p->error_indicator) {
5768 return NULL;
5769 }
5770 NameDefaultPair* res = NULL;
5771 int mark = p->mark;
5772 { // lambda_param default? ','
5773 arg_ty a;
5774 void *c;
5775 Token * literal;
5776 if (
5777 (a = lambda_param_rule(p))
5778 &&
5779 (c = default_rule(p), 1)
5780 &&
5781 (literal = _PyPegen_expect_token(p, 12))
5782 )
5783 {
5784 res = _PyPegen_name_default_pair ( p , a , c , NULL );
5785 if (res == NULL && PyErr_Occurred()) {
5786 p->error_indicator = 1;
5787 return NULL;
5788 }
5789 goto done;
5790 }
5791 p->mark = mark;
5792 }
5793 { // lambda_param default? &':'
5794 arg_ty a;
5795 void *c;
5796 if (
5797 (a = lambda_param_rule(p))
5798 &&
5799 (c = default_rule(p), 1)
5800 &&
5801 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)
5802 )
5803 {
5804 res = _PyPegen_name_default_pair ( p , a , c , NULL );
5805 if (res == NULL && PyErr_Occurred()) {
5806 p->error_indicator = 1;
5807 return NULL;
5808 }
5809 goto done;
5810 }
5811 p->mark = mark;
5812 }
5813 res = NULL;
5814 done:
5815 return res;
5816}
5817
5818// lambda_param: NAME
5819static arg_ty
5820lambda_param_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005821{
5822 if (p->error_indicator) {
5823 return NULL;
5824 }
5825 arg_ty res = NULL;
5826 int mark = p->mark;
5827 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5828 p->error_indicator = 1;
5829 return NULL;
5830 }
5831 int start_lineno = p->tokens[mark]->lineno;
5832 UNUSED(start_lineno); // Only used by EXTRA macro
5833 int start_col_offset = p->tokens[mark]->col_offset;
5834 UNUSED(start_col_offset); // Only used by EXTRA macro
5835 { // NAME
5836 expr_ty a;
5837 if (
5838 (a = _PyPegen_name_token(p))
5839 )
5840 {
5841 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5842 if (token == NULL) {
5843 return NULL;
5844 }
5845 int end_lineno = token->end_lineno;
5846 UNUSED(end_lineno); // Only used by EXTRA macro
5847 int end_col_offset = token->end_col_offset;
5848 UNUSED(end_col_offset); // Only used by EXTRA macro
5849 res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
5850 if (res == NULL && PyErr_Occurred()) {
5851 p->error_indicator = 1;
5852 return NULL;
5853 }
5854 goto done;
5855 }
5856 p->mark = mark;
5857 }
5858 res = NULL;
5859 done:
5860 return res;
5861}
5862
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005863// disjunction: conjunction (('or' conjunction))+ | conjunction
5864static expr_ty
5865disjunction_rule(Parser *p)
5866{
5867 if (p->error_indicator) {
5868 return NULL;
5869 }
5870 expr_ty res = NULL;
5871 if (_PyPegen_is_memoized(p, disjunction_type, &res))
5872 return res;
5873 int mark = p->mark;
5874 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5875 p->error_indicator = 1;
5876 return NULL;
5877 }
5878 int start_lineno = p->tokens[mark]->lineno;
5879 UNUSED(start_lineno); // Only used by EXTRA macro
5880 int start_col_offset = p->tokens[mark]->col_offset;
5881 UNUSED(start_col_offset); // Only used by EXTRA macro
5882 { // conjunction (('or' conjunction))+
5883 expr_ty a;
5884 asdl_seq * b;
5885 if (
5886 (a = conjunction_rule(p))
5887 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005888 (b = _loop1_89_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005889 )
5890 {
5891 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5892 if (token == NULL) {
5893 return NULL;
5894 }
5895 int end_lineno = token->end_lineno;
5896 UNUSED(end_lineno); // Only used by EXTRA macro
5897 int end_col_offset = token->end_col_offset;
5898 UNUSED(end_col_offset); // Only used by EXTRA macro
5899 res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
5900 if (res == NULL && PyErr_Occurred()) {
5901 p->error_indicator = 1;
5902 return NULL;
5903 }
5904 goto done;
5905 }
5906 p->mark = mark;
5907 }
5908 { // conjunction
5909 expr_ty conjunction_var;
5910 if (
5911 (conjunction_var = conjunction_rule(p))
5912 )
5913 {
5914 res = conjunction_var;
5915 goto done;
5916 }
5917 p->mark = mark;
5918 }
5919 res = NULL;
5920 done:
5921 _PyPegen_insert_memo(p, mark, disjunction_type, res);
5922 return res;
5923}
5924
5925// conjunction: inversion (('and' inversion))+ | inversion
5926static expr_ty
5927conjunction_rule(Parser *p)
5928{
5929 if (p->error_indicator) {
5930 return NULL;
5931 }
5932 expr_ty res = NULL;
5933 if (_PyPegen_is_memoized(p, conjunction_type, &res))
5934 return res;
5935 int mark = p->mark;
5936 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5937 p->error_indicator = 1;
5938 return NULL;
5939 }
5940 int start_lineno = p->tokens[mark]->lineno;
5941 UNUSED(start_lineno); // Only used by EXTRA macro
5942 int start_col_offset = p->tokens[mark]->col_offset;
5943 UNUSED(start_col_offset); // Only used by EXTRA macro
5944 { // inversion (('and' inversion))+
5945 expr_ty a;
5946 asdl_seq * b;
5947 if (
5948 (a = inversion_rule(p))
5949 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005950 (b = _loop1_90_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005951 )
5952 {
5953 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5954 if (token == NULL) {
5955 return NULL;
5956 }
5957 int end_lineno = token->end_lineno;
5958 UNUSED(end_lineno); // Only used by EXTRA macro
5959 int end_col_offset = token->end_col_offset;
5960 UNUSED(end_col_offset); // Only used by EXTRA macro
5961 res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
5962 if (res == NULL && PyErr_Occurred()) {
5963 p->error_indicator = 1;
5964 return NULL;
5965 }
5966 goto done;
5967 }
5968 p->mark = mark;
5969 }
5970 { // inversion
5971 expr_ty inversion_var;
5972 if (
5973 (inversion_var = inversion_rule(p))
5974 )
5975 {
5976 res = inversion_var;
5977 goto done;
5978 }
5979 p->mark = mark;
5980 }
5981 res = NULL;
5982 done:
5983 _PyPegen_insert_memo(p, mark, conjunction_type, res);
5984 return res;
5985}
5986
5987// inversion: 'not' inversion | comparison
5988static expr_ty
5989inversion_rule(Parser *p)
5990{
5991 if (p->error_indicator) {
5992 return NULL;
5993 }
5994 expr_ty res = NULL;
5995 if (_PyPegen_is_memoized(p, inversion_type, &res))
5996 return res;
5997 int mark = p->mark;
5998 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5999 p->error_indicator = 1;
6000 return NULL;
6001 }
6002 int start_lineno = p->tokens[mark]->lineno;
6003 UNUSED(start_lineno); // Only used by EXTRA macro
6004 int start_col_offset = p->tokens[mark]->col_offset;
6005 UNUSED(start_col_offset); // Only used by EXTRA macro
6006 { // 'not' inversion
6007 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006008 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006009 if (
6010 (keyword = _PyPegen_expect_token(p, 525))
6011 &&
6012 (a = inversion_rule(p))
6013 )
6014 {
6015 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6016 if (token == NULL) {
6017 return NULL;
6018 }
6019 int end_lineno = token->end_lineno;
6020 UNUSED(end_lineno); // Only used by EXTRA macro
6021 int end_col_offset = token->end_col_offset;
6022 UNUSED(end_col_offset); // Only used by EXTRA macro
6023 res = _Py_UnaryOp ( Not , a , EXTRA );
6024 if (res == NULL && PyErr_Occurred()) {
6025 p->error_indicator = 1;
6026 return NULL;
6027 }
6028 goto done;
6029 }
6030 p->mark = mark;
6031 }
6032 { // comparison
6033 expr_ty comparison_var;
6034 if (
6035 (comparison_var = comparison_rule(p))
6036 )
6037 {
6038 res = comparison_var;
6039 goto done;
6040 }
6041 p->mark = mark;
6042 }
6043 res = NULL;
6044 done:
6045 _PyPegen_insert_memo(p, mark, inversion_type, res);
6046 return res;
6047}
6048
6049// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
6050static expr_ty
6051comparison_rule(Parser *p)
6052{
6053 if (p->error_indicator) {
6054 return NULL;
6055 }
6056 expr_ty res = NULL;
6057 int mark = p->mark;
6058 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6059 p->error_indicator = 1;
6060 return NULL;
6061 }
6062 int start_lineno = p->tokens[mark]->lineno;
6063 UNUSED(start_lineno); // Only used by EXTRA macro
6064 int start_col_offset = p->tokens[mark]->col_offset;
6065 UNUSED(start_col_offset); // Only used by EXTRA macro
6066 { // bitwise_or compare_op_bitwise_or_pair+
6067 expr_ty a;
6068 asdl_seq * b;
6069 if (
6070 (a = bitwise_or_rule(p))
6071 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07006072 (b = _loop1_91_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006073 )
6074 {
6075 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6076 if (token == NULL) {
6077 return NULL;
6078 }
6079 int end_lineno = token->end_lineno;
6080 UNUSED(end_lineno); // Only used by EXTRA macro
6081 int end_col_offset = token->end_col_offset;
6082 UNUSED(end_col_offset); // Only used by EXTRA macro
6083 res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA );
6084 if (res == NULL && PyErr_Occurred()) {
6085 p->error_indicator = 1;
6086 return NULL;
6087 }
6088 goto done;
6089 }
6090 p->mark = mark;
6091 }
6092 { // bitwise_or
6093 expr_ty bitwise_or_var;
6094 if (
6095 (bitwise_or_var = bitwise_or_rule(p))
6096 )
6097 {
6098 res = bitwise_or_var;
6099 goto done;
6100 }
6101 p->mark = mark;
6102 }
6103 res = NULL;
6104 done:
6105 return res;
6106}
6107
6108// compare_op_bitwise_or_pair:
6109// | eq_bitwise_or
6110// | noteq_bitwise_or
6111// | lte_bitwise_or
6112// | lt_bitwise_or
6113// | gte_bitwise_or
6114// | gt_bitwise_or
6115// | notin_bitwise_or
6116// | in_bitwise_or
6117// | isnot_bitwise_or
6118// | is_bitwise_or
6119static CmpopExprPair*
6120compare_op_bitwise_or_pair_rule(Parser *p)
6121{
6122 if (p->error_indicator) {
6123 return NULL;
6124 }
6125 CmpopExprPair* res = NULL;
6126 int mark = p->mark;
6127 { // eq_bitwise_or
6128 CmpopExprPair* eq_bitwise_or_var;
6129 if (
6130 (eq_bitwise_or_var = eq_bitwise_or_rule(p))
6131 )
6132 {
6133 res = eq_bitwise_or_var;
6134 goto done;
6135 }
6136 p->mark = mark;
6137 }
6138 { // noteq_bitwise_or
6139 CmpopExprPair* noteq_bitwise_or_var;
6140 if (
6141 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p))
6142 )
6143 {
6144 res = noteq_bitwise_or_var;
6145 goto done;
6146 }
6147 p->mark = mark;
6148 }
6149 { // lte_bitwise_or
6150 CmpopExprPair* lte_bitwise_or_var;
6151 if (
6152 (lte_bitwise_or_var = lte_bitwise_or_rule(p))
6153 )
6154 {
6155 res = lte_bitwise_or_var;
6156 goto done;
6157 }
6158 p->mark = mark;
6159 }
6160 { // lt_bitwise_or
6161 CmpopExprPair* lt_bitwise_or_var;
6162 if (
6163 (lt_bitwise_or_var = lt_bitwise_or_rule(p))
6164 )
6165 {
6166 res = lt_bitwise_or_var;
6167 goto done;
6168 }
6169 p->mark = mark;
6170 }
6171 { // gte_bitwise_or
6172 CmpopExprPair* gte_bitwise_or_var;
6173 if (
6174 (gte_bitwise_or_var = gte_bitwise_or_rule(p))
6175 )
6176 {
6177 res = gte_bitwise_or_var;
6178 goto done;
6179 }
6180 p->mark = mark;
6181 }
6182 { // gt_bitwise_or
6183 CmpopExprPair* gt_bitwise_or_var;
6184 if (
6185 (gt_bitwise_or_var = gt_bitwise_or_rule(p))
6186 )
6187 {
6188 res = gt_bitwise_or_var;
6189 goto done;
6190 }
6191 p->mark = mark;
6192 }
6193 { // notin_bitwise_or
6194 CmpopExprPair* notin_bitwise_or_var;
6195 if (
6196 (notin_bitwise_or_var = notin_bitwise_or_rule(p))
6197 )
6198 {
6199 res = notin_bitwise_or_var;
6200 goto done;
6201 }
6202 p->mark = mark;
6203 }
6204 { // in_bitwise_or
6205 CmpopExprPair* in_bitwise_or_var;
6206 if (
6207 (in_bitwise_or_var = in_bitwise_or_rule(p))
6208 )
6209 {
6210 res = in_bitwise_or_var;
6211 goto done;
6212 }
6213 p->mark = mark;
6214 }
6215 { // isnot_bitwise_or
6216 CmpopExprPair* isnot_bitwise_or_var;
6217 if (
6218 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p))
6219 )
6220 {
6221 res = isnot_bitwise_or_var;
6222 goto done;
6223 }
6224 p->mark = mark;
6225 }
6226 { // is_bitwise_or
6227 CmpopExprPair* is_bitwise_or_var;
6228 if (
6229 (is_bitwise_or_var = is_bitwise_or_rule(p))
6230 )
6231 {
6232 res = is_bitwise_or_var;
6233 goto done;
6234 }
6235 p->mark = mark;
6236 }
6237 res = NULL;
6238 done:
6239 return res;
6240}
6241
6242// eq_bitwise_or: '==' bitwise_or
6243static CmpopExprPair*
6244eq_bitwise_or_rule(Parser *p)
6245{
6246 if (p->error_indicator) {
6247 return NULL;
6248 }
6249 CmpopExprPair* res = NULL;
6250 int mark = p->mark;
6251 { // '==' bitwise_or
6252 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006253 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006254 if (
6255 (literal = _PyPegen_expect_token(p, 27))
6256 &&
6257 (a = bitwise_or_rule(p))
6258 )
6259 {
6260 res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
6261 if (res == NULL && PyErr_Occurred()) {
6262 p->error_indicator = 1;
6263 return NULL;
6264 }
6265 goto done;
6266 }
6267 p->mark = mark;
6268 }
6269 res = NULL;
6270 done:
6271 return res;
6272}
6273
Pablo Galindo2b74c832020-04-27 18:02:07 +01006274// noteq_bitwise_or: ('!=') bitwise_or
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006275static CmpopExprPair*
6276noteq_bitwise_or_rule(Parser *p)
6277{
6278 if (p->error_indicator) {
6279 return NULL;
6280 }
6281 CmpopExprPair* res = NULL;
6282 int mark = p->mark;
Pablo Galindo2b74c832020-04-27 18:02:07 +01006283 { // ('!=') bitwise_or
Guido van Rossum3941d972020-05-01 09:42:03 -07006284 void *_tmp_92_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006285 expr_ty a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006286 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07006287 (_tmp_92_var = _tmp_92_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006288 &&
6289 (a = bitwise_or_rule(p))
6290 )
6291 {
6292 res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
6293 if (res == NULL && PyErr_Occurred()) {
6294 p->error_indicator = 1;
6295 return NULL;
6296 }
6297 goto done;
6298 }
6299 p->mark = mark;
6300 }
6301 res = NULL;
6302 done:
6303 return res;
6304}
6305
6306// lte_bitwise_or: '<=' bitwise_or
6307static CmpopExprPair*
6308lte_bitwise_or_rule(Parser *p)
6309{
6310 if (p->error_indicator) {
6311 return NULL;
6312 }
6313 CmpopExprPair* res = NULL;
6314 int mark = p->mark;
6315 { // '<=' bitwise_or
6316 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006317 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006318 if (
6319 (literal = _PyPegen_expect_token(p, 29))
6320 &&
6321 (a = bitwise_or_rule(p))
6322 )
6323 {
6324 res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
6325 if (res == NULL && PyErr_Occurred()) {
6326 p->error_indicator = 1;
6327 return NULL;
6328 }
6329 goto done;
6330 }
6331 p->mark = mark;
6332 }
6333 res = NULL;
6334 done:
6335 return res;
6336}
6337
6338// lt_bitwise_or: '<' bitwise_or
6339static CmpopExprPair*
6340lt_bitwise_or_rule(Parser *p)
6341{
6342 if (p->error_indicator) {
6343 return NULL;
6344 }
6345 CmpopExprPair* res = NULL;
6346 int mark = p->mark;
6347 { // '<' bitwise_or
6348 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006349 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006350 if (
6351 (literal = _PyPegen_expect_token(p, 20))
6352 &&
6353 (a = bitwise_or_rule(p))
6354 )
6355 {
6356 res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
6357 if (res == NULL && PyErr_Occurred()) {
6358 p->error_indicator = 1;
6359 return NULL;
6360 }
6361 goto done;
6362 }
6363 p->mark = mark;
6364 }
6365 res = NULL;
6366 done:
6367 return res;
6368}
6369
6370// gte_bitwise_or: '>=' bitwise_or
6371static CmpopExprPair*
6372gte_bitwise_or_rule(Parser *p)
6373{
6374 if (p->error_indicator) {
6375 return NULL;
6376 }
6377 CmpopExprPair* res = NULL;
6378 int mark = p->mark;
6379 { // '>=' bitwise_or
6380 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006381 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006382 if (
6383 (literal = _PyPegen_expect_token(p, 30))
6384 &&
6385 (a = bitwise_or_rule(p))
6386 )
6387 {
6388 res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
6389 if (res == NULL && PyErr_Occurred()) {
6390 p->error_indicator = 1;
6391 return NULL;
6392 }
6393 goto done;
6394 }
6395 p->mark = mark;
6396 }
6397 res = NULL;
6398 done:
6399 return res;
6400}
6401
6402// gt_bitwise_or: '>' bitwise_or
6403static CmpopExprPair*
6404gt_bitwise_or_rule(Parser *p)
6405{
6406 if (p->error_indicator) {
6407 return NULL;
6408 }
6409 CmpopExprPair* res = NULL;
6410 int mark = p->mark;
6411 { // '>' bitwise_or
6412 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006413 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006414 if (
6415 (literal = _PyPegen_expect_token(p, 21))
6416 &&
6417 (a = bitwise_or_rule(p))
6418 )
6419 {
6420 res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
6421 if (res == NULL && PyErr_Occurred()) {
6422 p->error_indicator = 1;
6423 return NULL;
6424 }
6425 goto done;
6426 }
6427 p->mark = mark;
6428 }
6429 res = NULL;
6430 done:
6431 return res;
6432}
6433
6434// notin_bitwise_or: 'not' 'in' bitwise_or
6435static CmpopExprPair*
6436notin_bitwise_or_rule(Parser *p)
6437{
6438 if (p->error_indicator) {
6439 return NULL;
6440 }
6441 CmpopExprPair* res = NULL;
6442 int mark = p->mark;
6443 { // 'not' 'in' bitwise_or
6444 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006445 Token * keyword;
6446 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006447 if (
6448 (keyword = _PyPegen_expect_token(p, 525))
6449 &&
6450 (keyword_1 = _PyPegen_expect_token(p, 518))
6451 &&
6452 (a = bitwise_or_rule(p))
6453 )
6454 {
6455 res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
6456 if (res == NULL && PyErr_Occurred()) {
6457 p->error_indicator = 1;
6458 return NULL;
6459 }
6460 goto done;
6461 }
6462 p->mark = mark;
6463 }
6464 res = NULL;
6465 done:
6466 return res;
6467}
6468
6469// in_bitwise_or: 'in' bitwise_or
6470static CmpopExprPair*
6471in_bitwise_or_rule(Parser *p)
6472{
6473 if (p->error_indicator) {
6474 return NULL;
6475 }
6476 CmpopExprPair* res = NULL;
6477 int mark = p->mark;
6478 { // 'in' bitwise_or
6479 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006480 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006481 if (
6482 (keyword = _PyPegen_expect_token(p, 518))
6483 &&
6484 (a = bitwise_or_rule(p))
6485 )
6486 {
6487 res = _PyPegen_cmpop_expr_pair ( p , In , a );
6488 if (res == NULL && PyErr_Occurred()) {
6489 p->error_indicator = 1;
6490 return NULL;
6491 }
6492 goto done;
6493 }
6494 p->mark = mark;
6495 }
6496 res = NULL;
6497 done:
6498 return res;
6499}
6500
6501// isnot_bitwise_or: 'is' 'not' bitwise_or
6502static CmpopExprPair*
6503isnot_bitwise_or_rule(Parser *p)
6504{
6505 if (p->error_indicator) {
6506 return NULL;
6507 }
6508 CmpopExprPair* res = NULL;
6509 int mark = p->mark;
6510 { // 'is' 'not' bitwise_or
6511 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006512 Token * keyword;
6513 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006514 if (
6515 (keyword = _PyPegen_expect_token(p, 526))
6516 &&
6517 (keyword_1 = _PyPegen_expect_token(p, 525))
6518 &&
6519 (a = bitwise_or_rule(p))
6520 )
6521 {
6522 res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
6523 if (res == NULL && PyErr_Occurred()) {
6524 p->error_indicator = 1;
6525 return NULL;
6526 }
6527 goto done;
6528 }
6529 p->mark = mark;
6530 }
6531 res = NULL;
6532 done:
6533 return res;
6534}
6535
6536// is_bitwise_or: 'is' bitwise_or
6537static CmpopExprPair*
6538is_bitwise_or_rule(Parser *p)
6539{
6540 if (p->error_indicator) {
6541 return NULL;
6542 }
6543 CmpopExprPair* res = NULL;
6544 int mark = p->mark;
6545 { // 'is' bitwise_or
6546 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006547 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006548 if (
6549 (keyword = _PyPegen_expect_token(p, 526))
6550 &&
6551 (a = bitwise_or_rule(p))
6552 )
6553 {
6554 res = _PyPegen_cmpop_expr_pair ( p , Is , a );
6555 if (res == NULL && PyErr_Occurred()) {
6556 p->error_indicator = 1;
6557 return NULL;
6558 }
6559 goto done;
6560 }
6561 p->mark = mark;
6562 }
6563 res = NULL;
6564 done:
6565 return res;
6566}
6567
6568// Left-recursive
6569// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
6570static expr_ty bitwise_or_raw(Parser *);
6571static expr_ty
6572bitwise_or_rule(Parser *p)
6573{
6574 expr_ty res = NULL;
6575 if (_PyPegen_is_memoized(p, bitwise_or_type, &res))
6576 return res;
6577 int mark = p->mark;
6578 int resmark = p->mark;
6579 while (1) {
6580 int tmpvar_1 = _PyPegen_update_memo(p, mark, bitwise_or_type, res);
6581 if (tmpvar_1) {
6582 return res;
6583 }
6584 p->mark = mark;
6585 void *raw = bitwise_or_raw(p);
6586 if (raw == NULL || p->mark <= resmark)
6587 break;
6588 resmark = p->mark;
6589 res = raw;
6590 }
6591 p->mark = resmark;
6592 return res;
6593}
6594static expr_ty
6595bitwise_or_raw(Parser *p)
6596{
6597 if (p->error_indicator) {
6598 return NULL;
6599 }
6600 expr_ty res = NULL;
6601 int mark = p->mark;
6602 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6603 p->error_indicator = 1;
6604 return NULL;
6605 }
6606 int start_lineno = p->tokens[mark]->lineno;
6607 UNUSED(start_lineno); // Only used by EXTRA macro
6608 int start_col_offset = p->tokens[mark]->col_offset;
6609 UNUSED(start_col_offset); // Only used by EXTRA macro
6610 { // bitwise_or '|' bitwise_xor
6611 expr_ty a;
6612 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006613 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006614 if (
6615 (a = bitwise_or_rule(p))
6616 &&
6617 (literal = _PyPegen_expect_token(p, 18))
6618 &&
6619 (b = bitwise_xor_rule(p))
6620 )
6621 {
6622 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6623 if (token == NULL) {
6624 return NULL;
6625 }
6626 int end_lineno = token->end_lineno;
6627 UNUSED(end_lineno); // Only used by EXTRA macro
6628 int end_col_offset = token->end_col_offset;
6629 UNUSED(end_col_offset); // Only used by EXTRA macro
6630 res = _Py_BinOp ( a , BitOr , b , EXTRA );
6631 if (res == NULL && PyErr_Occurred()) {
6632 p->error_indicator = 1;
6633 return NULL;
6634 }
6635 goto done;
6636 }
6637 p->mark = mark;
6638 }
6639 { // bitwise_xor
6640 expr_ty bitwise_xor_var;
6641 if (
6642 (bitwise_xor_var = bitwise_xor_rule(p))
6643 )
6644 {
6645 res = bitwise_xor_var;
6646 goto done;
6647 }
6648 p->mark = mark;
6649 }
6650 res = NULL;
6651 done:
6652 return res;
6653}
6654
6655// Left-recursive
6656// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
6657static expr_ty bitwise_xor_raw(Parser *);
6658static expr_ty
6659bitwise_xor_rule(Parser *p)
6660{
6661 expr_ty res = NULL;
6662 if (_PyPegen_is_memoized(p, bitwise_xor_type, &res))
6663 return res;
6664 int mark = p->mark;
6665 int resmark = p->mark;
6666 while (1) {
6667 int tmpvar_2 = _PyPegen_update_memo(p, mark, bitwise_xor_type, res);
6668 if (tmpvar_2) {
6669 return res;
6670 }
6671 p->mark = mark;
6672 void *raw = bitwise_xor_raw(p);
6673 if (raw == NULL || p->mark <= resmark)
6674 break;
6675 resmark = p->mark;
6676 res = raw;
6677 }
6678 p->mark = resmark;
6679 return res;
6680}
6681static expr_ty
6682bitwise_xor_raw(Parser *p)
6683{
6684 if (p->error_indicator) {
6685 return NULL;
6686 }
6687 expr_ty res = NULL;
6688 int mark = p->mark;
6689 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6690 p->error_indicator = 1;
6691 return NULL;
6692 }
6693 int start_lineno = p->tokens[mark]->lineno;
6694 UNUSED(start_lineno); // Only used by EXTRA macro
6695 int start_col_offset = p->tokens[mark]->col_offset;
6696 UNUSED(start_col_offset); // Only used by EXTRA macro
6697 { // bitwise_xor '^' bitwise_and
6698 expr_ty a;
6699 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006700 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006701 if (
6702 (a = bitwise_xor_rule(p))
6703 &&
6704 (literal = _PyPegen_expect_token(p, 32))
6705 &&
6706 (b = bitwise_and_rule(p))
6707 )
6708 {
6709 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6710 if (token == NULL) {
6711 return NULL;
6712 }
6713 int end_lineno = token->end_lineno;
6714 UNUSED(end_lineno); // Only used by EXTRA macro
6715 int end_col_offset = token->end_col_offset;
6716 UNUSED(end_col_offset); // Only used by EXTRA macro
6717 res = _Py_BinOp ( a , BitXor , b , EXTRA );
6718 if (res == NULL && PyErr_Occurred()) {
6719 p->error_indicator = 1;
6720 return NULL;
6721 }
6722 goto done;
6723 }
6724 p->mark = mark;
6725 }
6726 { // bitwise_and
6727 expr_ty bitwise_and_var;
6728 if (
6729 (bitwise_and_var = bitwise_and_rule(p))
6730 )
6731 {
6732 res = bitwise_and_var;
6733 goto done;
6734 }
6735 p->mark = mark;
6736 }
6737 res = NULL;
6738 done:
6739 return res;
6740}
6741
6742// Left-recursive
6743// bitwise_and: bitwise_and '&' shift_expr | shift_expr
6744static expr_ty bitwise_and_raw(Parser *);
6745static expr_ty
6746bitwise_and_rule(Parser *p)
6747{
6748 expr_ty res = NULL;
6749 if (_PyPegen_is_memoized(p, bitwise_and_type, &res))
6750 return res;
6751 int mark = p->mark;
6752 int resmark = p->mark;
6753 while (1) {
6754 int tmpvar_3 = _PyPegen_update_memo(p, mark, bitwise_and_type, res);
6755 if (tmpvar_3) {
6756 return res;
6757 }
6758 p->mark = mark;
6759 void *raw = bitwise_and_raw(p);
6760 if (raw == NULL || p->mark <= resmark)
6761 break;
6762 resmark = p->mark;
6763 res = raw;
6764 }
6765 p->mark = resmark;
6766 return res;
6767}
6768static expr_ty
6769bitwise_and_raw(Parser *p)
6770{
6771 if (p->error_indicator) {
6772 return NULL;
6773 }
6774 expr_ty res = NULL;
6775 int mark = p->mark;
6776 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6777 p->error_indicator = 1;
6778 return NULL;
6779 }
6780 int start_lineno = p->tokens[mark]->lineno;
6781 UNUSED(start_lineno); // Only used by EXTRA macro
6782 int start_col_offset = p->tokens[mark]->col_offset;
6783 UNUSED(start_col_offset); // Only used by EXTRA macro
6784 { // bitwise_and '&' shift_expr
6785 expr_ty a;
6786 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006787 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006788 if (
6789 (a = bitwise_and_rule(p))
6790 &&
6791 (literal = _PyPegen_expect_token(p, 19))
6792 &&
6793 (b = shift_expr_rule(p))
6794 )
6795 {
6796 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6797 if (token == NULL) {
6798 return NULL;
6799 }
6800 int end_lineno = token->end_lineno;
6801 UNUSED(end_lineno); // Only used by EXTRA macro
6802 int end_col_offset = token->end_col_offset;
6803 UNUSED(end_col_offset); // Only used by EXTRA macro
6804 res = _Py_BinOp ( a , BitAnd , b , EXTRA );
6805 if (res == NULL && PyErr_Occurred()) {
6806 p->error_indicator = 1;
6807 return NULL;
6808 }
6809 goto done;
6810 }
6811 p->mark = mark;
6812 }
6813 { // shift_expr
6814 expr_ty shift_expr_var;
6815 if (
6816 (shift_expr_var = shift_expr_rule(p))
6817 )
6818 {
6819 res = shift_expr_var;
6820 goto done;
6821 }
6822 p->mark = mark;
6823 }
6824 res = NULL;
6825 done:
6826 return res;
6827}
6828
6829// Left-recursive
6830// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
6831static expr_ty shift_expr_raw(Parser *);
6832static expr_ty
6833shift_expr_rule(Parser *p)
6834{
6835 expr_ty res = NULL;
6836 if (_PyPegen_is_memoized(p, shift_expr_type, &res))
6837 return res;
6838 int mark = p->mark;
6839 int resmark = p->mark;
6840 while (1) {
6841 int tmpvar_4 = _PyPegen_update_memo(p, mark, shift_expr_type, res);
6842 if (tmpvar_4) {
6843 return res;
6844 }
6845 p->mark = mark;
6846 void *raw = shift_expr_raw(p);
6847 if (raw == NULL || p->mark <= resmark)
6848 break;
6849 resmark = p->mark;
6850 res = raw;
6851 }
6852 p->mark = resmark;
6853 return res;
6854}
6855static expr_ty
6856shift_expr_raw(Parser *p)
6857{
6858 if (p->error_indicator) {
6859 return NULL;
6860 }
6861 expr_ty res = NULL;
6862 int mark = p->mark;
6863 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6864 p->error_indicator = 1;
6865 return NULL;
6866 }
6867 int start_lineno = p->tokens[mark]->lineno;
6868 UNUSED(start_lineno); // Only used by EXTRA macro
6869 int start_col_offset = p->tokens[mark]->col_offset;
6870 UNUSED(start_col_offset); // Only used by EXTRA macro
6871 { // shift_expr '<<' sum
6872 expr_ty a;
6873 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006874 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006875 if (
6876 (a = shift_expr_rule(p))
6877 &&
6878 (literal = _PyPegen_expect_token(p, 33))
6879 &&
6880 (b = sum_rule(p))
6881 )
6882 {
6883 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6884 if (token == NULL) {
6885 return NULL;
6886 }
6887 int end_lineno = token->end_lineno;
6888 UNUSED(end_lineno); // Only used by EXTRA macro
6889 int end_col_offset = token->end_col_offset;
6890 UNUSED(end_col_offset); // Only used by EXTRA macro
6891 res = _Py_BinOp ( a , LShift , b , EXTRA );
6892 if (res == NULL && PyErr_Occurred()) {
6893 p->error_indicator = 1;
6894 return NULL;
6895 }
6896 goto done;
6897 }
6898 p->mark = mark;
6899 }
6900 { // shift_expr '>>' sum
6901 expr_ty a;
6902 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006903 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006904 if (
6905 (a = shift_expr_rule(p))
6906 &&
6907 (literal = _PyPegen_expect_token(p, 34))
6908 &&
6909 (b = sum_rule(p))
6910 )
6911 {
6912 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6913 if (token == NULL) {
6914 return NULL;
6915 }
6916 int end_lineno = token->end_lineno;
6917 UNUSED(end_lineno); // Only used by EXTRA macro
6918 int end_col_offset = token->end_col_offset;
6919 UNUSED(end_col_offset); // Only used by EXTRA macro
6920 res = _Py_BinOp ( a , RShift , b , EXTRA );
6921 if (res == NULL && PyErr_Occurred()) {
6922 p->error_indicator = 1;
6923 return NULL;
6924 }
6925 goto done;
6926 }
6927 p->mark = mark;
6928 }
6929 { // sum
6930 expr_ty sum_var;
6931 if (
6932 (sum_var = sum_rule(p))
6933 )
6934 {
6935 res = sum_var;
6936 goto done;
6937 }
6938 p->mark = mark;
6939 }
6940 res = NULL;
6941 done:
6942 return res;
6943}
6944
6945// Left-recursive
6946// sum: sum '+' term | sum '-' term | term
6947static expr_ty sum_raw(Parser *);
6948static expr_ty
6949sum_rule(Parser *p)
6950{
6951 expr_ty res = NULL;
6952 if (_PyPegen_is_memoized(p, sum_type, &res))
6953 return res;
6954 int mark = p->mark;
6955 int resmark = p->mark;
6956 while (1) {
6957 int tmpvar_5 = _PyPegen_update_memo(p, mark, sum_type, res);
6958 if (tmpvar_5) {
6959 return res;
6960 }
6961 p->mark = mark;
6962 void *raw = sum_raw(p);
6963 if (raw == NULL || p->mark <= resmark)
6964 break;
6965 resmark = p->mark;
6966 res = raw;
6967 }
6968 p->mark = resmark;
6969 return res;
6970}
6971static expr_ty
6972sum_raw(Parser *p)
6973{
6974 if (p->error_indicator) {
6975 return NULL;
6976 }
6977 expr_ty res = NULL;
6978 int mark = p->mark;
6979 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6980 p->error_indicator = 1;
6981 return NULL;
6982 }
6983 int start_lineno = p->tokens[mark]->lineno;
6984 UNUSED(start_lineno); // Only used by EXTRA macro
6985 int start_col_offset = p->tokens[mark]->col_offset;
6986 UNUSED(start_col_offset); // Only used by EXTRA macro
6987 { // sum '+' term
6988 expr_ty a;
6989 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006990 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006991 if (
6992 (a = sum_rule(p))
6993 &&
6994 (literal = _PyPegen_expect_token(p, 14))
6995 &&
6996 (b = term_rule(p))
6997 )
6998 {
6999 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7000 if (token == NULL) {
7001 return NULL;
7002 }
7003 int end_lineno = token->end_lineno;
7004 UNUSED(end_lineno); // Only used by EXTRA macro
7005 int end_col_offset = token->end_col_offset;
7006 UNUSED(end_col_offset); // Only used by EXTRA macro
7007 res = _Py_BinOp ( a , Add , b , EXTRA );
7008 if (res == NULL && PyErr_Occurred()) {
7009 p->error_indicator = 1;
7010 return NULL;
7011 }
7012 goto done;
7013 }
7014 p->mark = mark;
7015 }
7016 { // sum '-' term
7017 expr_ty a;
7018 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007019 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007020 if (
7021 (a = sum_rule(p))
7022 &&
7023 (literal = _PyPegen_expect_token(p, 15))
7024 &&
7025 (b = term_rule(p))
7026 )
7027 {
7028 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7029 if (token == NULL) {
7030 return NULL;
7031 }
7032 int end_lineno = token->end_lineno;
7033 UNUSED(end_lineno); // Only used by EXTRA macro
7034 int end_col_offset = token->end_col_offset;
7035 UNUSED(end_col_offset); // Only used by EXTRA macro
7036 res = _Py_BinOp ( a , Sub , b , EXTRA );
7037 if (res == NULL && PyErr_Occurred()) {
7038 p->error_indicator = 1;
7039 return NULL;
7040 }
7041 goto done;
7042 }
7043 p->mark = mark;
7044 }
7045 { // term
7046 expr_ty term_var;
7047 if (
7048 (term_var = term_rule(p))
7049 )
7050 {
7051 res = term_var;
7052 goto done;
7053 }
7054 p->mark = mark;
7055 }
7056 res = NULL;
7057 done:
7058 return res;
7059}
7060
7061// Left-recursive
7062// term:
7063// | term '*' factor
7064// | term '/' factor
7065// | term '//' factor
7066// | term '%' factor
7067// | term '@' factor
7068// | factor
7069static expr_ty term_raw(Parser *);
7070static expr_ty
7071term_rule(Parser *p)
7072{
7073 expr_ty res = NULL;
7074 if (_PyPegen_is_memoized(p, term_type, &res))
7075 return res;
7076 int mark = p->mark;
7077 int resmark = p->mark;
7078 while (1) {
7079 int tmpvar_6 = _PyPegen_update_memo(p, mark, term_type, res);
7080 if (tmpvar_6) {
7081 return res;
7082 }
7083 p->mark = mark;
7084 void *raw = term_raw(p);
7085 if (raw == NULL || p->mark <= resmark)
7086 break;
7087 resmark = p->mark;
7088 res = raw;
7089 }
7090 p->mark = resmark;
7091 return res;
7092}
7093static expr_ty
7094term_raw(Parser *p)
7095{
7096 if (p->error_indicator) {
7097 return NULL;
7098 }
7099 expr_ty res = NULL;
7100 int mark = p->mark;
7101 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7102 p->error_indicator = 1;
7103 return NULL;
7104 }
7105 int start_lineno = p->tokens[mark]->lineno;
7106 UNUSED(start_lineno); // Only used by EXTRA macro
7107 int start_col_offset = p->tokens[mark]->col_offset;
7108 UNUSED(start_col_offset); // Only used by EXTRA macro
7109 { // term '*' factor
7110 expr_ty a;
7111 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007112 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007113 if (
7114 (a = term_rule(p))
7115 &&
7116 (literal = _PyPegen_expect_token(p, 16))
7117 &&
7118 (b = factor_rule(p))
7119 )
7120 {
7121 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7122 if (token == NULL) {
7123 return NULL;
7124 }
7125 int end_lineno = token->end_lineno;
7126 UNUSED(end_lineno); // Only used by EXTRA macro
7127 int end_col_offset = token->end_col_offset;
7128 UNUSED(end_col_offset); // Only used by EXTRA macro
7129 res = _Py_BinOp ( a , Mult , b , EXTRA );
7130 if (res == NULL && PyErr_Occurred()) {
7131 p->error_indicator = 1;
7132 return NULL;
7133 }
7134 goto done;
7135 }
7136 p->mark = mark;
7137 }
7138 { // term '/' factor
7139 expr_ty a;
7140 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007141 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007142 if (
7143 (a = term_rule(p))
7144 &&
7145 (literal = _PyPegen_expect_token(p, 17))
7146 &&
7147 (b = factor_rule(p))
7148 )
7149 {
7150 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7151 if (token == NULL) {
7152 return NULL;
7153 }
7154 int end_lineno = token->end_lineno;
7155 UNUSED(end_lineno); // Only used by EXTRA macro
7156 int end_col_offset = token->end_col_offset;
7157 UNUSED(end_col_offset); // Only used by EXTRA macro
7158 res = _Py_BinOp ( a , Div , b , EXTRA );
7159 if (res == NULL && PyErr_Occurred()) {
7160 p->error_indicator = 1;
7161 return NULL;
7162 }
7163 goto done;
7164 }
7165 p->mark = mark;
7166 }
7167 { // term '//' factor
7168 expr_ty a;
7169 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007170 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007171 if (
7172 (a = term_rule(p))
7173 &&
7174 (literal = _PyPegen_expect_token(p, 47))
7175 &&
7176 (b = factor_rule(p))
7177 )
7178 {
7179 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7180 if (token == NULL) {
7181 return NULL;
7182 }
7183 int end_lineno = token->end_lineno;
7184 UNUSED(end_lineno); // Only used by EXTRA macro
7185 int end_col_offset = token->end_col_offset;
7186 UNUSED(end_col_offset); // Only used by EXTRA macro
7187 res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
7188 if (res == NULL && PyErr_Occurred()) {
7189 p->error_indicator = 1;
7190 return NULL;
7191 }
7192 goto done;
7193 }
7194 p->mark = mark;
7195 }
7196 { // term '%' factor
7197 expr_ty a;
7198 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007199 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007200 if (
7201 (a = term_rule(p))
7202 &&
7203 (literal = _PyPegen_expect_token(p, 24))
7204 &&
7205 (b = factor_rule(p))
7206 )
7207 {
7208 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7209 if (token == NULL) {
7210 return NULL;
7211 }
7212 int end_lineno = token->end_lineno;
7213 UNUSED(end_lineno); // Only used by EXTRA macro
7214 int end_col_offset = token->end_col_offset;
7215 UNUSED(end_col_offset); // Only used by EXTRA macro
7216 res = _Py_BinOp ( a , Mod , b , EXTRA );
7217 if (res == NULL && PyErr_Occurred()) {
7218 p->error_indicator = 1;
7219 return NULL;
7220 }
7221 goto done;
7222 }
7223 p->mark = mark;
7224 }
7225 { // term '@' factor
7226 expr_ty a;
7227 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007228 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007229 if (
7230 (a = term_rule(p))
7231 &&
7232 (literal = _PyPegen_expect_token(p, 49))
7233 &&
7234 (b = factor_rule(p))
7235 )
7236 {
7237 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7238 if (token == NULL) {
7239 return NULL;
7240 }
7241 int end_lineno = token->end_lineno;
7242 UNUSED(end_lineno); // Only used by EXTRA macro
7243 int end_col_offset = token->end_col_offset;
7244 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03007245 res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007246 if (res == NULL && PyErr_Occurred()) {
7247 p->error_indicator = 1;
7248 return NULL;
7249 }
7250 goto done;
7251 }
7252 p->mark = mark;
7253 }
7254 { // factor
7255 expr_ty factor_var;
7256 if (
7257 (factor_var = factor_rule(p))
7258 )
7259 {
7260 res = factor_var;
7261 goto done;
7262 }
7263 p->mark = mark;
7264 }
7265 res = NULL;
7266 done:
7267 return res;
7268}
7269
7270// factor: '+' factor | '-' factor | '~' factor | power
7271static expr_ty
7272factor_rule(Parser *p)
7273{
7274 if (p->error_indicator) {
7275 return NULL;
7276 }
7277 expr_ty res = NULL;
7278 if (_PyPegen_is_memoized(p, factor_type, &res))
7279 return res;
7280 int mark = p->mark;
7281 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7282 p->error_indicator = 1;
7283 return NULL;
7284 }
7285 int start_lineno = p->tokens[mark]->lineno;
7286 UNUSED(start_lineno); // Only used by EXTRA macro
7287 int start_col_offset = p->tokens[mark]->col_offset;
7288 UNUSED(start_col_offset); // Only used by EXTRA macro
7289 { // '+' factor
7290 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007291 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007292 if (
7293 (literal = _PyPegen_expect_token(p, 14))
7294 &&
7295 (a = factor_rule(p))
7296 )
7297 {
7298 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7299 if (token == NULL) {
7300 return NULL;
7301 }
7302 int end_lineno = token->end_lineno;
7303 UNUSED(end_lineno); // Only used by EXTRA macro
7304 int end_col_offset = token->end_col_offset;
7305 UNUSED(end_col_offset); // Only used by EXTRA macro
7306 res = _Py_UnaryOp ( UAdd , a , EXTRA );
7307 if (res == NULL && PyErr_Occurred()) {
7308 p->error_indicator = 1;
7309 return NULL;
7310 }
7311 goto done;
7312 }
7313 p->mark = mark;
7314 }
7315 { // '-' factor
7316 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007317 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007318 if (
7319 (literal = _PyPegen_expect_token(p, 15))
7320 &&
7321 (a = factor_rule(p))
7322 )
7323 {
7324 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7325 if (token == NULL) {
7326 return NULL;
7327 }
7328 int end_lineno = token->end_lineno;
7329 UNUSED(end_lineno); // Only used by EXTRA macro
7330 int end_col_offset = token->end_col_offset;
7331 UNUSED(end_col_offset); // Only used by EXTRA macro
7332 res = _Py_UnaryOp ( USub , a , EXTRA );
7333 if (res == NULL && PyErr_Occurred()) {
7334 p->error_indicator = 1;
7335 return NULL;
7336 }
7337 goto done;
7338 }
7339 p->mark = mark;
7340 }
7341 { // '~' factor
7342 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007343 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007344 if (
7345 (literal = _PyPegen_expect_token(p, 31))
7346 &&
7347 (a = factor_rule(p))
7348 )
7349 {
7350 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7351 if (token == NULL) {
7352 return NULL;
7353 }
7354 int end_lineno = token->end_lineno;
7355 UNUSED(end_lineno); // Only used by EXTRA macro
7356 int end_col_offset = token->end_col_offset;
7357 UNUSED(end_col_offset); // Only used by EXTRA macro
7358 res = _Py_UnaryOp ( Invert , a , EXTRA );
7359 if (res == NULL && PyErr_Occurred()) {
7360 p->error_indicator = 1;
7361 return NULL;
7362 }
7363 goto done;
7364 }
7365 p->mark = mark;
7366 }
7367 { // power
7368 expr_ty power_var;
7369 if (
7370 (power_var = power_rule(p))
7371 )
7372 {
7373 res = power_var;
7374 goto done;
7375 }
7376 p->mark = mark;
7377 }
7378 res = NULL;
7379 done:
7380 _PyPegen_insert_memo(p, mark, factor_type, res);
7381 return res;
7382}
7383
7384// power: await_primary '**' factor | await_primary
7385static expr_ty
7386power_rule(Parser *p)
7387{
7388 if (p->error_indicator) {
7389 return NULL;
7390 }
7391 expr_ty res = NULL;
7392 int mark = p->mark;
7393 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7394 p->error_indicator = 1;
7395 return NULL;
7396 }
7397 int start_lineno = p->tokens[mark]->lineno;
7398 UNUSED(start_lineno); // Only used by EXTRA macro
7399 int start_col_offset = p->tokens[mark]->col_offset;
7400 UNUSED(start_col_offset); // Only used by EXTRA macro
7401 { // await_primary '**' factor
7402 expr_ty a;
7403 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007404 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007405 if (
7406 (a = await_primary_rule(p))
7407 &&
7408 (literal = _PyPegen_expect_token(p, 35))
7409 &&
7410 (b = factor_rule(p))
7411 )
7412 {
7413 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7414 if (token == NULL) {
7415 return NULL;
7416 }
7417 int end_lineno = token->end_lineno;
7418 UNUSED(end_lineno); // Only used by EXTRA macro
7419 int end_col_offset = token->end_col_offset;
7420 UNUSED(end_col_offset); // Only used by EXTRA macro
7421 res = _Py_BinOp ( a , Pow , b , EXTRA );
7422 if (res == NULL && PyErr_Occurred()) {
7423 p->error_indicator = 1;
7424 return NULL;
7425 }
7426 goto done;
7427 }
7428 p->mark = mark;
7429 }
7430 { // await_primary
7431 expr_ty await_primary_var;
7432 if (
7433 (await_primary_var = await_primary_rule(p))
7434 )
7435 {
7436 res = await_primary_var;
7437 goto done;
7438 }
7439 p->mark = mark;
7440 }
7441 res = NULL;
7442 done:
7443 return res;
7444}
7445
7446// await_primary: AWAIT primary | primary
7447static expr_ty
7448await_primary_rule(Parser *p)
7449{
7450 if (p->error_indicator) {
7451 return NULL;
7452 }
7453 expr_ty res = NULL;
7454 if (_PyPegen_is_memoized(p, await_primary_type, &res))
7455 return res;
7456 int mark = p->mark;
7457 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7458 p->error_indicator = 1;
7459 return NULL;
7460 }
7461 int start_lineno = p->tokens[mark]->lineno;
7462 UNUSED(start_lineno); // Only used by EXTRA macro
7463 int start_col_offset = p->tokens[mark]->col_offset;
7464 UNUSED(start_col_offset); // Only used by EXTRA macro
7465 { // AWAIT primary
7466 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007467 Token * await_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007468 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01007469 (await_var = _PyPegen_expect_token(p, AWAIT))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007470 &&
7471 (a = primary_rule(p))
7472 )
7473 {
7474 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7475 if (token == NULL) {
7476 return NULL;
7477 }
7478 int end_lineno = token->end_lineno;
7479 UNUSED(end_lineno); // Only used by EXTRA macro
7480 int end_col_offset = token->end_col_offset;
7481 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03007482 res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007483 if (res == NULL && PyErr_Occurred()) {
7484 p->error_indicator = 1;
7485 return NULL;
7486 }
7487 goto done;
7488 }
7489 p->mark = mark;
7490 }
7491 { // primary
7492 expr_ty primary_var;
7493 if (
7494 (primary_var = primary_rule(p))
7495 )
7496 {
7497 res = primary_var;
7498 goto done;
7499 }
7500 p->mark = mark;
7501 }
7502 res = NULL;
7503 done:
7504 _PyPegen_insert_memo(p, mark, await_primary_type, res);
7505 return res;
7506}
7507
7508// Left-recursive
7509// primary:
7510// | primary '.' NAME
7511// | primary genexp
7512// | primary '(' arguments? ')'
7513// | primary '[' slices ']'
7514// | atom
7515static expr_ty primary_raw(Parser *);
7516static expr_ty
7517primary_rule(Parser *p)
7518{
7519 expr_ty res = NULL;
7520 if (_PyPegen_is_memoized(p, primary_type, &res))
7521 return res;
7522 int mark = p->mark;
7523 int resmark = p->mark;
7524 while (1) {
7525 int tmpvar_7 = _PyPegen_update_memo(p, mark, primary_type, res);
7526 if (tmpvar_7) {
7527 return res;
7528 }
7529 p->mark = mark;
7530 void *raw = primary_raw(p);
7531 if (raw == NULL || p->mark <= resmark)
7532 break;
7533 resmark = p->mark;
7534 res = raw;
7535 }
7536 p->mark = resmark;
7537 return res;
7538}
7539static expr_ty
7540primary_raw(Parser *p)
7541{
7542 if (p->error_indicator) {
7543 return NULL;
7544 }
7545 expr_ty res = NULL;
7546 int mark = p->mark;
7547 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7548 p->error_indicator = 1;
7549 return NULL;
7550 }
7551 int start_lineno = p->tokens[mark]->lineno;
7552 UNUSED(start_lineno); // Only used by EXTRA macro
7553 int start_col_offset = p->tokens[mark]->col_offset;
7554 UNUSED(start_col_offset); // Only used by EXTRA macro
7555 { // primary '.' NAME
7556 expr_ty a;
7557 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007558 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007559 if (
7560 (a = primary_rule(p))
7561 &&
7562 (literal = _PyPegen_expect_token(p, 23))
7563 &&
7564 (b = _PyPegen_name_token(p))
7565 )
7566 {
7567 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7568 if (token == NULL) {
7569 return NULL;
7570 }
7571 int end_lineno = token->end_lineno;
7572 UNUSED(end_lineno); // Only used by EXTRA macro
7573 int end_col_offset = token->end_col_offset;
7574 UNUSED(end_col_offset); // Only used by EXTRA macro
7575 res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
7576 if (res == NULL && PyErr_Occurred()) {
7577 p->error_indicator = 1;
7578 return NULL;
7579 }
7580 goto done;
7581 }
7582 p->mark = mark;
7583 }
7584 { // primary genexp
7585 expr_ty a;
7586 expr_ty b;
7587 if (
7588 (a = primary_rule(p))
7589 &&
7590 (b = genexp_rule(p))
7591 )
7592 {
7593 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7594 if (token == NULL) {
7595 return NULL;
7596 }
7597 int end_lineno = token->end_lineno;
7598 UNUSED(end_lineno); // Only used by EXTRA macro
7599 int end_col_offset = token->end_col_offset;
7600 UNUSED(end_col_offset); // Only used by EXTRA macro
7601 res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
7602 if (res == NULL && PyErr_Occurred()) {
7603 p->error_indicator = 1;
7604 return NULL;
7605 }
7606 goto done;
7607 }
7608 p->mark = mark;
7609 }
7610 { // primary '(' arguments? ')'
7611 expr_ty a;
7612 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007613 Token * literal;
7614 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007615 if (
7616 (a = primary_rule(p))
7617 &&
7618 (literal = _PyPegen_expect_token(p, 7))
7619 &&
7620 (b = arguments_rule(p), 1)
7621 &&
7622 (literal_1 = _PyPegen_expect_token(p, 8))
7623 )
7624 {
7625 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7626 if (token == NULL) {
7627 return NULL;
7628 }
7629 int end_lineno = token->end_lineno;
7630 UNUSED(end_lineno); // Only used by EXTRA macro
7631 int end_col_offset = token->end_col_offset;
7632 UNUSED(end_col_offset); // Only used by EXTRA macro
7633 res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
7634 if (res == NULL && PyErr_Occurred()) {
7635 p->error_indicator = 1;
7636 return NULL;
7637 }
7638 goto done;
7639 }
7640 p->mark = mark;
7641 }
7642 { // primary '[' slices ']'
7643 expr_ty a;
7644 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007645 Token * literal;
7646 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007647 if (
7648 (a = primary_rule(p))
7649 &&
7650 (literal = _PyPegen_expect_token(p, 9))
7651 &&
7652 (b = slices_rule(p))
7653 &&
7654 (literal_1 = _PyPegen_expect_token(p, 10))
7655 )
7656 {
7657 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7658 if (token == NULL) {
7659 return NULL;
7660 }
7661 int end_lineno = token->end_lineno;
7662 UNUSED(end_lineno); // Only used by EXTRA macro
7663 int end_col_offset = token->end_col_offset;
7664 UNUSED(end_col_offset); // Only used by EXTRA macro
7665 res = _Py_Subscript ( a , b , Load , EXTRA );
7666 if (res == NULL && PyErr_Occurred()) {
7667 p->error_indicator = 1;
7668 return NULL;
7669 }
7670 goto done;
7671 }
7672 p->mark = mark;
7673 }
7674 { // atom
7675 expr_ty atom_var;
7676 if (
7677 (atom_var = atom_rule(p))
7678 )
7679 {
7680 res = atom_var;
7681 goto done;
7682 }
7683 p->mark = mark;
7684 }
7685 res = NULL;
7686 done:
7687 return res;
7688}
7689
7690// slices: slice !',' | ','.slice+ ','?
7691static expr_ty
7692slices_rule(Parser *p)
7693{
7694 if (p->error_indicator) {
7695 return NULL;
7696 }
7697 expr_ty res = NULL;
7698 int mark = p->mark;
7699 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7700 p->error_indicator = 1;
7701 return NULL;
7702 }
7703 int start_lineno = p->tokens[mark]->lineno;
7704 UNUSED(start_lineno); // Only used by EXTRA macro
7705 int start_col_offset = p->tokens[mark]->col_offset;
7706 UNUSED(start_col_offset); // Only used by EXTRA macro
7707 { // slice !','
7708 expr_ty a;
7709 if (
7710 (a = slice_rule(p))
7711 &&
7712 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)
7713 )
7714 {
7715 res = 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 { // ','.slice+ ','?
7725 asdl_seq * a;
7726 void *opt_var;
7727 UNUSED(opt_var); // Silence compiler warnings
7728 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07007729 (a = _gather_93_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007730 &&
7731 (opt_var = _PyPegen_expect_token(p, 12), 1)
7732 )
7733 {
7734 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7735 if (token == NULL) {
7736 return NULL;
7737 }
7738 int end_lineno = token->end_lineno;
7739 UNUSED(end_lineno); // Only used by EXTRA macro
7740 int end_col_offset = token->end_col_offset;
7741 UNUSED(end_col_offset); // Only used by EXTRA macro
7742 res = _Py_Tuple ( a , Load , EXTRA );
7743 if (res == NULL && PyErr_Occurred()) {
7744 p->error_indicator = 1;
7745 return NULL;
7746 }
7747 goto done;
7748 }
7749 p->mark = mark;
7750 }
7751 res = NULL;
7752 done:
7753 return res;
7754}
7755
7756// slice: expression? ':' expression? [':' expression?] | expression
7757static expr_ty
7758slice_rule(Parser *p)
7759{
7760 if (p->error_indicator) {
7761 return NULL;
7762 }
7763 expr_ty res = NULL;
7764 int mark = p->mark;
7765 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7766 p->error_indicator = 1;
7767 return NULL;
7768 }
7769 int start_lineno = p->tokens[mark]->lineno;
7770 UNUSED(start_lineno); // Only used by EXTRA macro
7771 int start_col_offset = p->tokens[mark]->col_offset;
7772 UNUSED(start_col_offset); // Only used by EXTRA macro
7773 { // expression? ':' expression? [':' expression?]
7774 void *a;
7775 void *b;
7776 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007777 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007778 if (
7779 (a = expression_rule(p), 1)
7780 &&
7781 (literal = _PyPegen_expect_token(p, 11))
7782 &&
7783 (b = expression_rule(p), 1)
7784 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07007785 (c = _tmp_95_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007786 )
7787 {
7788 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7789 if (token == NULL) {
7790 return NULL;
7791 }
7792 int end_lineno = token->end_lineno;
7793 UNUSED(end_lineno); // Only used by EXTRA macro
7794 int end_col_offset = token->end_col_offset;
7795 UNUSED(end_col_offset); // Only used by EXTRA macro
7796 res = _Py_Slice ( a , b , c , EXTRA );
7797 if (res == NULL && PyErr_Occurred()) {
7798 p->error_indicator = 1;
7799 return NULL;
7800 }
7801 goto done;
7802 }
7803 p->mark = mark;
7804 }
7805 { // expression
7806 expr_ty a;
7807 if (
7808 (a = expression_rule(p))
7809 )
7810 {
7811 res = a;
7812 if (res == NULL && PyErr_Occurred()) {
7813 p->error_indicator = 1;
7814 return NULL;
7815 }
7816 goto done;
7817 }
7818 p->mark = mark;
7819 }
7820 res = NULL;
7821 done:
7822 return res;
7823}
7824
7825// atom:
7826// | NAME
7827// | 'True'
7828// | 'False'
7829// | 'None'
7830// | '__new_parser__'
7831// | &STRING strings
7832// | NUMBER
7833// | &'(' (tuple | group | genexp)
7834// | &'[' (list | listcomp)
7835// | &'{' (dict | set | dictcomp | setcomp)
7836// | '...'
7837static expr_ty
7838atom_rule(Parser *p)
7839{
7840 if (p->error_indicator) {
7841 return NULL;
7842 }
7843 expr_ty res = NULL;
7844 int mark = p->mark;
7845 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7846 p->error_indicator = 1;
7847 return NULL;
7848 }
7849 int start_lineno = p->tokens[mark]->lineno;
7850 UNUSED(start_lineno); // Only used by EXTRA macro
7851 int start_col_offset = p->tokens[mark]->col_offset;
7852 UNUSED(start_col_offset); // Only used by EXTRA macro
7853 { // NAME
7854 expr_ty name_var;
7855 if (
7856 (name_var = _PyPegen_name_token(p))
7857 )
7858 {
7859 res = name_var;
7860 goto done;
7861 }
7862 p->mark = mark;
7863 }
7864 { // 'True'
Pablo Galindob796b3f2020-05-01 12:32:26 +01007865 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007866 if (
7867 (keyword = _PyPegen_expect_token(p, 527))
7868 )
7869 {
7870 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7871 if (token == NULL) {
7872 return NULL;
7873 }
7874 int end_lineno = token->end_lineno;
7875 UNUSED(end_lineno); // Only used by EXTRA macro
7876 int end_col_offset = token->end_col_offset;
7877 UNUSED(end_col_offset); // Only used by EXTRA macro
7878 res = _Py_Constant ( Py_True , NULL , EXTRA );
7879 if (res == NULL && PyErr_Occurred()) {
7880 p->error_indicator = 1;
7881 return NULL;
7882 }
7883 goto done;
7884 }
7885 p->mark = mark;
7886 }
7887 { // 'False'
Pablo Galindob796b3f2020-05-01 12:32:26 +01007888 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007889 if (
7890 (keyword = _PyPegen_expect_token(p, 528))
7891 )
7892 {
7893 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7894 if (token == NULL) {
7895 return NULL;
7896 }
7897 int end_lineno = token->end_lineno;
7898 UNUSED(end_lineno); // Only used by EXTRA macro
7899 int end_col_offset = token->end_col_offset;
7900 UNUSED(end_col_offset); // Only used by EXTRA macro
7901 res = _Py_Constant ( Py_False , NULL , EXTRA );
7902 if (res == NULL && PyErr_Occurred()) {
7903 p->error_indicator = 1;
7904 return NULL;
7905 }
7906 goto done;
7907 }
7908 p->mark = mark;
7909 }
7910 { // 'None'
Pablo Galindob796b3f2020-05-01 12:32:26 +01007911 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007912 if (
7913 (keyword = _PyPegen_expect_token(p, 529))
7914 )
7915 {
7916 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7917 if (token == NULL) {
7918 return NULL;
7919 }
7920 int end_lineno = token->end_lineno;
7921 UNUSED(end_lineno); // Only used by EXTRA macro
7922 int end_col_offset = token->end_col_offset;
7923 UNUSED(end_col_offset); // Only used by EXTRA macro
7924 res = _Py_Constant ( Py_None , NULL , EXTRA );
7925 if (res == NULL && PyErr_Occurred()) {
7926 p->error_indicator = 1;
7927 return NULL;
7928 }
7929 goto done;
7930 }
7931 p->mark = mark;
7932 }
7933 { // '__new_parser__'
Pablo Galindob796b3f2020-05-01 12:32:26 +01007934 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007935 if (
7936 (keyword = _PyPegen_expect_token(p, 530))
7937 )
7938 {
7939 res = RAISE_SYNTAX_ERROR ( "You found it!" );
7940 if (res == NULL && PyErr_Occurred()) {
7941 p->error_indicator = 1;
7942 return NULL;
7943 }
7944 goto done;
7945 }
7946 p->mark = mark;
7947 }
7948 { // &STRING strings
7949 expr_ty strings_var;
7950 if (
7951 _PyPegen_lookahead(1, _PyPegen_string_token, p)
7952 &&
7953 (strings_var = strings_rule(p))
7954 )
7955 {
7956 res = strings_var;
7957 goto done;
7958 }
7959 p->mark = mark;
7960 }
7961 { // NUMBER
7962 expr_ty number_var;
7963 if (
7964 (number_var = _PyPegen_number_token(p))
7965 )
7966 {
7967 res = number_var;
7968 goto done;
7969 }
7970 p->mark = mark;
7971 }
7972 { // &'(' (tuple | group | genexp)
Guido van Rossum3941d972020-05-01 09:42:03 -07007973 void *_tmp_96_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007974 if (
Pablo Galindo2b74c832020-04-27 18:02:07 +01007975 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007976 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07007977 (_tmp_96_var = _tmp_96_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007978 )
7979 {
Guido van Rossum3941d972020-05-01 09:42:03 -07007980 res = _tmp_96_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007981 goto done;
7982 }
7983 p->mark = mark;
7984 }
Pablo Galindo2b74c832020-04-27 18:02:07 +01007985 { // &'[' (list | listcomp)
Guido van Rossum3941d972020-05-01 09:42:03 -07007986 void *_tmp_97_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007987 if (
Pablo Galindo2b74c832020-04-27 18:02:07 +01007988 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007989 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07007990 (_tmp_97_var = _tmp_97_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007991 )
7992 {
Guido van Rossum3941d972020-05-01 09:42:03 -07007993 res = _tmp_97_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007994 goto done;
7995 }
7996 p->mark = mark;
7997 }
Pablo Galindo2b74c832020-04-27 18:02:07 +01007998 { // &'{' (dict | set | dictcomp | setcomp)
Guido van Rossum3941d972020-05-01 09:42:03 -07007999 void *_tmp_98_var;
Pablo Galindo2b74c832020-04-27 18:02:07 +01008000 if (
8001 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25)
8002 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008003 (_tmp_98_var = _tmp_98_rule(p))
Pablo Galindo2b74c832020-04-27 18:02:07 +01008004 )
8005 {
Guido van Rossum3941d972020-05-01 09:42:03 -07008006 res = _tmp_98_var;
Pablo Galindo2b74c832020-04-27 18:02:07 +01008007 goto done;
8008 }
8009 p->mark = mark;
8010 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008011 { // '...'
Pablo Galindob796b3f2020-05-01 12:32:26 +01008012 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008013 if (
8014 (literal = _PyPegen_expect_token(p, 52))
8015 )
8016 {
8017 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8018 if (token == NULL) {
8019 return NULL;
8020 }
8021 int end_lineno = token->end_lineno;
8022 UNUSED(end_lineno); // Only used by EXTRA macro
8023 int end_col_offset = token->end_col_offset;
8024 UNUSED(end_col_offset); // Only used by EXTRA macro
8025 res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
8026 if (res == NULL && PyErr_Occurred()) {
8027 p->error_indicator = 1;
8028 return NULL;
8029 }
8030 goto done;
8031 }
8032 p->mark = mark;
8033 }
8034 res = NULL;
8035 done:
8036 return res;
8037}
8038
8039// strings: STRING+
8040static expr_ty
8041strings_rule(Parser *p)
8042{
8043 if (p->error_indicator) {
8044 return NULL;
8045 }
8046 expr_ty res = NULL;
8047 if (_PyPegen_is_memoized(p, strings_type, &res))
8048 return res;
8049 int mark = p->mark;
8050 { // STRING+
8051 asdl_seq * a;
8052 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07008053 (a = _loop1_99_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008054 )
8055 {
8056 res = _PyPegen_concatenate_strings ( p , a );
8057 if (res == NULL && PyErr_Occurred()) {
8058 p->error_indicator = 1;
8059 return NULL;
8060 }
8061 goto done;
8062 }
8063 p->mark = mark;
8064 }
8065 res = NULL;
8066 done:
8067 _PyPegen_insert_memo(p, mark, strings_type, res);
8068 return res;
8069}
8070
8071// list: '[' star_named_expressions? ']'
8072static expr_ty
8073list_rule(Parser *p)
8074{
8075 if (p->error_indicator) {
8076 return NULL;
8077 }
8078 expr_ty res = NULL;
8079 int mark = p->mark;
8080 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8081 p->error_indicator = 1;
8082 return NULL;
8083 }
8084 int start_lineno = p->tokens[mark]->lineno;
8085 UNUSED(start_lineno); // Only used by EXTRA macro
8086 int start_col_offset = p->tokens[mark]->col_offset;
8087 UNUSED(start_col_offset); // Only used by EXTRA macro
8088 { // '[' star_named_expressions? ']'
8089 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008090 Token * literal;
8091 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008092 if (
8093 (literal = _PyPegen_expect_token(p, 9))
8094 &&
8095 (a = star_named_expressions_rule(p), 1)
8096 &&
8097 (literal_1 = _PyPegen_expect_token(p, 10))
8098 )
8099 {
8100 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8101 if (token == NULL) {
8102 return NULL;
8103 }
8104 int end_lineno = token->end_lineno;
8105 UNUSED(end_lineno); // Only used by EXTRA macro
8106 int end_col_offset = token->end_col_offset;
8107 UNUSED(end_col_offset); // Only used by EXTRA macro
8108 res = _Py_List ( a , Load , EXTRA );
8109 if (res == NULL && PyErr_Occurred()) {
8110 p->error_indicator = 1;
8111 return NULL;
8112 }
8113 goto done;
8114 }
8115 p->mark = mark;
8116 }
8117 res = NULL;
8118 done:
8119 return res;
8120}
8121
8122// listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension
8123static expr_ty
8124listcomp_rule(Parser *p)
8125{
8126 if (p->error_indicator) {
8127 return NULL;
8128 }
8129 expr_ty res = NULL;
8130 int mark = p->mark;
8131 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8132 p->error_indicator = 1;
8133 return NULL;
8134 }
8135 int start_lineno = p->tokens[mark]->lineno;
8136 UNUSED(start_lineno); // Only used by EXTRA macro
8137 int start_col_offset = p->tokens[mark]->col_offset;
8138 UNUSED(start_col_offset); // Only used by EXTRA macro
8139 { // '[' named_expression for_if_clauses ']'
8140 expr_ty a;
8141 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008142 Token * literal;
8143 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008144 if (
8145 (literal = _PyPegen_expect_token(p, 9))
8146 &&
8147 (a = named_expression_rule(p))
8148 &&
8149 (b = for_if_clauses_rule(p))
8150 &&
8151 (literal_1 = _PyPegen_expect_token(p, 10))
8152 )
8153 {
8154 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8155 if (token == NULL) {
8156 return NULL;
8157 }
8158 int end_lineno = token->end_lineno;
8159 UNUSED(end_lineno); // Only used by EXTRA macro
8160 int end_col_offset = token->end_col_offset;
8161 UNUSED(end_col_offset); // Only used by EXTRA macro
8162 res = _Py_ListComp ( a , b , EXTRA );
8163 if (res == NULL && PyErr_Occurred()) {
8164 p->error_indicator = 1;
8165 return NULL;
8166 }
8167 goto done;
8168 }
8169 p->mark = mark;
8170 }
8171 { // invalid_comprehension
8172 void *invalid_comprehension_var;
8173 if (
8174 (invalid_comprehension_var = invalid_comprehension_rule(p))
8175 )
8176 {
8177 res = invalid_comprehension_var;
8178 goto done;
8179 }
8180 p->mark = mark;
8181 }
8182 res = NULL;
8183 done:
8184 return res;
8185}
8186
8187// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
8188static expr_ty
8189tuple_rule(Parser *p)
8190{
8191 if (p->error_indicator) {
8192 return NULL;
8193 }
8194 expr_ty res = NULL;
8195 int mark = p->mark;
8196 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8197 p->error_indicator = 1;
8198 return NULL;
8199 }
8200 int start_lineno = p->tokens[mark]->lineno;
8201 UNUSED(start_lineno); // Only used by EXTRA macro
8202 int start_col_offset = p->tokens[mark]->col_offset;
8203 UNUSED(start_col_offset); // Only used by EXTRA macro
8204 { // '(' [star_named_expression ',' star_named_expressions?] ')'
8205 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008206 Token * literal;
8207 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008208 if (
8209 (literal = _PyPegen_expect_token(p, 7))
8210 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008211 (a = _tmp_100_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008212 &&
8213 (literal_1 = _PyPegen_expect_token(p, 8))
8214 )
8215 {
8216 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8217 if (token == NULL) {
8218 return NULL;
8219 }
8220 int end_lineno = token->end_lineno;
8221 UNUSED(end_lineno); // Only used by EXTRA macro
8222 int end_col_offset = token->end_col_offset;
8223 UNUSED(end_col_offset); // Only used by EXTRA macro
8224 res = _Py_Tuple ( a , Load , EXTRA );
8225 if (res == NULL && PyErr_Occurred()) {
8226 p->error_indicator = 1;
8227 return NULL;
8228 }
8229 goto done;
8230 }
8231 p->mark = mark;
8232 }
8233 res = NULL;
8234 done:
8235 return res;
8236}
8237
8238// group: '(' (yield_expr | named_expression) ')'
8239static expr_ty
8240group_rule(Parser *p)
8241{
8242 if (p->error_indicator) {
8243 return NULL;
8244 }
8245 expr_ty res = NULL;
8246 int mark = p->mark;
8247 { // '(' (yield_expr | named_expression) ')'
8248 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008249 Token * literal;
8250 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008251 if (
8252 (literal = _PyPegen_expect_token(p, 7))
8253 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008254 (a = _tmp_101_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008255 &&
8256 (literal_1 = _PyPegen_expect_token(p, 8))
8257 )
8258 {
8259 res = a;
8260 if (res == NULL && PyErr_Occurred()) {
8261 p->error_indicator = 1;
8262 return NULL;
8263 }
8264 goto done;
8265 }
8266 p->mark = mark;
8267 }
8268 res = NULL;
8269 done:
8270 return res;
8271}
8272
8273// genexp: '(' expression for_if_clauses ')' | invalid_comprehension
8274static expr_ty
8275genexp_rule(Parser *p)
8276{
8277 if (p->error_indicator) {
8278 return NULL;
8279 }
8280 expr_ty res = NULL;
8281 int mark = p->mark;
8282 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8283 p->error_indicator = 1;
8284 return NULL;
8285 }
8286 int start_lineno = p->tokens[mark]->lineno;
8287 UNUSED(start_lineno); // Only used by EXTRA macro
8288 int start_col_offset = p->tokens[mark]->col_offset;
8289 UNUSED(start_col_offset); // Only used by EXTRA macro
8290 { // '(' expression for_if_clauses ')'
8291 expr_ty a;
8292 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008293 Token * literal;
8294 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008295 if (
8296 (literal = _PyPegen_expect_token(p, 7))
8297 &&
8298 (a = expression_rule(p))
8299 &&
8300 (b = for_if_clauses_rule(p))
8301 &&
8302 (literal_1 = _PyPegen_expect_token(p, 8))
8303 )
8304 {
8305 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8306 if (token == NULL) {
8307 return NULL;
8308 }
8309 int end_lineno = token->end_lineno;
8310 UNUSED(end_lineno); // Only used by EXTRA macro
8311 int end_col_offset = token->end_col_offset;
8312 UNUSED(end_col_offset); // Only used by EXTRA macro
8313 res = _Py_GeneratorExp ( a , b , EXTRA );
8314 if (res == NULL && PyErr_Occurred()) {
8315 p->error_indicator = 1;
8316 return NULL;
8317 }
8318 goto done;
8319 }
8320 p->mark = mark;
8321 }
8322 { // invalid_comprehension
8323 void *invalid_comprehension_var;
8324 if (
8325 (invalid_comprehension_var = invalid_comprehension_rule(p))
8326 )
8327 {
8328 res = invalid_comprehension_var;
8329 goto done;
8330 }
8331 p->mark = mark;
8332 }
8333 res = NULL;
8334 done:
8335 return res;
8336}
8337
8338// set: '{' expressions_list '}'
8339static expr_ty
8340set_rule(Parser *p)
8341{
8342 if (p->error_indicator) {
8343 return NULL;
8344 }
8345 expr_ty res = NULL;
8346 int mark = p->mark;
8347 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8348 p->error_indicator = 1;
8349 return NULL;
8350 }
8351 int start_lineno = p->tokens[mark]->lineno;
8352 UNUSED(start_lineno); // Only used by EXTRA macro
8353 int start_col_offset = p->tokens[mark]->col_offset;
8354 UNUSED(start_col_offset); // Only used by EXTRA macro
8355 { // '{' expressions_list '}'
8356 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008357 Token * literal;
8358 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008359 if (
8360 (literal = _PyPegen_expect_token(p, 25))
8361 &&
8362 (a = expressions_list_rule(p))
8363 &&
8364 (literal_1 = _PyPegen_expect_token(p, 26))
8365 )
8366 {
8367 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8368 if (token == NULL) {
8369 return NULL;
8370 }
8371 int end_lineno = token->end_lineno;
8372 UNUSED(end_lineno); // Only used by EXTRA macro
8373 int end_col_offset = token->end_col_offset;
8374 UNUSED(end_col_offset); // Only used by EXTRA macro
8375 res = _Py_Set ( a , EXTRA );
8376 if (res == NULL && PyErr_Occurred()) {
8377 p->error_indicator = 1;
8378 return NULL;
8379 }
8380 goto done;
8381 }
8382 p->mark = mark;
8383 }
8384 res = NULL;
8385 done:
8386 return res;
8387}
8388
8389// setcomp: '{' expression for_if_clauses '}' | invalid_comprehension
8390static expr_ty
8391setcomp_rule(Parser *p)
8392{
8393 if (p->error_indicator) {
8394 return NULL;
8395 }
8396 expr_ty res = NULL;
8397 int mark = p->mark;
8398 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8399 p->error_indicator = 1;
8400 return NULL;
8401 }
8402 int start_lineno = p->tokens[mark]->lineno;
8403 UNUSED(start_lineno); // Only used by EXTRA macro
8404 int start_col_offset = p->tokens[mark]->col_offset;
8405 UNUSED(start_col_offset); // Only used by EXTRA macro
8406 { // '{' expression for_if_clauses '}'
8407 expr_ty a;
8408 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008409 Token * literal;
8410 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008411 if (
8412 (literal = _PyPegen_expect_token(p, 25))
8413 &&
8414 (a = expression_rule(p))
8415 &&
8416 (b = for_if_clauses_rule(p))
8417 &&
8418 (literal_1 = _PyPegen_expect_token(p, 26))
8419 )
8420 {
8421 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8422 if (token == NULL) {
8423 return NULL;
8424 }
8425 int end_lineno = token->end_lineno;
8426 UNUSED(end_lineno); // Only used by EXTRA macro
8427 int end_col_offset = token->end_col_offset;
8428 UNUSED(end_col_offset); // Only used by EXTRA macro
8429 res = _Py_SetComp ( a , b , EXTRA );
8430 if (res == NULL && PyErr_Occurred()) {
8431 p->error_indicator = 1;
8432 return NULL;
8433 }
8434 goto done;
8435 }
8436 p->mark = mark;
8437 }
8438 { // invalid_comprehension
8439 void *invalid_comprehension_var;
8440 if (
8441 (invalid_comprehension_var = invalid_comprehension_rule(p))
8442 )
8443 {
8444 res = invalid_comprehension_var;
8445 goto done;
8446 }
8447 p->mark = mark;
8448 }
8449 res = NULL;
8450 done:
8451 return res;
8452}
8453
8454// dict: '{' kvpairs? '}'
8455static expr_ty
8456dict_rule(Parser *p)
8457{
8458 if (p->error_indicator) {
8459 return NULL;
8460 }
8461 expr_ty res = NULL;
8462 int mark = p->mark;
8463 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8464 p->error_indicator = 1;
8465 return NULL;
8466 }
8467 int start_lineno = p->tokens[mark]->lineno;
8468 UNUSED(start_lineno); // Only used by EXTRA macro
8469 int start_col_offset = p->tokens[mark]->col_offset;
8470 UNUSED(start_col_offset); // Only used by EXTRA macro
8471 { // '{' kvpairs? '}'
8472 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008473 Token * literal;
8474 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008475 if (
8476 (literal = _PyPegen_expect_token(p, 25))
8477 &&
8478 (a = kvpairs_rule(p), 1)
8479 &&
8480 (literal_1 = _PyPegen_expect_token(p, 26))
8481 )
8482 {
8483 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8484 if (token == NULL) {
8485 return NULL;
8486 }
8487 int end_lineno = token->end_lineno;
8488 UNUSED(end_lineno); // Only used by EXTRA macro
8489 int end_col_offset = token->end_col_offset;
8490 UNUSED(end_col_offset); // Only used by EXTRA macro
8491 res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA );
8492 if (res == NULL && PyErr_Occurred()) {
8493 p->error_indicator = 1;
8494 return NULL;
8495 }
8496 goto done;
8497 }
8498 p->mark = mark;
8499 }
8500 res = NULL;
8501 done:
8502 return res;
8503}
8504
8505// dictcomp: '{' kvpair for_if_clauses '}'
8506static expr_ty
8507dictcomp_rule(Parser *p)
8508{
8509 if (p->error_indicator) {
8510 return NULL;
8511 }
8512 expr_ty res = NULL;
8513 int mark = p->mark;
8514 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8515 p->error_indicator = 1;
8516 return NULL;
8517 }
8518 int start_lineno = p->tokens[mark]->lineno;
8519 UNUSED(start_lineno); // Only used by EXTRA macro
8520 int start_col_offset = p->tokens[mark]->col_offset;
8521 UNUSED(start_col_offset); // Only used by EXTRA macro
8522 { // '{' kvpair for_if_clauses '}'
8523 KeyValuePair* a;
8524 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008525 Token * literal;
8526 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008527 if (
8528 (literal = _PyPegen_expect_token(p, 25))
8529 &&
8530 (a = kvpair_rule(p))
8531 &&
8532 (b = for_if_clauses_rule(p))
8533 &&
8534 (literal_1 = _PyPegen_expect_token(p, 26))
8535 )
8536 {
8537 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8538 if (token == NULL) {
8539 return NULL;
8540 }
8541 int end_lineno = token->end_lineno;
8542 UNUSED(end_lineno); // Only used by EXTRA macro
8543 int end_col_offset = token->end_col_offset;
8544 UNUSED(end_col_offset); // Only used by EXTRA macro
8545 res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
8546 if (res == NULL && PyErr_Occurred()) {
8547 p->error_indicator = 1;
8548 return NULL;
8549 }
8550 goto done;
8551 }
8552 p->mark = mark;
8553 }
8554 res = NULL;
8555 done:
8556 return res;
8557}
8558
8559// kvpairs: ','.kvpair+ ','?
8560static asdl_seq*
8561kvpairs_rule(Parser *p)
8562{
8563 if (p->error_indicator) {
8564 return NULL;
8565 }
8566 asdl_seq* res = NULL;
8567 int mark = p->mark;
8568 { // ','.kvpair+ ','?
8569 asdl_seq * a;
8570 void *opt_var;
8571 UNUSED(opt_var); // Silence compiler warnings
8572 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07008573 (a = _gather_102_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008574 &&
8575 (opt_var = _PyPegen_expect_token(p, 12), 1)
8576 )
8577 {
8578 res = a;
8579 if (res == NULL && PyErr_Occurred()) {
8580 p->error_indicator = 1;
8581 return NULL;
8582 }
8583 goto done;
8584 }
8585 p->mark = mark;
8586 }
8587 res = NULL;
8588 done:
8589 return res;
8590}
8591
8592// kvpair: '**' bitwise_or | expression ':' expression
8593static KeyValuePair*
8594kvpair_rule(Parser *p)
8595{
8596 if (p->error_indicator) {
8597 return NULL;
8598 }
8599 KeyValuePair* res = NULL;
8600 int mark = p->mark;
8601 { // '**' bitwise_or
8602 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008603 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008604 if (
8605 (literal = _PyPegen_expect_token(p, 35))
8606 &&
8607 (a = bitwise_or_rule(p))
8608 )
8609 {
8610 res = _PyPegen_key_value_pair ( p , NULL , a );
8611 if (res == NULL && PyErr_Occurred()) {
8612 p->error_indicator = 1;
8613 return NULL;
8614 }
8615 goto done;
8616 }
8617 p->mark = mark;
8618 }
8619 { // expression ':' expression
8620 expr_ty a;
8621 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008622 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008623 if (
8624 (a = expression_rule(p))
8625 &&
8626 (literal = _PyPegen_expect_token(p, 11))
8627 &&
8628 (b = expression_rule(p))
8629 )
8630 {
8631 res = _PyPegen_key_value_pair ( p , a , b );
8632 if (res == NULL && PyErr_Occurred()) {
8633 p->error_indicator = 1;
8634 return NULL;
8635 }
8636 goto done;
8637 }
8638 p->mark = mark;
8639 }
8640 res = NULL;
8641 done:
8642 return res;
8643}
8644
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008645// for_if_clauses: for_if_clause+
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008646static asdl_seq*
8647for_if_clauses_rule(Parser *p)
8648{
8649 if (p->error_indicator) {
8650 return NULL;
8651 }
8652 asdl_seq* res = NULL;
8653 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008654 { // for_if_clause+
Guido van Rossum3941d972020-05-01 09:42:03 -07008655 asdl_seq * _loop1_104_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008656 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07008657 (_loop1_104_var = _loop1_104_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008658 )
8659 {
Guido van Rossum3941d972020-05-01 09:42:03 -07008660 res = _loop1_104_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008661 goto done;
8662 }
8663 p->mark = mark;
8664 }
8665 res = NULL;
8666 done:
8667 return res;
8668}
8669
8670// for_if_clause:
8671// | ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*
8672// | 'for' star_targets 'in' disjunction (('if' disjunction))*
8673static comprehension_ty
8674for_if_clause_rule(Parser *p)
8675{
8676 if (p->error_indicator) {
8677 return NULL;
8678 }
8679 comprehension_ty res = NULL;
8680 int mark = p->mark;
8681 { // ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*
8682 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008683 Token * async_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008684 expr_ty b;
8685 asdl_seq * c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008686 Token * keyword;
8687 Token * keyword_1;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008688 if (
8689 (async_var = _PyPegen_expect_token(p, ASYNC))
8690 &&
8691 (keyword = _PyPegen_expect_token(p, 517))
8692 &&
8693 (a = star_targets_rule(p))
8694 &&
8695 (keyword_1 = _PyPegen_expect_token(p, 518))
8696 &&
8697 (b = disjunction_rule(p))
8698 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008699 (c = _loop0_105_rule(p))
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008700 )
8701 {
8702 res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) );
8703 if (res == NULL && PyErr_Occurred()) {
8704 p->error_indicator = 1;
8705 return NULL;
8706 }
8707 goto done;
8708 }
8709 p->mark = mark;
8710 }
8711 { // 'for' star_targets 'in' disjunction (('if' disjunction))*
8712 expr_ty a;
8713 expr_ty b;
8714 asdl_seq * c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008715 Token * keyword;
8716 Token * keyword_1;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008717 if (
8718 (keyword = _PyPegen_expect_token(p, 517))
8719 &&
8720 (a = star_targets_rule(p))
8721 &&
8722 (keyword_1 = _PyPegen_expect_token(p, 518))
8723 &&
8724 (b = disjunction_rule(p))
8725 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008726 (c = _loop0_106_rule(p))
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008727 )
8728 {
8729 res = _Py_comprehension ( a , b , c , 0 , p -> arena );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008730 if (res == NULL && PyErr_Occurred()) {
8731 p->error_indicator = 1;
8732 return NULL;
8733 }
8734 goto done;
8735 }
8736 p->mark = mark;
8737 }
8738 res = NULL;
8739 done:
8740 return res;
8741}
8742
8743// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
8744static expr_ty
8745yield_expr_rule(Parser *p)
8746{
8747 if (p->error_indicator) {
8748 return NULL;
8749 }
8750 expr_ty res = NULL;
8751 int mark = p->mark;
8752 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8753 p->error_indicator = 1;
8754 return NULL;
8755 }
8756 int start_lineno = p->tokens[mark]->lineno;
8757 UNUSED(start_lineno); // Only used by EXTRA macro
8758 int start_col_offset = p->tokens[mark]->col_offset;
8759 UNUSED(start_col_offset); // Only used by EXTRA macro
8760 { // 'yield' 'from' expression
8761 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008762 Token * keyword;
8763 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008764 if (
8765 (keyword = _PyPegen_expect_token(p, 504))
8766 &&
8767 (keyword_1 = _PyPegen_expect_token(p, 514))
8768 &&
8769 (a = expression_rule(p))
8770 )
8771 {
8772 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8773 if (token == NULL) {
8774 return NULL;
8775 }
8776 int end_lineno = token->end_lineno;
8777 UNUSED(end_lineno); // Only used by EXTRA macro
8778 int end_col_offset = token->end_col_offset;
8779 UNUSED(end_col_offset); // Only used by EXTRA macro
8780 res = _Py_YieldFrom ( a , EXTRA );
8781 if (res == NULL && PyErr_Occurred()) {
8782 p->error_indicator = 1;
8783 return NULL;
8784 }
8785 goto done;
8786 }
8787 p->mark = mark;
8788 }
8789 { // 'yield' star_expressions?
8790 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008791 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008792 if (
8793 (keyword = _PyPegen_expect_token(p, 504))
8794 &&
8795 (a = star_expressions_rule(p), 1)
8796 )
8797 {
8798 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8799 if (token == NULL) {
8800 return NULL;
8801 }
8802 int end_lineno = token->end_lineno;
8803 UNUSED(end_lineno); // Only used by EXTRA macro
8804 int end_col_offset = token->end_col_offset;
8805 UNUSED(end_col_offset); // Only used by EXTRA macro
8806 res = _Py_Yield ( a , EXTRA );
8807 if (res == NULL && PyErr_Occurred()) {
8808 p->error_indicator = 1;
8809 return NULL;
8810 }
8811 goto done;
8812 }
8813 p->mark = mark;
8814 }
8815 res = NULL;
8816 done:
8817 return res;
8818}
8819
8820// arguments: args ','? &')' | incorrect_arguments
8821static expr_ty
8822arguments_rule(Parser *p)
8823{
8824 if (p->error_indicator) {
8825 return NULL;
8826 }
8827 expr_ty res = NULL;
8828 if (_PyPegen_is_memoized(p, arguments_type, &res))
8829 return res;
8830 int mark = p->mark;
8831 { // args ','? &')'
8832 expr_ty a;
8833 void *opt_var;
8834 UNUSED(opt_var); // Silence compiler warnings
8835 if (
8836 (a = args_rule(p))
8837 &&
8838 (opt_var = _PyPegen_expect_token(p, 12), 1)
8839 &&
8840 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
8841 )
8842 {
8843 res = a;
8844 if (res == NULL && PyErr_Occurred()) {
8845 p->error_indicator = 1;
8846 return NULL;
8847 }
8848 goto done;
8849 }
8850 p->mark = mark;
8851 }
8852 { // incorrect_arguments
8853 void *incorrect_arguments_var;
8854 if (
8855 (incorrect_arguments_var = incorrect_arguments_rule(p))
8856 )
8857 {
8858 res = incorrect_arguments_var;
8859 goto done;
8860 }
8861 p->mark = mark;
8862 }
8863 res = NULL;
8864 done:
8865 _PyPegen_insert_memo(p, mark, arguments_type, res);
8866 return res;
8867}
8868
8869// args: starred_expression [',' args] | kwargs | named_expression [',' args]
8870static expr_ty
8871args_rule(Parser *p)
8872{
8873 if (p->error_indicator) {
8874 return NULL;
8875 }
8876 expr_ty res = NULL;
8877 int mark = p->mark;
8878 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8879 p->error_indicator = 1;
8880 return NULL;
8881 }
8882 int start_lineno = p->tokens[mark]->lineno;
8883 UNUSED(start_lineno); // Only used by EXTRA macro
8884 int start_col_offset = p->tokens[mark]->col_offset;
8885 UNUSED(start_col_offset); // Only used by EXTRA macro
8886 { // starred_expression [',' args]
8887 expr_ty a;
8888 void *b;
8889 if (
8890 (a = starred_expression_rule(p))
8891 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008892 (b = _tmp_107_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008893 )
8894 {
8895 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8896 if (token == NULL) {
8897 return NULL;
8898 }
8899 int end_lineno = token->end_lineno;
8900 UNUSED(end_lineno); // Only used by EXTRA macro
8901 int end_col_offset = token->end_col_offset;
8902 UNUSED(end_col_offset); // Only used by EXTRA macro
8903 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 );
8904 if (res == NULL && PyErr_Occurred()) {
8905 p->error_indicator = 1;
8906 return NULL;
8907 }
8908 goto done;
8909 }
8910 p->mark = mark;
8911 }
8912 { // kwargs
8913 asdl_seq* a;
8914 if (
8915 (a = kwargs_rule(p))
8916 )
8917 {
8918 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8919 if (token == NULL) {
8920 return NULL;
8921 }
8922 int end_lineno = token->end_lineno;
8923 UNUSED(end_lineno); // Only used by EXTRA macro
8924 int end_col_offset = token->end_col_offset;
8925 UNUSED(end_col_offset); // Only used by EXTRA macro
8926 res = _Py_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 );
8927 if (res == NULL && PyErr_Occurred()) {
8928 p->error_indicator = 1;
8929 return NULL;
8930 }
8931 goto done;
8932 }
8933 p->mark = mark;
8934 }
8935 { // named_expression [',' args]
8936 expr_ty a;
8937 void *b;
8938 if (
8939 (a = named_expression_rule(p))
8940 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008941 (b = _tmp_108_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008942 )
8943 {
8944 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8945 if (token == NULL) {
8946 return NULL;
8947 }
8948 int end_lineno = token->end_lineno;
8949 UNUSED(end_lineno); // Only used by EXTRA macro
8950 int end_col_offset = token->end_col_offset;
8951 UNUSED(end_col_offset); // Only used by EXTRA macro
8952 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 );
8953 if (res == NULL && PyErr_Occurred()) {
8954 p->error_indicator = 1;
8955 return NULL;
8956 }
8957 goto done;
8958 }
8959 p->mark = mark;
8960 }
8961 res = NULL;
8962 done:
8963 return res;
8964}
8965
8966// kwargs:
8967// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
8968// | ','.kwarg_or_starred+
8969// | ','.kwarg_or_double_starred+
8970static asdl_seq*
8971kwargs_rule(Parser *p)
8972{
8973 if (p->error_indicator) {
8974 return NULL;
8975 }
8976 asdl_seq* res = NULL;
8977 int mark = p->mark;
8978 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
8979 asdl_seq * a;
8980 asdl_seq * b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008981 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008982 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07008983 (a = _gather_109_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008984 &&
8985 (literal = _PyPegen_expect_token(p, 12))
8986 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008987 (b = _gather_111_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008988 )
8989 {
8990 res = _PyPegen_join_sequences ( p , a , b );
8991 if (res == NULL && PyErr_Occurred()) {
8992 p->error_indicator = 1;
8993 return NULL;
8994 }
8995 goto done;
8996 }
8997 p->mark = mark;
8998 }
8999 { // ','.kwarg_or_starred+
Guido van Rossum3941d972020-05-01 09:42:03 -07009000 asdl_seq * _gather_113_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009001 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07009002 (_gather_113_var = _gather_113_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009003 )
9004 {
Guido van Rossum3941d972020-05-01 09:42:03 -07009005 res = _gather_113_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009006 goto done;
9007 }
9008 p->mark = mark;
9009 }
9010 { // ','.kwarg_or_double_starred+
Guido van Rossum3941d972020-05-01 09:42:03 -07009011 asdl_seq * _gather_115_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009012 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07009013 (_gather_115_var = _gather_115_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009014 )
9015 {
Guido van Rossum3941d972020-05-01 09:42:03 -07009016 res = _gather_115_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009017 goto done;
9018 }
9019 p->mark = mark;
9020 }
9021 res = NULL;
9022 done:
9023 return res;
9024}
9025
9026// starred_expression: '*' expression
9027static expr_ty
9028starred_expression_rule(Parser *p)
9029{
9030 if (p->error_indicator) {
9031 return NULL;
9032 }
9033 expr_ty res = NULL;
9034 int mark = p->mark;
9035 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9036 p->error_indicator = 1;
9037 return NULL;
9038 }
9039 int start_lineno = p->tokens[mark]->lineno;
9040 UNUSED(start_lineno); // Only used by EXTRA macro
9041 int start_col_offset = p->tokens[mark]->col_offset;
9042 UNUSED(start_col_offset); // Only used by EXTRA macro
9043 { // '*' expression
9044 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009045 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009046 if (
9047 (literal = _PyPegen_expect_token(p, 16))
9048 &&
9049 (a = expression_rule(p))
9050 )
9051 {
9052 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9053 if (token == NULL) {
9054 return NULL;
9055 }
9056 int end_lineno = token->end_lineno;
9057 UNUSED(end_lineno); // Only used by EXTRA macro
9058 int end_col_offset = token->end_col_offset;
9059 UNUSED(end_col_offset); // Only used by EXTRA macro
9060 res = _Py_Starred ( a , Load , EXTRA );
9061 if (res == NULL && PyErr_Occurred()) {
9062 p->error_indicator = 1;
9063 return NULL;
9064 }
9065 goto done;
9066 }
9067 p->mark = mark;
9068 }
9069 res = NULL;
9070 done:
9071 return res;
9072}
9073
9074// kwarg_or_starred: NAME '=' expression | starred_expression
9075static KeywordOrStarred*
9076kwarg_or_starred_rule(Parser *p)
9077{
9078 if (p->error_indicator) {
9079 return NULL;
9080 }
9081 KeywordOrStarred* res = NULL;
9082 int mark = p->mark;
9083 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9084 p->error_indicator = 1;
9085 return NULL;
9086 }
9087 int start_lineno = p->tokens[mark]->lineno;
9088 UNUSED(start_lineno); // Only used by EXTRA macro
9089 int start_col_offset = p->tokens[mark]->col_offset;
9090 UNUSED(start_col_offset); // Only used by EXTRA macro
9091 { // NAME '=' expression
9092 expr_ty a;
9093 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009094 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009095 if (
9096 (a = _PyPegen_name_token(p))
9097 &&
9098 (literal = _PyPegen_expect_token(p, 22))
9099 &&
9100 (b = expression_rule(p))
9101 )
9102 {
9103 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9104 if (token == NULL) {
9105 return NULL;
9106 }
9107 int end_lineno = token->end_lineno;
9108 UNUSED(end_lineno); // Only used by EXTRA macro
9109 int end_col_offset = token->end_col_offset;
9110 UNUSED(end_col_offset); // Only used by EXTRA macro
9111 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
9112 if (res == NULL && PyErr_Occurred()) {
9113 p->error_indicator = 1;
9114 return NULL;
9115 }
9116 goto done;
9117 }
9118 p->mark = mark;
9119 }
9120 { // starred_expression
9121 expr_ty a;
9122 if (
9123 (a = starred_expression_rule(p))
9124 )
9125 {
9126 res = _PyPegen_keyword_or_starred ( p , a , 0 );
9127 if (res == NULL && PyErr_Occurred()) {
9128 p->error_indicator = 1;
9129 return NULL;
9130 }
9131 goto done;
9132 }
9133 p->mark = mark;
9134 }
9135 res = NULL;
9136 done:
9137 return res;
9138}
9139
9140// kwarg_or_double_starred: NAME '=' expression | '**' expression
9141static KeywordOrStarred*
9142kwarg_or_double_starred_rule(Parser *p)
9143{
9144 if (p->error_indicator) {
9145 return NULL;
9146 }
9147 KeywordOrStarred* res = NULL;
9148 int mark = p->mark;
9149 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9150 p->error_indicator = 1;
9151 return NULL;
9152 }
9153 int start_lineno = p->tokens[mark]->lineno;
9154 UNUSED(start_lineno); // Only used by EXTRA macro
9155 int start_col_offset = p->tokens[mark]->col_offset;
9156 UNUSED(start_col_offset); // Only used by EXTRA macro
9157 { // NAME '=' expression
9158 expr_ty a;
9159 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009160 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009161 if (
9162 (a = _PyPegen_name_token(p))
9163 &&
9164 (literal = _PyPegen_expect_token(p, 22))
9165 &&
9166 (b = expression_rule(p))
9167 )
9168 {
9169 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9170 if (token == NULL) {
9171 return NULL;
9172 }
9173 int end_lineno = token->end_lineno;
9174 UNUSED(end_lineno); // Only used by EXTRA macro
9175 int end_col_offset = token->end_col_offset;
9176 UNUSED(end_col_offset); // Only used by EXTRA macro
9177 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
9178 if (res == NULL && PyErr_Occurred()) {
9179 p->error_indicator = 1;
9180 return NULL;
9181 }
9182 goto done;
9183 }
9184 p->mark = mark;
9185 }
9186 { // '**' expression
9187 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009188 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009189 if (
9190 (literal = _PyPegen_expect_token(p, 35))
9191 &&
9192 (a = expression_rule(p))
9193 )
9194 {
9195 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9196 if (token == NULL) {
9197 return NULL;
9198 }
9199 int end_lineno = token->end_lineno;
9200 UNUSED(end_lineno); // Only used by EXTRA macro
9201 int end_col_offset = token->end_col_offset;
9202 UNUSED(end_col_offset); // Only used by EXTRA macro
9203 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
9204 if (res == NULL && PyErr_Occurred()) {
9205 p->error_indicator = 1;
9206 return NULL;
9207 }
9208 goto done;
9209 }
9210 p->mark = mark;
9211 }
9212 res = NULL;
9213 done:
9214 return res;
9215}
9216
9217// star_targets: star_target !',' | star_target ((',' star_target))* ','?
9218static expr_ty
9219star_targets_rule(Parser *p)
9220{
9221 if (p->error_indicator) {
9222 return NULL;
9223 }
9224 expr_ty res = NULL;
9225 int mark = p->mark;
9226 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9227 p->error_indicator = 1;
9228 return NULL;
9229 }
9230 int start_lineno = p->tokens[mark]->lineno;
9231 UNUSED(start_lineno); // Only used by EXTRA macro
9232 int start_col_offset = p->tokens[mark]->col_offset;
9233 UNUSED(start_col_offset); // Only used by EXTRA macro
9234 { // star_target !','
9235 expr_ty a;
9236 if (
9237 (a = star_target_rule(p))
9238 &&
9239 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)
9240 )
9241 {
9242 res = a;
9243 if (res == NULL && PyErr_Occurred()) {
9244 p->error_indicator = 1;
9245 return NULL;
9246 }
9247 goto done;
9248 }
9249 p->mark = mark;
9250 }
9251 { // star_target ((',' star_target))* ','?
9252 expr_ty a;
9253 asdl_seq * b;
9254 void *opt_var;
9255 UNUSED(opt_var); // Silence compiler warnings
9256 if (
9257 (a = star_target_rule(p))
9258 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07009259 (b = _loop0_117_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009260 &&
9261 (opt_var = _PyPegen_expect_token(p, 12), 1)
9262 )
9263 {
9264 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9265 if (token == NULL) {
9266 return NULL;
9267 }
9268 int end_lineno = token->end_lineno;
9269 UNUSED(end_lineno); // Only used by EXTRA macro
9270 int end_col_offset = token->end_col_offset;
9271 UNUSED(end_col_offset); // Only used by EXTRA macro
9272 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
9273 if (res == NULL && PyErr_Occurred()) {
9274 p->error_indicator = 1;
9275 return NULL;
9276 }
9277 goto done;
9278 }
9279 p->mark = mark;
9280 }
9281 res = NULL;
9282 done:
9283 return res;
9284}
9285
9286// star_targets_seq: ','.star_target+ ','?
9287static asdl_seq*
9288star_targets_seq_rule(Parser *p)
9289{
9290 if (p->error_indicator) {
9291 return NULL;
9292 }
9293 asdl_seq* res = NULL;
9294 int mark = p->mark;
9295 { // ','.star_target+ ','?
9296 asdl_seq * a;
9297 void *opt_var;
9298 UNUSED(opt_var); // Silence compiler warnings
9299 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07009300 (a = _gather_118_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009301 &&
9302 (opt_var = _PyPegen_expect_token(p, 12), 1)
9303 )
9304 {
9305 res = a;
9306 if (res == NULL && PyErr_Occurred()) {
9307 p->error_indicator = 1;
9308 return NULL;
9309 }
9310 goto done;
9311 }
9312 p->mark = mark;
9313 }
9314 res = NULL;
9315 done:
9316 return res;
9317}
9318
9319// star_target:
9320// | '*' (!'*' star_target)
9321// | t_primary '.' NAME !t_lookahead
9322// | t_primary '[' slices ']' !t_lookahead
9323// | star_atom
9324static expr_ty
9325star_target_rule(Parser *p)
9326{
9327 if (p->error_indicator) {
9328 return NULL;
9329 }
9330 expr_ty res = NULL;
9331 if (_PyPegen_is_memoized(p, star_target_type, &res))
9332 return res;
9333 int mark = p->mark;
9334 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9335 p->error_indicator = 1;
9336 return NULL;
9337 }
9338 int start_lineno = p->tokens[mark]->lineno;
9339 UNUSED(start_lineno); // Only used by EXTRA macro
9340 int start_col_offset = p->tokens[mark]->col_offset;
9341 UNUSED(start_col_offset); // Only used by EXTRA macro
9342 { // '*' (!'*' star_target)
9343 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009344 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009345 if (
9346 (literal = _PyPegen_expect_token(p, 16))
9347 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07009348 (a = _tmp_120_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009349 )
9350 {
9351 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9352 if (token == NULL) {
9353 return NULL;
9354 }
9355 int end_lineno = token->end_lineno;
9356 UNUSED(end_lineno); // Only used by EXTRA macro
9357 int end_col_offset = token->end_col_offset;
9358 UNUSED(end_col_offset); // Only used by EXTRA macro
9359 res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
9360 if (res == NULL && PyErr_Occurred()) {
9361 p->error_indicator = 1;
9362 return NULL;
9363 }
9364 goto done;
9365 }
9366 p->mark = mark;
9367 }
9368 { // t_primary '.' NAME !t_lookahead
9369 expr_ty a;
9370 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009371 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009372 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 , Store , 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;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009402 Token * literal;
9403 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009404 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 , Store , 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 { // star_atom
9434 expr_ty star_atom_var;
9435 if (
9436 (star_atom_var = star_atom_rule(p))
9437 )
9438 {
9439 res = star_atom_var;
9440 goto done;
9441 }
9442 p->mark = mark;
9443 }
9444 res = NULL;
9445 done:
9446 _PyPegen_insert_memo(p, mark, star_target_type, res);
9447 return res;
9448}
9449
9450// star_atom:
9451// | NAME
9452// | '(' star_target ')'
9453// | '(' star_targets_seq? ')'
9454// | '[' star_targets_seq? ']'
9455static expr_ty
9456star_atom_rule(Parser *p)
9457{
9458 if (p->error_indicator) {
9459 return NULL;
9460 }
9461 expr_ty res = NULL;
9462 int mark = p->mark;
9463 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9464 p->error_indicator = 1;
9465 return NULL;
9466 }
9467 int start_lineno = p->tokens[mark]->lineno;
9468 UNUSED(start_lineno); // Only used by EXTRA macro
9469 int start_col_offset = p->tokens[mark]->col_offset;
9470 UNUSED(start_col_offset); // Only used by EXTRA macro
9471 { // NAME
9472 expr_ty a;
9473 if (
9474 (a = _PyPegen_name_token(p))
9475 )
9476 {
9477 res = _PyPegen_set_expr_context ( p , a , Store );
9478 if (res == NULL && PyErr_Occurred()) {
9479 p->error_indicator = 1;
9480 return NULL;
9481 }
9482 goto done;
9483 }
9484 p->mark = mark;
9485 }
9486 { // '(' star_target ')'
9487 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009488 Token * literal;
9489 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009490 if (
9491 (literal = _PyPegen_expect_token(p, 7))
9492 &&
9493 (a = star_target_rule(p))
9494 &&
9495 (literal_1 = _PyPegen_expect_token(p, 8))
9496 )
9497 {
9498 res = _PyPegen_set_expr_context ( p , a , Store );
9499 if (res == NULL && PyErr_Occurred()) {
9500 p->error_indicator = 1;
9501 return NULL;
9502 }
9503 goto done;
9504 }
9505 p->mark = mark;
9506 }
9507 { // '(' star_targets_seq? ')'
9508 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009509 Token * literal;
9510 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009511 if (
9512 (literal = _PyPegen_expect_token(p, 7))
9513 &&
9514 (a = star_targets_seq_rule(p), 1)
9515 &&
9516 (literal_1 = _PyPegen_expect_token(p, 8))
9517 )
9518 {
9519 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9520 if (token == NULL) {
9521 return NULL;
9522 }
9523 int end_lineno = token->end_lineno;
9524 UNUSED(end_lineno); // Only used by EXTRA macro
9525 int end_col_offset = token->end_col_offset;
9526 UNUSED(end_col_offset); // Only used by EXTRA macro
9527 res = _Py_Tuple ( a , Store , EXTRA );
9528 if (res == NULL && PyErr_Occurred()) {
9529 p->error_indicator = 1;
9530 return NULL;
9531 }
9532 goto done;
9533 }
9534 p->mark = mark;
9535 }
9536 { // '[' star_targets_seq? ']'
9537 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009538 Token * literal;
9539 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009540 if (
9541 (literal = _PyPegen_expect_token(p, 9))
9542 &&
9543 (a = star_targets_seq_rule(p), 1)
9544 &&
9545 (literal_1 = _PyPegen_expect_token(p, 10))
9546 )
9547 {
9548 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9549 if (token == NULL) {
9550 return NULL;
9551 }
9552 int end_lineno = token->end_lineno;
9553 UNUSED(end_lineno); // Only used by EXTRA macro
9554 int end_col_offset = token->end_col_offset;
9555 UNUSED(end_col_offset); // Only used by EXTRA macro
9556 res = _Py_List ( a , Store , EXTRA );
9557 if (res == NULL && PyErr_Occurred()) {
9558 p->error_indicator = 1;
9559 return NULL;
9560 }
9561 goto done;
9562 }
9563 p->mark = mark;
9564 }
9565 res = NULL;
9566 done:
9567 return res;
9568}
9569
9570// inside_paren_ann_assign_target:
9571// | ann_assign_subscript_attribute_target
9572// | NAME
9573// | '(' inside_paren_ann_assign_target ')'
9574static expr_ty
9575inside_paren_ann_assign_target_rule(Parser *p)
9576{
9577 if (p->error_indicator) {
9578 return NULL;
9579 }
9580 expr_ty res = NULL;
9581 int mark = p->mark;
9582 { // ann_assign_subscript_attribute_target
9583 expr_ty ann_assign_subscript_attribute_target_var;
9584 if (
9585 (ann_assign_subscript_attribute_target_var = ann_assign_subscript_attribute_target_rule(p))
9586 )
9587 {
9588 res = ann_assign_subscript_attribute_target_var;
9589 goto done;
9590 }
9591 p->mark = mark;
9592 }
9593 { // NAME
9594 expr_ty a;
9595 if (
9596 (a = _PyPegen_name_token(p))
9597 )
9598 {
9599 res = _PyPegen_set_expr_context ( p , a , Store );
9600 if (res == NULL && PyErr_Occurred()) {
9601 p->error_indicator = 1;
9602 return NULL;
9603 }
9604 goto done;
9605 }
9606 p->mark = mark;
9607 }
9608 { // '(' inside_paren_ann_assign_target ')'
9609 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009610 Token * literal;
9611 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009612 if (
9613 (literal = _PyPegen_expect_token(p, 7))
9614 &&
9615 (a = inside_paren_ann_assign_target_rule(p))
9616 &&
9617 (literal_1 = _PyPegen_expect_token(p, 8))
9618 )
9619 {
9620 res = a;
9621 if (res == NULL && PyErr_Occurred()) {
9622 p->error_indicator = 1;
9623 return NULL;
9624 }
9625 goto done;
9626 }
9627 p->mark = mark;
9628 }
9629 res = NULL;
9630 done:
9631 return res;
9632}
9633
9634// ann_assign_subscript_attribute_target:
9635// | t_primary '.' NAME !t_lookahead
9636// | t_primary '[' slices ']' !t_lookahead
9637static expr_ty
9638ann_assign_subscript_attribute_target_rule(Parser *p)
9639{
9640 if (p->error_indicator) {
9641 return NULL;
9642 }
9643 expr_ty res = NULL;
9644 int mark = p->mark;
9645 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9646 p->error_indicator = 1;
9647 return NULL;
9648 }
9649 int start_lineno = p->tokens[mark]->lineno;
9650 UNUSED(start_lineno); // Only used by EXTRA macro
9651 int start_col_offset = p->tokens[mark]->col_offset;
9652 UNUSED(start_col_offset); // Only used by EXTRA macro
9653 { // t_primary '.' NAME !t_lookahead
9654 expr_ty a;
9655 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009656 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009657 if (
9658 (a = t_primary_rule(p))
9659 &&
9660 (literal = _PyPegen_expect_token(p, 23))
9661 &&
9662 (b = _PyPegen_name_token(p))
9663 &&
9664 _PyPegen_lookahead(0, t_lookahead_rule, p)
9665 )
9666 {
9667 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9668 if (token == NULL) {
9669 return NULL;
9670 }
9671 int end_lineno = token->end_lineno;
9672 UNUSED(end_lineno); // Only used by EXTRA macro
9673 int end_col_offset = token->end_col_offset;
9674 UNUSED(end_col_offset); // Only used by EXTRA macro
9675 res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
9676 if (res == NULL && PyErr_Occurred()) {
9677 p->error_indicator = 1;
9678 return NULL;
9679 }
9680 goto done;
9681 }
9682 p->mark = mark;
9683 }
9684 { // t_primary '[' slices ']' !t_lookahead
9685 expr_ty a;
9686 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009687 Token * literal;
9688 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009689 if (
9690 (a = t_primary_rule(p))
9691 &&
9692 (literal = _PyPegen_expect_token(p, 9))
9693 &&
9694 (b = slices_rule(p))
9695 &&
9696 (literal_1 = _PyPegen_expect_token(p, 10))
9697 &&
9698 _PyPegen_lookahead(0, t_lookahead_rule, p)
9699 )
9700 {
9701 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9702 if (token == NULL) {
9703 return NULL;
9704 }
9705 int end_lineno = token->end_lineno;
9706 UNUSED(end_lineno); // Only used by EXTRA macro
9707 int end_col_offset = token->end_col_offset;
9708 UNUSED(end_col_offset); // Only used by EXTRA macro
9709 res = _Py_Subscript ( a , b , Store , EXTRA );
9710 if (res == NULL && PyErr_Occurred()) {
9711 p->error_indicator = 1;
9712 return NULL;
9713 }
9714 goto done;
9715 }
9716 p->mark = mark;
9717 }
9718 res = NULL;
9719 done:
9720 return res;
9721}
9722
9723// del_targets: ','.del_target+ ','?
9724static asdl_seq*
9725del_targets_rule(Parser *p)
9726{
9727 if (p->error_indicator) {
9728 return NULL;
9729 }
9730 asdl_seq* res = NULL;
9731 int mark = p->mark;
9732 { // ','.del_target+ ','?
9733 asdl_seq * a;
9734 void *opt_var;
9735 UNUSED(opt_var); // Silence compiler warnings
9736 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07009737 (a = _gather_121_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009738 &&
9739 (opt_var = _PyPegen_expect_token(p, 12), 1)
9740 )
9741 {
9742 res = a;
9743 if (res == NULL && PyErr_Occurred()) {
9744 p->error_indicator = 1;
9745 return NULL;
9746 }
9747 goto done;
9748 }
9749 p->mark = mark;
9750 }
9751 res = NULL;
9752 done:
9753 return res;
9754}
9755
9756// del_target:
9757// | t_primary '.' NAME !t_lookahead
9758// | t_primary '[' slices ']' !t_lookahead
9759// | del_t_atom
9760static expr_ty
9761del_target_rule(Parser *p)
9762{
9763 if (p->error_indicator) {
9764 return NULL;
9765 }
9766 expr_ty res = NULL;
9767 if (_PyPegen_is_memoized(p, del_target_type, &res))
9768 return res;
9769 int mark = p->mark;
9770 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9771 p->error_indicator = 1;
9772 return NULL;
9773 }
9774 int start_lineno = p->tokens[mark]->lineno;
9775 UNUSED(start_lineno); // Only used by EXTRA macro
9776 int start_col_offset = p->tokens[mark]->col_offset;
9777 UNUSED(start_col_offset); // Only used by EXTRA macro
9778 { // t_primary '.' NAME !t_lookahead
9779 expr_ty a;
9780 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009781 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009782 if (
9783 (a = t_primary_rule(p))
9784 &&
9785 (literal = _PyPegen_expect_token(p, 23))
9786 &&
9787 (b = _PyPegen_name_token(p))
9788 &&
9789 _PyPegen_lookahead(0, t_lookahead_rule, p)
9790 )
9791 {
9792 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9793 if (token == NULL) {
9794 return NULL;
9795 }
9796 int end_lineno = token->end_lineno;
9797 UNUSED(end_lineno); // Only used by EXTRA macro
9798 int end_col_offset = token->end_col_offset;
9799 UNUSED(end_col_offset); // Only used by EXTRA macro
9800 res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
9801 if (res == NULL && PyErr_Occurred()) {
9802 p->error_indicator = 1;
9803 return NULL;
9804 }
9805 goto done;
9806 }
9807 p->mark = mark;
9808 }
9809 { // t_primary '[' slices ']' !t_lookahead
9810 expr_ty a;
9811 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009812 Token * literal;
9813 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009814 if (
9815 (a = t_primary_rule(p))
9816 &&
9817 (literal = _PyPegen_expect_token(p, 9))
9818 &&
9819 (b = slices_rule(p))
9820 &&
9821 (literal_1 = _PyPegen_expect_token(p, 10))
9822 &&
9823 _PyPegen_lookahead(0, 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_Subscript ( a , b , Del , 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 { // del_t_atom
9844 expr_ty del_t_atom_var;
9845 if (
9846 (del_t_atom_var = del_t_atom_rule(p))
9847 )
9848 {
9849 res = del_t_atom_var;
9850 goto done;
9851 }
9852 p->mark = mark;
9853 }
9854 res = NULL;
9855 done:
9856 _PyPegen_insert_memo(p, mark, del_target_type, res);
9857 return res;
9858}
9859
9860// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
9861static expr_ty
9862del_t_atom_rule(Parser *p)
9863{
9864 if (p->error_indicator) {
9865 return NULL;
9866 }
9867 expr_ty res = NULL;
9868 int mark = p->mark;
9869 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9870 p->error_indicator = 1;
9871 return NULL;
9872 }
9873 int start_lineno = p->tokens[mark]->lineno;
9874 UNUSED(start_lineno); // Only used by EXTRA macro
9875 int start_col_offset = p->tokens[mark]->col_offset;
9876 UNUSED(start_col_offset); // Only used by EXTRA macro
9877 { // NAME
9878 expr_ty a;
9879 if (
9880 (a = _PyPegen_name_token(p))
9881 )
9882 {
9883 res = _PyPegen_set_expr_context ( p , a , Del );
9884 if (res == NULL && PyErr_Occurred()) {
9885 p->error_indicator = 1;
9886 return NULL;
9887 }
9888 goto done;
9889 }
9890 p->mark = mark;
9891 }
9892 { // '(' del_target ')'
9893 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009894 Token * literal;
9895 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009896 if (
9897 (literal = _PyPegen_expect_token(p, 7))
9898 &&
9899 (a = del_target_rule(p))
9900 &&
9901 (literal_1 = _PyPegen_expect_token(p, 8))
9902 )
9903 {
9904 res = _PyPegen_set_expr_context ( p , a , Del );
9905 if (res == NULL && PyErr_Occurred()) {
9906 p->error_indicator = 1;
9907 return NULL;
9908 }
9909 goto done;
9910 }
9911 p->mark = mark;
9912 }
9913 { // '(' del_targets? ')'
9914 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009915 Token * literal;
9916 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009917 if (
9918 (literal = _PyPegen_expect_token(p, 7))
9919 &&
9920 (a = del_targets_rule(p), 1)
9921 &&
9922 (literal_1 = _PyPegen_expect_token(p, 8))
9923 )
9924 {
9925 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9926 if (token == NULL) {
9927 return NULL;
9928 }
9929 int end_lineno = token->end_lineno;
9930 UNUSED(end_lineno); // Only used by EXTRA macro
9931 int end_col_offset = token->end_col_offset;
9932 UNUSED(end_col_offset); // Only used by EXTRA macro
9933 res = _Py_Tuple ( a , Del , EXTRA );
9934 if (res == NULL && PyErr_Occurred()) {
9935 p->error_indicator = 1;
9936 return NULL;
9937 }
9938 goto done;
9939 }
9940 p->mark = mark;
9941 }
9942 { // '[' del_targets? ']'
9943 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009944 Token * literal;
9945 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009946 if (
9947 (literal = _PyPegen_expect_token(p, 9))
9948 &&
9949 (a = del_targets_rule(p), 1)
9950 &&
9951 (literal_1 = _PyPegen_expect_token(p, 10))
9952 )
9953 {
9954 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9955 if (token == NULL) {
9956 return NULL;
9957 }
9958 int end_lineno = token->end_lineno;
9959 UNUSED(end_lineno); // Only used by EXTRA macro
9960 int end_col_offset = token->end_col_offset;
9961 UNUSED(end_col_offset); // Only used by EXTRA macro
9962 res = _Py_List ( a , Del , EXTRA );
9963 if (res == NULL && PyErr_Occurred()) {
9964 p->error_indicator = 1;
9965 return NULL;
9966 }
9967 goto done;
9968 }
9969 p->mark = mark;
9970 }
9971 res = NULL;
9972 done:
9973 return res;
9974}
9975
9976// targets: ','.target+ ','?
9977static asdl_seq*
9978targets_rule(Parser *p)
9979{
9980 if (p->error_indicator) {
9981 return NULL;
9982 }
9983 asdl_seq* res = NULL;
9984 int mark = p->mark;
9985 { // ','.target+ ','?
9986 asdl_seq * a;
9987 void *opt_var;
9988 UNUSED(opt_var); // Silence compiler warnings
9989 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07009990 (a = _gather_123_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009991 &&
9992 (opt_var = _PyPegen_expect_token(p, 12), 1)
9993 )
9994 {
9995 res = a;
9996 if (res == NULL && PyErr_Occurred()) {
9997 p->error_indicator = 1;
9998 return NULL;
9999 }
10000 goto done;
10001 }
10002 p->mark = mark;
10003 }
10004 res = NULL;
10005 done:
10006 return res;
10007}
10008
10009// target:
10010// | t_primary '.' NAME !t_lookahead
10011// | t_primary '[' slices ']' !t_lookahead
10012// | t_atom
10013static expr_ty
10014target_rule(Parser *p)
10015{
10016 if (p->error_indicator) {
10017 return NULL;
10018 }
10019 expr_ty res = NULL;
10020 if (_PyPegen_is_memoized(p, target_type, &res))
10021 return res;
10022 int mark = p->mark;
10023 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10024 p->error_indicator = 1;
10025 return NULL;
10026 }
10027 int start_lineno = p->tokens[mark]->lineno;
10028 UNUSED(start_lineno); // Only used by EXTRA macro
10029 int start_col_offset = p->tokens[mark]->col_offset;
10030 UNUSED(start_col_offset); // Only used by EXTRA macro
10031 { // t_primary '.' NAME !t_lookahead
10032 expr_ty a;
10033 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010034 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010035 if (
10036 (a = t_primary_rule(p))
10037 &&
10038 (literal = _PyPegen_expect_token(p, 23))
10039 &&
10040 (b = _PyPegen_name_token(p))
10041 &&
10042 _PyPegen_lookahead(0, t_lookahead_rule, p)
10043 )
10044 {
10045 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10046 if (token == NULL) {
10047 return NULL;
10048 }
10049 int end_lineno = token->end_lineno;
10050 UNUSED(end_lineno); // Only used by EXTRA macro
10051 int end_col_offset = token->end_col_offset;
10052 UNUSED(end_col_offset); // Only used by EXTRA macro
10053 res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
10054 if (res == NULL && PyErr_Occurred()) {
10055 p->error_indicator = 1;
10056 return NULL;
10057 }
10058 goto done;
10059 }
10060 p->mark = mark;
10061 }
10062 { // t_primary '[' slices ']' !t_lookahead
10063 expr_ty a;
10064 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010065 Token * literal;
10066 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010067 if (
10068 (a = t_primary_rule(p))
10069 &&
10070 (literal = _PyPegen_expect_token(p, 9))
10071 &&
10072 (b = slices_rule(p))
10073 &&
10074 (literal_1 = _PyPegen_expect_token(p, 10))
10075 &&
10076 _PyPegen_lookahead(0, t_lookahead_rule, p)
10077 )
10078 {
10079 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10080 if (token == NULL) {
10081 return NULL;
10082 }
10083 int end_lineno = token->end_lineno;
10084 UNUSED(end_lineno); // Only used by EXTRA macro
10085 int end_col_offset = token->end_col_offset;
10086 UNUSED(end_col_offset); // Only used by EXTRA macro
10087 res = _Py_Subscript ( a , b , Store , EXTRA );
10088 if (res == NULL && PyErr_Occurred()) {
10089 p->error_indicator = 1;
10090 return NULL;
10091 }
10092 goto done;
10093 }
10094 p->mark = mark;
10095 }
10096 { // t_atom
10097 expr_ty t_atom_var;
10098 if (
10099 (t_atom_var = t_atom_rule(p))
10100 )
10101 {
10102 res = t_atom_var;
10103 goto done;
10104 }
10105 p->mark = mark;
10106 }
10107 res = NULL;
10108 done:
10109 _PyPegen_insert_memo(p, mark, target_type, res);
10110 return res;
10111}
10112
10113// Left-recursive
10114// t_primary:
10115// | t_primary '.' NAME &t_lookahead
10116// | t_primary '[' slices ']' &t_lookahead
10117// | t_primary genexp &t_lookahead
10118// | t_primary '(' arguments? ')' &t_lookahead
10119// | atom &t_lookahead
10120static expr_ty t_primary_raw(Parser *);
10121static expr_ty
10122t_primary_rule(Parser *p)
10123{
10124 expr_ty res = NULL;
10125 if (_PyPegen_is_memoized(p, t_primary_type, &res))
10126 return res;
10127 int mark = p->mark;
10128 int resmark = p->mark;
10129 while (1) {
10130 int tmpvar_8 = _PyPegen_update_memo(p, mark, t_primary_type, res);
10131 if (tmpvar_8) {
10132 return res;
10133 }
10134 p->mark = mark;
10135 void *raw = t_primary_raw(p);
10136 if (raw == NULL || p->mark <= resmark)
10137 break;
10138 resmark = p->mark;
10139 res = raw;
10140 }
10141 p->mark = resmark;
10142 return res;
10143}
10144static expr_ty
10145t_primary_raw(Parser *p)
10146{
10147 if (p->error_indicator) {
10148 return NULL;
10149 }
10150 expr_ty res = NULL;
10151 int mark = p->mark;
10152 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10153 p->error_indicator = 1;
10154 return NULL;
10155 }
10156 int start_lineno = p->tokens[mark]->lineno;
10157 UNUSED(start_lineno); // Only used by EXTRA macro
10158 int start_col_offset = p->tokens[mark]->col_offset;
10159 UNUSED(start_col_offset); // Only used by EXTRA macro
10160 { // t_primary '.' NAME &t_lookahead
10161 expr_ty a;
10162 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010163 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010164 if (
10165 (a = t_primary_rule(p))
10166 &&
10167 (literal = _PyPegen_expect_token(p, 23))
10168 &&
10169 (b = _PyPegen_name_token(p))
10170 &&
10171 _PyPegen_lookahead(1, t_lookahead_rule, p)
10172 )
10173 {
10174 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10175 if (token == NULL) {
10176 return NULL;
10177 }
10178 int end_lineno = token->end_lineno;
10179 UNUSED(end_lineno); // Only used by EXTRA macro
10180 int end_col_offset = token->end_col_offset;
10181 UNUSED(end_col_offset); // Only used by EXTRA macro
10182 res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
10183 if (res == NULL && PyErr_Occurred()) {
10184 p->error_indicator = 1;
10185 return NULL;
10186 }
10187 goto done;
10188 }
10189 p->mark = mark;
10190 }
10191 { // t_primary '[' slices ']' &t_lookahead
10192 expr_ty a;
10193 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010194 Token * literal;
10195 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010196 if (
10197 (a = t_primary_rule(p))
10198 &&
10199 (literal = _PyPegen_expect_token(p, 9))
10200 &&
10201 (b = slices_rule(p))
10202 &&
10203 (literal_1 = _PyPegen_expect_token(p, 10))
10204 &&
10205 _PyPegen_lookahead(1, t_lookahead_rule, p)
10206 )
10207 {
10208 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10209 if (token == NULL) {
10210 return NULL;
10211 }
10212 int end_lineno = token->end_lineno;
10213 UNUSED(end_lineno); // Only used by EXTRA macro
10214 int end_col_offset = token->end_col_offset;
10215 UNUSED(end_col_offset); // Only used by EXTRA macro
10216 res = _Py_Subscript ( a , b , Load , EXTRA );
10217 if (res == NULL && PyErr_Occurred()) {
10218 p->error_indicator = 1;
10219 return NULL;
10220 }
10221 goto done;
10222 }
10223 p->mark = mark;
10224 }
10225 { // t_primary genexp &t_lookahead
10226 expr_ty a;
10227 expr_ty b;
10228 if (
10229 (a = t_primary_rule(p))
10230 &&
10231 (b = genexp_rule(p))
10232 &&
10233 _PyPegen_lookahead(1, t_lookahead_rule, p)
10234 )
10235 {
10236 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10237 if (token == NULL) {
10238 return NULL;
10239 }
10240 int end_lineno = token->end_lineno;
10241 UNUSED(end_lineno); // Only used by EXTRA macro
10242 int end_col_offset = token->end_col_offset;
10243 UNUSED(end_col_offset); // Only used by EXTRA macro
10244 res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
10245 if (res == NULL && PyErr_Occurred()) {
10246 p->error_indicator = 1;
10247 return NULL;
10248 }
10249 goto done;
10250 }
10251 p->mark = mark;
10252 }
10253 { // t_primary '(' arguments? ')' &t_lookahead
10254 expr_ty a;
10255 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010256 Token * literal;
10257 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010258 if (
10259 (a = t_primary_rule(p))
10260 &&
10261 (literal = _PyPegen_expect_token(p, 7))
10262 &&
10263 (b = arguments_rule(p), 1)
10264 &&
10265 (literal_1 = _PyPegen_expect_token(p, 8))
10266 &&
10267 _PyPegen_lookahead(1, t_lookahead_rule, p)
10268 )
10269 {
10270 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10271 if (token == NULL) {
10272 return NULL;
10273 }
10274 int end_lineno = token->end_lineno;
10275 UNUSED(end_lineno); // Only used by EXTRA macro
10276 int end_col_offset = token->end_col_offset;
10277 UNUSED(end_col_offset); // Only used by EXTRA macro
10278 res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
10279 if (res == NULL && PyErr_Occurred()) {
10280 p->error_indicator = 1;
10281 return NULL;
10282 }
10283 goto done;
10284 }
10285 p->mark = mark;
10286 }
10287 { // atom &t_lookahead
10288 expr_ty a;
10289 if (
10290 (a = atom_rule(p))
10291 &&
10292 _PyPegen_lookahead(1, t_lookahead_rule, p)
10293 )
10294 {
10295 res = a;
10296 if (res == NULL && PyErr_Occurred()) {
10297 p->error_indicator = 1;
10298 return NULL;
10299 }
10300 goto done;
10301 }
10302 p->mark = mark;
10303 }
10304 res = NULL;
10305 done:
10306 return res;
10307}
10308
10309// t_lookahead: '(' | '[' | '.'
10310static void *
10311t_lookahead_rule(Parser *p)
10312{
10313 if (p->error_indicator) {
10314 return NULL;
10315 }
10316 void * res = NULL;
10317 int mark = p->mark;
10318 { // '('
Pablo Galindob796b3f2020-05-01 12:32:26 +010010319 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010320 if (
10321 (literal = _PyPegen_expect_token(p, 7))
10322 )
10323 {
10324 res = literal;
10325 goto done;
10326 }
10327 p->mark = mark;
10328 }
10329 { // '['
Pablo Galindob796b3f2020-05-01 12:32:26 +010010330 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010331 if (
10332 (literal = _PyPegen_expect_token(p, 9))
10333 )
10334 {
10335 res = literal;
10336 goto done;
10337 }
10338 p->mark = mark;
10339 }
10340 { // '.'
Pablo Galindob796b3f2020-05-01 12:32:26 +010010341 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010342 if (
10343 (literal = _PyPegen_expect_token(p, 23))
10344 )
10345 {
10346 res = literal;
10347 goto done;
10348 }
10349 p->mark = mark;
10350 }
10351 res = NULL;
10352 done:
10353 return res;
10354}
10355
10356// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
10357static expr_ty
10358t_atom_rule(Parser *p)
10359{
10360 if (p->error_indicator) {
10361 return NULL;
10362 }
10363 expr_ty res = NULL;
10364 int mark = p->mark;
10365 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10366 p->error_indicator = 1;
10367 return NULL;
10368 }
10369 int start_lineno = p->tokens[mark]->lineno;
10370 UNUSED(start_lineno); // Only used by EXTRA macro
10371 int start_col_offset = p->tokens[mark]->col_offset;
10372 UNUSED(start_col_offset); // Only used by EXTRA macro
10373 { // NAME
10374 expr_ty a;
10375 if (
10376 (a = _PyPegen_name_token(p))
10377 )
10378 {
10379 res = _PyPegen_set_expr_context ( p , a , Store );
10380 if (res == NULL && PyErr_Occurred()) {
10381 p->error_indicator = 1;
10382 return NULL;
10383 }
10384 goto done;
10385 }
10386 p->mark = mark;
10387 }
10388 { // '(' target ')'
10389 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010390 Token * literal;
10391 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010392 if (
10393 (literal = _PyPegen_expect_token(p, 7))
10394 &&
10395 (a = target_rule(p))
10396 &&
10397 (literal_1 = _PyPegen_expect_token(p, 8))
10398 )
10399 {
10400 res = _PyPegen_set_expr_context ( p , a , Store );
10401 if (res == NULL && PyErr_Occurred()) {
10402 p->error_indicator = 1;
10403 return NULL;
10404 }
10405 goto done;
10406 }
10407 p->mark = mark;
10408 }
10409 { // '(' targets? ')'
10410 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010411 Token * literal;
10412 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010413 if (
10414 (literal = _PyPegen_expect_token(p, 7))
10415 &&
10416 (b = targets_rule(p), 1)
10417 &&
10418 (literal_1 = _PyPegen_expect_token(p, 8))
10419 )
10420 {
10421 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10422 if (token == NULL) {
10423 return NULL;
10424 }
10425 int end_lineno = token->end_lineno;
10426 UNUSED(end_lineno); // Only used by EXTRA macro
10427 int end_col_offset = token->end_col_offset;
10428 UNUSED(end_col_offset); // Only used by EXTRA macro
10429 res = _Py_Tuple ( b , Store , EXTRA );
10430 if (res == NULL && PyErr_Occurred()) {
10431 p->error_indicator = 1;
10432 return NULL;
10433 }
10434 goto done;
10435 }
10436 p->mark = mark;
10437 }
10438 { // '[' targets? ']'
10439 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010440 Token * literal;
10441 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010442 if (
10443 (literal = _PyPegen_expect_token(p, 9))
10444 &&
10445 (b = targets_rule(p), 1)
10446 &&
10447 (literal_1 = _PyPegen_expect_token(p, 10))
10448 )
10449 {
10450 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10451 if (token == NULL) {
10452 return NULL;
10453 }
10454 int end_lineno = token->end_lineno;
10455 UNUSED(end_lineno); // Only used by EXTRA macro
10456 int end_col_offset = token->end_col_offset;
10457 UNUSED(end_col_offset); // Only used by EXTRA macro
10458 res = _Py_List ( b , Store , EXTRA );
10459 if (res == NULL && PyErr_Occurred()) {
10460 p->error_indicator = 1;
10461 return NULL;
10462 }
10463 goto done;
10464 }
10465 p->mark = mark;
10466 }
10467 res = NULL;
10468 done:
10469 return res;
10470}
10471
10472// incorrect_arguments:
10473// | args ',' '*'
10474// | expression for_if_clauses ',' [args | expression for_if_clauses]
10475// | args ',' args
10476static void *
10477incorrect_arguments_rule(Parser *p)
10478{
10479 if (p->error_indicator) {
10480 return NULL;
10481 }
10482 void * res = NULL;
10483 int mark = p->mark;
10484 { // args ',' '*'
10485 expr_ty args_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010486 Token * literal;
10487 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010488 if (
10489 (args_var = args_rule(p))
10490 &&
10491 (literal = _PyPegen_expect_token(p, 12))
10492 &&
10493 (literal_1 = _PyPegen_expect_token(p, 16))
10494 )
10495 {
10496 res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
10497 if (res == NULL && PyErr_Occurred()) {
10498 p->error_indicator = 1;
10499 return NULL;
10500 }
10501 goto done;
10502 }
10503 p->mark = mark;
10504 }
10505 { // expression for_if_clauses ',' [args | expression for_if_clauses]
10506 expr_ty expression_var;
10507 asdl_seq* for_if_clauses_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010508 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010509 void *opt_var;
10510 UNUSED(opt_var); // Silence compiler warnings
10511 if (
10512 (expression_var = expression_rule(p))
10513 &&
10514 (for_if_clauses_var = for_if_clauses_rule(p))
10515 &&
10516 (literal = _PyPegen_expect_token(p, 12))
10517 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070010518 (opt_var = _tmp_125_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010519 )
10520 {
10521 res = RAISE_SYNTAX_ERROR ( "Generator expression must be parenthesized" );
10522 if (res == NULL && PyErr_Occurred()) {
10523 p->error_indicator = 1;
10524 return NULL;
10525 }
10526 goto done;
10527 }
10528 p->mark = mark;
10529 }
10530 { // args ',' args
10531 expr_ty a;
10532 expr_ty args_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010533 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010534 if (
10535 (a = args_rule(p))
10536 &&
10537 (literal = _PyPegen_expect_token(p, 12))
10538 &&
10539 (args_var = args_rule(p))
10540 )
10541 {
10542 res = _PyPegen_arguments_parsing_error ( p , a );
10543 if (res == NULL && PyErr_Occurred()) {
10544 p->error_indicator = 1;
10545 return NULL;
10546 }
10547 goto done;
10548 }
10549 p->mark = mark;
10550 }
10551 res = NULL;
10552 done:
10553 return res;
10554}
10555
10556// invalid_named_expression: expression ':=' expression
10557static void *
10558invalid_named_expression_rule(Parser *p)
10559{
10560 if (p->error_indicator) {
10561 return NULL;
10562 }
10563 void * res = NULL;
10564 int mark = p->mark;
10565 { // expression ':=' expression
10566 expr_ty a;
10567 expr_ty expression_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010568 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010569 if (
10570 (a = expression_rule(p))
10571 &&
10572 (literal = _PyPegen_expect_token(p, 53))
10573 &&
10574 (expression_var = expression_rule(p))
10575 )
10576 {
10577 res = RAISE_SYNTAX_ERROR ( "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
10578 if (res == NULL && PyErr_Occurred()) {
10579 p->error_indicator = 1;
10580 return NULL;
10581 }
10582 goto done;
10583 }
10584 p->mark = mark;
10585 }
10586 res = NULL;
10587 done:
10588 return res;
10589}
10590
10591// invalid_assignment:
10592// | list ':'
10593// | tuple ':'
10594// | expression ':' expression ['=' annotated_rhs]
10595// | expression ('=' | augassign) (yield_expr | star_expressions)
10596static void *
10597invalid_assignment_rule(Parser *p)
10598{
10599 if (p->error_indicator) {
10600 return NULL;
10601 }
10602 void * res = NULL;
10603 int mark = p->mark;
10604 { // list ':'
10605 expr_ty list_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010606 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010607 if (
10608 (list_var = list_rule(p))
10609 &&
10610 (literal = _PyPegen_expect_token(p, 11))
10611 )
10612 {
10613 res = RAISE_SYNTAX_ERROR ( "only single target (not list) can be annotated" );
10614 if (res == NULL && PyErr_Occurred()) {
10615 p->error_indicator = 1;
10616 return NULL;
10617 }
10618 goto done;
10619 }
10620 p->mark = mark;
10621 }
10622 { // tuple ':'
Pablo Galindob796b3f2020-05-01 12:32:26 +010010623 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010624 expr_ty tuple_var;
10625 if (
10626 (tuple_var = tuple_rule(p))
10627 &&
10628 (literal = _PyPegen_expect_token(p, 11))
10629 )
10630 {
10631 res = RAISE_SYNTAX_ERROR ( "only single target (not tuple) can be annotated" );
10632 if (res == NULL && PyErr_Occurred()) {
10633 p->error_indicator = 1;
10634 return NULL;
10635 }
10636 goto done;
10637 }
10638 p->mark = mark;
10639 }
10640 { // expression ':' expression ['=' annotated_rhs]
10641 expr_ty expression_var;
10642 expr_ty expression_var_1;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010643 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010644 void *opt_var;
10645 UNUSED(opt_var); // Silence compiler warnings
10646 if (
10647 (expression_var = expression_rule(p))
10648 &&
10649 (literal = _PyPegen_expect_token(p, 11))
10650 &&
10651 (expression_var_1 = expression_rule(p))
10652 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070010653 (opt_var = _tmp_126_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010654 )
10655 {
10656 res = RAISE_SYNTAX_ERROR ( "illegal target for annotation" );
10657 if (res == NULL && PyErr_Occurred()) {
10658 p->error_indicator = 1;
10659 return NULL;
10660 }
10661 goto done;
10662 }
10663 p->mark = mark;
10664 }
10665 { // expression ('=' | augassign) (yield_expr | star_expressions)
Guido van Rossum3941d972020-05-01 09:42:03 -070010666 void *_tmp_127_var;
10667 void *_tmp_128_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010668 expr_ty a;
10669 if (
10670 (a = expression_rule(p))
10671 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070010672 (_tmp_127_var = _tmp_127_rule(p))
Pablo Galindo2b74c832020-04-27 18:02:07 +010010673 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070010674 (_tmp_128_var = _tmp_128_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010675 )
10676 {
Batuhan Taskaya76c1b4d2020-05-01 16:13:43 +030010677 res = RAISE_SYNTAX_ERROR_NO_COL_OFFSET ( "cannot assign to %s" , _PyPegen_get_expr_name ( a ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010678 if (res == NULL && PyErr_Occurred()) {
10679 p->error_indicator = 1;
10680 return NULL;
10681 }
10682 goto done;
10683 }
10684 p->mark = mark;
10685 }
10686 res = NULL;
10687 done:
10688 return res;
10689}
10690
10691// invalid_block: NEWLINE !INDENT
10692static void *
10693invalid_block_rule(Parser *p)
10694{
10695 if (p->error_indicator) {
10696 return NULL;
10697 }
10698 void * res = NULL;
10699 int mark = p->mark;
10700 { // NEWLINE !INDENT
Pablo Galindob796b3f2020-05-01 12:32:26 +010010701 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010702 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010010703 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010704 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +010010705 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010706 )
10707 {
10708 res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
10709 if (res == NULL && PyErr_Occurred()) {
10710 p->error_indicator = 1;
10711 return NULL;
10712 }
10713 goto done;
10714 }
10715 p->mark = mark;
10716 }
10717 res = NULL;
10718 done:
10719 return res;
10720}
10721
10722// invalid_comprehension: ('[' | '(' | '{') '*' expression for_if_clauses
10723static void *
10724invalid_comprehension_rule(Parser *p)
10725{
10726 if (p->error_indicator) {
10727 return NULL;
10728 }
10729 void * res = NULL;
10730 int mark = p->mark;
10731 { // ('[' | '(' | '{') '*' expression for_if_clauses
Guido van Rossum3941d972020-05-01 09:42:03 -070010732 void *_tmp_129_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010733 expr_ty expression_var;
10734 asdl_seq* for_if_clauses_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010735 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010736 if (
Guido van Rossum3941d972020-05-01 09:42:03 -070010737 (_tmp_129_var = _tmp_129_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010738 &&
10739 (literal = _PyPegen_expect_token(p, 16))
10740 &&
10741 (expression_var = expression_rule(p))
10742 &&
10743 (for_if_clauses_var = for_if_clauses_rule(p))
10744 )
10745 {
10746 res = RAISE_SYNTAX_ERROR ( "iterable unpacking cannot be used in comprehension" );
10747 if (res == NULL && PyErr_Occurred()) {
10748 p->error_indicator = 1;
10749 return NULL;
10750 }
10751 goto done;
10752 }
10753 p->mark = mark;
10754 }
10755 res = NULL;
10756 done:
10757 return res;
10758}
10759
10760// invalid_parameters:
Guido van Rossumc001c092020-04-30 12:12:19 -070010761// | param_no_default* (slash_with_default | param_with_default+) param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010762static void *
10763invalid_parameters_rule(Parser *p)
10764{
10765 if (p->error_indicator) {
10766 return NULL;
10767 }
10768 void * res = NULL;
10769 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070010770 { // param_no_default* (slash_with_default | param_with_default+) param_no_default
Guido van Rossum3941d972020-05-01 09:42:03 -070010771 asdl_seq * _loop0_130_var;
10772 void *_tmp_131_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070010773 arg_ty param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010774 if (
Guido van Rossum3941d972020-05-01 09:42:03 -070010775 (_loop0_130_var = _loop0_130_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010776 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070010777 (_tmp_131_var = _tmp_131_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010778 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070010779 (param_no_default_var = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010780 )
10781 {
10782 res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
10783 if (res == NULL && PyErr_Occurred()) {
10784 p->error_indicator = 1;
10785 return NULL;
10786 }
10787 goto done;
10788 }
10789 p->mark = mark;
10790 }
10791 res = NULL;
10792 done:
10793 return res;
10794}
10795
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030010796// invalid_star_etc: '*' (')' | ',' (')' | '**'))
10797static void *
10798invalid_star_etc_rule(Parser *p)
10799{
10800 if (p->error_indicator) {
10801 return NULL;
10802 }
10803 void * res = NULL;
10804 int mark = p->mark;
10805 { // '*' (')' | ',' (')' | '**'))
10806 void *_tmp_132_var;
10807 Token * literal;
10808 if (
10809 (literal = _PyPegen_expect_token(p, 16))
10810 &&
10811 (_tmp_132_var = _tmp_132_rule(p))
10812 )
10813 {
10814 res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
10815 if (res == NULL && PyErr_Occurred()) {
10816 p->error_indicator = 1;
10817 return NULL;
10818 }
10819 goto done;
10820 }
10821 p->mark = mark;
10822 }
10823 res = NULL;
10824 done:
10825 return res;
10826}
10827
10828// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**'))
10829static void *
10830invalid_lambda_star_etc_rule(Parser *p)
10831{
10832 if (p->error_indicator) {
10833 return NULL;
10834 }
10835 void * res = NULL;
10836 int mark = p->mark;
10837 { // '*' (':' | ',' (':' | '**'))
10838 void *_tmp_133_var;
10839 Token * literal;
10840 if (
10841 (literal = _PyPegen_expect_token(p, 16))
10842 &&
10843 (_tmp_133_var = _tmp_133_rule(p))
10844 )
10845 {
10846 res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
10847 if (res == NULL && PyErr_Occurred()) {
10848 p->error_indicator = 1;
10849 return NULL;
10850 }
10851 goto done;
10852 }
10853 p->mark = mark;
10854 }
10855 res = NULL;
10856 done:
10857 return res;
10858}
10859
Guido van Rossumc001c092020-04-30 12:12:19 -070010860// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
10861static void *
10862invalid_double_type_comments_rule(Parser *p)
10863{
10864 if (p->error_indicator) {
10865 return NULL;
10866 }
10867 void * res = NULL;
10868 int mark = p->mark;
10869 { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
Pablo Galindob796b3f2020-05-01 12:32:26 +010010870 Token * indent_var;
10871 Token * newline_var;
10872 Token * newline_var_1;
10873 Token * type_comment_var;
10874 Token * type_comment_var_1;
Guido van Rossumc001c092020-04-30 12:12:19 -070010875 if (
10876 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))
10877 &&
10878 (newline_var = _PyPegen_expect_token(p, NEWLINE))
10879 &&
10880 (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT))
10881 &&
10882 (newline_var_1 = _PyPegen_expect_token(p, NEWLINE))
10883 &&
10884 (indent_var = _PyPegen_expect_token(p, INDENT))
10885 )
10886 {
10887 res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
10888 if (res == NULL && PyErr_Occurred()) {
10889 p->error_indicator = 1;
10890 return NULL;
10891 }
10892 goto done;
10893 }
10894 p->mark = mark;
10895 }
10896 res = NULL;
10897 done:
10898 return res;
10899}
10900
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010901// _loop0_1: NEWLINE
10902static asdl_seq *
10903_loop0_1_rule(Parser *p)
10904{
10905 if (p->error_indicator) {
10906 return NULL;
10907 }
10908 void *res = NULL;
10909 int mark = p->mark;
10910 int start_mark = p->mark;
10911 void **children = PyMem_Malloc(sizeof(void *));
10912 if (!children) {
10913 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10914 return NULL;
10915 }
10916 ssize_t children_capacity = 1;
10917 ssize_t n = 0;
10918 { // NEWLINE
Pablo Galindob796b3f2020-05-01 12:32:26 +010010919 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010920 while (
Pablo Galindo4db245e2020-04-29 10:42:21 +010010921 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010922 )
10923 {
10924 res = newline_var;
10925 if (n == children_capacity) {
10926 children_capacity *= 2;
10927 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10928 if (!children) {
10929 PyErr_Format(PyExc_MemoryError, "realloc None");
10930 return NULL;
10931 }
10932 }
10933 children[n++] = res;
10934 mark = p->mark;
10935 }
10936 p->mark = mark;
10937 }
10938 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10939 if (!seq) {
10940 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_1");
10941 PyMem_Free(children);
10942 return NULL;
10943 }
10944 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10945 PyMem_Free(children);
10946 _PyPegen_insert_memo(p, start_mark, _loop0_1_type, seq);
10947 return seq;
10948}
10949
Guido van Rossumc001c092020-04-30 12:12:19 -070010950// _loop0_2: NEWLINE
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010951static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070010952_loop0_2_rule(Parser *p)
10953{
10954 if (p->error_indicator) {
10955 return NULL;
10956 }
10957 void *res = NULL;
10958 int mark = p->mark;
10959 int start_mark = p->mark;
10960 void **children = PyMem_Malloc(sizeof(void *));
10961 if (!children) {
10962 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10963 return NULL;
10964 }
10965 ssize_t children_capacity = 1;
10966 ssize_t n = 0;
10967 { // NEWLINE
Pablo Galindob796b3f2020-05-01 12:32:26 +010010968 Token * newline_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070010969 while (
10970 (newline_var = _PyPegen_expect_token(p, NEWLINE))
10971 )
10972 {
10973 res = newline_var;
10974 if (n == children_capacity) {
10975 children_capacity *= 2;
10976 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10977 if (!children) {
10978 PyErr_Format(PyExc_MemoryError, "realloc None");
10979 return NULL;
10980 }
10981 }
10982 children[n++] = res;
10983 mark = p->mark;
10984 }
10985 p->mark = mark;
10986 }
10987 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10988 if (!seq) {
10989 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_2");
10990 PyMem_Free(children);
10991 return NULL;
10992 }
10993 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10994 PyMem_Free(children);
10995 _PyPegen_insert_memo(p, start_mark, _loop0_2_type, seq);
10996 return seq;
10997}
10998
10999// _loop0_4: ',' expression
11000static asdl_seq *
11001_loop0_4_rule(Parser *p)
11002{
11003 if (p->error_indicator) {
11004 return NULL;
11005 }
11006 void *res = NULL;
11007 int mark = p->mark;
11008 int start_mark = p->mark;
11009 void **children = PyMem_Malloc(sizeof(void *));
11010 if (!children) {
11011 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11012 return NULL;
11013 }
11014 ssize_t children_capacity = 1;
11015 ssize_t n = 0;
11016 { // ',' expression
11017 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011018 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070011019 while (
11020 (literal = _PyPegen_expect_token(p, 12))
11021 &&
11022 (elem = expression_rule(p))
11023 )
11024 {
11025 res = elem;
11026 if (res == NULL && PyErr_Occurred()) {
11027 p->error_indicator = 1;
11028 PyMem_Free(children);
11029 return NULL;
11030 }
11031 if (n == children_capacity) {
11032 children_capacity *= 2;
11033 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11034 if (!children) {
11035 PyErr_Format(PyExc_MemoryError, "realloc None");
11036 return NULL;
11037 }
11038 }
11039 children[n++] = res;
11040 mark = p->mark;
11041 }
11042 p->mark = mark;
11043 }
11044 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11045 if (!seq) {
11046 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_4");
11047 PyMem_Free(children);
11048 return NULL;
11049 }
11050 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11051 PyMem_Free(children);
11052 _PyPegen_insert_memo(p, start_mark, _loop0_4_type, seq);
11053 return seq;
11054}
11055
11056// _gather_3: expression _loop0_4
11057static asdl_seq *
11058_gather_3_rule(Parser *p)
11059{
11060 if (p->error_indicator) {
11061 return NULL;
11062 }
11063 asdl_seq * res = NULL;
11064 int mark = p->mark;
11065 { // expression _loop0_4
11066 expr_ty elem;
11067 asdl_seq * seq;
11068 if (
11069 (elem = expression_rule(p))
11070 &&
11071 (seq = _loop0_4_rule(p))
11072 )
11073 {
11074 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11075 goto done;
11076 }
11077 p->mark = mark;
11078 }
11079 res = NULL;
11080 done:
11081 return res;
11082}
11083
11084// _loop0_6: ',' expression
11085static asdl_seq *
11086_loop0_6_rule(Parser *p)
11087{
11088 if (p->error_indicator) {
11089 return NULL;
11090 }
11091 void *res = NULL;
11092 int mark = p->mark;
11093 int start_mark = p->mark;
11094 void **children = PyMem_Malloc(sizeof(void *));
11095 if (!children) {
11096 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11097 return NULL;
11098 }
11099 ssize_t children_capacity = 1;
11100 ssize_t n = 0;
11101 { // ',' expression
11102 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011103 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070011104 while (
11105 (literal = _PyPegen_expect_token(p, 12))
11106 &&
11107 (elem = expression_rule(p))
11108 )
11109 {
11110 res = elem;
11111 if (res == NULL && PyErr_Occurred()) {
11112 p->error_indicator = 1;
11113 PyMem_Free(children);
11114 return NULL;
11115 }
11116 if (n == children_capacity) {
11117 children_capacity *= 2;
11118 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11119 if (!children) {
11120 PyErr_Format(PyExc_MemoryError, "realloc None");
11121 return NULL;
11122 }
11123 }
11124 children[n++] = res;
11125 mark = p->mark;
11126 }
11127 p->mark = mark;
11128 }
11129 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11130 if (!seq) {
11131 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_6");
11132 PyMem_Free(children);
11133 return NULL;
11134 }
11135 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11136 PyMem_Free(children);
11137 _PyPegen_insert_memo(p, start_mark, _loop0_6_type, seq);
11138 return seq;
11139}
11140
11141// _gather_5: expression _loop0_6
11142static asdl_seq *
11143_gather_5_rule(Parser *p)
11144{
11145 if (p->error_indicator) {
11146 return NULL;
11147 }
11148 asdl_seq * res = NULL;
11149 int mark = p->mark;
11150 { // expression _loop0_6
11151 expr_ty elem;
11152 asdl_seq * seq;
11153 if (
11154 (elem = expression_rule(p))
11155 &&
11156 (seq = _loop0_6_rule(p))
11157 )
11158 {
11159 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11160 goto done;
11161 }
11162 p->mark = mark;
11163 }
11164 res = NULL;
11165 done:
11166 return res;
11167}
11168
11169// _loop0_8: ',' expression
11170static asdl_seq *
11171_loop0_8_rule(Parser *p)
11172{
11173 if (p->error_indicator) {
11174 return NULL;
11175 }
11176 void *res = NULL;
11177 int mark = p->mark;
11178 int start_mark = p->mark;
11179 void **children = PyMem_Malloc(sizeof(void *));
11180 if (!children) {
11181 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11182 return NULL;
11183 }
11184 ssize_t children_capacity = 1;
11185 ssize_t n = 0;
11186 { // ',' expression
11187 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011188 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070011189 while (
11190 (literal = _PyPegen_expect_token(p, 12))
11191 &&
11192 (elem = expression_rule(p))
11193 )
11194 {
11195 res = elem;
11196 if (res == NULL && PyErr_Occurred()) {
11197 p->error_indicator = 1;
11198 PyMem_Free(children);
11199 return NULL;
11200 }
11201 if (n == children_capacity) {
11202 children_capacity *= 2;
11203 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11204 if (!children) {
11205 PyErr_Format(PyExc_MemoryError, "realloc None");
11206 return NULL;
11207 }
11208 }
11209 children[n++] = res;
11210 mark = p->mark;
11211 }
11212 p->mark = mark;
11213 }
11214 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11215 if (!seq) {
11216 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_8");
11217 PyMem_Free(children);
11218 return NULL;
11219 }
11220 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11221 PyMem_Free(children);
11222 _PyPegen_insert_memo(p, start_mark, _loop0_8_type, seq);
11223 return seq;
11224}
11225
11226// _gather_7: expression _loop0_8
11227static asdl_seq *
11228_gather_7_rule(Parser *p)
11229{
11230 if (p->error_indicator) {
11231 return NULL;
11232 }
11233 asdl_seq * res = NULL;
11234 int mark = p->mark;
11235 { // expression _loop0_8
11236 expr_ty elem;
11237 asdl_seq * seq;
11238 if (
11239 (elem = expression_rule(p))
11240 &&
11241 (seq = _loop0_8_rule(p))
11242 )
11243 {
11244 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11245 goto done;
11246 }
11247 p->mark = mark;
11248 }
11249 res = NULL;
11250 done:
11251 return res;
11252}
11253
11254// _loop0_10: ',' expression
11255static asdl_seq *
11256_loop0_10_rule(Parser *p)
11257{
11258 if (p->error_indicator) {
11259 return NULL;
11260 }
11261 void *res = NULL;
11262 int mark = p->mark;
11263 int start_mark = p->mark;
11264 void **children = PyMem_Malloc(sizeof(void *));
11265 if (!children) {
11266 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11267 return NULL;
11268 }
11269 ssize_t children_capacity = 1;
11270 ssize_t n = 0;
11271 { // ',' expression
11272 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011273 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070011274 while (
11275 (literal = _PyPegen_expect_token(p, 12))
11276 &&
11277 (elem = expression_rule(p))
11278 )
11279 {
11280 res = elem;
11281 if (res == NULL && PyErr_Occurred()) {
11282 p->error_indicator = 1;
11283 PyMem_Free(children);
11284 return NULL;
11285 }
11286 if (n == children_capacity) {
11287 children_capacity *= 2;
11288 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11289 if (!children) {
11290 PyErr_Format(PyExc_MemoryError, "realloc None");
11291 return NULL;
11292 }
11293 }
11294 children[n++] = res;
11295 mark = p->mark;
11296 }
11297 p->mark = mark;
11298 }
11299 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11300 if (!seq) {
11301 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_10");
11302 PyMem_Free(children);
11303 return NULL;
11304 }
11305 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11306 PyMem_Free(children);
11307 _PyPegen_insert_memo(p, start_mark, _loop0_10_type, seq);
11308 return seq;
11309}
11310
11311// _gather_9: expression _loop0_10
11312static asdl_seq *
11313_gather_9_rule(Parser *p)
11314{
11315 if (p->error_indicator) {
11316 return NULL;
11317 }
11318 asdl_seq * res = NULL;
11319 int mark = p->mark;
11320 { // expression _loop0_10
11321 expr_ty elem;
11322 asdl_seq * seq;
11323 if (
11324 (elem = expression_rule(p))
11325 &&
11326 (seq = _loop0_10_rule(p))
11327 )
11328 {
11329 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11330 goto done;
11331 }
11332 p->mark = mark;
11333 }
11334 res = NULL;
11335 done:
11336 return res;
11337}
11338
11339// _loop1_11: statement
11340static asdl_seq *
11341_loop1_11_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011342{
11343 if (p->error_indicator) {
11344 return NULL;
11345 }
11346 void *res = NULL;
11347 int mark = p->mark;
11348 int start_mark = p->mark;
11349 void **children = PyMem_Malloc(sizeof(void *));
11350 if (!children) {
11351 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11352 return NULL;
11353 }
11354 ssize_t children_capacity = 1;
11355 ssize_t n = 0;
11356 { // statement
11357 asdl_seq* statement_var;
11358 while (
11359 (statement_var = statement_rule(p))
11360 )
11361 {
11362 res = statement_var;
11363 if (n == children_capacity) {
11364 children_capacity *= 2;
11365 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11366 if (!children) {
11367 PyErr_Format(PyExc_MemoryError, "realloc None");
11368 return NULL;
11369 }
11370 }
11371 children[n++] = res;
11372 mark = p->mark;
11373 }
11374 p->mark = mark;
11375 }
11376 if (n == 0) {
11377 PyMem_Free(children);
11378 return NULL;
11379 }
11380 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11381 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070011382 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_11");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011383 PyMem_Free(children);
11384 return NULL;
11385 }
11386 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11387 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070011388 _PyPegen_insert_memo(p, start_mark, _loop1_11_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011389 return seq;
11390}
11391
Guido van Rossumc001c092020-04-30 12:12:19 -070011392// _loop0_13: ';' small_stmt
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011393static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070011394_loop0_13_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011395{
11396 if (p->error_indicator) {
11397 return NULL;
11398 }
11399 void *res = NULL;
11400 int mark = p->mark;
11401 int start_mark = p->mark;
11402 void **children = PyMem_Malloc(sizeof(void *));
11403 if (!children) {
11404 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11405 return NULL;
11406 }
11407 ssize_t children_capacity = 1;
11408 ssize_t n = 0;
11409 { // ';' small_stmt
11410 stmt_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011411 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011412 while (
11413 (literal = _PyPegen_expect_token(p, 13))
11414 &&
11415 (elem = small_stmt_rule(p))
11416 )
11417 {
11418 res = elem;
11419 if (res == NULL && PyErr_Occurred()) {
11420 p->error_indicator = 1;
11421 PyMem_Free(children);
11422 return NULL;
11423 }
11424 if (n == children_capacity) {
11425 children_capacity *= 2;
11426 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11427 if (!children) {
11428 PyErr_Format(PyExc_MemoryError, "realloc None");
11429 return NULL;
11430 }
11431 }
11432 children[n++] = res;
11433 mark = p->mark;
11434 }
11435 p->mark = mark;
11436 }
11437 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11438 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070011439 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_13");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011440 PyMem_Free(children);
11441 return NULL;
11442 }
11443 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11444 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070011445 _PyPegen_insert_memo(p, start_mark, _loop0_13_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011446 return seq;
11447}
11448
Guido van Rossumc001c092020-04-30 12:12:19 -070011449// _gather_12: small_stmt _loop0_13
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011450static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070011451_gather_12_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011452{
11453 if (p->error_indicator) {
11454 return NULL;
11455 }
11456 asdl_seq * res = NULL;
11457 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070011458 { // small_stmt _loop0_13
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011459 stmt_ty elem;
11460 asdl_seq * seq;
11461 if (
11462 (elem = small_stmt_rule(p))
11463 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070011464 (seq = _loop0_13_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011465 )
11466 {
11467 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11468 goto done;
11469 }
11470 p->mark = mark;
11471 }
11472 res = NULL;
11473 done:
11474 return res;
11475}
11476
Guido van Rossumc001c092020-04-30 12:12:19 -070011477// _tmp_14: 'import' | 'from'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011478static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011479_tmp_14_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011480{
11481 if (p->error_indicator) {
11482 return NULL;
11483 }
11484 void * res = NULL;
11485 int mark = p->mark;
11486 { // 'import'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011487 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011488 if (
11489 (keyword = _PyPegen_expect_token(p, 513))
11490 )
11491 {
11492 res = keyword;
11493 goto done;
11494 }
11495 p->mark = mark;
11496 }
11497 { // 'from'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011498 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011499 if (
11500 (keyword = _PyPegen_expect_token(p, 514))
11501 )
11502 {
11503 res = keyword;
11504 goto done;
11505 }
11506 p->mark = mark;
11507 }
11508 res = NULL;
11509 done:
11510 return res;
11511}
11512
Guido van Rossumc001c092020-04-30 12:12:19 -070011513// _tmp_15: 'def' | '@' | ASYNC
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011514static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011515_tmp_15_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011516{
11517 if (p->error_indicator) {
11518 return NULL;
11519 }
11520 void * res = NULL;
11521 int mark = p->mark;
11522 { // 'def'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011523 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011524 if (
11525 (keyword = _PyPegen_expect_token(p, 522))
11526 )
11527 {
11528 res = keyword;
11529 goto done;
11530 }
11531 p->mark = mark;
11532 }
11533 { // '@'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011534 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011535 if (
11536 (literal = _PyPegen_expect_token(p, 49))
11537 )
11538 {
11539 res = literal;
11540 goto done;
11541 }
11542 p->mark = mark;
11543 }
11544 { // ASYNC
Pablo Galindob796b3f2020-05-01 12:32:26 +010011545 Token * async_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011546 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010011547 (async_var = _PyPegen_expect_token(p, ASYNC))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011548 )
11549 {
11550 res = async_var;
11551 goto done;
11552 }
11553 p->mark = mark;
11554 }
11555 res = NULL;
11556 done:
11557 return res;
11558}
11559
Guido van Rossumc001c092020-04-30 12:12:19 -070011560// _tmp_16: 'class' | '@'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011561static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011562_tmp_16_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011563{
11564 if (p->error_indicator) {
11565 return NULL;
11566 }
11567 void * res = NULL;
11568 int mark = p->mark;
11569 { // 'class'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011570 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011571 if (
11572 (keyword = _PyPegen_expect_token(p, 523))
11573 )
11574 {
11575 res = keyword;
11576 goto done;
11577 }
11578 p->mark = mark;
11579 }
11580 { // '@'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011581 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011582 if (
11583 (literal = _PyPegen_expect_token(p, 49))
11584 )
11585 {
11586 res = literal;
11587 goto done;
11588 }
11589 p->mark = mark;
11590 }
11591 res = NULL;
11592 done:
11593 return res;
11594}
11595
Guido van Rossumc001c092020-04-30 12:12:19 -070011596// _tmp_17: 'with' | ASYNC
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011597static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011598_tmp_17_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011599{
11600 if (p->error_indicator) {
11601 return NULL;
11602 }
11603 void * res = NULL;
11604 int mark = p->mark;
11605 { // 'with'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011606 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011607 if (
11608 (keyword = _PyPegen_expect_token(p, 519))
11609 )
11610 {
11611 res = keyword;
11612 goto done;
11613 }
11614 p->mark = mark;
11615 }
11616 { // ASYNC
Pablo Galindob796b3f2020-05-01 12:32:26 +010011617 Token * async_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011618 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010011619 (async_var = _PyPegen_expect_token(p, ASYNC))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011620 )
11621 {
11622 res = async_var;
11623 goto done;
11624 }
11625 p->mark = mark;
11626 }
11627 res = NULL;
11628 done:
11629 return res;
11630}
11631
Guido van Rossumc001c092020-04-30 12:12:19 -070011632// _tmp_18: 'for' | ASYNC
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011633static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011634_tmp_18_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011635{
11636 if (p->error_indicator) {
11637 return NULL;
11638 }
11639 void * res = NULL;
11640 int mark = p->mark;
11641 { // 'for'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011642 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011643 if (
11644 (keyword = _PyPegen_expect_token(p, 517))
11645 )
11646 {
11647 res = keyword;
11648 goto done;
11649 }
11650 p->mark = mark;
11651 }
11652 { // ASYNC
Pablo Galindob796b3f2020-05-01 12:32:26 +010011653 Token * async_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011654 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010011655 (async_var = _PyPegen_expect_token(p, ASYNC))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011656 )
11657 {
11658 res = async_var;
11659 goto done;
11660 }
11661 p->mark = mark;
11662 }
11663 res = NULL;
11664 done:
11665 return res;
11666}
11667
Guido van Rossumc001c092020-04-30 12:12:19 -070011668// _tmp_19: '=' annotated_rhs
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011669static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011670_tmp_19_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011671{
11672 if (p->error_indicator) {
11673 return NULL;
11674 }
11675 void * res = NULL;
11676 int mark = p->mark;
11677 { // '=' annotated_rhs
11678 expr_ty d;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011679 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011680 if (
11681 (literal = _PyPegen_expect_token(p, 22))
11682 &&
11683 (d = annotated_rhs_rule(p))
11684 )
11685 {
11686 res = d;
11687 if (res == NULL && PyErr_Occurred()) {
11688 p->error_indicator = 1;
11689 return NULL;
11690 }
11691 goto done;
11692 }
11693 p->mark = mark;
11694 }
11695 res = NULL;
11696 done:
11697 return res;
11698}
11699
Guido van Rossumc001c092020-04-30 12:12:19 -070011700// _tmp_20: '(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011701static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011702_tmp_20_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011703{
11704 if (p->error_indicator) {
11705 return NULL;
11706 }
11707 void * res = NULL;
11708 int mark = p->mark;
11709 { // '(' inside_paren_ann_assign_target ')'
11710 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011711 Token * literal;
11712 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011713 if (
11714 (literal = _PyPegen_expect_token(p, 7))
11715 &&
11716 (b = inside_paren_ann_assign_target_rule(p))
11717 &&
11718 (literal_1 = _PyPegen_expect_token(p, 8))
11719 )
11720 {
11721 res = b;
11722 if (res == NULL && PyErr_Occurred()) {
11723 p->error_indicator = 1;
11724 return NULL;
11725 }
11726 goto done;
11727 }
11728 p->mark = mark;
11729 }
11730 { // ann_assign_subscript_attribute_target
11731 expr_ty ann_assign_subscript_attribute_target_var;
11732 if (
11733 (ann_assign_subscript_attribute_target_var = ann_assign_subscript_attribute_target_rule(p))
11734 )
11735 {
11736 res = ann_assign_subscript_attribute_target_var;
11737 goto done;
11738 }
11739 p->mark = mark;
11740 }
11741 res = NULL;
11742 done:
11743 return res;
11744}
11745
Guido van Rossumc001c092020-04-30 12:12:19 -070011746// _tmp_21: '=' annotated_rhs
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011747static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011748_tmp_21_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011749{
11750 if (p->error_indicator) {
11751 return NULL;
11752 }
11753 void * res = NULL;
11754 int mark = p->mark;
11755 { // '=' annotated_rhs
11756 expr_ty d;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011757 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011758 if (
11759 (literal = _PyPegen_expect_token(p, 22))
11760 &&
11761 (d = annotated_rhs_rule(p))
11762 )
11763 {
11764 res = d;
11765 if (res == NULL && PyErr_Occurred()) {
11766 p->error_indicator = 1;
11767 return NULL;
11768 }
11769 goto done;
11770 }
11771 p->mark = mark;
11772 }
11773 res = NULL;
11774 done:
11775 return res;
11776}
11777
Guido van Rossumc001c092020-04-30 12:12:19 -070011778// _loop1_22: (star_targets '=')
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011779static asdl_seq *
11780_loop1_22_rule(Parser *p)
11781{
11782 if (p->error_indicator) {
11783 return NULL;
11784 }
11785 void *res = NULL;
11786 int mark = p->mark;
11787 int start_mark = p->mark;
11788 void **children = PyMem_Malloc(sizeof(void *));
11789 if (!children) {
11790 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11791 return NULL;
11792 }
11793 ssize_t children_capacity = 1;
11794 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070011795 { // (star_targets '=')
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030011796 void *_tmp_134_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011797 while (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030011798 (_tmp_134_var = _tmp_134_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011799 )
11800 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030011801 res = _tmp_134_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011802 if (n == children_capacity) {
11803 children_capacity *= 2;
11804 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11805 if (!children) {
11806 PyErr_Format(PyExc_MemoryError, "realloc None");
11807 return NULL;
11808 }
11809 }
11810 children[n++] = res;
11811 mark = p->mark;
11812 }
11813 p->mark = mark;
11814 }
11815 if (n == 0) {
11816 PyMem_Free(children);
11817 return NULL;
11818 }
11819 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11820 if (!seq) {
11821 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_22");
11822 PyMem_Free(children);
11823 return NULL;
11824 }
11825 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11826 PyMem_Free(children);
11827 _PyPegen_insert_memo(p, start_mark, _loop1_22_type, seq);
11828 return seq;
11829}
11830
Guido van Rossumc001c092020-04-30 12:12:19 -070011831// _tmp_23: yield_expr | star_expressions
11832static void *
11833_tmp_23_rule(Parser *p)
11834{
11835 if (p->error_indicator) {
11836 return NULL;
11837 }
11838 void * res = NULL;
11839 int mark = p->mark;
11840 { // yield_expr
11841 expr_ty yield_expr_var;
11842 if (
11843 (yield_expr_var = yield_expr_rule(p))
11844 )
11845 {
11846 res = yield_expr_var;
11847 goto done;
11848 }
11849 p->mark = mark;
11850 }
11851 { // star_expressions
11852 expr_ty star_expressions_var;
11853 if (
11854 (star_expressions_var = star_expressions_rule(p))
11855 )
11856 {
11857 res = star_expressions_var;
11858 goto done;
11859 }
11860 p->mark = mark;
11861 }
11862 res = NULL;
11863 done:
11864 return res;
11865}
11866
11867// _tmp_24: yield_expr | star_expressions
11868static void *
11869_tmp_24_rule(Parser *p)
11870{
11871 if (p->error_indicator) {
11872 return NULL;
11873 }
11874 void * res = NULL;
11875 int mark = p->mark;
11876 { // yield_expr
11877 expr_ty yield_expr_var;
11878 if (
11879 (yield_expr_var = yield_expr_rule(p))
11880 )
11881 {
11882 res = yield_expr_var;
11883 goto done;
11884 }
11885 p->mark = mark;
11886 }
11887 { // star_expressions
11888 expr_ty star_expressions_var;
11889 if (
11890 (star_expressions_var = star_expressions_rule(p))
11891 )
11892 {
11893 res = star_expressions_var;
11894 goto done;
11895 }
11896 p->mark = mark;
11897 }
11898 res = NULL;
11899 done:
11900 return res;
11901}
11902
11903// _loop0_26: ',' NAME
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011904static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070011905_loop0_26_rule(Parser *p)
11906{
11907 if (p->error_indicator) {
11908 return NULL;
11909 }
11910 void *res = NULL;
11911 int mark = p->mark;
11912 int start_mark = p->mark;
11913 void **children = PyMem_Malloc(sizeof(void *));
11914 if (!children) {
11915 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11916 return NULL;
11917 }
11918 ssize_t children_capacity = 1;
11919 ssize_t n = 0;
11920 { // ',' NAME
11921 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011922 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070011923 while (
11924 (literal = _PyPegen_expect_token(p, 12))
11925 &&
11926 (elem = _PyPegen_name_token(p))
11927 )
11928 {
11929 res = elem;
11930 if (res == NULL && PyErr_Occurred()) {
11931 p->error_indicator = 1;
11932 PyMem_Free(children);
11933 return NULL;
11934 }
11935 if (n == children_capacity) {
11936 children_capacity *= 2;
11937 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11938 if (!children) {
11939 PyErr_Format(PyExc_MemoryError, "realloc None");
11940 return NULL;
11941 }
11942 }
11943 children[n++] = res;
11944 mark = p->mark;
11945 }
11946 p->mark = mark;
11947 }
11948 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11949 if (!seq) {
11950 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_26");
11951 PyMem_Free(children);
11952 return NULL;
11953 }
11954 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11955 PyMem_Free(children);
11956 _PyPegen_insert_memo(p, start_mark, _loop0_26_type, seq);
11957 return seq;
11958}
11959
11960// _gather_25: NAME _loop0_26
11961static asdl_seq *
11962_gather_25_rule(Parser *p)
11963{
11964 if (p->error_indicator) {
11965 return NULL;
11966 }
11967 asdl_seq * res = NULL;
11968 int mark = p->mark;
11969 { // NAME _loop0_26
11970 expr_ty elem;
11971 asdl_seq * seq;
11972 if (
11973 (elem = _PyPegen_name_token(p))
11974 &&
11975 (seq = _loop0_26_rule(p))
11976 )
11977 {
11978 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11979 goto done;
11980 }
11981 p->mark = mark;
11982 }
11983 res = NULL;
11984 done:
11985 return res;
11986}
11987
11988// _loop0_28: ',' NAME
11989static asdl_seq *
11990_loop0_28_rule(Parser *p)
11991{
11992 if (p->error_indicator) {
11993 return NULL;
11994 }
11995 void *res = NULL;
11996 int mark = p->mark;
11997 int start_mark = p->mark;
11998 void **children = PyMem_Malloc(sizeof(void *));
11999 if (!children) {
12000 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12001 return NULL;
12002 }
12003 ssize_t children_capacity = 1;
12004 ssize_t n = 0;
12005 { // ',' NAME
12006 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012007 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070012008 while (
12009 (literal = _PyPegen_expect_token(p, 12))
12010 &&
12011 (elem = _PyPegen_name_token(p))
12012 )
12013 {
12014 res = elem;
12015 if (res == NULL && PyErr_Occurred()) {
12016 p->error_indicator = 1;
12017 PyMem_Free(children);
12018 return NULL;
12019 }
12020 if (n == children_capacity) {
12021 children_capacity *= 2;
12022 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12023 if (!children) {
12024 PyErr_Format(PyExc_MemoryError, "realloc None");
12025 return NULL;
12026 }
12027 }
12028 children[n++] = res;
12029 mark = p->mark;
12030 }
12031 p->mark = mark;
12032 }
12033 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12034 if (!seq) {
12035 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_28");
12036 PyMem_Free(children);
12037 return NULL;
12038 }
12039 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12040 PyMem_Free(children);
12041 _PyPegen_insert_memo(p, start_mark, _loop0_28_type, seq);
12042 return seq;
12043}
12044
12045// _gather_27: NAME _loop0_28
12046static asdl_seq *
12047_gather_27_rule(Parser *p)
12048{
12049 if (p->error_indicator) {
12050 return NULL;
12051 }
12052 asdl_seq * res = NULL;
12053 int mark = p->mark;
12054 { // NAME _loop0_28
12055 expr_ty elem;
12056 asdl_seq * seq;
12057 if (
12058 (elem = _PyPegen_name_token(p))
12059 &&
12060 (seq = _loop0_28_rule(p))
12061 )
12062 {
12063 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12064 goto done;
12065 }
12066 p->mark = mark;
12067 }
12068 res = NULL;
12069 done:
12070 return res;
12071}
12072
12073// _tmp_29: ',' expression
12074static void *
12075_tmp_29_rule(Parser *p)
12076{
12077 if (p->error_indicator) {
12078 return NULL;
12079 }
12080 void * res = NULL;
12081 int mark = p->mark;
12082 { // ',' expression
Pablo Galindob796b3f2020-05-01 12:32:26 +010012083 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070012084 expr_ty z;
12085 if (
12086 (literal = _PyPegen_expect_token(p, 12))
12087 &&
12088 (z = expression_rule(p))
12089 )
12090 {
12091 res = z;
12092 if (res == NULL && PyErr_Occurred()) {
12093 p->error_indicator = 1;
12094 return NULL;
12095 }
12096 goto done;
12097 }
12098 p->mark = mark;
12099 }
12100 res = NULL;
12101 done:
12102 return res;
12103}
12104
12105// _loop0_30: ('.' | '...')
12106static asdl_seq *
12107_loop0_30_rule(Parser *p)
12108{
12109 if (p->error_indicator) {
12110 return NULL;
12111 }
12112 void *res = NULL;
12113 int mark = p->mark;
12114 int start_mark = p->mark;
12115 void **children = PyMem_Malloc(sizeof(void *));
12116 if (!children) {
12117 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12118 return NULL;
12119 }
12120 ssize_t children_capacity = 1;
12121 ssize_t n = 0;
12122 { // ('.' | '...')
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030012123 void *_tmp_135_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070012124 while (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030012125 (_tmp_135_var = _tmp_135_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070012126 )
12127 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030012128 res = _tmp_135_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070012129 if (n == children_capacity) {
12130 children_capacity *= 2;
12131 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12132 if (!children) {
12133 PyErr_Format(PyExc_MemoryError, "realloc None");
12134 return NULL;
12135 }
12136 }
12137 children[n++] = res;
12138 mark = p->mark;
12139 }
12140 p->mark = mark;
12141 }
12142 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12143 if (!seq) {
12144 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_30");
12145 PyMem_Free(children);
12146 return NULL;
12147 }
12148 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12149 PyMem_Free(children);
12150 _PyPegen_insert_memo(p, start_mark, _loop0_30_type, seq);
12151 return seq;
12152}
12153
12154// _loop1_31: ('.' | '...')
12155static asdl_seq *
12156_loop1_31_rule(Parser *p)
12157{
12158 if (p->error_indicator) {
12159 return NULL;
12160 }
12161 void *res = NULL;
12162 int mark = p->mark;
12163 int start_mark = p->mark;
12164 void **children = PyMem_Malloc(sizeof(void *));
12165 if (!children) {
12166 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12167 return NULL;
12168 }
12169 ssize_t children_capacity = 1;
12170 ssize_t n = 0;
12171 { // ('.' | '...')
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030012172 void *_tmp_136_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070012173 while (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030012174 (_tmp_136_var = _tmp_136_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070012175 )
12176 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030012177 res = _tmp_136_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070012178 if (n == children_capacity) {
12179 children_capacity *= 2;
12180 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12181 if (!children) {
12182 PyErr_Format(PyExc_MemoryError, "realloc None");
12183 return NULL;
12184 }
12185 }
12186 children[n++] = res;
12187 mark = p->mark;
12188 }
12189 p->mark = mark;
12190 }
12191 if (n == 0) {
12192 PyMem_Free(children);
12193 return NULL;
12194 }
12195 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12196 if (!seq) {
12197 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_31");
12198 PyMem_Free(children);
12199 return NULL;
12200 }
12201 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12202 PyMem_Free(children);
12203 _PyPegen_insert_memo(p, start_mark, _loop1_31_type, seq);
12204 return seq;
12205}
12206
12207// _loop0_33: ',' import_from_as_name
12208static asdl_seq *
12209_loop0_33_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012210{
12211 if (p->error_indicator) {
12212 return NULL;
12213 }
12214 void *res = NULL;
12215 int mark = p->mark;
12216 int start_mark = p->mark;
12217 void **children = PyMem_Malloc(sizeof(void *));
12218 if (!children) {
12219 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12220 return NULL;
12221 }
12222 ssize_t children_capacity = 1;
12223 ssize_t n = 0;
12224 { // ',' import_from_as_name
12225 alias_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012226 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012227 while (
12228 (literal = _PyPegen_expect_token(p, 12))
12229 &&
12230 (elem = import_from_as_name_rule(p))
12231 )
12232 {
12233 res = elem;
12234 if (res == NULL && PyErr_Occurred()) {
12235 p->error_indicator = 1;
12236 PyMem_Free(children);
12237 return NULL;
12238 }
12239 if (n == children_capacity) {
12240 children_capacity *= 2;
12241 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12242 if (!children) {
12243 PyErr_Format(PyExc_MemoryError, "realloc None");
12244 return NULL;
12245 }
12246 }
12247 children[n++] = res;
12248 mark = p->mark;
12249 }
12250 p->mark = mark;
12251 }
12252 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12253 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012254 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_33");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012255 PyMem_Free(children);
12256 return NULL;
12257 }
12258 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12259 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012260 _PyPegen_insert_memo(p, start_mark, _loop0_33_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012261 return seq;
12262}
12263
Guido van Rossumc001c092020-04-30 12:12:19 -070012264// _gather_32: import_from_as_name _loop0_33
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012265static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012266_gather_32_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012267{
12268 if (p->error_indicator) {
12269 return NULL;
12270 }
12271 asdl_seq * res = NULL;
12272 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012273 { // import_from_as_name _loop0_33
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012274 alias_ty elem;
12275 asdl_seq * seq;
12276 if (
12277 (elem = import_from_as_name_rule(p))
12278 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012279 (seq = _loop0_33_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012280 )
12281 {
12282 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12283 goto done;
12284 }
12285 p->mark = mark;
12286 }
12287 res = NULL;
12288 done:
12289 return res;
12290}
12291
Guido van Rossumc001c092020-04-30 12:12:19 -070012292// _tmp_34: 'as' NAME
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012293static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070012294_tmp_34_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012295{
12296 if (p->error_indicator) {
12297 return NULL;
12298 }
12299 void * res = NULL;
12300 int mark = p->mark;
12301 { // 'as' NAME
Pablo Galindob796b3f2020-05-01 12:32:26 +010012302 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012303 expr_ty z;
12304 if (
12305 (keyword = _PyPegen_expect_token(p, 531))
12306 &&
12307 (z = _PyPegen_name_token(p))
12308 )
12309 {
12310 res = z;
12311 if (res == NULL && PyErr_Occurred()) {
12312 p->error_indicator = 1;
12313 return NULL;
12314 }
12315 goto done;
12316 }
12317 p->mark = mark;
12318 }
12319 res = NULL;
12320 done:
12321 return res;
12322}
12323
Guido van Rossumc001c092020-04-30 12:12:19 -070012324// _loop0_36: ',' dotted_as_name
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012325static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012326_loop0_36_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012327{
12328 if (p->error_indicator) {
12329 return NULL;
12330 }
12331 void *res = NULL;
12332 int mark = p->mark;
12333 int start_mark = p->mark;
12334 void **children = PyMem_Malloc(sizeof(void *));
12335 if (!children) {
12336 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12337 return NULL;
12338 }
12339 ssize_t children_capacity = 1;
12340 ssize_t n = 0;
12341 { // ',' dotted_as_name
12342 alias_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012343 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012344 while (
12345 (literal = _PyPegen_expect_token(p, 12))
12346 &&
12347 (elem = dotted_as_name_rule(p))
12348 )
12349 {
12350 res = elem;
12351 if (res == NULL && PyErr_Occurred()) {
12352 p->error_indicator = 1;
12353 PyMem_Free(children);
12354 return NULL;
12355 }
12356 if (n == children_capacity) {
12357 children_capacity *= 2;
12358 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12359 if (!children) {
12360 PyErr_Format(PyExc_MemoryError, "realloc None");
12361 return NULL;
12362 }
12363 }
12364 children[n++] = res;
12365 mark = p->mark;
12366 }
12367 p->mark = mark;
12368 }
12369 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12370 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012371 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_36");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012372 PyMem_Free(children);
12373 return NULL;
12374 }
12375 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12376 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012377 _PyPegen_insert_memo(p, start_mark, _loop0_36_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012378 return seq;
12379}
12380
Guido van Rossumc001c092020-04-30 12:12:19 -070012381// _gather_35: dotted_as_name _loop0_36
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012382static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012383_gather_35_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012384{
12385 if (p->error_indicator) {
12386 return NULL;
12387 }
12388 asdl_seq * res = NULL;
12389 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012390 { // dotted_as_name _loop0_36
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012391 alias_ty elem;
12392 asdl_seq * seq;
12393 if (
12394 (elem = dotted_as_name_rule(p))
12395 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012396 (seq = _loop0_36_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012397 )
12398 {
12399 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12400 goto done;
12401 }
12402 p->mark = mark;
12403 }
12404 res = NULL;
12405 done:
12406 return res;
12407}
12408
Guido van Rossumc001c092020-04-30 12:12:19 -070012409// _tmp_37: 'as' NAME
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012410static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070012411_tmp_37_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012412{
12413 if (p->error_indicator) {
12414 return NULL;
12415 }
12416 void * res = NULL;
12417 int mark = p->mark;
12418 { // 'as' NAME
Pablo Galindob796b3f2020-05-01 12:32:26 +010012419 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012420 expr_ty z;
12421 if (
12422 (keyword = _PyPegen_expect_token(p, 531))
12423 &&
12424 (z = _PyPegen_name_token(p))
12425 )
12426 {
12427 res = z;
12428 if (res == NULL && PyErr_Occurred()) {
12429 p->error_indicator = 1;
12430 return NULL;
12431 }
12432 goto done;
12433 }
12434 p->mark = mark;
12435 }
12436 res = NULL;
12437 done:
12438 return res;
12439}
12440
Guido van Rossumc001c092020-04-30 12:12:19 -070012441// _loop0_39: ',' with_item
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012442static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012443_loop0_39_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012444{
12445 if (p->error_indicator) {
12446 return NULL;
12447 }
12448 void *res = NULL;
12449 int mark = p->mark;
12450 int start_mark = p->mark;
12451 void **children = PyMem_Malloc(sizeof(void *));
12452 if (!children) {
12453 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12454 return NULL;
12455 }
12456 ssize_t children_capacity = 1;
12457 ssize_t n = 0;
12458 { // ',' with_item
12459 withitem_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012460 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012461 while (
12462 (literal = _PyPegen_expect_token(p, 12))
12463 &&
12464 (elem = with_item_rule(p))
12465 )
12466 {
12467 res = elem;
12468 if (res == NULL && PyErr_Occurred()) {
12469 p->error_indicator = 1;
12470 PyMem_Free(children);
12471 return NULL;
12472 }
12473 if (n == children_capacity) {
12474 children_capacity *= 2;
12475 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12476 if (!children) {
12477 PyErr_Format(PyExc_MemoryError, "realloc None");
12478 return NULL;
12479 }
12480 }
12481 children[n++] = res;
12482 mark = p->mark;
12483 }
12484 p->mark = mark;
12485 }
12486 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12487 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012488 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_39");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012489 PyMem_Free(children);
12490 return NULL;
12491 }
12492 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12493 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012494 _PyPegen_insert_memo(p, start_mark, _loop0_39_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012495 return seq;
12496}
12497
Guido van Rossumc001c092020-04-30 12:12:19 -070012498// _gather_38: with_item _loop0_39
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012499static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012500_gather_38_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012501{
12502 if (p->error_indicator) {
12503 return NULL;
12504 }
12505 asdl_seq * res = NULL;
12506 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012507 { // with_item _loop0_39
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012508 withitem_ty elem;
12509 asdl_seq * seq;
12510 if (
12511 (elem = with_item_rule(p))
12512 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012513 (seq = _loop0_39_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012514 )
12515 {
12516 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12517 goto done;
12518 }
12519 p->mark = mark;
12520 }
12521 res = NULL;
12522 done:
12523 return res;
12524}
12525
Guido van Rossumc001c092020-04-30 12:12:19 -070012526// _loop0_41: ',' with_item
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012527static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012528_loop0_41_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012529{
12530 if (p->error_indicator) {
12531 return NULL;
12532 }
12533 void *res = NULL;
12534 int mark = p->mark;
12535 int start_mark = p->mark;
12536 void **children = PyMem_Malloc(sizeof(void *));
12537 if (!children) {
12538 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12539 return NULL;
12540 }
12541 ssize_t children_capacity = 1;
12542 ssize_t n = 0;
12543 { // ',' with_item
12544 withitem_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012545 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012546 while (
12547 (literal = _PyPegen_expect_token(p, 12))
12548 &&
12549 (elem = with_item_rule(p))
12550 )
12551 {
12552 res = elem;
12553 if (res == NULL && PyErr_Occurred()) {
12554 p->error_indicator = 1;
12555 PyMem_Free(children);
12556 return NULL;
12557 }
12558 if (n == children_capacity) {
12559 children_capacity *= 2;
12560 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12561 if (!children) {
12562 PyErr_Format(PyExc_MemoryError, "realloc None");
12563 return NULL;
12564 }
12565 }
12566 children[n++] = res;
12567 mark = p->mark;
12568 }
12569 p->mark = mark;
12570 }
12571 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12572 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012573 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_41");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012574 PyMem_Free(children);
12575 return NULL;
12576 }
12577 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12578 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012579 _PyPegen_insert_memo(p, start_mark, _loop0_41_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012580 return seq;
12581}
12582
Guido van Rossumc001c092020-04-30 12:12:19 -070012583// _gather_40: with_item _loop0_41
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012584static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012585_gather_40_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012586{
12587 if (p->error_indicator) {
12588 return NULL;
12589 }
12590 asdl_seq * res = NULL;
12591 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012592 { // with_item _loop0_41
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012593 withitem_ty elem;
12594 asdl_seq * seq;
12595 if (
12596 (elem = with_item_rule(p))
12597 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012598 (seq = _loop0_41_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012599 )
12600 {
12601 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12602 goto done;
12603 }
12604 p->mark = mark;
12605 }
12606 res = NULL;
12607 done:
12608 return res;
12609}
12610
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012611// _loop0_43: ',' with_item
12612static asdl_seq *
12613_loop0_43_rule(Parser *p)
12614{
12615 if (p->error_indicator) {
12616 return NULL;
12617 }
12618 void *res = NULL;
12619 int mark = p->mark;
12620 int start_mark = p->mark;
12621 void **children = PyMem_Malloc(sizeof(void *));
12622 if (!children) {
12623 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12624 return NULL;
12625 }
12626 ssize_t children_capacity = 1;
12627 ssize_t n = 0;
12628 { // ',' with_item
12629 withitem_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012630 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012631 while (
12632 (literal = _PyPegen_expect_token(p, 12))
12633 &&
12634 (elem = with_item_rule(p))
12635 )
12636 {
12637 res = elem;
12638 if (res == NULL && PyErr_Occurred()) {
12639 p->error_indicator = 1;
12640 PyMem_Free(children);
12641 return NULL;
12642 }
12643 if (n == children_capacity) {
12644 children_capacity *= 2;
12645 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12646 if (!children) {
12647 PyErr_Format(PyExc_MemoryError, "realloc None");
12648 return NULL;
12649 }
12650 }
12651 children[n++] = res;
12652 mark = p->mark;
12653 }
12654 p->mark = mark;
12655 }
12656 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12657 if (!seq) {
12658 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_43");
12659 PyMem_Free(children);
12660 return NULL;
12661 }
12662 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12663 PyMem_Free(children);
12664 _PyPegen_insert_memo(p, start_mark, _loop0_43_type, seq);
12665 return seq;
12666}
12667
12668// _gather_42: with_item _loop0_43
12669static asdl_seq *
12670_gather_42_rule(Parser *p)
12671{
12672 if (p->error_indicator) {
12673 return NULL;
12674 }
12675 asdl_seq * res = NULL;
12676 int mark = p->mark;
12677 { // with_item _loop0_43
12678 withitem_ty elem;
12679 asdl_seq * seq;
12680 if (
12681 (elem = with_item_rule(p))
12682 &&
12683 (seq = _loop0_43_rule(p))
12684 )
12685 {
12686 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12687 goto done;
12688 }
12689 p->mark = mark;
12690 }
12691 res = NULL;
12692 done:
12693 return res;
12694}
12695
12696// _loop0_45: ',' with_item
12697static asdl_seq *
12698_loop0_45_rule(Parser *p)
12699{
12700 if (p->error_indicator) {
12701 return NULL;
12702 }
12703 void *res = NULL;
12704 int mark = p->mark;
12705 int start_mark = p->mark;
12706 void **children = PyMem_Malloc(sizeof(void *));
12707 if (!children) {
12708 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12709 return NULL;
12710 }
12711 ssize_t children_capacity = 1;
12712 ssize_t n = 0;
12713 { // ',' with_item
12714 withitem_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012715 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012716 while (
12717 (literal = _PyPegen_expect_token(p, 12))
12718 &&
12719 (elem = with_item_rule(p))
12720 )
12721 {
12722 res = elem;
12723 if (res == NULL && PyErr_Occurred()) {
12724 p->error_indicator = 1;
12725 PyMem_Free(children);
12726 return NULL;
12727 }
12728 if (n == children_capacity) {
12729 children_capacity *= 2;
12730 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12731 if (!children) {
12732 PyErr_Format(PyExc_MemoryError, "realloc None");
12733 return NULL;
12734 }
12735 }
12736 children[n++] = res;
12737 mark = p->mark;
12738 }
12739 p->mark = mark;
12740 }
12741 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12742 if (!seq) {
12743 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_45");
12744 PyMem_Free(children);
12745 return NULL;
12746 }
12747 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12748 PyMem_Free(children);
12749 _PyPegen_insert_memo(p, start_mark, _loop0_45_type, seq);
12750 return seq;
12751}
12752
12753// _gather_44: with_item _loop0_45
12754static asdl_seq *
12755_gather_44_rule(Parser *p)
12756{
12757 if (p->error_indicator) {
12758 return NULL;
12759 }
12760 asdl_seq * res = NULL;
12761 int mark = p->mark;
12762 { // with_item _loop0_45
12763 withitem_ty elem;
12764 asdl_seq * seq;
12765 if (
12766 (elem = with_item_rule(p))
12767 &&
12768 (seq = _loop0_45_rule(p))
12769 )
12770 {
12771 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12772 goto done;
12773 }
12774 p->mark = mark;
12775 }
12776 res = NULL;
12777 done:
12778 return res;
12779}
12780
12781// _tmp_46: 'as' target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012782static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012783_tmp_46_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012784{
12785 if (p->error_indicator) {
12786 return NULL;
12787 }
12788 void * res = NULL;
12789 int mark = p->mark;
12790 { // 'as' target
Pablo Galindob796b3f2020-05-01 12:32:26 +010012791 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012792 expr_ty t;
12793 if (
12794 (keyword = _PyPegen_expect_token(p, 531))
12795 &&
12796 (t = target_rule(p))
12797 )
12798 {
12799 res = t;
12800 if (res == NULL && PyErr_Occurred()) {
12801 p->error_indicator = 1;
12802 return NULL;
12803 }
12804 goto done;
12805 }
12806 p->mark = mark;
12807 }
12808 res = NULL;
12809 done:
12810 return res;
12811}
12812
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012813// _loop1_47: except_block
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012814static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012815_loop1_47_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012816{
12817 if (p->error_indicator) {
12818 return NULL;
12819 }
12820 void *res = NULL;
12821 int mark = p->mark;
12822 int start_mark = p->mark;
12823 void **children = PyMem_Malloc(sizeof(void *));
12824 if (!children) {
12825 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12826 return NULL;
12827 }
12828 ssize_t children_capacity = 1;
12829 ssize_t n = 0;
12830 { // except_block
12831 excepthandler_ty except_block_var;
12832 while (
12833 (except_block_var = except_block_rule(p))
12834 )
12835 {
12836 res = except_block_var;
12837 if (n == children_capacity) {
12838 children_capacity *= 2;
12839 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12840 if (!children) {
12841 PyErr_Format(PyExc_MemoryError, "realloc None");
12842 return NULL;
12843 }
12844 }
12845 children[n++] = res;
12846 mark = p->mark;
12847 }
12848 p->mark = mark;
12849 }
12850 if (n == 0) {
12851 PyMem_Free(children);
12852 return NULL;
12853 }
12854 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12855 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012856 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_47");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012857 PyMem_Free(children);
12858 return NULL;
12859 }
12860 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12861 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012862 _PyPegen_insert_memo(p, start_mark, _loop1_47_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012863 return seq;
12864}
12865
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012866// _tmp_48: 'as' target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012867static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012868_tmp_48_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012869{
12870 if (p->error_indicator) {
12871 return NULL;
12872 }
12873 void * res = NULL;
12874 int mark = p->mark;
12875 { // 'as' target
Pablo Galindob796b3f2020-05-01 12:32:26 +010012876 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012877 expr_ty z;
12878 if (
12879 (keyword = _PyPegen_expect_token(p, 531))
12880 &&
12881 (z = target_rule(p))
12882 )
12883 {
12884 res = z;
12885 if (res == NULL && PyErr_Occurred()) {
12886 p->error_indicator = 1;
12887 return NULL;
12888 }
12889 goto done;
12890 }
12891 p->mark = mark;
12892 }
12893 res = NULL;
12894 done:
12895 return res;
12896}
12897
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012898// _tmp_49: 'from' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012899static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012900_tmp_49_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012901{
12902 if (p->error_indicator) {
12903 return NULL;
12904 }
12905 void * res = NULL;
12906 int mark = p->mark;
12907 { // 'from' expression
Pablo Galindob796b3f2020-05-01 12:32:26 +010012908 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012909 expr_ty z;
12910 if (
12911 (keyword = _PyPegen_expect_token(p, 514))
12912 &&
12913 (z = expression_rule(p))
12914 )
12915 {
12916 res = z;
12917 if (res == NULL && PyErr_Occurred()) {
12918 p->error_indicator = 1;
12919 return NULL;
12920 }
12921 goto done;
12922 }
12923 p->mark = mark;
12924 }
12925 res = NULL;
12926 done:
12927 return res;
12928}
12929
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012930// _tmp_50: '->' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012931static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012932_tmp_50_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012933{
12934 if (p->error_indicator) {
12935 return NULL;
12936 }
12937 void * res = NULL;
12938 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012939 { // '->' expression
Pablo Galindob796b3f2020-05-01 12:32:26 +010012940 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070012941 expr_ty z;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012942 if (
Guido van Rossumc001c092020-04-30 12:12:19 -070012943 (literal = _PyPegen_expect_token(p, 51))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012944 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012945 (z = expression_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012946 )
12947 {
Guido van Rossumc001c092020-04-30 12:12:19 -070012948 res = z;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012949 if (res == NULL && PyErr_Occurred()) {
12950 p->error_indicator = 1;
12951 return NULL;
12952 }
12953 goto done;
12954 }
12955 p->mark = mark;
12956 }
12957 res = NULL;
12958 done:
12959 return res;
12960}
12961
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012962// _tmp_51: '->' expression
Guido van Rossumc001c092020-04-30 12:12:19 -070012963static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012964_tmp_51_rule(Parser *p)
12965{
12966 if (p->error_indicator) {
12967 return NULL;
12968 }
12969 void * res = NULL;
12970 int mark = p->mark;
12971 { // '->' expression
Pablo Galindob796b3f2020-05-01 12:32:26 +010012972 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012973 expr_ty z;
12974 if (
12975 (literal = _PyPegen_expect_token(p, 51))
12976 &&
12977 (z = expression_rule(p))
12978 )
12979 {
12980 res = z;
12981 if (res == NULL && PyErr_Occurred()) {
12982 p->error_indicator = 1;
12983 return NULL;
12984 }
12985 goto done;
12986 }
12987 p->mark = mark;
12988 }
12989 res = NULL;
12990 done:
12991 return res;
12992}
12993
12994// _tmp_52: NEWLINE INDENT
12995static void *
12996_tmp_52_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070012997{
12998 if (p->error_indicator) {
12999 return NULL;
13000 }
13001 void * res = NULL;
13002 int mark = p->mark;
13003 { // NEWLINE INDENT
Pablo Galindob796b3f2020-05-01 12:32:26 +010013004 Token * indent_var;
13005 Token * newline_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013006 if (
13007 (newline_var = _PyPegen_expect_token(p, NEWLINE))
13008 &&
13009 (indent_var = _PyPegen_expect_token(p, INDENT))
13010 )
13011 {
13012 res = _PyPegen_dummy_name(p, newline_var, indent_var);
13013 goto done;
13014 }
13015 p->mark = mark;
13016 }
13017 res = NULL;
13018 done:
13019 return res;
13020}
13021
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013022// _loop0_53: param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013023static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013024_loop0_53_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013025{
13026 if (p->error_indicator) {
13027 return NULL;
13028 }
13029 void *res = NULL;
13030 int mark = p->mark;
13031 int start_mark = p->mark;
13032 void **children = PyMem_Malloc(sizeof(void *));
13033 if (!children) {
13034 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13035 return NULL;
13036 }
13037 ssize_t children_capacity = 1;
13038 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070013039 { // param_no_default
13040 arg_ty param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013041 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070013042 (param_no_default_var = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013043 )
13044 {
Guido van Rossumc001c092020-04-30 12:12:19 -070013045 res = param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013046 if (n == children_capacity) {
13047 children_capacity *= 2;
13048 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13049 if (!children) {
13050 PyErr_Format(PyExc_MemoryError, "realloc None");
13051 return NULL;
13052 }
13053 }
13054 children[n++] = res;
13055 mark = p->mark;
13056 }
13057 p->mark = mark;
13058 }
13059 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13060 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013061 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_53");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013062 PyMem_Free(children);
13063 return NULL;
13064 }
13065 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13066 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013067 _PyPegen_insert_memo(p, start_mark, _loop0_53_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013068 return seq;
13069}
13070
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013071// _loop0_54: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013072static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013073_loop0_54_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013074{
13075 if (p->error_indicator) {
13076 return NULL;
13077 }
13078 void *res = NULL;
13079 int mark = p->mark;
13080 int start_mark = p->mark;
13081 void **children = PyMem_Malloc(sizeof(void *));
13082 if (!children) {
13083 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13084 return NULL;
13085 }
13086 ssize_t children_capacity = 1;
13087 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070013088 { // param_with_default
13089 NameDefaultPair* param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013090 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070013091 (param_with_default_var = param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013092 )
13093 {
Guido van Rossumc001c092020-04-30 12:12:19 -070013094 res = param_with_default_var;
13095 if (n == children_capacity) {
13096 children_capacity *= 2;
13097 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13098 if (!children) {
13099 PyErr_Format(PyExc_MemoryError, "realloc None");
13100 return NULL;
13101 }
13102 }
13103 children[n++] = res;
13104 mark = p->mark;
13105 }
13106 p->mark = mark;
13107 }
13108 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13109 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013110 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_54");
Guido van Rossumc001c092020-04-30 12:12:19 -070013111 PyMem_Free(children);
13112 return NULL;
13113 }
13114 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13115 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013116 _PyPegen_insert_memo(p, start_mark, _loop0_54_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070013117 return seq;
13118}
13119
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013120// _loop0_55: param_with_default
Guido van Rossumc001c092020-04-30 12:12:19 -070013121static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013122_loop0_55_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070013123{
13124 if (p->error_indicator) {
13125 return NULL;
13126 }
13127 void *res = NULL;
13128 int mark = p->mark;
13129 int start_mark = p->mark;
13130 void **children = PyMem_Malloc(sizeof(void *));
13131 if (!children) {
13132 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13133 return NULL;
13134 }
13135 ssize_t children_capacity = 1;
13136 ssize_t n = 0;
13137 { // param_with_default
13138 NameDefaultPair* param_with_default_var;
13139 while (
13140 (param_with_default_var = param_with_default_rule(p))
13141 )
13142 {
13143 res = param_with_default_var;
13144 if (n == children_capacity) {
13145 children_capacity *= 2;
13146 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13147 if (!children) {
13148 PyErr_Format(PyExc_MemoryError, "realloc None");
13149 return NULL;
13150 }
13151 }
13152 children[n++] = res;
13153 mark = p->mark;
13154 }
13155 p->mark = mark;
13156 }
13157 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13158 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013159 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_55");
Guido van Rossumc001c092020-04-30 12:12:19 -070013160 PyMem_Free(children);
13161 return NULL;
13162 }
13163 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13164 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013165 _PyPegen_insert_memo(p, start_mark, _loop0_55_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070013166 return seq;
13167}
13168
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013169// _loop1_56: param_no_default
Guido van Rossumc001c092020-04-30 12:12:19 -070013170static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013171_loop1_56_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070013172{
13173 if (p->error_indicator) {
13174 return NULL;
13175 }
13176 void *res = NULL;
13177 int mark = p->mark;
13178 int start_mark = p->mark;
13179 void **children = PyMem_Malloc(sizeof(void *));
13180 if (!children) {
13181 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13182 return NULL;
13183 }
13184 ssize_t children_capacity = 1;
13185 ssize_t n = 0;
13186 { // param_no_default
13187 arg_ty param_no_default_var;
13188 while (
13189 (param_no_default_var = param_no_default_rule(p))
13190 )
13191 {
13192 res = param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013193 if (n == children_capacity) {
13194 children_capacity *= 2;
13195 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13196 if (!children) {
13197 PyErr_Format(PyExc_MemoryError, "realloc None");
13198 return NULL;
13199 }
13200 }
13201 children[n++] = res;
13202 mark = p->mark;
13203 }
13204 p->mark = mark;
13205 }
13206 if (n == 0) {
13207 PyMem_Free(children);
13208 return NULL;
13209 }
13210 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13211 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013212 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_56");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013213 PyMem_Free(children);
13214 return NULL;
13215 }
13216 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13217 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013218 _PyPegen_insert_memo(p, start_mark, _loop1_56_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013219 return seq;
13220}
13221
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013222// _loop0_57: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013223static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013224_loop0_57_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013225{
13226 if (p->error_indicator) {
13227 return NULL;
13228 }
13229 void *res = NULL;
13230 int mark = p->mark;
13231 int start_mark = p->mark;
13232 void **children = PyMem_Malloc(sizeof(void *));
13233 if (!children) {
13234 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13235 return NULL;
13236 }
13237 ssize_t children_capacity = 1;
13238 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070013239 { // param_with_default
13240 NameDefaultPair* param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013241 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070013242 (param_with_default_var = param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013243 )
13244 {
Guido van Rossumc001c092020-04-30 12:12:19 -070013245 res = param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013246 if (n == children_capacity) {
13247 children_capacity *= 2;
13248 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13249 if (!children) {
13250 PyErr_Format(PyExc_MemoryError, "realloc None");
13251 return NULL;
13252 }
13253 }
13254 children[n++] = res;
13255 mark = p->mark;
13256 }
13257 p->mark = mark;
13258 }
13259 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13260 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013261 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_57");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013262 PyMem_Free(children);
13263 return NULL;
13264 }
13265 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13266 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013267 _PyPegen_insert_memo(p, start_mark, _loop0_57_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013268 return seq;
13269}
13270
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013271// _loop1_58: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013272static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013273_loop1_58_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013274{
13275 if (p->error_indicator) {
13276 return NULL;
13277 }
13278 void *res = NULL;
13279 int mark = p->mark;
13280 int start_mark = p->mark;
13281 void **children = PyMem_Malloc(sizeof(void *));
13282 if (!children) {
13283 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13284 return NULL;
13285 }
13286 ssize_t children_capacity = 1;
13287 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070013288 { // param_with_default
13289 NameDefaultPair* param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013290 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070013291 (param_with_default_var = param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013292 )
13293 {
Guido van Rossumc001c092020-04-30 12:12:19 -070013294 res = param_with_default_var;
13295 if (n == children_capacity) {
13296 children_capacity *= 2;
13297 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13298 if (!children) {
13299 PyErr_Format(PyExc_MemoryError, "realloc None");
13300 return NULL;
13301 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013302 }
Guido van Rossumc001c092020-04-30 12:12:19 -070013303 children[n++] = res;
13304 mark = p->mark;
13305 }
13306 p->mark = mark;
13307 }
13308 if (n == 0) {
13309 PyMem_Free(children);
13310 return NULL;
13311 }
13312 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13313 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013314 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_58");
Guido van Rossumc001c092020-04-30 12:12:19 -070013315 PyMem_Free(children);
13316 return NULL;
13317 }
13318 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13319 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013320 _PyPegen_insert_memo(p, start_mark, _loop1_58_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070013321 return seq;
13322}
13323
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013324// _loop1_59: param_no_default
Guido van Rossumc001c092020-04-30 12:12:19 -070013325static asdl_seq *
13326_loop1_59_rule(Parser *p)
13327{
13328 if (p->error_indicator) {
13329 return NULL;
13330 }
13331 void *res = NULL;
13332 int mark = p->mark;
13333 int start_mark = p->mark;
13334 void **children = PyMem_Malloc(sizeof(void *));
13335 if (!children) {
13336 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13337 return NULL;
13338 }
13339 ssize_t children_capacity = 1;
13340 ssize_t n = 0;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013341 { // param_no_default
13342 arg_ty param_no_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013343 while (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013344 (param_no_default_var = param_no_default_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070013345 )
13346 {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013347 res = param_no_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013348 if (n == children_capacity) {
13349 children_capacity *= 2;
13350 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13351 if (!children) {
13352 PyErr_Format(PyExc_MemoryError, "realloc None");
13353 return NULL;
13354 }
13355 }
13356 children[n++] = res;
13357 mark = p->mark;
13358 }
13359 p->mark = mark;
13360 }
13361 if (n == 0) {
13362 PyMem_Free(children);
13363 return NULL;
13364 }
13365 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13366 if (!seq) {
13367 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_59");
13368 PyMem_Free(children);
13369 return NULL;
13370 }
13371 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13372 PyMem_Free(children);
13373 _PyPegen_insert_memo(p, start_mark, _loop1_59_type, seq);
13374 return seq;
13375}
13376
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013377// _loop1_60: param_no_default
Guido van Rossumc001c092020-04-30 12:12:19 -070013378static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013379_loop1_60_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070013380{
13381 if (p->error_indicator) {
13382 return NULL;
13383 }
13384 void *res = NULL;
13385 int mark = p->mark;
13386 int start_mark = p->mark;
13387 void **children = PyMem_Malloc(sizeof(void *));
13388 if (!children) {
13389 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13390 return NULL;
13391 }
13392 ssize_t children_capacity = 1;
13393 ssize_t n = 0;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013394 { // param_no_default
13395 arg_ty param_no_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013396 while (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013397 (param_no_default_var = param_no_default_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070013398 )
13399 {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013400 res = param_no_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013401 if (n == children_capacity) {
13402 children_capacity *= 2;
13403 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13404 if (!children) {
13405 PyErr_Format(PyExc_MemoryError, "realloc None");
13406 return NULL;
13407 }
13408 }
13409 children[n++] = res;
13410 mark = p->mark;
13411 }
13412 p->mark = mark;
13413 }
13414 if (n == 0) {
13415 PyMem_Free(children);
13416 return NULL;
13417 }
13418 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13419 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013420 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_60");
Guido van Rossumc001c092020-04-30 12:12:19 -070013421 PyMem_Free(children);
13422 return NULL;
13423 }
13424 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13425 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013426 _PyPegen_insert_memo(p, start_mark, _loop1_60_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070013427 return seq;
13428}
13429
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013430// _loop0_61: param_no_default
13431static asdl_seq *
13432_loop0_61_rule(Parser *p)
13433{
13434 if (p->error_indicator) {
13435 return NULL;
13436 }
13437 void *res = NULL;
13438 int mark = p->mark;
13439 int start_mark = p->mark;
13440 void **children = PyMem_Malloc(sizeof(void *));
13441 if (!children) {
13442 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13443 return NULL;
13444 }
13445 ssize_t children_capacity = 1;
13446 ssize_t n = 0;
13447 { // param_no_default
13448 arg_ty param_no_default_var;
13449 while (
13450 (param_no_default_var = param_no_default_rule(p))
13451 )
13452 {
13453 res = param_no_default_var;
13454 if (n == children_capacity) {
13455 children_capacity *= 2;
13456 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13457 if (!children) {
13458 PyErr_Format(PyExc_MemoryError, "realloc None");
13459 return NULL;
13460 }
13461 }
13462 children[n++] = res;
13463 mark = p->mark;
13464 }
13465 p->mark = mark;
13466 }
13467 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13468 if (!seq) {
13469 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_61");
13470 PyMem_Free(children);
13471 return NULL;
13472 }
13473 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13474 PyMem_Free(children);
13475 _PyPegen_insert_memo(p, start_mark, _loop0_61_type, seq);
13476 return seq;
13477}
13478
13479// _loop1_62: param_with_default
Guido van Rossumc001c092020-04-30 12:12:19 -070013480static asdl_seq *
13481_loop1_62_rule(Parser *p)
13482{
13483 if (p->error_indicator) {
13484 return NULL;
13485 }
13486 void *res = NULL;
13487 int mark = p->mark;
13488 int start_mark = p->mark;
13489 void **children = PyMem_Malloc(sizeof(void *));
13490 if (!children) {
13491 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13492 return NULL;
13493 }
13494 ssize_t children_capacity = 1;
13495 ssize_t n = 0;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013496 { // param_with_default
13497 NameDefaultPair* param_with_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013498 while (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013499 (param_with_default_var = param_with_default_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070013500 )
13501 {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013502 res = param_with_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013503 if (n == children_capacity) {
13504 children_capacity *= 2;
13505 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13506 if (!children) {
13507 PyErr_Format(PyExc_MemoryError, "realloc None");
13508 return NULL;
13509 }
13510 }
13511 children[n++] = res;
13512 mark = p->mark;
13513 }
13514 p->mark = mark;
13515 }
13516 if (n == 0) {
13517 PyMem_Free(children);
13518 return NULL;
13519 }
13520 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13521 if (!seq) {
13522 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_62");
13523 PyMem_Free(children);
13524 return NULL;
13525 }
13526 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13527 PyMem_Free(children);
13528 _PyPegen_insert_memo(p, start_mark, _loop1_62_type, seq);
13529 return seq;
13530}
13531
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013532// _loop0_63: param_no_default
13533static asdl_seq *
13534_loop0_63_rule(Parser *p)
13535{
13536 if (p->error_indicator) {
13537 return NULL;
13538 }
13539 void *res = NULL;
13540 int mark = p->mark;
13541 int start_mark = p->mark;
13542 void **children = PyMem_Malloc(sizeof(void *));
13543 if (!children) {
13544 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13545 return NULL;
13546 }
13547 ssize_t children_capacity = 1;
13548 ssize_t n = 0;
13549 { // param_no_default
13550 arg_ty param_no_default_var;
13551 while (
13552 (param_no_default_var = param_no_default_rule(p))
13553 )
13554 {
13555 res = param_no_default_var;
13556 if (n == children_capacity) {
13557 children_capacity *= 2;
13558 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13559 if (!children) {
13560 PyErr_Format(PyExc_MemoryError, "realloc None");
13561 return NULL;
13562 }
13563 }
13564 children[n++] = res;
13565 mark = p->mark;
13566 }
13567 p->mark = mark;
13568 }
13569 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13570 if (!seq) {
13571 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_63");
13572 PyMem_Free(children);
13573 return NULL;
13574 }
13575 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13576 PyMem_Free(children);
13577 _PyPegen_insert_memo(p, start_mark, _loop0_63_type, seq);
13578 return seq;
13579}
13580
13581// _loop1_64: param_with_default
13582static asdl_seq *
13583_loop1_64_rule(Parser *p)
13584{
13585 if (p->error_indicator) {
13586 return NULL;
13587 }
13588 void *res = NULL;
13589 int mark = p->mark;
13590 int start_mark = p->mark;
13591 void **children = PyMem_Malloc(sizeof(void *));
13592 if (!children) {
13593 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13594 return NULL;
13595 }
13596 ssize_t children_capacity = 1;
13597 ssize_t n = 0;
13598 { // param_with_default
13599 NameDefaultPair* param_with_default_var;
13600 while (
13601 (param_with_default_var = param_with_default_rule(p))
13602 )
13603 {
13604 res = param_with_default_var;
13605 if (n == children_capacity) {
13606 children_capacity *= 2;
13607 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13608 if (!children) {
13609 PyErr_Format(PyExc_MemoryError, "realloc None");
13610 return NULL;
13611 }
13612 }
13613 children[n++] = res;
13614 mark = p->mark;
13615 }
13616 p->mark = mark;
13617 }
13618 if (n == 0) {
13619 PyMem_Free(children);
13620 return NULL;
13621 }
13622 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13623 if (!seq) {
13624 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_64");
13625 PyMem_Free(children);
13626 return NULL;
13627 }
13628 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13629 PyMem_Free(children);
13630 _PyPegen_insert_memo(p, start_mark, _loop1_64_type, seq);
13631 return seq;
13632}
13633
13634// _loop0_65: param_maybe_default
13635static asdl_seq *
13636_loop0_65_rule(Parser *p)
13637{
13638 if (p->error_indicator) {
13639 return NULL;
13640 }
13641 void *res = NULL;
13642 int mark = p->mark;
13643 int start_mark = p->mark;
13644 void **children = PyMem_Malloc(sizeof(void *));
13645 if (!children) {
13646 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13647 return NULL;
13648 }
13649 ssize_t children_capacity = 1;
13650 ssize_t n = 0;
13651 { // param_maybe_default
13652 NameDefaultPair* param_maybe_default_var;
13653 while (
13654 (param_maybe_default_var = param_maybe_default_rule(p))
13655 )
13656 {
13657 res = param_maybe_default_var;
13658 if (n == children_capacity) {
13659 children_capacity *= 2;
13660 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13661 if (!children) {
13662 PyErr_Format(PyExc_MemoryError, "realloc None");
13663 return NULL;
13664 }
13665 }
13666 children[n++] = res;
13667 mark = p->mark;
13668 }
13669 p->mark = mark;
13670 }
13671 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13672 if (!seq) {
13673 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_65");
13674 PyMem_Free(children);
13675 return NULL;
13676 }
13677 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13678 PyMem_Free(children);
13679 _PyPegen_insert_memo(p, start_mark, _loop0_65_type, seq);
13680 return seq;
13681}
13682
13683// _loop1_66: param_maybe_default
13684static asdl_seq *
13685_loop1_66_rule(Parser *p)
13686{
13687 if (p->error_indicator) {
13688 return NULL;
13689 }
13690 void *res = NULL;
13691 int mark = p->mark;
13692 int start_mark = p->mark;
13693 void **children = PyMem_Malloc(sizeof(void *));
13694 if (!children) {
13695 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13696 return NULL;
13697 }
13698 ssize_t children_capacity = 1;
13699 ssize_t n = 0;
13700 { // param_maybe_default
13701 NameDefaultPair* param_maybe_default_var;
13702 while (
13703 (param_maybe_default_var = param_maybe_default_rule(p))
13704 )
13705 {
13706 res = param_maybe_default_var;
13707 if (n == children_capacity) {
13708 children_capacity *= 2;
13709 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13710 if (!children) {
13711 PyErr_Format(PyExc_MemoryError, "realloc None");
13712 return NULL;
13713 }
13714 }
13715 children[n++] = res;
13716 mark = p->mark;
13717 }
13718 p->mark = mark;
13719 }
13720 if (n == 0) {
13721 PyMem_Free(children);
13722 return NULL;
13723 }
13724 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13725 if (!seq) {
13726 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_66");
13727 PyMem_Free(children);
13728 return NULL;
13729 }
13730 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13731 PyMem_Free(children);
13732 _PyPegen_insert_memo(p, start_mark, _loop1_66_type, seq);
13733 return seq;
13734}
13735
13736// _loop1_67: ('@' named_expression NEWLINE)
13737static asdl_seq *
13738_loop1_67_rule(Parser *p)
13739{
13740 if (p->error_indicator) {
13741 return NULL;
13742 }
13743 void *res = NULL;
13744 int mark = p->mark;
13745 int start_mark = p->mark;
13746 void **children = PyMem_Malloc(sizeof(void *));
13747 if (!children) {
13748 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13749 return NULL;
13750 }
13751 ssize_t children_capacity = 1;
13752 ssize_t n = 0;
13753 { // ('@' named_expression NEWLINE)
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030013754 void *_tmp_137_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013755 while (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030013756 (_tmp_137_var = _tmp_137_rule(p))
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013757 )
13758 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030013759 res = _tmp_137_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013760 if (n == children_capacity) {
13761 children_capacity *= 2;
13762 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13763 if (!children) {
13764 PyErr_Format(PyExc_MemoryError, "realloc None");
13765 return NULL;
13766 }
13767 }
13768 children[n++] = res;
13769 mark = p->mark;
13770 }
13771 p->mark = mark;
13772 }
13773 if (n == 0) {
13774 PyMem_Free(children);
13775 return NULL;
13776 }
13777 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13778 if (!seq) {
13779 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_67");
13780 PyMem_Free(children);
13781 return NULL;
13782 }
13783 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13784 PyMem_Free(children);
13785 _PyPegen_insert_memo(p, start_mark, _loop1_67_type, seq);
13786 return seq;
13787}
13788
13789// _tmp_68: '(' arguments? ')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013790static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013791_tmp_68_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013792{
13793 if (p->error_indicator) {
13794 return NULL;
13795 }
13796 void * res = NULL;
13797 int mark = p->mark;
13798 { // '(' arguments? ')'
Pablo Galindob796b3f2020-05-01 12:32:26 +010013799 Token * literal;
13800 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013801 void *z;
13802 if (
13803 (literal = _PyPegen_expect_token(p, 7))
13804 &&
13805 (z = arguments_rule(p), 1)
13806 &&
13807 (literal_1 = _PyPegen_expect_token(p, 8))
13808 )
13809 {
13810 res = z;
13811 if (res == NULL && PyErr_Occurred()) {
13812 p->error_indicator = 1;
13813 return NULL;
13814 }
13815 goto done;
13816 }
13817 p->mark = mark;
13818 }
13819 res = NULL;
13820 done:
13821 return res;
13822}
13823
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013824// _loop0_70: ',' star_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013825static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013826_loop0_70_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013827{
13828 if (p->error_indicator) {
13829 return NULL;
13830 }
13831 void *res = NULL;
13832 int mark = p->mark;
13833 int start_mark = p->mark;
13834 void **children = PyMem_Malloc(sizeof(void *));
13835 if (!children) {
13836 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13837 return NULL;
13838 }
13839 ssize_t children_capacity = 1;
13840 ssize_t n = 0;
13841 { // ',' star_expression
13842 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010013843 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013844 while (
13845 (literal = _PyPegen_expect_token(p, 12))
13846 &&
13847 (elem = star_expression_rule(p))
13848 )
13849 {
13850 res = elem;
13851 if (res == NULL && PyErr_Occurred()) {
13852 p->error_indicator = 1;
13853 PyMem_Free(children);
13854 return NULL;
13855 }
13856 if (n == children_capacity) {
13857 children_capacity *= 2;
13858 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13859 if (!children) {
13860 PyErr_Format(PyExc_MemoryError, "realloc None");
13861 return NULL;
13862 }
13863 }
13864 children[n++] = res;
13865 mark = p->mark;
13866 }
13867 p->mark = mark;
13868 }
13869 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13870 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013871 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_70");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013872 PyMem_Free(children);
13873 return NULL;
13874 }
13875 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13876 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013877 _PyPegen_insert_memo(p, start_mark, _loop0_70_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013878 return seq;
13879}
13880
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013881// _gather_69: star_expression _loop0_70
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013882static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013883_gather_69_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013884{
13885 if (p->error_indicator) {
13886 return NULL;
13887 }
13888 asdl_seq * res = NULL;
13889 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013890 { // star_expression _loop0_70
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013891 expr_ty elem;
13892 asdl_seq * seq;
13893 if (
13894 (elem = star_expression_rule(p))
13895 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013896 (seq = _loop0_70_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013897 )
13898 {
13899 res = _PyPegen_seq_insert_in_front(p, elem, seq);
13900 goto done;
13901 }
13902 p->mark = mark;
13903 }
13904 res = NULL;
13905 done:
13906 return res;
13907}
13908
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013909// _loop1_71: (',' star_expression)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013910static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013911_loop1_71_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013912{
13913 if (p->error_indicator) {
13914 return NULL;
13915 }
13916 void *res = NULL;
13917 int mark = p->mark;
13918 int start_mark = p->mark;
13919 void **children = PyMem_Malloc(sizeof(void *));
13920 if (!children) {
13921 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13922 return NULL;
13923 }
13924 ssize_t children_capacity = 1;
13925 ssize_t n = 0;
13926 { // (',' star_expression)
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030013927 void *_tmp_138_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013928 while (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030013929 (_tmp_138_var = _tmp_138_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013930 )
13931 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030013932 res = _tmp_138_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013933 if (n == children_capacity) {
13934 children_capacity *= 2;
13935 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13936 if (!children) {
13937 PyErr_Format(PyExc_MemoryError, "realloc None");
13938 return NULL;
13939 }
13940 }
13941 children[n++] = res;
13942 mark = p->mark;
13943 }
13944 p->mark = mark;
13945 }
13946 if (n == 0) {
13947 PyMem_Free(children);
13948 return NULL;
13949 }
13950 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13951 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013952 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_71");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013953 PyMem_Free(children);
13954 return NULL;
13955 }
13956 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13957 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013958 _PyPegen_insert_memo(p, start_mark, _loop1_71_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013959 return seq;
13960}
13961
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013962// _loop0_73: ',' star_named_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013963static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013964_loop0_73_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013965{
13966 if (p->error_indicator) {
13967 return NULL;
13968 }
13969 void *res = NULL;
13970 int mark = p->mark;
13971 int start_mark = p->mark;
13972 void **children = PyMem_Malloc(sizeof(void *));
13973 if (!children) {
13974 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13975 return NULL;
13976 }
13977 ssize_t children_capacity = 1;
13978 ssize_t n = 0;
13979 { // ',' star_named_expression
13980 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010013981 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013982 while (
13983 (literal = _PyPegen_expect_token(p, 12))
13984 &&
13985 (elem = star_named_expression_rule(p))
13986 )
13987 {
13988 res = elem;
13989 if (res == NULL && PyErr_Occurred()) {
13990 p->error_indicator = 1;
13991 PyMem_Free(children);
13992 return NULL;
13993 }
13994 if (n == children_capacity) {
13995 children_capacity *= 2;
13996 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13997 if (!children) {
13998 PyErr_Format(PyExc_MemoryError, "realloc None");
13999 return NULL;
14000 }
14001 }
14002 children[n++] = res;
14003 mark = p->mark;
14004 }
14005 p->mark = mark;
14006 }
14007 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14008 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014009 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_73");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014010 PyMem_Free(children);
14011 return NULL;
14012 }
14013 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14014 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014015 _PyPegen_insert_memo(p, start_mark, _loop0_73_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014016 return seq;
14017}
14018
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014019// _gather_72: star_named_expression _loop0_73
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014020static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014021_gather_72_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014022{
14023 if (p->error_indicator) {
14024 return NULL;
14025 }
14026 asdl_seq * res = NULL;
14027 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014028 { // star_named_expression _loop0_73
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014029 expr_ty elem;
14030 asdl_seq * seq;
14031 if (
14032 (elem = star_named_expression_rule(p))
14033 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014034 (seq = _loop0_73_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014035 )
14036 {
14037 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14038 goto done;
14039 }
14040 p->mark = mark;
14041 }
14042 res = NULL;
14043 done:
14044 return res;
14045}
14046
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014047// _loop1_74: (',' expression)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014048static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014049_loop1_74_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014050{
14051 if (p->error_indicator) {
14052 return NULL;
14053 }
14054 void *res = NULL;
14055 int mark = p->mark;
14056 int start_mark = p->mark;
14057 void **children = PyMem_Malloc(sizeof(void *));
14058 if (!children) {
14059 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14060 return NULL;
14061 }
14062 ssize_t children_capacity = 1;
14063 ssize_t n = 0;
14064 { // (',' expression)
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030014065 void *_tmp_139_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014066 while (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030014067 (_tmp_139_var = _tmp_139_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014068 )
14069 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030014070 res = _tmp_139_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014071 if (n == children_capacity) {
14072 children_capacity *= 2;
14073 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14074 if (!children) {
14075 PyErr_Format(PyExc_MemoryError, "realloc None");
14076 return NULL;
14077 }
14078 }
14079 children[n++] = res;
14080 mark = p->mark;
14081 }
14082 p->mark = mark;
14083 }
14084 if (n == 0) {
14085 PyMem_Free(children);
14086 return NULL;
14087 }
14088 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14089 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014090 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_74");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014091 PyMem_Free(children);
14092 return NULL;
14093 }
14094 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14095 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014096 _PyPegen_insert_memo(p, start_mark, _loop1_74_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014097 return seq;
14098}
14099
Guido van Rossum3941d972020-05-01 09:42:03 -070014100// _loop0_75: lambda_param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014101static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014102_loop0_75_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014103{
14104 if (p->error_indicator) {
14105 return NULL;
14106 }
14107 void *res = NULL;
14108 int mark = p->mark;
14109 int start_mark = p->mark;
14110 void **children = PyMem_Malloc(sizeof(void *));
14111 if (!children) {
14112 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14113 return NULL;
14114 }
14115 ssize_t children_capacity = 1;
14116 ssize_t n = 0;
Guido van Rossum3941d972020-05-01 09:42:03 -070014117 { // lambda_param_no_default
14118 arg_ty lambda_param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014119 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070014120 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014121 )
14122 {
Guido van Rossum3941d972020-05-01 09:42:03 -070014123 res = lambda_param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014124 if (n == children_capacity) {
14125 children_capacity *= 2;
14126 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14127 if (!children) {
14128 PyErr_Format(PyExc_MemoryError, "realloc None");
14129 return NULL;
14130 }
14131 }
14132 children[n++] = res;
14133 mark = p->mark;
14134 }
14135 p->mark = mark;
14136 }
14137 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14138 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014139 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_75");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014140 PyMem_Free(children);
14141 return NULL;
14142 }
14143 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14144 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014145 _PyPegen_insert_memo(p, start_mark, _loop0_75_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014146 return seq;
14147}
14148
Guido van Rossum3941d972020-05-01 09:42:03 -070014149// _loop0_76: lambda_param_with_default
14150static asdl_seq *
14151_loop0_76_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014152{
14153 if (p->error_indicator) {
14154 return NULL;
14155 }
Guido van Rossum3941d972020-05-01 09:42:03 -070014156 void *res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014157 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070014158 int start_mark = p->mark;
14159 void **children = PyMem_Malloc(sizeof(void *));
14160 if (!children) {
14161 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14162 return NULL;
14163 }
14164 ssize_t children_capacity = 1;
14165 ssize_t n = 0;
14166 { // lambda_param_with_default
14167 NameDefaultPair* lambda_param_with_default_var;
14168 while (
14169 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014170 )
14171 {
Guido van Rossum3941d972020-05-01 09:42:03 -070014172 res = lambda_param_with_default_var;
14173 if (n == children_capacity) {
14174 children_capacity *= 2;
14175 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14176 if (!children) {
14177 PyErr_Format(PyExc_MemoryError, "realloc None");
14178 return NULL;
14179 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014180 }
Guido van Rossum3941d972020-05-01 09:42:03 -070014181 children[n++] = res;
14182 mark = p->mark;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014183 }
14184 p->mark = mark;
14185 }
Guido van Rossum3941d972020-05-01 09:42:03 -070014186 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14187 if (!seq) {
14188 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_76");
14189 PyMem_Free(children);
14190 return NULL;
14191 }
14192 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14193 PyMem_Free(children);
14194 _PyPegen_insert_memo(p, start_mark, _loop0_76_type, seq);
14195 return seq;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014196}
14197
Guido van Rossum3941d972020-05-01 09:42:03 -070014198// _loop0_77: lambda_param_with_default
14199static asdl_seq *
14200_loop0_77_rule(Parser *p)
14201{
14202 if (p->error_indicator) {
14203 return NULL;
14204 }
14205 void *res = NULL;
14206 int mark = p->mark;
14207 int start_mark = p->mark;
14208 void **children = PyMem_Malloc(sizeof(void *));
14209 if (!children) {
14210 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14211 return NULL;
14212 }
14213 ssize_t children_capacity = 1;
14214 ssize_t n = 0;
14215 { // lambda_param_with_default
14216 NameDefaultPair* lambda_param_with_default_var;
14217 while (
14218 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
14219 )
14220 {
14221 res = lambda_param_with_default_var;
14222 if (n == children_capacity) {
14223 children_capacity *= 2;
14224 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14225 if (!children) {
14226 PyErr_Format(PyExc_MemoryError, "realloc None");
14227 return NULL;
14228 }
14229 }
14230 children[n++] = res;
14231 mark = p->mark;
14232 }
14233 p->mark = mark;
14234 }
14235 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14236 if (!seq) {
14237 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_77");
14238 PyMem_Free(children);
14239 return NULL;
14240 }
14241 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14242 PyMem_Free(children);
14243 _PyPegen_insert_memo(p, start_mark, _loop0_77_type, seq);
14244 return seq;
14245}
14246
14247// _loop1_78: lambda_param_no_default
14248static asdl_seq *
14249_loop1_78_rule(Parser *p)
14250{
14251 if (p->error_indicator) {
14252 return NULL;
14253 }
14254 void *res = NULL;
14255 int mark = p->mark;
14256 int start_mark = p->mark;
14257 void **children = PyMem_Malloc(sizeof(void *));
14258 if (!children) {
14259 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14260 return NULL;
14261 }
14262 ssize_t children_capacity = 1;
14263 ssize_t n = 0;
14264 { // lambda_param_no_default
14265 arg_ty lambda_param_no_default_var;
14266 while (
14267 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
14268 )
14269 {
14270 res = lambda_param_no_default_var;
14271 if (n == children_capacity) {
14272 children_capacity *= 2;
14273 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14274 if (!children) {
14275 PyErr_Format(PyExc_MemoryError, "realloc None");
14276 return NULL;
14277 }
14278 }
14279 children[n++] = res;
14280 mark = p->mark;
14281 }
14282 p->mark = mark;
14283 }
14284 if (n == 0) {
14285 PyMem_Free(children);
14286 return NULL;
14287 }
14288 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14289 if (!seq) {
14290 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_78");
14291 PyMem_Free(children);
14292 return NULL;
14293 }
14294 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14295 PyMem_Free(children);
14296 _PyPegen_insert_memo(p, start_mark, _loop1_78_type, seq);
14297 return seq;
14298}
14299
14300// _loop0_79: lambda_param_with_default
14301static asdl_seq *
14302_loop0_79_rule(Parser *p)
14303{
14304 if (p->error_indicator) {
14305 return NULL;
14306 }
14307 void *res = NULL;
14308 int mark = p->mark;
14309 int start_mark = p->mark;
14310 void **children = PyMem_Malloc(sizeof(void *));
14311 if (!children) {
14312 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14313 return NULL;
14314 }
14315 ssize_t children_capacity = 1;
14316 ssize_t n = 0;
14317 { // lambda_param_with_default
14318 NameDefaultPair* lambda_param_with_default_var;
14319 while (
14320 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
14321 )
14322 {
14323 res = lambda_param_with_default_var;
14324 if (n == children_capacity) {
14325 children_capacity *= 2;
14326 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14327 if (!children) {
14328 PyErr_Format(PyExc_MemoryError, "realloc None");
14329 return NULL;
14330 }
14331 }
14332 children[n++] = res;
14333 mark = p->mark;
14334 }
14335 p->mark = mark;
14336 }
14337 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14338 if (!seq) {
14339 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_79");
14340 PyMem_Free(children);
14341 return NULL;
14342 }
14343 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14344 PyMem_Free(children);
14345 _PyPegen_insert_memo(p, start_mark, _loop0_79_type, seq);
14346 return seq;
14347}
14348
14349// _loop1_80: lambda_param_with_default
14350static asdl_seq *
14351_loop1_80_rule(Parser *p)
14352{
14353 if (p->error_indicator) {
14354 return NULL;
14355 }
14356 void *res = NULL;
14357 int mark = p->mark;
14358 int start_mark = p->mark;
14359 void **children = PyMem_Malloc(sizeof(void *));
14360 if (!children) {
14361 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14362 return NULL;
14363 }
14364 ssize_t children_capacity = 1;
14365 ssize_t n = 0;
14366 { // lambda_param_with_default
14367 NameDefaultPair* lambda_param_with_default_var;
14368 while (
14369 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
14370 )
14371 {
14372 res = lambda_param_with_default_var;
14373 if (n == children_capacity) {
14374 children_capacity *= 2;
14375 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14376 if (!children) {
14377 PyErr_Format(PyExc_MemoryError, "realloc None");
14378 return NULL;
14379 }
14380 }
14381 children[n++] = res;
14382 mark = p->mark;
14383 }
14384 p->mark = mark;
14385 }
14386 if (n == 0) {
14387 PyMem_Free(children);
14388 return NULL;
14389 }
14390 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14391 if (!seq) {
14392 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_80");
14393 PyMem_Free(children);
14394 return NULL;
14395 }
14396 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14397 PyMem_Free(children);
14398 _PyPegen_insert_memo(p, start_mark, _loop1_80_type, seq);
14399 return seq;
14400}
14401
14402// _loop1_81: lambda_param_no_default
14403static asdl_seq *
14404_loop1_81_rule(Parser *p)
14405{
14406 if (p->error_indicator) {
14407 return NULL;
14408 }
14409 void *res = NULL;
14410 int mark = p->mark;
14411 int start_mark = p->mark;
14412 void **children = PyMem_Malloc(sizeof(void *));
14413 if (!children) {
14414 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14415 return NULL;
14416 }
14417 ssize_t children_capacity = 1;
14418 ssize_t n = 0;
14419 { // lambda_param_no_default
14420 arg_ty lambda_param_no_default_var;
14421 while (
14422 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
14423 )
14424 {
14425 res = lambda_param_no_default_var;
14426 if (n == children_capacity) {
14427 children_capacity *= 2;
14428 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14429 if (!children) {
14430 PyErr_Format(PyExc_MemoryError, "realloc None");
14431 return NULL;
14432 }
14433 }
14434 children[n++] = res;
14435 mark = p->mark;
14436 }
14437 p->mark = mark;
14438 }
14439 if (n == 0) {
14440 PyMem_Free(children);
14441 return NULL;
14442 }
14443 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14444 if (!seq) {
14445 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_81");
14446 PyMem_Free(children);
14447 return NULL;
14448 }
14449 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14450 PyMem_Free(children);
14451 _PyPegen_insert_memo(p, start_mark, _loop1_81_type, seq);
14452 return seq;
14453}
14454
14455// _loop1_82: lambda_param_no_default
14456static asdl_seq *
14457_loop1_82_rule(Parser *p)
14458{
14459 if (p->error_indicator) {
14460 return NULL;
14461 }
14462 void *res = NULL;
14463 int mark = p->mark;
14464 int start_mark = p->mark;
14465 void **children = PyMem_Malloc(sizeof(void *));
14466 if (!children) {
14467 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14468 return NULL;
14469 }
14470 ssize_t children_capacity = 1;
14471 ssize_t n = 0;
14472 { // lambda_param_no_default
14473 arg_ty lambda_param_no_default_var;
14474 while (
14475 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
14476 )
14477 {
14478 res = lambda_param_no_default_var;
14479 if (n == children_capacity) {
14480 children_capacity *= 2;
14481 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14482 if (!children) {
14483 PyErr_Format(PyExc_MemoryError, "realloc None");
14484 return NULL;
14485 }
14486 }
14487 children[n++] = res;
14488 mark = p->mark;
14489 }
14490 p->mark = mark;
14491 }
14492 if (n == 0) {
14493 PyMem_Free(children);
14494 return NULL;
14495 }
14496 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14497 if (!seq) {
14498 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_82");
14499 PyMem_Free(children);
14500 return NULL;
14501 }
14502 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14503 PyMem_Free(children);
14504 _PyPegen_insert_memo(p, start_mark, _loop1_82_type, seq);
14505 return seq;
14506}
14507
14508// _loop0_83: lambda_param_no_default
14509static asdl_seq *
14510_loop0_83_rule(Parser *p)
14511{
14512 if (p->error_indicator) {
14513 return NULL;
14514 }
14515 void *res = NULL;
14516 int mark = p->mark;
14517 int start_mark = p->mark;
14518 void **children = PyMem_Malloc(sizeof(void *));
14519 if (!children) {
14520 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14521 return NULL;
14522 }
14523 ssize_t children_capacity = 1;
14524 ssize_t n = 0;
14525 { // lambda_param_no_default
14526 arg_ty lambda_param_no_default_var;
14527 while (
14528 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
14529 )
14530 {
14531 res = lambda_param_no_default_var;
14532 if (n == children_capacity) {
14533 children_capacity *= 2;
14534 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14535 if (!children) {
14536 PyErr_Format(PyExc_MemoryError, "realloc None");
14537 return NULL;
14538 }
14539 }
14540 children[n++] = res;
14541 mark = p->mark;
14542 }
14543 p->mark = mark;
14544 }
14545 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14546 if (!seq) {
14547 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_83");
14548 PyMem_Free(children);
14549 return NULL;
14550 }
14551 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14552 PyMem_Free(children);
14553 _PyPegen_insert_memo(p, start_mark, _loop0_83_type, seq);
14554 return seq;
14555}
14556
14557// _loop1_84: lambda_param_with_default
14558static asdl_seq *
14559_loop1_84_rule(Parser *p)
14560{
14561 if (p->error_indicator) {
14562 return NULL;
14563 }
14564 void *res = NULL;
14565 int mark = p->mark;
14566 int start_mark = p->mark;
14567 void **children = PyMem_Malloc(sizeof(void *));
14568 if (!children) {
14569 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14570 return NULL;
14571 }
14572 ssize_t children_capacity = 1;
14573 ssize_t n = 0;
14574 { // lambda_param_with_default
14575 NameDefaultPair* lambda_param_with_default_var;
14576 while (
14577 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
14578 )
14579 {
14580 res = lambda_param_with_default_var;
14581 if (n == children_capacity) {
14582 children_capacity *= 2;
14583 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14584 if (!children) {
14585 PyErr_Format(PyExc_MemoryError, "realloc None");
14586 return NULL;
14587 }
14588 }
14589 children[n++] = res;
14590 mark = p->mark;
14591 }
14592 p->mark = mark;
14593 }
14594 if (n == 0) {
14595 PyMem_Free(children);
14596 return NULL;
14597 }
14598 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14599 if (!seq) {
14600 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_84");
14601 PyMem_Free(children);
14602 return NULL;
14603 }
14604 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14605 PyMem_Free(children);
14606 _PyPegen_insert_memo(p, start_mark, _loop1_84_type, seq);
14607 return seq;
14608}
14609
14610// _loop0_85: lambda_param_no_default
14611static asdl_seq *
14612_loop0_85_rule(Parser *p)
14613{
14614 if (p->error_indicator) {
14615 return NULL;
14616 }
14617 void *res = NULL;
14618 int mark = p->mark;
14619 int start_mark = p->mark;
14620 void **children = PyMem_Malloc(sizeof(void *));
14621 if (!children) {
14622 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14623 return NULL;
14624 }
14625 ssize_t children_capacity = 1;
14626 ssize_t n = 0;
14627 { // lambda_param_no_default
14628 arg_ty lambda_param_no_default_var;
14629 while (
14630 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
14631 )
14632 {
14633 res = lambda_param_no_default_var;
14634 if (n == children_capacity) {
14635 children_capacity *= 2;
14636 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14637 if (!children) {
14638 PyErr_Format(PyExc_MemoryError, "realloc None");
14639 return NULL;
14640 }
14641 }
14642 children[n++] = res;
14643 mark = p->mark;
14644 }
14645 p->mark = mark;
14646 }
14647 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14648 if (!seq) {
14649 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_85");
14650 PyMem_Free(children);
14651 return NULL;
14652 }
14653 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14654 PyMem_Free(children);
14655 _PyPegen_insert_memo(p, start_mark, _loop0_85_type, seq);
14656 return seq;
14657}
14658
14659// _loop1_86: lambda_param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014660static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014661_loop1_86_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014662{
14663 if (p->error_indicator) {
14664 return NULL;
14665 }
14666 void *res = NULL;
14667 int mark = p->mark;
14668 int start_mark = p->mark;
14669 void **children = PyMem_Malloc(sizeof(void *));
14670 if (!children) {
14671 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14672 return NULL;
14673 }
14674 ssize_t children_capacity = 1;
14675 ssize_t n = 0;
Guido van Rossum3941d972020-05-01 09:42:03 -070014676 { // lambda_param_with_default
14677 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014678 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070014679 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014680 )
14681 {
Guido van Rossum3941d972020-05-01 09:42:03 -070014682 res = lambda_param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014683 if (n == children_capacity) {
14684 children_capacity *= 2;
14685 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14686 if (!children) {
14687 PyErr_Format(PyExc_MemoryError, "realloc None");
14688 return NULL;
14689 }
14690 }
14691 children[n++] = res;
14692 mark = p->mark;
14693 }
14694 p->mark = mark;
14695 }
14696 if (n == 0) {
14697 PyMem_Free(children);
14698 return NULL;
14699 }
14700 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14701 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014702 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_86");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014703 PyMem_Free(children);
14704 return NULL;
14705 }
14706 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14707 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014708 _PyPegen_insert_memo(p, start_mark, _loop1_86_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014709 return seq;
14710}
14711
Guido van Rossum3941d972020-05-01 09:42:03 -070014712// _loop0_87: lambda_param_maybe_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014713static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014714_loop0_87_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014715{
14716 if (p->error_indicator) {
14717 return NULL;
14718 }
14719 void *res = NULL;
14720 int mark = p->mark;
14721 int start_mark = p->mark;
14722 void **children = PyMem_Malloc(sizeof(void *));
14723 if (!children) {
14724 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14725 return NULL;
14726 }
14727 ssize_t children_capacity = 1;
14728 ssize_t n = 0;
Guido van Rossum3941d972020-05-01 09:42:03 -070014729 { // lambda_param_maybe_default
14730 NameDefaultPair* lambda_param_maybe_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014731 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070014732 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014733 )
14734 {
Guido van Rossum3941d972020-05-01 09:42:03 -070014735 res = lambda_param_maybe_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014736 if (n == children_capacity) {
14737 children_capacity *= 2;
14738 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14739 if (!children) {
14740 PyErr_Format(PyExc_MemoryError, "realloc None");
14741 return NULL;
14742 }
14743 }
14744 children[n++] = res;
14745 mark = p->mark;
14746 }
14747 p->mark = mark;
14748 }
14749 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14750 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014751 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_87");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014752 PyMem_Free(children);
14753 return NULL;
14754 }
14755 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14756 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014757 _PyPegen_insert_memo(p, start_mark, _loop0_87_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014758 return seq;
14759}
14760
Guido van Rossum3941d972020-05-01 09:42:03 -070014761// _loop1_88: lambda_param_maybe_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014762static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014763_loop1_88_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014764{
14765 if (p->error_indicator) {
14766 return NULL;
14767 }
14768 void *res = NULL;
14769 int mark = p->mark;
14770 int start_mark = p->mark;
14771 void **children = PyMem_Malloc(sizeof(void *));
14772 if (!children) {
14773 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14774 return NULL;
14775 }
14776 ssize_t children_capacity = 1;
14777 ssize_t n = 0;
Guido van Rossum3941d972020-05-01 09:42:03 -070014778 { // lambda_param_maybe_default
14779 NameDefaultPair* lambda_param_maybe_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014780 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070014781 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014782 )
14783 {
Guido van Rossum3941d972020-05-01 09:42:03 -070014784 res = lambda_param_maybe_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014785 if (n == children_capacity) {
14786 children_capacity *= 2;
14787 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14788 if (!children) {
14789 PyErr_Format(PyExc_MemoryError, "realloc None");
14790 return NULL;
14791 }
14792 }
14793 children[n++] = res;
14794 mark = p->mark;
14795 }
14796 p->mark = mark;
14797 }
Guido van Rossum3941d972020-05-01 09:42:03 -070014798 if (n == 0) {
14799 PyMem_Free(children);
14800 return NULL;
14801 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014802 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14803 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014804 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_88");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014805 PyMem_Free(children);
14806 return NULL;
14807 }
14808 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14809 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014810 _PyPegen_insert_memo(p, start_mark, _loop1_88_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014811 return seq;
14812}
14813
Guido van Rossum3941d972020-05-01 09:42:03 -070014814// _loop1_89: ('or' conjunction)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014815static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014816_loop1_89_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014817{
14818 if (p->error_indicator) {
14819 return NULL;
14820 }
14821 void *res = NULL;
14822 int mark = p->mark;
14823 int start_mark = p->mark;
14824 void **children = PyMem_Malloc(sizeof(void *));
14825 if (!children) {
14826 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14827 return NULL;
14828 }
14829 ssize_t children_capacity = 1;
14830 ssize_t n = 0;
14831 { // ('or' conjunction)
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030014832 void *_tmp_140_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014833 while (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030014834 (_tmp_140_var = _tmp_140_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014835 )
14836 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030014837 res = _tmp_140_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014838 if (n == children_capacity) {
14839 children_capacity *= 2;
14840 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14841 if (!children) {
14842 PyErr_Format(PyExc_MemoryError, "realloc None");
14843 return NULL;
14844 }
14845 }
14846 children[n++] = res;
14847 mark = p->mark;
14848 }
14849 p->mark = mark;
14850 }
14851 if (n == 0) {
14852 PyMem_Free(children);
14853 return NULL;
14854 }
14855 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14856 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014857 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_89");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014858 PyMem_Free(children);
14859 return NULL;
14860 }
14861 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14862 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014863 _PyPegen_insert_memo(p, start_mark, _loop1_89_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014864 return seq;
14865}
14866
Guido van Rossum3941d972020-05-01 09:42:03 -070014867// _loop1_90: ('and' inversion)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014868static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014869_loop1_90_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014870{
14871 if (p->error_indicator) {
14872 return NULL;
14873 }
14874 void *res = NULL;
14875 int mark = p->mark;
14876 int start_mark = p->mark;
14877 void **children = PyMem_Malloc(sizeof(void *));
14878 if (!children) {
14879 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14880 return NULL;
14881 }
14882 ssize_t children_capacity = 1;
14883 ssize_t n = 0;
14884 { // ('and' inversion)
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030014885 void *_tmp_141_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014886 while (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030014887 (_tmp_141_var = _tmp_141_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014888 )
14889 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030014890 res = _tmp_141_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014891 if (n == children_capacity) {
14892 children_capacity *= 2;
14893 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14894 if (!children) {
14895 PyErr_Format(PyExc_MemoryError, "realloc None");
14896 return NULL;
14897 }
14898 }
14899 children[n++] = res;
14900 mark = p->mark;
14901 }
14902 p->mark = mark;
14903 }
14904 if (n == 0) {
14905 PyMem_Free(children);
14906 return NULL;
14907 }
14908 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14909 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014910 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_90");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014911 PyMem_Free(children);
14912 return NULL;
14913 }
14914 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14915 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014916 _PyPegen_insert_memo(p, start_mark, _loop1_90_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014917 return seq;
14918}
14919
Guido van Rossum3941d972020-05-01 09:42:03 -070014920// _loop1_91: compare_op_bitwise_or_pair
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014921static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014922_loop1_91_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014923{
14924 if (p->error_indicator) {
14925 return NULL;
14926 }
14927 void *res = NULL;
14928 int mark = p->mark;
14929 int start_mark = p->mark;
14930 void **children = PyMem_Malloc(sizeof(void *));
14931 if (!children) {
14932 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14933 return NULL;
14934 }
14935 ssize_t children_capacity = 1;
14936 ssize_t n = 0;
14937 { // compare_op_bitwise_or_pair
14938 CmpopExprPair* compare_op_bitwise_or_pair_var;
14939 while (
14940 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p))
14941 )
14942 {
14943 res = compare_op_bitwise_or_pair_var;
14944 if (n == children_capacity) {
14945 children_capacity *= 2;
14946 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14947 if (!children) {
14948 PyErr_Format(PyExc_MemoryError, "realloc None");
14949 return NULL;
14950 }
14951 }
14952 children[n++] = res;
14953 mark = p->mark;
14954 }
14955 p->mark = mark;
14956 }
14957 if (n == 0) {
14958 PyMem_Free(children);
14959 return NULL;
14960 }
14961 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14962 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014963 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_91");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014964 PyMem_Free(children);
14965 return NULL;
14966 }
14967 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14968 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014969 _PyPegen_insert_memo(p, start_mark, _loop1_91_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014970 return seq;
14971}
14972
Guido van Rossum3941d972020-05-01 09:42:03 -070014973// _tmp_92: '!='
Pablo Galindo2b74c832020-04-27 18:02:07 +010014974static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070014975_tmp_92_rule(Parser *p)
Pablo Galindo2b74c832020-04-27 18:02:07 +010014976{
14977 if (p->error_indicator) {
14978 return NULL;
14979 }
14980 void * res = NULL;
14981 int mark = p->mark;
14982 { // '!='
Pablo Galindob796b3f2020-05-01 12:32:26 +010014983 Token * tok;
Pablo Galindo2b74c832020-04-27 18:02:07 +010014984 if (
14985 (tok = _PyPegen_expect_token(p, 28))
14986 )
14987 {
14988 res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok;
14989 if (res == NULL && PyErr_Occurred()) {
14990 p->error_indicator = 1;
14991 return NULL;
14992 }
14993 goto done;
14994 }
14995 p->mark = mark;
14996 }
14997 res = NULL;
14998 done:
14999 return res;
15000}
15001
Guido van Rossum3941d972020-05-01 09:42:03 -070015002// _loop0_94: ',' slice
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015003static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015004_loop0_94_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015005{
15006 if (p->error_indicator) {
15007 return NULL;
15008 }
15009 void *res = NULL;
15010 int mark = p->mark;
15011 int start_mark = p->mark;
15012 void **children = PyMem_Malloc(sizeof(void *));
15013 if (!children) {
15014 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15015 return NULL;
15016 }
15017 ssize_t children_capacity = 1;
15018 ssize_t n = 0;
15019 { // ',' slice
15020 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015021 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015022 while (
15023 (literal = _PyPegen_expect_token(p, 12))
15024 &&
15025 (elem = slice_rule(p))
15026 )
15027 {
15028 res = elem;
15029 if (res == NULL && PyErr_Occurred()) {
15030 p->error_indicator = 1;
15031 PyMem_Free(children);
15032 return NULL;
15033 }
15034 if (n == children_capacity) {
15035 children_capacity *= 2;
15036 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15037 if (!children) {
15038 PyErr_Format(PyExc_MemoryError, "realloc None");
15039 return NULL;
15040 }
15041 }
15042 children[n++] = res;
15043 mark = p->mark;
15044 }
15045 p->mark = mark;
15046 }
15047 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15048 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015049 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_94");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015050 PyMem_Free(children);
15051 return NULL;
15052 }
15053 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15054 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015055 _PyPegen_insert_memo(p, start_mark, _loop0_94_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015056 return seq;
15057}
15058
Guido van Rossum3941d972020-05-01 09:42:03 -070015059// _gather_93: slice _loop0_94
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015060static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015061_gather_93_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015062{
15063 if (p->error_indicator) {
15064 return NULL;
15065 }
15066 asdl_seq * res = NULL;
15067 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070015068 { // slice _loop0_94
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015069 expr_ty elem;
15070 asdl_seq * seq;
15071 if (
15072 (elem = slice_rule(p))
15073 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070015074 (seq = _loop0_94_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015075 )
15076 {
15077 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15078 goto done;
15079 }
15080 p->mark = mark;
15081 }
15082 res = NULL;
15083 done:
15084 return res;
15085}
15086
Guido van Rossum3941d972020-05-01 09:42:03 -070015087// _tmp_95: ':' expression?
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015088static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015089_tmp_95_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015090{
15091 if (p->error_indicator) {
15092 return NULL;
15093 }
15094 void * res = NULL;
15095 int mark = p->mark;
15096 { // ':' expression?
15097 void *d;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015098 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015099 if (
15100 (literal = _PyPegen_expect_token(p, 11))
15101 &&
15102 (d = expression_rule(p), 1)
15103 )
15104 {
15105 res = d;
15106 if (res == NULL && PyErr_Occurred()) {
15107 p->error_indicator = 1;
15108 return NULL;
15109 }
15110 goto done;
15111 }
15112 p->mark = mark;
15113 }
15114 res = NULL;
15115 done:
15116 return res;
15117}
15118
Guido van Rossum3941d972020-05-01 09:42:03 -070015119// _tmp_96: tuple | group | genexp
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015120static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015121_tmp_96_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015122{
15123 if (p->error_indicator) {
15124 return NULL;
15125 }
15126 void * res = NULL;
15127 int mark = p->mark;
15128 { // tuple
15129 expr_ty tuple_var;
15130 if (
15131 (tuple_var = tuple_rule(p))
15132 )
15133 {
15134 res = tuple_var;
15135 goto done;
15136 }
15137 p->mark = mark;
15138 }
15139 { // group
15140 expr_ty group_var;
15141 if (
15142 (group_var = group_rule(p))
15143 )
15144 {
15145 res = group_var;
15146 goto done;
15147 }
15148 p->mark = mark;
15149 }
15150 { // genexp
15151 expr_ty genexp_var;
15152 if (
15153 (genexp_var = genexp_rule(p))
15154 )
15155 {
15156 res = genexp_var;
15157 goto done;
15158 }
15159 p->mark = mark;
15160 }
15161 res = NULL;
15162 done:
15163 return res;
15164}
15165
Guido van Rossum3941d972020-05-01 09:42:03 -070015166// _tmp_97: list | listcomp
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015167static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015168_tmp_97_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015169{
15170 if (p->error_indicator) {
15171 return NULL;
15172 }
15173 void * res = NULL;
15174 int mark = p->mark;
15175 { // list
15176 expr_ty list_var;
15177 if (
15178 (list_var = list_rule(p))
15179 )
15180 {
15181 res = list_var;
15182 goto done;
15183 }
15184 p->mark = mark;
15185 }
15186 { // listcomp
15187 expr_ty listcomp_var;
15188 if (
15189 (listcomp_var = listcomp_rule(p))
15190 )
15191 {
15192 res = listcomp_var;
15193 goto done;
15194 }
15195 p->mark = mark;
15196 }
15197 res = NULL;
15198 done:
15199 return res;
15200}
15201
Guido van Rossum3941d972020-05-01 09:42:03 -070015202// _tmp_98: dict | set | dictcomp | setcomp
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015203static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015204_tmp_98_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015205{
15206 if (p->error_indicator) {
15207 return NULL;
15208 }
15209 void * res = NULL;
15210 int mark = p->mark;
15211 { // dict
15212 expr_ty dict_var;
15213 if (
15214 (dict_var = dict_rule(p))
15215 )
15216 {
15217 res = dict_var;
15218 goto done;
15219 }
15220 p->mark = mark;
15221 }
15222 { // set
15223 expr_ty set_var;
15224 if (
15225 (set_var = set_rule(p))
15226 )
15227 {
15228 res = set_var;
15229 goto done;
15230 }
15231 p->mark = mark;
15232 }
15233 { // dictcomp
15234 expr_ty dictcomp_var;
15235 if (
15236 (dictcomp_var = dictcomp_rule(p))
15237 )
15238 {
15239 res = dictcomp_var;
15240 goto done;
15241 }
15242 p->mark = mark;
15243 }
15244 { // setcomp
15245 expr_ty setcomp_var;
15246 if (
15247 (setcomp_var = setcomp_rule(p))
15248 )
15249 {
15250 res = setcomp_var;
15251 goto done;
15252 }
15253 p->mark = mark;
15254 }
15255 res = NULL;
15256 done:
15257 return res;
15258}
15259
Guido van Rossum3941d972020-05-01 09:42:03 -070015260// _loop1_99: STRING
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015261static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015262_loop1_99_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015263{
15264 if (p->error_indicator) {
15265 return NULL;
15266 }
15267 void *res = NULL;
15268 int mark = p->mark;
15269 int start_mark = p->mark;
15270 void **children = PyMem_Malloc(sizeof(void *));
15271 if (!children) {
15272 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15273 return NULL;
15274 }
15275 ssize_t children_capacity = 1;
15276 ssize_t n = 0;
15277 { // STRING
15278 expr_ty string_var;
15279 while (
15280 (string_var = _PyPegen_string_token(p))
15281 )
15282 {
15283 res = string_var;
15284 if (n == children_capacity) {
15285 children_capacity *= 2;
15286 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15287 if (!children) {
15288 PyErr_Format(PyExc_MemoryError, "realloc None");
15289 return NULL;
15290 }
15291 }
15292 children[n++] = res;
15293 mark = p->mark;
15294 }
15295 p->mark = mark;
15296 }
15297 if (n == 0) {
15298 PyMem_Free(children);
15299 return NULL;
15300 }
15301 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15302 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015303 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_99");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015304 PyMem_Free(children);
15305 return NULL;
15306 }
15307 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15308 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015309 _PyPegen_insert_memo(p, start_mark, _loop1_99_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015310 return seq;
15311}
15312
Guido van Rossum3941d972020-05-01 09:42:03 -070015313// _tmp_100: star_named_expression ',' star_named_expressions?
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015314static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015315_tmp_100_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015316{
15317 if (p->error_indicator) {
15318 return NULL;
15319 }
15320 void * res = NULL;
15321 int mark = p->mark;
15322 { // star_named_expression ',' star_named_expressions?
Pablo Galindob796b3f2020-05-01 12:32:26 +010015323 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015324 expr_ty y;
15325 void *z;
15326 if (
15327 (y = star_named_expression_rule(p))
15328 &&
15329 (literal = _PyPegen_expect_token(p, 12))
15330 &&
15331 (z = star_named_expressions_rule(p), 1)
15332 )
15333 {
15334 res = _PyPegen_seq_insert_in_front ( p , y , z );
15335 if (res == NULL && PyErr_Occurred()) {
15336 p->error_indicator = 1;
15337 return NULL;
15338 }
15339 goto done;
15340 }
15341 p->mark = mark;
15342 }
15343 res = NULL;
15344 done:
15345 return res;
15346}
15347
Guido van Rossum3941d972020-05-01 09:42:03 -070015348// _tmp_101: yield_expr | named_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015349static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015350_tmp_101_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015351{
15352 if (p->error_indicator) {
15353 return NULL;
15354 }
15355 void * res = NULL;
15356 int mark = p->mark;
15357 { // yield_expr
15358 expr_ty yield_expr_var;
15359 if (
15360 (yield_expr_var = yield_expr_rule(p))
15361 )
15362 {
15363 res = yield_expr_var;
15364 goto done;
15365 }
15366 p->mark = mark;
15367 }
15368 { // named_expression
15369 expr_ty named_expression_var;
15370 if (
15371 (named_expression_var = named_expression_rule(p))
15372 )
15373 {
15374 res = named_expression_var;
15375 goto done;
15376 }
15377 p->mark = mark;
15378 }
15379 res = NULL;
15380 done:
15381 return res;
15382}
15383
Guido van Rossum3941d972020-05-01 09:42:03 -070015384// _loop0_103: ',' kvpair
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015385static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015386_loop0_103_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015387{
15388 if (p->error_indicator) {
15389 return NULL;
15390 }
15391 void *res = NULL;
15392 int mark = p->mark;
15393 int start_mark = p->mark;
15394 void **children = PyMem_Malloc(sizeof(void *));
15395 if (!children) {
15396 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15397 return NULL;
15398 }
15399 ssize_t children_capacity = 1;
15400 ssize_t n = 0;
15401 { // ',' kvpair
15402 KeyValuePair* elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015403 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015404 while (
15405 (literal = _PyPegen_expect_token(p, 12))
15406 &&
15407 (elem = kvpair_rule(p))
15408 )
15409 {
15410 res = elem;
15411 if (res == NULL && PyErr_Occurred()) {
15412 p->error_indicator = 1;
15413 PyMem_Free(children);
15414 return NULL;
15415 }
15416 if (n == children_capacity) {
15417 children_capacity *= 2;
15418 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15419 if (!children) {
15420 PyErr_Format(PyExc_MemoryError, "realloc None");
15421 return NULL;
15422 }
15423 }
15424 children[n++] = res;
15425 mark = p->mark;
15426 }
15427 p->mark = mark;
15428 }
15429 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15430 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015431 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_103");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015432 PyMem_Free(children);
15433 return NULL;
15434 }
15435 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15436 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015437 _PyPegen_insert_memo(p, start_mark, _loop0_103_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015438 return seq;
15439}
15440
Guido van Rossum3941d972020-05-01 09:42:03 -070015441// _gather_102: kvpair _loop0_103
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015442static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015443_gather_102_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015444{
15445 if (p->error_indicator) {
15446 return NULL;
15447 }
15448 asdl_seq * res = NULL;
15449 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070015450 { // kvpair _loop0_103
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015451 KeyValuePair* elem;
15452 asdl_seq * seq;
15453 if (
15454 (elem = kvpair_rule(p))
15455 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070015456 (seq = _loop0_103_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015457 )
15458 {
15459 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15460 goto done;
15461 }
15462 p->mark = mark;
15463 }
15464 res = NULL;
15465 done:
15466 return res;
15467}
15468
Guido van Rossum3941d972020-05-01 09:42:03 -070015469// _loop1_104: for_if_clause
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015470static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015471_loop1_104_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015472{
15473 if (p->error_indicator) {
15474 return NULL;
15475 }
15476 void *res = NULL;
15477 int mark = p->mark;
15478 int start_mark = p->mark;
15479 void **children = PyMem_Malloc(sizeof(void *));
15480 if (!children) {
15481 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15482 return NULL;
15483 }
15484 ssize_t children_capacity = 1;
15485 ssize_t n = 0;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015486 { // for_if_clause
15487 comprehension_ty for_if_clause_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015488 while (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015489 (for_if_clause_var = for_if_clause_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015490 )
15491 {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015492 res = for_if_clause_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015493 if (n == children_capacity) {
15494 children_capacity *= 2;
15495 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15496 if (!children) {
15497 PyErr_Format(PyExc_MemoryError, "realloc None");
15498 return NULL;
15499 }
15500 }
15501 children[n++] = res;
15502 mark = p->mark;
15503 }
15504 p->mark = mark;
15505 }
15506 if (n == 0) {
15507 PyMem_Free(children);
15508 return NULL;
15509 }
15510 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15511 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015512 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_104");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015513 PyMem_Free(children);
15514 return NULL;
15515 }
15516 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15517 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015518 _PyPegen_insert_memo(p, start_mark, _loop1_104_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015519 return seq;
15520}
15521
Guido van Rossum3941d972020-05-01 09:42:03 -070015522// _loop0_105: ('if' disjunction)
Pablo Galindo2b74c832020-04-27 18:02:07 +010015523static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015524_loop0_105_rule(Parser *p)
Pablo Galindo2b74c832020-04-27 18:02:07 +010015525{
15526 if (p->error_indicator) {
15527 return NULL;
15528 }
15529 void *res = NULL;
15530 int mark = p->mark;
15531 int start_mark = p->mark;
15532 void **children = PyMem_Malloc(sizeof(void *));
15533 if (!children) {
15534 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15535 return NULL;
15536 }
15537 ssize_t children_capacity = 1;
15538 ssize_t n = 0;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015539 { // ('if' disjunction)
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030015540 void *_tmp_142_var;
Pablo Galindo2b74c832020-04-27 18:02:07 +010015541 while (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030015542 (_tmp_142_var = _tmp_142_rule(p))
Pablo Galindo2b74c832020-04-27 18:02:07 +010015543 )
15544 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030015545 res = _tmp_142_var;
Pablo Galindo2b74c832020-04-27 18:02:07 +010015546 if (n == children_capacity) {
15547 children_capacity *= 2;
15548 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15549 if (!children) {
15550 PyErr_Format(PyExc_MemoryError, "realloc None");
15551 return NULL;
15552 }
15553 }
15554 children[n++] = res;
15555 mark = p->mark;
15556 }
15557 p->mark = mark;
15558 }
15559 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15560 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015561 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_105");
Pablo Galindo2b74c832020-04-27 18:02:07 +010015562 PyMem_Free(children);
15563 return NULL;
15564 }
15565 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15566 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015567 _PyPegen_insert_memo(p, start_mark, _loop0_105_type, seq);
Pablo Galindo2b74c832020-04-27 18:02:07 +010015568 return seq;
15569}
15570
Guido van Rossum3941d972020-05-01 09:42:03 -070015571// _loop0_106: ('if' disjunction)
Guido van Rossumc001c092020-04-30 12:12:19 -070015572static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015573_loop0_106_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070015574{
15575 if (p->error_indicator) {
15576 return NULL;
15577 }
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015578 void *res = NULL;
Guido van Rossumc001c092020-04-30 12:12:19 -070015579 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015580 int start_mark = p->mark;
15581 void **children = PyMem_Malloc(sizeof(void *));
15582 if (!children) {
15583 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15584 return NULL;
15585 }
15586 ssize_t children_capacity = 1;
15587 ssize_t n = 0;
15588 { // ('if' disjunction)
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030015589 void *_tmp_143_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015590 while (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030015591 (_tmp_143_var = _tmp_143_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070015592 )
15593 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030015594 res = _tmp_143_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015595 if (n == children_capacity) {
15596 children_capacity *= 2;
15597 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15598 if (!children) {
15599 PyErr_Format(PyExc_MemoryError, "realloc None");
15600 return NULL;
15601 }
15602 }
15603 children[n++] = res;
15604 mark = p->mark;
15605 }
15606 p->mark = mark;
15607 }
15608 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15609 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015610 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_106");
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015611 PyMem_Free(children);
15612 return NULL;
15613 }
15614 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15615 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015616 _PyPegen_insert_memo(p, start_mark, _loop0_106_type, seq);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015617 return seq;
15618}
15619
Guido van Rossum3941d972020-05-01 09:42:03 -070015620// _tmp_107: ',' args
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015621static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015622_tmp_107_rule(Parser *p)
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015623{
15624 if (p->error_indicator) {
15625 return NULL;
15626 }
15627 void * res = NULL;
15628 int mark = p->mark;
15629 { // ',' args
15630 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015631 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015632 if (
15633 (literal = _PyPegen_expect_token(p, 12))
15634 &&
15635 (c = args_rule(p))
15636 )
15637 {
15638 res = c;
15639 if (res == NULL && PyErr_Occurred()) {
15640 p->error_indicator = 1;
15641 return NULL;
15642 }
Guido van Rossumc001c092020-04-30 12:12:19 -070015643 goto done;
15644 }
15645 p->mark = mark;
15646 }
15647 res = NULL;
15648 done:
15649 return res;
15650}
15651
Guido van Rossum3941d972020-05-01 09:42:03 -070015652// _tmp_108: ',' args
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015653static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015654_tmp_108_rule(Parser *p)
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015655{
15656 if (p->error_indicator) {
15657 return NULL;
15658 }
15659 void * res = NULL;
15660 int mark = p->mark;
15661 { // ',' args
15662 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015663 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015664 if (
15665 (literal = _PyPegen_expect_token(p, 12))
15666 &&
15667 (c = args_rule(p))
15668 )
15669 {
15670 res = c;
15671 if (res == NULL && PyErr_Occurred()) {
15672 p->error_indicator = 1;
15673 return NULL;
15674 }
15675 goto done;
15676 }
15677 p->mark = mark;
15678 }
15679 res = NULL;
15680 done:
15681 return res;
15682}
15683
Guido van Rossum3941d972020-05-01 09:42:03 -070015684// _loop0_110: ',' kwarg_or_starred
15685static asdl_seq *
15686_loop0_110_rule(Parser *p)
15687{
15688 if (p->error_indicator) {
15689 return NULL;
15690 }
15691 void *res = NULL;
15692 int mark = p->mark;
15693 int start_mark = p->mark;
15694 void **children = PyMem_Malloc(sizeof(void *));
15695 if (!children) {
15696 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15697 return NULL;
15698 }
15699 ssize_t children_capacity = 1;
15700 ssize_t n = 0;
15701 { // ',' kwarg_or_starred
15702 KeywordOrStarred* elem;
15703 Token * literal;
15704 while (
15705 (literal = _PyPegen_expect_token(p, 12))
15706 &&
15707 (elem = kwarg_or_starred_rule(p))
15708 )
15709 {
15710 res = elem;
15711 if (res == NULL && PyErr_Occurred()) {
15712 p->error_indicator = 1;
15713 PyMem_Free(children);
15714 return NULL;
15715 }
15716 if (n == children_capacity) {
15717 children_capacity *= 2;
15718 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15719 if (!children) {
15720 PyErr_Format(PyExc_MemoryError, "realloc None");
15721 return NULL;
15722 }
15723 }
15724 children[n++] = res;
15725 mark = p->mark;
15726 }
15727 p->mark = mark;
15728 }
15729 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15730 if (!seq) {
15731 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_110");
15732 PyMem_Free(children);
15733 return NULL;
15734 }
15735 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15736 PyMem_Free(children);
15737 _PyPegen_insert_memo(p, start_mark, _loop0_110_type, seq);
15738 return seq;
15739}
15740
15741// _gather_109: kwarg_or_starred _loop0_110
15742static asdl_seq *
15743_gather_109_rule(Parser *p)
15744{
15745 if (p->error_indicator) {
15746 return NULL;
15747 }
15748 asdl_seq * res = NULL;
15749 int mark = p->mark;
15750 { // kwarg_or_starred _loop0_110
15751 KeywordOrStarred* elem;
15752 asdl_seq * seq;
15753 if (
15754 (elem = kwarg_or_starred_rule(p))
15755 &&
15756 (seq = _loop0_110_rule(p))
15757 )
15758 {
15759 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15760 goto done;
15761 }
15762 p->mark = mark;
15763 }
15764 res = NULL;
15765 done:
15766 return res;
15767}
15768
15769// _loop0_112: ',' kwarg_or_double_starred
15770static asdl_seq *
15771_loop0_112_rule(Parser *p)
15772{
15773 if (p->error_indicator) {
15774 return NULL;
15775 }
15776 void *res = NULL;
15777 int mark = p->mark;
15778 int start_mark = p->mark;
15779 void **children = PyMem_Malloc(sizeof(void *));
15780 if (!children) {
15781 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15782 return NULL;
15783 }
15784 ssize_t children_capacity = 1;
15785 ssize_t n = 0;
15786 { // ',' kwarg_or_double_starred
15787 KeywordOrStarred* elem;
15788 Token * literal;
15789 while (
15790 (literal = _PyPegen_expect_token(p, 12))
15791 &&
15792 (elem = kwarg_or_double_starred_rule(p))
15793 )
15794 {
15795 res = elem;
15796 if (res == NULL && PyErr_Occurred()) {
15797 p->error_indicator = 1;
15798 PyMem_Free(children);
15799 return NULL;
15800 }
15801 if (n == children_capacity) {
15802 children_capacity *= 2;
15803 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15804 if (!children) {
15805 PyErr_Format(PyExc_MemoryError, "realloc None");
15806 return NULL;
15807 }
15808 }
15809 children[n++] = res;
15810 mark = p->mark;
15811 }
15812 p->mark = mark;
15813 }
15814 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15815 if (!seq) {
15816 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_112");
15817 PyMem_Free(children);
15818 return NULL;
15819 }
15820 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15821 PyMem_Free(children);
15822 _PyPegen_insert_memo(p, start_mark, _loop0_112_type, seq);
15823 return seq;
15824}
15825
15826// _gather_111: kwarg_or_double_starred _loop0_112
15827static asdl_seq *
15828_gather_111_rule(Parser *p)
15829{
15830 if (p->error_indicator) {
15831 return NULL;
15832 }
15833 asdl_seq * res = NULL;
15834 int mark = p->mark;
15835 { // kwarg_or_double_starred _loop0_112
15836 KeywordOrStarred* elem;
15837 asdl_seq * seq;
15838 if (
15839 (elem = kwarg_or_double_starred_rule(p))
15840 &&
15841 (seq = _loop0_112_rule(p))
15842 )
15843 {
15844 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15845 goto done;
15846 }
15847 p->mark = mark;
15848 }
15849 res = NULL;
15850 done:
15851 return res;
15852}
15853
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015854// _loop0_114: ',' kwarg_or_starred
Pablo Galindo2b74c832020-04-27 18:02:07 +010015855static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015856_loop0_114_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015857{
15858 if (p->error_indicator) {
15859 return NULL;
15860 }
15861 void *res = NULL;
15862 int mark = p->mark;
15863 int start_mark = p->mark;
15864 void **children = PyMem_Malloc(sizeof(void *));
15865 if (!children) {
15866 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15867 return NULL;
15868 }
15869 ssize_t children_capacity = 1;
15870 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070015871 { // ',' kwarg_or_starred
15872 KeywordOrStarred* elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015873 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070015874 while (
15875 (literal = _PyPegen_expect_token(p, 12))
15876 &&
15877 (elem = kwarg_or_starred_rule(p))
15878 )
15879 {
15880 res = elem;
15881 if (res == NULL && PyErr_Occurred()) {
15882 p->error_indicator = 1;
15883 PyMem_Free(children);
15884 return NULL;
15885 }
15886 if (n == children_capacity) {
15887 children_capacity *= 2;
15888 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15889 if (!children) {
15890 PyErr_Format(PyExc_MemoryError, "realloc None");
15891 return NULL;
15892 }
15893 }
15894 children[n++] = res;
15895 mark = p->mark;
15896 }
15897 p->mark = mark;
15898 }
15899 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15900 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015901 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_114");
Guido van Rossumc001c092020-04-30 12:12:19 -070015902 PyMem_Free(children);
15903 return NULL;
15904 }
15905 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15906 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015907 _PyPegen_insert_memo(p, start_mark, _loop0_114_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070015908 return seq;
15909}
15910
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015911// _gather_113: kwarg_or_starred _loop0_114
Guido van Rossumc001c092020-04-30 12:12:19 -070015912static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015913_gather_113_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070015914{
15915 if (p->error_indicator) {
15916 return NULL;
15917 }
15918 asdl_seq * res = NULL;
15919 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015920 { // kwarg_or_starred _loop0_114
Guido van Rossumc001c092020-04-30 12:12:19 -070015921 KeywordOrStarred* elem;
15922 asdl_seq * seq;
15923 if (
15924 (elem = kwarg_or_starred_rule(p))
15925 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015926 (seq = _loop0_114_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070015927 )
15928 {
15929 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15930 goto done;
15931 }
15932 p->mark = mark;
15933 }
15934 res = NULL;
15935 done:
15936 return res;
15937}
15938
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015939// _loop0_116: ',' kwarg_or_double_starred
Guido van Rossumc001c092020-04-30 12:12:19 -070015940static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015941_loop0_116_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070015942{
15943 if (p->error_indicator) {
15944 return NULL;
15945 }
15946 void *res = NULL;
15947 int mark = p->mark;
15948 int start_mark = p->mark;
15949 void **children = PyMem_Malloc(sizeof(void *));
15950 if (!children) {
15951 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15952 return NULL;
15953 }
15954 ssize_t children_capacity = 1;
15955 ssize_t n = 0;
15956 { // ',' kwarg_or_double_starred
15957 KeywordOrStarred* elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015958 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070015959 while (
15960 (literal = _PyPegen_expect_token(p, 12))
15961 &&
15962 (elem = kwarg_or_double_starred_rule(p))
15963 )
15964 {
15965 res = elem;
15966 if (res == NULL && PyErr_Occurred()) {
15967 p->error_indicator = 1;
15968 PyMem_Free(children);
15969 return NULL;
15970 }
15971 if (n == children_capacity) {
15972 children_capacity *= 2;
15973 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15974 if (!children) {
15975 PyErr_Format(PyExc_MemoryError, "realloc None");
15976 return NULL;
15977 }
15978 }
15979 children[n++] = res;
15980 mark = p->mark;
15981 }
15982 p->mark = mark;
15983 }
15984 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15985 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015986 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_116");
Guido van Rossumc001c092020-04-30 12:12:19 -070015987 PyMem_Free(children);
15988 return NULL;
15989 }
15990 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15991 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015992 _PyPegen_insert_memo(p, start_mark, _loop0_116_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070015993 return seq;
15994}
15995
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015996// _gather_115: kwarg_or_double_starred _loop0_116
Guido van Rossumc001c092020-04-30 12:12:19 -070015997static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015998_gather_115_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070015999{
16000 if (p->error_indicator) {
16001 return NULL;
16002 }
16003 asdl_seq * res = NULL;
16004 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016005 { // kwarg_or_double_starred _loop0_116
Guido van Rossumc001c092020-04-30 12:12:19 -070016006 KeywordOrStarred* elem;
16007 asdl_seq * seq;
16008 if (
16009 (elem = kwarg_or_double_starred_rule(p))
16010 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016011 (seq = _loop0_116_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070016012 )
16013 {
16014 res = _PyPegen_seq_insert_in_front(p, elem, seq);
16015 goto done;
16016 }
16017 p->mark = mark;
16018 }
16019 res = NULL;
16020 done:
16021 return res;
16022}
16023
Guido van Rossum3941d972020-05-01 09:42:03 -070016024// _loop0_117: (',' star_target)
Guido van Rossumc001c092020-04-30 12:12:19 -070016025static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016026_loop0_117_rule(Parser *p)
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016027{
16028 if (p->error_indicator) {
16029 return NULL;
16030 }
16031 void *res = NULL;
16032 int mark = p->mark;
16033 int start_mark = p->mark;
16034 void **children = PyMem_Malloc(sizeof(void *));
16035 if (!children) {
16036 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
16037 return NULL;
16038 }
16039 ssize_t children_capacity = 1;
16040 ssize_t n = 0;
16041 { // (',' star_target)
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016042 void *_tmp_144_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016043 while (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016044 (_tmp_144_var = _tmp_144_rule(p))
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016045 )
16046 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016047 res = _tmp_144_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016048 if (n == children_capacity) {
16049 children_capacity *= 2;
16050 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
16051 if (!children) {
16052 PyErr_Format(PyExc_MemoryError, "realloc None");
16053 return NULL;
16054 }
16055 }
16056 children[n++] = res;
16057 mark = p->mark;
16058 }
16059 p->mark = mark;
16060 }
16061 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
16062 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070016063 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_117");
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016064 PyMem_Free(children);
16065 return NULL;
16066 }
16067 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
16068 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070016069 _PyPegen_insert_memo(p, start_mark, _loop0_117_type, seq);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016070 return seq;
16071}
16072
Guido van Rossum3941d972020-05-01 09:42:03 -070016073// _loop0_119: ',' star_target
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016074static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016075_loop0_119_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070016076{
16077 if (p->error_indicator) {
16078 return NULL;
16079 }
16080 void *res = NULL;
16081 int mark = p->mark;
16082 int start_mark = p->mark;
16083 void **children = PyMem_Malloc(sizeof(void *));
16084 if (!children) {
16085 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
16086 return NULL;
16087 }
16088 ssize_t children_capacity = 1;
16089 ssize_t n = 0;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016090 { // ',' star_target
16091 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016092 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016093 while (
16094 (literal = _PyPegen_expect_token(p, 12))
16095 &&
16096 (elem = star_target_rule(p))
16097 )
16098 {
16099 res = elem;
16100 if (res == NULL && PyErr_Occurred()) {
16101 p->error_indicator = 1;
16102 PyMem_Free(children);
16103 return NULL;
16104 }
16105 if (n == children_capacity) {
16106 children_capacity *= 2;
16107 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
16108 if (!children) {
16109 PyErr_Format(PyExc_MemoryError, "realloc None");
16110 return NULL;
16111 }
16112 }
16113 children[n++] = res;
16114 mark = p->mark;
16115 }
16116 p->mark = mark;
16117 }
16118 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
16119 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070016120 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_119");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016121 PyMem_Free(children);
16122 return NULL;
16123 }
16124 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
16125 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070016126 _PyPegen_insert_memo(p, start_mark, _loop0_119_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016127 return seq;
16128}
16129
Guido van Rossum3941d972020-05-01 09:42:03 -070016130// _gather_118: star_target _loop0_119
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016131static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016132_gather_118_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016133{
16134 if (p->error_indicator) {
16135 return NULL;
16136 }
16137 asdl_seq * res = NULL;
16138 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070016139 { // star_target _loop0_119
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016140 expr_ty elem;
16141 asdl_seq * seq;
16142 if (
16143 (elem = star_target_rule(p))
16144 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070016145 (seq = _loop0_119_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016146 )
16147 {
16148 res = _PyPegen_seq_insert_in_front(p, elem, seq);
16149 goto done;
16150 }
16151 p->mark = mark;
16152 }
16153 res = NULL;
16154 done:
16155 return res;
16156}
16157
Guido van Rossum3941d972020-05-01 09:42:03 -070016158// _tmp_120: !'*' star_target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016159static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016160_tmp_120_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016161{
16162 if (p->error_indicator) {
16163 return NULL;
16164 }
16165 void * res = NULL;
16166 int mark = p->mark;
16167 { // !'*' star_target
16168 expr_ty star_target_var;
16169 if (
16170 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16)
16171 &&
16172 (star_target_var = star_target_rule(p))
16173 )
16174 {
16175 res = star_target_var;
16176 goto done;
16177 }
16178 p->mark = mark;
16179 }
16180 res = NULL;
16181 done:
16182 return res;
16183}
16184
Guido van Rossum3941d972020-05-01 09:42:03 -070016185// _loop0_122: ',' del_target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016186static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016187_loop0_122_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016188{
16189 if (p->error_indicator) {
16190 return NULL;
16191 }
16192 void *res = NULL;
16193 int mark = p->mark;
16194 int start_mark = p->mark;
16195 void **children = PyMem_Malloc(sizeof(void *));
16196 if (!children) {
16197 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
16198 return NULL;
16199 }
16200 ssize_t children_capacity = 1;
16201 ssize_t n = 0;
16202 { // ',' del_target
16203 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016204 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016205 while (
16206 (literal = _PyPegen_expect_token(p, 12))
16207 &&
16208 (elem = del_target_rule(p))
16209 )
16210 {
16211 res = elem;
16212 if (res == NULL && PyErr_Occurred()) {
16213 p->error_indicator = 1;
16214 PyMem_Free(children);
16215 return NULL;
16216 }
16217 if (n == children_capacity) {
16218 children_capacity *= 2;
16219 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
16220 if (!children) {
16221 PyErr_Format(PyExc_MemoryError, "realloc None");
16222 return NULL;
16223 }
16224 }
16225 children[n++] = res;
16226 mark = p->mark;
16227 }
16228 p->mark = mark;
16229 }
16230 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
16231 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070016232 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_122");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016233 PyMem_Free(children);
16234 return NULL;
16235 }
16236 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
16237 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070016238 _PyPegen_insert_memo(p, start_mark, _loop0_122_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016239 return seq;
16240}
16241
Guido van Rossum3941d972020-05-01 09:42:03 -070016242// _gather_121: del_target _loop0_122
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016243static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016244_gather_121_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016245{
16246 if (p->error_indicator) {
16247 return NULL;
16248 }
16249 asdl_seq * res = NULL;
16250 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070016251 { // del_target _loop0_122
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016252 expr_ty elem;
16253 asdl_seq * seq;
16254 if (
16255 (elem = del_target_rule(p))
16256 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070016257 (seq = _loop0_122_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016258 )
16259 {
16260 res = _PyPegen_seq_insert_in_front(p, elem, seq);
16261 goto done;
16262 }
16263 p->mark = mark;
16264 }
16265 res = NULL;
16266 done:
16267 return res;
16268}
16269
Guido van Rossum3941d972020-05-01 09:42:03 -070016270// _loop0_124: ',' target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016271static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016272_loop0_124_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016273{
16274 if (p->error_indicator) {
16275 return NULL;
16276 }
16277 void *res = NULL;
16278 int mark = p->mark;
16279 int start_mark = p->mark;
16280 void **children = PyMem_Malloc(sizeof(void *));
16281 if (!children) {
16282 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
16283 return NULL;
16284 }
16285 ssize_t children_capacity = 1;
16286 ssize_t n = 0;
16287 { // ',' target
16288 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016289 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016290 while (
16291 (literal = _PyPegen_expect_token(p, 12))
16292 &&
16293 (elem = target_rule(p))
16294 )
16295 {
16296 res = elem;
16297 if (res == NULL && PyErr_Occurred()) {
16298 p->error_indicator = 1;
16299 PyMem_Free(children);
16300 return NULL;
16301 }
16302 if (n == children_capacity) {
16303 children_capacity *= 2;
16304 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
16305 if (!children) {
16306 PyErr_Format(PyExc_MemoryError, "realloc None");
16307 return NULL;
16308 }
16309 }
16310 children[n++] = res;
16311 mark = p->mark;
16312 }
16313 p->mark = mark;
16314 }
16315 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
16316 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070016317 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_124");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016318 PyMem_Free(children);
16319 return NULL;
16320 }
16321 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
16322 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070016323 _PyPegen_insert_memo(p, start_mark, _loop0_124_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016324 return seq;
16325}
16326
Guido van Rossum3941d972020-05-01 09:42:03 -070016327// _gather_123: target _loop0_124
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016328static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016329_gather_123_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016330{
16331 if (p->error_indicator) {
16332 return NULL;
16333 }
16334 asdl_seq * res = NULL;
16335 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070016336 { // target _loop0_124
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016337 expr_ty elem;
16338 asdl_seq * seq;
16339 if (
16340 (elem = target_rule(p))
16341 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070016342 (seq = _loop0_124_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016343 )
16344 {
16345 res = _PyPegen_seq_insert_in_front(p, elem, seq);
16346 goto done;
16347 }
16348 p->mark = mark;
16349 }
16350 res = NULL;
16351 done:
16352 return res;
16353}
16354
Guido van Rossum3941d972020-05-01 09:42:03 -070016355// _tmp_125: args | expression for_if_clauses
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016356static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016357_tmp_125_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016358{
16359 if (p->error_indicator) {
16360 return NULL;
16361 }
16362 void * res = NULL;
16363 int mark = p->mark;
16364 { // args
16365 expr_ty args_var;
16366 if (
16367 (args_var = args_rule(p))
16368 )
16369 {
16370 res = args_var;
16371 goto done;
16372 }
16373 p->mark = mark;
16374 }
16375 { // expression for_if_clauses
16376 expr_ty expression_var;
16377 asdl_seq* for_if_clauses_var;
16378 if (
16379 (expression_var = expression_rule(p))
16380 &&
16381 (for_if_clauses_var = for_if_clauses_rule(p))
16382 )
16383 {
16384 res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
16385 goto done;
16386 }
16387 p->mark = mark;
16388 }
16389 res = NULL;
16390 done:
16391 return res;
16392}
16393
Guido van Rossum3941d972020-05-01 09:42:03 -070016394// _tmp_126: '=' annotated_rhs
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016395static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016396_tmp_126_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016397{
16398 if (p->error_indicator) {
16399 return NULL;
16400 }
16401 void * res = NULL;
16402 int mark = p->mark;
16403 { // '=' annotated_rhs
16404 expr_ty annotated_rhs_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016405 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016406 if (
16407 (literal = _PyPegen_expect_token(p, 22))
16408 &&
16409 (annotated_rhs_var = annotated_rhs_rule(p))
16410 )
16411 {
16412 res = _PyPegen_dummy_name(p, literal, annotated_rhs_var);
16413 goto done;
16414 }
16415 p->mark = mark;
16416 }
16417 res = NULL;
16418 done:
16419 return res;
16420}
16421
Guido van Rossum3941d972020-05-01 09:42:03 -070016422// _tmp_127: '=' | augassign
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016423static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016424_tmp_127_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016425{
16426 if (p->error_indicator) {
16427 return NULL;
16428 }
16429 void * res = NULL;
16430 int mark = p->mark;
16431 { // '='
Pablo Galindob796b3f2020-05-01 12:32:26 +010016432 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016433 if (
16434 (literal = _PyPegen_expect_token(p, 22))
16435 )
16436 {
16437 res = literal;
16438 goto done;
16439 }
16440 p->mark = mark;
16441 }
16442 { // augassign
16443 AugOperator* augassign_var;
16444 if (
16445 (augassign_var = augassign_rule(p))
16446 )
16447 {
16448 res = augassign_var;
16449 goto done;
16450 }
16451 p->mark = mark;
16452 }
16453 res = NULL;
16454 done:
16455 return res;
16456}
16457
Guido van Rossum3941d972020-05-01 09:42:03 -070016458// _tmp_128: yield_expr | star_expressions
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016459static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016460_tmp_128_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016461{
16462 if (p->error_indicator) {
16463 return NULL;
16464 }
16465 void * res = NULL;
16466 int mark = p->mark;
16467 { // yield_expr
16468 expr_ty yield_expr_var;
16469 if (
16470 (yield_expr_var = yield_expr_rule(p))
16471 )
16472 {
16473 res = yield_expr_var;
16474 goto done;
16475 }
16476 p->mark = mark;
16477 }
16478 { // star_expressions
16479 expr_ty star_expressions_var;
16480 if (
16481 (star_expressions_var = star_expressions_rule(p))
16482 )
16483 {
16484 res = star_expressions_var;
16485 goto done;
16486 }
16487 p->mark = mark;
16488 }
16489 res = NULL;
16490 done:
16491 return res;
16492}
16493
Guido van Rossum3941d972020-05-01 09:42:03 -070016494// _tmp_129: '[' | '(' | '{'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016495static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016496_tmp_129_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016497{
16498 if (p->error_indicator) {
16499 return NULL;
16500 }
16501 void * res = NULL;
16502 int mark = p->mark;
16503 { // '['
Pablo Galindob796b3f2020-05-01 12:32:26 +010016504 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016505 if (
16506 (literal = _PyPegen_expect_token(p, 9))
16507 )
16508 {
16509 res = literal;
16510 goto done;
16511 }
16512 p->mark = mark;
16513 }
16514 { // '('
Pablo Galindob796b3f2020-05-01 12:32:26 +010016515 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016516 if (
16517 (literal = _PyPegen_expect_token(p, 7))
16518 )
16519 {
16520 res = literal;
16521 goto done;
16522 }
16523 p->mark = mark;
16524 }
16525 { // '{'
Pablo Galindob796b3f2020-05-01 12:32:26 +010016526 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016527 if (
16528 (literal = _PyPegen_expect_token(p, 25))
16529 )
16530 {
16531 res = literal;
16532 goto done;
16533 }
16534 p->mark = mark;
16535 }
16536 res = NULL;
16537 done:
16538 return res;
16539}
16540
Guido van Rossum3941d972020-05-01 09:42:03 -070016541// _loop0_130: param_no_default
Guido van Rossumc001c092020-04-30 12:12:19 -070016542static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016543_loop0_130_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016544{
16545 if (p->error_indicator) {
16546 return NULL;
16547 }
Guido van Rossumc001c092020-04-30 12:12:19 -070016548 void *res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016549 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070016550 int start_mark = p->mark;
16551 void **children = PyMem_Malloc(sizeof(void *));
16552 if (!children) {
16553 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
16554 return NULL;
16555 }
16556 ssize_t children_capacity = 1;
16557 ssize_t n = 0;
16558 { // param_no_default
16559 arg_ty param_no_default_var;
16560 while (
16561 (param_no_default_var = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016562 )
16563 {
Guido van Rossumc001c092020-04-30 12:12:19 -070016564 res = param_no_default_var;
16565 if (n == children_capacity) {
16566 children_capacity *= 2;
16567 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
16568 if (!children) {
16569 PyErr_Format(PyExc_MemoryError, "realloc None");
16570 return NULL;
16571 }
16572 }
16573 children[n++] = res;
16574 mark = p->mark;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016575 }
16576 p->mark = mark;
16577 }
Guido van Rossumc001c092020-04-30 12:12:19 -070016578 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
16579 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070016580 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_130");
Guido van Rossumc001c092020-04-30 12:12:19 -070016581 PyMem_Free(children);
16582 return NULL;
16583 }
16584 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
16585 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070016586 _PyPegen_insert_memo(p, start_mark, _loop0_130_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070016587 return seq;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016588}
16589
Guido van Rossum3941d972020-05-01 09:42:03 -070016590// _tmp_131: slash_with_default | param_with_default+
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016591static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016592_tmp_131_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016593{
16594 if (p->error_indicator) {
16595 return NULL;
16596 }
16597 void * res = NULL;
16598 int mark = p->mark;
16599 { // slash_with_default
16600 SlashWithDefault* slash_with_default_var;
16601 if (
16602 (slash_with_default_var = slash_with_default_rule(p))
16603 )
16604 {
16605 res = slash_with_default_var;
16606 goto done;
16607 }
16608 p->mark = mark;
16609 }
Guido van Rossumc001c092020-04-30 12:12:19 -070016610 { // param_with_default+
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016611 asdl_seq * _loop1_145_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016612 if (
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016613 (_loop1_145_var = _loop1_145_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016614 )
16615 {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016616 res = _loop1_145_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016617 goto done;
16618 }
16619 p->mark = mark;
16620 }
16621 res = NULL;
16622 done:
16623 return res;
16624}
16625
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016626// _tmp_132: ')' | ',' (')' | '**')
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016627static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016628_tmp_132_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016629{
16630 if (p->error_indicator) {
16631 return NULL;
16632 }
16633 void * res = NULL;
16634 int mark = p->mark;
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016635 { // ')'
16636 Token * literal;
16637 if (
16638 (literal = _PyPegen_expect_token(p, 8))
16639 )
16640 {
16641 res = literal;
16642 goto done;
16643 }
16644 p->mark = mark;
16645 }
16646 { // ',' (')' | '**')
16647 void *_tmp_146_var;
16648 Token * literal;
16649 if (
16650 (literal = _PyPegen_expect_token(p, 12))
16651 &&
16652 (_tmp_146_var = _tmp_146_rule(p))
16653 )
16654 {
16655 res = _PyPegen_dummy_name(p, literal, _tmp_146_var);
16656 goto done;
16657 }
16658 p->mark = mark;
16659 }
16660 res = NULL;
16661 done:
16662 return res;
16663}
16664
16665// _tmp_133: ':' | ',' (':' | '**')
16666static void *
16667_tmp_133_rule(Parser *p)
16668{
16669 if (p->error_indicator) {
16670 return NULL;
16671 }
16672 void * res = NULL;
16673 int mark = p->mark;
16674 { // ':'
16675 Token * literal;
16676 if (
16677 (literal = _PyPegen_expect_token(p, 11))
16678 )
16679 {
16680 res = literal;
16681 goto done;
16682 }
16683 p->mark = mark;
16684 }
16685 { // ',' (':' | '**')
16686 void *_tmp_147_var;
16687 Token * literal;
16688 if (
16689 (literal = _PyPegen_expect_token(p, 12))
16690 &&
16691 (_tmp_147_var = _tmp_147_rule(p))
16692 )
16693 {
16694 res = _PyPegen_dummy_name(p, literal, _tmp_147_var);
16695 goto done;
16696 }
16697 p->mark = mark;
16698 }
16699 res = NULL;
16700 done:
16701 return res;
16702}
16703
16704// _tmp_134: star_targets '='
16705static void *
16706_tmp_134_rule(Parser *p)
16707{
16708 if (p->error_indicator) {
16709 return NULL;
16710 }
16711 void * res = NULL;
16712 int mark = p->mark;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016713 { // star_targets '='
Pablo Galindob796b3f2020-05-01 12:32:26 +010016714 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016715 expr_ty z;
16716 if (
16717 (z = star_targets_rule(p))
16718 &&
16719 (literal = _PyPegen_expect_token(p, 22))
16720 )
16721 {
16722 res = z;
16723 if (res == NULL && PyErr_Occurred()) {
16724 p->error_indicator = 1;
16725 return NULL;
16726 }
16727 goto done;
16728 }
16729 p->mark = mark;
16730 }
16731 res = NULL;
16732 done:
16733 return res;
16734}
16735
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016736// _tmp_135: '.' | '...'
Pablo Galindo2b74c832020-04-27 18:02:07 +010016737static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016738_tmp_135_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016739{
16740 if (p->error_indicator) {
16741 return NULL;
16742 }
16743 void * res = NULL;
16744 int mark = p->mark;
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016745 { // '.'
16746 Token * literal;
16747 if (
16748 (literal = _PyPegen_expect_token(p, 23))
16749 )
16750 {
16751 res = literal;
16752 goto done;
16753 }
16754 p->mark = mark;
16755 }
16756 { // '...'
16757 Token * literal;
16758 if (
16759 (literal = _PyPegen_expect_token(p, 52))
16760 )
16761 {
16762 res = literal;
16763 goto done;
16764 }
16765 p->mark = mark;
16766 }
16767 res = NULL;
16768 done:
16769 return res;
16770}
16771
16772// _tmp_136: '.' | '...'
16773static void *
16774_tmp_136_rule(Parser *p)
16775{
16776 if (p->error_indicator) {
16777 return NULL;
16778 }
16779 void * res = NULL;
16780 int mark = p->mark;
16781 { // '.'
16782 Token * literal;
16783 if (
16784 (literal = _PyPegen_expect_token(p, 23))
16785 )
16786 {
16787 res = literal;
16788 goto done;
16789 }
16790 p->mark = mark;
16791 }
16792 { // '...'
16793 Token * literal;
16794 if (
16795 (literal = _PyPegen_expect_token(p, 52))
16796 )
16797 {
16798 res = literal;
16799 goto done;
16800 }
16801 p->mark = mark;
16802 }
16803 res = NULL;
16804 done:
16805 return res;
16806}
16807
16808// _tmp_137: '@' named_expression NEWLINE
16809static void *
16810_tmp_137_rule(Parser *p)
16811{
16812 if (p->error_indicator) {
16813 return NULL;
16814 }
16815 void * res = NULL;
16816 int mark = p->mark;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016817 { // '@' named_expression NEWLINE
16818 expr_ty f;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016819 Token * literal;
16820 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016821 if (
16822 (literal = _PyPegen_expect_token(p, 49))
16823 &&
16824 (f = named_expression_rule(p))
16825 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +010016826 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016827 )
16828 {
16829 res = f;
16830 if (res == NULL && PyErr_Occurred()) {
16831 p->error_indicator = 1;
16832 return NULL;
16833 }
16834 goto done;
16835 }
16836 p->mark = mark;
16837 }
16838 res = NULL;
16839 done:
16840 return res;
16841}
16842
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016843// _tmp_138: ',' star_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016844static void *
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016845_tmp_138_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016846{
16847 if (p->error_indicator) {
16848 return NULL;
16849 }
16850 void * res = NULL;
16851 int mark = p->mark;
16852 { // ',' star_expression
16853 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016854 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016855 if (
16856 (literal = _PyPegen_expect_token(p, 12))
16857 &&
16858 (c = star_expression_rule(p))
16859 )
16860 {
16861 res = c;
16862 if (res == NULL && PyErr_Occurred()) {
16863 p->error_indicator = 1;
16864 return NULL;
16865 }
16866 goto done;
16867 }
16868 p->mark = mark;
16869 }
16870 res = NULL;
16871 done:
16872 return res;
16873}
16874
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016875// _tmp_139: ',' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016876static void *
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016877_tmp_139_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016878{
16879 if (p->error_indicator) {
16880 return NULL;
16881 }
16882 void * res = NULL;
16883 int mark = p->mark;
16884 { // ',' expression
16885 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016886 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016887 if (
16888 (literal = _PyPegen_expect_token(p, 12))
16889 &&
16890 (c = expression_rule(p))
16891 )
16892 {
16893 res = c;
16894 if (res == NULL && PyErr_Occurred()) {
16895 p->error_indicator = 1;
16896 return NULL;
16897 }
16898 goto done;
16899 }
16900 p->mark = mark;
16901 }
16902 res = NULL;
16903 done:
16904 return res;
16905}
16906
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016907// _tmp_140: 'or' conjunction
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016908static void *
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016909_tmp_140_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016910{
16911 if (p->error_indicator) {
16912 return NULL;
16913 }
16914 void * res = NULL;
16915 int mark = p->mark;
16916 { // 'or' conjunction
16917 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016918 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016919 if (
16920 (keyword = _PyPegen_expect_token(p, 532))
16921 &&
16922 (c = conjunction_rule(p))
16923 )
16924 {
16925 res = c;
16926 if (res == NULL && PyErr_Occurred()) {
16927 p->error_indicator = 1;
16928 return NULL;
16929 }
16930 goto done;
16931 }
16932 p->mark = mark;
16933 }
16934 res = NULL;
16935 done:
16936 return res;
16937}
16938
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016939// _tmp_141: 'and' inversion
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016940static void *
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016941_tmp_141_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016942{
16943 if (p->error_indicator) {
16944 return NULL;
16945 }
16946 void * res = NULL;
16947 int mark = p->mark;
16948 { // 'and' inversion
16949 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016950 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016951 if (
16952 (keyword = _PyPegen_expect_token(p, 533))
16953 &&
16954 (c = inversion_rule(p))
16955 )
16956 {
16957 res = c;
16958 if (res == NULL && PyErr_Occurred()) {
16959 p->error_indicator = 1;
16960 return NULL;
16961 }
16962 goto done;
16963 }
16964 p->mark = mark;
16965 }
16966 res = NULL;
16967 done:
16968 return res;
16969}
16970
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016971// _tmp_142: 'if' disjunction
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016972static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016973_tmp_142_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016974{
16975 if (p->error_indicator) {
16976 return NULL;
16977 }
16978 void * res = NULL;
16979 int mark = p->mark;
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030016980 { // 'if' disjunction
16981 Token * keyword;
16982 expr_ty z;
16983 if (
16984 (keyword = _PyPegen_expect_token(p, 510))
16985 &&
16986 (z = disjunction_rule(p))
16987 )
16988 {
16989 res = z;
16990 if (res == NULL && PyErr_Occurred()) {
16991 p->error_indicator = 1;
16992 return NULL;
16993 }
16994 goto done;
16995 }
16996 p->mark = mark;
16997 }
16998 res = NULL;
16999 done:
17000 return res;
17001}
17002
17003// _tmp_143: 'if' disjunction
17004static void *
17005_tmp_143_rule(Parser *p)
17006{
17007 if (p->error_indicator) {
17008 return NULL;
17009 }
17010 void * res = NULL;
17011 int mark = p->mark;
17012 { // 'if' disjunction
17013 Token * keyword;
17014 expr_ty z;
17015 if (
17016 (keyword = _PyPegen_expect_token(p, 510))
17017 &&
17018 (z = disjunction_rule(p))
17019 )
17020 {
17021 res = z;
17022 if (res == NULL && PyErr_Occurred()) {
17023 p->error_indicator = 1;
17024 return NULL;
17025 }
17026 goto done;
17027 }
17028 p->mark = mark;
17029 }
17030 res = NULL;
17031 done:
17032 return res;
17033}
17034
17035// _tmp_144: ',' star_target
17036static void *
17037_tmp_144_rule(Parser *p)
17038{
17039 if (p->error_indicator) {
17040 return NULL;
17041 }
17042 void * res = NULL;
17043 int mark = p->mark;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010017044 { // ',' star_target
17045 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010017046 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010017047 if (
17048 (literal = _PyPegen_expect_token(p, 12))
17049 &&
17050 (c = star_target_rule(p))
17051 )
17052 {
17053 res = c;
17054 if (res == NULL && PyErr_Occurred()) {
17055 p->error_indicator = 1;
17056 return NULL;
17057 }
17058 goto done;
17059 }
17060 p->mark = mark;
17061 }
17062 res = NULL;
17063 done:
17064 return res;
17065}
17066
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030017067// _loop1_145: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010017068static asdl_seq *
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030017069_loop1_145_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070017070{
17071 if (p->error_indicator) {
17072 return NULL;
17073 }
17074 void *res = NULL;
17075 int mark = p->mark;
17076 int start_mark = p->mark;
17077 void **children = PyMem_Malloc(sizeof(void *));
17078 if (!children) {
17079 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
17080 return NULL;
17081 }
17082 ssize_t children_capacity = 1;
17083 ssize_t n = 0;
17084 { // param_with_default
17085 NameDefaultPair* param_with_default_var;
17086 while (
17087 (param_with_default_var = param_with_default_rule(p))
17088 )
17089 {
17090 res = param_with_default_var;
17091 if (n == children_capacity) {
17092 children_capacity *= 2;
17093 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
17094 if (!children) {
17095 PyErr_Format(PyExc_MemoryError, "realloc None");
17096 return NULL;
17097 }
17098 }
17099 children[n++] = res;
17100 mark = p->mark;
17101 }
17102 p->mark = mark;
17103 }
17104 if (n == 0) {
17105 PyMem_Free(children);
17106 return NULL;
17107 }
17108 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
17109 if (!seq) {
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030017110 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_145");
Guido van Rossumc001c092020-04-30 12:12:19 -070017111 PyMem_Free(children);
17112 return NULL;
17113 }
17114 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
17115 PyMem_Free(children);
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030017116 _PyPegen_insert_memo(p, start_mark, _loop1_145_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070017117 return seq;
17118}
17119
Lysandros Nikolaoue10e7c72020-05-04 13:58:31 +030017120// _tmp_146: ')' | '**'
17121static void *
17122_tmp_146_rule(Parser *p)
17123{
17124 if (p->error_indicator) {
17125 return NULL;
17126 }
17127 void * res = NULL;
17128 int mark = p->mark;
17129 { // ')'
17130 Token * literal;
17131 if (
17132 (literal = _PyPegen_expect_token(p, 8))
17133 )
17134 {
17135 res = literal;
17136 goto done;
17137 }
17138 p->mark = mark;
17139 }
17140 { // '**'
17141 Token * literal;
17142 if (
17143 (literal = _PyPegen_expect_token(p, 35))
17144 )
17145 {
17146 res = literal;
17147 goto done;
17148 }
17149 p->mark = mark;
17150 }
17151 res = NULL;
17152 done:
17153 return res;
17154}
17155
17156// _tmp_147: ':' | '**'
17157static void *
17158_tmp_147_rule(Parser *p)
17159{
17160 if (p->error_indicator) {
17161 return NULL;
17162 }
17163 void * res = NULL;
17164 int mark = p->mark;
17165 { // ':'
17166 Token * literal;
17167 if (
17168 (literal = _PyPegen_expect_token(p, 11))
17169 )
17170 {
17171 res = literal;
17172 goto done;
17173 }
17174 p->mark = mark;
17175 }
17176 { // '**'
17177 Token * literal;
17178 if (
17179 (literal = _PyPegen_expect_token(p, 35))
17180 )
17181 {
17182 res = literal;
17183 goto done;
17184 }
17185 p->mark = mark;
17186 }
17187 res = NULL;
17188 done:
17189 return res;
17190}
17191
Pablo Galindoc5fc1562020-04-22 23:29:27 +010017192void *
17193_PyPegen_parse(Parser *p)
17194{
17195 // Initialize keywords
17196 p->keywords = reserved_keywords;
17197 p->n_keyword_lists = n_keyword_lists;
17198
17199 // Run parser
17200 void *result = NULL;
17201 if (p->start_rule == Py_file_input) {
17202 result = file_rule(p);
17203 } else if (p->start_rule == Py_single_input) {
17204 result = interactive_rule(p);
17205 } else if (p->start_rule == Py_eval_input) {
17206 result = eval_rule(p);
Guido van Rossumc001c092020-04-30 12:12:19 -070017207 } else if (p->start_rule == Py_func_type_input) {
17208 result = func_type_rule(p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010017209 } else if (p->start_rule == Py_fstring_input) {
17210 result = fstring_rule(p);
17211 }
17212
17213 return result;
17214}
17215
17216// The end