blob: b4745ba4d4f26a17abba2562245b13dd1fc7c6ac [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
218#define invalid_double_type_comments_type 1147
219#define _loop0_1_type 1148
220#define _loop0_2_type 1149
221#define _loop0_4_type 1150
222#define _gather_3_type 1151
223#define _loop0_6_type 1152
224#define _gather_5_type 1153
225#define _loop0_8_type 1154
226#define _gather_7_type 1155
227#define _loop0_10_type 1156
228#define _gather_9_type 1157
229#define _loop1_11_type 1158
230#define _loop0_13_type 1159
231#define _gather_12_type 1160
232#define _tmp_14_type 1161
233#define _tmp_15_type 1162
234#define _tmp_16_type 1163
235#define _tmp_17_type 1164
236#define _tmp_18_type 1165
237#define _tmp_19_type 1166
238#define _tmp_20_type 1167
239#define _tmp_21_type 1168
240#define _loop1_22_type 1169
241#define _tmp_23_type 1170
242#define _tmp_24_type 1171
243#define _loop0_26_type 1172
244#define _gather_25_type 1173
245#define _loop0_28_type 1174
246#define _gather_27_type 1175
247#define _tmp_29_type 1176
248#define _loop0_30_type 1177
249#define _loop1_31_type 1178
250#define _loop0_33_type 1179
251#define _gather_32_type 1180
252#define _tmp_34_type 1181
253#define _loop0_36_type 1182
254#define _gather_35_type 1183
255#define _tmp_37_type 1184
256#define _loop0_39_type 1185
257#define _gather_38_type 1186
258#define _loop0_41_type 1187
259#define _gather_40_type 1188
260#define _loop0_43_type 1189
261#define _gather_42_type 1190
262#define _loop0_45_type 1191
263#define _gather_44_type 1192
264#define _tmp_46_type 1193
265#define _loop1_47_type 1194
266#define _tmp_48_type 1195
267#define _tmp_49_type 1196
268#define _tmp_50_type 1197
269#define _tmp_51_type 1198
270#define _tmp_52_type 1199
271#define _loop0_53_type 1200
272#define _loop0_54_type 1201
273#define _loop0_55_type 1202
274#define _loop1_56_type 1203
275#define _loop0_57_type 1204
276#define _loop1_58_type 1205
277#define _loop1_59_type 1206
278#define _loop1_60_type 1207
279#define _loop0_61_type 1208
280#define _loop1_62_type 1209
281#define _loop0_63_type 1210
282#define _loop1_64_type 1211
283#define _loop0_65_type 1212
284#define _loop1_66_type 1213
285#define _loop1_67_type 1214
286#define _tmp_68_type 1215
287#define _loop0_70_type 1216
288#define _gather_69_type 1217
289#define _loop1_71_type 1218
290#define _loop0_73_type 1219
291#define _gather_72_type 1220
292#define _loop1_74_type 1221
293#define _loop0_75_type 1222
294#define _loop0_76_type 1223
295#define _loop0_77_type 1224
296#define _loop1_78_type 1225
297#define _loop0_79_type 1226
298#define _loop1_80_type 1227
299#define _loop1_81_type 1228
300#define _loop1_82_type 1229
301#define _loop0_83_type 1230
302#define _loop1_84_type 1231
303#define _loop0_85_type 1232
304#define _loop1_86_type 1233
305#define _loop0_87_type 1234
306#define _loop1_88_type 1235
307#define _loop1_89_type 1236
308#define _loop1_90_type 1237
309#define _loop1_91_type 1238
310#define _tmp_92_type 1239
311#define _loop0_94_type 1240
312#define _gather_93_type 1241
313#define _tmp_95_type 1242
314#define _tmp_96_type 1243
315#define _tmp_97_type 1244
316#define _tmp_98_type 1245
317#define _loop1_99_type 1246
318#define _tmp_100_type 1247
319#define _tmp_101_type 1248
320#define _loop0_103_type 1249
321#define _gather_102_type 1250
322#define _loop1_104_type 1251
323#define _loop0_105_type 1252
324#define _loop0_106_type 1253
325#define _tmp_107_type 1254
326#define _tmp_108_type 1255
327#define _loop0_110_type 1256
328#define _gather_109_type 1257
329#define _loop0_112_type 1258
330#define _gather_111_type 1259
331#define _loop0_114_type 1260
332#define _gather_113_type 1261
333#define _loop0_116_type 1262
334#define _gather_115_type 1263
335#define _loop0_117_type 1264
336#define _loop0_119_type 1265
337#define _gather_118_type 1266
338#define _tmp_120_type 1267
339#define _loop0_122_type 1268
340#define _gather_121_type 1269
341#define _loop0_124_type 1270
342#define _gather_123_type 1271
343#define _tmp_125_type 1272
344#define _tmp_126_type 1273
345#define _tmp_127_type 1274
346#define _tmp_128_type 1275
347#define _tmp_129_type 1276
348#define _loop0_130_type 1277
349#define _tmp_131_type 1278
350#define _tmp_132_type 1279
351#define _tmp_133_type 1280
352#define _tmp_134_type 1281
353#define _tmp_135_type 1282
354#define _tmp_136_type 1283
355#define _tmp_137_type 1284
356#define _tmp_138_type 1285
357#define _tmp_139_type 1286
358#define _tmp_140_type 1287
359#define _tmp_141_type 1288
360#define _tmp_142_type 1289
361#define _loop1_143_type 1290
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100362
363static mod_ty file_rule(Parser *p);
364static mod_ty interactive_rule(Parser *p);
365static mod_ty eval_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700366static mod_ty func_type_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100367static expr_ty fstring_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700368static asdl_seq* type_expressions_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100369static asdl_seq* statements_rule(Parser *p);
370static asdl_seq* statement_rule(Parser *p);
371static asdl_seq* statement_newline_rule(Parser *p);
372static asdl_seq* simple_stmt_rule(Parser *p);
373static stmt_ty small_stmt_rule(Parser *p);
374static stmt_ty compound_stmt_rule(Parser *p);
375static void *assignment_rule(Parser *p);
376static AugOperator* augassign_rule(Parser *p);
377static stmt_ty global_stmt_rule(Parser *p);
378static stmt_ty nonlocal_stmt_rule(Parser *p);
379static stmt_ty yield_stmt_rule(Parser *p);
380static stmt_ty assert_stmt_rule(Parser *p);
381static stmt_ty del_stmt_rule(Parser *p);
382static stmt_ty import_stmt_rule(Parser *p);
383static stmt_ty import_name_rule(Parser *p);
384static stmt_ty import_from_rule(Parser *p);
385static asdl_seq* import_from_targets_rule(Parser *p);
386static asdl_seq* import_from_as_names_rule(Parser *p);
387static alias_ty import_from_as_name_rule(Parser *p);
388static asdl_seq* dotted_as_names_rule(Parser *p);
389static alias_ty dotted_as_name_rule(Parser *p);
390static expr_ty dotted_name_rule(Parser *p);
391static stmt_ty if_stmt_rule(Parser *p);
392static stmt_ty elif_stmt_rule(Parser *p);
393static asdl_seq* else_block_rule(Parser *p);
394static stmt_ty while_stmt_rule(Parser *p);
395static stmt_ty for_stmt_rule(Parser *p);
396static stmt_ty with_stmt_rule(Parser *p);
397static withitem_ty with_item_rule(Parser *p);
398static stmt_ty try_stmt_rule(Parser *p);
399static excepthandler_ty except_block_rule(Parser *p);
400static asdl_seq* finally_block_rule(Parser *p);
401static stmt_ty return_stmt_rule(Parser *p);
402static stmt_ty raise_stmt_rule(Parser *p);
403static stmt_ty function_def_rule(Parser *p);
404static stmt_ty function_def_raw_rule(Parser *p);
Pablo Galindod9552412020-05-01 16:32:09 +0100405static Token* func_type_comment_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100406static arguments_ty params_rule(Parser *p);
407static arguments_ty parameters_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700408static asdl_seq* slash_no_default_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100409static SlashWithDefault* slash_with_default_rule(Parser *p);
410static StarEtc* star_etc_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100411static arg_ty kwds_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700412static arg_ty param_no_default_rule(Parser *p);
413static NameDefaultPair* param_with_default_rule(Parser *p);
414static NameDefaultPair* param_maybe_default_rule(Parser *p);
415static arg_ty param_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100416static expr_ty annotation_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700417static expr_ty default_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100418static asdl_seq* decorators_rule(Parser *p);
419static stmt_ty class_def_rule(Parser *p);
420static stmt_ty class_def_raw_rule(Parser *p);
421static asdl_seq* block_rule(Parser *p);
422static asdl_seq* expressions_list_rule(Parser *p);
423static expr_ty star_expressions_rule(Parser *p);
424static expr_ty star_expression_rule(Parser *p);
425static asdl_seq* star_named_expressions_rule(Parser *p);
426static expr_ty star_named_expression_rule(Parser *p);
427static expr_ty named_expression_rule(Parser *p);
428static expr_ty annotated_rhs_rule(Parser *p);
429static expr_ty expressions_rule(Parser *p);
430static expr_ty expression_rule(Parser *p);
431static expr_ty lambdef_rule(Parser *p);
432static arguments_ty lambda_parameters_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700433static asdl_seq* lambda_slash_no_default_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100434static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
435static StarEtc* lambda_star_etc_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100436static arg_ty lambda_kwds_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700437static arg_ty lambda_param_no_default_rule(Parser *p);
438static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
439static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
440static arg_ty lambda_param_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100441static expr_ty disjunction_rule(Parser *p);
442static expr_ty conjunction_rule(Parser *p);
443static expr_ty inversion_rule(Parser *p);
444static expr_ty comparison_rule(Parser *p);
445static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
446static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
447static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
448static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
449static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
450static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
451static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
452static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
453static CmpopExprPair* in_bitwise_or_rule(Parser *p);
454static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
455static CmpopExprPair* is_bitwise_or_rule(Parser *p);
456static expr_ty bitwise_or_rule(Parser *p);
457static expr_ty bitwise_xor_rule(Parser *p);
458static expr_ty bitwise_and_rule(Parser *p);
459static expr_ty shift_expr_rule(Parser *p);
460static expr_ty sum_rule(Parser *p);
461static expr_ty term_rule(Parser *p);
462static expr_ty factor_rule(Parser *p);
463static expr_ty power_rule(Parser *p);
464static expr_ty await_primary_rule(Parser *p);
465static expr_ty primary_rule(Parser *p);
466static expr_ty slices_rule(Parser *p);
467static expr_ty slice_rule(Parser *p);
468static expr_ty atom_rule(Parser *p);
469static expr_ty strings_rule(Parser *p);
470static expr_ty list_rule(Parser *p);
471static expr_ty listcomp_rule(Parser *p);
472static expr_ty tuple_rule(Parser *p);
473static expr_ty group_rule(Parser *p);
474static expr_ty genexp_rule(Parser *p);
475static expr_ty set_rule(Parser *p);
476static expr_ty setcomp_rule(Parser *p);
477static expr_ty dict_rule(Parser *p);
478static expr_ty dictcomp_rule(Parser *p);
479static asdl_seq* kvpairs_rule(Parser *p);
480static KeyValuePair* kvpair_rule(Parser *p);
481static asdl_seq* for_if_clauses_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300482static comprehension_ty for_if_clause_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100483static expr_ty yield_expr_rule(Parser *p);
484static expr_ty arguments_rule(Parser *p);
485static expr_ty args_rule(Parser *p);
486static asdl_seq* kwargs_rule(Parser *p);
487static expr_ty starred_expression_rule(Parser *p);
488static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
489static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
490static expr_ty star_targets_rule(Parser *p);
491static asdl_seq* star_targets_seq_rule(Parser *p);
492static expr_ty star_target_rule(Parser *p);
493static expr_ty star_atom_rule(Parser *p);
494static expr_ty inside_paren_ann_assign_target_rule(Parser *p);
495static expr_ty ann_assign_subscript_attribute_target_rule(Parser *p);
496static asdl_seq* del_targets_rule(Parser *p);
497static expr_ty del_target_rule(Parser *p);
498static expr_ty del_t_atom_rule(Parser *p);
499static asdl_seq* targets_rule(Parser *p);
500static expr_ty target_rule(Parser *p);
501static expr_ty t_primary_rule(Parser *p);
502static void *t_lookahead_rule(Parser *p);
503static expr_ty t_atom_rule(Parser *p);
504static void *incorrect_arguments_rule(Parser *p);
505static void *invalid_named_expression_rule(Parser *p);
506static void *invalid_assignment_rule(Parser *p);
507static void *invalid_block_rule(Parser *p);
508static void *invalid_comprehension_rule(Parser *p);
509static void *invalid_parameters_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700510static void *invalid_double_type_comments_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100511static asdl_seq *_loop0_1_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700512static asdl_seq *_loop0_2_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100513static asdl_seq *_loop0_4_rule(Parser *p);
514static asdl_seq *_gather_3_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700515static asdl_seq *_loop0_6_rule(Parser *p);
516static asdl_seq *_gather_5_rule(Parser *p);
517static asdl_seq *_loop0_8_rule(Parser *p);
518static asdl_seq *_gather_7_rule(Parser *p);
519static asdl_seq *_loop0_10_rule(Parser *p);
520static asdl_seq *_gather_9_rule(Parser *p);
521static asdl_seq *_loop1_11_rule(Parser *p);
522static asdl_seq *_loop0_13_rule(Parser *p);
523static asdl_seq *_gather_12_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100524static void *_tmp_14_rule(Parser *p);
525static void *_tmp_15_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700526static void *_tmp_16_rule(Parser *p);
527static void *_tmp_17_rule(Parser *p);
528static void *_tmp_18_rule(Parser *p);
529static void *_tmp_19_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100530static void *_tmp_20_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700531static void *_tmp_21_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100532static asdl_seq *_loop1_22_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700533static void *_tmp_23_rule(Parser *p);
534static void *_tmp_24_rule(Parser *p);
535static asdl_seq *_loop0_26_rule(Parser *p);
536static asdl_seq *_gather_25_rule(Parser *p);
537static asdl_seq *_loop0_28_rule(Parser *p);
538static asdl_seq *_gather_27_rule(Parser *p);
539static void *_tmp_29_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100540static asdl_seq *_loop0_30_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700541static asdl_seq *_loop1_31_rule(Parser *p);
542static asdl_seq *_loop0_33_rule(Parser *p);
543static asdl_seq *_gather_32_rule(Parser *p);
544static void *_tmp_34_rule(Parser *p);
545static asdl_seq *_loop0_36_rule(Parser *p);
546static asdl_seq *_gather_35_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100547static void *_tmp_37_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700548static asdl_seq *_loop0_39_rule(Parser *p);
549static asdl_seq *_gather_38_rule(Parser *p);
550static asdl_seq *_loop0_41_rule(Parser *p);
551static asdl_seq *_gather_40_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300552static asdl_seq *_loop0_43_rule(Parser *p);
553static asdl_seq *_gather_42_rule(Parser *p);
554static asdl_seq *_loop0_45_rule(Parser *p);
555static asdl_seq *_gather_44_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100556static void *_tmp_46_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300557static asdl_seq *_loop1_47_rule(Parser *p);
558static void *_tmp_48_rule(Parser *p);
559static void *_tmp_49_rule(Parser *p);
560static void *_tmp_50_rule(Parser *p);
561static void *_tmp_51_rule(Parser *p);
562static void *_tmp_52_rule(Parser *p);
563static asdl_seq *_loop0_53_rule(Parser *p);
564static asdl_seq *_loop0_54_rule(Parser *p);
565static asdl_seq *_loop0_55_rule(Parser *p);
566static asdl_seq *_loop1_56_rule(Parser *p);
567static asdl_seq *_loop0_57_rule(Parser *p);
568static asdl_seq *_loop1_58_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700569static asdl_seq *_loop1_59_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300570static asdl_seq *_loop1_60_rule(Parser *p);
571static asdl_seq *_loop0_61_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700572static asdl_seq *_loop1_62_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300573static asdl_seq *_loop0_63_rule(Parser *p);
574static asdl_seq *_loop1_64_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700575static asdl_seq *_loop0_65_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700576static asdl_seq *_loop1_66_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300577static asdl_seq *_loop1_67_rule(Parser *p);
578static void *_tmp_68_rule(Parser *p);
579static asdl_seq *_loop0_70_rule(Parser *p);
580static asdl_seq *_gather_69_rule(Parser *p);
581static asdl_seq *_loop1_71_rule(Parser *p);
582static asdl_seq *_loop0_73_rule(Parser *p);
583static asdl_seq *_gather_72_rule(Parser *p);
584static asdl_seq *_loop1_74_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700585static asdl_seq *_loop0_75_rule(Parser *p);
586static asdl_seq *_loop0_76_rule(Parser *p);
587static asdl_seq *_loop0_77_rule(Parser *p);
588static asdl_seq *_loop1_78_rule(Parser *p);
589static asdl_seq *_loop0_79_rule(Parser *p);
590static asdl_seq *_loop1_80_rule(Parser *p);
591static asdl_seq *_loop1_81_rule(Parser *p);
592static asdl_seq *_loop1_82_rule(Parser *p);
593static asdl_seq *_loop0_83_rule(Parser *p);
594static asdl_seq *_loop1_84_rule(Parser *p);
595static asdl_seq *_loop0_85_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300596static asdl_seq *_loop1_86_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700597static asdl_seq *_loop0_87_rule(Parser *p);
598static asdl_seq *_loop1_88_rule(Parser *p);
599static asdl_seq *_loop1_89_rule(Parser *p);
600static asdl_seq *_loop1_90_rule(Parser *p);
601static asdl_seq *_loop1_91_rule(Parser *p);
602static void *_tmp_92_rule(Parser *p);
603static asdl_seq *_loop0_94_rule(Parser *p);
604static asdl_seq *_gather_93_rule(Parser *p);
605static void *_tmp_95_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700606static void *_tmp_96_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700607static void *_tmp_97_rule(Parser *p);
608static void *_tmp_98_rule(Parser *p);
609static asdl_seq *_loop1_99_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100610static void *_tmp_100_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300611static void *_tmp_101_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700612static asdl_seq *_loop0_103_rule(Parser *p);
613static asdl_seq *_gather_102_rule(Parser *p);
614static asdl_seq *_loop1_104_rule(Parser *p);
615static asdl_seq *_loop0_105_rule(Parser *p);
616static asdl_seq *_loop0_106_rule(Parser *p);
617static void *_tmp_107_rule(Parser *p);
618static void *_tmp_108_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300619static asdl_seq *_loop0_110_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700620static asdl_seq *_gather_109_rule(Parser *p);
621static asdl_seq *_loop0_112_rule(Parser *p);
622static asdl_seq *_gather_111_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100623static asdl_seq *_loop0_114_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300624static asdl_seq *_gather_113_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100625static asdl_seq *_loop0_116_rule(Parser *p);
626static asdl_seq *_gather_115_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700627static asdl_seq *_loop0_117_rule(Parser *p);
628static asdl_seq *_loop0_119_rule(Parser *p);
629static asdl_seq *_gather_118_rule(Parser *p);
630static void *_tmp_120_rule(Parser *p);
631static asdl_seq *_loop0_122_rule(Parser *p);
632static asdl_seq *_gather_121_rule(Parser *p);
633static asdl_seq *_loop0_124_rule(Parser *p);
634static asdl_seq *_gather_123_rule(Parser *p);
635static void *_tmp_125_rule(Parser *p);
636static void *_tmp_126_rule(Parser *p);
637static void *_tmp_127_rule(Parser *p);
638static void *_tmp_128_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100639static void *_tmp_129_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700640static asdl_seq *_loop0_130_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100641static void *_tmp_131_rule(Parser *p);
642static void *_tmp_132_rule(Parser *p);
643static void *_tmp_133_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700644static void *_tmp_134_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100645static void *_tmp_135_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700646static void *_tmp_136_rule(Parser *p);
Pablo Galindo2b74c832020-04-27 18:02:07 +0100647static void *_tmp_137_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700648static void *_tmp_138_rule(Parser *p);
649static void *_tmp_139_rule(Parser *p);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +0300650static void *_tmp_140_rule(Parser *p);
651static void *_tmp_141_rule(Parser *p);
Guido van Rossumc001c092020-04-30 12:12:19 -0700652static void *_tmp_142_rule(Parser *p);
Guido van Rossum3941d972020-05-01 09:42:03 -0700653static asdl_seq *_loop1_143_rule(Parser *p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100654
655
656// file: statements? $
657static mod_ty
658file_rule(Parser *p)
659{
660 if (p->error_indicator) {
661 return NULL;
662 }
663 mod_ty res = NULL;
664 int mark = p->mark;
665 { // statements? $
666 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100667 Token * endmarker_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100668 if (
669 (a = statements_rule(p), 1)
670 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +0100671 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100672 )
673 {
Guido van Rossumc001c092020-04-30 12:12:19 -0700674 res = _PyPegen_make_module ( p , a );
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100675 if (res == NULL && PyErr_Occurred()) {
676 p->error_indicator = 1;
677 return NULL;
678 }
679 goto done;
680 }
681 p->mark = mark;
682 }
683 res = NULL;
684 done:
685 return res;
686}
687
688// interactive: statement_newline
689static mod_ty
690interactive_rule(Parser *p)
691{
692 if (p->error_indicator) {
693 return NULL;
694 }
695 mod_ty res = NULL;
696 int mark = p->mark;
697 { // statement_newline
698 asdl_seq* a;
699 if (
700 (a = statement_newline_rule(p))
701 )
702 {
703 res = Interactive ( a , p -> arena );
704 if (res == NULL && PyErr_Occurred()) {
705 p->error_indicator = 1;
706 return NULL;
707 }
708 goto done;
709 }
710 p->mark = mark;
711 }
712 res = NULL;
713 done:
714 return res;
715}
716
717// eval: expressions NEWLINE* $
718static mod_ty
719eval_rule(Parser *p)
720{
721 if (p->error_indicator) {
722 return NULL;
723 }
724 mod_ty res = NULL;
725 int mark = p->mark;
726 { // expressions NEWLINE* $
727 asdl_seq * _loop0_1_var;
728 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100729 Token * endmarker_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100730 if (
731 (a = expressions_rule(p))
732 &&
733 (_loop0_1_var = _loop0_1_rule(p))
734 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +0100735 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100736 )
737 {
738 res = Expression ( a , p -> arena );
739 if (res == NULL && PyErr_Occurred()) {
740 p->error_indicator = 1;
741 return NULL;
742 }
743 goto done;
744 }
745 p->mark = mark;
746 }
747 res = NULL;
748 done:
749 return res;
750}
751
Guido van Rossumc001c092020-04-30 12:12:19 -0700752// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
753static mod_ty
754func_type_rule(Parser *p)
755{
756 if (p->error_indicator) {
757 return NULL;
758 }
759 mod_ty res = NULL;
760 int mark = p->mark;
761 { // '(' type_expressions? ')' '->' expression NEWLINE* $
762 asdl_seq * _loop0_2_var;
763 void *a;
764 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100765 Token * endmarker_var;
766 Token * literal;
767 Token * literal_1;
768 Token * literal_2;
Guido van Rossumc001c092020-04-30 12:12:19 -0700769 if (
770 (literal = _PyPegen_expect_token(p, 7))
771 &&
772 (a = type_expressions_rule(p), 1)
773 &&
774 (literal_1 = _PyPegen_expect_token(p, 8))
775 &&
776 (literal_2 = _PyPegen_expect_token(p, 51))
777 &&
778 (b = expression_rule(p))
779 &&
780 (_loop0_2_var = _loop0_2_rule(p))
781 &&
782 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
783 )
784 {
785 res = FunctionType ( a , b , p -> arena );
786 if (res == NULL && PyErr_Occurred()) {
787 p->error_indicator = 1;
788 return NULL;
789 }
790 goto done;
791 }
792 p->mark = mark;
793 }
794 res = NULL;
795 done:
796 return res;
797}
798
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100799// fstring: star_expressions
800static expr_ty
801fstring_rule(Parser *p)
802{
803 if (p->error_indicator) {
804 return NULL;
805 }
806 expr_ty res = NULL;
807 int mark = p->mark;
808 { // star_expressions
809 expr_ty star_expressions_var;
810 if (
811 (star_expressions_var = star_expressions_rule(p))
812 )
813 {
814 res = star_expressions_var;
815 goto done;
816 }
817 p->mark = mark;
818 }
819 res = NULL;
820 done:
821 return res;
822}
823
Guido van Rossumc001c092020-04-30 12:12:19 -0700824// type_expressions:
825// | ','.expression+ ',' '*' expression ',' '**' expression
826// | ','.expression+ ',' '*' expression
827// | ','.expression+ ',' '**' expression
828// | ','.expression+
829static asdl_seq*
830type_expressions_rule(Parser *p)
831{
832 if (p->error_indicator) {
833 return NULL;
834 }
835 asdl_seq* res = NULL;
836 int mark = p->mark;
837 { // ','.expression+ ',' '*' expression ',' '**' expression
838 asdl_seq * a;
839 expr_ty b;
840 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100841 Token * literal;
842 Token * literal_1;
843 Token * literal_2;
844 Token * literal_3;
Guido van Rossumc001c092020-04-30 12:12:19 -0700845 if (
846 (a = _gather_3_rule(p))
847 &&
848 (literal = _PyPegen_expect_token(p, 12))
849 &&
850 (literal_1 = _PyPegen_expect_token(p, 16))
851 &&
852 (b = expression_rule(p))
853 &&
854 (literal_2 = _PyPegen_expect_token(p, 12))
855 &&
856 (literal_3 = _PyPegen_expect_token(p, 35))
857 &&
858 (c = expression_rule(p))
859 )
860 {
861 res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
862 if (res == NULL && PyErr_Occurred()) {
863 p->error_indicator = 1;
864 return NULL;
865 }
866 goto done;
867 }
868 p->mark = mark;
869 }
870 { // ','.expression+ ',' '*' expression
871 asdl_seq * a;
872 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100873 Token * literal;
874 Token * literal_1;
Guido van Rossumc001c092020-04-30 12:12:19 -0700875 if (
876 (a = _gather_5_rule(p))
877 &&
878 (literal = _PyPegen_expect_token(p, 12))
879 &&
880 (literal_1 = _PyPegen_expect_token(p, 16))
881 &&
882 (b = expression_rule(p))
883 )
884 {
885 res = _PyPegen_seq_append_to_end ( p , a , b );
886 if (res == NULL && PyErr_Occurred()) {
887 p->error_indicator = 1;
888 return NULL;
889 }
890 goto done;
891 }
892 p->mark = mark;
893 }
894 { // ','.expression+ ',' '**' expression
895 asdl_seq * a;
896 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +0100897 Token * literal;
898 Token * literal_1;
Guido van Rossumc001c092020-04-30 12:12:19 -0700899 if (
900 (a = _gather_7_rule(p))
901 &&
902 (literal = _PyPegen_expect_token(p, 12))
903 &&
904 (literal_1 = _PyPegen_expect_token(p, 35))
905 &&
906 (b = expression_rule(p))
907 )
908 {
909 res = _PyPegen_seq_append_to_end ( p , a , b );
910 if (res == NULL && PyErr_Occurred()) {
911 p->error_indicator = 1;
912 return NULL;
913 }
914 goto done;
915 }
916 p->mark = mark;
917 }
918 { // ','.expression+
919 asdl_seq * _gather_9_var;
920 if (
921 (_gather_9_var = _gather_9_rule(p))
922 )
923 {
924 res = _gather_9_var;
925 goto done;
926 }
927 p->mark = mark;
928 }
929 res = NULL;
930 done:
931 return res;
932}
933
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100934// statements: statement+
935static asdl_seq*
936statements_rule(Parser *p)
937{
938 if (p->error_indicator) {
939 return NULL;
940 }
941 asdl_seq* res = NULL;
942 int mark = p->mark;
943 { // statement+
944 asdl_seq * a;
945 if (
Guido van Rossumc001c092020-04-30 12:12:19 -0700946 (a = _loop1_11_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +0100947 )
948 {
949 res = _PyPegen_seq_flatten ( p , a );
950 if (res == NULL && PyErr_Occurred()) {
951 p->error_indicator = 1;
952 return NULL;
953 }
954 goto done;
955 }
956 p->mark = mark;
957 }
958 res = NULL;
959 done:
960 return res;
961}
962
963// statement: compound_stmt | simple_stmt
964static asdl_seq*
965statement_rule(Parser *p)
966{
967 if (p->error_indicator) {
968 return NULL;
969 }
970 asdl_seq* res = NULL;
971 int mark = p->mark;
972 { // compound_stmt
973 stmt_ty a;
974 if (
975 (a = compound_stmt_rule(p))
976 )
977 {
978 res = _PyPegen_singleton_seq ( p , a );
979 if (res == NULL && PyErr_Occurred()) {
980 p->error_indicator = 1;
981 return NULL;
982 }
983 goto done;
984 }
985 p->mark = mark;
986 }
987 { // simple_stmt
988 asdl_seq* simple_stmt_var;
989 if (
990 (simple_stmt_var = simple_stmt_rule(p))
991 )
992 {
993 res = simple_stmt_var;
994 goto done;
995 }
996 p->mark = mark;
997 }
998 res = NULL;
999 done:
1000 return res;
1001}
1002
1003// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
1004static asdl_seq*
1005statement_newline_rule(Parser *p)
1006{
1007 if (p->error_indicator) {
1008 return NULL;
1009 }
1010 asdl_seq* res = NULL;
1011 int mark = p->mark;
1012 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1013 p->error_indicator = 1;
1014 return NULL;
1015 }
1016 int start_lineno = p->tokens[mark]->lineno;
1017 UNUSED(start_lineno); // Only used by EXTRA macro
1018 int start_col_offset = p->tokens[mark]->col_offset;
1019 UNUSED(start_col_offset); // Only used by EXTRA macro
1020 { // compound_stmt NEWLINE
1021 stmt_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001022 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001023 if (
1024 (a = compound_stmt_rule(p))
1025 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01001026 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001027 )
1028 {
1029 res = _PyPegen_singleton_seq ( p , a );
1030 if (res == NULL && PyErr_Occurred()) {
1031 p->error_indicator = 1;
1032 return NULL;
1033 }
1034 goto done;
1035 }
1036 p->mark = mark;
1037 }
1038 { // simple_stmt
1039 asdl_seq* simple_stmt_var;
1040 if (
1041 (simple_stmt_var = simple_stmt_rule(p))
1042 )
1043 {
1044 res = simple_stmt_var;
1045 goto done;
1046 }
1047 p->mark = mark;
1048 }
1049 { // NEWLINE
Pablo Galindob796b3f2020-05-01 12:32:26 +01001050 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001051 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01001052 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001053 )
1054 {
1055 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1056 if (token == NULL) {
1057 return NULL;
1058 }
1059 int end_lineno = token->end_lineno;
1060 UNUSED(end_lineno); // Only used by EXTRA macro
1061 int end_col_offset = token->end_col_offset;
1062 UNUSED(end_col_offset); // Only used by EXTRA macro
1063 res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
1064 if (res == NULL && PyErr_Occurred()) {
1065 p->error_indicator = 1;
1066 return NULL;
1067 }
1068 goto done;
1069 }
1070 p->mark = mark;
1071 }
1072 { // $
Pablo Galindob796b3f2020-05-01 12:32:26 +01001073 Token * endmarker_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001074 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01001075 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001076 )
1077 {
1078 res = _PyPegen_interactive_exit ( p );
1079 if (res == NULL && PyErr_Occurred()) {
1080 p->error_indicator = 1;
1081 return NULL;
1082 }
1083 goto done;
1084 }
1085 p->mark = mark;
1086 }
1087 res = NULL;
1088 done:
1089 return res;
1090}
1091
1092// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
1093static asdl_seq*
1094simple_stmt_rule(Parser *p)
1095{
1096 if (p->error_indicator) {
1097 return NULL;
1098 }
1099 asdl_seq* res = NULL;
1100 int mark = p->mark;
1101 { // small_stmt !';' NEWLINE
1102 stmt_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001103 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001104 if (
1105 (a = small_stmt_rule(p))
1106 &&
1107 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13)
1108 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01001109 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001110 )
1111 {
1112 res = _PyPegen_singleton_seq ( p , a );
1113 if (res == NULL && PyErr_Occurred()) {
1114 p->error_indicator = 1;
1115 return NULL;
1116 }
1117 goto done;
1118 }
1119 p->mark = mark;
1120 }
1121 { // ';'.small_stmt+ ';'? NEWLINE
1122 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001123 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001124 void *opt_var;
1125 UNUSED(opt_var); // Silence compiler warnings
1126 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001127 (a = _gather_12_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001128 &&
1129 (opt_var = _PyPegen_expect_token(p, 13), 1)
1130 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01001131 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001132 )
1133 {
1134 res = a;
1135 if (res == NULL && PyErr_Occurred()) {
1136 p->error_indicator = 1;
1137 return NULL;
1138 }
1139 goto done;
1140 }
1141 p->mark = mark;
1142 }
1143 res = NULL;
1144 done:
1145 return res;
1146}
1147
1148// small_stmt:
1149// | assignment
1150// | star_expressions
1151// | &'return' return_stmt
1152// | &('import' | 'from') import_stmt
1153// | &'raise' raise_stmt
1154// | 'pass'
1155// | &'del' del_stmt
1156// | &'yield' yield_stmt
1157// | &'assert' assert_stmt
1158// | 'break'
1159// | 'continue'
1160// | &'global' global_stmt
1161// | &'nonlocal' nonlocal_stmt
1162static stmt_ty
1163small_stmt_rule(Parser *p)
1164{
1165 if (p->error_indicator) {
1166 return NULL;
1167 }
1168 stmt_ty res = NULL;
1169 if (_PyPegen_is_memoized(p, small_stmt_type, &res))
1170 return res;
1171 int mark = p->mark;
1172 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1173 p->error_indicator = 1;
1174 return NULL;
1175 }
1176 int start_lineno = p->tokens[mark]->lineno;
1177 UNUSED(start_lineno); // Only used by EXTRA macro
1178 int start_col_offset = p->tokens[mark]->col_offset;
1179 UNUSED(start_col_offset); // Only used by EXTRA macro
1180 { // assignment
1181 void *assignment_var;
1182 if (
1183 (assignment_var = assignment_rule(p))
1184 )
1185 {
1186 res = assignment_var;
1187 goto done;
1188 }
1189 p->mark = mark;
1190 }
1191 { // star_expressions
1192 expr_ty e;
1193 if (
1194 (e = star_expressions_rule(p))
1195 )
1196 {
1197 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1198 if (token == NULL) {
1199 return NULL;
1200 }
1201 int end_lineno = token->end_lineno;
1202 UNUSED(end_lineno); // Only used by EXTRA macro
1203 int end_col_offset = token->end_col_offset;
1204 UNUSED(end_col_offset); // Only used by EXTRA macro
1205 res = _Py_Expr ( e , EXTRA );
1206 if (res == NULL && PyErr_Occurred()) {
1207 p->error_indicator = 1;
1208 return NULL;
1209 }
1210 goto done;
1211 }
1212 p->mark = mark;
1213 }
1214 { // &'return' return_stmt
1215 stmt_ty return_stmt_var;
1216 if (
1217 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500)
1218 &&
1219 (return_stmt_var = return_stmt_rule(p))
1220 )
1221 {
1222 res = return_stmt_var;
1223 goto done;
1224 }
1225 p->mark = mark;
1226 }
1227 { // &('import' | 'from') import_stmt
1228 stmt_ty import_stmt_var;
1229 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001230 _PyPegen_lookahead(1, _tmp_14_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001231 &&
1232 (import_stmt_var = import_stmt_rule(p))
1233 )
1234 {
1235 res = import_stmt_var;
1236 goto done;
1237 }
1238 p->mark = mark;
1239 }
1240 { // &'raise' raise_stmt
1241 stmt_ty raise_stmt_var;
1242 if (
1243 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501)
1244 &&
1245 (raise_stmt_var = raise_stmt_rule(p))
1246 )
1247 {
1248 res = raise_stmt_var;
1249 goto done;
1250 }
1251 p->mark = mark;
1252 }
1253 { // 'pass'
Pablo Galindob796b3f2020-05-01 12:32:26 +01001254 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001255 if (
1256 (keyword = _PyPegen_expect_token(p, 502))
1257 )
1258 {
1259 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1260 if (token == NULL) {
1261 return NULL;
1262 }
1263 int end_lineno = token->end_lineno;
1264 UNUSED(end_lineno); // Only used by EXTRA macro
1265 int end_col_offset = token->end_col_offset;
1266 UNUSED(end_col_offset); // Only used by EXTRA macro
1267 res = _Py_Pass ( EXTRA );
1268 if (res == NULL && PyErr_Occurred()) {
1269 p->error_indicator = 1;
1270 return NULL;
1271 }
1272 goto done;
1273 }
1274 p->mark = mark;
1275 }
1276 { // &'del' del_stmt
1277 stmt_ty del_stmt_var;
1278 if (
1279 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503)
1280 &&
1281 (del_stmt_var = del_stmt_rule(p))
1282 )
1283 {
1284 res = del_stmt_var;
1285 goto done;
1286 }
1287 p->mark = mark;
1288 }
1289 { // &'yield' yield_stmt
1290 stmt_ty yield_stmt_var;
1291 if (
1292 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504)
1293 &&
1294 (yield_stmt_var = yield_stmt_rule(p))
1295 )
1296 {
1297 res = yield_stmt_var;
1298 goto done;
1299 }
1300 p->mark = mark;
1301 }
1302 { // &'assert' assert_stmt
1303 stmt_ty assert_stmt_var;
1304 if (
1305 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505)
1306 &&
1307 (assert_stmt_var = assert_stmt_rule(p))
1308 )
1309 {
1310 res = assert_stmt_var;
1311 goto done;
1312 }
1313 p->mark = mark;
1314 }
1315 { // 'break'
Pablo Galindob796b3f2020-05-01 12:32:26 +01001316 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001317 if (
1318 (keyword = _PyPegen_expect_token(p, 506))
1319 )
1320 {
1321 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1322 if (token == NULL) {
1323 return NULL;
1324 }
1325 int end_lineno = token->end_lineno;
1326 UNUSED(end_lineno); // Only used by EXTRA macro
1327 int end_col_offset = token->end_col_offset;
1328 UNUSED(end_col_offset); // Only used by EXTRA macro
1329 res = _Py_Break ( EXTRA );
1330 if (res == NULL && PyErr_Occurred()) {
1331 p->error_indicator = 1;
1332 return NULL;
1333 }
1334 goto done;
1335 }
1336 p->mark = mark;
1337 }
1338 { // 'continue'
Pablo Galindob796b3f2020-05-01 12:32:26 +01001339 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001340 if (
1341 (keyword = _PyPegen_expect_token(p, 507))
1342 )
1343 {
1344 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1345 if (token == NULL) {
1346 return NULL;
1347 }
1348 int end_lineno = token->end_lineno;
1349 UNUSED(end_lineno); // Only used by EXTRA macro
1350 int end_col_offset = token->end_col_offset;
1351 UNUSED(end_col_offset); // Only used by EXTRA macro
1352 res = _Py_Continue ( EXTRA );
1353 if (res == NULL && PyErr_Occurred()) {
1354 p->error_indicator = 1;
1355 return NULL;
1356 }
1357 goto done;
1358 }
1359 p->mark = mark;
1360 }
1361 { // &'global' global_stmt
1362 stmt_ty global_stmt_var;
1363 if (
1364 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508)
1365 &&
1366 (global_stmt_var = global_stmt_rule(p))
1367 )
1368 {
1369 res = global_stmt_var;
1370 goto done;
1371 }
1372 p->mark = mark;
1373 }
1374 { // &'nonlocal' nonlocal_stmt
1375 stmt_ty nonlocal_stmt_var;
1376 if (
1377 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509)
1378 &&
1379 (nonlocal_stmt_var = nonlocal_stmt_rule(p))
1380 )
1381 {
1382 res = nonlocal_stmt_var;
1383 goto done;
1384 }
1385 p->mark = mark;
1386 }
1387 res = NULL;
1388 done:
1389 _PyPegen_insert_memo(p, mark, small_stmt_type, res);
1390 return res;
1391}
1392
1393// compound_stmt:
1394// | &('def' | '@' | ASYNC) function_def
1395// | &'if' if_stmt
1396// | &('class' | '@') class_def
1397// | &('with' | ASYNC) with_stmt
1398// | &('for' | ASYNC) for_stmt
1399// | &'try' try_stmt
1400// | &'while' while_stmt
1401static stmt_ty
1402compound_stmt_rule(Parser *p)
1403{
1404 if (p->error_indicator) {
1405 return NULL;
1406 }
1407 stmt_ty res = NULL;
1408 int mark = p->mark;
1409 { // &('def' | '@' | ASYNC) function_def
1410 stmt_ty function_def_var;
1411 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001412 _PyPegen_lookahead(1, _tmp_15_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001413 &&
1414 (function_def_var = function_def_rule(p))
1415 )
1416 {
1417 res = function_def_var;
1418 goto done;
1419 }
1420 p->mark = mark;
1421 }
1422 { // &'if' if_stmt
1423 stmt_ty if_stmt_var;
1424 if (
1425 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510)
1426 &&
1427 (if_stmt_var = if_stmt_rule(p))
1428 )
1429 {
1430 res = if_stmt_var;
1431 goto done;
1432 }
1433 p->mark = mark;
1434 }
1435 { // &('class' | '@') class_def
1436 stmt_ty class_def_var;
1437 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001438 _PyPegen_lookahead(1, _tmp_16_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001439 &&
1440 (class_def_var = class_def_rule(p))
1441 )
1442 {
1443 res = class_def_var;
1444 goto done;
1445 }
1446 p->mark = mark;
1447 }
1448 { // &('with' | ASYNC) with_stmt
1449 stmt_ty with_stmt_var;
1450 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001451 _PyPegen_lookahead(1, _tmp_17_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001452 &&
1453 (with_stmt_var = with_stmt_rule(p))
1454 )
1455 {
1456 res = with_stmt_var;
1457 goto done;
1458 }
1459 p->mark = mark;
1460 }
1461 { // &('for' | ASYNC) for_stmt
1462 stmt_ty for_stmt_var;
1463 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001464 _PyPegen_lookahead(1, _tmp_18_rule, p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001465 &&
1466 (for_stmt_var = for_stmt_rule(p))
1467 )
1468 {
1469 res = for_stmt_var;
1470 goto done;
1471 }
1472 p->mark = mark;
1473 }
1474 { // &'try' try_stmt
1475 stmt_ty try_stmt_var;
1476 if (
1477 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511)
1478 &&
1479 (try_stmt_var = try_stmt_rule(p))
1480 )
1481 {
1482 res = try_stmt_var;
1483 goto done;
1484 }
1485 p->mark = mark;
1486 }
1487 { // &'while' while_stmt
1488 stmt_ty while_stmt_var;
1489 if (
1490 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512)
1491 &&
1492 (while_stmt_var = while_stmt_rule(p))
1493 )
1494 {
1495 res = while_stmt_var;
1496 goto done;
1497 }
1498 p->mark = mark;
1499 }
1500 res = NULL;
1501 done:
1502 return res;
1503}
1504
1505// assignment:
1506// | NAME ':' expression ['=' annotated_rhs]
1507// | ('(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target) ':' expression ['=' annotated_rhs]
Guido van Rossumc001c092020-04-30 12:12:19 -07001508// | ((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001509// | target augassign (yield_expr | star_expressions)
1510// | invalid_assignment
1511static void *
1512assignment_rule(Parser *p)
1513{
1514 if (p->error_indicator) {
1515 return NULL;
1516 }
1517 void * res = NULL;
1518 int mark = p->mark;
1519 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1520 p->error_indicator = 1;
1521 return NULL;
1522 }
1523 int start_lineno = p->tokens[mark]->lineno;
1524 UNUSED(start_lineno); // Only used by EXTRA macro
1525 int start_col_offset = p->tokens[mark]->col_offset;
1526 UNUSED(start_col_offset); // Only used by EXTRA macro
1527 { // NAME ':' expression ['=' annotated_rhs]
1528 expr_ty a;
1529 expr_ty b;
1530 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001531 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001532 if (
1533 (a = _PyPegen_name_token(p))
1534 &&
1535 (literal = _PyPegen_expect_token(p, 11))
1536 &&
1537 (b = expression_rule(p))
1538 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001539 (c = _tmp_19_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001540 )
1541 {
1542 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1543 if (token == NULL) {
1544 return NULL;
1545 }
1546 int end_lineno = token->end_lineno;
1547 UNUSED(end_lineno); // Only used by EXTRA macro
1548 int end_col_offset = token->end_col_offset;
1549 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03001550 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 +01001551 if (res == NULL && PyErr_Occurred()) {
1552 p->error_indicator = 1;
1553 return NULL;
1554 }
1555 goto done;
1556 }
1557 p->mark = mark;
1558 }
1559 { // ('(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target) ':' expression ['=' annotated_rhs]
1560 void *a;
1561 expr_ty b;
1562 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001563 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001564 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001565 (a = _tmp_20_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001566 &&
1567 (literal = _PyPegen_expect_token(p, 11))
1568 &&
1569 (b = expression_rule(p))
1570 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001571 (c = _tmp_21_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001572 )
1573 {
1574 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1575 if (token == NULL) {
1576 return NULL;
1577 }
1578 int end_lineno = token->end_lineno;
1579 UNUSED(end_lineno); // Only used by EXTRA macro
1580 int end_col_offset = token->end_col_offset;
1581 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03001582 res = CHECK_VERSION ( 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001583 if (res == NULL && PyErr_Occurred()) {
1584 p->error_indicator = 1;
1585 return NULL;
1586 }
1587 goto done;
1588 }
1589 p->mark = mark;
1590 }
Guido van Rossumc001c092020-04-30 12:12:19 -07001591 { // ((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001592 asdl_seq * a;
1593 void *b;
Guido van Rossumc001c092020-04-30 12:12:19 -07001594 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001595 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07001596 (a = _loop1_22_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001597 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001598 (b = _tmp_23_rule(p))
1599 &&
1600 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001601 )
1602 {
1603 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1604 if (token == NULL) {
1605 return NULL;
1606 }
1607 int end_lineno = token->end_lineno;
1608 UNUSED(end_lineno); // Only used by EXTRA macro
1609 int end_col_offset = token->end_col_offset;
1610 UNUSED(end_col_offset); // Only used by EXTRA macro
Guido van Rossumc001c092020-04-30 12:12:19 -07001611 res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001612 if (res == NULL && PyErr_Occurred()) {
1613 p->error_indicator = 1;
1614 return NULL;
1615 }
1616 goto done;
1617 }
1618 p->mark = mark;
1619 }
1620 { // target augassign (yield_expr | star_expressions)
1621 expr_ty a;
1622 AugOperator* b;
1623 void *c;
1624 if (
1625 (a = target_rule(p))
1626 &&
1627 (b = augassign_rule(p))
1628 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001629 (c = _tmp_24_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001630 )
1631 {
1632 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1633 if (token == NULL) {
1634 return NULL;
1635 }
1636 int end_lineno = token->end_lineno;
1637 UNUSED(end_lineno); // Only used by EXTRA macro
1638 int end_col_offset = token->end_col_offset;
1639 UNUSED(end_col_offset); // Only used by EXTRA macro
1640 res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
1641 if (res == NULL && PyErr_Occurred()) {
1642 p->error_indicator = 1;
1643 return NULL;
1644 }
1645 goto done;
1646 }
1647 p->mark = mark;
1648 }
1649 { // invalid_assignment
1650 void *invalid_assignment_var;
1651 if (
1652 (invalid_assignment_var = invalid_assignment_rule(p))
1653 )
1654 {
1655 res = invalid_assignment_var;
1656 goto done;
1657 }
1658 p->mark = mark;
1659 }
1660 res = NULL;
1661 done:
1662 return res;
1663}
1664
1665// augassign:
1666// | '+='
1667// | '-='
1668// | '*='
1669// | '@='
1670// | '/='
1671// | '%='
1672// | '&='
1673// | '|='
1674// | '^='
1675// | '<<='
1676// | '>>='
1677// | '**='
1678// | '//='
1679static AugOperator*
1680augassign_rule(Parser *p)
1681{
1682 if (p->error_indicator) {
1683 return NULL;
1684 }
1685 AugOperator* res = NULL;
1686 int mark = p->mark;
1687 { // '+='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001688 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001689 if (
1690 (literal = _PyPegen_expect_token(p, 36))
1691 )
1692 {
1693 res = _PyPegen_augoperator ( p , Add );
1694 if (res == NULL && PyErr_Occurred()) {
1695 p->error_indicator = 1;
1696 return NULL;
1697 }
1698 goto done;
1699 }
1700 p->mark = mark;
1701 }
1702 { // '-='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001703 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001704 if (
1705 (literal = _PyPegen_expect_token(p, 37))
1706 )
1707 {
1708 res = _PyPegen_augoperator ( p , Sub );
1709 if (res == NULL && PyErr_Occurred()) {
1710 p->error_indicator = 1;
1711 return NULL;
1712 }
1713 goto done;
1714 }
1715 p->mark = mark;
1716 }
1717 { // '*='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001718 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001719 if (
1720 (literal = _PyPegen_expect_token(p, 38))
1721 )
1722 {
1723 res = _PyPegen_augoperator ( p , Mult );
1724 if (res == NULL && PyErr_Occurred()) {
1725 p->error_indicator = 1;
1726 return NULL;
1727 }
1728 goto done;
1729 }
1730 p->mark = mark;
1731 }
1732 { // '@='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001733 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001734 if (
1735 (literal = _PyPegen_expect_token(p, 50))
1736 )
1737 {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03001738 res = CHECK_VERSION ( 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001739 if (res == NULL && PyErr_Occurred()) {
1740 p->error_indicator = 1;
1741 return NULL;
1742 }
1743 goto done;
1744 }
1745 p->mark = mark;
1746 }
1747 { // '/='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001748 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001749 if (
1750 (literal = _PyPegen_expect_token(p, 39))
1751 )
1752 {
1753 res = _PyPegen_augoperator ( p , Div );
1754 if (res == NULL && PyErr_Occurred()) {
1755 p->error_indicator = 1;
1756 return NULL;
1757 }
1758 goto done;
1759 }
1760 p->mark = mark;
1761 }
1762 { // '%='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001763 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001764 if (
1765 (literal = _PyPegen_expect_token(p, 40))
1766 )
1767 {
1768 res = _PyPegen_augoperator ( p , Mod );
1769 if (res == NULL && PyErr_Occurred()) {
1770 p->error_indicator = 1;
1771 return NULL;
1772 }
1773 goto done;
1774 }
1775 p->mark = mark;
1776 }
1777 { // '&='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001778 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001779 if (
1780 (literal = _PyPegen_expect_token(p, 41))
1781 )
1782 {
1783 res = _PyPegen_augoperator ( p , BitAnd );
1784 if (res == NULL && PyErr_Occurred()) {
1785 p->error_indicator = 1;
1786 return NULL;
1787 }
1788 goto done;
1789 }
1790 p->mark = mark;
1791 }
1792 { // '|='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001793 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001794 if (
1795 (literal = _PyPegen_expect_token(p, 42))
1796 )
1797 {
1798 res = _PyPegen_augoperator ( p , BitOr );
1799 if (res == NULL && PyErr_Occurred()) {
1800 p->error_indicator = 1;
1801 return NULL;
1802 }
1803 goto done;
1804 }
1805 p->mark = mark;
1806 }
1807 { // '^='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001808 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001809 if (
1810 (literal = _PyPegen_expect_token(p, 43))
1811 )
1812 {
1813 res = _PyPegen_augoperator ( p , BitXor );
1814 if (res == NULL && PyErr_Occurred()) {
1815 p->error_indicator = 1;
1816 return NULL;
1817 }
1818 goto done;
1819 }
1820 p->mark = mark;
1821 }
1822 { // '<<='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001823 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001824 if (
1825 (literal = _PyPegen_expect_token(p, 44))
1826 )
1827 {
1828 res = _PyPegen_augoperator ( p , LShift );
1829 if (res == NULL && PyErr_Occurred()) {
1830 p->error_indicator = 1;
1831 return NULL;
1832 }
1833 goto done;
1834 }
1835 p->mark = mark;
1836 }
1837 { // '>>='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001838 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001839 if (
1840 (literal = _PyPegen_expect_token(p, 45))
1841 )
1842 {
1843 res = _PyPegen_augoperator ( p , RShift );
1844 if (res == NULL && PyErr_Occurred()) {
1845 p->error_indicator = 1;
1846 return NULL;
1847 }
1848 goto done;
1849 }
1850 p->mark = mark;
1851 }
1852 { // '**='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001853 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001854 if (
1855 (literal = _PyPegen_expect_token(p, 46))
1856 )
1857 {
1858 res = _PyPegen_augoperator ( p , Pow );
1859 if (res == NULL && PyErr_Occurred()) {
1860 p->error_indicator = 1;
1861 return NULL;
1862 }
1863 goto done;
1864 }
1865 p->mark = mark;
1866 }
1867 { // '//='
Pablo Galindob796b3f2020-05-01 12:32:26 +01001868 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001869 if (
1870 (literal = _PyPegen_expect_token(p, 48))
1871 )
1872 {
1873 res = _PyPegen_augoperator ( p , FloorDiv );
1874 if (res == NULL && PyErr_Occurred()) {
1875 p->error_indicator = 1;
1876 return NULL;
1877 }
1878 goto done;
1879 }
1880 p->mark = mark;
1881 }
1882 res = NULL;
1883 done:
1884 return res;
1885}
1886
1887// global_stmt: 'global' ','.NAME+
1888static stmt_ty
1889global_stmt_rule(Parser *p)
1890{
1891 if (p->error_indicator) {
1892 return NULL;
1893 }
1894 stmt_ty res = NULL;
1895 int mark = p->mark;
1896 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1897 p->error_indicator = 1;
1898 return NULL;
1899 }
1900 int start_lineno = p->tokens[mark]->lineno;
1901 UNUSED(start_lineno); // Only used by EXTRA macro
1902 int start_col_offset = p->tokens[mark]->col_offset;
1903 UNUSED(start_col_offset); // Only used by EXTRA macro
1904 { // 'global' ','.NAME+
1905 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001906 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001907 if (
1908 (keyword = _PyPegen_expect_token(p, 508))
1909 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001910 (a = _gather_25_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001911 )
1912 {
1913 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1914 if (token == NULL) {
1915 return NULL;
1916 }
1917 int end_lineno = token->end_lineno;
1918 UNUSED(end_lineno); // Only used by EXTRA macro
1919 int end_col_offset = token->end_col_offset;
1920 UNUSED(end_col_offset); // Only used by EXTRA macro
1921 res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
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 res = NULL;
1931 done:
1932 return res;
1933}
1934
1935// nonlocal_stmt: 'nonlocal' ','.NAME+
1936static stmt_ty
1937nonlocal_stmt_rule(Parser *p)
1938{
1939 if (p->error_indicator) {
1940 return NULL;
1941 }
1942 stmt_ty res = NULL;
1943 int mark = p->mark;
1944 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1945 p->error_indicator = 1;
1946 return NULL;
1947 }
1948 int start_lineno = p->tokens[mark]->lineno;
1949 UNUSED(start_lineno); // Only used by EXTRA macro
1950 int start_col_offset = p->tokens[mark]->col_offset;
1951 UNUSED(start_col_offset); // Only used by EXTRA macro
1952 { // 'nonlocal' ','.NAME+
1953 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01001954 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001955 if (
1956 (keyword = _PyPegen_expect_token(p, 509))
1957 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07001958 (a = _gather_27_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01001959 )
1960 {
1961 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
1962 if (token == NULL) {
1963 return NULL;
1964 }
1965 int end_lineno = token->end_lineno;
1966 UNUSED(end_lineno); // Only used by EXTRA macro
1967 int end_col_offset = token->end_col_offset;
1968 UNUSED(end_col_offset); // Only used by EXTRA macro
1969 res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
1970 if (res == NULL && PyErr_Occurred()) {
1971 p->error_indicator = 1;
1972 return NULL;
1973 }
1974 goto done;
1975 }
1976 p->mark = mark;
1977 }
1978 res = NULL;
1979 done:
1980 return res;
1981}
1982
1983// yield_stmt: yield_expr
1984static stmt_ty
1985yield_stmt_rule(Parser *p)
1986{
1987 if (p->error_indicator) {
1988 return NULL;
1989 }
1990 stmt_ty res = NULL;
1991 int mark = p->mark;
1992 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1993 p->error_indicator = 1;
1994 return NULL;
1995 }
1996 int start_lineno = p->tokens[mark]->lineno;
1997 UNUSED(start_lineno); // Only used by EXTRA macro
1998 int start_col_offset = p->tokens[mark]->col_offset;
1999 UNUSED(start_col_offset); // Only used by EXTRA macro
2000 { // yield_expr
2001 expr_ty y;
2002 if (
2003 (y = yield_expr_rule(p))
2004 )
2005 {
2006 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2007 if (token == NULL) {
2008 return NULL;
2009 }
2010 int end_lineno = token->end_lineno;
2011 UNUSED(end_lineno); // Only used by EXTRA macro
2012 int end_col_offset = token->end_col_offset;
2013 UNUSED(end_col_offset); // Only used by EXTRA macro
2014 res = _Py_Expr ( y , EXTRA );
2015 if (res == NULL && PyErr_Occurred()) {
2016 p->error_indicator = 1;
2017 return NULL;
2018 }
2019 goto done;
2020 }
2021 p->mark = mark;
2022 }
2023 res = NULL;
2024 done:
2025 return res;
2026}
2027
2028// assert_stmt: 'assert' expression [',' expression]
2029static stmt_ty
2030assert_stmt_rule(Parser *p)
2031{
2032 if (p->error_indicator) {
2033 return NULL;
2034 }
2035 stmt_ty res = NULL;
2036 int mark = p->mark;
2037 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2038 p->error_indicator = 1;
2039 return NULL;
2040 }
2041 int start_lineno = p->tokens[mark]->lineno;
2042 UNUSED(start_lineno); // Only used by EXTRA macro
2043 int start_col_offset = p->tokens[mark]->col_offset;
2044 UNUSED(start_col_offset); // Only used by EXTRA macro
2045 { // 'assert' expression [',' expression]
2046 expr_ty a;
2047 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002048 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002049 if (
2050 (keyword = _PyPegen_expect_token(p, 505))
2051 &&
2052 (a = expression_rule(p))
2053 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002054 (b = _tmp_29_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002055 )
2056 {
2057 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2058 if (token == NULL) {
2059 return NULL;
2060 }
2061 int end_lineno = token->end_lineno;
2062 UNUSED(end_lineno); // Only used by EXTRA macro
2063 int end_col_offset = token->end_col_offset;
2064 UNUSED(end_col_offset); // Only used by EXTRA macro
2065 res = _Py_Assert ( a , b , EXTRA );
2066 if (res == NULL && PyErr_Occurred()) {
2067 p->error_indicator = 1;
2068 return NULL;
2069 }
2070 goto done;
2071 }
2072 p->mark = mark;
2073 }
2074 res = NULL;
2075 done:
2076 return res;
2077}
2078
2079// del_stmt: 'del' del_targets
2080static stmt_ty
2081del_stmt_rule(Parser *p)
2082{
2083 if (p->error_indicator) {
2084 return NULL;
2085 }
2086 stmt_ty res = NULL;
2087 int mark = p->mark;
2088 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2089 p->error_indicator = 1;
2090 return NULL;
2091 }
2092 int start_lineno = p->tokens[mark]->lineno;
2093 UNUSED(start_lineno); // Only used by EXTRA macro
2094 int start_col_offset = p->tokens[mark]->col_offset;
2095 UNUSED(start_col_offset); // Only used by EXTRA macro
2096 { // 'del' del_targets
2097 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002098 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002099 if (
2100 (keyword = _PyPegen_expect_token(p, 503))
2101 &&
2102 (a = del_targets_rule(p))
2103 )
2104 {
2105 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2106 if (token == NULL) {
2107 return NULL;
2108 }
2109 int end_lineno = token->end_lineno;
2110 UNUSED(end_lineno); // Only used by EXTRA macro
2111 int end_col_offset = token->end_col_offset;
2112 UNUSED(end_col_offset); // Only used by EXTRA macro
2113 res = _Py_Delete ( a , EXTRA );
2114 if (res == NULL && PyErr_Occurred()) {
2115 p->error_indicator = 1;
2116 return NULL;
2117 }
2118 goto done;
2119 }
2120 p->mark = mark;
2121 }
2122 res = NULL;
2123 done:
2124 return res;
2125}
2126
2127// import_stmt: import_name | import_from
2128static stmt_ty
2129import_stmt_rule(Parser *p)
2130{
2131 if (p->error_indicator) {
2132 return NULL;
2133 }
2134 stmt_ty res = NULL;
2135 int mark = p->mark;
2136 { // import_name
2137 stmt_ty import_name_var;
2138 if (
2139 (import_name_var = import_name_rule(p))
2140 )
2141 {
2142 res = import_name_var;
2143 goto done;
2144 }
2145 p->mark = mark;
2146 }
2147 { // import_from
2148 stmt_ty import_from_var;
2149 if (
2150 (import_from_var = import_from_rule(p))
2151 )
2152 {
2153 res = import_from_var;
2154 goto done;
2155 }
2156 p->mark = mark;
2157 }
2158 res = NULL;
2159 done:
2160 return res;
2161}
2162
2163// import_name: 'import' dotted_as_names
2164static stmt_ty
2165import_name_rule(Parser *p)
2166{
2167 if (p->error_indicator) {
2168 return NULL;
2169 }
2170 stmt_ty res = NULL;
2171 int mark = p->mark;
2172 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2173 p->error_indicator = 1;
2174 return NULL;
2175 }
2176 int start_lineno = p->tokens[mark]->lineno;
2177 UNUSED(start_lineno); // Only used by EXTRA macro
2178 int start_col_offset = p->tokens[mark]->col_offset;
2179 UNUSED(start_col_offset); // Only used by EXTRA macro
2180 { // 'import' dotted_as_names
2181 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002182 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002183 if (
2184 (keyword = _PyPegen_expect_token(p, 513))
2185 &&
2186 (a = dotted_as_names_rule(p))
2187 )
2188 {
2189 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2190 if (token == NULL) {
2191 return NULL;
2192 }
2193 int end_lineno = token->end_lineno;
2194 UNUSED(end_lineno); // Only used by EXTRA macro
2195 int end_col_offset = token->end_col_offset;
2196 UNUSED(end_col_offset); // Only used by EXTRA macro
2197 res = _Py_Import ( a , EXTRA );
2198 if (res == NULL && PyErr_Occurred()) {
2199 p->error_indicator = 1;
2200 return NULL;
2201 }
2202 goto done;
2203 }
2204 p->mark = mark;
2205 }
2206 res = NULL;
2207 done:
2208 return res;
2209}
2210
2211// import_from:
2212// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
2213// | 'from' (('.' | '...'))+ 'import' import_from_targets
2214static stmt_ty
2215import_from_rule(Parser *p)
2216{
2217 if (p->error_indicator) {
2218 return NULL;
2219 }
2220 stmt_ty res = NULL;
2221 int mark = p->mark;
2222 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2223 p->error_indicator = 1;
2224 return NULL;
2225 }
2226 int start_lineno = p->tokens[mark]->lineno;
2227 UNUSED(start_lineno); // Only used by EXTRA macro
2228 int start_col_offset = p->tokens[mark]->col_offset;
2229 UNUSED(start_col_offset); // Only used by EXTRA macro
2230 { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
2231 asdl_seq * a;
2232 expr_ty b;
2233 asdl_seq* c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002234 Token * keyword;
2235 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002236 if (
2237 (keyword = _PyPegen_expect_token(p, 514))
2238 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002239 (a = _loop0_30_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002240 &&
2241 (b = dotted_name_rule(p))
2242 &&
2243 (keyword_1 = _PyPegen_expect_token(p, 513))
2244 &&
2245 (c = import_from_targets_rule(p))
2246 )
2247 {
2248 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2249 if (token == NULL) {
2250 return NULL;
2251 }
2252 int end_lineno = token->end_lineno;
2253 UNUSED(end_lineno); // Only used by EXTRA macro
2254 int end_col_offset = token->end_col_offset;
2255 UNUSED(end_col_offset); // Only used by EXTRA macro
2256 res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
2257 if (res == NULL && PyErr_Occurred()) {
2258 p->error_indicator = 1;
2259 return NULL;
2260 }
2261 goto done;
2262 }
2263 p->mark = mark;
2264 }
2265 { // 'from' (('.' | '...'))+ 'import' import_from_targets
2266 asdl_seq * a;
2267 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002268 Token * keyword;
2269 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002270 if (
2271 (keyword = _PyPegen_expect_token(p, 514))
2272 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002273 (a = _loop1_31_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002274 &&
2275 (keyword_1 = _PyPegen_expect_token(p, 513))
2276 &&
2277 (b = import_from_targets_rule(p))
2278 )
2279 {
2280 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2281 if (token == NULL) {
2282 return NULL;
2283 }
2284 int end_lineno = token->end_lineno;
2285 UNUSED(end_lineno); // Only used by EXTRA macro
2286 int end_col_offset = token->end_col_offset;
2287 UNUSED(end_col_offset); // Only used by EXTRA macro
2288 res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
2289 if (res == NULL && PyErr_Occurred()) {
2290 p->error_indicator = 1;
2291 return NULL;
2292 }
2293 goto done;
2294 }
2295 p->mark = mark;
2296 }
2297 res = NULL;
2298 done:
2299 return res;
2300}
2301
2302// import_from_targets: '(' import_from_as_names ','? ')' | import_from_as_names | '*'
2303static asdl_seq*
2304import_from_targets_rule(Parser *p)
2305{
2306 if (p->error_indicator) {
2307 return NULL;
2308 }
2309 asdl_seq* res = NULL;
2310 int mark = p->mark;
2311 { // '(' import_from_as_names ','? ')'
2312 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002313 Token * literal;
2314 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002315 void *opt_var;
2316 UNUSED(opt_var); // Silence compiler warnings
2317 if (
2318 (literal = _PyPegen_expect_token(p, 7))
2319 &&
2320 (a = import_from_as_names_rule(p))
2321 &&
2322 (opt_var = _PyPegen_expect_token(p, 12), 1)
2323 &&
2324 (literal_1 = _PyPegen_expect_token(p, 8))
2325 )
2326 {
2327 res = a;
2328 if (res == NULL && PyErr_Occurred()) {
2329 p->error_indicator = 1;
2330 return NULL;
2331 }
2332 goto done;
2333 }
2334 p->mark = mark;
2335 }
2336 { // import_from_as_names
2337 asdl_seq* import_from_as_names_var;
2338 if (
2339 (import_from_as_names_var = import_from_as_names_rule(p))
2340 )
2341 {
2342 res = import_from_as_names_var;
2343 goto done;
2344 }
2345 p->mark = mark;
2346 }
2347 { // '*'
Pablo Galindob796b3f2020-05-01 12:32:26 +01002348 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002349 if (
2350 (literal = _PyPegen_expect_token(p, 16))
2351 )
2352 {
2353 res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
2354 if (res == NULL && PyErr_Occurred()) {
2355 p->error_indicator = 1;
2356 return NULL;
2357 }
2358 goto done;
2359 }
2360 p->mark = mark;
2361 }
2362 res = NULL;
2363 done:
2364 return res;
2365}
2366
2367// import_from_as_names: ','.import_from_as_name+
2368static asdl_seq*
2369import_from_as_names_rule(Parser *p)
2370{
2371 if (p->error_indicator) {
2372 return NULL;
2373 }
2374 asdl_seq* res = NULL;
2375 int mark = p->mark;
2376 { // ','.import_from_as_name+
2377 asdl_seq * a;
2378 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07002379 (a = _gather_32_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002380 )
2381 {
2382 res = a;
2383 if (res == NULL && PyErr_Occurred()) {
2384 p->error_indicator = 1;
2385 return NULL;
2386 }
2387 goto done;
2388 }
2389 p->mark = mark;
2390 }
2391 res = NULL;
2392 done:
2393 return res;
2394}
2395
2396// import_from_as_name: NAME ['as' NAME]
2397static alias_ty
2398import_from_as_name_rule(Parser *p)
2399{
2400 if (p->error_indicator) {
2401 return NULL;
2402 }
2403 alias_ty res = NULL;
2404 int mark = p->mark;
2405 { // NAME ['as' NAME]
2406 expr_ty a;
2407 void *b;
2408 if (
2409 (a = _PyPegen_name_token(p))
2410 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002411 (b = _tmp_34_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002412 )
2413 {
2414 res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
2415 if (res == NULL && PyErr_Occurred()) {
2416 p->error_indicator = 1;
2417 return NULL;
2418 }
2419 goto done;
2420 }
2421 p->mark = mark;
2422 }
2423 res = NULL;
2424 done:
2425 return res;
2426}
2427
2428// dotted_as_names: ','.dotted_as_name+
2429static asdl_seq*
2430dotted_as_names_rule(Parser *p)
2431{
2432 if (p->error_indicator) {
2433 return NULL;
2434 }
2435 asdl_seq* res = NULL;
2436 int mark = p->mark;
2437 { // ','.dotted_as_name+
2438 asdl_seq * a;
2439 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07002440 (a = _gather_35_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002441 )
2442 {
2443 res = a;
2444 if (res == NULL && PyErr_Occurred()) {
2445 p->error_indicator = 1;
2446 return NULL;
2447 }
2448 goto done;
2449 }
2450 p->mark = mark;
2451 }
2452 res = NULL;
2453 done:
2454 return res;
2455}
2456
2457// dotted_as_name: dotted_name ['as' NAME]
2458static alias_ty
2459dotted_as_name_rule(Parser *p)
2460{
2461 if (p->error_indicator) {
2462 return NULL;
2463 }
2464 alias_ty res = NULL;
2465 int mark = p->mark;
2466 { // dotted_name ['as' NAME]
2467 expr_ty a;
2468 void *b;
2469 if (
2470 (a = dotted_name_rule(p))
2471 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002472 (b = _tmp_37_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002473 )
2474 {
2475 res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
2476 if (res == NULL && PyErr_Occurred()) {
2477 p->error_indicator = 1;
2478 return NULL;
2479 }
2480 goto done;
2481 }
2482 p->mark = mark;
2483 }
2484 res = NULL;
2485 done:
2486 return res;
2487}
2488
2489// Left-recursive
2490// dotted_name: dotted_name '.' NAME | NAME
2491static expr_ty dotted_name_raw(Parser *);
2492static expr_ty
2493dotted_name_rule(Parser *p)
2494{
2495 expr_ty res = NULL;
2496 if (_PyPegen_is_memoized(p, dotted_name_type, &res))
2497 return res;
2498 int mark = p->mark;
2499 int resmark = p->mark;
2500 while (1) {
2501 int tmpvar_0 = _PyPegen_update_memo(p, mark, dotted_name_type, res);
2502 if (tmpvar_0) {
2503 return res;
2504 }
2505 p->mark = mark;
2506 void *raw = dotted_name_raw(p);
2507 if (raw == NULL || p->mark <= resmark)
2508 break;
2509 resmark = p->mark;
2510 res = raw;
2511 }
2512 p->mark = resmark;
2513 return res;
2514}
2515static expr_ty
2516dotted_name_raw(Parser *p)
2517{
2518 if (p->error_indicator) {
2519 return NULL;
2520 }
2521 expr_ty res = NULL;
2522 int mark = p->mark;
2523 { // dotted_name '.' NAME
2524 expr_ty a;
2525 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002526 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002527 if (
2528 (a = dotted_name_rule(p))
2529 &&
2530 (literal = _PyPegen_expect_token(p, 23))
2531 &&
2532 (b = _PyPegen_name_token(p))
2533 )
2534 {
2535 res = _PyPegen_join_names_with_dot ( p , a , b );
2536 if (res == NULL && PyErr_Occurred()) {
2537 p->error_indicator = 1;
2538 return NULL;
2539 }
2540 goto done;
2541 }
2542 p->mark = mark;
2543 }
2544 { // NAME
2545 expr_ty name_var;
2546 if (
2547 (name_var = _PyPegen_name_token(p))
2548 )
2549 {
2550 res = name_var;
2551 goto done;
2552 }
2553 p->mark = mark;
2554 }
2555 res = NULL;
2556 done:
2557 return res;
2558}
2559
2560// if_stmt:
2561// | 'if' named_expression ':' block elif_stmt
2562// | 'if' named_expression ':' block else_block?
2563static stmt_ty
2564if_stmt_rule(Parser *p)
2565{
2566 if (p->error_indicator) {
2567 return NULL;
2568 }
2569 stmt_ty res = NULL;
2570 int mark = p->mark;
2571 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2572 p->error_indicator = 1;
2573 return NULL;
2574 }
2575 int start_lineno = p->tokens[mark]->lineno;
2576 UNUSED(start_lineno); // Only used by EXTRA macro
2577 int start_col_offset = p->tokens[mark]->col_offset;
2578 UNUSED(start_col_offset); // Only used by EXTRA macro
2579 { // 'if' named_expression ':' block elif_stmt
2580 expr_ty a;
2581 asdl_seq* b;
2582 stmt_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002583 Token * keyword;
2584 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002585 if (
2586 (keyword = _PyPegen_expect_token(p, 510))
2587 &&
2588 (a = named_expression_rule(p))
2589 &&
2590 (literal = _PyPegen_expect_token(p, 11))
2591 &&
2592 (b = block_rule(p))
2593 &&
2594 (c = elif_stmt_rule(p))
2595 )
2596 {
2597 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2598 if (token == NULL) {
2599 return NULL;
2600 }
2601 int end_lineno = token->end_lineno;
2602 UNUSED(end_lineno); // Only used by EXTRA macro
2603 int end_col_offset = token->end_col_offset;
2604 UNUSED(end_col_offset); // Only used by EXTRA macro
2605 res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
2606 if (res == NULL && PyErr_Occurred()) {
2607 p->error_indicator = 1;
2608 return NULL;
2609 }
2610 goto done;
2611 }
2612 p->mark = mark;
2613 }
2614 { // 'if' named_expression ':' block else_block?
2615 expr_ty a;
2616 asdl_seq* b;
2617 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002618 Token * keyword;
2619 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002620 if (
2621 (keyword = _PyPegen_expect_token(p, 510))
2622 &&
2623 (a = named_expression_rule(p))
2624 &&
2625 (literal = _PyPegen_expect_token(p, 11))
2626 &&
2627 (b = block_rule(p))
2628 &&
2629 (c = else_block_rule(p), 1)
2630 )
2631 {
2632 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2633 if (token == NULL) {
2634 return NULL;
2635 }
2636 int end_lineno = token->end_lineno;
2637 UNUSED(end_lineno); // Only used by EXTRA macro
2638 int end_col_offset = token->end_col_offset;
2639 UNUSED(end_col_offset); // Only used by EXTRA macro
2640 res = _Py_If ( a , b , c , EXTRA );
2641 if (res == NULL && PyErr_Occurred()) {
2642 p->error_indicator = 1;
2643 return NULL;
2644 }
2645 goto done;
2646 }
2647 p->mark = mark;
2648 }
2649 res = NULL;
2650 done:
2651 return res;
2652}
2653
2654// elif_stmt:
2655// | 'elif' named_expression ':' block elif_stmt
2656// | 'elif' named_expression ':' block else_block?
2657static stmt_ty
2658elif_stmt_rule(Parser *p)
2659{
2660 if (p->error_indicator) {
2661 return NULL;
2662 }
2663 stmt_ty res = NULL;
2664 int mark = p->mark;
2665 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2666 p->error_indicator = 1;
2667 return NULL;
2668 }
2669 int start_lineno = p->tokens[mark]->lineno;
2670 UNUSED(start_lineno); // Only used by EXTRA macro
2671 int start_col_offset = p->tokens[mark]->col_offset;
2672 UNUSED(start_col_offset); // Only used by EXTRA macro
2673 { // 'elif' named_expression ':' block elif_stmt
2674 expr_ty a;
2675 asdl_seq* b;
2676 stmt_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002677 Token * keyword;
2678 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002679 if (
2680 (keyword = _PyPegen_expect_token(p, 515))
2681 &&
2682 (a = named_expression_rule(p))
2683 &&
2684 (literal = _PyPegen_expect_token(p, 11))
2685 &&
2686 (b = block_rule(p))
2687 &&
2688 (c = elif_stmt_rule(p))
2689 )
2690 {
2691 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2692 if (token == NULL) {
2693 return NULL;
2694 }
2695 int end_lineno = token->end_lineno;
2696 UNUSED(end_lineno); // Only used by EXTRA macro
2697 int end_col_offset = token->end_col_offset;
2698 UNUSED(end_col_offset); // Only used by EXTRA macro
2699 res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
2700 if (res == NULL && PyErr_Occurred()) {
2701 p->error_indicator = 1;
2702 return NULL;
2703 }
2704 goto done;
2705 }
2706 p->mark = mark;
2707 }
2708 { // 'elif' named_expression ':' block else_block?
2709 expr_ty a;
2710 asdl_seq* b;
2711 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002712 Token * keyword;
2713 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002714 if (
2715 (keyword = _PyPegen_expect_token(p, 515))
2716 &&
2717 (a = named_expression_rule(p))
2718 &&
2719 (literal = _PyPegen_expect_token(p, 11))
2720 &&
2721 (b = block_rule(p))
2722 &&
2723 (c = else_block_rule(p), 1)
2724 )
2725 {
2726 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2727 if (token == NULL) {
2728 return NULL;
2729 }
2730 int end_lineno = token->end_lineno;
2731 UNUSED(end_lineno); // Only used by EXTRA macro
2732 int end_col_offset = token->end_col_offset;
2733 UNUSED(end_col_offset); // Only used by EXTRA macro
2734 res = _Py_If ( a , b , c , EXTRA );
2735 if (res == NULL && PyErr_Occurred()) {
2736 p->error_indicator = 1;
2737 return NULL;
2738 }
2739 goto done;
2740 }
2741 p->mark = mark;
2742 }
2743 res = NULL;
2744 done:
2745 return res;
2746}
2747
2748// else_block: 'else' ':' block
2749static asdl_seq*
2750else_block_rule(Parser *p)
2751{
2752 if (p->error_indicator) {
2753 return NULL;
2754 }
2755 asdl_seq* res = NULL;
2756 int mark = p->mark;
2757 { // 'else' ':' block
2758 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002759 Token * keyword;
2760 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002761 if (
2762 (keyword = _PyPegen_expect_token(p, 516))
2763 &&
2764 (literal = _PyPegen_expect_token(p, 11))
2765 &&
2766 (b = block_rule(p))
2767 )
2768 {
2769 res = b;
2770 if (res == NULL && PyErr_Occurred()) {
2771 p->error_indicator = 1;
2772 return NULL;
2773 }
2774 goto done;
2775 }
2776 p->mark = mark;
2777 }
2778 res = NULL;
2779 done:
2780 return res;
2781}
2782
2783// while_stmt: 'while' named_expression ':' block else_block?
2784static stmt_ty
2785while_stmt_rule(Parser *p)
2786{
2787 if (p->error_indicator) {
2788 return NULL;
2789 }
2790 stmt_ty res = NULL;
2791 int mark = p->mark;
2792 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2793 p->error_indicator = 1;
2794 return NULL;
2795 }
2796 int start_lineno = p->tokens[mark]->lineno;
2797 UNUSED(start_lineno); // Only used by EXTRA macro
2798 int start_col_offset = p->tokens[mark]->col_offset;
2799 UNUSED(start_col_offset); // Only used by EXTRA macro
2800 { // 'while' named_expression ':' block else_block?
2801 expr_ty a;
2802 asdl_seq* b;
2803 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002804 Token * keyword;
2805 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002806 if (
2807 (keyword = _PyPegen_expect_token(p, 512))
2808 &&
2809 (a = named_expression_rule(p))
2810 &&
2811 (literal = _PyPegen_expect_token(p, 11))
2812 &&
2813 (b = block_rule(p))
2814 &&
2815 (c = else_block_rule(p), 1)
2816 )
2817 {
2818 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2819 if (token == NULL) {
2820 return NULL;
2821 }
2822 int end_lineno = token->end_lineno;
2823 UNUSED(end_lineno); // Only used by EXTRA macro
2824 int end_col_offset = token->end_col_offset;
2825 UNUSED(end_col_offset); // Only used by EXTRA macro
2826 res = _Py_While ( a , b , c , EXTRA );
2827 if (res == NULL && PyErr_Occurred()) {
2828 p->error_indicator = 1;
2829 return NULL;
2830 }
2831 goto done;
2832 }
2833 p->mark = mark;
2834 }
2835 res = NULL;
2836 done:
2837 return res;
2838}
2839
Guido van Rossumc001c092020-04-30 12:12:19 -07002840// for_stmt:
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002841// | 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
2842// | ASYNC 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002843static stmt_ty
2844for_stmt_rule(Parser *p)
2845{
2846 if (p->error_indicator) {
2847 return NULL;
2848 }
2849 stmt_ty res = NULL;
2850 int mark = p->mark;
2851 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2852 p->error_indicator = 1;
2853 return NULL;
2854 }
2855 int start_lineno = p->tokens[mark]->lineno;
2856 UNUSED(start_lineno); // Only used by EXTRA macro
2857 int start_col_offset = p->tokens[mark]->col_offset;
2858 UNUSED(start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002859 { // 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002860 asdl_seq* b;
2861 void *el;
2862 expr_ty ex;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002863 Token * keyword;
2864 Token * keyword_1;
2865 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002866 expr_ty t;
Guido van Rossumc001c092020-04-30 12:12:19 -07002867 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002868 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002869 (keyword = _PyPegen_expect_token(p, 517))
2870 &&
2871 (t = star_targets_rule(p))
2872 &&
2873 (keyword_1 = _PyPegen_expect_token(p, 518))
2874 &&
2875 (ex = star_expressions_rule(p))
2876 &&
2877 (literal = _PyPegen_expect_token(p, 11))
2878 &&
2879 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
2880 &&
2881 (b = block_rule(p))
2882 &&
2883 (el = else_block_rule(p), 1)
2884 )
2885 {
2886 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2887 if (token == NULL) {
2888 return NULL;
2889 }
2890 int end_lineno = token->end_lineno;
2891 UNUSED(end_lineno); // Only used by EXTRA macro
2892 int end_col_offset = token->end_col_offset;
2893 UNUSED(end_col_offset); // Only used by EXTRA macro
2894 res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
2895 if (res == NULL && PyErr_Occurred()) {
2896 p->error_indicator = 1;
2897 return NULL;
2898 }
2899 goto done;
2900 }
2901 p->mark = mark;
2902 }
2903 { // ASYNC 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindob796b3f2020-05-01 12:32:26 +01002904 Token * async_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002905 asdl_seq* b;
2906 void *el;
2907 expr_ty ex;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002908 Token * keyword;
2909 Token * keyword_1;
2910 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002911 expr_ty t;
2912 void *tc;
2913 if (
2914 (async_var = _PyPegen_expect_token(p, ASYNC))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002915 &&
2916 (keyword = _PyPegen_expect_token(p, 517))
2917 &&
2918 (t = star_targets_rule(p))
2919 &&
2920 (keyword_1 = _PyPegen_expect_token(p, 518))
2921 &&
2922 (ex = star_expressions_rule(p))
2923 &&
2924 (literal = _PyPegen_expect_token(p, 11))
2925 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002926 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
2927 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002928 (b = block_rule(p))
2929 &&
2930 (el = else_block_rule(p), 1)
2931 )
2932 {
2933 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2934 if (token == NULL) {
2935 return NULL;
2936 }
2937 int end_lineno = token->end_lineno;
2938 UNUSED(end_lineno); // Only used by EXTRA macro
2939 int end_col_offset = token->end_col_offset;
2940 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002941 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 +01002942 if (res == NULL && PyErr_Occurred()) {
2943 p->error_indicator = 1;
2944 return NULL;
2945 }
2946 goto done;
2947 }
2948 p->mark = mark;
2949 }
2950 res = NULL;
2951 done:
2952 return res;
2953}
2954
2955// with_stmt:
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002956// | 'with' '(' ','.with_item+ ')' ':' block
2957// | 'with' ','.with_item+ ':' TYPE_COMMENT? block
2958// | ASYNC 'with' '(' ','.with_item+ ')' ':' block
2959// | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002960static stmt_ty
2961with_stmt_rule(Parser *p)
2962{
2963 if (p->error_indicator) {
2964 return NULL;
2965 }
2966 stmt_ty res = NULL;
2967 int mark = p->mark;
2968 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2969 p->error_indicator = 1;
2970 return NULL;
2971 }
2972 int start_lineno = p->tokens[mark]->lineno;
2973 UNUSED(start_lineno); // Only used by EXTRA macro
2974 int start_col_offset = p->tokens[mark]->col_offset;
2975 UNUSED(start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03002976 { // 'with' '(' ','.with_item+ ')' ':' block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002977 asdl_seq * a;
2978 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01002979 Token * keyword;
2980 Token * literal;
2981 Token * literal_1;
2982 Token * literal_2;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002983 if (
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002984 (keyword = _PyPegen_expect_token(p, 519))
2985 &&
2986 (literal = _PyPegen_expect_token(p, 7))
2987 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07002988 (a = _gather_38_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01002989 &&
2990 (literal_1 = _PyPegen_expect_token(p, 8))
2991 &&
2992 (literal_2 = _PyPegen_expect_token(p, 11))
2993 &&
2994 (b = block_rule(p))
2995 )
2996 {
2997 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
2998 if (token == NULL) {
2999 return NULL;
3000 }
3001 int end_lineno = token->end_lineno;
3002 UNUSED(end_lineno); // Only used by EXTRA macro
3003 int end_col_offset = token->end_col_offset;
3004 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003005 res = _Py_With ( a , b , NULL , EXTRA );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003006 if (res == NULL && PyErr_Occurred()) {
3007 p->error_indicator = 1;
3008 return NULL;
3009 }
3010 goto done;
3011 }
3012 p->mark = mark;
3013 }
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003014 { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003015 asdl_seq * a;
3016 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003017 Token * keyword;
3018 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07003019 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003020 if (
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003021 (keyword = _PyPegen_expect_token(p, 519))
3022 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003023 (a = _gather_40_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003024 &&
3025 (literal = _PyPegen_expect_token(p, 11))
3026 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003027 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
3028 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003029 (b = block_rule(p))
3030 )
3031 {
3032 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3033 if (token == NULL) {
3034 return NULL;
3035 }
3036 int end_lineno = token->end_lineno;
3037 UNUSED(end_lineno); // Only used by EXTRA macro
3038 int end_col_offset = token->end_col_offset;
3039 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003040 res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
3041 if (res == NULL && PyErr_Occurred()) {
3042 p->error_indicator = 1;
3043 return NULL;
3044 }
3045 goto done;
3046 }
3047 p->mark = mark;
3048 }
3049 { // ASYNC 'with' '(' ','.with_item+ ')' ':' block
3050 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003051 Token * async_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003052 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003053 Token * keyword;
3054 Token * literal;
3055 Token * literal_1;
3056 Token * literal_2;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003057 if (
3058 (async_var = _PyPegen_expect_token(p, ASYNC))
3059 &&
3060 (keyword = _PyPegen_expect_token(p, 519))
3061 &&
3062 (literal = _PyPegen_expect_token(p, 7))
3063 &&
3064 (a = _gather_42_rule(p))
3065 &&
3066 (literal_1 = _PyPegen_expect_token(p, 8))
3067 &&
3068 (literal_2 = _PyPegen_expect_token(p, 11))
3069 &&
3070 (b = block_rule(p))
3071 )
3072 {
3073 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3074 if (token == NULL) {
3075 return NULL;
3076 }
3077 int end_lineno = token->end_lineno;
3078 UNUSED(end_lineno); // Only used by EXTRA macro
3079 int end_col_offset = token->end_col_offset;
3080 UNUSED(end_col_offset); // Only used by EXTRA macro
3081 res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) );
3082 if (res == NULL && PyErr_Occurred()) {
3083 p->error_indicator = 1;
3084 return NULL;
3085 }
3086 goto done;
3087 }
3088 p->mark = mark;
3089 }
3090 { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
3091 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003092 Token * async_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003093 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003094 Token * keyword;
3095 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003096 void *tc;
3097 if (
3098 (async_var = _PyPegen_expect_token(p, ASYNC))
3099 &&
3100 (keyword = _PyPegen_expect_token(p, 519))
3101 &&
3102 (a = _gather_44_rule(p))
3103 &&
3104 (literal = _PyPegen_expect_token(p, 11))
3105 &&
3106 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
3107 &&
3108 (b = block_rule(p))
3109 )
3110 {
3111 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3112 if (token == NULL) {
3113 return NULL;
3114 }
3115 int end_lineno = token->end_lineno;
3116 UNUSED(end_lineno); // Only used by EXTRA macro
3117 int end_col_offset = token->end_col_offset;
3118 UNUSED(end_col_offset); // Only used by EXTRA macro
3119 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 +01003120 if (res == NULL && PyErr_Occurred()) {
3121 p->error_indicator = 1;
3122 return NULL;
3123 }
3124 goto done;
3125 }
3126 p->mark = mark;
3127 }
3128 res = NULL;
3129 done:
3130 return res;
3131}
3132
3133// with_item: expression ['as' target]
3134static withitem_ty
3135with_item_rule(Parser *p)
3136{
3137 if (p->error_indicator) {
3138 return NULL;
3139 }
3140 withitem_ty res = NULL;
3141 int mark = p->mark;
3142 { // expression ['as' target]
3143 expr_ty e;
3144 void *o;
3145 if (
3146 (e = expression_rule(p))
3147 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003148 (o = _tmp_46_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003149 )
3150 {
3151 res = _Py_withitem ( e , o , p -> arena );
3152 if (res == NULL && PyErr_Occurred()) {
3153 p->error_indicator = 1;
3154 return NULL;
3155 }
3156 goto done;
3157 }
3158 p->mark = mark;
3159 }
3160 res = NULL;
3161 done:
3162 return res;
3163}
3164
3165// try_stmt:
3166// | 'try' ':' block finally_block
3167// | 'try' ':' block except_block+ else_block? finally_block?
3168static stmt_ty
3169try_stmt_rule(Parser *p)
3170{
3171 if (p->error_indicator) {
3172 return NULL;
3173 }
3174 stmt_ty res = NULL;
3175 int mark = p->mark;
3176 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3177 p->error_indicator = 1;
3178 return NULL;
3179 }
3180 int start_lineno = p->tokens[mark]->lineno;
3181 UNUSED(start_lineno); // Only used by EXTRA macro
3182 int start_col_offset = p->tokens[mark]->col_offset;
3183 UNUSED(start_col_offset); // Only used by EXTRA macro
3184 { // 'try' ':' block finally_block
3185 asdl_seq* b;
3186 asdl_seq* f;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003187 Token * keyword;
3188 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003189 if (
3190 (keyword = _PyPegen_expect_token(p, 511))
3191 &&
3192 (literal = _PyPegen_expect_token(p, 11))
3193 &&
3194 (b = block_rule(p))
3195 &&
3196 (f = finally_block_rule(p))
3197 )
3198 {
3199 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3200 if (token == NULL) {
3201 return NULL;
3202 }
3203 int end_lineno = token->end_lineno;
3204 UNUSED(end_lineno); // Only used by EXTRA macro
3205 int end_col_offset = token->end_col_offset;
3206 UNUSED(end_col_offset); // Only used by EXTRA macro
3207 res = _Py_Try ( b , NULL , NULL , f , EXTRA );
3208 if (res == NULL && PyErr_Occurred()) {
3209 p->error_indicator = 1;
3210 return NULL;
3211 }
3212 goto done;
3213 }
3214 p->mark = mark;
3215 }
3216 { // 'try' ':' block except_block+ else_block? finally_block?
3217 asdl_seq* b;
3218 void *el;
3219 asdl_seq * ex;
3220 void *f;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003221 Token * keyword;
3222 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003223 if (
3224 (keyword = _PyPegen_expect_token(p, 511))
3225 &&
3226 (literal = _PyPegen_expect_token(p, 11))
3227 &&
3228 (b = block_rule(p))
3229 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003230 (ex = _loop1_47_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003231 &&
3232 (el = else_block_rule(p), 1)
3233 &&
3234 (f = finally_block_rule(p), 1)
3235 )
3236 {
3237 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3238 if (token == NULL) {
3239 return NULL;
3240 }
3241 int end_lineno = token->end_lineno;
3242 UNUSED(end_lineno); // Only used by EXTRA macro
3243 int end_col_offset = token->end_col_offset;
3244 UNUSED(end_col_offset); // Only used by EXTRA macro
3245 res = _Py_Try ( b , ex , el , f , EXTRA );
3246 if (res == NULL && PyErr_Occurred()) {
3247 p->error_indicator = 1;
3248 return NULL;
3249 }
3250 goto done;
3251 }
3252 p->mark = mark;
3253 }
3254 res = NULL;
3255 done:
3256 return res;
3257}
3258
3259// except_block: 'except' expression ['as' target] ':' block | 'except' ':' block
3260static excepthandler_ty
3261except_block_rule(Parser *p)
3262{
3263 if (p->error_indicator) {
3264 return NULL;
3265 }
3266 excepthandler_ty res = NULL;
3267 int mark = p->mark;
3268 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3269 p->error_indicator = 1;
3270 return NULL;
3271 }
3272 int start_lineno = p->tokens[mark]->lineno;
3273 UNUSED(start_lineno); // Only used by EXTRA macro
3274 int start_col_offset = p->tokens[mark]->col_offset;
3275 UNUSED(start_col_offset); // Only used by EXTRA macro
3276 { // 'except' expression ['as' target] ':' block
3277 asdl_seq* b;
3278 expr_ty e;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003279 Token * keyword;
3280 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003281 void *t;
3282 if (
3283 (keyword = _PyPegen_expect_token(p, 520))
3284 &&
3285 (e = expression_rule(p))
3286 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003287 (t = _tmp_48_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003288 &&
3289 (literal = _PyPegen_expect_token(p, 11))
3290 &&
3291 (b = block_rule(p))
3292 )
3293 {
3294 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3295 if (token == NULL) {
3296 return NULL;
3297 }
3298 int end_lineno = token->end_lineno;
3299 UNUSED(end_lineno); // Only used by EXTRA macro
3300 int end_col_offset = token->end_col_offset;
3301 UNUSED(end_col_offset); // Only used by EXTRA macro
3302 res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
3303 if (res == NULL && PyErr_Occurred()) {
3304 p->error_indicator = 1;
3305 return NULL;
3306 }
3307 goto done;
3308 }
3309 p->mark = mark;
3310 }
3311 { // 'except' ':' block
3312 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003313 Token * keyword;
3314 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003315 if (
3316 (keyword = _PyPegen_expect_token(p, 520))
3317 &&
3318 (literal = _PyPegen_expect_token(p, 11))
3319 &&
3320 (b = block_rule(p))
3321 )
3322 {
3323 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3324 if (token == NULL) {
3325 return NULL;
3326 }
3327 int end_lineno = token->end_lineno;
3328 UNUSED(end_lineno); // Only used by EXTRA macro
3329 int end_col_offset = token->end_col_offset;
3330 UNUSED(end_col_offset); // Only used by EXTRA macro
3331 res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
3332 if (res == NULL && PyErr_Occurred()) {
3333 p->error_indicator = 1;
3334 return NULL;
3335 }
3336 goto done;
3337 }
3338 p->mark = mark;
3339 }
3340 res = NULL;
3341 done:
3342 return res;
3343}
3344
3345// finally_block: 'finally' ':' block
3346static asdl_seq*
3347finally_block_rule(Parser *p)
3348{
3349 if (p->error_indicator) {
3350 return NULL;
3351 }
3352 asdl_seq* res = NULL;
3353 int mark = p->mark;
3354 { // 'finally' ':' block
3355 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003356 Token * keyword;
3357 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003358 if (
3359 (keyword = _PyPegen_expect_token(p, 521))
3360 &&
3361 (literal = _PyPegen_expect_token(p, 11))
3362 &&
3363 (a = block_rule(p))
3364 )
3365 {
3366 res = a;
3367 if (res == NULL && PyErr_Occurred()) {
3368 p->error_indicator = 1;
3369 return NULL;
3370 }
3371 goto done;
3372 }
3373 p->mark = mark;
3374 }
3375 res = NULL;
3376 done:
3377 return res;
3378}
3379
3380// return_stmt: 'return' star_expressions?
3381static stmt_ty
3382return_stmt_rule(Parser *p)
3383{
3384 if (p->error_indicator) {
3385 return NULL;
3386 }
3387 stmt_ty res = NULL;
3388 int mark = p->mark;
3389 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3390 p->error_indicator = 1;
3391 return NULL;
3392 }
3393 int start_lineno = p->tokens[mark]->lineno;
3394 UNUSED(start_lineno); // Only used by EXTRA macro
3395 int start_col_offset = p->tokens[mark]->col_offset;
3396 UNUSED(start_col_offset); // Only used by EXTRA macro
3397 { // 'return' star_expressions?
3398 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003399 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003400 if (
3401 (keyword = _PyPegen_expect_token(p, 500))
3402 &&
3403 (a = star_expressions_rule(p), 1)
3404 )
3405 {
3406 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3407 if (token == NULL) {
3408 return NULL;
3409 }
3410 int end_lineno = token->end_lineno;
3411 UNUSED(end_lineno); // Only used by EXTRA macro
3412 int end_col_offset = token->end_col_offset;
3413 UNUSED(end_col_offset); // Only used by EXTRA macro
3414 res = _Py_Return ( a , EXTRA );
3415 if (res == NULL && PyErr_Occurred()) {
3416 p->error_indicator = 1;
3417 return NULL;
3418 }
3419 goto done;
3420 }
3421 p->mark = mark;
3422 }
3423 res = NULL;
3424 done:
3425 return res;
3426}
3427
3428// raise_stmt: 'raise' expression ['from' expression] | 'raise'
3429static stmt_ty
3430raise_stmt_rule(Parser *p)
3431{
3432 if (p->error_indicator) {
3433 return NULL;
3434 }
3435 stmt_ty res = NULL;
3436 int mark = p->mark;
3437 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3438 p->error_indicator = 1;
3439 return NULL;
3440 }
3441 int start_lineno = p->tokens[mark]->lineno;
3442 UNUSED(start_lineno); // Only used by EXTRA macro
3443 int start_col_offset = p->tokens[mark]->col_offset;
3444 UNUSED(start_col_offset); // Only used by EXTRA macro
3445 { // 'raise' expression ['from' expression]
3446 expr_ty a;
3447 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003448 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003449 if (
3450 (keyword = _PyPegen_expect_token(p, 501))
3451 &&
3452 (a = expression_rule(p))
3453 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003454 (b = _tmp_49_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003455 )
3456 {
3457 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3458 if (token == NULL) {
3459 return NULL;
3460 }
3461 int end_lineno = token->end_lineno;
3462 UNUSED(end_lineno); // Only used by EXTRA macro
3463 int end_col_offset = token->end_col_offset;
3464 UNUSED(end_col_offset); // Only used by EXTRA macro
3465 res = _Py_Raise ( a , b , EXTRA );
3466 if (res == NULL && PyErr_Occurred()) {
3467 p->error_indicator = 1;
3468 return NULL;
3469 }
3470 goto done;
3471 }
3472 p->mark = mark;
3473 }
3474 { // 'raise'
Pablo Galindob796b3f2020-05-01 12:32:26 +01003475 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003476 if (
3477 (keyword = _PyPegen_expect_token(p, 501))
3478 )
3479 {
3480 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3481 if (token == NULL) {
3482 return NULL;
3483 }
3484 int end_lineno = token->end_lineno;
3485 UNUSED(end_lineno); // Only used by EXTRA macro
3486 int end_col_offset = token->end_col_offset;
3487 UNUSED(end_col_offset); // Only used by EXTRA macro
3488 res = _Py_Raise ( NULL , NULL , EXTRA );
3489 if (res == NULL && PyErr_Occurred()) {
3490 p->error_indicator = 1;
3491 return NULL;
3492 }
3493 goto done;
3494 }
3495 p->mark = mark;
3496 }
3497 res = NULL;
3498 done:
3499 return res;
3500}
3501
3502// function_def: decorators function_def_raw | function_def_raw
3503static stmt_ty
3504function_def_rule(Parser *p)
3505{
3506 if (p->error_indicator) {
3507 return NULL;
3508 }
3509 stmt_ty res = NULL;
3510 int mark = p->mark;
3511 { // decorators function_def_raw
3512 asdl_seq* d;
3513 stmt_ty f;
3514 if (
3515 (d = decorators_rule(p))
3516 &&
3517 (f = function_def_raw_rule(p))
3518 )
3519 {
3520 res = _PyPegen_function_def_decorators ( p , d , f );
3521 if (res == NULL && PyErr_Occurred()) {
3522 p->error_indicator = 1;
3523 return NULL;
3524 }
3525 goto done;
3526 }
3527 p->mark = mark;
3528 }
3529 { // function_def_raw
3530 stmt_ty function_def_raw_var;
3531 if (
3532 (function_def_raw_var = function_def_raw_rule(p))
3533 )
3534 {
3535 res = function_def_raw_var;
3536 goto done;
3537 }
3538 p->mark = mark;
3539 }
3540 res = NULL;
3541 done:
3542 return res;
3543}
3544
Guido van Rossumc001c092020-04-30 12:12:19 -07003545// function_def_raw:
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003546// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
3547// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003548static stmt_ty
3549function_def_raw_rule(Parser *p)
3550{
3551 if (p->error_indicator) {
3552 return NULL;
3553 }
3554 stmt_ty res = NULL;
3555 int mark = p->mark;
3556 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3557 p->error_indicator = 1;
3558 return NULL;
3559 }
3560 int start_lineno = p->tokens[mark]->lineno;
3561 UNUSED(start_lineno); // Only used by EXTRA macro
3562 int start_col_offset = p->tokens[mark]->col_offset;
3563 UNUSED(start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003564 { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003565 void *a;
3566 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003567 Token * keyword;
3568 Token * literal;
3569 Token * literal_1;
3570 Token * literal_2;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003571 expr_ty n;
3572 void *params;
Guido van Rossumc001c092020-04-30 12:12:19 -07003573 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003574 if (
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003575 (keyword = _PyPegen_expect_token(p, 522))
3576 &&
3577 (n = _PyPegen_name_token(p))
3578 &&
3579 (literal = _PyPegen_expect_token(p, 7))
3580 &&
3581 (params = params_rule(p), 1)
3582 &&
3583 (literal_1 = _PyPegen_expect_token(p, 8))
3584 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003585 (a = _tmp_50_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003586 &&
3587 (literal_2 = _PyPegen_expect_token(p, 11))
3588 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003589 (tc = func_type_comment_rule(p), 1)
3590 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003591 (b = block_rule(p))
3592 )
3593 {
3594 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3595 if (token == NULL) {
3596 return NULL;
3597 }
3598 int end_lineno = token->end_lineno;
3599 UNUSED(end_lineno); // Only used by EXTRA macro
3600 int end_col_offset = token->end_col_offset;
3601 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003602 res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
3603 if (res == NULL && PyErr_Occurred()) {
3604 p->error_indicator = 1;
3605 return NULL;
3606 }
3607 goto done;
3608 }
3609 p->mark = mark;
3610 }
3611 { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
3612 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003613 Token * async_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003614 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003615 Token * keyword;
3616 Token * literal;
3617 Token * literal_1;
3618 Token * literal_2;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003619 expr_ty n;
3620 void *params;
3621 void *tc;
3622 if (
3623 (async_var = _PyPegen_expect_token(p, ASYNC))
3624 &&
3625 (keyword = _PyPegen_expect_token(p, 522))
3626 &&
3627 (n = _PyPegen_name_token(p))
3628 &&
3629 (literal = _PyPegen_expect_token(p, 7))
3630 &&
3631 (params = params_rule(p), 1)
3632 &&
3633 (literal_1 = _PyPegen_expect_token(p, 8))
3634 &&
3635 (a = _tmp_51_rule(p), 1)
3636 &&
3637 (literal_2 = _PyPegen_expect_token(p, 11))
3638 &&
3639 (tc = func_type_comment_rule(p), 1)
3640 &&
3641 (b = block_rule(p))
3642 )
3643 {
3644 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
3645 if (token == NULL) {
3646 return NULL;
3647 }
3648 int end_lineno = token->end_lineno;
3649 UNUSED(end_lineno); // Only used by EXTRA macro
3650 int end_col_offset = token->end_col_offset;
3651 UNUSED(end_col_offset); // Only used by EXTRA macro
3652 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 +01003653 if (res == NULL && PyErr_Occurred()) {
3654 p->error_indicator = 1;
3655 return NULL;
3656 }
3657 goto done;
3658 }
3659 p->mark = mark;
3660 }
3661 res = NULL;
3662 done:
3663 return res;
3664}
3665
Guido van Rossumc001c092020-04-30 12:12:19 -07003666// func_type_comment:
3667// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
3668// | invalid_double_type_comments
3669// | TYPE_COMMENT
Pablo Galindod9552412020-05-01 16:32:09 +01003670static Token*
Guido van Rossumc001c092020-04-30 12:12:19 -07003671func_type_comment_rule(Parser *p)
3672{
3673 if (p->error_indicator) {
3674 return NULL;
3675 }
Pablo Galindod9552412020-05-01 16:32:09 +01003676 Token* res = NULL;
Guido van Rossumc001c092020-04-30 12:12:19 -07003677 int mark = p->mark;
3678 { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
Pablo Galindob796b3f2020-05-01 12:32:26 +01003679 Token * newline_var;
3680 Token * t;
Guido van Rossumc001c092020-04-30 12:12:19 -07003681 if (
3682 (newline_var = _PyPegen_expect_token(p, NEWLINE))
3683 &&
3684 (t = _PyPegen_expect_token(p, TYPE_COMMENT))
3685 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003686 _PyPegen_lookahead(1, _tmp_52_rule, p)
Guido van Rossumc001c092020-04-30 12:12:19 -07003687 )
3688 {
3689 res = t;
3690 if (res == NULL && PyErr_Occurred()) {
3691 p->error_indicator = 1;
3692 return NULL;
3693 }
3694 goto done;
3695 }
3696 p->mark = mark;
3697 }
3698 { // invalid_double_type_comments
3699 void *invalid_double_type_comments_var;
3700 if (
3701 (invalid_double_type_comments_var = invalid_double_type_comments_rule(p))
3702 )
3703 {
3704 res = invalid_double_type_comments_var;
3705 goto done;
3706 }
3707 p->mark = mark;
3708 }
3709 { // TYPE_COMMENT
Pablo Galindob796b3f2020-05-01 12:32:26 +01003710 Token * type_comment_var;
Guido van Rossumc001c092020-04-30 12:12:19 -07003711 if (
3712 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))
3713 )
3714 {
3715 res = type_comment_var;
3716 goto done;
3717 }
3718 p->mark = mark;
3719 }
3720 res = NULL;
3721 done:
3722 return res;
3723}
3724
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003725// params: invalid_parameters | parameters
3726static arguments_ty
3727params_rule(Parser *p)
3728{
3729 if (p->error_indicator) {
3730 return NULL;
3731 }
3732 arguments_ty res = NULL;
3733 int mark = p->mark;
3734 { // invalid_parameters
3735 void *invalid_parameters_var;
3736 if (
3737 (invalid_parameters_var = invalid_parameters_rule(p))
3738 )
3739 {
3740 res = invalid_parameters_var;
3741 goto done;
3742 }
3743 p->mark = mark;
3744 }
3745 { // parameters
3746 arguments_ty parameters_var;
3747 if (
3748 (parameters_var = parameters_rule(p))
3749 )
3750 {
3751 res = parameters_var;
3752 goto done;
3753 }
3754 p->mark = mark;
3755 }
3756 res = NULL;
3757 done:
3758 return res;
3759}
3760
3761// parameters:
Guido van Rossumc001c092020-04-30 12:12:19 -07003762// | slash_no_default param_no_default* param_with_default* star_etc?
3763// | slash_with_default param_with_default* star_etc?
3764// | param_no_default+ param_with_default* star_etc?
3765// | param_with_default+ star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003766// | star_etc
3767static arguments_ty
3768parameters_rule(Parser *p)
3769{
3770 if (p->error_indicator) {
3771 return NULL;
3772 }
3773 arguments_ty res = NULL;
3774 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07003775 { // slash_no_default param_no_default* param_with_default* star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003776 asdl_seq* a;
Guido van Rossumc001c092020-04-30 12:12:19 -07003777 asdl_seq * b;
3778 asdl_seq * c;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003779 void *d;
3780 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07003781 (a = slash_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003782 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003783 (b = _loop0_53_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003784 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003785 (c = _loop0_54_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003786 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003787 (d = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003788 )
3789 {
3790 res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
3791 if (res == NULL && PyErr_Occurred()) {
3792 p->error_indicator = 1;
3793 return NULL;
3794 }
3795 goto done;
3796 }
3797 p->mark = mark;
3798 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003799 { // slash_with_default param_with_default* star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003800 SlashWithDefault* a;
Guido van Rossumc001c092020-04-30 12:12:19 -07003801 asdl_seq * b;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003802 void *c;
3803 if (
3804 (a = slash_with_default_rule(p))
3805 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003806 (b = _loop0_55_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003807 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003808 (c = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003809 )
3810 {
3811 res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
3812 if (res == NULL && PyErr_Occurred()) {
3813 p->error_indicator = 1;
3814 return NULL;
3815 }
3816 goto done;
3817 }
3818 p->mark = mark;
3819 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003820 { // param_no_default+ param_with_default* star_etc?
3821 asdl_seq * a;
3822 asdl_seq * b;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003823 void *c;
3824 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003825 (a = _loop1_56_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003826 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003827 (b = _loop0_57_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003828 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003829 (c = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003830 )
3831 {
3832 res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
3833 if (res == NULL && PyErr_Occurred()) {
3834 p->error_indicator = 1;
3835 return NULL;
3836 }
3837 goto done;
3838 }
3839 p->mark = mark;
3840 }
Guido van Rossumc001c092020-04-30 12:12:19 -07003841 { // param_with_default+ star_etc?
3842 asdl_seq * a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003843 void *b;
3844 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003845 (a = _loop1_58_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003846 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003847 (b = star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003848 )
3849 {
3850 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
3851 if (res == NULL && PyErr_Occurred()) {
3852 p->error_indicator = 1;
3853 return NULL;
3854 }
3855 goto done;
3856 }
3857 p->mark = mark;
3858 }
3859 { // star_etc
3860 StarEtc* a;
3861 if (
3862 (a = star_etc_rule(p))
3863 )
3864 {
3865 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
3866 if (res == NULL && PyErr_Occurred()) {
3867 p->error_indicator = 1;
3868 return NULL;
3869 }
3870 goto done;
3871 }
3872 p->mark = mark;
3873 }
3874 res = NULL;
3875 done:
3876 return res;
3877}
3878
Guido van Rossumc001c092020-04-30 12:12:19 -07003879// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003880static asdl_seq*
Guido van Rossumc001c092020-04-30 12:12:19 -07003881slash_no_default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003882{
3883 if (p->error_indicator) {
3884 return NULL;
3885 }
3886 asdl_seq* res = NULL;
3887 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07003888 { // param_no_default+ '/' ','
3889 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003890 Token * literal;
3891 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003892 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003893 (a = _loop1_59_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003894 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003895 (literal = _PyPegen_expect_token(p, 17))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003896 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003897 (literal_1 = _PyPegen_expect_token(p, 12))
3898 )
3899 {
3900 res = a;
3901 if (res == NULL && PyErr_Occurred()) {
3902 p->error_indicator = 1;
3903 return NULL;
3904 }
3905 goto done;
3906 }
3907 p->mark = mark;
3908 }
3909 { // param_no_default+ '/' &')'
3910 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003911 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07003912 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003913 (a = _loop1_60_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -07003914 &&
3915 (literal = _PyPegen_expect_token(p, 17))
3916 &&
3917 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003918 )
3919 {
3920 res = a;
3921 if (res == NULL && PyErr_Occurred()) {
3922 p->error_indicator = 1;
3923 return NULL;
3924 }
3925 goto done;
3926 }
3927 p->mark = mark;
3928 }
3929 res = NULL;
3930 done:
3931 return res;
3932}
3933
Guido van Rossumc001c092020-04-30 12:12:19 -07003934// slash_with_default:
3935// | param_no_default* param_with_default+ '/' ','
3936// | param_no_default* param_with_default+ '/' &')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003937static SlashWithDefault*
3938slash_with_default_rule(Parser *p)
3939{
3940 if (p->error_indicator) {
3941 return NULL;
3942 }
3943 SlashWithDefault* res = NULL;
3944 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07003945 { // param_no_default* param_with_default+ '/' ','
3946 asdl_seq * a;
3947 asdl_seq * b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003948 Token * literal;
3949 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003950 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003951 (a = _loop0_61_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003952 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003953 (b = _loop1_62_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003954 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003955 (literal = _PyPegen_expect_token(p, 17))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003956 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07003957 (literal_1 = _PyPegen_expect_token(p, 12))
3958 )
3959 {
3960 res = _PyPegen_slash_with_default ( p , a , b );
3961 if (res == NULL && PyErr_Occurred()) {
3962 p->error_indicator = 1;
3963 return NULL;
3964 }
3965 goto done;
3966 }
3967 p->mark = mark;
3968 }
3969 { // param_no_default* param_with_default+ '/' &')'
3970 asdl_seq * a;
3971 asdl_seq * b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01003972 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07003973 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003974 (a = _loop0_63_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -07003975 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03003976 (b = _loop1_64_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -07003977 &&
3978 (literal = _PyPegen_expect_token(p, 17))
3979 &&
3980 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01003981 )
3982 {
3983 res = _PyPegen_slash_with_default ( p , a , b );
3984 if (res == NULL && PyErr_Occurred()) {
3985 p->error_indicator = 1;
3986 return NULL;
3987 }
3988 goto done;
3989 }
3990 p->mark = mark;
3991 }
3992 res = NULL;
3993 done:
3994 return res;
3995}
3996
3997// star_etc:
Guido van Rossumc001c092020-04-30 12:12:19 -07003998// | '*' param_no_default param_maybe_default* kwds?
3999// | '*' ',' param_maybe_default+ kwds?
4000// | kwds
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004001static StarEtc*
4002star_etc_rule(Parser *p)
4003{
4004 if (p->error_indicator) {
4005 return NULL;
4006 }
4007 StarEtc* res = NULL;
4008 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004009 { // '*' param_no_default param_maybe_default* kwds?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004010 arg_ty a;
4011 asdl_seq * b;
4012 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004013 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004014 if (
4015 (literal = _PyPegen_expect_token(p, 16))
4016 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004017 (a = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004018 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004019 (b = _loop0_65_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004020 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004021 (c = kwds_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004022 )
4023 {
4024 res = _PyPegen_star_etc ( p , a , b , c );
4025 if (res == NULL && PyErr_Occurred()) {
4026 p->error_indicator = 1;
4027 return NULL;
4028 }
4029 goto done;
4030 }
4031 p->mark = mark;
4032 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004033 { // '*' ',' param_maybe_default+ kwds?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004034 asdl_seq * b;
4035 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004036 Token * literal;
4037 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004038 if (
4039 (literal = _PyPegen_expect_token(p, 16))
4040 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004041 (literal_1 = _PyPegen_expect_token(p, 12))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004042 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004043 (b = _loop1_66_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004044 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004045 (c = kwds_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004046 )
4047 {
4048 res = _PyPegen_star_etc ( p , NULL , b , c );
4049 if (res == NULL && PyErr_Occurred()) {
4050 p->error_indicator = 1;
4051 return NULL;
4052 }
4053 goto done;
4054 }
4055 p->mark = mark;
4056 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004057 { // kwds
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004058 arg_ty a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004059 if (
4060 (a = kwds_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004061 )
4062 {
4063 res = _PyPegen_star_etc ( p , NULL , NULL , a );
4064 if (res == NULL && PyErr_Occurred()) {
4065 p->error_indicator = 1;
4066 return NULL;
4067 }
4068 goto done;
4069 }
4070 p->mark = mark;
4071 }
4072 res = NULL;
4073 done:
4074 return res;
4075}
4076
Guido van Rossumc001c092020-04-30 12:12:19 -07004077// kwds: '**' param_no_default
4078static arg_ty
4079kwds_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004080{
4081 if (p->error_indicator) {
4082 return NULL;
4083 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004084 arg_ty res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004085 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004086 { // '**' param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004087 arg_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004088 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004089 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004090 (literal = _PyPegen_expect_token(p, 35))
4091 &&
4092 (a = param_no_default_rule(p))
4093 )
4094 {
4095 res = a;
4096 if (res == NULL && PyErr_Occurred()) {
4097 p->error_indicator = 1;
4098 return NULL;
4099 }
4100 goto done;
4101 }
4102 p->mark = mark;
4103 }
4104 res = NULL;
4105 done:
4106 return res;
4107}
4108
4109// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
4110static arg_ty
4111param_no_default_rule(Parser *p)
4112{
4113 if (p->error_indicator) {
4114 return NULL;
4115 }
4116 arg_ty res = NULL;
4117 int mark = p->mark;
4118 { // param ',' TYPE_COMMENT?
4119 arg_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004120 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07004121 void *tc;
4122 if (
4123 (a = param_rule(p))
4124 &&
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004125 (literal = _PyPegen_expect_token(p, 12))
4126 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004127 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004128 )
4129 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004130 res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004131 if (res == NULL && PyErr_Occurred()) {
4132 p->error_indicator = 1;
4133 return NULL;
4134 }
4135 goto done;
4136 }
4137 p->mark = mark;
4138 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004139 { // param TYPE_COMMENT? &')'
4140 arg_ty a;
4141 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004142 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004143 (a = param_rule(p))
4144 &&
4145 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
4146 &&
4147 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004148 )
4149 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004150 res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004151 if (res == NULL && PyErr_Occurred()) {
4152 p->error_indicator = 1;
4153 return NULL;
4154 }
4155 goto done;
4156 }
4157 p->mark = mark;
4158 }
4159 res = NULL;
4160 done:
4161 return res;
4162}
4163
Guido van Rossumc001c092020-04-30 12:12:19 -07004164// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004165static NameDefaultPair*
Guido van Rossumc001c092020-04-30 12:12:19 -07004166param_with_default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004167{
4168 if (p->error_indicator) {
4169 return NULL;
4170 }
4171 NameDefaultPair* res = NULL;
4172 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004173 { // param default ',' TYPE_COMMENT?
4174 arg_ty a;
4175 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004176 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07004177 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004178 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004179 (a = param_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004180 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004181 (c = default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004182 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004183 (literal = _PyPegen_expect_token(p, 12))
4184 &&
4185 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004186 )
4187 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004188 res = _PyPegen_name_default_pair ( p , a , c , tc );
4189 if (res == NULL && PyErr_Occurred()) {
4190 p->error_indicator = 1;
4191 return NULL;
4192 }
4193 goto done;
4194 }
4195 p->mark = mark;
4196 }
4197 { // param default TYPE_COMMENT? &')'
4198 arg_ty a;
4199 expr_ty c;
4200 void *tc;
4201 if (
4202 (a = param_rule(p))
4203 &&
4204 (c = default_rule(p))
4205 &&
4206 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
4207 &&
4208 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
4209 )
4210 {
4211 res = _PyPegen_name_default_pair ( p , a , c , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004212 if (res == NULL && PyErr_Occurred()) {
4213 p->error_indicator = 1;
4214 return NULL;
4215 }
4216 goto done;
4217 }
4218 p->mark = mark;
4219 }
4220 res = NULL;
4221 done:
4222 return res;
4223}
4224
Guido van Rossumc001c092020-04-30 12:12:19 -07004225// param_maybe_default:
4226// | param default? ',' TYPE_COMMENT?
4227// | param default? TYPE_COMMENT? &')'
4228static NameDefaultPair*
4229param_maybe_default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004230{
4231 if (p->error_indicator) {
4232 return NULL;
4233 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004234 NameDefaultPair* res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004235 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004236 { // param default? ',' TYPE_COMMENT?
4237 arg_ty a;
4238 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004239 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -07004240 void *tc;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004241 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004242 (a = param_rule(p))
4243 &&
4244 (c = default_rule(p), 1)
4245 &&
4246 (literal = _PyPegen_expect_token(p, 12))
4247 &&
4248 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004249 )
4250 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004251 res = _PyPegen_name_default_pair ( p , a , c , tc );
4252 if (res == NULL && PyErr_Occurred()) {
4253 p->error_indicator = 1;
4254 return NULL;
4255 }
4256 goto done;
4257 }
4258 p->mark = mark;
4259 }
4260 { // param default? TYPE_COMMENT? &')'
4261 arg_ty a;
4262 void *c;
4263 void *tc;
4264 if (
4265 (a = param_rule(p))
4266 &&
4267 (c = default_rule(p), 1)
4268 &&
4269 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
4270 &&
4271 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
4272 )
4273 {
4274 res = _PyPegen_name_default_pair ( p , a , c , tc );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004275 if (res == NULL && PyErr_Occurred()) {
4276 p->error_indicator = 1;
4277 return NULL;
4278 }
4279 goto done;
4280 }
4281 p->mark = mark;
4282 }
4283 res = NULL;
4284 done:
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004285 return res;
4286}
4287
Guido van Rossumc001c092020-04-30 12:12:19 -07004288// param: NAME annotation?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004289static arg_ty
Guido van Rossumc001c092020-04-30 12:12:19 -07004290param_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004291{
4292 if (p->error_indicator) {
4293 return NULL;
4294 }
4295 arg_ty res = NULL;
4296 int mark = p->mark;
4297 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4298 p->error_indicator = 1;
4299 return NULL;
4300 }
4301 int start_lineno = p->tokens[mark]->lineno;
4302 UNUSED(start_lineno); // Only used by EXTRA macro
4303 int start_col_offset = p->tokens[mark]->col_offset;
4304 UNUSED(start_col_offset); // Only used by EXTRA macro
Guido van Rossumc001c092020-04-30 12:12:19 -07004305 { // NAME annotation?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004306 expr_ty a;
4307 void *b;
4308 if (
4309 (a = _PyPegen_name_token(p))
4310 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004311 (b = annotation_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004312 )
4313 {
4314 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4315 if (token == NULL) {
4316 return NULL;
4317 }
4318 int end_lineno = token->end_lineno;
4319 UNUSED(end_lineno); // Only used by EXTRA macro
4320 int end_col_offset = token->end_col_offset;
4321 UNUSED(end_col_offset); // Only used by EXTRA macro
4322 res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
4323 if (res == NULL && PyErr_Occurred()) {
4324 p->error_indicator = 1;
4325 return NULL;
4326 }
4327 goto done;
4328 }
4329 p->mark = mark;
4330 }
4331 res = NULL;
4332 done:
4333 return res;
4334}
4335
Guido van Rossumc001c092020-04-30 12:12:19 -07004336// annotation: ':' expression
4337static expr_ty
4338annotation_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004339{
4340 if (p->error_indicator) {
4341 return NULL;
4342 }
Guido van Rossumc001c092020-04-30 12:12:19 -07004343 expr_ty res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004344 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004345 { // ':' expression
4346 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004347 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004348 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004349 (literal = _PyPegen_expect_token(p, 11))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004350 &&
Guido van Rossumc001c092020-04-30 12:12:19 -07004351 (a = expression_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004352 )
4353 {
4354 res = a;
4355 if (res == NULL && PyErr_Occurred()) {
4356 p->error_indicator = 1;
4357 return NULL;
4358 }
4359 goto done;
4360 }
4361 p->mark = mark;
4362 }
4363 res = NULL;
4364 done:
4365 return res;
4366}
4367
Guido van Rossumc001c092020-04-30 12:12:19 -07004368// default: '=' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004369static expr_ty
Guido van Rossumc001c092020-04-30 12:12:19 -07004370default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004371{
4372 if (p->error_indicator) {
4373 return NULL;
4374 }
4375 expr_ty res = NULL;
4376 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -07004377 { // '=' expression
4378 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004379 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004380 if (
Guido van Rossumc001c092020-04-30 12:12:19 -07004381 (literal = _PyPegen_expect_token(p, 22))
4382 &&
4383 (a = expression_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004384 )
4385 {
Guido van Rossumc001c092020-04-30 12:12:19 -07004386 res = a;
4387 if (res == NULL && PyErr_Occurred()) {
4388 p->error_indicator = 1;
4389 return NULL;
4390 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004391 goto done;
4392 }
4393 p->mark = mark;
4394 }
4395 res = NULL;
4396 done:
4397 return res;
4398}
4399
4400// decorators: (('@' named_expression NEWLINE))+
4401static asdl_seq*
4402decorators_rule(Parser *p)
4403{
4404 if (p->error_indicator) {
4405 return NULL;
4406 }
4407 asdl_seq* res = NULL;
4408 int mark = p->mark;
4409 { // (('@' named_expression NEWLINE))+
4410 asdl_seq * a;
4411 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004412 (a = _loop1_67_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004413 )
4414 {
4415 res = a;
4416 if (res == NULL && PyErr_Occurred()) {
4417 p->error_indicator = 1;
4418 return NULL;
4419 }
4420 goto done;
4421 }
4422 p->mark = mark;
4423 }
4424 res = NULL;
4425 done:
4426 return res;
4427}
4428
4429// class_def: decorators class_def_raw | class_def_raw
4430static stmt_ty
4431class_def_rule(Parser *p)
4432{
4433 if (p->error_indicator) {
4434 return NULL;
4435 }
4436 stmt_ty res = NULL;
4437 int mark = p->mark;
4438 { // decorators class_def_raw
4439 asdl_seq* a;
4440 stmt_ty b;
4441 if (
4442 (a = decorators_rule(p))
4443 &&
4444 (b = class_def_raw_rule(p))
4445 )
4446 {
4447 res = _PyPegen_class_def_decorators ( p , a , b );
4448 if (res == NULL && PyErr_Occurred()) {
4449 p->error_indicator = 1;
4450 return NULL;
4451 }
4452 goto done;
4453 }
4454 p->mark = mark;
4455 }
4456 { // class_def_raw
4457 stmt_ty class_def_raw_var;
4458 if (
4459 (class_def_raw_var = class_def_raw_rule(p))
4460 )
4461 {
4462 res = class_def_raw_var;
4463 goto done;
4464 }
4465 p->mark = mark;
4466 }
4467 res = NULL;
4468 done:
4469 return res;
4470}
4471
4472// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
4473static stmt_ty
4474class_def_raw_rule(Parser *p)
4475{
4476 if (p->error_indicator) {
4477 return NULL;
4478 }
4479 stmt_ty res = NULL;
4480 int mark = p->mark;
4481 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4482 p->error_indicator = 1;
4483 return NULL;
4484 }
4485 int start_lineno = p->tokens[mark]->lineno;
4486 UNUSED(start_lineno); // Only used by EXTRA macro
4487 int start_col_offset = p->tokens[mark]->col_offset;
4488 UNUSED(start_col_offset); // Only used by EXTRA macro
4489 { // 'class' NAME ['(' arguments? ')'] ':' block
4490 expr_ty a;
4491 void *b;
4492 asdl_seq* c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004493 Token * keyword;
4494 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004495 if (
4496 (keyword = _PyPegen_expect_token(p, 523))
4497 &&
4498 (a = _PyPegen_name_token(p))
4499 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004500 (b = _tmp_68_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004501 &&
4502 (literal = _PyPegen_expect_token(p, 11))
4503 &&
4504 (c = block_rule(p))
4505 )
4506 {
4507 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4508 if (token == NULL) {
4509 return NULL;
4510 }
4511 int end_lineno = token->end_lineno;
4512 UNUSED(end_lineno); // Only used by EXTRA macro
4513 int end_col_offset = token->end_col_offset;
4514 UNUSED(end_col_offset); // Only used by EXTRA macro
4515 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 );
4516 if (res == NULL && PyErr_Occurred()) {
4517 p->error_indicator = 1;
4518 return NULL;
4519 }
4520 goto done;
4521 }
4522 p->mark = mark;
4523 }
4524 res = NULL;
4525 done:
4526 return res;
4527}
4528
4529// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
4530static asdl_seq*
4531block_rule(Parser *p)
4532{
4533 if (p->error_indicator) {
4534 return NULL;
4535 }
4536 asdl_seq* res = NULL;
4537 if (_PyPegen_is_memoized(p, block_type, &res))
4538 return res;
4539 int mark = p->mark;
4540 { // NEWLINE INDENT statements DEDENT
4541 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004542 Token * dedent_var;
4543 Token * indent_var;
4544 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004545 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01004546 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004547 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01004548 (indent_var = _PyPegen_expect_token(p, INDENT))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004549 &&
4550 (a = statements_rule(p))
4551 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +01004552 (dedent_var = _PyPegen_expect_token(p, DEDENT))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004553 )
4554 {
4555 res = a;
4556 if (res == NULL && PyErr_Occurred()) {
4557 p->error_indicator = 1;
4558 return NULL;
4559 }
4560 goto done;
4561 }
4562 p->mark = mark;
4563 }
4564 { // simple_stmt
4565 asdl_seq* simple_stmt_var;
4566 if (
4567 (simple_stmt_var = simple_stmt_rule(p))
4568 )
4569 {
4570 res = simple_stmt_var;
4571 goto done;
4572 }
4573 p->mark = mark;
4574 }
4575 { // invalid_block
4576 void *invalid_block_var;
4577 if (
4578 (invalid_block_var = invalid_block_rule(p))
4579 )
4580 {
4581 res = invalid_block_var;
4582 goto done;
4583 }
4584 p->mark = mark;
4585 }
4586 res = NULL;
4587 done:
4588 _PyPegen_insert_memo(p, mark, block_type, res);
4589 return res;
4590}
4591
4592// expressions_list: ','.star_expression+ ','?
4593static asdl_seq*
4594expressions_list_rule(Parser *p)
4595{
4596 if (p->error_indicator) {
4597 return NULL;
4598 }
4599 asdl_seq* res = NULL;
4600 int mark = p->mark;
4601 { // ','.star_expression+ ','?
4602 asdl_seq * a;
4603 void *opt_var;
4604 UNUSED(opt_var); // Silence compiler warnings
4605 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004606 (a = _gather_69_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004607 &&
4608 (opt_var = _PyPegen_expect_token(p, 12), 1)
4609 )
4610 {
4611 res = a;
4612 if (res == NULL && PyErr_Occurred()) {
4613 p->error_indicator = 1;
4614 return NULL;
4615 }
4616 goto done;
4617 }
4618 p->mark = mark;
4619 }
4620 res = NULL;
4621 done:
4622 return res;
4623}
4624
4625// star_expressions:
4626// | star_expression ((',' star_expression))+ ','?
4627// | star_expression ','
4628// | star_expression
4629static expr_ty
4630star_expressions_rule(Parser *p)
4631{
4632 if (p->error_indicator) {
4633 return NULL;
4634 }
4635 expr_ty res = NULL;
4636 int mark = p->mark;
4637 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4638 p->error_indicator = 1;
4639 return NULL;
4640 }
4641 int start_lineno = p->tokens[mark]->lineno;
4642 UNUSED(start_lineno); // Only used by EXTRA macro
4643 int start_col_offset = p->tokens[mark]->col_offset;
4644 UNUSED(start_col_offset); // Only used by EXTRA macro
4645 { // star_expression ((',' star_expression))+ ','?
4646 expr_ty a;
4647 asdl_seq * b;
4648 void *opt_var;
4649 UNUSED(opt_var); // Silence compiler warnings
4650 if (
4651 (a = star_expression_rule(p))
4652 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004653 (b = _loop1_71_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004654 &&
4655 (opt_var = _PyPegen_expect_token(p, 12), 1)
4656 )
4657 {
4658 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4659 if (token == NULL) {
4660 return NULL;
4661 }
4662 int end_lineno = token->end_lineno;
4663 UNUSED(end_lineno); // Only used by EXTRA macro
4664 int end_col_offset = token->end_col_offset;
4665 UNUSED(end_col_offset); // Only used by EXTRA macro
4666 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
4667 if (res == NULL && PyErr_Occurred()) {
4668 p->error_indicator = 1;
4669 return NULL;
4670 }
4671 goto done;
4672 }
4673 p->mark = mark;
4674 }
4675 { // star_expression ','
4676 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004677 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004678 if (
4679 (a = star_expression_rule(p))
4680 &&
4681 (literal = _PyPegen_expect_token(p, 12))
4682 )
4683 {
4684 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4685 if (token == NULL) {
4686 return NULL;
4687 }
4688 int end_lineno = token->end_lineno;
4689 UNUSED(end_lineno); // Only used by EXTRA macro
4690 int end_col_offset = token->end_col_offset;
4691 UNUSED(end_col_offset); // Only used by EXTRA macro
4692 res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
4693 if (res == NULL && PyErr_Occurred()) {
4694 p->error_indicator = 1;
4695 return NULL;
4696 }
4697 goto done;
4698 }
4699 p->mark = mark;
4700 }
4701 { // star_expression
4702 expr_ty star_expression_var;
4703 if (
4704 (star_expression_var = star_expression_rule(p))
4705 )
4706 {
4707 res = star_expression_var;
4708 goto done;
4709 }
4710 p->mark = mark;
4711 }
4712 res = NULL;
4713 done:
4714 return res;
4715}
4716
4717// star_expression: '*' bitwise_or | expression
4718static expr_ty
4719star_expression_rule(Parser *p)
4720{
4721 if (p->error_indicator) {
4722 return NULL;
4723 }
4724 expr_ty res = NULL;
4725 if (_PyPegen_is_memoized(p, star_expression_type, &res))
4726 return res;
4727 int mark = p->mark;
4728 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4729 p->error_indicator = 1;
4730 return NULL;
4731 }
4732 int start_lineno = p->tokens[mark]->lineno;
4733 UNUSED(start_lineno); // Only used by EXTRA macro
4734 int start_col_offset = p->tokens[mark]->col_offset;
4735 UNUSED(start_col_offset); // Only used by EXTRA macro
4736 { // '*' bitwise_or
4737 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004738 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004739 if (
4740 (literal = _PyPegen_expect_token(p, 16))
4741 &&
4742 (a = bitwise_or_rule(p))
4743 )
4744 {
4745 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4746 if (token == NULL) {
4747 return NULL;
4748 }
4749 int end_lineno = token->end_lineno;
4750 UNUSED(end_lineno); // Only used by EXTRA macro
4751 int end_col_offset = token->end_col_offset;
4752 UNUSED(end_col_offset); // Only used by EXTRA macro
4753 res = _Py_Starred ( a , Load , EXTRA );
4754 if (res == NULL && PyErr_Occurred()) {
4755 p->error_indicator = 1;
4756 return NULL;
4757 }
4758 goto done;
4759 }
4760 p->mark = mark;
4761 }
4762 { // expression
4763 expr_ty expression_var;
4764 if (
4765 (expression_var = expression_rule(p))
4766 )
4767 {
4768 res = expression_var;
4769 goto done;
4770 }
4771 p->mark = mark;
4772 }
4773 res = NULL;
4774 done:
4775 _PyPegen_insert_memo(p, mark, star_expression_type, res);
4776 return res;
4777}
4778
4779// star_named_expressions: ','.star_named_expression+ ','?
4780static asdl_seq*
4781star_named_expressions_rule(Parser *p)
4782{
4783 if (p->error_indicator) {
4784 return NULL;
4785 }
4786 asdl_seq* res = NULL;
4787 int mark = p->mark;
4788 { // ','.star_named_expression+ ','?
4789 asdl_seq * a;
4790 void *opt_var;
4791 UNUSED(opt_var); // Silence compiler warnings
4792 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03004793 (a = _gather_72_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004794 &&
4795 (opt_var = _PyPegen_expect_token(p, 12), 1)
4796 )
4797 {
4798 res = a;
4799 if (res == NULL && PyErr_Occurred()) {
4800 p->error_indicator = 1;
4801 return NULL;
4802 }
4803 goto done;
4804 }
4805 p->mark = mark;
4806 }
4807 res = NULL;
4808 done:
4809 return res;
4810}
4811
4812// star_named_expression: '*' bitwise_or | named_expression
4813static expr_ty
4814star_named_expression_rule(Parser *p)
4815{
4816 if (p->error_indicator) {
4817 return NULL;
4818 }
4819 expr_ty res = NULL;
4820 int mark = p->mark;
4821 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4822 p->error_indicator = 1;
4823 return NULL;
4824 }
4825 int start_lineno = p->tokens[mark]->lineno;
4826 UNUSED(start_lineno); // Only used by EXTRA macro
4827 int start_col_offset = p->tokens[mark]->col_offset;
4828 UNUSED(start_col_offset); // Only used by EXTRA macro
4829 { // '*' bitwise_or
4830 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004831 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004832 if (
4833 (literal = _PyPegen_expect_token(p, 16))
4834 &&
4835 (a = bitwise_or_rule(p))
4836 )
4837 {
4838 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4839 if (token == NULL) {
4840 return NULL;
4841 }
4842 int end_lineno = token->end_lineno;
4843 UNUSED(end_lineno); // Only used by EXTRA macro
4844 int end_col_offset = token->end_col_offset;
4845 UNUSED(end_col_offset); // Only used by EXTRA macro
4846 res = _Py_Starred ( a , Load , EXTRA );
4847 if (res == NULL && PyErr_Occurred()) {
4848 p->error_indicator = 1;
4849 return NULL;
4850 }
4851 goto done;
4852 }
4853 p->mark = mark;
4854 }
4855 { // named_expression
4856 expr_ty named_expression_var;
4857 if (
4858 (named_expression_var = named_expression_rule(p))
4859 )
4860 {
4861 res = named_expression_var;
4862 goto done;
4863 }
4864 p->mark = mark;
4865 }
4866 res = NULL;
4867 done:
4868 return res;
4869}
4870
4871// named_expression: NAME ':=' expression | expression !':=' | invalid_named_expression
4872static expr_ty
4873named_expression_rule(Parser *p)
4874{
4875 if (p->error_indicator) {
4876 return NULL;
4877 }
4878 expr_ty res = NULL;
4879 int mark = p->mark;
4880 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4881 p->error_indicator = 1;
4882 return NULL;
4883 }
4884 int start_lineno = p->tokens[mark]->lineno;
4885 UNUSED(start_lineno); // Only used by EXTRA macro
4886 int start_col_offset = p->tokens[mark]->col_offset;
4887 UNUSED(start_col_offset); // Only used by EXTRA macro
4888 { // NAME ':=' expression
4889 expr_ty a;
4890 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01004891 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01004892 if (
4893 (a = _PyPegen_name_token(p))
4894 &&
4895 (literal = _PyPegen_expect_token(p, 53))
4896 &&
4897 (b = expression_rule(p))
4898 )
4899 {
4900 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
4901 if (token == NULL) {
4902 return NULL;
4903 }
4904 int end_lineno = token->end_lineno;
4905 UNUSED(end_lineno); // Only used by EXTRA macro
4906 int end_col_offset = token->end_col_offset;
4907 UNUSED(end_col_offset); // Only used by EXTRA macro
4908 res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
4909 if (res == NULL && PyErr_Occurred()) {
4910 p->error_indicator = 1;
4911 return NULL;
4912 }
4913 goto done;
4914 }
4915 p->mark = mark;
4916 }
4917 { // expression !':='
4918 expr_ty expression_var;
4919 if (
4920 (expression_var = expression_rule(p))
4921 &&
4922 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53)
4923 )
4924 {
4925 res = expression_var;
4926 goto done;
4927 }
4928 p->mark = mark;
4929 }
4930 { // invalid_named_expression
4931 void *invalid_named_expression_var;
4932 if (
4933 (invalid_named_expression_var = invalid_named_expression_rule(p))
4934 )
4935 {
4936 res = invalid_named_expression_var;
4937 goto done;
4938 }
4939 p->mark = mark;
4940 }
4941 res = NULL;
4942 done:
4943 return res;
4944}
4945
4946// annotated_rhs: yield_expr | star_expressions
4947static expr_ty
4948annotated_rhs_rule(Parser *p)
4949{
4950 if (p->error_indicator) {
4951 return NULL;
4952 }
4953 expr_ty res = NULL;
4954 int mark = p->mark;
4955 { // yield_expr
4956 expr_ty yield_expr_var;
4957 if (
4958 (yield_expr_var = yield_expr_rule(p))
4959 )
4960 {
4961 res = yield_expr_var;
4962 goto done;
4963 }
4964 p->mark = mark;
4965 }
4966 { // star_expressions
4967 expr_ty star_expressions_var;
4968 if (
4969 (star_expressions_var = star_expressions_rule(p))
4970 )
4971 {
4972 res = star_expressions_var;
4973 goto done;
4974 }
4975 p->mark = mark;
4976 }
4977 res = NULL;
4978 done:
4979 return res;
4980}
4981
4982// expressions: expression ((',' expression))+ ','? | expression ',' | expression
4983static expr_ty
4984expressions_rule(Parser *p)
4985{
4986 if (p->error_indicator) {
4987 return NULL;
4988 }
4989 expr_ty res = NULL;
4990 int mark = p->mark;
4991 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4992 p->error_indicator = 1;
4993 return NULL;
4994 }
4995 int start_lineno = p->tokens[mark]->lineno;
4996 UNUSED(start_lineno); // Only used by EXTRA macro
4997 int start_col_offset = p->tokens[mark]->col_offset;
4998 UNUSED(start_col_offset); // Only used by EXTRA macro
4999 { // expression ((',' expression))+ ','?
5000 expr_ty a;
5001 asdl_seq * b;
5002 void *opt_var;
5003 UNUSED(opt_var); // Silence compiler warnings
5004 if (
5005 (a = expression_rule(p))
5006 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03005007 (b = _loop1_74_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005008 &&
5009 (opt_var = _PyPegen_expect_token(p, 12), 1)
5010 )
5011 {
5012 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5013 if (token == NULL) {
5014 return NULL;
5015 }
5016 int end_lineno = token->end_lineno;
5017 UNUSED(end_lineno); // Only used by EXTRA macro
5018 int end_col_offset = token->end_col_offset;
5019 UNUSED(end_col_offset); // Only used by EXTRA macro
5020 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
5021 if (res == NULL && PyErr_Occurred()) {
5022 p->error_indicator = 1;
5023 return NULL;
5024 }
5025 goto done;
5026 }
5027 p->mark = mark;
5028 }
5029 { // expression ','
5030 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005031 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005032 if (
5033 (a = expression_rule(p))
5034 &&
5035 (literal = _PyPegen_expect_token(p, 12))
5036 )
5037 {
5038 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5039 if (token == NULL) {
5040 return NULL;
5041 }
5042 int end_lineno = token->end_lineno;
5043 UNUSED(end_lineno); // Only used by EXTRA macro
5044 int end_col_offset = token->end_col_offset;
5045 UNUSED(end_col_offset); // Only used by EXTRA macro
5046 res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
5047 if (res == NULL && PyErr_Occurred()) {
5048 p->error_indicator = 1;
5049 return NULL;
5050 }
5051 goto done;
5052 }
5053 p->mark = mark;
5054 }
5055 { // expression
5056 expr_ty expression_var;
5057 if (
5058 (expression_var = expression_rule(p))
5059 )
5060 {
5061 res = expression_var;
5062 goto done;
5063 }
5064 p->mark = mark;
5065 }
5066 res = NULL;
5067 done:
5068 return res;
5069}
5070
5071// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
5072static expr_ty
5073expression_rule(Parser *p)
5074{
5075 if (p->error_indicator) {
5076 return NULL;
5077 }
5078 expr_ty res = NULL;
5079 if (_PyPegen_is_memoized(p, expression_type, &res))
5080 return res;
5081 int mark = p->mark;
5082 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5083 p->error_indicator = 1;
5084 return NULL;
5085 }
5086 int start_lineno = p->tokens[mark]->lineno;
5087 UNUSED(start_lineno); // Only used by EXTRA macro
5088 int start_col_offset = p->tokens[mark]->col_offset;
5089 UNUSED(start_col_offset); // Only used by EXTRA macro
5090 { // disjunction 'if' disjunction 'else' expression
5091 expr_ty a;
5092 expr_ty b;
5093 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005094 Token * keyword;
5095 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005096 if (
5097 (a = disjunction_rule(p))
5098 &&
5099 (keyword = _PyPegen_expect_token(p, 510))
5100 &&
5101 (b = disjunction_rule(p))
5102 &&
5103 (keyword_1 = _PyPegen_expect_token(p, 516))
5104 &&
5105 (c = expression_rule(p))
5106 )
5107 {
5108 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5109 if (token == NULL) {
5110 return NULL;
5111 }
5112 int end_lineno = token->end_lineno;
5113 UNUSED(end_lineno); // Only used by EXTRA macro
5114 int end_col_offset = token->end_col_offset;
5115 UNUSED(end_col_offset); // Only used by EXTRA macro
5116 res = _Py_IfExp ( b , a , c , EXTRA );
5117 if (res == NULL && PyErr_Occurred()) {
5118 p->error_indicator = 1;
5119 return NULL;
5120 }
5121 goto done;
5122 }
5123 p->mark = mark;
5124 }
5125 { // disjunction
5126 expr_ty disjunction_var;
5127 if (
5128 (disjunction_var = disjunction_rule(p))
5129 )
5130 {
5131 res = disjunction_var;
5132 goto done;
5133 }
5134 p->mark = mark;
5135 }
5136 { // lambdef
5137 expr_ty lambdef_var;
5138 if (
5139 (lambdef_var = lambdef_rule(p))
5140 )
5141 {
5142 res = lambdef_var;
5143 goto done;
5144 }
5145 p->mark = mark;
5146 }
5147 res = NULL;
5148 done:
5149 _PyPegen_insert_memo(p, mark, expression_type, res);
5150 return res;
5151}
5152
5153// lambdef: 'lambda' lambda_parameters? ':' expression
5154static expr_ty
5155lambdef_rule(Parser *p)
5156{
5157 if (p->error_indicator) {
5158 return NULL;
5159 }
5160 expr_ty res = NULL;
5161 int mark = p->mark;
5162 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5163 p->error_indicator = 1;
5164 return NULL;
5165 }
5166 int start_lineno = p->tokens[mark]->lineno;
5167 UNUSED(start_lineno); // Only used by EXTRA macro
5168 int start_col_offset = p->tokens[mark]->col_offset;
5169 UNUSED(start_col_offset); // Only used by EXTRA macro
5170 { // 'lambda' lambda_parameters? ':' expression
5171 void *a;
5172 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005173 Token * keyword;
5174 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005175 if (
5176 (keyword = _PyPegen_expect_token(p, 524))
5177 &&
5178 (a = lambda_parameters_rule(p), 1)
5179 &&
5180 (literal = _PyPegen_expect_token(p, 11))
5181 &&
5182 (b = expression_rule(p))
5183 )
5184 {
5185 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5186 if (token == NULL) {
5187 return NULL;
5188 }
5189 int end_lineno = token->end_lineno;
5190 UNUSED(end_lineno); // Only used by EXTRA macro
5191 int end_col_offset = token->end_col_offset;
5192 UNUSED(end_col_offset); // Only used by EXTRA macro
5193 res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
5194 if (res == NULL && PyErr_Occurred()) {
5195 p->error_indicator = 1;
5196 return NULL;
5197 }
5198 goto done;
5199 }
5200 p->mark = mark;
5201 }
5202 res = NULL;
5203 done:
5204 return res;
5205}
5206
5207// lambda_parameters:
Guido van Rossum3941d972020-05-01 09:42:03 -07005208// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
5209// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
5210// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
5211// | lambda_param_with_default+ lambda_star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005212// | lambda_star_etc
5213static arguments_ty
5214lambda_parameters_rule(Parser *p)
5215{
5216 if (p->error_indicator) {
5217 return NULL;
5218 }
5219 arguments_ty res = NULL;
5220 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -07005221 { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005222 asdl_seq* a;
Guido van Rossum3941d972020-05-01 09:42:03 -07005223 asdl_seq * b;
5224 asdl_seq * c;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005225 void *d;
5226 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07005227 (a = lambda_slash_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005228 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005229 (b = _loop0_75_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005230 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005231 (c = _loop0_76_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005232 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005233 (d = lambda_star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005234 )
5235 {
5236 res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
5237 if (res == NULL && PyErr_Occurred()) {
5238 p->error_indicator = 1;
5239 return NULL;
5240 }
5241 goto done;
5242 }
5243 p->mark = mark;
5244 }
Guido van Rossum3941d972020-05-01 09:42:03 -07005245 { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005246 SlashWithDefault* a;
Guido van Rossum3941d972020-05-01 09:42:03 -07005247 asdl_seq * b;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005248 void *c;
5249 if (
5250 (a = lambda_slash_with_default_rule(p))
5251 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005252 (b = _loop0_77_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005253 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005254 (c = lambda_star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005255 )
5256 {
5257 res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
5258 if (res == NULL && PyErr_Occurred()) {
5259 p->error_indicator = 1;
5260 return NULL;
5261 }
5262 goto done;
5263 }
5264 p->mark = mark;
5265 }
Guido van Rossum3941d972020-05-01 09:42:03 -07005266 { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
5267 asdl_seq * a;
5268 asdl_seq * b;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005269 void *c;
5270 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07005271 (a = _loop1_78_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005272 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005273 (b = _loop0_79_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005274 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005275 (c = lambda_star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005276 )
5277 {
5278 res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
5279 if (res == NULL && PyErr_Occurred()) {
5280 p->error_indicator = 1;
5281 return NULL;
5282 }
5283 goto done;
5284 }
5285 p->mark = mark;
5286 }
Guido van Rossum3941d972020-05-01 09:42:03 -07005287 { // lambda_param_with_default+ lambda_star_etc?
5288 asdl_seq * a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005289 void *b;
5290 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07005291 (a = _loop1_80_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005292 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005293 (b = lambda_star_etc_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005294 )
5295 {
5296 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
5297 if (res == NULL && PyErr_Occurred()) {
5298 p->error_indicator = 1;
5299 return NULL;
5300 }
5301 goto done;
5302 }
5303 p->mark = mark;
5304 }
5305 { // lambda_star_etc
5306 StarEtc* a;
5307 if (
5308 (a = lambda_star_etc_rule(p))
5309 )
5310 {
5311 res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
5312 if (res == NULL && PyErr_Occurred()) {
5313 p->error_indicator = 1;
5314 return NULL;
5315 }
5316 goto done;
5317 }
5318 p->mark = mark;
5319 }
5320 res = NULL;
5321 done:
5322 return res;
5323}
5324
Guido van Rossum3941d972020-05-01 09:42:03 -07005325// lambda_slash_no_default:
5326// | lambda_param_no_default+ '/' ','
5327// | lambda_param_no_default+ '/' &':'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005328static asdl_seq*
Guido van Rossum3941d972020-05-01 09:42:03 -07005329lambda_slash_no_default_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005330{
5331 if (p->error_indicator) {
5332 return NULL;
5333 }
5334 asdl_seq* res = NULL;
5335 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -07005336 { // lambda_param_no_default+ '/' ','
5337 asdl_seq * a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005338 Token * literal;
5339 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005340 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07005341 (a = _loop1_81_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005342 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005343 (literal = _PyPegen_expect_token(p, 17))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005344 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005345 (literal_1 = _PyPegen_expect_token(p, 12))
5346 )
5347 {
5348 res = a;
5349 if (res == NULL && PyErr_Occurred()) {
5350 p->error_indicator = 1;
5351 return NULL;
5352 }
5353 goto done;
5354 }
5355 p->mark = mark;
5356 }
5357 { // lambda_param_no_default+ '/' &':'
5358 asdl_seq * a;
5359 Token * literal;
5360 if (
5361 (a = _loop1_82_rule(p))
5362 &&
5363 (literal = _PyPegen_expect_token(p, 17))
5364 &&
5365 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005366 )
5367 {
5368 res = a;
5369 if (res == NULL && PyErr_Occurred()) {
5370 p->error_indicator = 1;
5371 return NULL;
5372 }
5373 goto done;
5374 }
5375 p->mark = mark;
5376 }
5377 res = NULL;
5378 done:
5379 return res;
5380}
5381
Guido van Rossum3941d972020-05-01 09:42:03 -07005382// lambda_slash_with_default:
5383// | lambda_param_no_default* lambda_param_with_default+ '/' ','
5384// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005385static SlashWithDefault*
5386lambda_slash_with_default_rule(Parser *p)
5387{
5388 if (p->error_indicator) {
5389 return NULL;
5390 }
5391 SlashWithDefault* res = NULL;
5392 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -07005393 { // lambda_param_no_default* lambda_param_with_default+ '/' ','
5394 asdl_seq * a;
5395 asdl_seq * b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005396 Token * literal;
5397 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005398 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07005399 (a = _loop0_83_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005400 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005401 (b = _loop1_84_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005402 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005403 (literal = _PyPegen_expect_token(p, 17))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005404 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005405 (literal_1 = _PyPegen_expect_token(p, 12))
5406 )
5407 {
5408 res = _PyPegen_slash_with_default ( p , a , b );
5409 if (res == NULL && PyErr_Occurred()) {
5410 p->error_indicator = 1;
5411 return NULL;
5412 }
5413 goto done;
5414 }
5415 p->mark = mark;
5416 }
5417 { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
5418 asdl_seq * a;
5419 asdl_seq * b;
5420 Token * literal;
5421 if (
5422 (a = _loop0_85_rule(p))
5423 &&
5424 (b = _loop1_86_rule(p))
5425 &&
5426 (literal = _PyPegen_expect_token(p, 17))
5427 &&
5428 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005429 )
5430 {
5431 res = _PyPegen_slash_with_default ( p , a , b );
5432 if (res == NULL && PyErr_Occurred()) {
5433 p->error_indicator = 1;
5434 return NULL;
5435 }
5436 goto done;
5437 }
5438 p->mark = mark;
5439 }
5440 res = NULL;
5441 done:
5442 return res;
5443}
5444
5445// lambda_star_etc:
Guido van Rossum3941d972020-05-01 09:42:03 -07005446// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
5447// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
5448// | lambda_kwds
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005449static StarEtc*
5450lambda_star_etc_rule(Parser *p)
5451{
5452 if (p->error_indicator) {
5453 return NULL;
5454 }
5455 StarEtc* res = NULL;
5456 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -07005457 { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005458 arg_ty a;
5459 asdl_seq * b;
5460 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005461 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005462 if (
5463 (literal = _PyPegen_expect_token(p, 16))
5464 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005465 (a = lambda_param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005466 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005467 (b = _loop0_87_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005468 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005469 (c = lambda_kwds_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005470 )
5471 {
5472 res = _PyPegen_star_etc ( p , a , b , c );
5473 if (res == NULL && PyErr_Occurred()) {
5474 p->error_indicator = 1;
5475 return NULL;
5476 }
5477 goto done;
5478 }
5479 p->mark = mark;
5480 }
Guido van Rossum3941d972020-05-01 09:42:03 -07005481 { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005482 asdl_seq * b;
5483 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005484 Token * literal;
Guido van Rossum3941d972020-05-01 09:42:03 -07005485 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005486 if (
5487 (literal = _PyPegen_expect_token(p, 16))
5488 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005489 (literal_1 = _PyPegen_expect_token(p, 12))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005490 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005491 (b = _loop1_88_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005492 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005493 (c = lambda_kwds_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005494 )
5495 {
5496 res = _PyPegen_star_etc ( p , NULL , b , c );
5497 if (res == NULL && PyErr_Occurred()) {
5498 p->error_indicator = 1;
5499 return NULL;
5500 }
5501 goto done;
5502 }
5503 p->mark = mark;
5504 }
Guido van Rossum3941d972020-05-01 09:42:03 -07005505 { // lambda_kwds
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005506 arg_ty a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005507 if (
5508 (a = lambda_kwds_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005509 )
5510 {
5511 res = _PyPegen_star_etc ( p , NULL , NULL , a );
5512 if (res == NULL && PyErr_Occurred()) {
5513 p->error_indicator = 1;
5514 return NULL;
5515 }
5516 goto done;
5517 }
5518 p->mark = mark;
5519 }
5520 res = NULL;
5521 done:
5522 return res;
5523}
5524
Guido van Rossum3941d972020-05-01 09:42:03 -07005525// lambda_kwds: '**' lambda_param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005526static arg_ty
Guido van Rossum3941d972020-05-01 09:42:03 -07005527lambda_kwds_rule(Parser *p)
5528{
5529 if (p->error_indicator) {
5530 return NULL;
5531 }
5532 arg_ty res = NULL;
5533 int mark = p->mark;
5534 { // '**' lambda_param_no_default
5535 arg_ty a;
5536 Token * literal;
5537 if (
5538 (literal = _PyPegen_expect_token(p, 35))
5539 &&
5540 (a = lambda_param_no_default_rule(p))
5541 )
5542 {
5543 res = a;
5544 if (res == NULL && PyErr_Occurred()) {
5545 p->error_indicator = 1;
5546 return NULL;
5547 }
5548 goto done;
5549 }
5550 p->mark = mark;
5551 }
5552 res = NULL;
5553 done:
5554 return res;
5555}
5556
5557// lambda_param_no_default: lambda_param ',' | lambda_param &':'
5558static arg_ty
5559lambda_param_no_default_rule(Parser *p)
5560{
5561 if (p->error_indicator) {
5562 return NULL;
5563 }
5564 arg_ty res = NULL;
5565 int mark = p->mark;
5566 { // lambda_param ','
5567 arg_ty a;
5568 Token * literal;
5569 if (
5570 (a = lambda_param_rule(p))
5571 &&
5572 (literal = _PyPegen_expect_token(p, 12))
5573 )
5574 {
5575 res = a;
5576 if (res == NULL && PyErr_Occurred()) {
5577 p->error_indicator = 1;
5578 return NULL;
5579 }
5580 goto done;
5581 }
5582 p->mark = mark;
5583 }
5584 { // lambda_param &':'
5585 arg_ty a;
5586 if (
5587 (a = lambda_param_rule(p))
5588 &&
5589 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)
5590 )
5591 {
5592 res = a;
5593 if (res == NULL && PyErr_Occurred()) {
5594 p->error_indicator = 1;
5595 return NULL;
5596 }
5597 goto done;
5598 }
5599 p->mark = mark;
5600 }
5601 res = NULL;
5602 done:
5603 return res;
5604}
5605
5606// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
5607static NameDefaultPair*
5608lambda_param_with_default_rule(Parser *p)
5609{
5610 if (p->error_indicator) {
5611 return NULL;
5612 }
5613 NameDefaultPair* res = NULL;
5614 int mark = p->mark;
5615 { // lambda_param default ','
5616 arg_ty a;
5617 expr_ty c;
5618 Token * literal;
5619 if (
5620 (a = lambda_param_rule(p))
5621 &&
5622 (c = default_rule(p))
5623 &&
5624 (literal = _PyPegen_expect_token(p, 12))
5625 )
5626 {
5627 res = _PyPegen_name_default_pair ( p , a , c , NULL );
5628 if (res == NULL && PyErr_Occurred()) {
5629 p->error_indicator = 1;
5630 return NULL;
5631 }
5632 goto done;
5633 }
5634 p->mark = mark;
5635 }
5636 { // lambda_param default &':'
5637 arg_ty a;
5638 expr_ty c;
5639 if (
5640 (a = lambda_param_rule(p))
5641 &&
5642 (c = default_rule(p))
5643 &&
5644 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)
5645 )
5646 {
5647 res = _PyPegen_name_default_pair ( p , a , c , NULL );
5648 if (res == NULL && PyErr_Occurred()) {
5649 p->error_indicator = 1;
5650 return NULL;
5651 }
5652 goto done;
5653 }
5654 p->mark = mark;
5655 }
5656 res = NULL;
5657 done:
5658 return res;
5659}
5660
5661// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
5662static NameDefaultPair*
5663lambda_param_maybe_default_rule(Parser *p)
5664{
5665 if (p->error_indicator) {
5666 return NULL;
5667 }
5668 NameDefaultPair* res = NULL;
5669 int mark = p->mark;
5670 { // lambda_param default? ','
5671 arg_ty a;
5672 void *c;
5673 Token * literal;
5674 if (
5675 (a = lambda_param_rule(p))
5676 &&
5677 (c = default_rule(p), 1)
5678 &&
5679 (literal = _PyPegen_expect_token(p, 12))
5680 )
5681 {
5682 res = _PyPegen_name_default_pair ( p , a , c , NULL );
5683 if (res == NULL && PyErr_Occurred()) {
5684 p->error_indicator = 1;
5685 return NULL;
5686 }
5687 goto done;
5688 }
5689 p->mark = mark;
5690 }
5691 { // lambda_param default? &':'
5692 arg_ty a;
5693 void *c;
5694 if (
5695 (a = lambda_param_rule(p))
5696 &&
5697 (c = default_rule(p), 1)
5698 &&
5699 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)
5700 )
5701 {
5702 res = _PyPegen_name_default_pair ( p , a , c , NULL );
5703 if (res == NULL && PyErr_Occurred()) {
5704 p->error_indicator = 1;
5705 return NULL;
5706 }
5707 goto done;
5708 }
5709 p->mark = mark;
5710 }
5711 res = NULL;
5712 done:
5713 return res;
5714}
5715
5716// lambda_param: NAME
5717static arg_ty
5718lambda_param_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005719{
5720 if (p->error_indicator) {
5721 return NULL;
5722 }
5723 arg_ty res = NULL;
5724 int mark = p->mark;
5725 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5726 p->error_indicator = 1;
5727 return NULL;
5728 }
5729 int start_lineno = p->tokens[mark]->lineno;
5730 UNUSED(start_lineno); // Only used by EXTRA macro
5731 int start_col_offset = p->tokens[mark]->col_offset;
5732 UNUSED(start_col_offset); // Only used by EXTRA macro
5733 { // NAME
5734 expr_ty a;
5735 if (
5736 (a = _PyPegen_name_token(p))
5737 )
5738 {
5739 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5740 if (token == NULL) {
5741 return NULL;
5742 }
5743 int end_lineno = token->end_lineno;
5744 UNUSED(end_lineno); // Only used by EXTRA macro
5745 int end_col_offset = token->end_col_offset;
5746 UNUSED(end_col_offset); // Only used by EXTRA macro
5747 res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
5748 if (res == NULL && PyErr_Occurred()) {
5749 p->error_indicator = 1;
5750 return NULL;
5751 }
5752 goto done;
5753 }
5754 p->mark = mark;
5755 }
5756 res = NULL;
5757 done:
5758 return res;
5759}
5760
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005761// disjunction: conjunction (('or' conjunction))+ | conjunction
5762static expr_ty
5763disjunction_rule(Parser *p)
5764{
5765 if (p->error_indicator) {
5766 return NULL;
5767 }
5768 expr_ty res = NULL;
5769 if (_PyPegen_is_memoized(p, disjunction_type, &res))
5770 return res;
5771 int mark = p->mark;
5772 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5773 p->error_indicator = 1;
5774 return NULL;
5775 }
5776 int start_lineno = p->tokens[mark]->lineno;
5777 UNUSED(start_lineno); // Only used by EXTRA macro
5778 int start_col_offset = p->tokens[mark]->col_offset;
5779 UNUSED(start_col_offset); // Only used by EXTRA macro
5780 { // conjunction (('or' conjunction))+
5781 expr_ty a;
5782 asdl_seq * b;
5783 if (
5784 (a = conjunction_rule(p))
5785 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005786 (b = _loop1_89_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005787 )
5788 {
5789 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5790 if (token == NULL) {
5791 return NULL;
5792 }
5793 int end_lineno = token->end_lineno;
5794 UNUSED(end_lineno); // Only used by EXTRA macro
5795 int end_col_offset = token->end_col_offset;
5796 UNUSED(end_col_offset); // Only used by EXTRA macro
5797 res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
5798 if (res == NULL && PyErr_Occurred()) {
5799 p->error_indicator = 1;
5800 return NULL;
5801 }
5802 goto done;
5803 }
5804 p->mark = mark;
5805 }
5806 { // conjunction
5807 expr_ty conjunction_var;
5808 if (
5809 (conjunction_var = conjunction_rule(p))
5810 )
5811 {
5812 res = conjunction_var;
5813 goto done;
5814 }
5815 p->mark = mark;
5816 }
5817 res = NULL;
5818 done:
5819 _PyPegen_insert_memo(p, mark, disjunction_type, res);
5820 return res;
5821}
5822
5823// conjunction: inversion (('and' inversion))+ | inversion
5824static expr_ty
5825conjunction_rule(Parser *p)
5826{
5827 if (p->error_indicator) {
5828 return NULL;
5829 }
5830 expr_ty res = NULL;
5831 if (_PyPegen_is_memoized(p, conjunction_type, &res))
5832 return res;
5833 int mark = p->mark;
5834 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5835 p->error_indicator = 1;
5836 return NULL;
5837 }
5838 int start_lineno = p->tokens[mark]->lineno;
5839 UNUSED(start_lineno); // Only used by EXTRA macro
5840 int start_col_offset = p->tokens[mark]->col_offset;
5841 UNUSED(start_col_offset); // Only used by EXTRA macro
5842 { // inversion (('and' inversion))+
5843 expr_ty a;
5844 asdl_seq * b;
5845 if (
5846 (a = inversion_rule(p))
5847 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005848 (b = _loop1_90_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005849 )
5850 {
5851 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5852 if (token == NULL) {
5853 return NULL;
5854 }
5855 int end_lineno = token->end_lineno;
5856 UNUSED(end_lineno); // Only used by EXTRA macro
5857 int end_col_offset = token->end_col_offset;
5858 UNUSED(end_col_offset); // Only used by EXTRA macro
5859 res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
5860 if (res == NULL && PyErr_Occurred()) {
5861 p->error_indicator = 1;
5862 return NULL;
5863 }
5864 goto done;
5865 }
5866 p->mark = mark;
5867 }
5868 { // inversion
5869 expr_ty inversion_var;
5870 if (
5871 (inversion_var = inversion_rule(p))
5872 )
5873 {
5874 res = inversion_var;
5875 goto done;
5876 }
5877 p->mark = mark;
5878 }
5879 res = NULL;
5880 done:
5881 _PyPegen_insert_memo(p, mark, conjunction_type, res);
5882 return res;
5883}
5884
5885// inversion: 'not' inversion | comparison
5886static expr_ty
5887inversion_rule(Parser *p)
5888{
5889 if (p->error_indicator) {
5890 return NULL;
5891 }
5892 expr_ty res = NULL;
5893 if (_PyPegen_is_memoized(p, inversion_type, &res))
5894 return res;
5895 int mark = p->mark;
5896 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5897 p->error_indicator = 1;
5898 return NULL;
5899 }
5900 int start_lineno = p->tokens[mark]->lineno;
5901 UNUSED(start_lineno); // Only used by EXTRA macro
5902 int start_col_offset = p->tokens[mark]->col_offset;
5903 UNUSED(start_col_offset); // Only used by EXTRA macro
5904 { // 'not' inversion
5905 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01005906 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005907 if (
5908 (keyword = _PyPegen_expect_token(p, 525))
5909 &&
5910 (a = inversion_rule(p))
5911 )
5912 {
5913 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5914 if (token == NULL) {
5915 return NULL;
5916 }
5917 int end_lineno = token->end_lineno;
5918 UNUSED(end_lineno); // Only used by EXTRA macro
5919 int end_col_offset = token->end_col_offset;
5920 UNUSED(end_col_offset); // Only used by EXTRA macro
5921 res = _Py_UnaryOp ( Not , a , EXTRA );
5922 if (res == NULL && PyErr_Occurred()) {
5923 p->error_indicator = 1;
5924 return NULL;
5925 }
5926 goto done;
5927 }
5928 p->mark = mark;
5929 }
5930 { // comparison
5931 expr_ty comparison_var;
5932 if (
5933 (comparison_var = comparison_rule(p))
5934 )
5935 {
5936 res = comparison_var;
5937 goto done;
5938 }
5939 p->mark = mark;
5940 }
5941 res = NULL;
5942 done:
5943 _PyPegen_insert_memo(p, mark, inversion_type, res);
5944 return res;
5945}
5946
5947// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
5948static expr_ty
5949comparison_rule(Parser *p)
5950{
5951 if (p->error_indicator) {
5952 return NULL;
5953 }
5954 expr_ty res = NULL;
5955 int mark = p->mark;
5956 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5957 p->error_indicator = 1;
5958 return NULL;
5959 }
5960 int start_lineno = p->tokens[mark]->lineno;
5961 UNUSED(start_lineno); // Only used by EXTRA macro
5962 int start_col_offset = p->tokens[mark]->col_offset;
5963 UNUSED(start_col_offset); // Only used by EXTRA macro
5964 { // bitwise_or compare_op_bitwise_or_pair+
5965 expr_ty a;
5966 asdl_seq * b;
5967 if (
5968 (a = bitwise_or_rule(p))
5969 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07005970 (b = _loop1_91_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01005971 )
5972 {
5973 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
5974 if (token == NULL) {
5975 return NULL;
5976 }
5977 int end_lineno = token->end_lineno;
5978 UNUSED(end_lineno); // Only used by EXTRA macro
5979 int end_col_offset = token->end_col_offset;
5980 UNUSED(end_col_offset); // Only used by EXTRA macro
5981 res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA );
5982 if (res == NULL && PyErr_Occurred()) {
5983 p->error_indicator = 1;
5984 return NULL;
5985 }
5986 goto done;
5987 }
5988 p->mark = mark;
5989 }
5990 { // bitwise_or
5991 expr_ty bitwise_or_var;
5992 if (
5993 (bitwise_or_var = bitwise_or_rule(p))
5994 )
5995 {
5996 res = bitwise_or_var;
5997 goto done;
5998 }
5999 p->mark = mark;
6000 }
6001 res = NULL;
6002 done:
6003 return res;
6004}
6005
6006// compare_op_bitwise_or_pair:
6007// | eq_bitwise_or
6008// | noteq_bitwise_or
6009// | lte_bitwise_or
6010// | lt_bitwise_or
6011// | gte_bitwise_or
6012// | gt_bitwise_or
6013// | notin_bitwise_or
6014// | in_bitwise_or
6015// | isnot_bitwise_or
6016// | is_bitwise_or
6017static CmpopExprPair*
6018compare_op_bitwise_or_pair_rule(Parser *p)
6019{
6020 if (p->error_indicator) {
6021 return NULL;
6022 }
6023 CmpopExprPair* res = NULL;
6024 int mark = p->mark;
6025 { // eq_bitwise_or
6026 CmpopExprPair* eq_bitwise_or_var;
6027 if (
6028 (eq_bitwise_or_var = eq_bitwise_or_rule(p))
6029 )
6030 {
6031 res = eq_bitwise_or_var;
6032 goto done;
6033 }
6034 p->mark = mark;
6035 }
6036 { // noteq_bitwise_or
6037 CmpopExprPair* noteq_bitwise_or_var;
6038 if (
6039 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p))
6040 )
6041 {
6042 res = noteq_bitwise_or_var;
6043 goto done;
6044 }
6045 p->mark = mark;
6046 }
6047 { // lte_bitwise_or
6048 CmpopExprPair* lte_bitwise_or_var;
6049 if (
6050 (lte_bitwise_or_var = lte_bitwise_or_rule(p))
6051 )
6052 {
6053 res = lte_bitwise_or_var;
6054 goto done;
6055 }
6056 p->mark = mark;
6057 }
6058 { // lt_bitwise_or
6059 CmpopExprPair* lt_bitwise_or_var;
6060 if (
6061 (lt_bitwise_or_var = lt_bitwise_or_rule(p))
6062 )
6063 {
6064 res = lt_bitwise_or_var;
6065 goto done;
6066 }
6067 p->mark = mark;
6068 }
6069 { // gte_bitwise_or
6070 CmpopExprPair* gte_bitwise_or_var;
6071 if (
6072 (gte_bitwise_or_var = gte_bitwise_or_rule(p))
6073 )
6074 {
6075 res = gte_bitwise_or_var;
6076 goto done;
6077 }
6078 p->mark = mark;
6079 }
6080 { // gt_bitwise_or
6081 CmpopExprPair* gt_bitwise_or_var;
6082 if (
6083 (gt_bitwise_or_var = gt_bitwise_or_rule(p))
6084 )
6085 {
6086 res = gt_bitwise_or_var;
6087 goto done;
6088 }
6089 p->mark = mark;
6090 }
6091 { // notin_bitwise_or
6092 CmpopExprPair* notin_bitwise_or_var;
6093 if (
6094 (notin_bitwise_or_var = notin_bitwise_or_rule(p))
6095 )
6096 {
6097 res = notin_bitwise_or_var;
6098 goto done;
6099 }
6100 p->mark = mark;
6101 }
6102 { // in_bitwise_or
6103 CmpopExprPair* in_bitwise_or_var;
6104 if (
6105 (in_bitwise_or_var = in_bitwise_or_rule(p))
6106 )
6107 {
6108 res = in_bitwise_or_var;
6109 goto done;
6110 }
6111 p->mark = mark;
6112 }
6113 { // isnot_bitwise_or
6114 CmpopExprPair* isnot_bitwise_or_var;
6115 if (
6116 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p))
6117 )
6118 {
6119 res = isnot_bitwise_or_var;
6120 goto done;
6121 }
6122 p->mark = mark;
6123 }
6124 { // is_bitwise_or
6125 CmpopExprPair* is_bitwise_or_var;
6126 if (
6127 (is_bitwise_or_var = is_bitwise_or_rule(p))
6128 )
6129 {
6130 res = is_bitwise_or_var;
6131 goto done;
6132 }
6133 p->mark = mark;
6134 }
6135 res = NULL;
6136 done:
6137 return res;
6138}
6139
6140// eq_bitwise_or: '==' bitwise_or
6141static CmpopExprPair*
6142eq_bitwise_or_rule(Parser *p)
6143{
6144 if (p->error_indicator) {
6145 return NULL;
6146 }
6147 CmpopExprPair* res = NULL;
6148 int mark = p->mark;
6149 { // '==' bitwise_or
6150 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006151 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006152 if (
6153 (literal = _PyPegen_expect_token(p, 27))
6154 &&
6155 (a = bitwise_or_rule(p))
6156 )
6157 {
6158 res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
6159 if (res == NULL && PyErr_Occurred()) {
6160 p->error_indicator = 1;
6161 return NULL;
6162 }
6163 goto done;
6164 }
6165 p->mark = mark;
6166 }
6167 res = NULL;
6168 done:
6169 return res;
6170}
6171
Pablo Galindo2b74c832020-04-27 18:02:07 +01006172// noteq_bitwise_or: ('!=') bitwise_or
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006173static CmpopExprPair*
6174noteq_bitwise_or_rule(Parser *p)
6175{
6176 if (p->error_indicator) {
6177 return NULL;
6178 }
6179 CmpopExprPair* res = NULL;
6180 int mark = p->mark;
Pablo Galindo2b74c832020-04-27 18:02:07 +01006181 { // ('!=') bitwise_or
Guido van Rossum3941d972020-05-01 09:42:03 -07006182 void *_tmp_92_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006183 expr_ty a;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006184 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07006185 (_tmp_92_var = _tmp_92_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006186 &&
6187 (a = bitwise_or_rule(p))
6188 )
6189 {
6190 res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
6191 if (res == NULL && PyErr_Occurred()) {
6192 p->error_indicator = 1;
6193 return NULL;
6194 }
6195 goto done;
6196 }
6197 p->mark = mark;
6198 }
6199 res = NULL;
6200 done:
6201 return res;
6202}
6203
6204// lte_bitwise_or: '<=' bitwise_or
6205static CmpopExprPair*
6206lte_bitwise_or_rule(Parser *p)
6207{
6208 if (p->error_indicator) {
6209 return NULL;
6210 }
6211 CmpopExprPair* res = NULL;
6212 int mark = p->mark;
6213 { // '<=' bitwise_or
6214 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006215 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006216 if (
6217 (literal = _PyPegen_expect_token(p, 29))
6218 &&
6219 (a = bitwise_or_rule(p))
6220 )
6221 {
6222 res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
6223 if (res == NULL && PyErr_Occurred()) {
6224 p->error_indicator = 1;
6225 return NULL;
6226 }
6227 goto done;
6228 }
6229 p->mark = mark;
6230 }
6231 res = NULL;
6232 done:
6233 return res;
6234}
6235
6236// lt_bitwise_or: '<' bitwise_or
6237static CmpopExprPair*
6238lt_bitwise_or_rule(Parser *p)
6239{
6240 if (p->error_indicator) {
6241 return NULL;
6242 }
6243 CmpopExprPair* res = NULL;
6244 int mark = p->mark;
6245 { // '<' bitwise_or
6246 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006247 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006248 if (
6249 (literal = _PyPegen_expect_token(p, 20))
6250 &&
6251 (a = bitwise_or_rule(p))
6252 )
6253 {
6254 res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
6255 if (res == NULL && PyErr_Occurred()) {
6256 p->error_indicator = 1;
6257 return NULL;
6258 }
6259 goto done;
6260 }
6261 p->mark = mark;
6262 }
6263 res = NULL;
6264 done:
6265 return res;
6266}
6267
6268// gte_bitwise_or: '>=' bitwise_or
6269static CmpopExprPair*
6270gte_bitwise_or_rule(Parser *p)
6271{
6272 if (p->error_indicator) {
6273 return NULL;
6274 }
6275 CmpopExprPair* res = NULL;
6276 int mark = p->mark;
6277 { // '>=' bitwise_or
6278 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006279 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006280 if (
6281 (literal = _PyPegen_expect_token(p, 30))
6282 &&
6283 (a = bitwise_or_rule(p))
6284 )
6285 {
6286 res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
6287 if (res == NULL && PyErr_Occurred()) {
6288 p->error_indicator = 1;
6289 return NULL;
6290 }
6291 goto done;
6292 }
6293 p->mark = mark;
6294 }
6295 res = NULL;
6296 done:
6297 return res;
6298}
6299
6300// gt_bitwise_or: '>' bitwise_or
6301static CmpopExprPair*
6302gt_bitwise_or_rule(Parser *p)
6303{
6304 if (p->error_indicator) {
6305 return NULL;
6306 }
6307 CmpopExprPair* res = NULL;
6308 int mark = p->mark;
6309 { // '>' bitwise_or
6310 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006311 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006312 if (
6313 (literal = _PyPegen_expect_token(p, 21))
6314 &&
6315 (a = bitwise_or_rule(p))
6316 )
6317 {
6318 res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
6319 if (res == NULL && PyErr_Occurred()) {
6320 p->error_indicator = 1;
6321 return NULL;
6322 }
6323 goto done;
6324 }
6325 p->mark = mark;
6326 }
6327 res = NULL;
6328 done:
6329 return res;
6330}
6331
6332// notin_bitwise_or: 'not' 'in' bitwise_or
6333static CmpopExprPair*
6334notin_bitwise_or_rule(Parser *p)
6335{
6336 if (p->error_indicator) {
6337 return NULL;
6338 }
6339 CmpopExprPair* res = NULL;
6340 int mark = p->mark;
6341 { // 'not' 'in' bitwise_or
6342 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006343 Token * keyword;
6344 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006345 if (
6346 (keyword = _PyPegen_expect_token(p, 525))
6347 &&
6348 (keyword_1 = _PyPegen_expect_token(p, 518))
6349 &&
6350 (a = bitwise_or_rule(p))
6351 )
6352 {
6353 res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
6354 if (res == NULL && PyErr_Occurred()) {
6355 p->error_indicator = 1;
6356 return NULL;
6357 }
6358 goto done;
6359 }
6360 p->mark = mark;
6361 }
6362 res = NULL;
6363 done:
6364 return res;
6365}
6366
6367// in_bitwise_or: 'in' bitwise_or
6368static CmpopExprPair*
6369in_bitwise_or_rule(Parser *p)
6370{
6371 if (p->error_indicator) {
6372 return NULL;
6373 }
6374 CmpopExprPair* res = NULL;
6375 int mark = p->mark;
6376 { // 'in' bitwise_or
6377 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006378 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006379 if (
6380 (keyword = _PyPegen_expect_token(p, 518))
6381 &&
6382 (a = bitwise_or_rule(p))
6383 )
6384 {
6385 res = _PyPegen_cmpop_expr_pair ( p , In , a );
6386 if (res == NULL && PyErr_Occurred()) {
6387 p->error_indicator = 1;
6388 return NULL;
6389 }
6390 goto done;
6391 }
6392 p->mark = mark;
6393 }
6394 res = NULL;
6395 done:
6396 return res;
6397}
6398
6399// isnot_bitwise_or: 'is' 'not' bitwise_or
6400static CmpopExprPair*
6401isnot_bitwise_or_rule(Parser *p)
6402{
6403 if (p->error_indicator) {
6404 return NULL;
6405 }
6406 CmpopExprPair* res = NULL;
6407 int mark = p->mark;
6408 { // 'is' 'not' bitwise_or
6409 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006410 Token * keyword;
6411 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006412 if (
6413 (keyword = _PyPegen_expect_token(p, 526))
6414 &&
6415 (keyword_1 = _PyPegen_expect_token(p, 525))
6416 &&
6417 (a = bitwise_or_rule(p))
6418 )
6419 {
6420 res = _PyPegen_cmpop_expr_pair ( p , IsNot , 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// is_bitwise_or: 'is' bitwise_or
6435static CmpopExprPair*
6436is_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 { // 'is' bitwise_or
6444 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006445 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006446 if (
6447 (keyword = _PyPegen_expect_token(p, 526))
6448 &&
6449 (a = bitwise_or_rule(p))
6450 )
6451 {
6452 res = _PyPegen_cmpop_expr_pair ( p , Is , a );
6453 if (res == NULL && PyErr_Occurred()) {
6454 p->error_indicator = 1;
6455 return NULL;
6456 }
6457 goto done;
6458 }
6459 p->mark = mark;
6460 }
6461 res = NULL;
6462 done:
6463 return res;
6464}
6465
6466// Left-recursive
6467// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
6468static expr_ty bitwise_or_raw(Parser *);
6469static expr_ty
6470bitwise_or_rule(Parser *p)
6471{
6472 expr_ty res = NULL;
6473 if (_PyPegen_is_memoized(p, bitwise_or_type, &res))
6474 return res;
6475 int mark = p->mark;
6476 int resmark = p->mark;
6477 while (1) {
6478 int tmpvar_1 = _PyPegen_update_memo(p, mark, bitwise_or_type, res);
6479 if (tmpvar_1) {
6480 return res;
6481 }
6482 p->mark = mark;
6483 void *raw = bitwise_or_raw(p);
6484 if (raw == NULL || p->mark <= resmark)
6485 break;
6486 resmark = p->mark;
6487 res = raw;
6488 }
6489 p->mark = resmark;
6490 return res;
6491}
6492static expr_ty
6493bitwise_or_raw(Parser *p)
6494{
6495 if (p->error_indicator) {
6496 return NULL;
6497 }
6498 expr_ty res = NULL;
6499 int mark = p->mark;
6500 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6501 p->error_indicator = 1;
6502 return NULL;
6503 }
6504 int start_lineno = p->tokens[mark]->lineno;
6505 UNUSED(start_lineno); // Only used by EXTRA macro
6506 int start_col_offset = p->tokens[mark]->col_offset;
6507 UNUSED(start_col_offset); // Only used by EXTRA macro
6508 { // bitwise_or '|' bitwise_xor
6509 expr_ty a;
6510 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006511 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006512 if (
6513 (a = bitwise_or_rule(p))
6514 &&
6515 (literal = _PyPegen_expect_token(p, 18))
6516 &&
6517 (b = bitwise_xor_rule(p))
6518 )
6519 {
6520 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6521 if (token == NULL) {
6522 return NULL;
6523 }
6524 int end_lineno = token->end_lineno;
6525 UNUSED(end_lineno); // Only used by EXTRA macro
6526 int end_col_offset = token->end_col_offset;
6527 UNUSED(end_col_offset); // Only used by EXTRA macro
6528 res = _Py_BinOp ( a , BitOr , b , EXTRA );
6529 if (res == NULL && PyErr_Occurred()) {
6530 p->error_indicator = 1;
6531 return NULL;
6532 }
6533 goto done;
6534 }
6535 p->mark = mark;
6536 }
6537 { // bitwise_xor
6538 expr_ty bitwise_xor_var;
6539 if (
6540 (bitwise_xor_var = bitwise_xor_rule(p))
6541 )
6542 {
6543 res = bitwise_xor_var;
6544 goto done;
6545 }
6546 p->mark = mark;
6547 }
6548 res = NULL;
6549 done:
6550 return res;
6551}
6552
6553// Left-recursive
6554// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
6555static expr_ty bitwise_xor_raw(Parser *);
6556static expr_ty
6557bitwise_xor_rule(Parser *p)
6558{
6559 expr_ty res = NULL;
6560 if (_PyPegen_is_memoized(p, bitwise_xor_type, &res))
6561 return res;
6562 int mark = p->mark;
6563 int resmark = p->mark;
6564 while (1) {
6565 int tmpvar_2 = _PyPegen_update_memo(p, mark, bitwise_xor_type, res);
6566 if (tmpvar_2) {
6567 return res;
6568 }
6569 p->mark = mark;
6570 void *raw = bitwise_xor_raw(p);
6571 if (raw == NULL || p->mark <= resmark)
6572 break;
6573 resmark = p->mark;
6574 res = raw;
6575 }
6576 p->mark = resmark;
6577 return res;
6578}
6579static expr_ty
6580bitwise_xor_raw(Parser *p)
6581{
6582 if (p->error_indicator) {
6583 return NULL;
6584 }
6585 expr_ty res = NULL;
6586 int mark = p->mark;
6587 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6588 p->error_indicator = 1;
6589 return NULL;
6590 }
6591 int start_lineno = p->tokens[mark]->lineno;
6592 UNUSED(start_lineno); // Only used by EXTRA macro
6593 int start_col_offset = p->tokens[mark]->col_offset;
6594 UNUSED(start_col_offset); // Only used by EXTRA macro
6595 { // bitwise_xor '^' bitwise_and
6596 expr_ty a;
6597 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006598 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006599 if (
6600 (a = bitwise_xor_rule(p))
6601 &&
6602 (literal = _PyPegen_expect_token(p, 32))
6603 &&
6604 (b = bitwise_and_rule(p))
6605 )
6606 {
6607 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6608 if (token == NULL) {
6609 return NULL;
6610 }
6611 int end_lineno = token->end_lineno;
6612 UNUSED(end_lineno); // Only used by EXTRA macro
6613 int end_col_offset = token->end_col_offset;
6614 UNUSED(end_col_offset); // Only used by EXTRA macro
6615 res = _Py_BinOp ( a , BitXor , b , EXTRA );
6616 if (res == NULL && PyErr_Occurred()) {
6617 p->error_indicator = 1;
6618 return NULL;
6619 }
6620 goto done;
6621 }
6622 p->mark = mark;
6623 }
6624 { // bitwise_and
6625 expr_ty bitwise_and_var;
6626 if (
6627 (bitwise_and_var = bitwise_and_rule(p))
6628 )
6629 {
6630 res = bitwise_and_var;
6631 goto done;
6632 }
6633 p->mark = mark;
6634 }
6635 res = NULL;
6636 done:
6637 return res;
6638}
6639
6640// Left-recursive
6641// bitwise_and: bitwise_and '&' shift_expr | shift_expr
6642static expr_ty bitwise_and_raw(Parser *);
6643static expr_ty
6644bitwise_and_rule(Parser *p)
6645{
6646 expr_ty res = NULL;
6647 if (_PyPegen_is_memoized(p, bitwise_and_type, &res))
6648 return res;
6649 int mark = p->mark;
6650 int resmark = p->mark;
6651 while (1) {
6652 int tmpvar_3 = _PyPegen_update_memo(p, mark, bitwise_and_type, res);
6653 if (tmpvar_3) {
6654 return res;
6655 }
6656 p->mark = mark;
6657 void *raw = bitwise_and_raw(p);
6658 if (raw == NULL || p->mark <= resmark)
6659 break;
6660 resmark = p->mark;
6661 res = raw;
6662 }
6663 p->mark = resmark;
6664 return res;
6665}
6666static expr_ty
6667bitwise_and_raw(Parser *p)
6668{
6669 if (p->error_indicator) {
6670 return NULL;
6671 }
6672 expr_ty res = NULL;
6673 int mark = p->mark;
6674 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6675 p->error_indicator = 1;
6676 return NULL;
6677 }
6678 int start_lineno = p->tokens[mark]->lineno;
6679 UNUSED(start_lineno); // Only used by EXTRA macro
6680 int start_col_offset = p->tokens[mark]->col_offset;
6681 UNUSED(start_col_offset); // Only used by EXTRA macro
6682 { // bitwise_and '&' shift_expr
6683 expr_ty a;
6684 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006685 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006686 if (
6687 (a = bitwise_and_rule(p))
6688 &&
6689 (literal = _PyPegen_expect_token(p, 19))
6690 &&
6691 (b = shift_expr_rule(p))
6692 )
6693 {
6694 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6695 if (token == NULL) {
6696 return NULL;
6697 }
6698 int end_lineno = token->end_lineno;
6699 UNUSED(end_lineno); // Only used by EXTRA macro
6700 int end_col_offset = token->end_col_offset;
6701 UNUSED(end_col_offset); // Only used by EXTRA macro
6702 res = _Py_BinOp ( a , BitAnd , b , EXTRA );
6703 if (res == NULL && PyErr_Occurred()) {
6704 p->error_indicator = 1;
6705 return NULL;
6706 }
6707 goto done;
6708 }
6709 p->mark = mark;
6710 }
6711 { // shift_expr
6712 expr_ty shift_expr_var;
6713 if (
6714 (shift_expr_var = shift_expr_rule(p))
6715 )
6716 {
6717 res = shift_expr_var;
6718 goto done;
6719 }
6720 p->mark = mark;
6721 }
6722 res = NULL;
6723 done:
6724 return res;
6725}
6726
6727// Left-recursive
6728// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
6729static expr_ty shift_expr_raw(Parser *);
6730static expr_ty
6731shift_expr_rule(Parser *p)
6732{
6733 expr_ty res = NULL;
6734 if (_PyPegen_is_memoized(p, shift_expr_type, &res))
6735 return res;
6736 int mark = p->mark;
6737 int resmark = p->mark;
6738 while (1) {
6739 int tmpvar_4 = _PyPegen_update_memo(p, mark, shift_expr_type, res);
6740 if (tmpvar_4) {
6741 return res;
6742 }
6743 p->mark = mark;
6744 void *raw = shift_expr_raw(p);
6745 if (raw == NULL || p->mark <= resmark)
6746 break;
6747 resmark = p->mark;
6748 res = raw;
6749 }
6750 p->mark = resmark;
6751 return res;
6752}
6753static expr_ty
6754shift_expr_raw(Parser *p)
6755{
6756 if (p->error_indicator) {
6757 return NULL;
6758 }
6759 expr_ty res = NULL;
6760 int mark = p->mark;
6761 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6762 p->error_indicator = 1;
6763 return NULL;
6764 }
6765 int start_lineno = p->tokens[mark]->lineno;
6766 UNUSED(start_lineno); // Only used by EXTRA macro
6767 int start_col_offset = p->tokens[mark]->col_offset;
6768 UNUSED(start_col_offset); // Only used by EXTRA macro
6769 { // shift_expr '<<' sum
6770 expr_ty a;
6771 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006772 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006773 if (
6774 (a = shift_expr_rule(p))
6775 &&
6776 (literal = _PyPegen_expect_token(p, 33))
6777 &&
6778 (b = sum_rule(p))
6779 )
6780 {
6781 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6782 if (token == NULL) {
6783 return NULL;
6784 }
6785 int end_lineno = token->end_lineno;
6786 UNUSED(end_lineno); // Only used by EXTRA macro
6787 int end_col_offset = token->end_col_offset;
6788 UNUSED(end_col_offset); // Only used by EXTRA macro
6789 res = _Py_BinOp ( a , LShift , b , EXTRA );
6790 if (res == NULL && PyErr_Occurred()) {
6791 p->error_indicator = 1;
6792 return NULL;
6793 }
6794 goto done;
6795 }
6796 p->mark = mark;
6797 }
6798 { // shift_expr '>>' sum
6799 expr_ty a;
6800 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006801 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006802 if (
6803 (a = shift_expr_rule(p))
6804 &&
6805 (literal = _PyPegen_expect_token(p, 34))
6806 &&
6807 (b = sum_rule(p))
6808 )
6809 {
6810 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6811 if (token == NULL) {
6812 return NULL;
6813 }
6814 int end_lineno = token->end_lineno;
6815 UNUSED(end_lineno); // Only used by EXTRA macro
6816 int end_col_offset = token->end_col_offset;
6817 UNUSED(end_col_offset); // Only used by EXTRA macro
6818 res = _Py_BinOp ( a , RShift , b , EXTRA );
6819 if (res == NULL && PyErr_Occurred()) {
6820 p->error_indicator = 1;
6821 return NULL;
6822 }
6823 goto done;
6824 }
6825 p->mark = mark;
6826 }
6827 { // sum
6828 expr_ty sum_var;
6829 if (
6830 (sum_var = sum_rule(p))
6831 )
6832 {
6833 res = sum_var;
6834 goto done;
6835 }
6836 p->mark = mark;
6837 }
6838 res = NULL;
6839 done:
6840 return res;
6841}
6842
6843// Left-recursive
6844// sum: sum '+' term | sum '-' term | term
6845static expr_ty sum_raw(Parser *);
6846static expr_ty
6847sum_rule(Parser *p)
6848{
6849 expr_ty res = NULL;
6850 if (_PyPegen_is_memoized(p, sum_type, &res))
6851 return res;
6852 int mark = p->mark;
6853 int resmark = p->mark;
6854 while (1) {
6855 int tmpvar_5 = _PyPegen_update_memo(p, mark, sum_type, res);
6856 if (tmpvar_5) {
6857 return res;
6858 }
6859 p->mark = mark;
6860 void *raw = sum_raw(p);
6861 if (raw == NULL || p->mark <= resmark)
6862 break;
6863 resmark = p->mark;
6864 res = raw;
6865 }
6866 p->mark = resmark;
6867 return res;
6868}
6869static expr_ty
6870sum_raw(Parser *p)
6871{
6872 if (p->error_indicator) {
6873 return NULL;
6874 }
6875 expr_ty res = NULL;
6876 int mark = p->mark;
6877 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6878 p->error_indicator = 1;
6879 return NULL;
6880 }
6881 int start_lineno = p->tokens[mark]->lineno;
6882 UNUSED(start_lineno); // Only used by EXTRA macro
6883 int start_col_offset = p->tokens[mark]->col_offset;
6884 UNUSED(start_col_offset); // Only used by EXTRA macro
6885 { // sum '+' term
6886 expr_ty a;
6887 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006888 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006889 if (
6890 (a = sum_rule(p))
6891 &&
6892 (literal = _PyPegen_expect_token(p, 14))
6893 &&
6894 (b = term_rule(p))
6895 )
6896 {
6897 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6898 if (token == NULL) {
6899 return NULL;
6900 }
6901 int end_lineno = token->end_lineno;
6902 UNUSED(end_lineno); // Only used by EXTRA macro
6903 int end_col_offset = token->end_col_offset;
6904 UNUSED(end_col_offset); // Only used by EXTRA macro
6905 res = _Py_BinOp ( a , Add , b , EXTRA );
6906 if (res == NULL && PyErr_Occurred()) {
6907 p->error_indicator = 1;
6908 return NULL;
6909 }
6910 goto done;
6911 }
6912 p->mark = mark;
6913 }
6914 { // sum '-' term
6915 expr_ty a;
6916 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01006917 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01006918 if (
6919 (a = sum_rule(p))
6920 &&
6921 (literal = _PyPegen_expect_token(p, 15))
6922 &&
6923 (b = term_rule(p))
6924 )
6925 {
6926 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
6927 if (token == NULL) {
6928 return NULL;
6929 }
6930 int end_lineno = token->end_lineno;
6931 UNUSED(end_lineno); // Only used by EXTRA macro
6932 int end_col_offset = token->end_col_offset;
6933 UNUSED(end_col_offset); // Only used by EXTRA macro
6934 res = _Py_BinOp ( a , Sub , b , EXTRA );
6935 if (res == NULL && PyErr_Occurred()) {
6936 p->error_indicator = 1;
6937 return NULL;
6938 }
6939 goto done;
6940 }
6941 p->mark = mark;
6942 }
6943 { // term
6944 expr_ty term_var;
6945 if (
6946 (term_var = term_rule(p))
6947 )
6948 {
6949 res = term_var;
6950 goto done;
6951 }
6952 p->mark = mark;
6953 }
6954 res = NULL;
6955 done:
6956 return res;
6957}
6958
6959// Left-recursive
6960// term:
6961// | term '*' factor
6962// | term '/' factor
6963// | term '//' factor
6964// | term '%' factor
6965// | term '@' factor
6966// | factor
6967static expr_ty term_raw(Parser *);
6968static expr_ty
6969term_rule(Parser *p)
6970{
6971 expr_ty res = NULL;
6972 if (_PyPegen_is_memoized(p, term_type, &res))
6973 return res;
6974 int mark = p->mark;
6975 int resmark = p->mark;
6976 while (1) {
6977 int tmpvar_6 = _PyPegen_update_memo(p, mark, term_type, res);
6978 if (tmpvar_6) {
6979 return res;
6980 }
6981 p->mark = mark;
6982 void *raw = term_raw(p);
6983 if (raw == NULL || p->mark <= resmark)
6984 break;
6985 resmark = p->mark;
6986 res = raw;
6987 }
6988 p->mark = resmark;
6989 return res;
6990}
6991static expr_ty
6992term_raw(Parser *p)
6993{
6994 if (p->error_indicator) {
6995 return NULL;
6996 }
6997 expr_ty res = NULL;
6998 int mark = p->mark;
6999 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7000 p->error_indicator = 1;
7001 return NULL;
7002 }
7003 int start_lineno = p->tokens[mark]->lineno;
7004 UNUSED(start_lineno); // Only used by EXTRA macro
7005 int start_col_offset = p->tokens[mark]->col_offset;
7006 UNUSED(start_col_offset); // Only used by EXTRA macro
7007 { // term '*' factor
7008 expr_ty a;
7009 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007010 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007011 if (
7012 (a = term_rule(p))
7013 &&
7014 (literal = _PyPegen_expect_token(p, 16))
7015 &&
7016 (b = factor_rule(p))
7017 )
7018 {
7019 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7020 if (token == NULL) {
7021 return NULL;
7022 }
7023 int end_lineno = token->end_lineno;
7024 UNUSED(end_lineno); // Only used by EXTRA macro
7025 int end_col_offset = token->end_col_offset;
7026 UNUSED(end_col_offset); // Only used by EXTRA macro
7027 res = _Py_BinOp ( a , Mult , b , EXTRA );
7028 if (res == NULL && PyErr_Occurred()) {
7029 p->error_indicator = 1;
7030 return NULL;
7031 }
7032 goto done;
7033 }
7034 p->mark = mark;
7035 }
7036 { // term '/' factor
7037 expr_ty a;
7038 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007039 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007040 if (
7041 (a = term_rule(p))
7042 &&
7043 (literal = _PyPegen_expect_token(p, 17))
7044 &&
7045 (b = factor_rule(p))
7046 )
7047 {
7048 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7049 if (token == NULL) {
7050 return NULL;
7051 }
7052 int end_lineno = token->end_lineno;
7053 UNUSED(end_lineno); // Only used by EXTRA macro
7054 int end_col_offset = token->end_col_offset;
7055 UNUSED(end_col_offset); // Only used by EXTRA macro
7056 res = _Py_BinOp ( a , Div , b , EXTRA );
7057 if (res == NULL && PyErr_Occurred()) {
7058 p->error_indicator = 1;
7059 return NULL;
7060 }
7061 goto done;
7062 }
7063 p->mark = mark;
7064 }
7065 { // term '//' factor
7066 expr_ty a;
7067 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007068 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007069 if (
7070 (a = term_rule(p))
7071 &&
7072 (literal = _PyPegen_expect_token(p, 47))
7073 &&
7074 (b = factor_rule(p))
7075 )
7076 {
7077 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7078 if (token == NULL) {
7079 return NULL;
7080 }
7081 int end_lineno = token->end_lineno;
7082 UNUSED(end_lineno); // Only used by EXTRA macro
7083 int end_col_offset = token->end_col_offset;
7084 UNUSED(end_col_offset); // Only used by EXTRA macro
7085 res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
7086 if (res == NULL && PyErr_Occurred()) {
7087 p->error_indicator = 1;
7088 return NULL;
7089 }
7090 goto done;
7091 }
7092 p->mark = mark;
7093 }
7094 { // term '%' factor
7095 expr_ty a;
7096 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007097 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007098 if (
7099 (a = term_rule(p))
7100 &&
7101 (literal = _PyPegen_expect_token(p, 24))
7102 &&
7103 (b = factor_rule(p))
7104 )
7105 {
7106 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7107 if (token == NULL) {
7108 return NULL;
7109 }
7110 int end_lineno = token->end_lineno;
7111 UNUSED(end_lineno); // Only used by EXTRA macro
7112 int end_col_offset = token->end_col_offset;
7113 UNUSED(end_col_offset); // Only used by EXTRA macro
7114 res = _Py_BinOp ( a , Mod , b , EXTRA );
7115 if (res == NULL && PyErr_Occurred()) {
7116 p->error_indicator = 1;
7117 return NULL;
7118 }
7119 goto done;
7120 }
7121 p->mark = mark;
7122 }
7123 { // term '@' factor
7124 expr_ty a;
7125 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007126 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007127 if (
7128 (a = term_rule(p))
7129 &&
7130 (literal = _PyPegen_expect_token(p, 49))
7131 &&
7132 (b = factor_rule(p))
7133 )
7134 {
7135 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7136 if (token == NULL) {
7137 return NULL;
7138 }
7139 int end_lineno = token->end_lineno;
7140 UNUSED(end_lineno); // Only used by EXTRA macro
7141 int end_col_offset = token->end_col_offset;
7142 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03007143 res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007144 if (res == NULL && PyErr_Occurred()) {
7145 p->error_indicator = 1;
7146 return NULL;
7147 }
7148 goto done;
7149 }
7150 p->mark = mark;
7151 }
7152 { // factor
7153 expr_ty factor_var;
7154 if (
7155 (factor_var = factor_rule(p))
7156 )
7157 {
7158 res = factor_var;
7159 goto done;
7160 }
7161 p->mark = mark;
7162 }
7163 res = NULL;
7164 done:
7165 return res;
7166}
7167
7168// factor: '+' factor | '-' factor | '~' factor | power
7169static expr_ty
7170factor_rule(Parser *p)
7171{
7172 if (p->error_indicator) {
7173 return NULL;
7174 }
7175 expr_ty res = NULL;
7176 if (_PyPegen_is_memoized(p, factor_type, &res))
7177 return res;
7178 int mark = p->mark;
7179 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7180 p->error_indicator = 1;
7181 return NULL;
7182 }
7183 int start_lineno = p->tokens[mark]->lineno;
7184 UNUSED(start_lineno); // Only used by EXTRA macro
7185 int start_col_offset = p->tokens[mark]->col_offset;
7186 UNUSED(start_col_offset); // Only used by EXTRA macro
7187 { // '+' factor
7188 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007189 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007190 if (
7191 (literal = _PyPegen_expect_token(p, 14))
7192 &&
7193 (a = factor_rule(p))
7194 )
7195 {
7196 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7197 if (token == NULL) {
7198 return NULL;
7199 }
7200 int end_lineno = token->end_lineno;
7201 UNUSED(end_lineno); // Only used by EXTRA macro
7202 int end_col_offset = token->end_col_offset;
7203 UNUSED(end_col_offset); // Only used by EXTRA macro
7204 res = _Py_UnaryOp ( UAdd , a , EXTRA );
7205 if (res == NULL && PyErr_Occurred()) {
7206 p->error_indicator = 1;
7207 return NULL;
7208 }
7209 goto done;
7210 }
7211 p->mark = mark;
7212 }
7213 { // '-' factor
7214 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007215 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007216 if (
7217 (literal = _PyPegen_expect_token(p, 15))
7218 &&
7219 (a = factor_rule(p))
7220 )
7221 {
7222 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7223 if (token == NULL) {
7224 return NULL;
7225 }
7226 int end_lineno = token->end_lineno;
7227 UNUSED(end_lineno); // Only used by EXTRA macro
7228 int end_col_offset = token->end_col_offset;
7229 UNUSED(end_col_offset); // Only used by EXTRA macro
7230 res = _Py_UnaryOp ( USub , a , EXTRA );
7231 if (res == NULL && PyErr_Occurred()) {
7232 p->error_indicator = 1;
7233 return NULL;
7234 }
7235 goto done;
7236 }
7237 p->mark = mark;
7238 }
7239 { // '~' factor
7240 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007241 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007242 if (
7243 (literal = _PyPegen_expect_token(p, 31))
7244 &&
7245 (a = factor_rule(p))
7246 )
7247 {
7248 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7249 if (token == NULL) {
7250 return NULL;
7251 }
7252 int end_lineno = token->end_lineno;
7253 UNUSED(end_lineno); // Only used by EXTRA macro
7254 int end_col_offset = token->end_col_offset;
7255 UNUSED(end_col_offset); // Only used by EXTRA macro
7256 res = _Py_UnaryOp ( Invert , a , EXTRA );
7257 if (res == NULL && PyErr_Occurred()) {
7258 p->error_indicator = 1;
7259 return NULL;
7260 }
7261 goto done;
7262 }
7263 p->mark = mark;
7264 }
7265 { // power
7266 expr_ty power_var;
7267 if (
7268 (power_var = power_rule(p))
7269 )
7270 {
7271 res = power_var;
7272 goto done;
7273 }
7274 p->mark = mark;
7275 }
7276 res = NULL;
7277 done:
7278 _PyPegen_insert_memo(p, mark, factor_type, res);
7279 return res;
7280}
7281
7282// power: await_primary '**' factor | await_primary
7283static expr_ty
7284power_rule(Parser *p)
7285{
7286 if (p->error_indicator) {
7287 return NULL;
7288 }
7289 expr_ty res = NULL;
7290 int mark = p->mark;
7291 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7292 p->error_indicator = 1;
7293 return NULL;
7294 }
7295 int start_lineno = p->tokens[mark]->lineno;
7296 UNUSED(start_lineno); // Only used by EXTRA macro
7297 int start_col_offset = p->tokens[mark]->col_offset;
7298 UNUSED(start_col_offset); // Only used by EXTRA macro
7299 { // await_primary '**' factor
7300 expr_ty a;
7301 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007302 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007303 if (
7304 (a = await_primary_rule(p))
7305 &&
7306 (literal = _PyPegen_expect_token(p, 35))
7307 &&
7308 (b = factor_rule(p))
7309 )
7310 {
7311 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7312 if (token == NULL) {
7313 return NULL;
7314 }
7315 int end_lineno = token->end_lineno;
7316 UNUSED(end_lineno); // Only used by EXTRA macro
7317 int end_col_offset = token->end_col_offset;
7318 UNUSED(end_col_offset); // Only used by EXTRA macro
7319 res = _Py_BinOp ( a , Pow , b , EXTRA );
7320 if (res == NULL && PyErr_Occurred()) {
7321 p->error_indicator = 1;
7322 return NULL;
7323 }
7324 goto done;
7325 }
7326 p->mark = mark;
7327 }
7328 { // await_primary
7329 expr_ty await_primary_var;
7330 if (
7331 (await_primary_var = await_primary_rule(p))
7332 )
7333 {
7334 res = await_primary_var;
7335 goto done;
7336 }
7337 p->mark = mark;
7338 }
7339 res = NULL;
7340 done:
7341 return res;
7342}
7343
7344// await_primary: AWAIT primary | primary
7345static expr_ty
7346await_primary_rule(Parser *p)
7347{
7348 if (p->error_indicator) {
7349 return NULL;
7350 }
7351 expr_ty res = NULL;
7352 if (_PyPegen_is_memoized(p, await_primary_type, &res))
7353 return res;
7354 int mark = p->mark;
7355 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7356 p->error_indicator = 1;
7357 return NULL;
7358 }
7359 int start_lineno = p->tokens[mark]->lineno;
7360 UNUSED(start_lineno); // Only used by EXTRA macro
7361 int start_col_offset = p->tokens[mark]->col_offset;
7362 UNUSED(start_col_offset); // Only used by EXTRA macro
7363 { // AWAIT primary
7364 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007365 Token * await_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007366 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +01007367 (await_var = _PyPegen_expect_token(p, AWAIT))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007368 &&
7369 (a = primary_rule(p))
7370 )
7371 {
7372 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7373 if (token == NULL) {
7374 return NULL;
7375 }
7376 int end_lineno = token->end_lineno;
7377 UNUSED(end_lineno); // Only used by EXTRA macro
7378 int end_col_offset = token->end_col_offset;
7379 UNUSED(end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03007380 res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007381 if (res == NULL && PyErr_Occurred()) {
7382 p->error_indicator = 1;
7383 return NULL;
7384 }
7385 goto done;
7386 }
7387 p->mark = mark;
7388 }
7389 { // primary
7390 expr_ty primary_var;
7391 if (
7392 (primary_var = primary_rule(p))
7393 )
7394 {
7395 res = primary_var;
7396 goto done;
7397 }
7398 p->mark = mark;
7399 }
7400 res = NULL;
7401 done:
7402 _PyPegen_insert_memo(p, mark, await_primary_type, res);
7403 return res;
7404}
7405
7406// Left-recursive
7407// primary:
7408// | primary '.' NAME
7409// | primary genexp
7410// | primary '(' arguments? ')'
7411// | primary '[' slices ']'
7412// | atom
7413static expr_ty primary_raw(Parser *);
7414static expr_ty
7415primary_rule(Parser *p)
7416{
7417 expr_ty res = NULL;
7418 if (_PyPegen_is_memoized(p, primary_type, &res))
7419 return res;
7420 int mark = p->mark;
7421 int resmark = p->mark;
7422 while (1) {
7423 int tmpvar_7 = _PyPegen_update_memo(p, mark, primary_type, res);
7424 if (tmpvar_7) {
7425 return res;
7426 }
7427 p->mark = mark;
7428 void *raw = primary_raw(p);
7429 if (raw == NULL || p->mark <= resmark)
7430 break;
7431 resmark = p->mark;
7432 res = raw;
7433 }
7434 p->mark = resmark;
7435 return res;
7436}
7437static expr_ty
7438primary_raw(Parser *p)
7439{
7440 if (p->error_indicator) {
7441 return NULL;
7442 }
7443 expr_ty res = NULL;
7444 int mark = p->mark;
7445 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7446 p->error_indicator = 1;
7447 return NULL;
7448 }
7449 int start_lineno = p->tokens[mark]->lineno;
7450 UNUSED(start_lineno); // Only used by EXTRA macro
7451 int start_col_offset = p->tokens[mark]->col_offset;
7452 UNUSED(start_col_offset); // Only used by EXTRA macro
7453 { // primary '.' NAME
7454 expr_ty a;
7455 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007456 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007457 if (
7458 (a = primary_rule(p))
7459 &&
7460 (literal = _PyPegen_expect_token(p, 23))
7461 &&
7462 (b = _PyPegen_name_token(p))
7463 )
7464 {
7465 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7466 if (token == NULL) {
7467 return NULL;
7468 }
7469 int end_lineno = token->end_lineno;
7470 UNUSED(end_lineno); // Only used by EXTRA macro
7471 int end_col_offset = token->end_col_offset;
7472 UNUSED(end_col_offset); // Only used by EXTRA macro
7473 res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
7474 if (res == NULL && PyErr_Occurred()) {
7475 p->error_indicator = 1;
7476 return NULL;
7477 }
7478 goto done;
7479 }
7480 p->mark = mark;
7481 }
7482 { // primary genexp
7483 expr_ty a;
7484 expr_ty b;
7485 if (
7486 (a = primary_rule(p))
7487 &&
7488 (b = genexp_rule(p))
7489 )
7490 {
7491 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7492 if (token == NULL) {
7493 return NULL;
7494 }
7495 int end_lineno = token->end_lineno;
7496 UNUSED(end_lineno); // Only used by EXTRA macro
7497 int end_col_offset = token->end_col_offset;
7498 UNUSED(end_col_offset); // Only used by EXTRA macro
7499 res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
7500 if (res == NULL && PyErr_Occurred()) {
7501 p->error_indicator = 1;
7502 return NULL;
7503 }
7504 goto done;
7505 }
7506 p->mark = mark;
7507 }
7508 { // primary '(' arguments? ')'
7509 expr_ty a;
7510 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007511 Token * literal;
7512 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007513 if (
7514 (a = primary_rule(p))
7515 &&
7516 (literal = _PyPegen_expect_token(p, 7))
7517 &&
7518 (b = arguments_rule(p), 1)
7519 &&
7520 (literal_1 = _PyPegen_expect_token(p, 8))
7521 )
7522 {
7523 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7524 if (token == NULL) {
7525 return NULL;
7526 }
7527 int end_lineno = token->end_lineno;
7528 UNUSED(end_lineno); // Only used by EXTRA macro
7529 int end_col_offset = token->end_col_offset;
7530 UNUSED(end_col_offset); // Only used by EXTRA macro
7531 res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
7532 if (res == NULL && PyErr_Occurred()) {
7533 p->error_indicator = 1;
7534 return NULL;
7535 }
7536 goto done;
7537 }
7538 p->mark = mark;
7539 }
7540 { // primary '[' slices ']'
7541 expr_ty a;
7542 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007543 Token * literal;
7544 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007545 if (
7546 (a = primary_rule(p))
7547 &&
7548 (literal = _PyPegen_expect_token(p, 9))
7549 &&
7550 (b = slices_rule(p))
7551 &&
7552 (literal_1 = _PyPegen_expect_token(p, 10))
7553 )
7554 {
7555 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7556 if (token == NULL) {
7557 return NULL;
7558 }
7559 int end_lineno = token->end_lineno;
7560 UNUSED(end_lineno); // Only used by EXTRA macro
7561 int end_col_offset = token->end_col_offset;
7562 UNUSED(end_col_offset); // Only used by EXTRA macro
7563 res = _Py_Subscript ( a , b , Load , EXTRA );
7564 if (res == NULL && PyErr_Occurred()) {
7565 p->error_indicator = 1;
7566 return NULL;
7567 }
7568 goto done;
7569 }
7570 p->mark = mark;
7571 }
7572 { // atom
7573 expr_ty atom_var;
7574 if (
7575 (atom_var = atom_rule(p))
7576 )
7577 {
7578 res = atom_var;
7579 goto done;
7580 }
7581 p->mark = mark;
7582 }
7583 res = NULL;
7584 done:
7585 return res;
7586}
7587
7588// slices: slice !',' | ','.slice+ ','?
7589static expr_ty
7590slices_rule(Parser *p)
7591{
7592 if (p->error_indicator) {
7593 return NULL;
7594 }
7595 expr_ty res = NULL;
7596 int mark = p->mark;
7597 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7598 p->error_indicator = 1;
7599 return NULL;
7600 }
7601 int start_lineno = p->tokens[mark]->lineno;
7602 UNUSED(start_lineno); // Only used by EXTRA macro
7603 int start_col_offset = p->tokens[mark]->col_offset;
7604 UNUSED(start_col_offset); // Only used by EXTRA macro
7605 { // slice !','
7606 expr_ty a;
7607 if (
7608 (a = slice_rule(p))
7609 &&
7610 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)
7611 )
7612 {
7613 res = a;
7614 if (res == NULL && PyErr_Occurred()) {
7615 p->error_indicator = 1;
7616 return NULL;
7617 }
7618 goto done;
7619 }
7620 p->mark = mark;
7621 }
7622 { // ','.slice+ ','?
7623 asdl_seq * a;
7624 void *opt_var;
7625 UNUSED(opt_var); // Silence compiler warnings
7626 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07007627 (a = _gather_93_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007628 &&
7629 (opt_var = _PyPegen_expect_token(p, 12), 1)
7630 )
7631 {
7632 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7633 if (token == NULL) {
7634 return NULL;
7635 }
7636 int end_lineno = token->end_lineno;
7637 UNUSED(end_lineno); // Only used by EXTRA macro
7638 int end_col_offset = token->end_col_offset;
7639 UNUSED(end_col_offset); // Only used by EXTRA macro
7640 res = _Py_Tuple ( a , Load , EXTRA );
7641 if (res == NULL && PyErr_Occurred()) {
7642 p->error_indicator = 1;
7643 return NULL;
7644 }
7645 goto done;
7646 }
7647 p->mark = mark;
7648 }
7649 res = NULL;
7650 done:
7651 return res;
7652}
7653
7654// slice: expression? ':' expression? [':' expression?] | expression
7655static expr_ty
7656slice_rule(Parser *p)
7657{
7658 if (p->error_indicator) {
7659 return NULL;
7660 }
7661 expr_ty res = NULL;
7662 int mark = p->mark;
7663 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7664 p->error_indicator = 1;
7665 return NULL;
7666 }
7667 int start_lineno = p->tokens[mark]->lineno;
7668 UNUSED(start_lineno); // Only used by EXTRA macro
7669 int start_col_offset = p->tokens[mark]->col_offset;
7670 UNUSED(start_col_offset); // Only used by EXTRA macro
7671 { // expression? ':' expression? [':' expression?]
7672 void *a;
7673 void *b;
7674 void *c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007675 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007676 if (
7677 (a = expression_rule(p), 1)
7678 &&
7679 (literal = _PyPegen_expect_token(p, 11))
7680 &&
7681 (b = expression_rule(p), 1)
7682 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07007683 (c = _tmp_95_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007684 )
7685 {
7686 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7687 if (token == NULL) {
7688 return NULL;
7689 }
7690 int end_lineno = token->end_lineno;
7691 UNUSED(end_lineno); // Only used by EXTRA macro
7692 int end_col_offset = token->end_col_offset;
7693 UNUSED(end_col_offset); // Only used by EXTRA macro
7694 res = _Py_Slice ( a , b , c , EXTRA );
7695 if (res == NULL && PyErr_Occurred()) {
7696 p->error_indicator = 1;
7697 return NULL;
7698 }
7699 goto done;
7700 }
7701 p->mark = mark;
7702 }
7703 { // expression
7704 expr_ty a;
7705 if (
7706 (a = expression_rule(p))
7707 )
7708 {
7709 res = a;
7710 if (res == NULL && PyErr_Occurred()) {
7711 p->error_indicator = 1;
7712 return NULL;
7713 }
7714 goto done;
7715 }
7716 p->mark = mark;
7717 }
7718 res = NULL;
7719 done:
7720 return res;
7721}
7722
7723// atom:
7724// | NAME
7725// | 'True'
7726// | 'False'
7727// | 'None'
7728// | '__new_parser__'
7729// | &STRING strings
7730// | NUMBER
7731// | &'(' (tuple | group | genexp)
7732// | &'[' (list | listcomp)
7733// | &'{' (dict | set | dictcomp | setcomp)
7734// | '...'
7735static expr_ty
7736atom_rule(Parser *p)
7737{
7738 if (p->error_indicator) {
7739 return NULL;
7740 }
7741 expr_ty res = NULL;
7742 int mark = p->mark;
7743 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7744 p->error_indicator = 1;
7745 return NULL;
7746 }
7747 int start_lineno = p->tokens[mark]->lineno;
7748 UNUSED(start_lineno); // Only used by EXTRA macro
7749 int start_col_offset = p->tokens[mark]->col_offset;
7750 UNUSED(start_col_offset); // Only used by EXTRA macro
7751 { // NAME
7752 expr_ty name_var;
7753 if (
7754 (name_var = _PyPegen_name_token(p))
7755 )
7756 {
7757 res = name_var;
7758 goto done;
7759 }
7760 p->mark = mark;
7761 }
7762 { // 'True'
Pablo Galindob796b3f2020-05-01 12:32:26 +01007763 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007764 if (
7765 (keyword = _PyPegen_expect_token(p, 527))
7766 )
7767 {
7768 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7769 if (token == NULL) {
7770 return NULL;
7771 }
7772 int end_lineno = token->end_lineno;
7773 UNUSED(end_lineno); // Only used by EXTRA macro
7774 int end_col_offset = token->end_col_offset;
7775 UNUSED(end_col_offset); // Only used by EXTRA macro
7776 res = _Py_Constant ( Py_True , NULL , EXTRA );
7777 if (res == NULL && PyErr_Occurred()) {
7778 p->error_indicator = 1;
7779 return NULL;
7780 }
7781 goto done;
7782 }
7783 p->mark = mark;
7784 }
7785 { // 'False'
Pablo Galindob796b3f2020-05-01 12:32:26 +01007786 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007787 if (
7788 (keyword = _PyPegen_expect_token(p, 528))
7789 )
7790 {
7791 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7792 if (token == NULL) {
7793 return NULL;
7794 }
7795 int end_lineno = token->end_lineno;
7796 UNUSED(end_lineno); // Only used by EXTRA macro
7797 int end_col_offset = token->end_col_offset;
7798 UNUSED(end_col_offset); // Only used by EXTRA macro
7799 res = _Py_Constant ( Py_False , NULL , EXTRA );
7800 if (res == NULL && PyErr_Occurred()) {
7801 p->error_indicator = 1;
7802 return NULL;
7803 }
7804 goto done;
7805 }
7806 p->mark = mark;
7807 }
7808 { // 'None'
Pablo Galindob796b3f2020-05-01 12:32:26 +01007809 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007810 if (
7811 (keyword = _PyPegen_expect_token(p, 529))
7812 )
7813 {
7814 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7815 if (token == NULL) {
7816 return NULL;
7817 }
7818 int end_lineno = token->end_lineno;
7819 UNUSED(end_lineno); // Only used by EXTRA macro
7820 int end_col_offset = token->end_col_offset;
7821 UNUSED(end_col_offset); // Only used by EXTRA macro
7822 res = _Py_Constant ( Py_None , NULL , EXTRA );
7823 if (res == NULL && PyErr_Occurred()) {
7824 p->error_indicator = 1;
7825 return NULL;
7826 }
7827 goto done;
7828 }
7829 p->mark = mark;
7830 }
7831 { // '__new_parser__'
Pablo Galindob796b3f2020-05-01 12:32:26 +01007832 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007833 if (
7834 (keyword = _PyPegen_expect_token(p, 530))
7835 )
7836 {
7837 res = RAISE_SYNTAX_ERROR ( "You found it!" );
7838 if (res == NULL && PyErr_Occurred()) {
7839 p->error_indicator = 1;
7840 return NULL;
7841 }
7842 goto done;
7843 }
7844 p->mark = mark;
7845 }
7846 { // &STRING strings
7847 expr_ty strings_var;
7848 if (
7849 _PyPegen_lookahead(1, _PyPegen_string_token, p)
7850 &&
7851 (strings_var = strings_rule(p))
7852 )
7853 {
7854 res = strings_var;
7855 goto done;
7856 }
7857 p->mark = mark;
7858 }
7859 { // NUMBER
7860 expr_ty number_var;
7861 if (
7862 (number_var = _PyPegen_number_token(p))
7863 )
7864 {
7865 res = number_var;
7866 goto done;
7867 }
7868 p->mark = mark;
7869 }
7870 { // &'(' (tuple | group | genexp)
Guido van Rossum3941d972020-05-01 09:42:03 -07007871 void *_tmp_96_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007872 if (
Pablo Galindo2b74c832020-04-27 18:02:07 +01007873 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007874 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07007875 (_tmp_96_var = _tmp_96_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007876 )
7877 {
Guido van Rossum3941d972020-05-01 09:42:03 -07007878 res = _tmp_96_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007879 goto done;
7880 }
7881 p->mark = mark;
7882 }
Pablo Galindo2b74c832020-04-27 18:02:07 +01007883 { // &'[' (list | listcomp)
Guido van Rossum3941d972020-05-01 09:42:03 -07007884 void *_tmp_97_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007885 if (
Pablo Galindo2b74c832020-04-27 18:02:07 +01007886 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007887 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07007888 (_tmp_97_var = _tmp_97_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007889 )
7890 {
Guido van Rossum3941d972020-05-01 09:42:03 -07007891 res = _tmp_97_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007892 goto done;
7893 }
7894 p->mark = mark;
7895 }
Pablo Galindo2b74c832020-04-27 18:02:07 +01007896 { // &'{' (dict | set | dictcomp | setcomp)
Guido van Rossum3941d972020-05-01 09:42:03 -07007897 void *_tmp_98_var;
Pablo Galindo2b74c832020-04-27 18:02:07 +01007898 if (
7899 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25)
7900 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07007901 (_tmp_98_var = _tmp_98_rule(p))
Pablo Galindo2b74c832020-04-27 18:02:07 +01007902 )
7903 {
Guido van Rossum3941d972020-05-01 09:42:03 -07007904 res = _tmp_98_var;
Pablo Galindo2b74c832020-04-27 18:02:07 +01007905 goto done;
7906 }
7907 p->mark = mark;
7908 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007909 { // '...'
Pablo Galindob796b3f2020-05-01 12:32:26 +01007910 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007911 if (
7912 (literal = _PyPegen_expect_token(p, 52))
7913 )
7914 {
7915 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7916 if (token == NULL) {
7917 return NULL;
7918 }
7919 int end_lineno = token->end_lineno;
7920 UNUSED(end_lineno); // Only used by EXTRA macro
7921 int end_col_offset = token->end_col_offset;
7922 UNUSED(end_col_offset); // Only used by EXTRA macro
7923 res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
7924 if (res == NULL && PyErr_Occurred()) {
7925 p->error_indicator = 1;
7926 return NULL;
7927 }
7928 goto done;
7929 }
7930 p->mark = mark;
7931 }
7932 res = NULL;
7933 done:
7934 return res;
7935}
7936
7937// strings: STRING+
7938static expr_ty
7939strings_rule(Parser *p)
7940{
7941 if (p->error_indicator) {
7942 return NULL;
7943 }
7944 expr_ty res = NULL;
7945 if (_PyPegen_is_memoized(p, strings_type, &res))
7946 return res;
7947 int mark = p->mark;
7948 { // STRING+
7949 asdl_seq * a;
7950 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07007951 (a = _loop1_99_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007952 )
7953 {
7954 res = _PyPegen_concatenate_strings ( p , a );
7955 if (res == NULL && PyErr_Occurred()) {
7956 p->error_indicator = 1;
7957 return NULL;
7958 }
7959 goto done;
7960 }
7961 p->mark = mark;
7962 }
7963 res = NULL;
7964 done:
7965 _PyPegen_insert_memo(p, mark, strings_type, res);
7966 return res;
7967}
7968
7969// list: '[' star_named_expressions? ']'
7970static expr_ty
7971list_rule(Parser *p)
7972{
7973 if (p->error_indicator) {
7974 return NULL;
7975 }
7976 expr_ty res = NULL;
7977 int mark = p->mark;
7978 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7979 p->error_indicator = 1;
7980 return NULL;
7981 }
7982 int start_lineno = p->tokens[mark]->lineno;
7983 UNUSED(start_lineno); // Only used by EXTRA macro
7984 int start_col_offset = p->tokens[mark]->col_offset;
7985 UNUSED(start_col_offset); // Only used by EXTRA macro
7986 { // '[' star_named_expressions? ']'
7987 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01007988 Token * literal;
7989 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01007990 if (
7991 (literal = _PyPegen_expect_token(p, 9))
7992 &&
7993 (a = star_named_expressions_rule(p), 1)
7994 &&
7995 (literal_1 = _PyPegen_expect_token(p, 10))
7996 )
7997 {
7998 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
7999 if (token == NULL) {
8000 return NULL;
8001 }
8002 int end_lineno = token->end_lineno;
8003 UNUSED(end_lineno); // Only used by EXTRA macro
8004 int end_col_offset = token->end_col_offset;
8005 UNUSED(end_col_offset); // Only used by EXTRA macro
8006 res = _Py_List ( a , Load , EXTRA );
8007 if (res == NULL && PyErr_Occurred()) {
8008 p->error_indicator = 1;
8009 return NULL;
8010 }
8011 goto done;
8012 }
8013 p->mark = mark;
8014 }
8015 res = NULL;
8016 done:
8017 return res;
8018}
8019
8020// listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension
8021static expr_ty
8022listcomp_rule(Parser *p)
8023{
8024 if (p->error_indicator) {
8025 return NULL;
8026 }
8027 expr_ty res = NULL;
8028 int mark = p->mark;
8029 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8030 p->error_indicator = 1;
8031 return NULL;
8032 }
8033 int start_lineno = p->tokens[mark]->lineno;
8034 UNUSED(start_lineno); // Only used by EXTRA macro
8035 int start_col_offset = p->tokens[mark]->col_offset;
8036 UNUSED(start_col_offset); // Only used by EXTRA macro
8037 { // '[' named_expression for_if_clauses ']'
8038 expr_ty a;
8039 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008040 Token * literal;
8041 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008042 if (
8043 (literal = _PyPegen_expect_token(p, 9))
8044 &&
8045 (a = named_expression_rule(p))
8046 &&
8047 (b = for_if_clauses_rule(p))
8048 &&
8049 (literal_1 = _PyPegen_expect_token(p, 10))
8050 )
8051 {
8052 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8053 if (token == NULL) {
8054 return NULL;
8055 }
8056 int end_lineno = token->end_lineno;
8057 UNUSED(end_lineno); // Only used by EXTRA macro
8058 int end_col_offset = token->end_col_offset;
8059 UNUSED(end_col_offset); // Only used by EXTRA macro
8060 res = _Py_ListComp ( a , b , EXTRA );
8061 if (res == NULL && PyErr_Occurred()) {
8062 p->error_indicator = 1;
8063 return NULL;
8064 }
8065 goto done;
8066 }
8067 p->mark = mark;
8068 }
8069 { // invalid_comprehension
8070 void *invalid_comprehension_var;
8071 if (
8072 (invalid_comprehension_var = invalid_comprehension_rule(p))
8073 )
8074 {
8075 res = invalid_comprehension_var;
8076 goto done;
8077 }
8078 p->mark = mark;
8079 }
8080 res = NULL;
8081 done:
8082 return res;
8083}
8084
8085// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
8086static expr_ty
8087tuple_rule(Parser *p)
8088{
8089 if (p->error_indicator) {
8090 return NULL;
8091 }
8092 expr_ty res = NULL;
8093 int mark = p->mark;
8094 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8095 p->error_indicator = 1;
8096 return NULL;
8097 }
8098 int start_lineno = p->tokens[mark]->lineno;
8099 UNUSED(start_lineno); // Only used by EXTRA macro
8100 int start_col_offset = p->tokens[mark]->col_offset;
8101 UNUSED(start_col_offset); // Only used by EXTRA macro
8102 { // '(' [star_named_expression ',' star_named_expressions?] ')'
8103 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008104 Token * literal;
8105 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008106 if (
8107 (literal = _PyPegen_expect_token(p, 7))
8108 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008109 (a = _tmp_100_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008110 &&
8111 (literal_1 = _PyPegen_expect_token(p, 8))
8112 )
8113 {
8114 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8115 if (token == NULL) {
8116 return NULL;
8117 }
8118 int end_lineno = token->end_lineno;
8119 UNUSED(end_lineno); // Only used by EXTRA macro
8120 int end_col_offset = token->end_col_offset;
8121 UNUSED(end_col_offset); // Only used by EXTRA macro
8122 res = _Py_Tuple ( a , Load , EXTRA );
8123 if (res == NULL && PyErr_Occurred()) {
8124 p->error_indicator = 1;
8125 return NULL;
8126 }
8127 goto done;
8128 }
8129 p->mark = mark;
8130 }
8131 res = NULL;
8132 done:
8133 return res;
8134}
8135
8136// group: '(' (yield_expr | named_expression) ')'
8137static expr_ty
8138group_rule(Parser *p)
8139{
8140 if (p->error_indicator) {
8141 return NULL;
8142 }
8143 expr_ty res = NULL;
8144 int mark = p->mark;
8145 { // '(' (yield_expr | named_expression) ')'
8146 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008147 Token * literal;
8148 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008149 if (
8150 (literal = _PyPegen_expect_token(p, 7))
8151 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008152 (a = _tmp_101_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008153 &&
8154 (literal_1 = _PyPegen_expect_token(p, 8))
8155 )
8156 {
8157 res = a;
8158 if (res == NULL && PyErr_Occurred()) {
8159 p->error_indicator = 1;
8160 return NULL;
8161 }
8162 goto done;
8163 }
8164 p->mark = mark;
8165 }
8166 res = NULL;
8167 done:
8168 return res;
8169}
8170
8171// genexp: '(' expression for_if_clauses ')' | invalid_comprehension
8172static expr_ty
8173genexp_rule(Parser *p)
8174{
8175 if (p->error_indicator) {
8176 return NULL;
8177 }
8178 expr_ty res = NULL;
8179 int mark = p->mark;
8180 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8181 p->error_indicator = 1;
8182 return NULL;
8183 }
8184 int start_lineno = p->tokens[mark]->lineno;
8185 UNUSED(start_lineno); // Only used by EXTRA macro
8186 int start_col_offset = p->tokens[mark]->col_offset;
8187 UNUSED(start_col_offset); // Only used by EXTRA macro
8188 { // '(' expression for_if_clauses ')'
8189 expr_ty a;
8190 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008191 Token * literal;
8192 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008193 if (
8194 (literal = _PyPegen_expect_token(p, 7))
8195 &&
8196 (a = expression_rule(p))
8197 &&
8198 (b = for_if_clauses_rule(p))
8199 &&
8200 (literal_1 = _PyPegen_expect_token(p, 8))
8201 )
8202 {
8203 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8204 if (token == NULL) {
8205 return NULL;
8206 }
8207 int end_lineno = token->end_lineno;
8208 UNUSED(end_lineno); // Only used by EXTRA macro
8209 int end_col_offset = token->end_col_offset;
8210 UNUSED(end_col_offset); // Only used by EXTRA macro
8211 res = _Py_GeneratorExp ( a , b , EXTRA );
8212 if (res == NULL && PyErr_Occurred()) {
8213 p->error_indicator = 1;
8214 return NULL;
8215 }
8216 goto done;
8217 }
8218 p->mark = mark;
8219 }
8220 { // invalid_comprehension
8221 void *invalid_comprehension_var;
8222 if (
8223 (invalid_comprehension_var = invalid_comprehension_rule(p))
8224 )
8225 {
8226 res = invalid_comprehension_var;
8227 goto done;
8228 }
8229 p->mark = mark;
8230 }
8231 res = NULL;
8232 done:
8233 return res;
8234}
8235
8236// set: '{' expressions_list '}'
8237static expr_ty
8238set_rule(Parser *p)
8239{
8240 if (p->error_indicator) {
8241 return NULL;
8242 }
8243 expr_ty res = NULL;
8244 int mark = p->mark;
8245 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8246 p->error_indicator = 1;
8247 return NULL;
8248 }
8249 int start_lineno = p->tokens[mark]->lineno;
8250 UNUSED(start_lineno); // Only used by EXTRA macro
8251 int start_col_offset = p->tokens[mark]->col_offset;
8252 UNUSED(start_col_offset); // Only used by EXTRA macro
8253 { // '{' expressions_list '}'
8254 asdl_seq* a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008255 Token * literal;
8256 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008257 if (
8258 (literal = _PyPegen_expect_token(p, 25))
8259 &&
8260 (a = expressions_list_rule(p))
8261 &&
8262 (literal_1 = _PyPegen_expect_token(p, 26))
8263 )
8264 {
8265 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8266 if (token == NULL) {
8267 return NULL;
8268 }
8269 int end_lineno = token->end_lineno;
8270 UNUSED(end_lineno); // Only used by EXTRA macro
8271 int end_col_offset = token->end_col_offset;
8272 UNUSED(end_col_offset); // Only used by EXTRA macro
8273 res = _Py_Set ( a , EXTRA );
8274 if (res == NULL && PyErr_Occurred()) {
8275 p->error_indicator = 1;
8276 return NULL;
8277 }
8278 goto done;
8279 }
8280 p->mark = mark;
8281 }
8282 res = NULL;
8283 done:
8284 return res;
8285}
8286
8287// setcomp: '{' expression for_if_clauses '}' | invalid_comprehension
8288static expr_ty
8289setcomp_rule(Parser *p)
8290{
8291 if (p->error_indicator) {
8292 return NULL;
8293 }
8294 expr_ty res = NULL;
8295 int mark = p->mark;
8296 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8297 p->error_indicator = 1;
8298 return NULL;
8299 }
8300 int start_lineno = p->tokens[mark]->lineno;
8301 UNUSED(start_lineno); // Only used by EXTRA macro
8302 int start_col_offset = p->tokens[mark]->col_offset;
8303 UNUSED(start_col_offset); // Only used by EXTRA macro
8304 { // '{' expression for_if_clauses '}'
8305 expr_ty a;
8306 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008307 Token * literal;
8308 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008309 if (
8310 (literal = _PyPegen_expect_token(p, 25))
8311 &&
8312 (a = expression_rule(p))
8313 &&
8314 (b = for_if_clauses_rule(p))
8315 &&
8316 (literal_1 = _PyPegen_expect_token(p, 26))
8317 )
8318 {
8319 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8320 if (token == NULL) {
8321 return NULL;
8322 }
8323 int end_lineno = token->end_lineno;
8324 UNUSED(end_lineno); // Only used by EXTRA macro
8325 int end_col_offset = token->end_col_offset;
8326 UNUSED(end_col_offset); // Only used by EXTRA macro
8327 res = _Py_SetComp ( a , b , EXTRA );
8328 if (res == NULL && PyErr_Occurred()) {
8329 p->error_indicator = 1;
8330 return NULL;
8331 }
8332 goto done;
8333 }
8334 p->mark = mark;
8335 }
8336 { // invalid_comprehension
8337 void *invalid_comprehension_var;
8338 if (
8339 (invalid_comprehension_var = invalid_comprehension_rule(p))
8340 )
8341 {
8342 res = invalid_comprehension_var;
8343 goto done;
8344 }
8345 p->mark = mark;
8346 }
8347 res = NULL;
8348 done:
8349 return res;
8350}
8351
8352// dict: '{' kvpairs? '}'
8353static expr_ty
8354dict_rule(Parser *p)
8355{
8356 if (p->error_indicator) {
8357 return NULL;
8358 }
8359 expr_ty res = NULL;
8360 int mark = p->mark;
8361 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8362 p->error_indicator = 1;
8363 return NULL;
8364 }
8365 int start_lineno = p->tokens[mark]->lineno;
8366 UNUSED(start_lineno); // Only used by EXTRA macro
8367 int start_col_offset = p->tokens[mark]->col_offset;
8368 UNUSED(start_col_offset); // Only used by EXTRA macro
8369 { // '{' kvpairs? '}'
8370 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008371 Token * literal;
8372 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008373 if (
8374 (literal = _PyPegen_expect_token(p, 25))
8375 &&
8376 (a = kvpairs_rule(p), 1)
8377 &&
8378 (literal_1 = _PyPegen_expect_token(p, 26))
8379 )
8380 {
8381 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8382 if (token == NULL) {
8383 return NULL;
8384 }
8385 int end_lineno = token->end_lineno;
8386 UNUSED(end_lineno); // Only used by EXTRA macro
8387 int end_col_offset = token->end_col_offset;
8388 UNUSED(end_col_offset); // Only used by EXTRA macro
8389 res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA );
8390 if (res == NULL && PyErr_Occurred()) {
8391 p->error_indicator = 1;
8392 return NULL;
8393 }
8394 goto done;
8395 }
8396 p->mark = mark;
8397 }
8398 res = NULL;
8399 done:
8400 return res;
8401}
8402
8403// dictcomp: '{' kvpair for_if_clauses '}'
8404static expr_ty
8405dictcomp_rule(Parser *p)
8406{
8407 if (p->error_indicator) {
8408 return NULL;
8409 }
8410 expr_ty res = NULL;
8411 int mark = p->mark;
8412 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8413 p->error_indicator = 1;
8414 return NULL;
8415 }
8416 int start_lineno = p->tokens[mark]->lineno;
8417 UNUSED(start_lineno); // Only used by EXTRA macro
8418 int start_col_offset = p->tokens[mark]->col_offset;
8419 UNUSED(start_col_offset); // Only used by EXTRA macro
8420 { // '{' kvpair for_if_clauses '}'
8421 KeyValuePair* a;
8422 asdl_seq* b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008423 Token * literal;
8424 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008425 if (
8426 (literal = _PyPegen_expect_token(p, 25))
8427 &&
8428 (a = kvpair_rule(p))
8429 &&
8430 (b = for_if_clauses_rule(p))
8431 &&
8432 (literal_1 = _PyPegen_expect_token(p, 26))
8433 )
8434 {
8435 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8436 if (token == NULL) {
8437 return NULL;
8438 }
8439 int end_lineno = token->end_lineno;
8440 UNUSED(end_lineno); // Only used by EXTRA macro
8441 int end_col_offset = token->end_col_offset;
8442 UNUSED(end_col_offset); // Only used by EXTRA macro
8443 res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
8444 if (res == NULL && PyErr_Occurred()) {
8445 p->error_indicator = 1;
8446 return NULL;
8447 }
8448 goto done;
8449 }
8450 p->mark = mark;
8451 }
8452 res = NULL;
8453 done:
8454 return res;
8455}
8456
8457// kvpairs: ','.kvpair+ ','?
8458static asdl_seq*
8459kvpairs_rule(Parser *p)
8460{
8461 if (p->error_indicator) {
8462 return NULL;
8463 }
8464 asdl_seq* res = NULL;
8465 int mark = p->mark;
8466 { // ','.kvpair+ ','?
8467 asdl_seq * a;
8468 void *opt_var;
8469 UNUSED(opt_var); // Silence compiler warnings
8470 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07008471 (a = _gather_102_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008472 &&
8473 (opt_var = _PyPegen_expect_token(p, 12), 1)
8474 )
8475 {
8476 res = a;
8477 if (res == NULL && PyErr_Occurred()) {
8478 p->error_indicator = 1;
8479 return NULL;
8480 }
8481 goto done;
8482 }
8483 p->mark = mark;
8484 }
8485 res = NULL;
8486 done:
8487 return res;
8488}
8489
8490// kvpair: '**' bitwise_or | expression ':' expression
8491static KeyValuePair*
8492kvpair_rule(Parser *p)
8493{
8494 if (p->error_indicator) {
8495 return NULL;
8496 }
8497 KeyValuePair* res = NULL;
8498 int mark = p->mark;
8499 { // '**' bitwise_or
8500 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008501 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008502 if (
8503 (literal = _PyPegen_expect_token(p, 35))
8504 &&
8505 (a = bitwise_or_rule(p))
8506 )
8507 {
8508 res = _PyPegen_key_value_pair ( p , NULL , a );
8509 if (res == NULL && PyErr_Occurred()) {
8510 p->error_indicator = 1;
8511 return NULL;
8512 }
8513 goto done;
8514 }
8515 p->mark = mark;
8516 }
8517 { // expression ':' expression
8518 expr_ty a;
8519 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008520 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008521 if (
8522 (a = expression_rule(p))
8523 &&
8524 (literal = _PyPegen_expect_token(p, 11))
8525 &&
8526 (b = expression_rule(p))
8527 )
8528 {
8529 res = _PyPegen_key_value_pair ( p , a , b );
8530 if (res == NULL && PyErr_Occurred()) {
8531 p->error_indicator = 1;
8532 return NULL;
8533 }
8534 goto done;
8535 }
8536 p->mark = mark;
8537 }
8538 res = NULL;
8539 done:
8540 return res;
8541}
8542
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008543// for_if_clauses: for_if_clause+
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008544static asdl_seq*
8545for_if_clauses_rule(Parser *p)
8546{
8547 if (p->error_indicator) {
8548 return NULL;
8549 }
8550 asdl_seq* res = NULL;
8551 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008552 { // for_if_clause+
Guido van Rossum3941d972020-05-01 09:42:03 -07008553 asdl_seq * _loop1_104_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008554 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07008555 (_loop1_104_var = _loop1_104_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008556 )
8557 {
Guido van Rossum3941d972020-05-01 09:42:03 -07008558 res = _loop1_104_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008559 goto done;
8560 }
8561 p->mark = mark;
8562 }
8563 res = NULL;
8564 done:
8565 return res;
8566}
8567
8568// for_if_clause:
8569// | ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*
8570// | 'for' star_targets 'in' disjunction (('if' disjunction))*
8571static comprehension_ty
8572for_if_clause_rule(Parser *p)
8573{
8574 if (p->error_indicator) {
8575 return NULL;
8576 }
8577 comprehension_ty res = NULL;
8578 int mark = p->mark;
8579 { // ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*
8580 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008581 Token * async_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008582 expr_ty b;
8583 asdl_seq * c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008584 Token * keyword;
8585 Token * keyword_1;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008586 if (
8587 (async_var = _PyPegen_expect_token(p, ASYNC))
8588 &&
8589 (keyword = _PyPegen_expect_token(p, 517))
8590 &&
8591 (a = star_targets_rule(p))
8592 &&
8593 (keyword_1 = _PyPegen_expect_token(p, 518))
8594 &&
8595 (b = disjunction_rule(p))
8596 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008597 (c = _loop0_105_rule(p))
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008598 )
8599 {
8600 res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) );
8601 if (res == NULL && PyErr_Occurred()) {
8602 p->error_indicator = 1;
8603 return NULL;
8604 }
8605 goto done;
8606 }
8607 p->mark = mark;
8608 }
8609 { // 'for' star_targets 'in' disjunction (('if' disjunction))*
8610 expr_ty a;
8611 expr_ty b;
8612 asdl_seq * c;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008613 Token * keyword;
8614 Token * keyword_1;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008615 if (
8616 (keyword = _PyPegen_expect_token(p, 517))
8617 &&
8618 (a = star_targets_rule(p))
8619 &&
8620 (keyword_1 = _PyPegen_expect_token(p, 518))
8621 &&
8622 (b = disjunction_rule(p))
8623 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008624 (c = _loop0_106_rule(p))
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +03008625 )
8626 {
8627 res = _Py_comprehension ( a , b , c , 0 , p -> arena );
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008628 if (res == NULL && PyErr_Occurred()) {
8629 p->error_indicator = 1;
8630 return NULL;
8631 }
8632 goto done;
8633 }
8634 p->mark = mark;
8635 }
8636 res = NULL;
8637 done:
8638 return res;
8639}
8640
8641// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
8642static expr_ty
8643yield_expr_rule(Parser *p)
8644{
8645 if (p->error_indicator) {
8646 return NULL;
8647 }
8648 expr_ty res = NULL;
8649 int mark = p->mark;
8650 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8651 p->error_indicator = 1;
8652 return NULL;
8653 }
8654 int start_lineno = p->tokens[mark]->lineno;
8655 UNUSED(start_lineno); // Only used by EXTRA macro
8656 int start_col_offset = p->tokens[mark]->col_offset;
8657 UNUSED(start_col_offset); // Only used by EXTRA macro
8658 { // 'yield' 'from' expression
8659 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008660 Token * keyword;
8661 Token * keyword_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008662 if (
8663 (keyword = _PyPegen_expect_token(p, 504))
8664 &&
8665 (keyword_1 = _PyPegen_expect_token(p, 514))
8666 &&
8667 (a = expression_rule(p))
8668 )
8669 {
8670 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8671 if (token == NULL) {
8672 return NULL;
8673 }
8674 int end_lineno = token->end_lineno;
8675 UNUSED(end_lineno); // Only used by EXTRA macro
8676 int end_col_offset = token->end_col_offset;
8677 UNUSED(end_col_offset); // Only used by EXTRA macro
8678 res = _Py_YieldFrom ( a , EXTRA );
8679 if (res == NULL && PyErr_Occurred()) {
8680 p->error_indicator = 1;
8681 return NULL;
8682 }
8683 goto done;
8684 }
8685 p->mark = mark;
8686 }
8687 { // 'yield' star_expressions?
8688 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008689 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008690 if (
8691 (keyword = _PyPegen_expect_token(p, 504))
8692 &&
8693 (a = star_expressions_rule(p), 1)
8694 )
8695 {
8696 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8697 if (token == NULL) {
8698 return NULL;
8699 }
8700 int end_lineno = token->end_lineno;
8701 UNUSED(end_lineno); // Only used by EXTRA macro
8702 int end_col_offset = token->end_col_offset;
8703 UNUSED(end_col_offset); // Only used by EXTRA macro
8704 res = _Py_Yield ( a , EXTRA );
8705 if (res == NULL && PyErr_Occurred()) {
8706 p->error_indicator = 1;
8707 return NULL;
8708 }
8709 goto done;
8710 }
8711 p->mark = mark;
8712 }
8713 res = NULL;
8714 done:
8715 return res;
8716}
8717
8718// arguments: args ','? &')' | incorrect_arguments
8719static expr_ty
8720arguments_rule(Parser *p)
8721{
8722 if (p->error_indicator) {
8723 return NULL;
8724 }
8725 expr_ty res = NULL;
8726 if (_PyPegen_is_memoized(p, arguments_type, &res))
8727 return res;
8728 int mark = p->mark;
8729 { // args ','? &')'
8730 expr_ty a;
8731 void *opt_var;
8732 UNUSED(opt_var); // Silence compiler warnings
8733 if (
8734 (a = args_rule(p))
8735 &&
8736 (opt_var = _PyPegen_expect_token(p, 12), 1)
8737 &&
8738 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
8739 )
8740 {
8741 res = a;
8742 if (res == NULL && PyErr_Occurred()) {
8743 p->error_indicator = 1;
8744 return NULL;
8745 }
8746 goto done;
8747 }
8748 p->mark = mark;
8749 }
8750 { // incorrect_arguments
8751 void *incorrect_arguments_var;
8752 if (
8753 (incorrect_arguments_var = incorrect_arguments_rule(p))
8754 )
8755 {
8756 res = incorrect_arguments_var;
8757 goto done;
8758 }
8759 p->mark = mark;
8760 }
8761 res = NULL;
8762 done:
8763 _PyPegen_insert_memo(p, mark, arguments_type, res);
8764 return res;
8765}
8766
8767// args: starred_expression [',' args] | kwargs | named_expression [',' args]
8768static expr_ty
8769args_rule(Parser *p)
8770{
8771 if (p->error_indicator) {
8772 return NULL;
8773 }
8774 expr_ty res = NULL;
8775 int mark = p->mark;
8776 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8777 p->error_indicator = 1;
8778 return NULL;
8779 }
8780 int start_lineno = p->tokens[mark]->lineno;
8781 UNUSED(start_lineno); // Only used by EXTRA macro
8782 int start_col_offset = p->tokens[mark]->col_offset;
8783 UNUSED(start_col_offset); // Only used by EXTRA macro
8784 { // starred_expression [',' args]
8785 expr_ty a;
8786 void *b;
8787 if (
8788 (a = starred_expression_rule(p))
8789 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008790 (b = _tmp_107_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008791 )
8792 {
8793 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8794 if (token == NULL) {
8795 return NULL;
8796 }
8797 int end_lineno = token->end_lineno;
8798 UNUSED(end_lineno); // Only used by EXTRA macro
8799 int end_col_offset = token->end_col_offset;
8800 UNUSED(end_col_offset); // Only used by EXTRA macro
8801 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 );
8802 if (res == NULL && PyErr_Occurred()) {
8803 p->error_indicator = 1;
8804 return NULL;
8805 }
8806 goto done;
8807 }
8808 p->mark = mark;
8809 }
8810 { // kwargs
8811 asdl_seq* a;
8812 if (
8813 (a = kwargs_rule(p))
8814 )
8815 {
8816 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8817 if (token == NULL) {
8818 return NULL;
8819 }
8820 int end_lineno = token->end_lineno;
8821 UNUSED(end_lineno); // Only used by EXTRA macro
8822 int end_col_offset = token->end_col_offset;
8823 UNUSED(end_col_offset); // Only used by EXTRA macro
8824 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 );
8825 if (res == NULL && PyErr_Occurred()) {
8826 p->error_indicator = 1;
8827 return NULL;
8828 }
8829 goto done;
8830 }
8831 p->mark = mark;
8832 }
8833 { // named_expression [',' args]
8834 expr_ty a;
8835 void *b;
8836 if (
8837 (a = named_expression_rule(p))
8838 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008839 (b = _tmp_108_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008840 )
8841 {
8842 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8843 if (token == NULL) {
8844 return NULL;
8845 }
8846 int end_lineno = token->end_lineno;
8847 UNUSED(end_lineno); // Only used by EXTRA macro
8848 int end_col_offset = token->end_col_offset;
8849 UNUSED(end_col_offset); // Only used by EXTRA macro
8850 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 );
8851 if (res == NULL && PyErr_Occurred()) {
8852 p->error_indicator = 1;
8853 return NULL;
8854 }
8855 goto done;
8856 }
8857 p->mark = mark;
8858 }
8859 res = NULL;
8860 done:
8861 return res;
8862}
8863
8864// kwargs:
8865// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
8866// | ','.kwarg_or_starred+
8867// | ','.kwarg_or_double_starred+
8868static asdl_seq*
8869kwargs_rule(Parser *p)
8870{
8871 if (p->error_indicator) {
8872 return NULL;
8873 }
8874 asdl_seq* res = NULL;
8875 int mark = p->mark;
8876 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
8877 asdl_seq * a;
8878 asdl_seq * b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008879 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008880 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07008881 (a = _gather_109_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008882 &&
8883 (literal = _PyPegen_expect_token(p, 12))
8884 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07008885 (b = _gather_111_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008886 )
8887 {
8888 res = _PyPegen_join_sequences ( p , a , b );
8889 if (res == NULL && PyErr_Occurred()) {
8890 p->error_indicator = 1;
8891 return NULL;
8892 }
8893 goto done;
8894 }
8895 p->mark = mark;
8896 }
8897 { // ','.kwarg_or_starred+
Guido van Rossum3941d972020-05-01 09:42:03 -07008898 asdl_seq * _gather_113_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008899 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07008900 (_gather_113_var = _gather_113_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008901 )
8902 {
Guido van Rossum3941d972020-05-01 09:42:03 -07008903 res = _gather_113_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008904 goto done;
8905 }
8906 p->mark = mark;
8907 }
8908 { // ','.kwarg_or_double_starred+
Guido van Rossum3941d972020-05-01 09:42:03 -07008909 asdl_seq * _gather_115_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008910 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07008911 (_gather_115_var = _gather_115_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008912 )
8913 {
Guido van Rossum3941d972020-05-01 09:42:03 -07008914 res = _gather_115_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008915 goto done;
8916 }
8917 p->mark = mark;
8918 }
8919 res = NULL;
8920 done:
8921 return res;
8922}
8923
8924// starred_expression: '*' expression
8925static expr_ty
8926starred_expression_rule(Parser *p)
8927{
8928 if (p->error_indicator) {
8929 return NULL;
8930 }
8931 expr_ty res = NULL;
8932 int mark = p->mark;
8933 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8934 p->error_indicator = 1;
8935 return NULL;
8936 }
8937 int start_lineno = p->tokens[mark]->lineno;
8938 UNUSED(start_lineno); // Only used by EXTRA macro
8939 int start_col_offset = p->tokens[mark]->col_offset;
8940 UNUSED(start_col_offset); // Only used by EXTRA macro
8941 { // '*' expression
8942 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008943 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008944 if (
8945 (literal = _PyPegen_expect_token(p, 16))
8946 &&
8947 (a = expression_rule(p))
8948 )
8949 {
8950 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
8951 if (token == NULL) {
8952 return NULL;
8953 }
8954 int end_lineno = token->end_lineno;
8955 UNUSED(end_lineno); // Only used by EXTRA macro
8956 int end_col_offset = token->end_col_offset;
8957 UNUSED(end_col_offset); // Only used by EXTRA macro
8958 res = _Py_Starred ( a , Load , EXTRA );
8959 if (res == NULL && PyErr_Occurred()) {
8960 p->error_indicator = 1;
8961 return NULL;
8962 }
8963 goto done;
8964 }
8965 p->mark = mark;
8966 }
8967 res = NULL;
8968 done:
8969 return res;
8970}
8971
8972// kwarg_or_starred: NAME '=' expression | starred_expression
8973static KeywordOrStarred*
8974kwarg_or_starred_rule(Parser *p)
8975{
8976 if (p->error_indicator) {
8977 return NULL;
8978 }
8979 KeywordOrStarred* res = NULL;
8980 int mark = p->mark;
8981 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8982 p->error_indicator = 1;
8983 return NULL;
8984 }
8985 int start_lineno = p->tokens[mark]->lineno;
8986 UNUSED(start_lineno); // Only used by EXTRA macro
8987 int start_col_offset = p->tokens[mark]->col_offset;
8988 UNUSED(start_col_offset); // Only used by EXTRA macro
8989 { // NAME '=' expression
8990 expr_ty a;
8991 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01008992 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01008993 if (
8994 (a = _PyPegen_name_token(p))
8995 &&
8996 (literal = _PyPegen_expect_token(p, 22))
8997 &&
8998 (b = expression_rule(p))
8999 )
9000 {
9001 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9002 if (token == NULL) {
9003 return NULL;
9004 }
9005 int end_lineno = token->end_lineno;
9006 UNUSED(end_lineno); // Only used by EXTRA macro
9007 int end_col_offset = token->end_col_offset;
9008 UNUSED(end_col_offset); // Only used by EXTRA macro
9009 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
9010 if (res == NULL && PyErr_Occurred()) {
9011 p->error_indicator = 1;
9012 return NULL;
9013 }
9014 goto done;
9015 }
9016 p->mark = mark;
9017 }
9018 { // starred_expression
9019 expr_ty a;
9020 if (
9021 (a = starred_expression_rule(p))
9022 )
9023 {
9024 res = _PyPegen_keyword_or_starred ( p , a , 0 );
9025 if (res == NULL && PyErr_Occurred()) {
9026 p->error_indicator = 1;
9027 return NULL;
9028 }
9029 goto done;
9030 }
9031 p->mark = mark;
9032 }
9033 res = NULL;
9034 done:
9035 return res;
9036}
9037
9038// kwarg_or_double_starred: NAME '=' expression | '**' expression
9039static KeywordOrStarred*
9040kwarg_or_double_starred_rule(Parser *p)
9041{
9042 if (p->error_indicator) {
9043 return NULL;
9044 }
9045 KeywordOrStarred* res = NULL;
9046 int mark = p->mark;
9047 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9048 p->error_indicator = 1;
9049 return NULL;
9050 }
9051 int start_lineno = p->tokens[mark]->lineno;
9052 UNUSED(start_lineno); // Only used by EXTRA macro
9053 int start_col_offset = p->tokens[mark]->col_offset;
9054 UNUSED(start_col_offset); // Only used by EXTRA macro
9055 { // NAME '=' expression
9056 expr_ty a;
9057 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009058 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009059 if (
9060 (a = _PyPegen_name_token(p))
9061 &&
9062 (literal = _PyPegen_expect_token(p, 22))
9063 &&
9064 (b = expression_rule(p))
9065 )
9066 {
9067 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9068 if (token == NULL) {
9069 return NULL;
9070 }
9071 int end_lineno = token->end_lineno;
9072 UNUSED(end_lineno); // Only used by EXTRA macro
9073 int end_col_offset = token->end_col_offset;
9074 UNUSED(end_col_offset); // Only used by EXTRA macro
9075 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
9076 if (res == NULL && PyErr_Occurred()) {
9077 p->error_indicator = 1;
9078 return NULL;
9079 }
9080 goto done;
9081 }
9082 p->mark = mark;
9083 }
9084 { // '**' expression
9085 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009086 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009087 if (
9088 (literal = _PyPegen_expect_token(p, 35))
9089 &&
9090 (a = expression_rule(p))
9091 )
9092 {
9093 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9094 if (token == NULL) {
9095 return NULL;
9096 }
9097 int end_lineno = token->end_lineno;
9098 UNUSED(end_lineno); // Only used by EXTRA macro
9099 int end_col_offset = token->end_col_offset;
9100 UNUSED(end_col_offset); // Only used by EXTRA macro
9101 res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
9102 if (res == NULL && PyErr_Occurred()) {
9103 p->error_indicator = 1;
9104 return NULL;
9105 }
9106 goto done;
9107 }
9108 p->mark = mark;
9109 }
9110 res = NULL;
9111 done:
9112 return res;
9113}
9114
9115// star_targets: star_target !',' | star_target ((',' star_target))* ','?
9116static expr_ty
9117star_targets_rule(Parser *p)
9118{
9119 if (p->error_indicator) {
9120 return NULL;
9121 }
9122 expr_ty res = NULL;
9123 int mark = p->mark;
9124 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9125 p->error_indicator = 1;
9126 return NULL;
9127 }
9128 int start_lineno = p->tokens[mark]->lineno;
9129 UNUSED(start_lineno); // Only used by EXTRA macro
9130 int start_col_offset = p->tokens[mark]->col_offset;
9131 UNUSED(start_col_offset); // Only used by EXTRA macro
9132 { // star_target !','
9133 expr_ty a;
9134 if (
9135 (a = star_target_rule(p))
9136 &&
9137 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)
9138 )
9139 {
9140 res = a;
9141 if (res == NULL && PyErr_Occurred()) {
9142 p->error_indicator = 1;
9143 return NULL;
9144 }
9145 goto done;
9146 }
9147 p->mark = mark;
9148 }
9149 { // star_target ((',' star_target))* ','?
9150 expr_ty a;
9151 asdl_seq * b;
9152 void *opt_var;
9153 UNUSED(opt_var); // Silence compiler warnings
9154 if (
9155 (a = star_target_rule(p))
9156 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07009157 (b = _loop0_117_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009158 &&
9159 (opt_var = _PyPegen_expect_token(p, 12), 1)
9160 )
9161 {
9162 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9163 if (token == NULL) {
9164 return NULL;
9165 }
9166 int end_lineno = token->end_lineno;
9167 UNUSED(end_lineno); // Only used by EXTRA macro
9168 int end_col_offset = token->end_col_offset;
9169 UNUSED(end_col_offset); // Only used by EXTRA macro
9170 res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
9171 if (res == NULL && PyErr_Occurred()) {
9172 p->error_indicator = 1;
9173 return NULL;
9174 }
9175 goto done;
9176 }
9177 p->mark = mark;
9178 }
9179 res = NULL;
9180 done:
9181 return res;
9182}
9183
9184// star_targets_seq: ','.star_target+ ','?
9185static asdl_seq*
9186star_targets_seq_rule(Parser *p)
9187{
9188 if (p->error_indicator) {
9189 return NULL;
9190 }
9191 asdl_seq* res = NULL;
9192 int mark = p->mark;
9193 { // ','.star_target+ ','?
9194 asdl_seq * a;
9195 void *opt_var;
9196 UNUSED(opt_var); // Silence compiler warnings
9197 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07009198 (a = _gather_118_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009199 &&
9200 (opt_var = _PyPegen_expect_token(p, 12), 1)
9201 )
9202 {
9203 res = a;
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_target:
9218// | '*' (!'*' star_target)
9219// | t_primary '.' NAME !t_lookahead
9220// | t_primary '[' slices ']' !t_lookahead
9221// | star_atom
9222static expr_ty
9223star_target_rule(Parser *p)
9224{
9225 if (p->error_indicator) {
9226 return NULL;
9227 }
9228 expr_ty res = NULL;
9229 if (_PyPegen_is_memoized(p, star_target_type, &res))
9230 return res;
9231 int mark = p->mark;
9232 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9233 p->error_indicator = 1;
9234 return NULL;
9235 }
9236 int start_lineno = p->tokens[mark]->lineno;
9237 UNUSED(start_lineno); // Only used by EXTRA macro
9238 int start_col_offset = p->tokens[mark]->col_offset;
9239 UNUSED(start_col_offset); // Only used by EXTRA macro
9240 { // '*' (!'*' star_target)
9241 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009242 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009243 if (
9244 (literal = _PyPegen_expect_token(p, 16))
9245 &&
Guido van Rossum3941d972020-05-01 09:42:03 -07009246 (a = _tmp_120_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009247 )
9248 {
9249 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9250 if (token == NULL) {
9251 return NULL;
9252 }
9253 int end_lineno = token->end_lineno;
9254 UNUSED(end_lineno); // Only used by EXTRA macro
9255 int end_col_offset = token->end_col_offset;
9256 UNUSED(end_col_offset); // Only used by EXTRA macro
9257 res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
9258 if (res == NULL && PyErr_Occurred()) {
9259 p->error_indicator = 1;
9260 return NULL;
9261 }
9262 goto done;
9263 }
9264 p->mark = mark;
9265 }
9266 { // t_primary '.' NAME !t_lookahead
9267 expr_ty a;
9268 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009269 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009270 if (
9271 (a = t_primary_rule(p))
9272 &&
9273 (literal = _PyPegen_expect_token(p, 23))
9274 &&
9275 (b = _PyPegen_name_token(p))
9276 &&
9277 _PyPegen_lookahead(0, t_lookahead_rule, p)
9278 )
9279 {
9280 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9281 if (token == NULL) {
9282 return NULL;
9283 }
9284 int end_lineno = token->end_lineno;
9285 UNUSED(end_lineno); // Only used by EXTRA macro
9286 int end_col_offset = token->end_col_offset;
9287 UNUSED(end_col_offset); // Only used by EXTRA macro
9288 res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
9289 if (res == NULL && PyErr_Occurred()) {
9290 p->error_indicator = 1;
9291 return NULL;
9292 }
9293 goto done;
9294 }
9295 p->mark = mark;
9296 }
9297 { // t_primary '[' slices ']' !t_lookahead
9298 expr_ty a;
9299 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009300 Token * literal;
9301 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009302 if (
9303 (a = t_primary_rule(p))
9304 &&
9305 (literal = _PyPegen_expect_token(p, 9))
9306 &&
9307 (b = slices_rule(p))
9308 &&
9309 (literal_1 = _PyPegen_expect_token(p, 10))
9310 &&
9311 _PyPegen_lookahead(0, t_lookahead_rule, p)
9312 )
9313 {
9314 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9315 if (token == NULL) {
9316 return NULL;
9317 }
9318 int end_lineno = token->end_lineno;
9319 UNUSED(end_lineno); // Only used by EXTRA macro
9320 int end_col_offset = token->end_col_offset;
9321 UNUSED(end_col_offset); // Only used by EXTRA macro
9322 res = _Py_Subscript ( a , b , Store , EXTRA );
9323 if (res == NULL && PyErr_Occurred()) {
9324 p->error_indicator = 1;
9325 return NULL;
9326 }
9327 goto done;
9328 }
9329 p->mark = mark;
9330 }
9331 { // star_atom
9332 expr_ty star_atom_var;
9333 if (
9334 (star_atom_var = star_atom_rule(p))
9335 )
9336 {
9337 res = star_atom_var;
9338 goto done;
9339 }
9340 p->mark = mark;
9341 }
9342 res = NULL;
9343 done:
9344 _PyPegen_insert_memo(p, mark, star_target_type, res);
9345 return res;
9346}
9347
9348// star_atom:
9349// | NAME
9350// | '(' star_target ')'
9351// | '(' star_targets_seq? ')'
9352// | '[' star_targets_seq? ']'
9353static expr_ty
9354star_atom_rule(Parser *p)
9355{
9356 if (p->error_indicator) {
9357 return NULL;
9358 }
9359 expr_ty res = NULL;
9360 int mark = p->mark;
9361 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9362 p->error_indicator = 1;
9363 return NULL;
9364 }
9365 int start_lineno = p->tokens[mark]->lineno;
9366 UNUSED(start_lineno); // Only used by EXTRA macro
9367 int start_col_offset = p->tokens[mark]->col_offset;
9368 UNUSED(start_col_offset); // Only used by EXTRA macro
9369 { // NAME
9370 expr_ty a;
9371 if (
9372 (a = _PyPegen_name_token(p))
9373 )
9374 {
9375 res = _PyPegen_set_expr_context ( p , a , Store );
9376 if (res == NULL && PyErr_Occurred()) {
9377 p->error_indicator = 1;
9378 return NULL;
9379 }
9380 goto done;
9381 }
9382 p->mark = mark;
9383 }
9384 { // '(' star_target ')'
9385 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009386 Token * literal;
9387 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009388 if (
9389 (literal = _PyPegen_expect_token(p, 7))
9390 &&
9391 (a = star_target_rule(p))
9392 &&
9393 (literal_1 = _PyPegen_expect_token(p, 8))
9394 )
9395 {
9396 res = _PyPegen_set_expr_context ( p , a , Store );
9397 if (res == NULL && PyErr_Occurred()) {
9398 p->error_indicator = 1;
9399 return NULL;
9400 }
9401 goto done;
9402 }
9403 p->mark = mark;
9404 }
9405 { // '(' star_targets_seq? ')'
9406 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009407 Token * literal;
9408 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009409 if (
9410 (literal = _PyPegen_expect_token(p, 7))
9411 &&
9412 (a = star_targets_seq_rule(p), 1)
9413 &&
9414 (literal_1 = _PyPegen_expect_token(p, 8))
9415 )
9416 {
9417 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9418 if (token == NULL) {
9419 return NULL;
9420 }
9421 int end_lineno = token->end_lineno;
9422 UNUSED(end_lineno); // Only used by EXTRA macro
9423 int end_col_offset = token->end_col_offset;
9424 UNUSED(end_col_offset); // Only used by EXTRA macro
9425 res = _Py_Tuple ( a , Store , EXTRA );
9426 if (res == NULL && PyErr_Occurred()) {
9427 p->error_indicator = 1;
9428 return NULL;
9429 }
9430 goto done;
9431 }
9432 p->mark = mark;
9433 }
9434 { // '[' star_targets_seq? ']'
9435 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009436 Token * literal;
9437 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009438 if (
9439 (literal = _PyPegen_expect_token(p, 9))
9440 &&
9441 (a = star_targets_seq_rule(p), 1)
9442 &&
9443 (literal_1 = _PyPegen_expect_token(p, 10))
9444 )
9445 {
9446 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9447 if (token == NULL) {
9448 return NULL;
9449 }
9450 int end_lineno = token->end_lineno;
9451 UNUSED(end_lineno); // Only used by EXTRA macro
9452 int end_col_offset = token->end_col_offset;
9453 UNUSED(end_col_offset); // Only used by EXTRA macro
9454 res = _Py_List ( a , Store , EXTRA );
9455 if (res == NULL && PyErr_Occurred()) {
9456 p->error_indicator = 1;
9457 return NULL;
9458 }
9459 goto done;
9460 }
9461 p->mark = mark;
9462 }
9463 res = NULL;
9464 done:
9465 return res;
9466}
9467
9468// inside_paren_ann_assign_target:
9469// | ann_assign_subscript_attribute_target
9470// | NAME
9471// | '(' inside_paren_ann_assign_target ')'
9472static expr_ty
9473inside_paren_ann_assign_target_rule(Parser *p)
9474{
9475 if (p->error_indicator) {
9476 return NULL;
9477 }
9478 expr_ty res = NULL;
9479 int mark = p->mark;
9480 { // ann_assign_subscript_attribute_target
9481 expr_ty ann_assign_subscript_attribute_target_var;
9482 if (
9483 (ann_assign_subscript_attribute_target_var = ann_assign_subscript_attribute_target_rule(p))
9484 )
9485 {
9486 res = ann_assign_subscript_attribute_target_var;
9487 goto done;
9488 }
9489 p->mark = mark;
9490 }
9491 { // NAME
9492 expr_ty a;
9493 if (
9494 (a = _PyPegen_name_token(p))
9495 )
9496 {
9497 res = _PyPegen_set_expr_context ( p , a , Store );
9498 if (res == NULL && PyErr_Occurred()) {
9499 p->error_indicator = 1;
9500 return NULL;
9501 }
9502 goto done;
9503 }
9504 p->mark = mark;
9505 }
9506 { // '(' inside_paren_ann_assign_target ')'
9507 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009508 Token * literal;
9509 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009510 if (
9511 (literal = _PyPegen_expect_token(p, 7))
9512 &&
9513 (a = inside_paren_ann_assign_target_rule(p))
9514 &&
9515 (literal_1 = _PyPegen_expect_token(p, 8))
9516 )
9517 {
9518 res = a;
9519 if (res == NULL && PyErr_Occurred()) {
9520 p->error_indicator = 1;
9521 return NULL;
9522 }
9523 goto done;
9524 }
9525 p->mark = mark;
9526 }
9527 res = NULL;
9528 done:
9529 return res;
9530}
9531
9532// ann_assign_subscript_attribute_target:
9533// | t_primary '.' NAME !t_lookahead
9534// | t_primary '[' slices ']' !t_lookahead
9535static expr_ty
9536ann_assign_subscript_attribute_target_rule(Parser *p)
9537{
9538 if (p->error_indicator) {
9539 return NULL;
9540 }
9541 expr_ty res = NULL;
9542 int mark = p->mark;
9543 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9544 p->error_indicator = 1;
9545 return NULL;
9546 }
9547 int start_lineno = p->tokens[mark]->lineno;
9548 UNUSED(start_lineno); // Only used by EXTRA macro
9549 int start_col_offset = p->tokens[mark]->col_offset;
9550 UNUSED(start_col_offset); // Only used by EXTRA macro
9551 { // t_primary '.' NAME !t_lookahead
9552 expr_ty a;
9553 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009554 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009555 if (
9556 (a = t_primary_rule(p))
9557 &&
9558 (literal = _PyPegen_expect_token(p, 23))
9559 &&
9560 (b = _PyPegen_name_token(p))
9561 &&
9562 _PyPegen_lookahead(0, t_lookahead_rule, p)
9563 )
9564 {
9565 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9566 if (token == NULL) {
9567 return NULL;
9568 }
9569 int end_lineno = token->end_lineno;
9570 UNUSED(end_lineno); // Only used by EXTRA macro
9571 int end_col_offset = token->end_col_offset;
9572 UNUSED(end_col_offset); // Only used by EXTRA macro
9573 res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
9574 if (res == NULL && PyErr_Occurred()) {
9575 p->error_indicator = 1;
9576 return NULL;
9577 }
9578 goto done;
9579 }
9580 p->mark = mark;
9581 }
9582 { // t_primary '[' slices ']' !t_lookahead
9583 expr_ty a;
9584 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009585 Token * literal;
9586 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009587 if (
9588 (a = t_primary_rule(p))
9589 &&
9590 (literal = _PyPegen_expect_token(p, 9))
9591 &&
9592 (b = slices_rule(p))
9593 &&
9594 (literal_1 = _PyPegen_expect_token(p, 10))
9595 &&
9596 _PyPegen_lookahead(0, t_lookahead_rule, p)
9597 )
9598 {
9599 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9600 if (token == NULL) {
9601 return NULL;
9602 }
9603 int end_lineno = token->end_lineno;
9604 UNUSED(end_lineno); // Only used by EXTRA macro
9605 int end_col_offset = token->end_col_offset;
9606 UNUSED(end_col_offset); // Only used by EXTRA macro
9607 res = _Py_Subscript ( a , b , Store , EXTRA );
9608 if (res == NULL && PyErr_Occurred()) {
9609 p->error_indicator = 1;
9610 return NULL;
9611 }
9612 goto done;
9613 }
9614 p->mark = mark;
9615 }
9616 res = NULL;
9617 done:
9618 return res;
9619}
9620
9621// del_targets: ','.del_target+ ','?
9622static asdl_seq*
9623del_targets_rule(Parser *p)
9624{
9625 if (p->error_indicator) {
9626 return NULL;
9627 }
9628 asdl_seq* res = NULL;
9629 int mark = p->mark;
9630 { // ','.del_target+ ','?
9631 asdl_seq * a;
9632 void *opt_var;
9633 UNUSED(opt_var); // Silence compiler warnings
9634 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07009635 (a = _gather_121_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009636 &&
9637 (opt_var = _PyPegen_expect_token(p, 12), 1)
9638 )
9639 {
9640 res = a;
9641 if (res == NULL && PyErr_Occurred()) {
9642 p->error_indicator = 1;
9643 return NULL;
9644 }
9645 goto done;
9646 }
9647 p->mark = mark;
9648 }
9649 res = NULL;
9650 done:
9651 return res;
9652}
9653
9654// del_target:
9655// | t_primary '.' NAME !t_lookahead
9656// | t_primary '[' slices ']' !t_lookahead
9657// | del_t_atom
9658static expr_ty
9659del_target_rule(Parser *p)
9660{
9661 if (p->error_indicator) {
9662 return NULL;
9663 }
9664 expr_ty res = NULL;
9665 if (_PyPegen_is_memoized(p, del_target_type, &res))
9666 return res;
9667 int mark = p->mark;
9668 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9669 p->error_indicator = 1;
9670 return NULL;
9671 }
9672 int start_lineno = p->tokens[mark]->lineno;
9673 UNUSED(start_lineno); // Only used by EXTRA macro
9674 int start_col_offset = p->tokens[mark]->col_offset;
9675 UNUSED(start_col_offset); // Only used by EXTRA macro
9676 { // t_primary '.' NAME !t_lookahead
9677 expr_ty a;
9678 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009679 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009680 if (
9681 (a = t_primary_rule(p))
9682 &&
9683 (literal = _PyPegen_expect_token(p, 23))
9684 &&
9685 (b = _PyPegen_name_token(p))
9686 &&
9687 _PyPegen_lookahead(0, t_lookahead_rule, p)
9688 )
9689 {
9690 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9691 if (token == NULL) {
9692 return NULL;
9693 }
9694 int end_lineno = token->end_lineno;
9695 UNUSED(end_lineno); // Only used by EXTRA macro
9696 int end_col_offset = token->end_col_offset;
9697 UNUSED(end_col_offset); // Only used by EXTRA macro
9698 res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
9699 if (res == NULL && PyErr_Occurred()) {
9700 p->error_indicator = 1;
9701 return NULL;
9702 }
9703 goto done;
9704 }
9705 p->mark = mark;
9706 }
9707 { // t_primary '[' slices ']' !t_lookahead
9708 expr_ty a;
9709 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009710 Token * literal;
9711 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009712 if (
9713 (a = t_primary_rule(p))
9714 &&
9715 (literal = _PyPegen_expect_token(p, 9))
9716 &&
9717 (b = slices_rule(p))
9718 &&
9719 (literal_1 = _PyPegen_expect_token(p, 10))
9720 &&
9721 _PyPegen_lookahead(0, t_lookahead_rule, p)
9722 )
9723 {
9724 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9725 if (token == NULL) {
9726 return NULL;
9727 }
9728 int end_lineno = token->end_lineno;
9729 UNUSED(end_lineno); // Only used by EXTRA macro
9730 int end_col_offset = token->end_col_offset;
9731 UNUSED(end_col_offset); // Only used by EXTRA macro
9732 res = _Py_Subscript ( a , b , Del , EXTRA );
9733 if (res == NULL && PyErr_Occurred()) {
9734 p->error_indicator = 1;
9735 return NULL;
9736 }
9737 goto done;
9738 }
9739 p->mark = mark;
9740 }
9741 { // del_t_atom
9742 expr_ty del_t_atom_var;
9743 if (
9744 (del_t_atom_var = del_t_atom_rule(p))
9745 )
9746 {
9747 res = del_t_atom_var;
9748 goto done;
9749 }
9750 p->mark = mark;
9751 }
9752 res = NULL;
9753 done:
9754 _PyPegen_insert_memo(p, mark, del_target_type, res);
9755 return res;
9756}
9757
9758// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
9759static expr_ty
9760del_t_atom_rule(Parser *p)
9761{
9762 if (p->error_indicator) {
9763 return NULL;
9764 }
9765 expr_ty res = NULL;
9766 int mark = p->mark;
9767 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9768 p->error_indicator = 1;
9769 return NULL;
9770 }
9771 int start_lineno = p->tokens[mark]->lineno;
9772 UNUSED(start_lineno); // Only used by EXTRA macro
9773 int start_col_offset = p->tokens[mark]->col_offset;
9774 UNUSED(start_col_offset); // Only used by EXTRA macro
9775 { // NAME
9776 expr_ty a;
9777 if (
9778 (a = _PyPegen_name_token(p))
9779 )
9780 {
9781 res = _PyPegen_set_expr_context ( p , a , Del );
9782 if (res == NULL && PyErr_Occurred()) {
9783 p->error_indicator = 1;
9784 return NULL;
9785 }
9786 goto done;
9787 }
9788 p->mark = mark;
9789 }
9790 { // '(' del_target ')'
9791 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009792 Token * literal;
9793 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009794 if (
9795 (literal = _PyPegen_expect_token(p, 7))
9796 &&
9797 (a = del_target_rule(p))
9798 &&
9799 (literal_1 = _PyPegen_expect_token(p, 8))
9800 )
9801 {
9802 res = _PyPegen_set_expr_context ( p , a , Del );
9803 if (res == NULL && PyErr_Occurred()) {
9804 p->error_indicator = 1;
9805 return NULL;
9806 }
9807 goto done;
9808 }
9809 p->mark = mark;
9810 }
9811 { // '(' del_targets? ')'
9812 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009813 Token * literal;
9814 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009815 if (
9816 (literal = _PyPegen_expect_token(p, 7))
9817 &&
9818 (a = del_targets_rule(p), 1)
9819 &&
9820 (literal_1 = _PyPegen_expect_token(p, 8))
9821 )
9822 {
9823 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9824 if (token == NULL) {
9825 return NULL;
9826 }
9827 int end_lineno = token->end_lineno;
9828 UNUSED(end_lineno); // Only used by EXTRA macro
9829 int end_col_offset = token->end_col_offset;
9830 UNUSED(end_col_offset); // Only used by EXTRA macro
9831 res = _Py_Tuple ( a , Del , EXTRA );
9832 if (res == NULL && PyErr_Occurred()) {
9833 p->error_indicator = 1;
9834 return NULL;
9835 }
9836 goto done;
9837 }
9838 p->mark = mark;
9839 }
9840 { // '[' del_targets? ']'
9841 void *a;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009842 Token * literal;
9843 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009844 if (
9845 (literal = _PyPegen_expect_token(p, 9))
9846 &&
9847 (a = del_targets_rule(p), 1)
9848 &&
9849 (literal_1 = _PyPegen_expect_token(p, 10))
9850 )
9851 {
9852 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9853 if (token == NULL) {
9854 return NULL;
9855 }
9856 int end_lineno = token->end_lineno;
9857 UNUSED(end_lineno); // Only used by EXTRA macro
9858 int end_col_offset = token->end_col_offset;
9859 UNUSED(end_col_offset); // Only used by EXTRA macro
9860 res = _Py_List ( a , Del , EXTRA );
9861 if (res == NULL && PyErr_Occurred()) {
9862 p->error_indicator = 1;
9863 return NULL;
9864 }
9865 goto done;
9866 }
9867 p->mark = mark;
9868 }
9869 res = NULL;
9870 done:
9871 return res;
9872}
9873
9874// targets: ','.target+ ','?
9875static asdl_seq*
9876targets_rule(Parser *p)
9877{
9878 if (p->error_indicator) {
9879 return NULL;
9880 }
9881 asdl_seq* res = NULL;
9882 int mark = p->mark;
9883 { // ','.target+ ','?
9884 asdl_seq * a;
9885 void *opt_var;
9886 UNUSED(opt_var); // Silence compiler warnings
9887 if (
Guido van Rossum3941d972020-05-01 09:42:03 -07009888 (a = _gather_123_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009889 &&
9890 (opt_var = _PyPegen_expect_token(p, 12), 1)
9891 )
9892 {
9893 res = a;
9894 if (res == NULL && PyErr_Occurred()) {
9895 p->error_indicator = 1;
9896 return NULL;
9897 }
9898 goto done;
9899 }
9900 p->mark = mark;
9901 }
9902 res = NULL;
9903 done:
9904 return res;
9905}
9906
9907// target:
9908// | t_primary '.' NAME !t_lookahead
9909// | t_primary '[' slices ']' !t_lookahead
9910// | t_atom
9911static expr_ty
9912target_rule(Parser *p)
9913{
9914 if (p->error_indicator) {
9915 return NULL;
9916 }
9917 expr_ty res = NULL;
9918 if (_PyPegen_is_memoized(p, target_type, &res))
9919 return res;
9920 int mark = p->mark;
9921 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9922 p->error_indicator = 1;
9923 return NULL;
9924 }
9925 int start_lineno = p->tokens[mark]->lineno;
9926 UNUSED(start_lineno); // Only used by EXTRA macro
9927 int start_col_offset = p->tokens[mark]->col_offset;
9928 UNUSED(start_col_offset); // Only used by EXTRA macro
9929 { // t_primary '.' NAME !t_lookahead
9930 expr_ty a;
9931 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009932 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009933 if (
9934 (a = t_primary_rule(p))
9935 &&
9936 (literal = _PyPegen_expect_token(p, 23))
9937 &&
9938 (b = _PyPegen_name_token(p))
9939 &&
9940 _PyPegen_lookahead(0, t_lookahead_rule, p)
9941 )
9942 {
9943 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9944 if (token == NULL) {
9945 return NULL;
9946 }
9947 int end_lineno = token->end_lineno;
9948 UNUSED(end_lineno); // Only used by EXTRA macro
9949 int end_col_offset = token->end_col_offset;
9950 UNUSED(end_col_offset); // Only used by EXTRA macro
9951 res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
9952 if (res == NULL && PyErr_Occurred()) {
9953 p->error_indicator = 1;
9954 return NULL;
9955 }
9956 goto done;
9957 }
9958 p->mark = mark;
9959 }
9960 { // t_primary '[' slices ']' !t_lookahead
9961 expr_ty a;
9962 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +01009963 Token * literal;
9964 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +01009965 if (
9966 (a = t_primary_rule(p))
9967 &&
9968 (literal = _PyPegen_expect_token(p, 9))
9969 &&
9970 (b = slices_rule(p))
9971 &&
9972 (literal_1 = _PyPegen_expect_token(p, 10))
9973 &&
9974 _PyPegen_lookahead(0, t_lookahead_rule, p)
9975 )
9976 {
9977 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
9978 if (token == NULL) {
9979 return NULL;
9980 }
9981 int end_lineno = token->end_lineno;
9982 UNUSED(end_lineno); // Only used by EXTRA macro
9983 int end_col_offset = token->end_col_offset;
9984 UNUSED(end_col_offset); // Only used by EXTRA macro
9985 res = _Py_Subscript ( a , b , Store , EXTRA );
9986 if (res == NULL && PyErr_Occurred()) {
9987 p->error_indicator = 1;
9988 return NULL;
9989 }
9990 goto done;
9991 }
9992 p->mark = mark;
9993 }
9994 { // t_atom
9995 expr_ty t_atom_var;
9996 if (
9997 (t_atom_var = t_atom_rule(p))
9998 )
9999 {
10000 res = t_atom_var;
10001 goto done;
10002 }
10003 p->mark = mark;
10004 }
10005 res = NULL;
10006 done:
10007 _PyPegen_insert_memo(p, mark, target_type, res);
10008 return res;
10009}
10010
10011// Left-recursive
10012// t_primary:
10013// | t_primary '.' NAME &t_lookahead
10014// | t_primary '[' slices ']' &t_lookahead
10015// | t_primary genexp &t_lookahead
10016// | t_primary '(' arguments? ')' &t_lookahead
10017// | atom &t_lookahead
10018static expr_ty t_primary_raw(Parser *);
10019static expr_ty
10020t_primary_rule(Parser *p)
10021{
10022 expr_ty res = NULL;
10023 if (_PyPegen_is_memoized(p, t_primary_type, &res))
10024 return res;
10025 int mark = p->mark;
10026 int resmark = p->mark;
10027 while (1) {
10028 int tmpvar_8 = _PyPegen_update_memo(p, mark, t_primary_type, res);
10029 if (tmpvar_8) {
10030 return res;
10031 }
10032 p->mark = mark;
10033 void *raw = t_primary_raw(p);
10034 if (raw == NULL || p->mark <= resmark)
10035 break;
10036 resmark = p->mark;
10037 res = raw;
10038 }
10039 p->mark = resmark;
10040 return res;
10041}
10042static expr_ty
10043t_primary_raw(Parser *p)
10044{
10045 if (p->error_indicator) {
10046 return NULL;
10047 }
10048 expr_ty res = NULL;
10049 int mark = p->mark;
10050 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10051 p->error_indicator = 1;
10052 return NULL;
10053 }
10054 int start_lineno = p->tokens[mark]->lineno;
10055 UNUSED(start_lineno); // Only used by EXTRA macro
10056 int start_col_offset = p->tokens[mark]->col_offset;
10057 UNUSED(start_col_offset); // Only used by EXTRA macro
10058 { // t_primary '.' NAME &t_lookahead
10059 expr_ty a;
10060 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010061 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010062 if (
10063 (a = t_primary_rule(p))
10064 &&
10065 (literal = _PyPegen_expect_token(p, 23))
10066 &&
10067 (b = _PyPegen_name_token(p))
10068 &&
10069 _PyPegen_lookahead(1, t_lookahead_rule, p)
10070 )
10071 {
10072 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10073 if (token == NULL) {
10074 return NULL;
10075 }
10076 int end_lineno = token->end_lineno;
10077 UNUSED(end_lineno); // Only used by EXTRA macro
10078 int end_col_offset = token->end_col_offset;
10079 UNUSED(end_col_offset); // Only used by EXTRA macro
10080 res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
10081 if (res == NULL && PyErr_Occurred()) {
10082 p->error_indicator = 1;
10083 return NULL;
10084 }
10085 goto done;
10086 }
10087 p->mark = mark;
10088 }
10089 { // t_primary '[' slices ']' &t_lookahead
10090 expr_ty a;
10091 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010092 Token * literal;
10093 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010094 if (
10095 (a = t_primary_rule(p))
10096 &&
10097 (literal = _PyPegen_expect_token(p, 9))
10098 &&
10099 (b = slices_rule(p))
10100 &&
10101 (literal_1 = _PyPegen_expect_token(p, 10))
10102 &&
10103 _PyPegen_lookahead(1, t_lookahead_rule, p)
10104 )
10105 {
10106 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10107 if (token == NULL) {
10108 return NULL;
10109 }
10110 int end_lineno = token->end_lineno;
10111 UNUSED(end_lineno); // Only used by EXTRA macro
10112 int end_col_offset = token->end_col_offset;
10113 UNUSED(end_col_offset); // Only used by EXTRA macro
10114 res = _Py_Subscript ( a , b , Load , EXTRA );
10115 if (res == NULL && PyErr_Occurred()) {
10116 p->error_indicator = 1;
10117 return NULL;
10118 }
10119 goto done;
10120 }
10121 p->mark = mark;
10122 }
10123 { // t_primary genexp &t_lookahead
10124 expr_ty a;
10125 expr_ty b;
10126 if (
10127 (a = t_primary_rule(p))
10128 &&
10129 (b = genexp_rule(p))
10130 &&
10131 _PyPegen_lookahead(1, t_lookahead_rule, p)
10132 )
10133 {
10134 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10135 if (token == NULL) {
10136 return NULL;
10137 }
10138 int end_lineno = token->end_lineno;
10139 UNUSED(end_lineno); // Only used by EXTRA macro
10140 int end_col_offset = token->end_col_offset;
10141 UNUSED(end_col_offset); // Only used by EXTRA macro
10142 res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
10143 if (res == NULL && PyErr_Occurred()) {
10144 p->error_indicator = 1;
10145 return NULL;
10146 }
10147 goto done;
10148 }
10149 p->mark = mark;
10150 }
10151 { // t_primary '(' arguments? ')' &t_lookahead
10152 expr_ty a;
10153 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010154 Token * literal;
10155 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010156 if (
10157 (a = t_primary_rule(p))
10158 &&
10159 (literal = _PyPegen_expect_token(p, 7))
10160 &&
10161 (b = arguments_rule(p), 1)
10162 &&
10163 (literal_1 = _PyPegen_expect_token(p, 8))
10164 &&
10165 _PyPegen_lookahead(1, t_lookahead_rule, p)
10166 )
10167 {
10168 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10169 if (token == NULL) {
10170 return NULL;
10171 }
10172 int end_lineno = token->end_lineno;
10173 UNUSED(end_lineno); // Only used by EXTRA macro
10174 int end_col_offset = token->end_col_offset;
10175 UNUSED(end_col_offset); // Only used by EXTRA macro
10176 res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
10177 if (res == NULL && PyErr_Occurred()) {
10178 p->error_indicator = 1;
10179 return NULL;
10180 }
10181 goto done;
10182 }
10183 p->mark = mark;
10184 }
10185 { // atom &t_lookahead
10186 expr_ty a;
10187 if (
10188 (a = atom_rule(p))
10189 &&
10190 _PyPegen_lookahead(1, t_lookahead_rule, p)
10191 )
10192 {
10193 res = a;
10194 if (res == NULL && PyErr_Occurred()) {
10195 p->error_indicator = 1;
10196 return NULL;
10197 }
10198 goto done;
10199 }
10200 p->mark = mark;
10201 }
10202 res = NULL;
10203 done:
10204 return res;
10205}
10206
10207// t_lookahead: '(' | '[' | '.'
10208static void *
10209t_lookahead_rule(Parser *p)
10210{
10211 if (p->error_indicator) {
10212 return NULL;
10213 }
10214 void * res = NULL;
10215 int mark = p->mark;
10216 { // '('
Pablo Galindob796b3f2020-05-01 12:32:26 +010010217 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010218 if (
10219 (literal = _PyPegen_expect_token(p, 7))
10220 )
10221 {
10222 res = literal;
10223 goto done;
10224 }
10225 p->mark = mark;
10226 }
10227 { // '['
Pablo Galindob796b3f2020-05-01 12:32:26 +010010228 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010229 if (
10230 (literal = _PyPegen_expect_token(p, 9))
10231 )
10232 {
10233 res = literal;
10234 goto done;
10235 }
10236 p->mark = mark;
10237 }
10238 { // '.'
Pablo Galindob796b3f2020-05-01 12:32:26 +010010239 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010240 if (
10241 (literal = _PyPegen_expect_token(p, 23))
10242 )
10243 {
10244 res = literal;
10245 goto done;
10246 }
10247 p->mark = mark;
10248 }
10249 res = NULL;
10250 done:
10251 return res;
10252}
10253
10254// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
10255static expr_ty
10256t_atom_rule(Parser *p)
10257{
10258 if (p->error_indicator) {
10259 return NULL;
10260 }
10261 expr_ty res = NULL;
10262 int mark = p->mark;
10263 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10264 p->error_indicator = 1;
10265 return NULL;
10266 }
10267 int start_lineno = p->tokens[mark]->lineno;
10268 UNUSED(start_lineno); // Only used by EXTRA macro
10269 int start_col_offset = p->tokens[mark]->col_offset;
10270 UNUSED(start_col_offset); // Only used by EXTRA macro
10271 { // NAME
10272 expr_ty a;
10273 if (
10274 (a = _PyPegen_name_token(p))
10275 )
10276 {
10277 res = _PyPegen_set_expr_context ( p , a , Store );
10278 if (res == NULL && PyErr_Occurred()) {
10279 p->error_indicator = 1;
10280 return NULL;
10281 }
10282 goto done;
10283 }
10284 p->mark = mark;
10285 }
10286 { // '(' target ')'
10287 expr_ty a;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010288 Token * literal;
10289 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010290 if (
10291 (literal = _PyPegen_expect_token(p, 7))
10292 &&
10293 (a = target_rule(p))
10294 &&
10295 (literal_1 = _PyPegen_expect_token(p, 8))
10296 )
10297 {
10298 res = _PyPegen_set_expr_context ( p , a , Store );
10299 if (res == NULL && PyErr_Occurred()) {
10300 p->error_indicator = 1;
10301 return NULL;
10302 }
10303 goto done;
10304 }
10305 p->mark = mark;
10306 }
10307 { // '(' targets? ')'
10308 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010309 Token * literal;
10310 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010311 if (
10312 (literal = _PyPegen_expect_token(p, 7))
10313 &&
10314 (b = targets_rule(p), 1)
10315 &&
10316 (literal_1 = _PyPegen_expect_token(p, 8))
10317 )
10318 {
10319 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10320 if (token == NULL) {
10321 return NULL;
10322 }
10323 int end_lineno = token->end_lineno;
10324 UNUSED(end_lineno); // Only used by EXTRA macro
10325 int end_col_offset = token->end_col_offset;
10326 UNUSED(end_col_offset); // Only used by EXTRA macro
10327 res = _Py_Tuple ( b , Store , EXTRA );
10328 if (res == NULL && PyErr_Occurred()) {
10329 p->error_indicator = 1;
10330 return NULL;
10331 }
10332 goto done;
10333 }
10334 p->mark = mark;
10335 }
10336 { // '[' targets? ']'
10337 void *b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010338 Token * literal;
10339 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010340 if (
10341 (literal = _PyPegen_expect_token(p, 9))
10342 &&
10343 (b = targets_rule(p), 1)
10344 &&
10345 (literal_1 = _PyPegen_expect_token(p, 10))
10346 )
10347 {
10348 Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
10349 if (token == NULL) {
10350 return NULL;
10351 }
10352 int end_lineno = token->end_lineno;
10353 UNUSED(end_lineno); // Only used by EXTRA macro
10354 int end_col_offset = token->end_col_offset;
10355 UNUSED(end_col_offset); // Only used by EXTRA macro
10356 res = _Py_List ( b , Store , EXTRA );
10357 if (res == NULL && PyErr_Occurred()) {
10358 p->error_indicator = 1;
10359 return NULL;
10360 }
10361 goto done;
10362 }
10363 p->mark = mark;
10364 }
10365 res = NULL;
10366 done:
10367 return res;
10368}
10369
10370// incorrect_arguments:
10371// | args ',' '*'
10372// | expression for_if_clauses ',' [args | expression for_if_clauses]
10373// | args ',' args
10374static void *
10375incorrect_arguments_rule(Parser *p)
10376{
10377 if (p->error_indicator) {
10378 return NULL;
10379 }
10380 void * res = NULL;
10381 int mark = p->mark;
10382 { // args ',' '*'
10383 expr_ty args_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010384 Token * literal;
10385 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010386 if (
10387 (args_var = args_rule(p))
10388 &&
10389 (literal = _PyPegen_expect_token(p, 12))
10390 &&
10391 (literal_1 = _PyPegen_expect_token(p, 16))
10392 )
10393 {
10394 res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
10395 if (res == NULL && PyErr_Occurred()) {
10396 p->error_indicator = 1;
10397 return NULL;
10398 }
10399 goto done;
10400 }
10401 p->mark = mark;
10402 }
10403 { // expression for_if_clauses ',' [args | expression for_if_clauses]
10404 expr_ty expression_var;
10405 asdl_seq* for_if_clauses_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010406 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010407 void *opt_var;
10408 UNUSED(opt_var); // Silence compiler warnings
10409 if (
10410 (expression_var = expression_rule(p))
10411 &&
10412 (for_if_clauses_var = for_if_clauses_rule(p))
10413 &&
10414 (literal = _PyPegen_expect_token(p, 12))
10415 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070010416 (opt_var = _tmp_125_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010417 )
10418 {
10419 res = RAISE_SYNTAX_ERROR ( "Generator expression must be parenthesized" );
10420 if (res == NULL && PyErr_Occurred()) {
10421 p->error_indicator = 1;
10422 return NULL;
10423 }
10424 goto done;
10425 }
10426 p->mark = mark;
10427 }
10428 { // args ',' args
10429 expr_ty a;
10430 expr_ty args_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010431 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010432 if (
10433 (a = args_rule(p))
10434 &&
10435 (literal = _PyPegen_expect_token(p, 12))
10436 &&
10437 (args_var = args_rule(p))
10438 )
10439 {
10440 res = _PyPegen_arguments_parsing_error ( p , a );
10441 if (res == NULL && PyErr_Occurred()) {
10442 p->error_indicator = 1;
10443 return NULL;
10444 }
10445 goto done;
10446 }
10447 p->mark = mark;
10448 }
10449 res = NULL;
10450 done:
10451 return res;
10452}
10453
10454// invalid_named_expression: expression ':=' expression
10455static void *
10456invalid_named_expression_rule(Parser *p)
10457{
10458 if (p->error_indicator) {
10459 return NULL;
10460 }
10461 void * res = NULL;
10462 int mark = p->mark;
10463 { // expression ':=' expression
10464 expr_ty a;
10465 expr_ty expression_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010466 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010467 if (
10468 (a = expression_rule(p))
10469 &&
10470 (literal = _PyPegen_expect_token(p, 53))
10471 &&
10472 (expression_var = expression_rule(p))
10473 )
10474 {
10475 res = RAISE_SYNTAX_ERROR ( "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
10476 if (res == NULL && PyErr_Occurred()) {
10477 p->error_indicator = 1;
10478 return NULL;
10479 }
10480 goto done;
10481 }
10482 p->mark = mark;
10483 }
10484 res = NULL;
10485 done:
10486 return res;
10487}
10488
10489// invalid_assignment:
10490// | list ':'
10491// | tuple ':'
10492// | expression ':' expression ['=' annotated_rhs]
10493// | expression ('=' | augassign) (yield_expr | star_expressions)
10494static void *
10495invalid_assignment_rule(Parser *p)
10496{
10497 if (p->error_indicator) {
10498 return NULL;
10499 }
10500 void * res = NULL;
10501 int mark = p->mark;
10502 { // list ':'
10503 expr_ty list_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010504 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010505 if (
10506 (list_var = list_rule(p))
10507 &&
10508 (literal = _PyPegen_expect_token(p, 11))
10509 )
10510 {
10511 res = RAISE_SYNTAX_ERROR ( "only single target (not list) can be annotated" );
10512 if (res == NULL && PyErr_Occurred()) {
10513 p->error_indicator = 1;
10514 return NULL;
10515 }
10516 goto done;
10517 }
10518 p->mark = mark;
10519 }
10520 { // tuple ':'
Pablo Galindob796b3f2020-05-01 12:32:26 +010010521 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010522 expr_ty tuple_var;
10523 if (
10524 (tuple_var = tuple_rule(p))
10525 &&
10526 (literal = _PyPegen_expect_token(p, 11))
10527 )
10528 {
10529 res = RAISE_SYNTAX_ERROR ( "only single target (not tuple) can be annotated" );
10530 if (res == NULL && PyErr_Occurred()) {
10531 p->error_indicator = 1;
10532 return NULL;
10533 }
10534 goto done;
10535 }
10536 p->mark = mark;
10537 }
10538 { // expression ':' expression ['=' annotated_rhs]
10539 expr_ty expression_var;
10540 expr_ty expression_var_1;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010541 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010542 void *opt_var;
10543 UNUSED(opt_var); // Silence compiler warnings
10544 if (
10545 (expression_var = expression_rule(p))
10546 &&
10547 (literal = _PyPegen_expect_token(p, 11))
10548 &&
10549 (expression_var_1 = expression_rule(p))
10550 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070010551 (opt_var = _tmp_126_rule(p), 1)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010552 )
10553 {
10554 res = RAISE_SYNTAX_ERROR ( "illegal target for annotation" );
10555 if (res == NULL && PyErr_Occurred()) {
10556 p->error_indicator = 1;
10557 return NULL;
10558 }
10559 goto done;
10560 }
10561 p->mark = mark;
10562 }
10563 { // expression ('=' | augassign) (yield_expr | star_expressions)
Guido van Rossum3941d972020-05-01 09:42:03 -070010564 void *_tmp_127_var;
10565 void *_tmp_128_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010566 expr_ty a;
10567 if (
10568 (a = expression_rule(p))
10569 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070010570 (_tmp_127_var = _tmp_127_rule(p))
Pablo Galindo2b74c832020-04-27 18:02:07 +010010571 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070010572 (_tmp_128_var = _tmp_128_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010573 )
10574 {
Batuhan Taskaya76c1b4d2020-05-01 16:13:43 +030010575 res = RAISE_SYNTAX_ERROR_NO_COL_OFFSET ( "cannot assign to %s" , _PyPegen_get_expr_name ( a ) );
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010576 if (res == NULL && PyErr_Occurred()) {
10577 p->error_indicator = 1;
10578 return NULL;
10579 }
10580 goto done;
10581 }
10582 p->mark = mark;
10583 }
10584 res = NULL;
10585 done:
10586 return res;
10587}
10588
10589// invalid_block: NEWLINE !INDENT
10590static void *
10591invalid_block_rule(Parser *p)
10592{
10593 if (p->error_indicator) {
10594 return NULL;
10595 }
10596 void * res = NULL;
10597 int mark = p->mark;
10598 { // NEWLINE !INDENT
Pablo Galindob796b3f2020-05-01 12:32:26 +010010599 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010600 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010010601 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010602 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +010010603 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010604 )
10605 {
10606 res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
10607 if (res == NULL && PyErr_Occurred()) {
10608 p->error_indicator = 1;
10609 return NULL;
10610 }
10611 goto done;
10612 }
10613 p->mark = mark;
10614 }
10615 res = NULL;
10616 done:
10617 return res;
10618}
10619
10620// invalid_comprehension: ('[' | '(' | '{') '*' expression for_if_clauses
10621static void *
10622invalid_comprehension_rule(Parser *p)
10623{
10624 if (p->error_indicator) {
10625 return NULL;
10626 }
10627 void * res = NULL;
10628 int mark = p->mark;
10629 { // ('[' | '(' | '{') '*' expression for_if_clauses
Guido van Rossum3941d972020-05-01 09:42:03 -070010630 void *_tmp_129_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010631 expr_ty expression_var;
10632 asdl_seq* for_if_clauses_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010633 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010634 if (
Guido van Rossum3941d972020-05-01 09:42:03 -070010635 (_tmp_129_var = _tmp_129_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010636 &&
10637 (literal = _PyPegen_expect_token(p, 16))
10638 &&
10639 (expression_var = expression_rule(p))
10640 &&
10641 (for_if_clauses_var = for_if_clauses_rule(p))
10642 )
10643 {
10644 res = RAISE_SYNTAX_ERROR ( "iterable unpacking cannot be used in comprehension" );
10645 if (res == NULL && PyErr_Occurred()) {
10646 p->error_indicator = 1;
10647 return NULL;
10648 }
10649 goto done;
10650 }
10651 p->mark = mark;
10652 }
10653 res = NULL;
10654 done:
10655 return res;
10656}
10657
10658// invalid_parameters:
Guido van Rossumc001c092020-04-30 12:12:19 -070010659// | param_no_default* (slash_with_default | param_with_default+) param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010660static void *
10661invalid_parameters_rule(Parser *p)
10662{
10663 if (p->error_indicator) {
10664 return NULL;
10665 }
10666 void * res = NULL;
10667 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070010668 { // param_no_default* (slash_with_default | param_with_default+) param_no_default
Guido van Rossum3941d972020-05-01 09:42:03 -070010669 asdl_seq * _loop0_130_var;
10670 void *_tmp_131_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070010671 arg_ty param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010672 if (
Guido van Rossum3941d972020-05-01 09:42:03 -070010673 (_loop0_130_var = _loop0_130_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010674 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070010675 (_tmp_131_var = _tmp_131_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010676 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070010677 (param_no_default_var = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010678 )
10679 {
10680 res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
10681 if (res == NULL && PyErr_Occurred()) {
10682 p->error_indicator = 1;
10683 return NULL;
10684 }
10685 goto done;
10686 }
10687 p->mark = mark;
10688 }
10689 res = NULL;
10690 done:
10691 return res;
10692}
10693
Guido van Rossumc001c092020-04-30 12:12:19 -070010694// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
10695static void *
10696invalid_double_type_comments_rule(Parser *p)
10697{
10698 if (p->error_indicator) {
10699 return NULL;
10700 }
10701 void * res = NULL;
10702 int mark = p->mark;
10703 { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
Pablo Galindob796b3f2020-05-01 12:32:26 +010010704 Token * indent_var;
10705 Token * newline_var;
10706 Token * newline_var_1;
10707 Token * type_comment_var;
10708 Token * type_comment_var_1;
Guido van Rossumc001c092020-04-30 12:12:19 -070010709 if (
10710 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))
10711 &&
10712 (newline_var = _PyPegen_expect_token(p, NEWLINE))
10713 &&
10714 (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT))
10715 &&
10716 (newline_var_1 = _PyPegen_expect_token(p, NEWLINE))
10717 &&
10718 (indent_var = _PyPegen_expect_token(p, INDENT))
10719 )
10720 {
10721 res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
10722 if (res == NULL && PyErr_Occurred()) {
10723 p->error_indicator = 1;
10724 return NULL;
10725 }
10726 goto done;
10727 }
10728 p->mark = mark;
10729 }
10730 res = NULL;
10731 done:
10732 return res;
10733}
10734
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010735// _loop0_1: NEWLINE
10736static asdl_seq *
10737_loop0_1_rule(Parser *p)
10738{
10739 if (p->error_indicator) {
10740 return NULL;
10741 }
10742 void *res = NULL;
10743 int mark = p->mark;
10744 int start_mark = p->mark;
10745 void **children = PyMem_Malloc(sizeof(void *));
10746 if (!children) {
10747 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10748 return NULL;
10749 }
10750 ssize_t children_capacity = 1;
10751 ssize_t n = 0;
10752 { // NEWLINE
Pablo Galindob796b3f2020-05-01 12:32:26 +010010753 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010754 while (
Pablo Galindo4db245e2020-04-29 10:42:21 +010010755 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010756 )
10757 {
10758 res = newline_var;
10759 if (n == children_capacity) {
10760 children_capacity *= 2;
10761 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10762 if (!children) {
10763 PyErr_Format(PyExc_MemoryError, "realloc None");
10764 return NULL;
10765 }
10766 }
10767 children[n++] = res;
10768 mark = p->mark;
10769 }
10770 p->mark = mark;
10771 }
10772 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10773 if (!seq) {
10774 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_1");
10775 PyMem_Free(children);
10776 return NULL;
10777 }
10778 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10779 PyMem_Free(children);
10780 _PyPegen_insert_memo(p, start_mark, _loop0_1_type, seq);
10781 return seq;
10782}
10783
Guido van Rossumc001c092020-04-30 12:12:19 -070010784// _loop0_2: NEWLINE
Pablo Galindoc5fc1562020-04-22 23:29:27 +010010785static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070010786_loop0_2_rule(Parser *p)
10787{
10788 if (p->error_indicator) {
10789 return NULL;
10790 }
10791 void *res = NULL;
10792 int mark = p->mark;
10793 int start_mark = p->mark;
10794 void **children = PyMem_Malloc(sizeof(void *));
10795 if (!children) {
10796 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10797 return NULL;
10798 }
10799 ssize_t children_capacity = 1;
10800 ssize_t n = 0;
10801 { // NEWLINE
Pablo Galindob796b3f2020-05-01 12:32:26 +010010802 Token * newline_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070010803 while (
10804 (newline_var = _PyPegen_expect_token(p, NEWLINE))
10805 )
10806 {
10807 res = newline_var;
10808 if (n == children_capacity) {
10809 children_capacity *= 2;
10810 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10811 if (!children) {
10812 PyErr_Format(PyExc_MemoryError, "realloc None");
10813 return NULL;
10814 }
10815 }
10816 children[n++] = res;
10817 mark = p->mark;
10818 }
10819 p->mark = mark;
10820 }
10821 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10822 if (!seq) {
10823 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_2");
10824 PyMem_Free(children);
10825 return NULL;
10826 }
10827 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10828 PyMem_Free(children);
10829 _PyPegen_insert_memo(p, start_mark, _loop0_2_type, seq);
10830 return seq;
10831}
10832
10833// _loop0_4: ',' expression
10834static asdl_seq *
10835_loop0_4_rule(Parser *p)
10836{
10837 if (p->error_indicator) {
10838 return NULL;
10839 }
10840 void *res = NULL;
10841 int mark = p->mark;
10842 int start_mark = p->mark;
10843 void **children = PyMem_Malloc(sizeof(void *));
10844 if (!children) {
10845 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10846 return NULL;
10847 }
10848 ssize_t children_capacity = 1;
10849 ssize_t n = 0;
10850 { // ',' expression
10851 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010852 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070010853 while (
10854 (literal = _PyPegen_expect_token(p, 12))
10855 &&
10856 (elem = expression_rule(p))
10857 )
10858 {
10859 res = elem;
10860 if (res == NULL && PyErr_Occurred()) {
10861 p->error_indicator = 1;
10862 PyMem_Free(children);
10863 return NULL;
10864 }
10865 if (n == children_capacity) {
10866 children_capacity *= 2;
10867 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10868 if (!children) {
10869 PyErr_Format(PyExc_MemoryError, "realloc None");
10870 return NULL;
10871 }
10872 }
10873 children[n++] = res;
10874 mark = p->mark;
10875 }
10876 p->mark = mark;
10877 }
10878 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10879 if (!seq) {
10880 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_4");
10881 PyMem_Free(children);
10882 return NULL;
10883 }
10884 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10885 PyMem_Free(children);
10886 _PyPegen_insert_memo(p, start_mark, _loop0_4_type, seq);
10887 return seq;
10888}
10889
10890// _gather_3: expression _loop0_4
10891static asdl_seq *
10892_gather_3_rule(Parser *p)
10893{
10894 if (p->error_indicator) {
10895 return NULL;
10896 }
10897 asdl_seq * res = NULL;
10898 int mark = p->mark;
10899 { // expression _loop0_4
10900 expr_ty elem;
10901 asdl_seq * seq;
10902 if (
10903 (elem = expression_rule(p))
10904 &&
10905 (seq = _loop0_4_rule(p))
10906 )
10907 {
10908 res = _PyPegen_seq_insert_in_front(p, elem, seq);
10909 goto done;
10910 }
10911 p->mark = mark;
10912 }
10913 res = NULL;
10914 done:
10915 return res;
10916}
10917
10918// _loop0_6: ',' expression
10919static asdl_seq *
10920_loop0_6_rule(Parser *p)
10921{
10922 if (p->error_indicator) {
10923 return NULL;
10924 }
10925 void *res = NULL;
10926 int mark = p->mark;
10927 int start_mark = p->mark;
10928 void **children = PyMem_Malloc(sizeof(void *));
10929 if (!children) {
10930 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
10931 return NULL;
10932 }
10933 ssize_t children_capacity = 1;
10934 ssize_t n = 0;
10935 { // ',' expression
10936 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010010937 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070010938 while (
10939 (literal = _PyPegen_expect_token(p, 12))
10940 &&
10941 (elem = expression_rule(p))
10942 )
10943 {
10944 res = elem;
10945 if (res == NULL && PyErr_Occurred()) {
10946 p->error_indicator = 1;
10947 PyMem_Free(children);
10948 return NULL;
10949 }
10950 if (n == children_capacity) {
10951 children_capacity *= 2;
10952 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
10953 if (!children) {
10954 PyErr_Format(PyExc_MemoryError, "realloc None");
10955 return NULL;
10956 }
10957 }
10958 children[n++] = res;
10959 mark = p->mark;
10960 }
10961 p->mark = mark;
10962 }
10963 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
10964 if (!seq) {
10965 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_6");
10966 PyMem_Free(children);
10967 return NULL;
10968 }
10969 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
10970 PyMem_Free(children);
10971 _PyPegen_insert_memo(p, start_mark, _loop0_6_type, seq);
10972 return seq;
10973}
10974
10975// _gather_5: expression _loop0_6
10976static asdl_seq *
10977_gather_5_rule(Parser *p)
10978{
10979 if (p->error_indicator) {
10980 return NULL;
10981 }
10982 asdl_seq * res = NULL;
10983 int mark = p->mark;
10984 { // expression _loop0_6
10985 expr_ty elem;
10986 asdl_seq * seq;
10987 if (
10988 (elem = expression_rule(p))
10989 &&
10990 (seq = _loop0_6_rule(p))
10991 )
10992 {
10993 res = _PyPegen_seq_insert_in_front(p, elem, seq);
10994 goto done;
10995 }
10996 p->mark = mark;
10997 }
10998 res = NULL;
10999 done:
11000 return res;
11001}
11002
11003// _loop0_8: ',' expression
11004static asdl_seq *
11005_loop0_8_rule(Parser *p)
11006{
11007 if (p->error_indicator) {
11008 return NULL;
11009 }
11010 void *res = NULL;
11011 int mark = p->mark;
11012 int start_mark = p->mark;
11013 void **children = PyMem_Malloc(sizeof(void *));
11014 if (!children) {
11015 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11016 return NULL;
11017 }
11018 ssize_t children_capacity = 1;
11019 ssize_t n = 0;
11020 { // ',' expression
11021 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011022 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070011023 while (
11024 (literal = _PyPegen_expect_token(p, 12))
11025 &&
11026 (elem = expression_rule(p))
11027 )
11028 {
11029 res = elem;
11030 if (res == NULL && PyErr_Occurred()) {
11031 p->error_indicator = 1;
11032 PyMem_Free(children);
11033 return NULL;
11034 }
11035 if (n == children_capacity) {
11036 children_capacity *= 2;
11037 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11038 if (!children) {
11039 PyErr_Format(PyExc_MemoryError, "realloc None");
11040 return NULL;
11041 }
11042 }
11043 children[n++] = res;
11044 mark = p->mark;
11045 }
11046 p->mark = mark;
11047 }
11048 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11049 if (!seq) {
11050 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_8");
11051 PyMem_Free(children);
11052 return NULL;
11053 }
11054 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11055 PyMem_Free(children);
11056 _PyPegen_insert_memo(p, start_mark, _loop0_8_type, seq);
11057 return seq;
11058}
11059
11060// _gather_7: expression _loop0_8
11061static asdl_seq *
11062_gather_7_rule(Parser *p)
11063{
11064 if (p->error_indicator) {
11065 return NULL;
11066 }
11067 asdl_seq * res = NULL;
11068 int mark = p->mark;
11069 { // expression _loop0_8
11070 expr_ty elem;
11071 asdl_seq * seq;
11072 if (
11073 (elem = expression_rule(p))
11074 &&
11075 (seq = _loop0_8_rule(p))
11076 )
11077 {
11078 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11079 goto done;
11080 }
11081 p->mark = mark;
11082 }
11083 res = NULL;
11084 done:
11085 return res;
11086}
11087
11088// _loop0_10: ',' expression
11089static asdl_seq *
11090_loop0_10_rule(Parser *p)
11091{
11092 if (p->error_indicator) {
11093 return NULL;
11094 }
11095 void *res = NULL;
11096 int mark = p->mark;
11097 int start_mark = p->mark;
11098 void **children = PyMem_Malloc(sizeof(void *));
11099 if (!children) {
11100 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11101 return NULL;
11102 }
11103 ssize_t children_capacity = 1;
11104 ssize_t n = 0;
11105 { // ',' expression
11106 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011107 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070011108 while (
11109 (literal = _PyPegen_expect_token(p, 12))
11110 &&
11111 (elem = expression_rule(p))
11112 )
11113 {
11114 res = elem;
11115 if (res == NULL && PyErr_Occurred()) {
11116 p->error_indicator = 1;
11117 PyMem_Free(children);
11118 return NULL;
11119 }
11120 if (n == children_capacity) {
11121 children_capacity *= 2;
11122 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11123 if (!children) {
11124 PyErr_Format(PyExc_MemoryError, "realloc None");
11125 return NULL;
11126 }
11127 }
11128 children[n++] = res;
11129 mark = p->mark;
11130 }
11131 p->mark = mark;
11132 }
11133 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11134 if (!seq) {
11135 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_10");
11136 PyMem_Free(children);
11137 return NULL;
11138 }
11139 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11140 PyMem_Free(children);
11141 _PyPegen_insert_memo(p, start_mark, _loop0_10_type, seq);
11142 return seq;
11143}
11144
11145// _gather_9: expression _loop0_10
11146static asdl_seq *
11147_gather_9_rule(Parser *p)
11148{
11149 if (p->error_indicator) {
11150 return NULL;
11151 }
11152 asdl_seq * res = NULL;
11153 int mark = p->mark;
11154 { // expression _loop0_10
11155 expr_ty elem;
11156 asdl_seq * seq;
11157 if (
11158 (elem = expression_rule(p))
11159 &&
11160 (seq = _loop0_10_rule(p))
11161 )
11162 {
11163 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11164 goto done;
11165 }
11166 p->mark = mark;
11167 }
11168 res = NULL;
11169 done:
11170 return res;
11171}
11172
11173// _loop1_11: statement
11174static asdl_seq *
11175_loop1_11_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011176{
11177 if (p->error_indicator) {
11178 return NULL;
11179 }
11180 void *res = NULL;
11181 int mark = p->mark;
11182 int start_mark = p->mark;
11183 void **children = PyMem_Malloc(sizeof(void *));
11184 if (!children) {
11185 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11186 return NULL;
11187 }
11188 ssize_t children_capacity = 1;
11189 ssize_t n = 0;
11190 { // statement
11191 asdl_seq* statement_var;
11192 while (
11193 (statement_var = statement_rule(p))
11194 )
11195 {
11196 res = statement_var;
11197 if (n == children_capacity) {
11198 children_capacity *= 2;
11199 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11200 if (!children) {
11201 PyErr_Format(PyExc_MemoryError, "realloc None");
11202 return NULL;
11203 }
11204 }
11205 children[n++] = res;
11206 mark = p->mark;
11207 }
11208 p->mark = mark;
11209 }
11210 if (n == 0) {
11211 PyMem_Free(children);
11212 return NULL;
11213 }
11214 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11215 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070011216 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_11");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011217 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);
Guido van Rossumc001c092020-04-30 12:12:19 -070011222 _PyPegen_insert_memo(p, start_mark, _loop1_11_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011223 return seq;
11224}
11225
Guido van Rossumc001c092020-04-30 12:12:19 -070011226// _loop0_13: ';' small_stmt
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011227static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070011228_loop0_13_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011229{
11230 if (p->error_indicator) {
11231 return NULL;
11232 }
11233 void *res = NULL;
11234 int mark = p->mark;
11235 int start_mark = p->mark;
11236 void **children = PyMem_Malloc(sizeof(void *));
11237 if (!children) {
11238 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11239 return NULL;
11240 }
11241 ssize_t children_capacity = 1;
11242 ssize_t n = 0;
11243 { // ';' small_stmt
11244 stmt_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011245 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011246 while (
11247 (literal = _PyPegen_expect_token(p, 13))
11248 &&
11249 (elem = small_stmt_rule(p))
11250 )
11251 {
11252 res = elem;
11253 if (res == NULL && PyErr_Occurred()) {
11254 p->error_indicator = 1;
11255 PyMem_Free(children);
11256 return NULL;
11257 }
11258 if (n == children_capacity) {
11259 children_capacity *= 2;
11260 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11261 if (!children) {
11262 PyErr_Format(PyExc_MemoryError, "realloc None");
11263 return NULL;
11264 }
11265 }
11266 children[n++] = res;
11267 mark = p->mark;
11268 }
11269 p->mark = mark;
11270 }
11271 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11272 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070011273 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_13");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011274 PyMem_Free(children);
11275 return NULL;
11276 }
11277 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11278 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070011279 _PyPegen_insert_memo(p, start_mark, _loop0_13_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011280 return seq;
11281}
11282
Guido van Rossumc001c092020-04-30 12:12:19 -070011283// _gather_12: small_stmt _loop0_13
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011284static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070011285_gather_12_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011286{
11287 if (p->error_indicator) {
11288 return NULL;
11289 }
11290 asdl_seq * res = NULL;
11291 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070011292 { // small_stmt _loop0_13
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011293 stmt_ty elem;
11294 asdl_seq * seq;
11295 if (
11296 (elem = small_stmt_rule(p))
11297 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070011298 (seq = _loop0_13_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011299 )
11300 {
11301 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11302 goto done;
11303 }
11304 p->mark = mark;
11305 }
11306 res = NULL;
11307 done:
11308 return res;
11309}
11310
Guido van Rossumc001c092020-04-30 12:12:19 -070011311// _tmp_14: 'import' | 'from'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011312static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011313_tmp_14_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011314{
11315 if (p->error_indicator) {
11316 return NULL;
11317 }
11318 void * res = NULL;
11319 int mark = p->mark;
11320 { // 'import'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011321 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011322 if (
11323 (keyword = _PyPegen_expect_token(p, 513))
11324 )
11325 {
11326 res = keyword;
11327 goto done;
11328 }
11329 p->mark = mark;
11330 }
11331 { // 'from'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011332 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011333 if (
11334 (keyword = _PyPegen_expect_token(p, 514))
11335 )
11336 {
11337 res = keyword;
11338 goto done;
11339 }
11340 p->mark = mark;
11341 }
11342 res = NULL;
11343 done:
11344 return res;
11345}
11346
Guido van Rossumc001c092020-04-30 12:12:19 -070011347// _tmp_15: 'def' | '@' | ASYNC
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011348static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011349_tmp_15_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011350{
11351 if (p->error_indicator) {
11352 return NULL;
11353 }
11354 void * res = NULL;
11355 int mark = p->mark;
11356 { // 'def'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011357 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011358 if (
11359 (keyword = _PyPegen_expect_token(p, 522))
11360 )
11361 {
11362 res = keyword;
11363 goto done;
11364 }
11365 p->mark = mark;
11366 }
11367 { // '@'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011368 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011369 if (
11370 (literal = _PyPegen_expect_token(p, 49))
11371 )
11372 {
11373 res = literal;
11374 goto done;
11375 }
11376 p->mark = mark;
11377 }
11378 { // ASYNC
Pablo Galindob796b3f2020-05-01 12:32:26 +010011379 Token * async_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011380 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010011381 (async_var = _PyPegen_expect_token(p, ASYNC))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011382 )
11383 {
11384 res = async_var;
11385 goto done;
11386 }
11387 p->mark = mark;
11388 }
11389 res = NULL;
11390 done:
11391 return res;
11392}
11393
Guido van Rossumc001c092020-04-30 12:12:19 -070011394// _tmp_16: 'class' | '@'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011395static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011396_tmp_16_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011397{
11398 if (p->error_indicator) {
11399 return NULL;
11400 }
11401 void * res = NULL;
11402 int mark = p->mark;
11403 { // 'class'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011404 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011405 if (
11406 (keyword = _PyPegen_expect_token(p, 523))
11407 )
11408 {
11409 res = keyword;
11410 goto done;
11411 }
11412 p->mark = mark;
11413 }
11414 { // '@'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011415 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011416 if (
11417 (literal = _PyPegen_expect_token(p, 49))
11418 )
11419 {
11420 res = literal;
11421 goto done;
11422 }
11423 p->mark = mark;
11424 }
11425 res = NULL;
11426 done:
11427 return res;
11428}
11429
Guido van Rossumc001c092020-04-30 12:12:19 -070011430// _tmp_17: 'with' | ASYNC
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011431static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011432_tmp_17_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011433{
11434 if (p->error_indicator) {
11435 return NULL;
11436 }
11437 void * res = NULL;
11438 int mark = p->mark;
11439 { // 'with'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011440 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011441 if (
11442 (keyword = _PyPegen_expect_token(p, 519))
11443 )
11444 {
11445 res = keyword;
11446 goto done;
11447 }
11448 p->mark = mark;
11449 }
11450 { // ASYNC
Pablo Galindob796b3f2020-05-01 12:32:26 +010011451 Token * async_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011452 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010011453 (async_var = _PyPegen_expect_token(p, ASYNC))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011454 )
11455 {
11456 res = async_var;
11457 goto done;
11458 }
11459 p->mark = mark;
11460 }
11461 res = NULL;
11462 done:
11463 return res;
11464}
11465
Guido van Rossumc001c092020-04-30 12:12:19 -070011466// _tmp_18: 'for' | ASYNC
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011467static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011468_tmp_18_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011469{
11470 if (p->error_indicator) {
11471 return NULL;
11472 }
11473 void * res = NULL;
11474 int mark = p->mark;
11475 { // 'for'
Pablo Galindob796b3f2020-05-01 12:32:26 +010011476 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011477 if (
11478 (keyword = _PyPegen_expect_token(p, 517))
11479 )
11480 {
11481 res = keyword;
11482 goto done;
11483 }
11484 p->mark = mark;
11485 }
11486 { // ASYNC
Pablo Galindob796b3f2020-05-01 12:32:26 +010011487 Token * async_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011488 if (
Pablo Galindo4db245e2020-04-29 10:42:21 +010011489 (async_var = _PyPegen_expect_token(p, ASYNC))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011490 )
11491 {
11492 res = async_var;
11493 goto done;
11494 }
11495 p->mark = mark;
11496 }
11497 res = NULL;
11498 done:
11499 return res;
11500}
11501
Guido van Rossumc001c092020-04-30 12:12:19 -070011502// _tmp_19: '=' annotated_rhs
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011503static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011504_tmp_19_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011505{
11506 if (p->error_indicator) {
11507 return NULL;
11508 }
11509 void * res = NULL;
11510 int mark = p->mark;
11511 { // '=' annotated_rhs
11512 expr_ty d;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011513 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011514 if (
11515 (literal = _PyPegen_expect_token(p, 22))
11516 &&
11517 (d = annotated_rhs_rule(p))
11518 )
11519 {
11520 res = d;
11521 if (res == NULL && PyErr_Occurred()) {
11522 p->error_indicator = 1;
11523 return NULL;
11524 }
11525 goto done;
11526 }
11527 p->mark = mark;
11528 }
11529 res = NULL;
11530 done:
11531 return res;
11532}
11533
Guido van Rossumc001c092020-04-30 12:12:19 -070011534// _tmp_20: '(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011535static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011536_tmp_20_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011537{
11538 if (p->error_indicator) {
11539 return NULL;
11540 }
11541 void * res = NULL;
11542 int mark = p->mark;
11543 { // '(' inside_paren_ann_assign_target ')'
11544 expr_ty b;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011545 Token * literal;
11546 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011547 if (
11548 (literal = _PyPegen_expect_token(p, 7))
11549 &&
11550 (b = inside_paren_ann_assign_target_rule(p))
11551 &&
11552 (literal_1 = _PyPegen_expect_token(p, 8))
11553 )
11554 {
11555 res = b;
11556 if (res == NULL && PyErr_Occurred()) {
11557 p->error_indicator = 1;
11558 return NULL;
11559 }
11560 goto done;
11561 }
11562 p->mark = mark;
11563 }
11564 { // ann_assign_subscript_attribute_target
11565 expr_ty ann_assign_subscript_attribute_target_var;
11566 if (
11567 (ann_assign_subscript_attribute_target_var = ann_assign_subscript_attribute_target_rule(p))
11568 )
11569 {
11570 res = ann_assign_subscript_attribute_target_var;
11571 goto done;
11572 }
11573 p->mark = mark;
11574 }
11575 res = NULL;
11576 done:
11577 return res;
11578}
11579
Guido van Rossumc001c092020-04-30 12:12:19 -070011580// _tmp_21: '=' annotated_rhs
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011581static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070011582_tmp_21_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011583{
11584 if (p->error_indicator) {
11585 return NULL;
11586 }
11587 void * res = NULL;
11588 int mark = p->mark;
11589 { // '=' annotated_rhs
11590 expr_ty d;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011591 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011592 if (
11593 (literal = _PyPegen_expect_token(p, 22))
11594 &&
11595 (d = annotated_rhs_rule(p))
11596 )
11597 {
11598 res = d;
11599 if (res == NULL && PyErr_Occurred()) {
11600 p->error_indicator = 1;
11601 return NULL;
11602 }
11603 goto done;
11604 }
11605 p->mark = mark;
11606 }
11607 res = NULL;
11608 done:
11609 return res;
11610}
11611
Guido van Rossumc001c092020-04-30 12:12:19 -070011612// _loop1_22: (star_targets '=')
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011613static asdl_seq *
11614_loop1_22_rule(Parser *p)
11615{
11616 if (p->error_indicator) {
11617 return NULL;
11618 }
11619 void *res = NULL;
11620 int mark = p->mark;
11621 int start_mark = p->mark;
11622 void **children = PyMem_Malloc(sizeof(void *));
11623 if (!children) {
11624 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11625 return NULL;
11626 }
11627 ssize_t children_capacity = 1;
11628 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070011629 { // (star_targets '=')
Guido van Rossum3941d972020-05-01 09:42:03 -070011630 void *_tmp_132_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011631 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070011632 (_tmp_132_var = _tmp_132_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011633 )
11634 {
Guido van Rossum3941d972020-05-01 09:42:03 -070011635 res = _tmp_132_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011636 if (n == children_capacity) {
11637 children_capacity *= 2;
11638 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11639 if (!children) {
11640 PyErr_Format(PyExc_MemoryError, "realloc None");
11641 return NULL;
11642 }
11643 }
11644 children[n++] = res;
11645 mark = p->mark;
11646 }
11647 p->mark = mark;
11648 }
11649 if (n == 0) {
11650 PyMem_Free(children);
11651 return NULL;
11652 }
11653 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11654 if (!seq) {
11655 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_22");
11656 PyMem_Free(children);
11657 return NULL;
11658 }
11659 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11660 PyMem_Free(children);
11661 _PyPegen_insert_memo(p, start_mark, _loop1_22_type, seq);
11662 return seq;
11663}
11664
Guido van Rossumc001c092020-04-30 12:12:19 -070011665// _tmp_23: yield_expr | star_expressions
11666static void *
11667_tmp_23_rule(Parser *p)
11668{
11669 if (p->error_indicator) {
11670 return NULL;
11671 }
11672 void * res = NULL;
11673 int mark = p->mark;
11674 { // yield_expr
11675 expr_ty yield_expr_var;
11676 if (
11677 (yield_expr_var = yield_expr_rule(p))
11678 )
11679 {
11680 res = yield_expr_var;
11681 goto done;
11682 }
11683 p->mark = mark;
11684 }
11685 { // star_expressions
11686 expr_ty star_expressions_var;
11687 if (
11688 (star_expressions_var = star_expressions_rule(p))
11689 )
11690 {
11691 res = star_expressions_var;
11692 goto done;
11693 }
11694 p->mark = mark;
11695 }
11696 res = NULL;
11697 done:
11698 return res;
11699}
11700
11701// _tmp_24: yield_expr | star_expressions
11702static void *
11703_tmp_24_rule(Parser *p)
11704{
11705 if (p->error_indicator) {
11706 return NULL;
11707 }
11708 void * res = NULL;
11709 int mark = p->mark;
11710 { // yield_expr
11711 expr_ty yield_expr_var;
11712 if (
11713 (yield_expr_var = yield_expr_rule(p))
11714 )
11715 {
11716 res = yield_expr_var;
11717 goto done;
11718 }
11719 p->mark = mark;
11720 }
11721 { // star_expressions
11722 expr_ty star_expressions_var;
11723 if (
11724 (star_expressions_var = star_expressions_rule(p))
11725 )
11726 {
11727 res = star_expressions_var;
11728 goto done;
11729 }
11730 p->mark = mark;
11731 }
11732 res = NULL;
11733 done:
11734 return res;
11735}
11736
11737// _loop0_26: ',' NAME
Pablo Galindoc5fc1562020-04-22 23:29:27 +010011738static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070011739_loop0_26_rule(Parser *p)
11740{
11741 if (p->error_indicator) {
11742 return NULL;
11743 }
11744 void *res = NULL;
11745 int mark = p->mark;
11746 int start_mark = p->mark;
11747 void **children = PyMem_Malloc(sizeof(void *));
11748 if (!children) {
11749 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11750 return NULL;
11751 }
11752 ssize_t children_capacity = 1;
11753 ssize_t n = 0;
11754 { // ',' NAME
11755 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011756 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070011757 while (
11758 (literal = _PyPegen_expect_token(p, 12))
11759 &&
11760 (elem = _PyPegen_name_token(p))
11761 )
11762 {
11763 res = elem;
11764 if (res == NULL && PyErr_Occurred()) {
11765 p->error_indicator = 1;
11766 PyMem_Free(children);
11767 return NULL;
11768 }
11769 if (n == children_capacity) {
11770 children_capacity *= 2;
11771 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11772 if (!children) {
11773 PyErr_Format(PyExc_MemoryError, "realloc None");
11774 return NULL;
11775 }
11776 }
11777 children[n++] = res;
11778 mark = p->mark;
11779 }
11780 p->mark = mark;
11781 }
11782 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11783 if (!seq) {
11784 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_26");
11785 PyMem_Free(children);
11786 return NULL;
11787 }
11788 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11789 PyMem_Free(children);
11790 _PyPegen_insert_memo(p, start_mark, _loop0_26_type, seq);
11791 return seq;
11792}
11793
11794// _gather_25: NAME _loop0_26
11795static asdl_seq *
11796_gather_25_rule(Parser *p)
11797{
11798 if (p->error_indicator) {
11799 return NULL;
11800 }
11801 asdl_seq * res = NULL;
11802 int mark = p->mark;
11803 { // NAME _loop0_26
11804 expr_ty elem;
11805 asdl_seq * seq;
11806 if (
11807 (elem = _PyPegen_name_token(p))
11808 &&
11809 (seq = _loop0_26_rule(p))
11810 )
11811 {
11812 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11813 goto done;
11814 }
11815 p->mark = mark;
11816 }
11817 res = NULL;
11818 done:
11819 return res;
11820}
11821
11822// _loop0_28: ',' NAME
11823static asdl_seq *
11824_loop0_28_rule(Parser *p)
11825{
11826 if (p->error_indicator) {
11827 return NULL;
11828 }
11829 void *res = NULL;
11830 int mark = p->mark;
11831 int start_mark = p->mark;
11832 void **children = PyMem_Malloc(sizeof(void *));
11833 if (!children) {
11834 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11835 return NULL;
11836 }
11837 ssize_t children_capacity = 1;
11838 ssize_t n = 0;
11839 { // ',' NAME
11840 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010011841 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070011842 while (
11843 (literal = _PyPegen_expect_token(p, 12))
11844 &&
11845 (elem = _PyPegen_name_token(p))
11846 )
11847 {
11848 res = elem;
11849 if (res == NULL && PyErr_Occurred()) {
11850 p->error_indicator = 1;
11851 PyMem_Free(children);
11852 return NULL;
11853 }
11854 if (n == children_capacity) {
11855 children_capacity *= 2;
11856 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11857 if (!children) {
11858 PyErr_Format(PyExc_MemoryError, "realloc None");
11859 return NULL;
11860 }
11861 }
11862 children[n++] = res;
11863 mark = p->mark;
11864 }
11865 p->mark = mark;
11866 }
11867 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11868 if (!seq) {
11869 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_28");
11870 PyMem_Free(children);
11871 return NULL;
11872 }
11873 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11874 PyMem_Free(children);
11875 _PyPegen_insert_memo(p, start_mark, _loop0_28_type, seq);
11876 return seq;
11877}
11878
11879// _gather_27: NAME _loop0_28
11880static asdl_seq *
11881_gather_27_rule(Parser *p)
11882{
11883 if (p->error_indicator) {
11884 return NULL;
11885 }
11886 asdl_seq * res = NULL;
11887 int mark = p->mark;
11888 { // NAME _loop0_28
11889 expr_ty elem;
11890 asdl_seq * seq;
11891 if (
11892 (elem = _PyPegen_name_token(p))
11893 &&
11894 (seq = _loop0_28_rule(p))
11895 )
11896 {
11897 res = _PyPegen_seq_insert_in_front(p, elem, seq);
11898 goto done;
11899 }
11900 p->mark = mark;
11901 }
11902 res = NULL;
11903 done:
11904 return res;
11905}
11906
11907// _tmp_29: ',' expression
11908static void *
11909_tmp_29_rule(Parser *p)
11910{
11911 if (p->error_indicator) {
11912 return NULL;
11913 }
11914 void * res = NULL;
11915 int mark = p->mark;
11916 { // ',' expression
Pablo Galindob796b3f2020-05-01 12:32:26 +010011917 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070011918 expr_ty z;
11919 if (
11920 (literal = _PyPegen_expect_token(p, 12))
11921 &&
11922 (z = expression_rule(p))
11923 )
11924 {
11925 res = z;
11926 if (res == NULL && PyErr_Occurred()) {
11927 p->error_indicator = 1;
11928 return NULL;
11929 }
11930 goto done;
11931 }
11932 p->mark = mark;
11933 }
11934 res = NULL;
11935 done:
11936 return res;
11937}
11938
11939// _loop0_30: ('.' | '...')
11940static asdl_seq *
11941_loop0_30_rule(Parser *p)
11942{
11943 if (p->error_indicator) {
11944 return NULL;
11945 }
11946 void *res = NULL;
11947 int mark = p->mark;
11948 int start_mark = p->mark;
11949 void **children = PyMem_Malloc(sizeof(void *));
11950 if (!children) {
11951 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
11952 return NULL;
11953 }
11954 ssize_t children_capacity = 1;
11955 ssize_t n = 0;
11956 { // ('.' | '...')
Guido van Rossum3941d972020-05-01 09:42:03 -070011957 void *_tmp_133_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070011958 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070011959 (_tmp_133_var = _tmp_133_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070011960 )
11961 {
Guido van Rossum3941d972020-05-01 09:42:03 -070011962 res = _tmp_133_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070011963 if (n == children_capacity) {
11964 children_capacity *= 2;
11965 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
11966 if (!children) {
11967 PyErr_Format(PyExc_MemoryError, "realloc None");
11968 return NULL;
11969 }
11970 }
11971 children[n++] = res;
11972 mark = p->mark;
11973 }
11974 p->mark = mark;
11975 }
11976 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
11977 if (!seq) {
11978 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_30");
11979 PyMem_Free(children);
11980 return NULL;
11981 }
11982 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
11983 PyMem_Free(children);
11984 _PyPegen_insert_memo(p, start_mark, _loop0_30_type, seq);
11985 return seq;
11986}
11987
11988// _loop1_31: ('.' | '...')
11989static asdl_seq *
11990_loop1_31_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 { // ('.' | '...')
Guido van Rossum3941d972020-05-01 09:42:03 -070012006 void *_tmp_134_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070012007 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070012008 (_tmp_134_var = _tmp_134_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070012009 )
12010 {
Guido van Rossum3941d972020-05-01 09:42:03 -070012011 res = _tmp_134_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070012012 if (n == children_capacity) {
12013 children_capacity *= 2;
12014 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12015 if (!children) {
12016 PyErr_Format(PyExc_MemoryError, "realloc None");
12017 return NULL;
12018 }
12019 }
12020 children[n++] = res;
12021 mark = p->mark;
12022 }
12023 p->mark = mark;
12024 }
12025 if (n == 0) {
12026 PyMem_Free(children);
12027 return NULL;
12028 }
12029 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12030 if (!seq) {
12031 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_31");
12032 PyMem_Free(children);
12033 return NULL;
12034 }
12035 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12036 PyMem_Free(children);
12037 _PyPegen_insert_memo(p, start_mark, _loop1_31_type, seq);
12038 return seq;
12039}
12040
12041// _loop0_33: ',' import_from_as_name
12042static asdl_seq *
12043_loop0_33_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012044{
12045 if (p->error_indicator) {
12046 return NULL;
12047 }
12048 void *res = NULL;
12049 int mark = p->mark;
12050 int start_mark = p->mark;
12051 void **children = PyMem_Malloc(sizeof(void *));
12052 if (!children) {
12053 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12054 return NULL;
12055 }
12056 ssize_t children_capacity = 1;
12057 ssize_t n = 0;
12058 { // ',' import_from_as_name
12059 alias_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012060 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012061 while (
12062 (literal = _PyPegen_expect_token(p, 12))
12063 &&
12064 (elem = import_from_as_name_rule(p))
12065 )
12066 {
12067 res = elem;
12068 if (res == NULL && PyErr_Occurred()) {
12069 p->error_indicator = 1;
12070 PyMem_Free(children);
12071 return NULL;
12072 }
12073 if (n == children_capacity) {
12074 children_capacity *= 2;
12075 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12076 if (!children) {
12077 PyErr_Format(PyExc_MemoryError, "realloc None");
12078 return NULL;
12079 }
12080 }
12081 children[n++] = res;
12082 mark = p->mark;
12083 }
12084 p->mark = mark;
12085 }
12086 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12087 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012088 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_33");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012089 PyMem_Free(children);
12090 return NULL;
12091 }
12092 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12093 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012094 _PyPegen_insert_memo(p, start_mark, _loop0_33_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012095 return seq;
12096}
12097
Guido van Rossumc001c092020-04-30 12:12:19 -070012098// _gather_32: import_from_as_name _loop0_33
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012099static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012100_gather_32_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012101{
12102 if (p->error_indicator) {
12103 return NULL;
12104 }
12105 asdl_seq * res = NULL;
12106 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012107 { // import_from_as_name _loop0_33
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012108 alias_ty elem;
12109 asdl_seq * seq;
12110 if (
12111 (elem = import_from_as_name_rule(p))
12112 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012113 (seq = _loop0_33_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012114 )
12115 {
12116 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12117 goto done;
12118 }
12119 p->mark = mark;
12120 }
12121 res = NULL;
12122 done:
12123 return res;
12124}
12125
Guido van Rossumc001c092020-04-30 12:12:19 -070012126// _tmp_34: 'as' NAME
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012127static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070012128_tmp_34_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012129{
12130 if (p->error_indicator) {
12131 return NULL;
12132 }
12133 void * res = NULL;
12134 int mark = p->mark;
12135 { // 'as' NAME
Pablo Galindob796b3f2020-05-01 12:32:26 +010012136 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012137 expr_ty z;
12138 if (
12139 (keyword = _PyPegen_expect_token(p, 531))
12140 &&
12141 (z = _PyPegen_name_token(p))
12142 )
12143 {
12144 res = z;
12145 if (res == NULL && PyErr_Occurred()) {
12146 p->error_indicator = 1;
12147 return NULL;
12148 }
12149 goto done;
12150 }
12151 p->mark = mark;
12152 }
12153 res = NULL;
12154 done:
12155 return res;
12156}
12157
Guido van Rossumc001c092020-04-30 12:12:19 -070012158// _loop0_36: ',' dotted_as_name
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012159static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012160_loop0_36_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012161{
12162 if (p->error_indicator) {
12163 return NULL;
12164 }
12165 void *res = NULL;
12166 int mark = p->mark;
12167 int start_mark = p->mark;
12168 void **children = PyMem_Malloc(sizeof(void *));
12169 if (!children) {
12170 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12171 return NULL;
12172 }
12173 ssize_t children_capacity = 1;
12174 ssize_t n = 0;
12175 { // ',' dotted_as_name
12176 alias_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012177 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012178 while (
12179 (literal = _PyPegen_expect_token(p, 12))
12180 &&
12181 (elem = dotted_as_name_rule(p))
12182 )
12183 {
12184 res = elem;
12185 if (res == NULL && PyErr_Occurred()) {
12186 p->error_indicator = 1;
12187 PyMem_Free(children);
12188 return NULL;
12189 }
12190 if (n == children_capacity) {
12191 children_capacity *= 2;
12192 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12193 if (!children) {
12194 PyErr_Format(PyExc_MemoryError, "realloc None");
12195 return NULL;
12196 }
12197 }
12198 children[n++] = res;
12199 mark = p->mark;
12200 }
12201 p->mark = mark;
12202 }
12203 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12204 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012205 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_36");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012206 PyMem_Free(children);
12207 return NULL;
12208 }
12209 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12210 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012211 _PyPegen_insert_memo(p, start_mark, _loop0_36_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012212 return seq;
12213}
12214
Guido van Rossumc001c092020-04-30 12:12:19 -070012215// _gather_35: dotted_as_name _loop0_36
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012216static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012217_gather_35_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012218{
12219 if (p->error_indicator) {
12220 return NULL;
12221 }
12222 asdl_seq * res = NULL;
12223 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012224 { // dotted_as_name _loop0_36
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012225 alias_ty elem;
12226 asdl_seq * seq;
12227 if (
12228 (elem = dotted_as_name_rule(p))
12229 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012230 (seq = _loop0_36_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012231 )
12232 {
12233 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12234 goto done;
12235 }
12236 p->mark = mark;
12237 }
12238 res = NULL;
12239 done:
12240 return res;
12241}
12242
Guido van Rossumc001c092020-04-30 12:12:19 -070012243// _tmp_37: 'as' NAME
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012244static void *
Guido van Rossumc001c092020-04-30 12:12:19 -070012245_tmp_37_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012246{
12247 if (p->error_indicator) {
12248 return NULL;
12249 }
12250 void * res = NULL;
12251 int mark = p->mark;
12252 { // 'as' NAME
Pablo Galindob796b3f2020-05-01 12:32:26 +010012253 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012254 expr_ty z;
12255 if (
12256 (keyword = _PyPegen_expect_token(p, 531))
12257 &&
12258 (z = _PyPegen_name_token(p))
12259 )
12260 {
12261 res = z;
12262 if (res == NULL && PyErr_Occurred()) {
12263 p->error_indicator = 1;
12264 return NULL;
12265 }
12266 goto done;
12267 }
12268 p->mark = mark;
12269 }
12270 res = NULL;
12271 done:
12272 return res;
12273}
12274
Guido van Rossumc001c092020-04-30 12:12:19 -070012275// _loop0_39: ',' with_item
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012276static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012277_loop0_39_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012278{
12279 if (p->error_indicator) {
12280 return NULL;
12281 }
12282 void *res = NULL;
12283 int mark = p->mark;
12284 int start_mark = p->mark;
12285 void **children = PyMem_Malloc(sizeof(void *));
12286 if (!children) {
12287 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12288 return NULL;
12289 }
12290 ssize_t children_capacity = 1;
12291 ssize_t n = 0;
12292 { // ',' with_item
12293 withitem_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012294 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012295 while (
12296 (literal = _PyPegen_expect_token(p, 12))
12297 &&
12298 (elem = with_item_rule(p))
12299 )
12300 {
12301 res = elem;
12302 if (res == NULL && PyErr_Occurred()) {
12303 p->error_indicator = 1;
12304 PyMem_Free(children);
12305 return NULL;
12306 }
12307 if (n == children_capacity) {
12308 children_capacity *= 2;
12309 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12310 if (!children) {
12311 PyErr_Format(PyExc_MemoryError, "realloc None");
12312 return NULL;
12313 }
12314 }
12315 children[n++] = res;
12316 mark = p->mark;
12317 }
12318 p->mark = mark;
12319 }
12320 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12321 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012322 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_39");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012323 PyMem_Free(children);
12324 return NULL;
12325 }
12326 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12327 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012328 _PyPegen_insert_memo(p, start_mark, _loop0_39_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012329 return seq;
12330}
12331
Guido van Rossumc001c092020-04-30 12:12:19 -070012332// _gather_38: with_item _loop0_39
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012333static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012334_gather_38_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012335{
12336 if (p->error_indicator) {
12337 return NULL;
12338 }
12339 asdl_seq * res = NULL;
12340 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012341 { // with_item _loop0_39
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012342 withitem_ty elem;
12343 asdl_seq * seq;
12344 if (
12345 (elem = with_item_rule(p))
12346 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012347 (seq = _loop0_39_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012348 )
12349 {
12350 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12351 goto done;
12352 }
12353 p->mark = mark;
12354 }
12355 res = NULL;
12356 done:
12357 return res;
12358}
12359
Guido van Rossumc001c092020-04-30 12:12:19 -070012360// _loop0_41: ',' with_item
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012361static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012362_loop0_41_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012363{
12364 if (p->error_indicator) {
12365 return NULL;
12366 }
12367 void *res = NULL;
12368 int mark = p->mark;
12369 int start_mark = p->mark;
12370 void **children = PyMem_Malloc(sizeof(void *));
12371 if (!children) {
12372 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12373 return NULL;
12374 }
12375 ssize_t children_capacity = 1;
12376 ssize_t n = 0;
12377 { // ',' with_item
12378 withitem_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012379 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012380 while (
12381 (literal = _PyPegen_expect_token(p, 12))
12382 &&
12383 (elem = with_item_rule(p))
12384 )
12385 {
12386 res = elem;
12387 if (res == NULL && PyErr_Occurred()) {
12388 p->error_indicator = 1;
12389 PyMem_Free(children);
12390 return NULL;
12391 }
12392 if (n == children_capacity) {
12393 children_capacity *= 2;
12394 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12395 if (!children) {
12396 PyErr_Format(PyExc_MemoryError, "realloc None");
12397 return NULL;
12398 }
12399 }
12400 children[n++] = res;
12401 mark = p->mark;
12402 }
12403 p->mark = mark;
12404 }
12405 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12406 if (!seq) {
Guido van Rossumc001c092020-04-30 12:12:19 -070012407 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_41");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012408 PyMem_Free(children);
12409 return NULL;
12410 }
12411 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12412 PyMem_Free(children);
Guido van Rossumc001c092020-04-30 12:12:19 -070012413 _PyPegen_insert_memo(p, start_mark, _loop0_41_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012414 return seq;
12415}
12416
Guido van Rossumc001c092020-04-30 12:12:19 -070012417// _gather_40: with_item _loop0_41
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012418static asdl_seq *
Guido van Rossumc001c092020-04-30 12:12:19 -070012419_gather_40_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012420{
12421 if (p->error_indicator) {
12422 return NULL;
12423 }
12424 asdl_seq * res = NULL;
12425 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012426 { // with_item _loop0_41
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012427 withitem_ty elem;
12428 asdl_seq * seq;
12429 if (
12430 (elem = with_item_rule(p))
12431 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012432 (seq = _loop0_41_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012433 )
12434 {
12435 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12436 goto done;
12437 }
12438 p->mark = mark;
12439 }
12440 res = NULL;
12441 done:
12442 return res;
12443}
12444
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012445// _loop0_43: ',' with_item
12446static asdl_seq *
12447_loop0_43_rule(Parser *p)
12448{
12449 if (p->error_indicator) {
12450 return NULL;
12451 }
12452 void *res = NULL;
12453 int mark = p->mark;
12454 int start_mark = p->mark;
12455 void **children = PyMem_Malloc(sizeof(void *));
12456 if (!children) {
12457 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12458 return NULL;
12459 }
12460 ssize_t children_capacity = 1;
12461 ssize_t n = 0;
12462 { // ',' with_item
12463 withitem_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012464 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012465 while (
12466 (literal = _PyPegen_expect_token(p, 12))
12467 &&
12468 (elem = with_item_rule(p))
12469 )
12470 {
12471 res = elem;
12472 if (res == NULL && PyErr_Occurred()) {
12473 p->error_indicator = 1;
12474 PyMem_Free(children);
12475 return NULL;
12476 }
12477 if (n == children_capacity) {
12478 children_capacity *= 2;
12479 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12480 if (!children) {
12481 PyErr_Format(PyExc_MemoryError, "realloc None");
12482 return NULL;
12483 }
12484 }
12485 children[n++] = res;
12486 mark = p->mark;
12487 }
12488 p->mark = mark;
12489 }
12490 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12491 if (!seq) {
12492 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_43");
12493 PyMem_Free(children);
12494 return NULL;
12495 }
12496 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12497 PyMem_Free(children);
12498 _PyPegen_insert_memo(p, start_mark, _loop0_43_type, seq);
12499 return seq;
12500}
12501
12502// _gather_42: with_item _loop0_43
12503static asdl_seq *
12504_gather_42_rule(Parser *p)
12505{
12506 if (p->error_indicator) {
12507 return NULL;
12508 }
12509 asdl_seq * res = NULL;
12510 int mark = p->mark;
12511 { // with_item _loop0_43
12512 withitem_ty elem;
12513 asdl_seq * seq;
12514 if (
12515 (elem = with_item_rule(p))
12516 &&
12517 (seq = _loop0_43_rule(p))
12518 )
12519 {
12520 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12521 goto done;
12522 }
12523 p->mark = mark;
12524 }
12525 res = NULL;
12526 done:
12527 return res;
12528}
12529
12530// _loop0_45: ',' with_item
12531static asdl_seq *
12532_loop0_45_rule(Parser *p)
12533{
12534 if (p->error_indicator) {
12535 return NULL;
12536 }
12537 void *res = NULL;
12538 int mark = p->mark;
12539 int start_mark = p->mark;
12540 void **children = PyMem_Malloc(sizeof(void *));
12541 if (!children) {
12542 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12543 return NULL;
12544 }
12545 ssize_t children_capacity = 1;
12546 ssize_t n = 0;
12547 { // ',' with_item
12548 withitem_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010012549 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012550 while (
12551 (literal = _PyPegen_expect_token(p, 12))
12552 &&
12553 (elem = with_item_rule(p))
12554 )
12555 {
12556 res = elem;
12557 if (res == NULL && PyErr_Occurred()) {
12558 p->error_indicator = 1;
12559 PyMem_Free(children);
12560 return NULL;
12561 }
12562 if (n == children_capacity) {
12563 children_capacity *= 2;
12564 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12565 if (!children) {
12566 PyErr_Format(PyExc_MemoryError, "realloc None");
12567 return NULL;
12568 }
12569 }
12570 children[n++] = res;
12571 mark = p->mark;
12572 }
12573 p->mark = mark;
12574 }
12575 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12576 if (!seq) {
12577 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_45");
12578 PyMem_Free(children);
12579 return NULL;
12580 }
12581 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12582 PyMem_Free(children);
12583 _PyPegen_insert_memo(p, start_mark, _loop0_45_type, seq);
12584 return seq;
12585}
12586
12587// _gather_44: with_item _loop0_45
12588static asdl_seq *
12589_gather_44_rule(Parser *p)
12590{
12591 if (p->error_indicator) {
12592 return NULL;
12593 }
12594 asdl_seq * res = NULL;
12595 int mark = p->mark;
12596 { // with_item _loop0_45
12597 withitem_ty elem;
12598 asdl_seq * seq;
12599 if (
12600 (elem = with_item_rule(p))
12601 &&
12602 (seq = _loop0_45_rule(p))
12603 )
12604 {
12605 res = _PyPegen_seq_insert_in_front(p, elem, seq);
12606 goto done;
12607 }
12608 p->mark = mark;
12609 }
12610 res = NULL;
12611 done:
12612 return res;
12613}
12614
12615// _tmp_46: 'as' target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012616static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012617_tmp_46_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012618{
12619 if (p->error_indicator) {
12620 return NULL;
12621 }
12622 void * res = NULL;
12623 int mark = p->mark;
12624 { // 'as' target
Pablo Galindob796b3f2020-05-01 12:32:26 +010012625 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012626 expr_ty t;
12627 if (
12628 (keyword = _PyPegen_expect_token(p, 531))
12629 &&
12630 (t = target_rule(p))
12631 )
12632 {
12633 res = t;
12634 if (res == NULL && PyErr_Occurred()) {
12635 p->error_indicator = 1;
12636 return NULL;
12637 }
12638 goto done;
12639 }
12640 p->mark = mark;
12641 }
12642 res = NULL;
12643 done:
12644 return res;
12645}
12646
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012647// _loop1_47: except_block
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012648static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012649_loop1_47_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012650{
12651 if (p->error_indicator) {
12652 return NULL;
12653 }
12654 void *res = NULL;
12655 int mark = p->mark;
12656 int start_mark = p->mark;
12657 void **children = PyMem_Malloc(sizeof(void *));
12658 if (!children) {
12659 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12660 return NULL;
12661 }
12662 ssize_t children_capacity = 1;
12663 ssize_t n = 0;
12664 { // except_block
12665 excepthandler_ty except_block_var;
12666 while (
12667 (except_block_var = except_block_rule(p))
12668 )
12669 {
12670 res = except_block_var;
12671 if (n == children_capacity) {
12672 children_capacity *= 2;
12673 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12674 if (!children) {
12675 PyErr_Format(PyExc_MemoryError, "realloc None");
12676 return NULL;
12677 }
12678 }
12679 children[n++] = res;
12680 mark = p->mark;
12681 }
12682 p->mark = mark;
12683 }
12684 if (n == 0) {
12685 PyMem_Free(children);
12686 return NULL;
12687 }
12688 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12689 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012690 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_47");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012691 PyMem_Free(children);
12692 return NULL;
12693 }
12694 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12695 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012696 _PyPegen_insert_memo(p, start_mark, _loop1_47_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012697 return seq;
12698}
12699
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012700// _tmp_48: 'as' target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012701static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012702_tmp_48_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012703{
12704 if (p->error_indicator) {
12705 return NULL;
12706 }
12707 void * res = NULL;
12708 int mark = p->mark;
12709 { // 'as' target
Pablo Galindob796b3f2020-05-01 12:32:26 +010012710 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012711 expr_ty z;
12712 if (
12713 (keyword = _PyPegen_expect_token(p, 531))
12714 &&
12715 (z = target_rule(p))
12716 )
12717 {
12718 res = z;
12719 if (res == NULL && PyErr_Occurred()) {
12720 p->error_indicator = 1;
12721 return NULL;
12722 }
12723 goto done;
12724 }
12725 p->mark = mark;
12726 }
12727 res = NULL;
12728 done:
12729 return res;
12730}
12731
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012732// _tmp_49: 'from' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012733static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012734_tmp_49_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012735{
12736 if (p->error_indicator) {
12737 return NULL;
12738 }
12739 void * res = NULL;
12740 int mark = p->mark;
12741 { // 'from' expression
Pablo Galindob796b3f2020-05-01 12:32:26 +010012742 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012743 expr_ty z;
12744 if (
12745 (keyword = _PyPegen_expect_token(p, 514))
12746 &&
12747 (z = expression_rule(p))
12748 )
12749 {
12750 res = z;
12751 if (res == NULL && PyErr_Occurred()) {
12752 p->error_indicator = 1;
12753 return NULL;
12754 }
12755 goto done;
12756 }
12757 p->mark = mark;
12758 }
12759 res = NULL;
12760 done:
12761 return res;
12762}
12763
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012764// _tmp_50: '->' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012765static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012766_tmp_50_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012767{
12768 if (p->error_indicator) {
12769 return NULL;
12770 }
12771 void * res = NULL;
12772 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070012773 { // '->' expression
Pablo Galindob796b3f2020-05-01 12:32:26 +010012774 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070012775 expr_ty z;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012776 if (
Guido van Rossumc001c092020-04-30 12:12:19 -070012777 (literal = _PyPegen_expect_token(p, 51))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012778 &&
Guido van Rossumc001c092020-04-30 12:12:19 -070012779 (z = expression_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012780 )
12781 {
Guido van Rossumc001c092020-04-30 12:12:19 -070012782 res = z;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012783 if (res == NULL && PyErr_Occurred()) {
12784 p->error_indicator = 1;
12785 return NULL;
12786 }
12787 goto done;
12788 }
12789 p->mark = mark;
12790 }
12791 res = NULL;
12792 done:
12793 return res;
12794}
12795
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012796// _tmp_51: '->' expression
Guido van Rossumc001c092020-04-30 12:12:19 -070012797static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012798_tmp_51_rule(Parser *p)
12799{
12800 if (p->error_indicator) {
12801 return NULL;
12802 }
12803 void * res = NULL;
12804 int mark = p->mark;
12805 { // '->' expression
Pablo Galindob796b3f2020-05-01 12:32:26 +010012806 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012807 expr_ty z;
12808 if (
12809 (literal = _PyPegen_expect_token(p, 51))
12810 &&
12811 (z = expression_rule(p))
12812 )
12813 {
12814 res = z;
12815 if (res == NULL && PyErr_Occurred()) {
12816 p->error_indicator = 1;
12817 return NULL;
12818 }
12819 goto done;
12820 }
12821 p->mark = mark;
12822 }
12823 res = NULL;
12824 done:
12825 return res;
12826}
12827
12828// _tmp_52: NEWLINE INDENT
12829static void *
12830_tmp_52_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070012831{
12832 if (p->error_indicator) {
12833 return NULL;
12834 }
12835 void * res = NULL;
12836 int mark = p->mark;
12837 { // NEWLINE INDENT
Pablo Galindob796b3f2020-05-01 12:32:26 +010012838 Token * indent_var;
12839 Token * newline_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070012840 if (
12841 (newline_var = _PyPegen_expect_token(p, NEWLINE))
12842 &&
12843 (indent_var = _PyPegen_expect_token(p, INDENT))
12844 )
12845 {
12846 res = _PyPegen_dummy_name(p, newline_var, indent_var);
12847 goto done;
12848 }
12849 p->mark = mark;
12850 }
12851 res = NULL;
12852 done:
12853 return res;
12854}
12855
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012856// _loop0_53: param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012857static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012858_loop0_53_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012859{
12860 if (p->error_indicator) {
12861 return NULL;
12862 }
12863 void *res = NULL;
12864 int mark = p->mark;
12865 int start_mark = p->mark;
12866 void **children = PyMem_Malloc(sizeof(void *));
12867 if (!children) {
12868 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12869 return NULL;
12870 }
12871 ssize_t children_capacity = 1;
12872 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070012873 { // param_no_default
12874 arg_ty param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012875 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070012876 (param_no_default_var = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012877 )
12878 {
Guido van Rossumc001c092020-04-30 12:12:19 -070012879 res = param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012880 if (n == children_capacity) {
12881 children_capacity *= 2;
12882 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12883 if (!children) {
12884 PyErr_Format(PyExc_MemoryError, "realloc None");
12885 return NULL;
12886 }
12887 }
12888 children[n++] = res;
12889 mark = p->mark;
12890 }
12891 p->mark = mark;
12892 }
12893 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12894 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012895 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_53");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012896 PyMem_Free(children);
12897 return NULL;
12898 }
12899 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12900 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012901 _PyPegen_insert_memo(p, start_mark, _loop0_53_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012902 return seq;
12903}
12904
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012905// _loop0_54: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012906static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012907_loop0_54_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012908{
12909 if (p->error_indicator) {
12910 return NULL;
12911 }
12912 void *res = NULL;
12913 int mark = p->mark;
12914 int start_mark = p->mark;
12915 void **children = PyMem_Malloc(sizeof(void *));
12916 if (!children) {
12917 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12918 return NULL;
12919 }
12920 ssize_t children_capacity = 1;
12921 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070012922 { // param_with_default
12923 NameDefaultPair* param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012924 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070012925 (param_with_default_var = param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010012926 )
12927 {
Guido van Rossumc001c092020-04-30 12:12:19 -070012928 res = param_with_default_var;
12929 if (n == children_capacity) {
12930 children_capacity *= 2;
12931 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12932 if (!children) {
12933 PyErr_Format(PyExc_MemoryError, "realloc None");
12934 return NULL;
12935 }
12936 }
12937 children[n++] = res;
12938 mark = p->mark;
12939 }
12940 p->mark = mark;
12941 }
12942 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12943 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012944 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_54");
Guido van Rossumc001c092020-04-30 12:12:19 -070012945 PyMem_Free(children);
12946 return NULL;
12947 }
12948 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12949 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012950 _PyPegen_insert_memo(p, start_mark, _loop0_54_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070012951 return seq;
12952}
12953
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012954// _loop0_55: param_with_default
Guido van Rossumc001c092020-04-30 12:12:19 -070012955static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012956_loop0_55_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070012957{
12958 if (p->error_indicator) {
12959 return NULL;
12960 }
12961 void *res = NULL;
12962 int mark = p->mark;
12963 int start_mark = p->mark;
12964 void **children = PyMem_Malloc(sizeof(void *));
12965 if (!children) {
12966 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
12967 return NULL;
12968 }
12969 ssize_t children_capacity = 1;
12970 ssize_t n = 0;
12971 { // param_with_default
12972 NameDefaultPair* param_with_default_var;
12973 while (
12974 (param_with_default_var = param_with_default_rule(p))
12975 )
12976 {
12977 res = param_with_default_var;
12978 if (n == children_capacity) {
12979 children_capacity *= 2;
12980 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
12981 if (!children) {
12982 PyErr_Format(PyExc_MemoryError, "realloc None");
12983 return NULL;
12984 }
12985 }
12986 children[n++] = res;
12987 mark = p->mark;
12988 }
12989 p->mark = mark;
12990 }
12991 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
12992 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012993 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_55");
Guido van Rossumc001c092020-04-30 12:12:19 -070012994 PyMem_Free(children);
12995 return NULL;
12996 }
12997 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
12998 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030012999 _PyPegen_insert_memo(p, start_mark, _loop0_55_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070013000 return seq;
13001}
13002
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013003// _loop1_56: param_no_default
Guido van Rossumc001c092020-04-30 12:12:19 -070013004static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013005_loop1_56_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070013006{
13007 if (p->error_indicator) {
13008 return NULL;
13009 }
13010 void *res = NULL;
13011 int mark = p->mark;
13012 int start_mark = p->mark;
13013 void **children = PyMem_Malloc(sizeof(void *));
13014 if (!children) {
13015 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13016 return NULL;
13017 }
13018 ssize_t children_capacity = 1;
13019 ssize_t n = 0;
13020 { // param_no_default
13021 arg_ty param_no_default_var;
13022 while (
13023 (param_no_default_var = param_no_default_rule(p))
13024 )
13025 {
13026 res = param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013027 if (n == children_capacity) {
13028 children_capacity *= 2;
13029 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13030 if (!children) {
13031 PyErr_Format(PyExc_MemoryError, "realloc None");
13032 return NULL;
13033 }
13034 }
13035 children[n++] = res;
13036 mark = p->mark;
13037 }
13038 p->mark = mark;
13039 }
13040 if (n == 0) {
13041 PyMem_Free(children);
13042 return NULL;
13043 }
13044 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13045 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013046 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_56");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013047 PyMem_Free(children);
13048 return NULL;
13049 }
13050 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13051 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013052 _PyPegen_insert_memo(p, start_mark, _loop1_56_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013053 return seq;
13054}
13055
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013056// _loop0_57: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013057static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013058_loop0_57_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013059{
13060 if (p->error_indicator) {
13061 return NULL;
13062 }
13063 void *res = NULL;
13064 int mark = p->mark;
13065 int start_mark = p->mark;
13066 void **children = PyMem_Malloc(sizeof(void *));
13067 if (!children) {
13068 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13069 return NULL;
13070 }
13071 ssize_t children_capacity = 1;
13072 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070013073 { // param_with_default
13074 NameDefaultPair* param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013075 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070013076 (param_with_default_var = param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013077 )
13078 {
Guido van Rossumc001c092020-04-30 12:12:19 -070013079 res = param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013080 if (n == children_capacity) {
13081 children_capacity *= 2;
13082 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13083 if (!children) {
13084 PyErr_Format(PyExc_MemoryError, "realloc None");
13085 return NULL;
13086 }
13087 }
13088 children[n++] = res;
13089 mark = p->mark;
13090 }
13091 p->mark = mark;
13092 }
13093 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13094 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013095 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_57");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013096 PyMem_Free(children);
13097 return NULL;
13098 }
13099 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13100 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013101 _PyPegen_insert_memo(p, start_mark, _loop0_57_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013102 return seq;
13103}
13104
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013105// _loop1_58: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013106static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013107_loop1_58_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013108{
13109 if (p->error_indicator) {
13110 return NULL;
13111 }
13112 void *res = NULL;
13113 int mark = p->mark;
13114 int start_mark = p->mark;
13115 void **children = PyMem_Malloc(sizeof(void *));
13116 if (!children) {
13117 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13118 return NULL;
13119 }
13120 ssize_t children_capacity = 1;
13121 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070013122 { // param_with_default
13123 NameDefaultPair* param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013124 while (
Guido van Rossumc001c092020-04-30 12:12:19 -070013125 (param_with_default_var = param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013126 )
13127 {
Guido van Rossumc001c092020-04-30 12:12:19 -070013128 res = param_with_default_var;
13129 if (n == children_capacity) {
13130 children_capacity *= 2;
13131 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13132 if (!children) {
13133 PyErr_Format(PyExc_MemoryError, "realloc None");
13134 return NULL;
13135 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013136 }
Guido van Rossumc001c092020-04-30 12:12:19 -070013137 children[n++] = res;
13138 mark = p->mark;
13139 }
13140 p->mark = mark;
13141 }
13142 if (n == 0) {
13143 PyMem_Free(children);
13144 return NULL;
13145 }
13146 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13147 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013148 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_58");
Guido van Rossumc001c092020-04-30 12:12:19 -070013149 PyMem_Free(children);
13150 return NULL;
13151 }
13152 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13153 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013154 _PyPegen_insert_memo(p, start_mark, _loop1_58_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070013155 return seq;
13156}
13157
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013158// _loop1_59: param_no_default
Guido van Rossumc001c092020-04-30 12:12:19 -070013159static asdl_seq *
13160_loop1_59_rule(Parser *p)
13161{
13162 if (p->error_indicator) {
13163 return NULL;
13164 }
13165 void *res = NULL;
13166 int mark = p->mark;
13167 int start_mark = p->mark;
13168 void **children = PyMem_Malloc(sizeof(void *));
13169 if (!children) {
13170 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13171 return NULL;
13172 }
13173 ssize_t children_capacity = 1;
13174 ssize_t n = 0;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013175 { // param_no_default
13176 arg_ty param_no_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013177 while (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013178 (param_no_default_var = param_no_default_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070013179 )
13180 {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013181 res = param_no_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013182 if (n == children_capacity) {
13183 children_capacity *= 2;
13184 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13185 if (!children) {
13186 PyErr_Format(PyExc_MemoryError, "realloc None");
13187 return NULL;
13188 }
13189 }
13190 children[n++] = res;
13191 mark = p->mark;
13192 }
13193 p->mark = mark;
13194 }
13195 if (n == 0) {
13196 PyMem_Free(children);
13197 return NULL;
13198 }
13199 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13200 if (!seq) {
13201 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_59");
13202 PyMem_Free(children);
13203 return NULL;
13204 }
13205 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13206 PyMem_Free(children);
13207 _PyPegen_insert_memo(p, start_mark, _loop1_59_type, seq);
13208 return seq;
13209}
13210
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013211// _loop1_60: param_no_default
Guido van Rossumc001c092020-04-30 12:12:19 -070013212static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013213_loop1_60_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070013214{
13215 if (p->error_indicator) {
13216 return NULL;
13217 }
13218 void *res = NULL;
13219 int mark = p->mark;
13220 int start_mark = p->mark;
13221 void **children = PyMem_Malloc(sizeof(void *));
13222 if (!children) {
13223 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13224 return NULL;
13225 }
13226 ssize_t children_capacity = 1;
13227 ssize_t n = 0;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013228 { // param_no_default
13229 arg_ty param_no_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013230 while (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013231 (param_no_default_var = param_no_default_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070013232 )
13233 {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013234 res = param_no_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013235 if (n == children_capacity) {
13236 children_capacity *= 2;
13237 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13238 if (!children) {
13239 PyErr_Format(PyExc_MemoryError, "realloc None");
13240 return NULL;
13241 }
13242 }
13243 children[n++] = res;
13244 mark = p->mark;
13245 }
13246 p->mark = mark;
13247 }
13248 if (n == 0) {
13249 PyMem_Free(children);
13250 return NULL;
13251 }
13252 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13253 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013254 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_60");
Guido van Rossumc001c092020-04-30 12:12:19 -070013255 PyMem_Free(children);
13256 return NULL;
13257 }
13258 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13259 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013260 _PyPegen_insert_memo(p, start_mark, _loop1_60_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070013261 return seq;
13262}
13263
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013264// _loop0_61: param_no_default
13265static asdl_seq *
13266_loop0_61_rule(Parser *p)
13267{
13268 if (p->error_indicator) {
13269 return NULL;
13270 }
13271 void *res = NULL;
13272 int mark = p->mark;
13273 int start_mark = p->mark;
13274 void **children = PyMem_Malloc(sizeof(void *));
13275 if (!children) {
13276 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13277 return NULL;
13278 }
13279 ssize_t children_capacity = 1;
13280 ssize_t n = 0;
13281 { // param_no_default
13282 arg_ty param_no_default_var;
13283 while (
13284 (param_no_default_var = param_no_default_rule(p))
13285 )
13286 {
13287 res = param_no_default_var;
13288 if (n == children_capacity) {
13289 children_capacity *= 2;
13290 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13291 if (!children) {
13292 PyErr_Format(PyExc_MemoryError, "realloc None");
13293 return NULL;
13294 }
13295 }
13296 children[n++] = res;
13297 mark = p->mark;
13298 }
13299 p->mark = mark;
13300 }
13301 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13302 if (!seq) {
13303 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_61");
13304 PyMem_Free(children);
13305 return NULL;
13306 }
13307 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13308 PyMem_Free(children);
13309 _PyPegen_insert_memo(p, start_mark, _loop0_61_type, seq);
13310 return seq;
13311}
13312
13313// _loop1_62: param_with_default
Guido van Rossumc001c092020-04-30 12:12:19 -070013314static asdl_seq *
13315_loop1_62_rule(Parser *p)
13316{
13317 if (p->error_indicator) {
13318 return NULL;
13319 }
13320 void *res = NULL;
13321 int mark = p->mark;
13322 int start_mark = p->mark;
13323 void **children = PyMem_Malloc(sizeof(void *));
13324 if (!children) {
13325 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13326 return NULL;
13327 }
13328 ssize_t children_capacity = 1;
13329 ssize_t n = 0;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013330 { // param_with_default
13331 NameDefaultPair* param_with_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013332 while (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013333 (param_with_default_var = param_with_default_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070013334 )
13335 {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013336 res = param_with_default_var;
Guido van Rossumc001c092020-04-30 12:12:19 -070013337 if (n == children_capacity) {
13338 children_capacity *= 2;
13339 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13340 if (!children) {
13341 PyErr_Format(PyExc_MemoryError, "realloc None");
13342 return NULL;
13343 }
13344 }
13345 children[n++] = res;
13346 mark = p->mark;
13347 }
13348 p->mark = mark;
13349 }
13350 if (n == 0) {
13351 PyMem_Free(children);
13352 return NULL;
13353 }
13354 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13355 if (!seq) {
13356 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_62");
13357 PyMem_Free(children);
13358 return NULL;
13359 }
13360 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13361 PyMem_Free(children);
13362 _PyPegen_insert_memo(p, start_mark, _loop1_62_type, seq);
13363 return seq;
13364}
13365
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013366// _loop0_63: param_no_default
13367static asdl_seq *
13368_loop0_63_rule(Parser *p)
13369{
13370 if (p->error_indicator) {
13371 return NULL;
13372 }
13373 void *res = NULL;
13374 int mark = p->mark;
13375 int start_mark = p->mark;
13376 void **children = PyMem_Malloc(sizeof(void *));
13377 if (!children) {
13378 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13379 return NULL;
13380 }
13381 ssize_t children_capacity = 1;
13382 ssize_t n = 0;
13383 { // param_no_default
13384 arg_ty param_no_default_var;
13385 while (
13386 (param_no_default_var = param_no_default_rule(p))
13387 )
13388 {
13389 res = param_no_default_var;
13390 if (n == children_capacity) {
13391 children_capacity *= 2;
13392 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13393 if (!children) {
13394 PyErr_Format(PyExc_MemoryError, "realloc None");
13395 return NULL;
13396 }
13397 }
13398 children[n++] = res;
13399 mark = p->mark;
13400 }
13401 p->mark = mark;
13402 }
13403 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13404 if (!seq) {
13405 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_63");
13406 PyMem_Free(children);
13407 return NULL;
13408 }
13409 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13410 PyMem_Free(children);
13411 _PyPegen_insert_memo(p, start_mark, _loop0_63_type, seq);
13412 return seq;
13413}
13414
13415// _loop1_64: param_with_default
13416static asdl_seq *
13417_loop1_64_rule(Parser *p)
13418{
13419 if (p->error_indicator) {
13420 return NULL;
13421 }
13422 void *res = NULL;
13423 int mark = p->mark;
13424 int start_mark = p->mark;
13425 void **children = PyMem_Malloc(sizeof(void *));
13426 if (!children) {
13427 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13428 return NULL;
13429 }
13430 ssize_t children_capacity = 1;
13431 ssize_t n = 0;
13432 { // param_with_default
13433 NameDefaultPair* param_with_default_var;
13434 while (
13435 (param_with_default_var = param_with_default_rule(p))
13436 )
13437 {
13438 res = param_with_default_var;
13439 if (n == children_capacity) {
13440 children_capacity *= 2;
13441 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13442 if (!children) {
13443 PyErr_Format(PyExc_MemoryError, "realloc None");
13444 return NULL;
13445 }
13446 }
13447 children[n++] = res;
13448 mark = p->mark;
13449 }
13450 p->mark = mark;
13451 }
13452 if (n == 0) {
13453 PyMem_Free(children);
13454 return NULL;
13455 }
13456 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13457 if (!seq) {
13458 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_64");
13459 PyMem_Free(children);
13460 return NULL;
13461 }
13462 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13463 PyMem_Free(children);
13464 _PyPegen_insert_memo(p, start_mark, _loop1_64_type, seq);
13465 return seq;
13466}
13467
13468// _loop0_65: param_maybe_default
13469static asdl_seq *
13470_loop0_65_rule(Parser *p)
13471{
13472 if (p->error_indicator) {
13473 return NULL;
13474 }
13475 void *res = NULL;
13476 int mark = p->mark;
13477 int start_mark = p->mark;
13478 void **children = PyMem_Malloc(sizeof(void *));
13479 if (!children) {
13480 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13481 return NULL;
13482 }
13483 ssize_t children_capacity = 1;
13484 ssize_t n = 0;
13485 { // param_maybe_default
13486 NameDefaultPair* param_maybe_default_var;
13487 while (
13488 (param_maybe_default_var = param_maybe_default_rule(p))
13489 )
13490 {
13491 res = param_maybe_default_var;
13492 if (n == children_capacity) {
13493 children_capacity *= 2;
13494 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13495 if (!children) {
13496 PyErr_Format(PyExc_MemoryError, "realloc None");
13497 return NULL;
13498 }
13499 }
13500 children[n++] = res;
13501 mark = p->mark;
13502 }
13503 p->mark = mark;
13504 }
13505 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13506 if (!seq) {
13507 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_65");
13508 PyMem_Free(children);
13509 return NULL;
13510 }
13511 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13512 PyMem_Free(children);
13513 _PyPegen_insert_memo(p, start_mark, _loop0_65_type, seq);
13514 return seq;
13515}
13516
13517// _loop1_66: param_maybe_default
13518static asdl_seq *
13519_loop1_66_rule(Parser *p)
13520{
13521 if (p->error_indicator) {
13522 return NULL;
13523 }
13524 void *res = NULL;
13525 int mark = p->mark;
13526 int start_mark = p->mark;
13527 void **children = PyMem_Malloc(sizeof(void *));
13528 if (!children) {
13529 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13530 return NULL;
13531 }
13532 ssize_t children_capacity = 1;
13533 ssize_t n = 0;
13534 { // param_maybe_default
13535 NameDefaultPair* param_maybe_default_var;
13536 while (
13537 (param_maybe_default_var = param_maybe_default_rule(p))
13538 )
13539 {
13540 res = param_maybe_default_var;
13541 if (n == children_capacity) {
13542 children_capacity *= 2;
13543 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13544 if (!children) {
13545 PyErr_Format(PyExc_MemoryError, "realloc None");
13546 return NULL;
13547 }
13548 }
13549 children[n++] = res;
13550 mark = p->mark;
13551 }
13552 p->mark = mark;
13553 }
13554 if (n == 0) {
13555 PyMem_Free(children);
13556 return NULL;
13557 }
13558 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13559 if (!seq) {
13560 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_66");
13561 PyMem_Free(children);
13562 return NULL;
13563 }
13564 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13565 PyMem_Free(children);
13566 _PyPegen_insert_memo(p, start_mark, _loop1_66_type, seq);
13567 return seq;
13568}
13569
13570// _loop1_67: ('@' named_expression NEWLINE)
13571static asdl_seq *
13572_loop1_67_rule(Parser *p)
13573{
13574 if (p->error_indicator) {
13575 return NULL;
13576 }
13577 void *res = NULL;
13578 int mark = p->mark;
13579 int start_mark = p->mark;
13580 void **children = PyMem_Malloc(sizeof(void *));
13581 if (!children) {
13582 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13583 return NULL;
13584 }
13585 ssize_t children_capacity = 1;
13586 ssize_t n = 0;
13587 { // ('@' named_expression NEWLINE)
Guido van Rossum3941d972020-05-01 09:42:03 -070013588 void *_tmp_135_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013589 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070013590 (_tmp_135_var = _tmp_135_rule(p))
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013591 )
13592 {
Guido van Rossum3941d972020-05-01 09:42:03 -070013593 res = _tmp_135_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013594 if (n == children_capacity) {
13595 children_capacity *= 2;
13596 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13597 if (!children) {
13598 PyErr_Format(PyExc_MemoryError, "realloc None");
13599 return NULL;
13600 }
13601 }
13602 children[n++] = res;
13603 mark = p->mark;
13604 }
13605 p->mark = mark;
13606 }
13607 if (n == 0) {
13608 PyMem_Free(children);
13609 return NULL;
13610 }
13611 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13612 if (!seq) {
13613 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_67");
13614 PyMem_Free(children);
13615 return NULL;
13616 }
13617 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13618 PyMem_Free(children);
13619 _PyPegen_insert_memo(p, start_mark, _loop1_67_type, seq);
13620 return seq;
13621}
13622
13623// _tmp_68: '(' arguments? ')'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013624static void *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013625_tmp_68_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013626{
13627 if (p->error_indicator) {
13628 return NULL;
13629 }
13630 void * res = NULL;
13631 int mark = p->mark;
13632 { // '(' arguments? ')'
Pablo Galindob796b3f2020-05-01 12:32:26 +010013633 Token * literal;
13634 Token * literal_1;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013635 void *z;
13636 if (
13637 (literal = _PyPegen_expect_token(p, 7))
13638 &&
13639 (z = arguments_rule(p), 1)
13640 &&
13641 (literal_1 = _PyPegen_expect_token(p, 8))
13642 )
13643 {
13644 res = z;
13645 if (res == NULL && PyErr_Occurred()) {
13646 p->error_indicator = 1;
13647 return NULL;
13648 }
13649 goto done;
13650 }
13651 p->mark = mark;
13652 }
13653 res = NULL;
13654 done:
13655 return res;
13656}
13657
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013658// _loop0_70: ',' star_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013659static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013660_loop0_70_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013661{
13662 if (p->error_indicator) {
13663 return NULL;
13664 }
13665 void *res = NULL;
13666 int mark = p->mark;
13667 int start_mark = p->mark;
13668 void **children = PyMem_Malloc(sizeof(void *));
13669 if (!children) {
13670 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13671 return NULL;
13672 }
13673 ssize_t children_capacity = 1;
13674 ssize_t n = 0;
13675 { // ',' star_expression
13676 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010013677 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013678 while (
13679 (literal = _PyPegen_expect_token(p, 12))
13680 &&
13681 (elem = star_expression_rule(p))
13682 )
13683 {
13684 res = elem;
13685 if (res == NULL && PyErr_Occurred()) {
13686 p->error_indicator = 1;
13687 PyMem_Free(children);
13688 return NULL;
13689 }
13690 if (n == children_capacity) {
13691 children_capacity *= 2;
13692 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13693 if (!children) {
13694 PyErr_Format(PyExc_MemoryError, "realloc None");
13695 return NULL;
13696 }
13697 }
13698 children[n++] = res;
13699 mark = p->mark;
13700 }
13701 p->mark = mark;
13702 }
13703 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13704 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013705 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_70");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013706 PyMem_Free(children);
13707 return NULL;
13708 }
13709 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13710 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013711 _PyPegen_insert_memo(p, start_mark, _loop0_70_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013712 return seq;
13713}
13714
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013715// _gather_69: star_expression _loop0_70
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013716static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013717_gather_69_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013718{
13719 if (p->error_indicator) {
13720 return NULL;
13721 }
13722 asdl_seq * res = NULL;
13723 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013724 { // star_expression _loop0_70
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013725 expr_ty elem;
13726 asdl_seq * seq;
13727 if (
13728 (elem = star_expression_rule(p))
13729 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013730 (seq = _loop0_70_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013731 )
13732 {
13733 res = _PyPegen_seq_insert_in_front(p, elem, seq);
13734 goto done;
13735 }
13736 p->mark = mark;
13737 }
13738 res = NULL;
13739 done:
13740 return res;
13741}
13742
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013743// _loop1_71: (',' star_expression)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013744static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013745_loop1_71_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013746{
13747 if (p->error_indicator) {
13748 return NULL;
13749 }
13750 void *res = NULL;
13751 int mark = p->mark;
13752 int start_mark = p->mark;
13753 void **children = PyMem_Malloc(sizeof(void *));
13754 if (!children) {
13755 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13756 return NULL;
13757 }
13758 ssize_t children_capacity = 1;
13759 ssize_t n = 0;
13760 { // (',' star_expression)
Guido van Rossum3941d972020-05-01 09:42:03 -070013761 void *_tmp_136_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013762 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070013763 (_tmp_136_var = _tmp_136_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013764 )
13765 {
Guido van Rossum3941d972020-05-01 09:42:03 -070013766 res = _tmp_136_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013767 if (n == children_capacity) {
13768 children_capacity *= 2;
13769 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13770 if (!children) {
13771 PyErr_Format(PyExc_MemoryError, "realloc None");
13772 return NULL;
13773 }
13774 }
13775 children[n++] = res;
13776 mark = p->mark;
13777 }
13778 p->mark = mark;
13779 }
13780 if (n == 0) {
13781 PyMem_Free(children);
13782 return NULL;
13783 }
13784 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13785 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013786 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_71");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013787 PyMem_Free(children);
13788 return NULL;
13789 }
13790 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13791 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013792 _PyPegen_insert_memo(p, start_mark, _loop1_71_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013793 return seq;
13794}
13795
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013796// _loop0_73: ',' star_named_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013797static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013798_loop0_73_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013799{
13800 if (p->error_indicator) {
13801 return NULL;
13802 }
13803 void *res = NULL;
13804 int mark = p->mark;
13805 int start_mark = p->mark;
13806 void **children = PyMem_Malloc(sizeof(void *));
13807 if (!children) {
13808 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13809 return NULL;
13810 }
13811 ssize_t children_capacity = 1;
13812 ssize_t n = 0;
13813 { // ',' star_named_expression
13814 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010013815 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013816 while (
13817 (literal = _PyPegen_expect_token(p, 12))
13818 &&
13819 (elem = star_named_expression_rule(p))
13820 )
13821 {
13822 res = elem;
13823 if (res == NULL && PyErr_Occurred()) {
13824 p->error_indicator = 1;
13825 PyMem_Free(children);
13826 return NULL;
13827 }
13828 if (n == children_capacity) {
13829 children_capacity *= 2;
13830 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13831 if (!children) {
13832 PyErr_Format(PyExc_MemoryError, "realloc None");
13833 return NULL;
13834 }
13835 }
13836 children[n++] = res;
13837 mark = p->mark;
13838 }
13839 p->mark = mark;
13840 }
13841 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13842 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013843 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_73");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013844 PyMem_Free(children);
13845 return NULL;
13846 }
13847 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13848 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013849 _PyPegen_insert_memo(p, start_mark, _loop0_73_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013850 return seq;
13851}
13852
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013853// _gather_72: star_named_expression _loop0_73
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013854static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013855_gather_72_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013856{
13857 if (p->error_indicator) {
13858 return NULL;
13859 }
13860 asdl_seq * res = NULL;
13861 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013862 { // star_named_expression _loop0_73
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013863 expr_ty elem;
13864 asdl_seq * seq;
13865 if (
13866 (elem = star_named_expression_rule(p))
13867 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013868 (seq = _loop0_73_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013869 )
13870 {
13871 res = _PyPegen_seq_insert_in_front(p, elem, seq);
13872 goto done;
13873 }
13874 p->mark = mark;
13875 }
13876 res = NULL;
13877 done:
13878 return res;
13879}
13880
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013881// _loop1_74: (',' expression)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013882static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013883_loop1_74_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013884{
13885 if (p->error_indicator) {
13886 return NULL;
13887 }
13888 void *res = NULL;
13889 int mark = p->mark;
13890 int start_mark = p->mark;
13891 void **children = PyMem_Malloc(sizeof(void *));
13892 if (!children) {
13893 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13894 return NULL;
13895 }
13896 ssize_t children_capacity = 1;
13897 ssize_t n = 0;
13898 { // (',' expression)
Guido van Rossum3941d972020-05-01 09:42:03 -070013899 void *_tmp_137_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013900 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070013901 (_tmp_137_var = _tmp_137_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013902 )
13903 {
Guido van Rossum3941d972020-05-01 09:42:03 -070013904 res = _tmp_137_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013905 if (n == children_capacity) {
13906 children_capacity *= 2;
13907 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13908 if (!children) {
13909 PyErr_Format(PyExc_MemoryError, "realloc None");
13910 return NULL;
13911 }
13912 }
13913 children[n++] = res;
13914 mark = p->mark;
13915 }
13916 p->mark = mark;
13917 }
13918 if (n == 0) {
13919 PyMem_Free(children);
13920 return NULL;
13921 }
13922 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13923 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013924 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_74");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013925 PyMem_Free(children);
13926 return NULL;
13927 }
13928 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13929 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030013930 _PyPegen_insert_memo(p, start_mark, _loop1_74_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013931 return seq;
13932}
13933
Guido van Rossum3941d972020-05-01 09:42:03 -070013934// _loop0_75: lambda_param_no_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013935static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070013936_loop0_75_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013937{
13938 if (p->error_indicator) {
13939 return NULL;
13940 }
13941 void *res = NULL;
13942 int mark = p->mark;
13943 int start_mark = p->mark;
13944 void **children = PyMem_Malloc(sizeof(void *));
13945 if (!children) {
13946 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13947 return NULL;
13948 }
13949 ssize_t children_capacity = 1;
13950 ssize_t n = 0;
Guido van Rossum3941d972020-05-01 09:42:03 -070013951 { // lambda_param_no_default
13952 arg_ty lambda_param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013953 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070013954 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013955 )
13956 {
Guido van Rossum3941d972020-05-01 09:42:03 -070013957 res = lambda_param_no_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013958 if (n == children_capacity) {
13959 children_capacity *= 2;
13960 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
13961 if (!children) {
13962 PyErr_Format(PyExc_MemoryError, "realloc None");
13963 return NULL;
13964 }
13965 }
13966 children[n++] = res;
13967 mark = p->mark;
13968 }
13969 p->mark = mark;
13970 }
13971 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
13972 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070013973 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_75");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013974 PyMem_Free(children);
13975 return NULL;
13976 }
13977 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
13978 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070013979 _PyPegen_insert_memo(p, start_mark, _loop0_75_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013980 return seq;
13981}
13982
Guido van Rossum3941d972020-05-01 09:42:03 -070013983// _loop0_76: lambda_param_with_default
13984static asdl_seq *
13985_loop0_76_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013986{
13987 if (p->error_indicator) {
13988 return NULL;
13989 }
Guido van Rossum3941d972020-05-01 09:42:03 -070013990 void *res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010013991 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070013992 int start_mark = p->mark;
13993 void **children = PyMem_Malloc(sizeof(void *));
13994 if (!children) {
13995 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
13996 return NULL;
13997 }
13998 ssize_t children_capacity = 1;
13999 ssize_t n = 0;
14000 { // lambda_param_with_default
14001 NameDefaultPair* lambda_param_with_default_var;
14002 while (
14003 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014004 )
14005 {
Guido van Rossum3941d972020-05-01 09:42:03 -070014006 res = lambda_param_with_default_var;
14007 if (n == children_capacity) {
14008 children_capacity *= 2;
14009 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14010 if (!children) {
14011 PyErr_Format(PyExc_MemoryError, "realloc None");
14012 return NULL;
14013 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014014 }
Guido van Rossum3941d972020-05-01 09:42:03 -070014015 children[n++] = res;
14016 mark = p->mark;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014017 }
14018 p->mark = mark;
14019 }
Guido van Rossum3941d972020-05-01 09:42:03 -070014020 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14021 if (!seq) {
14022 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_76");
14023 PyMem_Free(children);
14024 return NULL;
14025 }
14026 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14027 PyMem_Free(children);
14028 _PyPegen_insert_memo(p, start_mark, _loop0_76_type, seq);
14029 return seq;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014030}
14031
Guido van Rossum3941d972020-05-01 09:42:03 -070014032// _loop0_77: lambda_param_with_default
14033static asdl_seq *
14034_loop0_77_rule(Parser *p)
14035{
14036 if (p->error_indicator) {
14037 return NULL;
14038 }
14039 void *res = NULL;
14040 int mark = p->mark;
14041 int start_mark = p->mark;
14042 void **children = PyMem_Malloc(sizeof(void *));
14043 if (!children) {
14044 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14045 return NULL;
14046 }
14047 ssize_t children_capacity = 1;
14048 ssize_t n = 0;
14049 { // lambda_param_with_default
14050 NameDefaultPair* lambda_param_with_default_var;
14051 while (
14052 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
14053 )
14054 {
14055 res = lambda_param_with_default_var;
14056 if (n == children_capacity) {
14057 children_capacity *= 2;
14058 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14059 if (!children) {
14060 PyErr_Format(PyExc_MemoryError, "realloc None");
14061 return NULL;
14062 }
14063 }
14064 children[n++] = res;
14065 mark = p->mark;
14066 }
14067 p->mark = mark;
14068 }
14069 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14070 if (!seq) {
14071 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_77");
14072 PyMem_Free(children);
14073 return NULL;
14074 }
14075 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14076 PyMem_Free(children);
14077 _PyPegen_insert_memo(p, start_mark, _loop0_77_type, seq);
14078 return seq;
14079}
14080
14081// _loop1_78: lambda_param_no_default
14082static asdl_seq *
14083_loop1_78_rule(Parser *p)
14084{
14085 if (p->error_indicator) {
14086 return NULL;
14087 }
14088 void *res = NULL;
14089 int mark = p->mark;
14090 int start_mark = p->mark;
14091 void **children = PyMem_Malloc(sizeof(void *));
14092 if (!children) {
14093 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14094 return NULL;
14095 }
14096 ssize_t children_capacity = 1;
14097 ssize_t n = 0;
14098 { // lambda_param_no_default
14099 arg_ty lambda_param_no_default_var;
14100 while (
14101 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
14102 )
14103 {
14104 res = lambda_param_no_default_var;
14105 if (n == children_capacity) {
14106 children_capacity *= 2;
14107 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14108 if (!children) {
14109 PyErr_Format(PyExc_MemoryError, "realloc None");
14110 return NULL;
14111 }
14112 }
14113 children[n++] = res;
14114 mark = p->mark;
14115 }
14116 p->mark = mark;
14117 }
14118 if (n == 0) {
14119 PyMem_Free(children);
14120 return NULL;
14121 }
14122 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14123 if (!seq) {
14124 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_78");
14125 PyMem_Free(children);
14126 return NULL;
14127 }
14128 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14129 PyMem_Free(children);
14130 _PyPegen_insert_memo(p, start_mark, _loop1_78_type, seq);
14131 return seq;
14132}
14133
14134// _loop0_79: lambda_param_with_default
14135static asdl_seq *
14136_loop0_79_rule(Parser *p)
14137{
14138 if (p->error_indicator) {
14139 return NULL;
14140 }
14141 void *res = NULL;
14142 int mark = p->mark;
14143 int start_mark = p->mark;
14144 void **children = PyMem_Malloc(sizeof(void *));
14145 if (!children) {
14146 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14147 return NULL;
14148 }
14149 ssize_t children_capacity = 1;
14150 ssize_t n = 0;
14151 { // lambda_param_with_default
14152 NameDefaultPair* lambda_param_with_default_var;
14153 while (
14154 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
14155 )
14156 {
14157 res = lambda_param_with_default_var;
14158 if (n == children_capacity) {
14159 children_capacity *= 2;
14160 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14161 if (!children) {
14162 PyErr_Format(PyExc_MemoryError, "realloc None");
14163 return NULL;
14164 }
14165 }
14166 children[n++] = res;
14167 mark = p->mark;
14168 }
14169 p->mark = mark;
14170 }
14171 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14172 if (!seq) {
14173 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_79");
14174 PyMem_Free(children);
14175 return NULL;
14176 }
14177 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14178 PyMem_Free(children);
14179 _PyPegen_insert_memo(p, start_mark, _loop0_79_type, seq);
14180 return seq;
14181}
14182
14183// _loop1_80: lambda_param_with_default
14184static asdl_seq *
14185_loop1_80_rule(Parser *p)
14186{
14187 if (p->error_indicator) {
14188 return NULL;
14189 }
14190 void *res = NULL;
14191 int mark = p->mark;
14192 int start_mark = p->mark;
14193 void **children = PyMem_Malloc(sizeof(void *));
14194 if (!children) {
14195 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14196 return NULL;
14197 }
14198 ssize_t children_capacity = 1;
14199 ssize_t n = 0;
14200 { // lambda_param_with_default
14201 NameDefaultPair* lambda_param_with_default_var;
14202 while (
14203 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
14204 )
14205 {
14206 res = lambda_param_with_default_var;
14207 if (n == children_capacity) {
14208 children_capacity *= 2;
14209 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14210 if (!children) {
14211 PyErr_Format(PyExc_MemoryError, "realloc None");
14212 return NULL;
14213 }
14214 }
14215 children[n++] = res;
14216 mark = p->mark;
14217 }
14218 p->mark = mark;
14219 }
14220 if (n == 0) {
14221 PyMem_Free(children);
14222 return NULL;
14223 }
14224 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14225 if (!seq) {
14226 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_80");
14227 PyMem_Free(children);
14228 return NULL;
14229 }
14230 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14231 PyMem_Free(children);
14232 _PyPegen_insert_memo(p, start_mark, _loop1_80_type, seq);
14233 return seq;
14234}
14235
14236// _loop1_81: lambda_param_no_default
14237static asdl_seq *
14238_loop1_81_rule(Parser *p)
14239{
14240 if (p->error_indicator) {
14241 return NULL;
14242 }
14243 void *res = NULL;
14244 int mark = p->mark;
14245 int start_mark = p->mark;
14246 void **children = PyMem_Malloc(sizeof(void *));
14247 if (!children) {
14248 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14249 return NULL;
14250 }
14251 ssize_t children_capacity = 1;
14252 ssize_t n = 0;
14253 { // lambda_param_no_default
14254 arg_ty lambda_param_no_default_var;
14255 while (
14256 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
14257 )
14258 {
14259 res = lambda_param_no_default_var;
14260 if (n == children_capacity) {
14261 children_capacity *= 2;
14262 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14263 if (!children) {
14264 PyErr_Format(PyExc_MemoryError, "realloc None");
14265 return NULL;
14266 }
14267 }
14268 children[n++] = res;
14269 mark = p->mark;
14270 }
14271 p->mark = mark;
14272 }
14273 if (n == 0) {
14274 PyMem_Free(children);
14275 return NULL;
14276 }
14277 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14278 if (!seq) {
14279 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_81");
14280 PyMem_Free(children);
14281 return NULL;
14282 }
14283 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14284 PyMem_Free(children);
14285 _PyPegen_insert_memo(p, start_mark, _loop1_81_type, seq);
14286 return seq;
14287}
14288
14289// _loop1_82: lambda_param_no_default
14290static asdl_seq *
14291_loop1_82_rule(Parser *p)
14292{
14293 if (p->error_indicator) {
14294 return NULL;
14295 }
14296 void *res = NULL;
14297 int mark = p->mark;
14298 int start_mark = p->mark;
14299 void **children = PyMem_Malloc(sizeof(void *));
14300 if (!children) {
14301 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14302 return NULL;
14303 }
14304 ssize_t children_capacity = 1;
14305 ssize_t n = 0;
14306 { // lambda_param_no_default
14307 arg_ty lambda_param_no_default_var;
14308 while (
14309 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
14310 )
14311 {
14312 res = lambda_param_no_default_var;
14313 if (n == children_capacity) {
14314 children_capacity *= 2;
14315 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14316 if (!children) {
14317 PyErr_Format(PyExc_MemoryError, "realloc None");
14318 return NULL;
14319 }
14320 }
14321 children[n++] = res;
14322 mark = p->mark;
14323 }
14324 p->mark = mark;
14325 }
14326 if (n == 0) {
14327 PyMem_Free(children);
14328 return NULL;
14329 }
14330 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14331 if (!seq) {
14332 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_82");
14333 PyMem_Free(children);
14334 return NULL;
14335 }
14336 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14337 PyMem_Free(children);
14338 _PyPegen_insert_memo(p, start_mark, _loop1_82_type, seq);
14339 return seq;
14340}
14341
14342// _loop0_83: lambda_param_no_default
14343static asdl_seq *
14344_loop0_83_rule(Parser *p)
14345{
14346 if (p->error_indicator) {
14347 return NULL;
14348 }
14349 void *res = NULL;
14350 int mark = p->mark;
14351 int start_mark = p->mark;
14352 void **children = PyMem_Malloc(sizeof(void *));
14353 if (!children) {
14354 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14355 return NULL;
14356 }
14357 ssize_t children_capacity = 1;
14358 ssize_t n = 0;
14359 { // lambda_param_no_default
14360 arg_ty lambda_param_no_default_var;
14361 while (
14362 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
14363 )
14364 {
14365 res = lambda_param_no_default_var;
14366 if (n == children_capacity) {
14367 children_capacity *= 2;
14368 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14369 if (!children) {
14370 PyErr_Format(PyExc_MemoryError, "realloc None");
14371 return NULL;
14372 }
14373 }
14374 children[n++] = res;
14375 mark = p->mark;
14376 }
14377 p->mark = mark;
14378 }
14379 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14380 if (!seq) {
14381 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_83");
14382 PyMem_Free(children);
14383 return NULL;
14384 }
14385 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14386 PyMem_Free(children);
14387 _PyPegen_insert_memo(p, start_mark, _loop0_83_type, seq);
14388 return seq;
14389}
14390
14391// _loop1_84: lambda_param_with_default
14392static asdl_seq *
14393_loop1_84_rule(Parser *p)
14394{
14395 if (p->error_indicator) {
14396 return NULL;
14397 }
14398 void *res = NULL;
14399 int mark = p->mark;
14400 int start_mark = p->mark;
14401 void **children = PyMem_Malloc(sizeof(void *));
14402 if (!children) {
14403 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14404 return NULL;
14405 }
14406 ssize_t children_capacity = 1;
14407 ssize_t n = 0;
14408 { // lambda_param_with_default
14409 NameDefaultPair* lambda_param_with_default_var;
14410 while (
14411 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
14412 )
14413 {
14414 res = lambda_param_with_default_var;
14415 if (n == children_capacity) {
14416 children_capacity *= 2;
14417 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14418 if (!children) {
14419 PyErr_Format(PyExc_MemoryError, "realloc None");
14420 return NULL;
14421 }
14422 }
14423 children[n++] = res;
14424 mark = p->mark;
14425 }
14426 p->mark = mark;
14427 }
14428 if (n == 0) {
14429 PyMem_Free(children);
14430 return NULL;
14431 }
14432 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14433 if (!seq) {
14434 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_84");
14435 PyMem_Free(children);
14436 return NULL;
14437 }
14438 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14439 PyMem_Free(children);
14440 _PyPegen_insert_memo(p, start_mark, _loop1_84_type, seq);
14441 return seq;
14442}
14443
14444// _loop0_85: lambda_param_no_default
14445static asdl_seq *
14446_loop0_85_rule(Parser *p)
14447{
14448 if (p->error_indicator) {
14449 return NULL;
14450 }
14451 void *res = NULL;
14452 int mark = p->mark;
14453 int start_mark = p->mark;
14454 void **children = PyMem_Malloc(sizeof(void *));
14455 if (!children) {
14456 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14457 return NULL;
14458 }
14459 ssize_t children_capacity = 1;
14460 ssize_t n = 0;
14461 { // lambda_param_no_default
14462 arg_ty lambda_param_no_default_var;
14463 while (
14464 (lambda_param_no_default_var = lambda_param_no_default_rule(p))
14465 )
14466 {
14467 res = lambda_param_no_default_var;
14468 if (n == children_capacity) {
14469 children_capacity *= 2;
14470 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14471 if (!children) {
14472 PyErr_Format(PyExc_MemoryError, "realloc None");
14473 return NULL;
14474 }
14475 }
14476 children[n++] = res;
14477 mark = p->mark;
14478 }
14479 p->mark = mark;
14480 }
14481 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14482 if (!seq) {
14483 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_85");
14484 PyMem_Free(children);
14485 return NULL;
14486 }
14487 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14488 PyMem_Free(children);
14489 _PyPegen_insert_memo(p, start_mark, _loop0_85_type, seq);
14490 return seq;
14491}
14492
14493// _loop1_86: lambda_param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014494static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014495_loop1_86_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014496{
14497 if (p->error_indicator) {
14498 return NULL;
14499 }
14500 void *res = NULL;
14501 int mark = p->mark;
14502 int start_mark = p->mark;
14503 void **children = PyMem_Malloc(sizeof(void *));
14504 if (!children) {
14505 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14506 return NULL;
14507 }
14508 ssize_t children_capacity = 1;
14509 ssize_t n = 0;
Guido van Rossum3941d972020-05-01 09:42:03 -070014510 { // lambda_param_with_default
14511 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014512 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070014513 (lambda_param_with_default_var = lambda_param_with_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014514 )
14515 {
Guido van Rossum3941d972020-05-01 09:42:03 -070014516 res = lambda_param_with_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014517 if (n == children_capacity) {
14518 children_capacity *= 2;
14519 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14520 if (!children) {
14521 PyErr_Format(PyExc_MemoryError, "realloc None");
14522 return NULL;
14523 }
14524 }
14525 children[n++] = res;
14526 mark = p->mark;
14527 }
14528 p->mark = mark;
14529 }
14530 if (n == 0) {
14531 PyMem_Free(children);
14532 return NULL;
14533 }
14534 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14535 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014536 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_86");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014537 PyMem_Free(children);
14538 return NULL;
14539 }
14540 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14541 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030014542 _PyPegen_insert_memo(p, start_mark, _loop1_86_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014543 return seq;
14544}
14545
Guido van Rossum3941d972020-05-01 09:42:03 -070014546// _loop0_87: lambda_param_maybe_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014547static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014548_loop0_87_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014549{
14550 if (p->error_indicator) {
14551 return NULL;
14552 }
14553 void *res = NULL;
14554 int mark = p->mark;
14555 int start_mark = p->mark;
14556 void **children = PyMem_Malloc(sizeof(void *));
14557 if (!children) {
14558 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14559 return NULL;
14560 }
14561 ssize_t children_capacity = 1;
14562 ssize_t n = 0;
Guido van Rossum3941d972020-05-01 09:42:03 -070014563 { // lambda_param_maybe_default
14564 NameDefaultPair* lambda_param_maybe_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014565 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070014566 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014567 )
14568 {
Guido van Rossum3941d972020-05-01 09:42:03 -070014569 res = lambda_param_maybe_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014570 if (n == children_capacity) {
14571 children_capacity *= 2;
14572 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14573 if (!children) {
14574 PyErr_Format(PyExc_MemoryError, "realloc None");
14575 return NULL;
14576 }
14577 }
14578 children[n++] = res;
14579 mark = p->mark;
14580 }
14581 p->mark = mark;
14582 }
14583 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14584 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014585 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_87");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014586 PyMem_Free(children);
14587 return NULL;
14588 }
14589 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14590 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014591 _PyPegen_insert_memo(p, start_mark, _loop0_87_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014592 return seq;
14593}
14594
Guido van Rossum3941d972020-05-01 09:42:03 -070014595// _loop1_88: lambda_param_maybe_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014596static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014597_loop1_88_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014598{
14599 if (p->error_indicator) {
14600 return NULL;
14601 }
14602 void *res = NULL;
14603 int mark = p->mark;
14604 int start_mark = p->mark;
14605 void **children = PyMem_Malloc(sizeof(void *));
14606 if (!children) {
14607 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14608 return NULL;
14609 }
14610 ssize_t children_capacity = 1;
14611 ssize_t n = 0;
Guido van Rossum3941d972020-05-01 09:42:03 -070014612 { // lambda_param_maybe_default
14613 NameDefaultPair* lambda_param_maybe_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014614 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070014615 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014616 )
14617 {
Guido van Rossum3941d972020-05-01 09:42:03 -070014618 res = lambda_param_maybe_default_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014619 if (n == children_capacity) {
14620 children_capacity *= 2;
14621 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14622 if (!children) {
14623 PyErr_Format(PyExc_MemoryError, "realloc None");
14624 return NULL;
14625 }
14626 }
14627 children[n++] = res;
14628 mark = p->mark;
14629 }
14630 p->mark = mark;
14631 }
Guido van Rossum3941d972020-05-01 09:42:03 -070014632 if (n == 0) {
14633 PyMem_Free(children);
14634 return NULL;
14635 }
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014636 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14637 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014638 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_88");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014639 PyMem_Free(children);
14640 return NULL;
14641 }
14642 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14643 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014644 _PyPegen_insert_memo(p, start_mark, _loop1_88_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014645 return seq;
14646}
14647
Guido van Rossum3941d972020-05-01 09:42:03 -070014648// _loop1_89: ('or' conjunction)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014649static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014650_loop1_89_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014651{
14652 if (p->error_indicator) {
14653 return NULL;
14654 }
14655 void *res = NULL;
14656 int mark = p->mark;
14657 int start_mark = p->mark;
14658 void **children = PyMem_Malloc(sizeof(void *));
14659 if (!children) {
14660 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14661 return NULL;
14662 }
14663 ssize_t children_capacity = 1;
14664 ssize_t n = 0;
14665 { // ('or' conjunction)
Guido van Rossum3941d972020-05-01 09:42:03 -070014666 void *_tmp_138_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014667 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070014668 (_tmp_138_var = _tmp_138_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014669 )
14670 {
Guido van Rossum3941d972020-05-01 09:42:03 -070014671 res = _tmp_138_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014672 if (n == children_capacity) {
14673 children_capacity *= 2;
14674 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14675 if (!children) {
14676 PyErr_Format(PyExc_MemoryError, "realloc None");
14677 return NULL;
14678 }
14679 }
14680 children[n++] = res;
14681 mark = p->mark;
14682 }
14683 p->mark = mark;
14684 }
14685 if (n == 0) {
14686 PyMem_Free(children);
14687 return NULL;
14688 }
14689 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14690 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014691 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_89");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014692 PyMem_Free(children);
14693 return NULL;
14694 }
14695 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14696 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014697 _PyPegen_insert_memo(p, start_mark, _loop1_89_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014698 return seq;
14699}
14700
Guido van Rossum3941d972020-05-01 09:42:03 -070014701// _loop1_90: ('and' inversion)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014702static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014703_loop1_90_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014704{
14705 if (p->error_indicator) {
14706 return NULL;
14707 }
14708 void *res = NULL;
14709 int mark = p->mark;
14710 int start_mark = p->mark;
14711 void **children = PyMem_Malloc(sizeof(void *));
14712 if (!children) {
14713 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14714 return NULL;
14715 }
14716 ssize_t children_capacity = 1;
14717 ssize_t n = 0;
14718 { // ('and' inversion)
Guido van Rossum3941d972020-05-01 09:42:03 -070014719 void *_tmp_139_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014720 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070014721 (_tmp_139_var = _tmp_139_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014722 )
14723 {
Guido van Rossum3941d972020-05-01 09:42:03 -070014724 res = _tmp_139_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014725 if (n == children_capacity) {
14726 children_capacity *= 2;
14727 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14728 if (!children) {
14729 PyErr_Format(PyExc_MemoryError, "realloc None");
14730 return NULL;
14731 }
14732 }
14733 children[n++] = res;
14734 mark = p->mark;
14735 }
14736 p->mark = mark;
14737 }
14738 if (n == 0) {
14739 PyMem_Free(children);
14740 return NULL;
14741 }
14742 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14743 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014744 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_90");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014745 PyMem_Free(children);
14746 return NULL;
14747 }
14748 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14749 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014750 _PyPegen_insert_memo(p, start_mark, _loop1_90_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014751 return seq;
14752}
14753
Guido van Rossum3941d972020-05-01 09:42:03 -070014754// _loop1_91: compare_op_bitwise_or_pair
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014755static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014756_loop1_91_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014757{
14758 if (p->error_indicator) {
14759 return NULL;
14760 }
14761 void *res = NULL;
14762 int mark = p->mark;
14763 int start_mark = p->mark;
14764 void **children = PyMem_Malloc(sizeof(void *));
14765 if (!children) {
14766 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14767 return NULL;
14768 }
14769 ssize_t children_capacity = 1;
14770 ssize_t n = 0;
14771 { // compare_op_bitwise_or_pair
14772 CmpopExprPair* compare_op_bitwise_or_pair_var;
14773 while (
14774 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p))
14775 )
14776 {
14777 res = compare_op_bitwise_or_pair_var;
14778 if (n == children_capacity) {
14779 children_capacity *= 2;
14780 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14781 if (!children) {
14782 PyErr_Format(PyExc_MemoryError, "realloc None");
14783 return NULL;
14784 }
14785 }
14786 children[n++] = res;
14787 mark = p->mark;
14788 }
14789 p->mark = mark;
14790 }
14791 if (n == 0) {
14792 PyMem_Free(children);
14793 return NULL;
14794 }
14795 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14796 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014797 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_91");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014798 PyMem_Free(children);
14799 return NULL;
14800 }
14801 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14802 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014803 _PyPegen_insert_memo(p, start_mark, _loop1_91_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014804 return seq;
14805}
14806
Guido van Rossum3941d972020-05-01 09:42:03 -070014807// _tmp_92: '!='
Pablo Galindo2b74c832020-04-27 18:02:07 +010014808static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070014809_tmp_92_rule(Parser *p)
Pablo Galindo2b74c832020-04-27 18:02:07 +010014810{
14811 if (p->error_indicator) {
14812 return NULL;
14813 }
14814 void * res = NULL;
14815 int mark = p->mark;
14816 { // '!='
Pablo Galindob796b3f2020-05-01 12:32:26 +010014817 Token * tok;
Pablo Galindo2b74c832020-04-27 18:02:07 +010014818 if (
14819 (tok = _PyPegen_expect_token(p, 28))
14820 )
14821 {
14822 res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok;
14823 if (res == NULL && PyErr_Occurred()) {
14824 p->error_indicator = 1;
14825 return NULL;
14826 }
14827 goto done;
14828 }
14829 p->mark = mark;
14830 }
14831 res = NULL;
14832 done:
14833 return res;
14834}
14835
Guido van Rossum3941d972020-05-01 09:42:03 -070014836// _loop0_94: ',' slice
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014837static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014838_loop0_94_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014839{
14840 if (p->error_indicator) {
14841 return NULL;
14842 }
14843 void *res = NULL;
14844 int mark = p->mark;
14845 int start_mark = p->mark;
14846 void **children = PyMem_Malloc(sizeof(void *));
14847 if (!children) {
14848 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
14849 return NULL;
14850 }
14851 ssize_t children_capacity = 1;
14852 ssize_t n = 0;
14853 { // ',' slice
14854 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010014855 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014856 while (
14857 (literal = _PyPegen_expect_token(p, 12))
14858 &&
14859 (elem = slice_rule(p))
14860 )
14861 {
14862 res = elem;
14863 if (res == NULL && PyErr_Occurred()) {
14864 p->error_indicator = 1;
14865 PyMem_Free(children);
14866 return NULL;
14867 }
14868 if (n == children_capacity) {
14869 children_capacity *= 2;
14870 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
14871 if (!children) {
14872 PyErr_Format(PyExc_MemoryError, "realloc None");
14873 return NULL;
14874 }
14875 }
14876 children[n++] = res;
14877 mark = p->mark;
14878 }
14879 p->mark = mark;
14880 }
14881 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
14882 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070014883 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_94");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014884 PyMem_Free(children);
14885 return NULL;
14886 }
14887 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
14888 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070014889 _PyPegen_insert_memo(p, start_mark, _loop0_94_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014890 return seq;
14891}
14892
Guido van Rossum3941d972020-05-01 09:42:03 -070014893// _gather_93: slice _loop0_94
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014894static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070014895_gather_93_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014896{
14897 if (p->error_indicator) {
14898 return NULL;
14899 }
14900 asdl_seq * res = NULL;
14901 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070014902 { // slice _loop0_94
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014903 expr_ty elem;
14904 asdl_seq * seq;
14905 if (
14906 (elem = slice_rule(p))
14907 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070014908 (seq = _loop0_94_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014909 )
14910 {
14911 res = _PyPegen_seq_insert_in_front(p, elem, seq);
14912 goto done;
14913 }
14914 p->mark = mark;
14915 }
14916 res = NULL;
14917 done:
14918 return res;
14919}
14920
Guido van Rossum3941d972020-05-01 09:42:03 -070014921// _tmp_95: ':' expression?
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014922static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070014923_tmp_95_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014924{
14925 if (p->error_indicator) {
14926 return NULL;
14927 }
14928 void * res = NULL;
14929 int mark = p->mark;
14930 { // ':' expression?
14931 void *d;
Pablo Galindob796b3f2020-05-01 12:32:26 +010014932 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014933 if (
14934 (literal = _PyPegen_expect_token(p, 11))
14935 &&
14936 (d = expression_rule(p), 1)
14937 )
14938 {
14939 res = d;
14940 if (res == NULL && PyErr_Occurred()) {
14941 p->error_indicator = 1;
14942 return NULL;
14943 }
14944 goto done;
14945 }
14946 p->mark = mark;
14947 }
14948 res = NULL;
14949 done:
14950 return res;
14951}
14952
Guido van Rossum3941d972020-05-01 09:42:03 -070014953// _tmp_96: tuple | group | genexp
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014954static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070014955_tmp_96_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010014956{
14957 if (p->error_indicator) {
14958 return NULL;
14959 }
14960 void * res = NULL;
14961 int mark = p->mark;
14962 { // tuple
14963 expr_ty tuple_var;
14964 if (
14965 (tuple_var = tuple_rule(p))
14966 )
14967 {
14968 res = tuple_var;
14969 goto done;
14970 }
14971 p->mark = mark;
14972 }
14973 { // group
14974 expr_ty group_var;
14975 if (
14976 (group_var = group_rule(p))
14977 )
14978 {
14979 res = group_var;
14980 goto done;
14981 }
14982 p->mark = mark;
14983 }
14984 { // genexp
14985 expr_ty genexp_var;
14986 if (
14987 (genexp_var = genexp_rule(p))
14988 )
14989 {
14990 res = genexp_var;
14991 goto done;
14992 }
14993 p->mark = mark;
14994 }
14995 res = NULL;
14996 done:
14997 return res;
14998}
14999
Guido van Rossum3941d972020-05-01 09:42:03 -070015000// _tmp_97: list | listcomp
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015001static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015002_tmp_97_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015003{
15004 if (p->error_indicator) {
15005 return NULL;
15006 }
15007 void * res = NULL;
15008 int mark = p->mark;
15009 { // list
15010 expr_ty list_var;
15011 if (
15012 (list_var = list_rule(p))
15013 )
15014 {
15015 res = list_var;
15016 goto done;
15017 }
15018 p->mark = mark;
15019 }
15020 { // listcomp
15021 expr_ty listcomp_var;
15022 if (
15023 (listcomp_var = listcomp_rule(p))
15024 )
15025 {
15026 res = listcomp_var;
15027 goto done;
15028 }
15029 p->mark = mark;
15030 }
15031 res = NULL;
15032 done:
15033 return res;
15034}
15035
Guido van Rossum3941d972020-05-01 09:42:03 -070015036// _tmp_98: dict | set | dictcomp | setcomp
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015037static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015038_tmp_98_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015039{
15040 if (p->error_indicator) {
15041 return NULL;
15042 }
15043 void * res = NULL;
15044 int mark = p->mark;
15045 { // dict
15046 expr_ty dict_var;
15047 if (
15048 (dict_var = dict_rule(p))
15049 )
15050 {
15051 res = dict_var;
15052 goto done;
15053 }
15054 p->mark = mark;
15055 }
15056 { // set
15057 expr_ty set_var;
15058 if (
15059 (set_var = set_rule(p))
15060 )
15061 {
15062 res = set_var;
15063 goto done;
15064 }
15065 p->mark = mark;
15066 }
15067 { // dictcomp
15068 expr_ty dictcomp_var;
15069 if (
15070 (dictcomp_var = dictcomp_rule(p))
15071 )
15072 {
15073 res = dictcomp_var;
15074 goto done;
15075 }
15076 p->mark = mark;
15077 }
15078 { // setcomp
15079 expr_ty setcomp_var;
15080 if (
15081 (setcomp_var = setcomp_rule(p))
15082 )
15083 {
15084 res = setcomp_var;
15085 goto done;
15086 }
15087 p->mark = mark;
15088 }
15089 res = NULL;
15090 done:
15091 return res;
15092}
15093
Guido van Rossum3941d972020-05-01 09:42:03 -070015094// _loop1_99: STRING
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015095static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015096_loop1_99_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015097{
15098 if (p->error_indicator) {
15099 return NULL;
15100 }
15101 void *res = NULL;
15102 int mark = p->mark;
15103 int start_mark = p->mark;
15104 void **children = PyMem_Malloc(sizeof(void *));
15105 if (!children) {
15106 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15107 return NULL;
15108 }
15109 ssize_t children_capacity = 1;
15110 ssize_t n = 0;
15111 { // STRING
15112 expr_ty string_var;
15113 while (
15114 (string_var = _PyPegen_string_token(p))
15115 )
15116 {
15117 res = string_var;
15118 if (n == children_capacity) {
15119 children_capacity *= 2;
15120 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15121 if (!children) {
15122 PyErr_Format(PyExc_MemoryError, "realloc None");
15123 return NULL;
15124 }
15125 }
15126 children[n++] = res;
15127 mark = p->mark;
15128 }
15129 p->mark = mark;
15130 }
15131 if (n == 0) {
15132 PyMem_Free(children);
15133 return NULL;
15134 }
15135 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15136 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015137 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_99");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015138 PyMem_Free(children);
15139 return NULL;
15140 }
15141 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15142 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015143 _PyPegen_insert_memo(p, start_mark, _loop1_99_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015144 return seq;
15145}
15146
Guido van Rossum3941d972020-05-01 09:42:03 -070015147// _tmp_100: star_named_expression ',' star_named_expressions?
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015148static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015149_tmp_100_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015150{
15151 if (p->error_indicator) {
15152 return NULL;
15153 }
15154 void * res = NULL;
15155 int mark = p->mark;
15156 { // star_named_expression ',' star_named_expressions?
Pablo Galindob796b3f2020-05-01 12:32:26 +010015157 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015158 expr_ty y;
15159 void *z;
15160 if (
15161 (y = star_named_expression_rule(p))
15162 &&
15163 (literal = _PyPegen_expect_token(p, 12))
15164 &&
15165 (z = star_named_expressions_rule(p), 1)
15166 )
15167 {
15168 res = _PyPegen_seq_insert_in_front ( p , y , z );
15169 if (res == NULL && PyErr_Occurred()) {
15170 p->error_indicator = 1;
15171 return NULL;
15172 }
15173 goto done;
15174 }
15175 p->mark = mark;
15176 }
15177 res = NULL;
15178 done:
15179 return res;
15180}
15181
Guido van Rossum3941d972020-05-01 09:42:03 -070015182// _tmp_101: yield_expr | named_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015183static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015184_tmp_101_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015185{
15186 if (p->error_indicator) {
15187 return NULL;
15188 }
15189 void * res = NULL;
15190 int mark = p->mark;
15191 { // yield_expr
15192 expr_ty yield_expr_var;
15193 if (
15194 (yield_expr_var = yield_expr_rule(p))
15195 )
15196 {
15197 res = yield_expr_var;
15198 goto done;
15199 }
15200 p->mark = mark;
15201 }
15202 { // named_expression
15203 expr_ty named_expression_var;
15204 if (
15205 (named_expression_var = named_expression_rule(p))
15206 )
15207 {
15208 res = named_expression_var;
15209 goto done;
15210 }
15211 p->mark = mark;
15212 }
15213 res = NULL;
15214 done:
15215 return res;
15216}
15217
Guido van Rossum3941d972020-05-01 09:42:03 -070015218// _loop0_103: ',' kvpair
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015219static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015220_loop0_103_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015221{
15222 if (p->error_indicator) {
15223 return NULL;
15224 }
15225 void *res = NULL;
15226 int mark = p->mark;
15227 int start_mark = p->mark;
15228 void **children = PyMem_Malloc(sizeof(void *));
15229 if (!children) {
15230 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15231 return NULL;
15232 }
15233 ssize_t children_capacity = 1;
15234 ssize_t n = 0;
15235 { // ',' kvpair
15236 KeyValuePair* elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015237 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015238 while (
15239 (literal = _PyPegen_expect_token(p, 12))
15240 &&
15241 (elem = kvpair_rule(p))
15242 )
15243 {
15244 res = elem;
15245 if (res == NULL && PyErr_Occurred()) {
15246 p->error_indicator = 1;
15247 PyMem_Free(children);
15248 return NULL;
15249 }
15250 if (n == children_capacity) {
15251 children_capacity *= 2;
15252 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15253 if (!children) {
15254 PyErr_Format(PyExc_MemoryError, "realloc None");
15255 return NULL;
15256 }
15257 }
15258 children[n++] = res;
15259 mark = p->mark;
15260 }
15261 p->mark = mark;
15262 }
15263 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15264 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015265 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_103");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015266 PyMem_Free(children);
15267 return NULL;
15268 }
15269 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15270 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015271 _PyPegen_insert_memo(p, start_mark, _loop0_103_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015272 return seq;
15273}
15274
Guido van Rossum3941d972020-05-01 09:42:03 -070015275// _gather_102: kvpair _loop0_103
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015276static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015277_gather_102_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015278{
15279 if (p->error_indicator) {
15280 return NULL;
15281 }
15282 asdl_seq * res = NULL;
15283 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070015284 { // kvpair _loop0_103
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015285 KeyValuePair* elem;
15286 asdl_seq * seq;
15287 if (
15288 (elem = kvpair_rule(p))
15289 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070015290 (seq = _loop0_103_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015291 )
15292 {
15293 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15294 goto done;
15295 }
15296 p->mark = mark;
15297 }
15298 res = NULL;
15299 done:
15300 return res;
15301}
15302
Guido van Rossum3941d972020-05-01 09:42:03 -070015303// _loop1_104: for_if_clause
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015304static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015305_loop1_104_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015306{
15307 if (p->error_indicator) {
15308 return NULL;
15309 }
15310 void *res = NULL;
15311 int mark = p->mark;
15312 int start_mark = p->mark;
15313 void **children = PyMem_Malloc(sizeof(void *));
15314 if (!children) {
15315 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15316 return NULL;
15317 }
15318 ssize_t children_capacity = 1;
15319 ssize_t n = 0;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015320 { // for_if_clause
15321 comprehension_ty for_if_clause_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015322 while (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015323 (for_if_clause_var = for_if_clause_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015324 )
15325 {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015326 res = for_if_clause_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015327 if (n == children_capacity) {
15328 children_capacity *= 2;
15329 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15330 if (!children) {
15331 PyErr_Format(PyExc_MemoryError, "realloc None");
15332 return NULL;
15333 }
15334 }
15335 children[n++] = res;
15336 mark = p->mark;
15337 }
15338 p->mark = mark;
15339 }
15340 if (n == 0) {
15341 PyMem_Free(children);
15342 return NULL;
15343 }
15344 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15345 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015346 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_104");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015347 PyMem_Free(children);
15348 return NULL;
15349 }
15350 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15351 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015352 _PyPegen_insert_memo(p, start_mark, _loop1_104_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015353 return seq;
15354}
15355
Guido van Rossum3941d972020-05-01 09:42:03 -070015356// _loop0_105: ('if' disjunction)
Pablo Galindo2b74c832020-04-27 18:02:07 +010015357static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015358_loop0_105_rule(Parser *p)
Pablo Galindo2b74c832020-04-27 18:02:07 +010015359{
15360 if (p->error_indicator) {
15361 return NULL;
15362 }
15363 void *res = NULL;
15364 int mark = p->mark;
15365 int start_mark = p->mark;
15366 void **children = PyMem_Malloc(sizeof(void *));
15367 if (!children) {
15368 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15369 return NULL;
15370 }
15371 ssize_t children_capacity = 1;
15372 ssize_t n = 0;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015373 { // ('if' disjunction)
Guido van Rossum3941d972020-05-01 09:42:03 -070015374 void *_tmp_140_var;
Pablo Galindo2b74c832020-04-27 18:02:07 +010015375 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070015376 (_tmp_140_var = _tmp_140_rule(p))
Pablo Galindo2b74c832020-04-27 18:02:07 +010015377 )
15378 {
Guido van Rossum3941d972020-05-01 09:42:03 -070015379 res = _tmp_140_var;
Pablo Galindo2b74c832020-04-27 18:02:07 +010015380 if (n == children_capacity) {
15381 children_capacity *= 2;
15382 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15383 if (!children) {
15384 PyErr_Format(PyExc_MemoryError, "realloc None");
15385 return NULL;
15386 }
15387 }
15388 children[n++] = res;
15389 mark = p->mark;
15390 }
15391 p->mark = mark;
15392 }
15393 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15394 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015395 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_105");
Pablo Galindo2b74c832020-04-27 18:02:07 +010015396 PyMem_Free(children);
15397 return NULL;
15398 }
15399 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15400 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015401 _PyPegen_insert_memo(p, start_mark, _loop0_105_type, seq);
Pablo Galindo2b74c832020-04-27 18:02:07 +010015402 return seq;
15403}
15404
Guido van Rossum3941d972020-05-01 09:42:03 -070015405// _loop0_106: ('if' disjunction)
Guido van Rossumc001c092020-04-30 12:12:19 -070015406static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015407_loop0_106_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070015408{
15409 if (p->error_indicator) {
15410 return NULL;
15411 }
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015412 void *res = NULL;
Guido van Rossumc001c092020-04-30 12:12:19 -070015413 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015414 int start_mark = p->mark;
15415 void **children = PyMem_Malloc(sizeof(void *));
15416 if (!children) {
15417 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15418 return NULL;
15419 }
15420 ssize_t children_capacity = 1;
15421 ssize_t n = 0;
15422 { // ('if' disjunction)
Guido van Rossum3941d972020-05-01 09:42:03 -070015423 void *_tmp_141_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015424 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070015425 (_tmp_141_var = _tmp_141_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070015426 )
15427 {
Guido van Rossum3941d972020-05-01 09:42:03 -070015428 res = _tmp_141_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015429 if (n == children_capacity) {
15430 children_capacity *= 2;
15431 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15432 if (!children) {
15433 PyErr_Format(PyExc_MemoryError, "realloc None");
15434 return NULL;
15435 }
15436 }
15437 children[n++] = res;
15438 mark = p->mark;
15439 }
15440 p->mark = mark;
15441 }
15442 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15443 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015444 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_106");
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015445 PyMem_Free(children);
15446 return NULL;
15447 }
15448 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15449 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015450 _PyPegen_insert_memo(p, start_mark, _loop0_106_type, seq);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015451 return seq;
15452}
15453
Guido van Rossum3941d972020-05-01 09:42:03 -070015454// _tmp_107: ',' args
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015455static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015456_tmp_107_rule(Parser *p)
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015457{
15458 if (p->error_indicator) {
15459 return NULL;
15460 }
15461 void * res = NULL;
15462 int mark = p->mark;
15463 { // ',' args
15464 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015465 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015466 if (
15467 (literal = _PyPegen_expect_token(p, 12))
15468 &&
15469 (c = args_rule(p))
15470 )
15471 {
15472 res = c;
15473 if (res == NULL && PyErr_Occurred()) {
15474 p->error_indicator = 1;
15475 return NULL;
15476 }
Guido van Rossumc001c092020-04-30 12:12:19 -070015477 goto done;
15478 }
15479 p->mark = mark;
15480 }
15481 res = NULL;
15482 done:
15483 return res;
15484}
15485
Guido van Rossum3941d972020-05-01 09:42:03 -070015486// _tmp_108: ',' args
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015487static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015488_tmp_108_rule(Parser *p)
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015489{
15490 if (p->error_indicator) {
15491 return NULL;
15492 }
15493 void * res = NULL;
15494 int mark = p->mark;
15495 { // ',' args
15496 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015497 Token * literal;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015498 if (
15499 (literal = _PyPegen_expect_token(p, 12))
15500 &&
15501 (c = args_rule(p))
15502 )
15503 {
15504 res = c;
15505 if (res == NULL && PyErr_Occurred()) {
15506 p->error_indicator = 1;
15507 return NULL;
15508 }
15509 goto done;
15510 }
15511 p->mark = mark;
15512 }
15513 res = NULL;
15514 done:
15515 return res;
15516}
15517
Guido van Rossum3941d972020-05-01 09:42:03 -070015518// _loop0_110: ',' kwarg_or_starred
15519static asdl_seq *
15520_loop0_110_rule(Parser *p)
15521{
15522 if (p->error_indicator) {
15523 return NULL;
15524 }
15525 void *res = NULL;
15526 int mark = p->mark;
15527 int start_mark = p->mark;
15528 void **children = PyMem_Malloc(sizeof(void *));
15529 if (!children) {
15530 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15531 return NULL;
15532 }
15533 ssize_t children_capacity = 1;
15534 ssize_t n = 0;
15535 { // ',' kwarg_or_starred
15536 KeywordOrStarred* elem;
15537 Token * literal;
15538 while (
15539 (literal = _PyPegen_expect_token(p, 12))
15540 &&
15541 (elem = kwarg_or_starred_rule(p))
15542 )
15543 {
15544 res = elem;
15545 if (res == NULL && PyErr_Occurred()) {
15546 p->error_indicator = 1;
15547 PyMem_Free(children);
15548 return NULL;
15549 }
15550 if (n == children_capacity) {
15551 children_capacity *= 2;
15552 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15553 if (!children) {
15554 PyErr_Format(PyExc_MemoryError, "realloc None");
15555 return NULL;
15556 }
15557 }
15558 children[n++] = res;
15559 mark = p->mark;
15560 }
15561 p->mark = mark;
15562 }
15563 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15564 if (!seq) {
15565 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_110");
15566 PyMem_Free(children);
15567 return NULL;
15568 }
15569 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15570 PyMem_Free(children);
15571 _PyPegen_insert_memo(p, start_mark, _loop0_110_type, seq);
15572 return seq;
15573}
15574
15575// _gather_109: kwarg_or_starred _loop0_110
15576static asdl_seq *
15577_gather_109_rule(Parser *p)
15578{
15579 if (p->error_indicator) {
15580 return NULL;
15581 }
15582 asdl_seq * res = NULL;
15583 int mark = p->mark;
15584 { // kwarg_or_starred _loop0_110
15585 KeywordOrStarred* elem;
15586 asdl_seq * seq;
15587 if (
15588 (elem = kwarg_or_starred_rule(p))
15589 &&
15590 (seq = _loop0_110_rule(p))
15591 )
15592 {
15593 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15594 goto done;
15595 }
15596 p->mark = mark;
15597 }
15598 res = NULL;
15599 done:
15600 return res;
15601}
15602
15603// _loop0_112: ',' kwarg_or_double_starred
15604static asdl_seq *
15605_loop0_112_rule(Parser *p)
15606{
15607 if (p->error_indicator) {
15608 return NULL;
15609 }
15610 void *res = NULL;
15611 int mark = p->mark;
15612 int start_mark = p->mark;
15613 void **children = PyMem_Malloc(sizeof(void *));
15614 if (!children) {
15615 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15616 return NULL;
15617 }
15618 ssize_t children_capacity = 1;
15619 ssize_t n = 0;
15620 { // ',' kwarg_or_double_starred
15621 KeywordOrStarred* elem;
15622 Token * literal;
15623 while (
15624 (literal = _PyPegen_expect_token(p, 12))
15625 &&
15626 (elem = kwarg_or_double_starred_rule(p))
15627 )
15628 {
15629 res = elem;
15630 if (res == NULL && PyErr_Occurred()) {
15631 p->error_indicator = 1;
15632 PyMem_Free(children);
15633 return NULL;
15634 }
15635 if (n == children_capacity) {
15636 children_capacity *= 2;
15637 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15638 if (!children) {
15639 PyErr_Format(PyExc_MemoryError, "realloc None");
15640 return NULL;
15641 }
15642 }
15643 children[n++] = res;
15644 mark = p->mark;
15645 }
15646 p->mark = mark;
15647 }
15648 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15649 if (!seq) {
15650 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_112");
15651 PyMem_Free(children);
15652 return NULL;
15653 }
15654 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15655 PyMem_Free(children);
15656 _PyPegen_insert_memo(p, start_mark, _loop0_112_type, seq);
15657 return seq;
15658}
15659
15660// _gather_111: kwarg_or_double_starred _loop0_112
15661static asdl_seq *
15662_gather_111_rule(Parser *p)
15663{
15664 if (p->error_indicator) {
15665 return NULL;
15666 }
15667 asdl_seq * res = NULL;
15668 int mark = p->mark;
15669 { // kwarg_or_double_starred _loop0_112
15670 KeywordOrStarred* elem;
15671 asdl_seq * seq;
15672 if (
15673 (elem = kwarg_or_double_starred_rule(p))
15674 &&
15675 (seq = _loop0_112_rule(p))
15676 )
15677 {
15678 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15679 goto done;
15680 }
15681 p->mark = mark;
15682 }
15683 res = NULL;
15684 done:
15685 return res;
15686}
15687
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015688// _loop0_114: ',' kwarg_or_starred
Pablo Galindo2b74c832020-04-27 18:02:07 +010015689static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015690_loop0_114_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015691{
15692 if (p->error_indicator) {
15693 return NULL;
15694 }
15695 void *res = NULL;
15696 int mark = p->mark;
15697 int start_mark = p->mark;
15698 void **children = PyMem_Malloc(sizeof(void *));
15699 if (!children) {
15700 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15701 return NULL;
15702 }
15703 ssize_t children_capacity = 1;
15704 ssize_t n = 0;
Guido van Rossumc001c092020-04-30 12:12:19 -070015705 { // ',' kwarg_or_starred
15706 KeywordOrStarred* elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015707 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070015708 while (
15709 (literal = _PyPegen_expect_token(p, 12))
15710 &&
15711 (elem = kwarg_or_starred_rule(p))
15712 )
15713 {
15714 res = elem;
15715 if (res == NULL && PyErr_Occurred()) {
15716 p->error_indicator = 1;
15717 PyMem_Free(children);
15718 return NULL;
15719 }
15720 if (n == children_capacity) {
15721 children_capacity *= 2;
15722 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15723 if (!children) {
15724 PyErr_Format(PyExc_MemoryError, "realloc None");
15725 return NULL;
15726 }
15727 }
15728 children[n++] = res;
15729 mark = p->mark;
15730 }
15731 p->mark = mark;
15732 }
15733 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15734 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015735 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_114");
Guido van Rossumc001c092020-04-30 12:12:19 -070015736 PyMem_Free(children);
15737 return NULL;
15738 }
15739 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15740 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015741 _PyPegen_insert_memo(p, start_mark, _loop0_114_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070015742 return seq;
15743}
15744
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015745// _gather_113: kwarg_or_starred _loop0_114
Guido van Rossumc001c092020-04-30 12:12:19 -070015746static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015747_gather_113_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070015748{
15749 if (p->error_indicator) {
15750 return NULL;
15751 }
15752 asdl_seq * res = NULL;
15753 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015754 { // kwarg_or_starred _loop0_114
Guido van Rossumc001c092020-04-30 12:12:19 -070015755 KeywordOrStarred* elem;
15756 asdl_seq * seq;
15757 if (
15758 (elem = kwarg_or_starred_rule(p))
15759 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015760 (seq = _loop0_114_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070015761 )
15762 {
15763 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15764 goto done;
15765 }
15766 p->mark = mark;
15767 }
15768 res = NULL;
15769 done:
15770 return res;
15771}
15772
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015773// _loop0_116: ',' kwarg_or_double_starred
Guido van Rossumc001c092020-04-30 12:12:19 -070015774static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015775_loop0_116_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070015776{
15777 if (p->error_indicator) {
15778 return NULL;
15779 }
15780 void *res = NULL;
15781 int mark = p->mark;
15782 int start_mark = p->mark;
15783 void **children = PyMem_Malloc(sizeof(void *));
15784 if (!children) {
15785 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15786 return NULL;
15787 }
15788 ssize_t children_capacity = 1;
15789 ssize_t n = 0;
15790 { // ',' kwarg_or_double_starred
15791 KeywordOrStarred* elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015792 Token * literal;
Guido van Rossumc001c092020-04-30 12:12:19 -070015793 while (
15794 (literal = _PyPegen_expect_token(p, 12))
15795 &&
15796 (elem = kwarg_or_double_starred_rule(p))
15797 )
15798 {
15799 res = elem;
15800 if (res == NULL && PyErr_Occurred()) {
15801 p->error_indicator = 1;
15802 PyMem_Free(children);
15803 return NULL;
15804 }
15805 if (n == children_capacity) {
15806 children_capacity *= 2;
15807 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15808 if (!children) {
15809 PyErr_Format(PyExc_MemoryError, "realloc None");
15810 return NULL;
15811 }
15812 }
15813 children[n++] = res;
15814 mark = p->mark;
15815 }
15816 p->mark = mark;
15817 }
15818 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15819 if (!seq) {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015820 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_116");
Guido van Rossumc001c092020-04-30 12:12:19 -070015821 PyMem_Free(children);
15822 return NULL;
15823 }
15824 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15825 PyMem_Free(children);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015826 _PyPegen_insert_memo(p, start_mark, _loop0_116_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070015827 return seq;
15828}
15829
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015830// _gather_115: kwarg_or_double_starred _loop0_116
Guido van Rossumc001c092020-04-30 12:12:19 -070015831static asdl_seq *
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015832_gather_115_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070015833{
15834 if (p->error_indicator) {
15835 return NULL;
15836 }
15837 asdl_seq * res = NULL;
15838 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015839 { // kwarg_or_double_starred _loop0_116
Guido van Rossumc001c092020-04-30 12:12:19 -070015840 KeywordOrStarred* elem;
15841 asdl_seq * seq;
15842 if (
15843 (elem = kwarg_or_double_starred_rule(p))
15844 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015845 (seq = _loop0_116_rule(p))
Guido van Rossumc001c092020-04-30 12:12:19 -070015846 )
15847 {
15848 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15849 goto done;
15850 }
15851 p->mark = mark;
15852 }
15853 res = NULL;
15854 done:
15855 return res;
15856}
15857
Guido van Rossum3941d972020-05-01 09:42:03 -070015858// _loop0_117: (',' star_target)
Guido van Rossumc001c092020-04-30 12:12:19 -070015859static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015860_loop0_117_rule(Parser *p)
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015861{
15862 if (p->error_indicator) {
15863 return NULL;
15864 }
15865 void *res = NULL;
15866 int mark = p->mark;
15867 int start_mark = p->mark;
15868 void **children = PyMem_Malloc(sizeof(void *));
15869 if (!children) {
15870 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15871 return NULL;
15872 }
15873 ssize_t children_capacity = 1;
15874 ssize_t n = 0;
15875 { // (',' star_target)
Guido van Rossum3941d972020-05-01 09:42:03 -070015876 void *_tmp_142_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015877 while (
Guido van Rossum3941d972020-05-01 09:42:03 -070015878 (_tmp_142_var = _tmp_142_rule(p))
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015879 )
15880 {
Guido van Rossum3941d972020-05-01 09:42:03 -070015881 res = _tmp_142_var;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015882 if (n == children_capacity) {
15883 children_capacity *= 2;
15884 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15885 if (!children) {
15886 PyErr_Format(PyExc_MemoryError, "realloc None");
15887 return NULL;
15888 }
15889 }
15890 children[n++] = res;
15891 mark = p->mark;
15892 }
15893 p->mark = mark;
15894 }
15895 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15896 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015897 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_117");
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015898 PyMem_Free(children);
15899 return NULL;
15900 }
15901 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15902 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015903 _PyPegen_insert_memo(p, start_mark, _loop0_117_type, seq);
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015904 return seq;
15905}
15906
Guido van Rossum3941d972020-05-01 09:42:03 -070015907// _loop0_119: ',' star_target
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030015908static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015909_loop0_119_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070015910{
15911 if (p->error_indicator) {
15912 return NULL;
15913 }
15914 void *res = NULL;
15915 int mark = p->mark;
15916 int start_mark = p->mark;
15917 void **children = PyMem_Malloc(sizeof(void *));
15918 if (!children) {
15919 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
15920 return NULL;
15921 }
15922 ssize_t children_capacity = 1;
15923 ssize_t n = 0;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015924 { // ',' star_target
15925 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010015926 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015927 while (
15928 (literal = _PyPegen_expect_token(p, 12))
15929 &&
15930 (elem = star_target_rule(p))
15931 )
15932 {
15933 res = elem;
15934 if (res == NULL && PyErr_Occurred()) {
15935 p->error_indicator = 1;
15936 PyMem_Free(children);
15937 return NULL;
15938 }
15939 if (n == children_capacity) {
15940 children_capacity *= 2;
15941 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
15942 if (!children) {
15943 PyErr_Format(PyExc_MemoryError, "realloc None");
15944 return NULL;
15945 }
15946 }
15947 children[n++] = res;
15948 mark = p->mark;
15949 }
15950 p->mark = mark;
15951 }
15952 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
15953 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070015954 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_119");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015955 PyMem_Free(children);
15956 return NULL;
15957 }
15958 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
15959 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070015960 _PyPegen_insert_memo(p, start_mark, _loop0_119_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015961 return seq;
15962}
15963
Guido van Rossum3941d972020-05-01 09:42:03 -070015964// _gather_118: star_target _loop0_119
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015965static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070015966_gather_118_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015967{
15968 if (p->error_indicator) {
15969 return NULL;
15970 }
15971 asdl_seq * res = NULL;
15972 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070015973 { // star_target _loop0_119
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015974 expr_ty elem;
15975 asdl_seq * seq;
15976 if (
15977 (elem = star_target_rule(p))
15978 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070015979 (seq = _loop0_119_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015980 )
15981 {
15982 res = _PyPegen_seq_insert_in_front(p, elem, seq);
15983 goto done;
15984 }
15985 p->mark = mark;
15986 }
15987 res = NULL;
15988 done:
15989 return res;
15990}
15991
Guido van Rossum3941d972020-05-01 09:42:03 -070015992// _tmp_120: !'*' star_target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015993static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070015994_tmp_120_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010015995{
15996 if (p->error_indicator) {
15997 return NULL;
15998 }
15999 void * res = NULL;
16000 int mark = p->mark;
16001 { // !'*' star_target
16002 expr_ty star_target_var;
16003 if (
16004 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16)
16005 &&
16006 (star_target_var = star_target_rule(p))
16007 )
16008 {
16009 res = star_target_var;
16010 goto done;
16011 }
16012 p->mark = mark;
16013 }
16014 res = NULL;
16015 done:
16016 return res;
16017}
16018
Guido van Rossum3941d972020-05-01 09:42:03 -070016019// _loop0_122: ',' del_target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016020static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016021_loop0_122_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016022{
16023 if (p->error_indicator) {
16024 return NULL;
16025 }
16026 void *res = NULL;
16027 int mark = p->mark;
16028 int start_mark = p->mark;
16029 void **children = PyMem_Malloc(sizeof(void *));
16030 if (!children) {
16031 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
16032 return NULL;
16033 }
16034 ssize_t children_capacity = 1;
16035 ssize_t n = 0;
16036 { // ',' del_target
16037 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016038 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016039 while (
16040 (literal = _PyPegen_expect_token(p, 12))
16041 &&
16042 (elem = del_target_rule(p))
16043 )
16044 {
16045 res = elem;
16046 if (res == NULL && PyErr_Occurred()) {
16047 p->error_indicator = 1;
16048 PyMem_Free(children);
16049 return NULL;
16050 }
16051 if (n == children_capacity) {
16052 children_capacity *= 2;
16053 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
16054 if (!children) {
16055 PyErr_Format(PyExc_MemoryError, "realloc None");
16056 return NULL;
16057 }
16058 }
16059 children[n++] = res;
16060 mark = p->mark;
16061 }
16062 p->mark = mark;
16063 }
16064 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
16065 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070016066 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_122");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016067 PyMem_Free(children);
16068 return NULL;
16069 }
16070 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
16071 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070016072 _PyPegen_insert_memo(p, start_mark, _loop0_122_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016073 return seq;
16074}
16075
Guido van Rossum3941d972020-05-01 09:42:03 -070016076// _gather_121: del_target _loop0_122
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016077static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016078_gather_121_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016079{
16080 if (p->error_indicator) {
16081 return NULL;
16082 }
16083 asdl_seq * res = NULL;
16084 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070016085 { // del_target _loop0_122
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016086 expr_ty elem;
16087 asdl_seq * seq;
16088 if (
16089 (elem = del_target_rule(p))
16090 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070016091 (seq = _loop0_122_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016092 )
16093 {
16094 res = _PyPegen_seq_insert_in_front(p, elem, seq);
16095 goto done;
16096 }
16097 p->mark = mark;
16098 }
16099 res = NULL;
16100 done:
16101 return res;
16102}
16103
Guido van Rossum3941d972020-05-01 09:42:03 -070016104// _loop0_124: ',' target
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016105static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016106_loop0_124_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016107{
16108 if (p->error_indicator) {
16109 return NULL;
16110 }
16111 void *res = NULL;
16112 int mark = p->mark;
16113 int start_mark = p->mark;
16114 void **children = PyMem_Malloc(sizeof(void *));
16115 if (!children) {
16116 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
16117 return NULL;
16118 }
16119 ssize_t children_capacity = 1;
16120 ssize_t n = 0;
16121 { // ',' target
16122 expr_ty elem;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016123 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016124 while (
16125 (literal = _PyPegen_expect_token(p, 12))
16126 &&
16127 (elem = target_rule(p))
16128 )
16129 {
16130 res = elem;
16131 if (res == NULL && PyErr_Occurred()) {
16132 p->error_indicator = 1;
16133 PyMem_Free(children);
16134 return NULL;
16135 }
16136 if (n == children_capacity) {
16137 children_capacity *= 2;
16138 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
16139 if (!children) {
16140 PyErr_Format(PyExc_MemoryError, "realloc None");
16141 return NULL;
16142 }
16143 }
16144 children[n++] = res;
16145 mark = p->mark;
16146 }
16147 p->mark = mark;
16148 }
16149 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
16150 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070016151 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_124");
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016152 PyMem_Free(children);
16153 return NULL;
16154 }
16155 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
16156 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070016157 _PyPegen_insert_memo(p, start_mark, _loop0_124_type, seq);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016158 return seq;
16159}
16160
Guido van Rossum3941d972020-05-01 09:42:03 -070016161// _gather_123: target _loop0_124
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016162static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016163_gather_123_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016164{
16165 if (p->error_indicator) {
16166 return NULL;
16167 }
16168 asdl_seq * res = NULL;
16169 int mark = p->mark;
Guido van Rossum3941d972020-05-01 09:42:03 -070016170 { // target _loop0_124
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016171 expr_ty elem;
16172 asdl_seq * seq;
16173 if (
16174 (elem = target_rule(p))
16175 &&
Guido van Rossum3941d972020-05-01 09:42:03 -070016176 (seq = _loop0_124_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016177 )
16178 {
16179 res = _PyPegen_seq_insert_in_front(p, elem, seq);
16180 goto done;
16181 }
16182 p->mark = mark;
16183 }
16184 res = NULL;
16185 done:
16186 return res;
16187}
16188
Guido van Rossum3941d972020-05-01 09:42:03 -070016189// _tmp_125: args | expression for_if_clauses
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016190static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016191_tmp_125_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016192{
16193 if (p->error_indicator) {
16194 return NULL;
16195 }
16196 void * res = NULL;
16197 int mark = p->mark;
16198 { // args
16199 expr_ty args_var;
16200 if (
16201 (args_var = args_rule(p))
16202 )
16203 {
16204 res = args_var;
16205 goto done;
16206 }
16207 p->mark = mark;
16208 }
16209 { // expression for_if_clauses
16210 expr_ty expression_var;
16211 asdl_seq* for_if_clauses_var;
16212 if (
16213 (expression_var = expression_rule(p))
16214 &&
16215 (for_if_clauses_var = for_if_clauses_rule(p))
16216 )
16217 {
16218 res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
16219 goto done;
16220 }
16221 p->mark = mark;
16222 }
16223 res = NULL;
16224 done:
16225 return res;
16226}
16227
Guido van Rossum3941d972020-05-01 09:42:03 -070016228// _tmp_126: '=' annotated_rhs
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016229static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016230_tmp_126_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016231{
16232 if (p->error_indicator) {
16233 return NULL;
16234 }
16235 void * res = NULL;
16236 int mark = p->mark;
16237 { // '=' annotated_rhs
16238 expr_ty annotated_rhs_var;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016239 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016240 if (
16241 (literal = _PyPegen_expect_token(p, 22))
16242 &&
16243 (annotated_rhs_var = annotated_rhs_rule(p))
16244 )
16245 {
16246 res = _PyPegen_dummy_name(p, literal, annotated_rhs_var);
16247 goto done;
16248 }
16249 p->mark = mark;
16250 }
16251 res = NULL;
16252 done:
16253 return res;
16254}
16255
Guido van Rossum3941d972020-05-01 09:42:03 -070016256// _tmp_127: '=' | augassign
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016257static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016258_tmp_127_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016259{
16260 if (p->error_indicator) {
16261 return NULL;
16262 }
16263 void * res = NULL;
16264 int mark = p->mark;
16265 { // '='
Pablo Galindob796b3f2020-05-01 12:32:26 +010016266 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016267 if (
16268 (literal = _PyPegen_expect_token(p, 22))
16269 )
16270 {
16271 res = literal;
16272 goto done;
16273 }
16274 p->mark = mark;
16275 }
16276 { // augassign
16277 AugOperator* augassign_var;
16278 if (
16279 (augassign_var = augassign_rule(p))
16280 )
16281 {
16282 res = augassign_var;
16283 goto done;
16284 }
16285 p->mark = mark;
16286 }
16287 res = NULL;
16288 done:
16289 return res;
16290}
16291
Guido van Rossum3941d972020-05-01 09:42:03 -070016292// _tmp_128: yield_expr | star_expressions
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016293static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016294_tmp_128_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016295{
16296 if (p->error_indicator) {
16297 return NULL;
16298 }
16299 void * res = NULL;
16300 int mark = p->mark;
16301 { // yield_expr
16302 expr_ty yield_expr_var;
16303 if (
16304 (yield_expr_var = yield_expr_rule(p))
16305 )
16306 {
16307 res = yield_expr_var;
16308 goto done;
16309 }
16310 p->mark = mark;
16311 }
16312 { // star_expressions
16313 expr_ty star_expressions_var;
16314 if (
16315 (star_expressions_var = star_expressions_rule(p))
16316 )
16317 {
16318 res = star_expressions_var;
16319 goto done;
16320 }
16321 p->mark = mark;
16322 }
16323 res = NULL;
16324 done:
16325 return res;
16326}
16327
Guido van Rossum3941d972020-05-01 09:42:03 -070016328// _tmp_129: '[' | '(' | '{'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016329static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016330_tmp_129_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016331{
16332 if (p->error_indicator) {
16333 return NULL;
16334 }
16335 void * res = NULL;
16336 int mark = p->mark;
16337 { // '['
Pablo Galindob796b3f2020-05-01 12:32:26 +010016338 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016339 if (
16340 (literal = _PyPegen_expect_token(p, 9))
16341 )
16342 {
16343 res = literal;
16344 goto done;
16345 }
16346 p->mark = mark;
16347 }
16348 { // '('
Pablo Galindob796b3f2020-05-01 12:32:26 +010016349 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016350 if (
16351 (literal = _PyPegen_expect_token(p, 7))
16352 )
16353 {
16354 res = literal;
16355 goto done;
16356 }
16357 p->mark = mark;
16358 }
16359 { // '{'
Pablo Galindob796b3f2020-05-01 12:32:26 +010016360 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016361 if (
16362 (literal = _PyPegen_expect_token(p, 25))
16363 )
16364 {
16365 res = literal;
16366 goto done;
16367 }
16368 p->mark = mark;
16369 }
16370 res = NULL;
16371 done:
16372 return res;
16373}
16374
Guido van Rossum3941d972020-05-01 09:42:03 -070016375// _loop0_130: param_no_default
Guido van Rossumc001c092020-04-30 12:12:19 -070016376static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016377_loop0_130_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016378{
16379 if (p->error_indicator) {
16380 return NULL;
16381 }
Guido van Rossumc001c092020-04-30 12:12:19 -070016382 void *res = NULL;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016383 int mark = p->mark;
Guido van Rossumc001c092020-04-30 12:12:19 -070016384 int start_mark = p->mark;
16385 void **children = PyMem_Malloc(sizeof(void *));
16386 if (!children) {
16387 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
16388 return NULL;
16389 }
16390 ssize_t children_capacity = 1;
16391 ssize_t n = 0;
16392 { // param_no_default
16393 arg_ty param_no_default_var;
16394 while (
16395 (param_no_default_var = param_no_default_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016396 )
16397 {
Guido van Rossumc001c092020-04-30 12:12:19 -070016398 res = param_no_default_var;
16399 if (n == children_capacity) {
16400 children_capacity *= 2;
16401 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
16402 if (!children) {
16403 PyErr_Format(PyExc_MemoryError, "realloc None");
16404 return NULL;
16405 }
16406 }
16407 children[n++] = res;
16408 mark = p->mark;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016409 }
16410 p->mark = mark;
16411 }
Guido van Rossumc001c092020-04-30 12:12:19 -070016412 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
16413 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070016414 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_130");
Guido van Rossumc001c092020-04-30 12:12:19 -070016415 PyMem_Free(children);
16416 return NULL;
16417 }
16418 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
16419 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070016420 _PyPegen_insert_memo(p, start_mark, _loop0_130_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070016421 return seq;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016422}
16423
Guido van Rossum3941d972020-05-01 09:42:03 -070016424// _tmp_131: slash_with_default | param_with_default+
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016425static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016426_tmp_131_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016427{
16428 if (p->error_indicator) {
16429 return NULL;
16430 }
16431 void * res = NULL;
16432 int mark = p->mark;
16433 { // slash_with_default
16434 SlashWithDefault* slash_with_default_var;
16435 if (
16436 (slash_with_default_var = slash_with_default_rule(p))
16437 )
16438 {
16439 res = slash_with_default_var;
16440 goto done;
16441 }
16442 p->mark = mark;
16443 }
Guido van Rossumc001c092020-04-30 12:12:19 -070016444 { // param_with_default+
Guido van Rossum3941d972020-05-01 09:42:03 -070016445 asdl_seq * _loop1_143_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016446 if (
Guido van Rossum3941d972020-05-01 09:42:03 -070016447 (_loop1_143_var = _loop1_143_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016448 )
16449 {
Guido van Rossum3941d972020-05-01 09:42:03 -070016450 res = _loop1_143_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016451 goto done;
16452 }
16453 p->mark = mark;
16454 }
16455 res = NULL;
16456 done:
16457 return res;
16458}
16459
Guido van Rossum3941d972020-05-01 09:42:03 -070016460// _tmp_132: star_targets '='
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016461static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016462_tmp_132_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016463{
16464 if (p->error_indicator) {
16465 return NULL;
16466 }
16467 void * res = NULL;
16468 int mark = p->mark;
16469 { // star_targets '='
Pablo Galindob796b3f2020-05-01 12:32:26 +010016470 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016471 expr_ty z;
16472 if (
16473 (z = star_targets_rule(p))
16474 &&
16475 (literal = _PyPegen_expect_token(p, 22))
16476 )
16477 {
16478 res = z;
16479 if (res == NULL && PyErr_Occurred()) {
16480 p->error_indicator = 1;
16481 return NULL;
16482 }
16483 goto done;
16484 }
16485 p->mark = mark;
16486 }
16487 res = NULL;
16488 done:
16489 return res;
16490}
16491
Guido van Rossum3941d972020-05-01 09:42:03 -070016492// _tmp_133: '.' | '...'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016493static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016494_tmp_133_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016495{
16496 if (p->error_indicator) {
16497 return NULL;
16498 }
16499 void * res = NULL;
16500 int mark = p->mark;
16501 { // '.'
Pablo Galindob796b3f2020-05-01 12:32:26 +010016502 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016503 if (
16504 (literal = _PyPegen_expect_token(p, 23))
16505 )
16506 {
16507 res = literal;
16508 goto done;
16509 }
16510 p->mark = mark;
16511 }
16512 { // '...'
Pablo Galindob796b3f2020-05-01 12:32:26 +010016513 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016514 if (
16515 (literal = _PyPegen_expect_token(p, 52))
16516 )
16517 {
16518 res = literal;
16519 goto done;
16520 }
16521 p->mark = mark;
16522 }
16523 res = NULL;
16524 done:
16525 return res;
16526}
16527
Guido van Rossum3941d972020-05-01 09:42:03 -070016528// _tmp_134: '.' | '...'
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016529static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016530_tmp_134_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016531{
16532 if (p->error_indicator) {
16533 return NULL;
16534 }
16535 void * res = NULL;
16536 int mark = p->mark;
Pablo Galindo2b74c832020-04-27 18:02:07 +010016537 { // '.'
Pablo Galindob796b3f2020-05-01 12:32:26 +010016538 Token * literal;
Pablo Galindo2b74c832020-04-27 18:02:07 +010016539 if (
16540 (literal = _PyPegen_expect_token(p, 23))
16541 )
16542 {
16543 res = literal;
16544 goto done;
16545 }
16546 p->mark = mark;
16547 }
16548 { // '...'
Pablo Galindob796b3f2020-05-01 12:32:26 +010016549 Token * literal;
Pablo Galindo2b74c832020-04-27 18:02:07 +010016550 if (
16551 (literal = _PyPegen_expect_token(p, 52))
16552 )
16553 {
16554 res = literal;
16555 goto done;
16556 }
16557 p->mark = mark;
16558 }
16559 res = NULL;
16560 done:
16561 return res;
16562}
16563
Guido van Rossum3941d972020-05-01 09:42:03 -070016564// _tmp_135: '@' named_expression NEWLINE
Pablo Galindo2b74c832020-04-27 18:02:07 +010016565static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016566_tmp_135_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016567{
16568 if (p->error_indicator) {
16569 return NULL;
16570 }
16571 void * res = NULL;
16572 int mark = p->mark;
16573 { // '@' named_expression NEWLINE
16574 expr_ty f;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016575 Token * literal;
16576 Token * newline_var;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016577 if (
16578 (literal = _PyPegen_expect_token(p, 49))
16579 &&
16580 (f = named_expression_rule(p))
16581 &&
Pablo Galindo4db245e2020-04-29 10:42:21 +010016582 (newline_var = _PyPegen_expect_token(p, NEWLINE))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016583 )
16584 {
16585 res = f;
16586 if (res == NULL && PyErr_Occurred()) {
16587 p->error_indicator = 1;
16588 return NULL;
16589 }
16590 goto done;
16591 }
16592 p->mark = mark;
16593 }
16594 res = NULL;
16595 done:
16596 return res;
16597}
16598
Guido van Rossum3941d972020-05-01 09:42:03 -070016599// _tmp_136: ',' star_expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016600static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016601_tmp_136_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016602{
16603 if (p->error_indicator) {
16604 return NULL;
16605 }
16606 void * res = NULL;
16607 int mark = p->mark;
16608 { // ',' star_expression
16609 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016610 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016611 if (
16612 (literal = _PyPegen_expect_token(p, 12))
16613 &&
16614 (c = star_expression_rule(p))
16615 )
16616 {
16617 res = c;
16618 if (res == NULL && PyErr_Occurred()) {
16619 p->error_indicator = 1;
16620 return NULL;
16621 }
16622 goto done;
16623 }
16624 p->mark = mark;
16625 }
16626 res = NULL;
16627 done:
16628 return res;
16629}
16630
Guido van Rossum3941d972020-05-01 09:42:03 -070016631// _tmp_137: ',' expression
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016632static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016633_tmp_137_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016634{
16635 if (p->error_indicator) {
16636 return NULL;
16637 }
16638 void * res = NULL;
16639 int mark = p->mark;
16640 { // ',' expression
16641 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016642 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016643 if (
16644 (literal = _PyPegen_expect_token(p, 12))
16645 &&
16646 (c = expression_rule(p))
16647 )
16648 {
16649 res = c;
16650 if (res == NULL && PyErr_Occurred()) {
16651 p->error_indicator = 1;
16652 return NULL;
16653 }
16654 goto done;
16655 }
16656 p->mark = mark;
16657 }
16658 res = NULL;
16659 done:
16660 return res;
16661}
16662
Guido van Rossum3941d972020-05-01 09:42:03 -070016663// _tmp_138: 'or' conjunction
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016664static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016665_tmp_138_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016666{
16667 if (p->error_indicator) {
16668 return NULL;
16669 }
16670 void * res = NULL;
16671 int mark = p->mark;
16672 { // 'or' conjunction
16673 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016674 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016675 if (
16676 (keyword = _PyPegen_expect_token(p, 532))
16677 &&
16678 (c = conjunction_rule(p))
16679 )
16680 {
16681 res = c;
16682 if (res == NULL && PyErr_Occurred()) {
16683 p->error_indicator = 1;
16684 return NULL;
16685 }
16686 goto done;
16687 }
16688 p->mark = mark;
16689 }
16690 res = NULL;
16691 done:
16692 return res;
16693}
16694
Guido van Rossum3941d972020-05-01 09:42:03 -070016695// _tmp_139: 'and' inversion
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016696static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016697_tmp_139_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016698{
16699 if (p->error_indicator) {
16700 return NULL;
16701 }
16702 void * res = NULL;
16703 int mark = p->mark;
16704 { // 'and' inversion
16705 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016706 Token * keyword;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016707 if (
16708 (keyword = _PyPegen_expect_token(p, 533))
16709 &&
16710 (c = inversion_rule(p))
16711 )
16712 {
16713 res = c;
16714 if (res == NULL && PyErr_Occurred()) {
16715 p->error_indicator = 1;
16716 return NULL;
16717 }
16718 goto done;
16719 }
16720 p->mark = mark;
16721 }
16722 res = NULL;
16723 done:
16724 return res;
16725}
16726
Guido van Rossum3941d972020-05-01 09:42:03 -070016727// _tmp_140: 'if' disjunction
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016728static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016729_tmp_140_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016730{
16731 if (p->error_indicator) {
16732 return NULL;
16733 }
16734 void * res = NULL;
16735 int mark = p->mark;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016736 { // 'if' disjunction
Pablo Galindob796b3f2020-05-01 12:32:26 +010016737 Token * keyword;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016738 expr_ty z;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016739 if (
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016740 (keyword = _PyPegen_expect_token(p, 510))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016741 &&
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016742 (z = disjunction_rule(p))
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016743 )
16744 {
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016745 res = z;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016746 if (res == NULL && PyErr_Occurred()) {
16747 p->error_indicator = 1;
16748 return NULL;
16749 }
16750 goto done;
16751 }
16752 p->mark = mark;
16753 }
16754 res = NULL;
16755 done:
16756 return res;
16757}
16758
Guido van Rossum3941d972020-05-01 09:42:03 -070016759// _tmp_141: 'if' disjunction
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016760static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016761_tmp_141_rule(Parser *p)
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016762{
16763 if (p->error_indicator) {
16764 return NULL;
16765 }
16766 void * res = NULL;
16767 int mark = p->mark;
16768 { // 'if' disjunction
Pablo Galindob796b3f2020-05-01 12:32:26 +010016769 Token * keyword;
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016770 expr_ty z;
16771 if (
16772 (keyword = _PyPegen_expect_token(p, 510))
16773 &&
16774 (z = disjunction_rule(p))
16775 )
16776 {
16777 res = z;
16778 if (res == NULL && PyErr_Occurred()) {
16779 p->error_indicator = 1;
16780 return NULL;
16781 }
16782 goto done;
16783 }
16784 p->mark = mark;
16785 }
16786 res = NULL;
16787 done:
16788 return res;
16789}
16790
Guido van Rossum3941d972020-05-01 09:42:03 -070016791// _tmp_142: ',' star_target
Lysandros Nikolaou3e0a6f32020-05-01 06:27:52 +030016792static void *
Guido van Rossum3941d972020-05-01 09:42:03 -070016793_tmp_142_rule(Parser *p)
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016794{
16795 if (p->error_indicator) {
16796 return NULL;
16797 }
16798 void * res = NULL;
16799 int mark = p->mark;
16800 { // ',' star_target
16801 expr_ty c;
Pablo Galindob796b3f2020-05-01 12:32:26 +010016802 Token * literal;
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016803 if (
16804 (literal = _PyPegen_expect_token(p, 12))
16805 &&
16806 (c = star_target_rule(p))
16807 )
16808 {
16809 res = c;
16810 if (res == NULL && PyErr_Occurred()) {
16811 p->error_indicator = 1;
16812 return NULL;
16813 }
16814 goto done;
16815 }
16816 p->mark = mark;
16817 }
16818 res = NULL;
16819 done:
16820 return res;
16821}
16822
Guido van Rossum3941d972020-05-01 09:42:03 -070016823// _loop1_143: param_with_default
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016824static asdl_seq *
Guido van Rossum3941d972020-05-01 09:42:03 -070016825_loop1_143_rule(Parser *p)
Guido van Rossumc001c092020-04-30 12:12:19 -070016826{
16827 if (p->error_indicator) {
16828 return NULL;
16829 }
16830 void *res = NULL;
16831 int mark = p->mark;
16832 int start_mark = p->mark;
16833 void **children = PyMem_Malloc(sizeof(void *));
16834 if (!children) {
16835 PyErr_Format(PyExc_MemoryError, "Parser out of memory");
16836 return NULL;
16837 }
16838 ssize_t children_capacity = 1;
16839 ssize_t n = 0;
16840 { // param_with_default
16841 NameDefaultPair* param_with_default_var;
16842 while (
16843 (param_with_default_var = param_with_default_rule(p))
16844 )
16845 {
16846 res = param_with_default_var;
16847 if (n == children_capacity) {
16848 children_capacity *= 2;
16849 children = PyMem_Realloc(children, children_capacity*sizeof(void *));
16850 if (!children) {
16851 PyErr_Format(PyExc_MemoryError, "realloc None");
16852 return NULL;
16853 }
16854 }
16855 children[n++] = res;
16856 mark = p->mark;
16857 }
16858 p->mark = mark;
16859 }
16860 if (n == 0) {
16861 PyMem_Free(children);
16862 return NULL;
16863 }
16864 asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
16865 if (!seq) {
Guido van Rossum3941d972020-05-01 09:42:03 -070016866 PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_143");
Guido van Rossumc001c092020-04-30 12:12:19 -070016867 PyMem_Free(children);
16868 return NULL;
16869 }
16870 for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
16871 PyMem_Free(children);
Guido van Rossum3941d972020-05-01 09:42:03 -070016872 _PyPegen_insert_memo(p, start_mark, _loop1_143_type, seq);
Guido van Rossumc001c092020-04-30 12:12:19 -070016873 return seq;
16874}
16875
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016876void *
16877_PyPegen_parse(Parser *p)
16878{
16879 // Initialize keywords
16880 p->keywords = reserved_keywords;
16881 p->n_keyword_lists = n_keyword_lists;
16882
16883 // Run parser
16884 void *result = NULL;
16885 if (p->start_rule == Py_file_input) {
16886 result = file_rule(p);
16887 } else if (p->start_rule == Py_single_input) {
16888 result = interactive_rule(p);
16889 } else if (p->start_rule == Py_eval_input) {
16890 result = eval_rule(p);
Guido van Rossumc001c092020-04-30 12:12:19 -070016891 } else if (p->start_rule == Py_func_type_input) {
16892 result = func_type_rule(p);
Pablo Galindoc5fc1562020-04-22 23:29:27 +010016893 } else if (p->start_rule == Py_fstring_input) {
16894 result = fstring_rule(p);
16895 }
16896
16897 return result;
16898}
16899
16900// The end