cpython/Parser/parser.c

35771 lines
1.2 MiB

// @generated by pegen from python.gram
#include "pegen.h"
#if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
# define D(x) if (p->debug) { x; }
#else
# define D(x)
#endif
#ifdef __wasi__
# ifdef Py_DEBUG
# define MAXSTACK 1000
# else
# define MAXSTACK 4000
# endif
#else
# define MAXSTACK 6000
#endif
static const int n_keyword_lists = 9;
static KeywordToken *reserved_keywords[] = {
(KeywordToken[]) {{NULL, -1}},
(KeywordToken[]) {{NULL, -1}},
(KeywordToken[]) {
{"if", 668},
{"as", 666},
{"in", 679},
{"or", 581},
{"is", 589},
{NULL, -1},
},
(KeywordToken[]) {
{"del", 613},
{"def", 683},
{"for", 678},
{"try", 642},
{"and", 582},
{"not", 687},
{NULL, -1},
},
(KeywordToken[]) {
{"from", 621},
{"pass", 504},
{"with", 633},
{"elif", 670},
{"else", 671},
{"None", 611},
{"True", 610},
{NULL, -1},
},
(KeywordToken[]) {
{"raise", 525},
{"yield", 580},
{"break", 508},
{"async", 682},
{"class", 685},
{"while", 673},
{"False", 612},
{"await", 590},
{NULL, -1},
},
(KeywordToken[]) {
{"return", 522},
{"import", 622},
{"assert", 529},
{"global", 526},
{"except", 663},
{"lambda", 609},
{NULL, -1},
},
(KeywordToken[]) {
{"finally", 659},
{NULL, -1},
},
(KeywordToken[]) {
{"continue", 509},
{"nonlocal", 527},
{NULL, -1},
},
};
static char *soft_keywords[] = {
"_",
"case",
"match",
"type",
NULL,
};
#define file_type 1000
#define interactive_type 1001
#define eval_type 1002
#define func_type_type 1003
#define statements_type 1004
#define statement_type 1005
#define statement_newline_type 1006
#define simple_stmts_type 1007
#define simple_stmt_type 1008
#define compound_stmt_type 1009
#define assignment_type 1010
#define annotated_rhs_type 1011
#define augassign_type 1012
#define return_stmt_type 1013
#define raise_stmt_type 1014
#define global_stmt_type 1015
#define nonlocal_stmt_type 1016
#define del_stmt_type 1017
#define yield_stmt_type 1018
#define assert_stmt_type 1019
#define import_stmt_type 1020
#define import_name_type 1021
#define import_from_type 1022
#define import_from_targets_type 1023
#define import_from_as_names_type 1024
#define import_from_as_name_type 1025
#define dotted_as_names_type 1026
#define dotted_as_name_type 1027
#define dotted_name_type 1028 // Left-recursive
#define block_type 1029
#define decorators_type 1030
#define class_def_type 1031
#define class_def_raw_type 1032
#define function_def_type 1033
#define function_def_raw_type 1034
#define params_type 1035
#define parameters_type 1036
#define slash_no_default_type 1037
#define slash_with_default_type 1038
#define star_etc_type 1039
#define kwds_type 1040
#define param_no_default_type 1041
#define param_no_default_star_annotation_type 1042
#define param_with_default_type 1043
#define param_maybe_default_type 1044
#define param_type 1045
#define param_star_annotation_type 1046
#define annotation_type 1047
#define star_annotation_type 1048
#define default_type 1049
#define if_stmt_type 1050
#define elif_stmt_type 1051
#define else_block_type 1052
#define while_stmt_type 1053
#define for_stmt_type 1054
#define with_stmt_type 1055
#define with_item_type 1056
#define try_stmt_type 1057
#define except_block_type 1058
#define except_star_block_type 1059
#define finally_block_type 1060
#define match_stmt_type 1061
#define subject_expr_type 1062
#define case_block_type 1063
#define guard_type 1064
#define patterns_type 1065
#define pattern_type 1066
#define as_pattern_type 1067
#define or_pattern_type 1068
#define closed_pattern_type 1069
#define literal_pattern_type 1070
#define literal_expr_type 1071
#define complex_number_type 1072
#define signed_number_type 1073
#define signed_real_number_type 1074
#define real_number_type 1075
#define imaginary_number_type 1076
#define capture_pattern_type 1077
#define pattern_capture_target_type 1078
#define wildcard_pattern_type 1079
#define value_pattern_type 1080
#define attr_type 1081 // Left-recursive
#define name_or_attr_type 1082 // Left-recursive
#define group_pattern_type 1083
#define sequence_pattern_type 1084
#define open_sequence_pattern_type 1085
#define maybe_sequence_pattern_type 1086
#define maybe_star_pattern_type 1087
#define star_pattern_type 1088
#define mapping_pattern_type 1089
#define items_pattern_type 1090
#define key_value_pattern_type 1091
#define double_star_pattern_type 1092
#define class_pattern_type 1093
#define positional_patterns_type 1094
#define keyword_patterns_type 1095
#define keyword_pattern_type 1096
#define type_alias_type 1097
#define type_params_type 1098
#define type_param_seq_type 1099
#define type_param_type 1100
#define type_param_bound_type 1101
#define type_param_default_type 1102
#define type_param_starred_default_type 1103
#define expressions_type 1104
#define expression_type 1105
#define yield_expr_type 1106
#define star_expressions_type 1107
#define star_expression_type 1108
#define star_named_expressions_type 1109
#define star_named_expression_type 1110
#define assignment_expression_type 1111
#define named_expression_type 1112
#define disjunction_type 1113
#define conjunction_type 1114
#define inversion_type 1115
#define comparison_type 1116
#define compare_op_bitwise_or_pair_type 1117
#define eq_bitwise_or_type 1118
#define noteq_bitwise_or_type 1119
#define lte_bitwise_or_type 1120
#define lt_bitwise_or_type 1121
#define gte_bitwise_or_type 1122
#define gt_bitwise_or_type 1123
#define notin_bitwise_or_type 1124
#define in_bitwise_or_type 1125
#define isnot_bitwise_or_type 1126
#define is_bitwise_or_type 1127
#define bitwise_or_type 1128 // Left-recursive
#define bitwise_xor_type 1129 // Left-recursive
#define bitwise_and_type 1130 // Left-recursive
#define shift_expr_type 1131 // Left-recursive
#define sum_type 1132 // Left-recursive
#define term_type 1133 // Left-recursive
#define factor_type 1134
#define power_type 1135
#define await_primary_type 1136
#define primary_type 1137 // Left-recursive
#define slices_type 1138
#define slice_type 1139
#define atom_type 1140
#define group_type 1141
#define lambdef_type 1142
#define lambda_params_type 1143
#define lambda_parameters_type 1144
#define lambda_slash_no_default_type 1145
#define lambda_slash_with_default_type 1146
#define lambda_star_etc_type 1147
#define lambda_kwds_type 1148
#define lambda_param_no_default_type 1149
#define lambda_param_with_default_type 1150
#define lambda_param_maybe_default_type 1151
#define lambda_param_type 1152
#define fstring_middle_type 1153
#define fstring_replacement_field_type 1154
#define fstring_conversion_type 1155
#define fstring_full_format_spec_type 1156
#define fstring_format_spec_type 1157
#define fstring_type 1158
#define string_type 1159
#define strings_type 1160
#define list_type 1161
#define tuple_type 1162
#define set_type 1163
#define dict_type 1164
#define double_starred_kvpairs_type 1165
#define double_starred_kvpair_type 1166
#define kvpair_type 1167
#define for_if_clauses_type 1168
#define for_if_clause_type 1169
#define listcomp_type 1170
#define setcomp_type 1171
#define genexp_type 1172
#define dictcomp_type 1173
#define arguments_type 1174
#define args_type 1175
#define kwargs_type 1176
#define starred_expression_type 1177
#define kwarg_or_starred_type 1178
#define kwarg_or_double_starred_type 1179
#define star_targets_type 1180
#define star_targets_list_seq_type 1181
#define star_targets_tuple_seq_type 1182
#define star_target_type 1183
#define target_with_star_atom_type 1184
#define star_atom_type 1185
#define single_target_type 1186
#define single_subscript_attribute_target_type 1187
#define t_primary_type 1188 // Left-recursive
#define t_lookahead_type 1189
#define del_targets_type 1190
#define del_target_type 1191
#define del_t_atom_type 1192
#define type_expressions_type 1193
#define func_type_comment_type 1194
#define invalid_arguments_type 1195
#define invalid_kwarg_type 1196
#define expression_without_invalid_type 1197
#define invalid_legacy_expression_type 1198
#define invalid_type_param_type 1199
#define invalid_expression_type 1200
#define invalid_named_expression_type 1201
#define invalid_assignment_type 1202
#define invalid_ann_assign_target_type 1203
#define invalid_del_stmt_type 1204
#define invalid_block_type 1205
#define invalid_comprehension_type 1206
#define invalid_dict_comprehension_type 1207
#define invalid_parameters_type 1208
#define invalid_default_type 1209
#define invalid_star_etc_type 1210
#define invalid_kwds_type 1211
#define invalid_parameters_helper_type 1212
#define invalid_lambda_parameters_type 1213
#define invalid_lambda_parameters_helper_type 1214
#define invalid_lambda_star_etc_type 1215
#define invalid_lambda_kwds_type 1216
#define invalid_double_type_comments_type 1217
#define invalid_with_item_type 1218
#define invalid_for_if_clause_type 1219
#define invalid_for_target_type 1220
#define invalid_group_type 1221
#define invalid_import_type 1222
#define invalid_import_from_targets_type 1223
#define invalid_with_stmt_type 1224
#define invalid_with_stmt_indent_type 1225
#define invalid_try_stmt_type 1226
#define invalid_except_stmt_type 1227
#define invalid_except_star_stmt_type 1228
#define invalid_finally_stmt_type 1229
#define invalid_except_stmt_indent_type 1230
#define invalid_except_star_stmt_indent_type 1231
#define invalid_match_stmt_type 1232
#define invalid_case_block_type 1233
#define invalid_as_pattern_type 1234
#define invalid_class_pattern_type 1235
#define invalid_class_argument_pattern_type 1236
#define invalid_if_stmt_type 1237
#define invalid_elif_stmt_type 1238
#define invalid_else_stmt_type 1239
#define invalid_while_stmt_type 1240
#define invalid_for_stmt_type 1241
#define invalid_def_raw_type 1242
#define invalid_class_def_raw_type 1243
#define invalid_double_starred_kvpairs_type 1244
#define invalid_kvpair_type 1245
#define invalid_starred_expression_unpacking_type 1246
#define invalid_starred_expression_type 1247
#define invalid_replacement_field_type 1248
#define invalid_conversion_character_type 1249
#define invalid_arithmetic_type 1250
#define invalid_factor_type 1251
#define invalid_type_params_type 1252
#define _loop0_1_type 1253
#define _loop1_2_type 1254
#define _loop0_3_type 1255
#define _gather_4_type 1256
#define _tmp_5_type 1257
#define _tmp_6_type 1258
#define _tmp_7_type 1259
#define _tmp_8_type 1260
#define _tmp_9_type 1261
#define _tmp_10_type 1262
#define _tmp_11_type 1263
#define _loop1_12_type 1264
#define _tmp_13_type 1265
#define _loop0_14_type 1266
#define _gather_15_type 1267
#define _tmp_16_type 1268
#define _tmp_17_type 1269
#define _loop0_18_type 1270
#define _loop1_19_type 1271
#define _loop0_20_type 1272
#define _gather_21_type 1273
#define _tmp_22_type 1274
#define _loop0_23_type 1275
#define _gather_24_type 1276
#define _loop1_25_type 1277
#define _tmp_26_type 1278
#define _tmp_27_type 1279
#define _loop0_28_type 1280
#define _loop0_29_type 1281
#define _loop1_30_type 1282
#define _loop1_31_type 1283
#define _loop0_32_type 1284
#define _loop1_33_type 1285
#define _loop0_34_type 1286
#define _gather_35_type 1287
#define _tmp_36_type 1288
#define _loop1_37_type 1289
#define _loop1_38_type 1290
#define _loop1_39_type 1291
#define _loop0_40_type 1292
#define _gather_41_type 1293
#define _tmp_42_type 1294
#define _tmp_43_type 1295
#define _loop0_44_type 1296
#define _gather_45_type 1297
#define _loop0_46_type 1298
#define _gather_47_type 1299
#define _tmp_48_type 1300
#define _loop0_49_type 1301
#define _gather_50_type 1302
#define _loop0_51_type 1303
#define _gather_52_type 1304
#define _loop0_53_type 1305
#define _gather_54_type 1306
#define _loop1_55_type 1307
#define _loop1_56_type 1308
#define _loop0_57_type 1309
#define _gather_58_type 1310
#define _loop1_59_type 1311
#define _loop1_60_type 1312
#define _loop1_61_type 1313
#define _tmp_62_type 1314
#define _loop0_63_type 1315
#define _gather_64_type 1316
#define _tmp_65_type 1317
#define _tmp_66_type 1318
#define _tmp_67_type 1319
#define _tmp_68_type 1320
#define _tmp_69_type 1321
#define _tmp_70_type 1322
#define _loop0_71_type 1323
#define _loop0_72_type 1324
#define _loop1_73_type 1325
#define _loop1_74_type 1326
#define _loop0_75_type 1327
#define _loop1_76_type 1328
#define _loop0_77_type 1329
#define _loop0_78_type 1330
#define _loop1_79_type 1331
#define _tmp_80_type 1332
#define _loop0_81_type 1333
#define _gather_82_type 1334
#define _loop1_83_type 1335
#define _loop0_84_type 1336
#define _tmp_85_type 1337
#define _loop0_86_type 1338
#define _gather_87_type 1339
#define _tmp_88_type 1340
#define _loop0_89_type 1341
#define _gather_90_type 1342
#define _loop0_91_type 1343
#define _gather_92_type 1344
#define _loop0_93_type 1345
#define _loop0_94_type 1346
#define _gather_95_type 1347
#define _loop1_96_type 1348
#define _tmp_97_type 1349
#define _loop0_98_type 1350
#define _gather_99_type 1351
#define _loop0_100_type 1352
#define _gather_101_type 1353
#define _tmp_102_type 1354
#define _tmp_103_type 1355
#define _loop0_104_type 1356
#define _gather_105_type 1357
#define _tmp_106_type 1358
#define _tmp_107_type 1359
#define _tmp_108_type 1360
#define _tmp_109_type 1361
#define _tmp_110_type 1362
#define _tmp_111_type 1363
#define _tmp_112_type 1364
#define _tmp_113_type 1365
#define _tmp_114_type 1366
#define _loop0_115_type 1367
#define _loop0_116_type 1368
#define _tmp_117_type 1369
#define _tmp_118_type 1370
#define _tmp_119_type 1371
#define _tmp_120_type 1372
#define _tmp_121_type 1373
#define _tmp_122_type 1374
#define _tmp_123_type 1375
#define _tmp_124_type 1376
#define _tmp_125_type 1377
#define _loop0_126_type 1378
#define _gather_127_type 1379
#define _tmp_128_type 1380
#define _tmp_129_type 1381
#define _tmp_130_type 1382
#define _tmp_131_type 1383
#define _loop0_132_type 1384
#define _gather_133_type 1385
#define _loop0_134_type 1386
#define _gather_135_type 1387
#define _loop0_136_type 1388
#define _gather_137_type 1389
#define _tmp_138_type 1390
#define _loop0_139_type 1391
#define _tmp_140_type 1392
#define _tmp_141_type 1393
#define _tmp_142_type 1394
#define _tmp_143_type 1395
#define _tmp_144_type 1396
#define _tmp_145_type 1397
#define _tmp_146_type 1398
#define _tmp_147_type 1399
#define _tmp_148_type 1400
#define _tmp_149_type 1401
#define _tmp_150_type 1402
#define _tmp_151_type 1403
#define _tmp_152_type 1404
#define _tmp_153_type 1405
#define _tmp_154_type 1406
#define _tmp_155_type 1407
#define _tmp_156_type 1408
#define _tmp_157_type 1409
#define _tmp_158_type 1410
#define _tmp_159_type 1411
#define _tmp_160_type 1412
#define _tmp_161_type 1413
#define _tmp_162_type 1414
#define _tmp_163_type 1415
#define _tmp_164_type 1416
#define _loop0_165_type 1417
#define _tmp_166_type 1418
#define _tmp_167_type 1419
#define _tmp_168_type 1420
#define _tmp_169_type 1421
static mod_ty file_rule(Parser *p);
static mod_ty interactive_rule(Parser *p);
static mod_ty eval_rule(Parser *p);
static mod_ty func_type_rule(Parser *p);
static asdl_stmt_seq* statements_rule(Parser *p);
static asdl_stmt_seq* statement_rule(Parser *p);
static asdl_stmt_seq* statement_newline_rule(Parser *p);
static asdl_stmt_seq* simple_stmts_rule(Parser *p);
static stmt_ty simple_stmt_rule(Parser *p);
static stmt_ty compound_stmt_rule(Parser *p);
static stmt_ty assignment_rule(Parser *p);
static expr_ty annotated_rhs_rule(Parser *p);
static AugOperator* augassign_rule(Parser *p);
static stmt_ty return_stmt_rule(Parser *p);
static stmt_ty raise_stmt_rule(Parser *p);
static stmt_ty global_stmt_rule(Parser *p);
static stmt_ty nonlocal_stmt_rule(Parser *p);
static stmt_ty del_stmt_rule(Parser *p);
static stmt_ty yield_stmt_rule(Parser *p);
static stmt_ty assert_stmt_rule(Parser *p);
static stmt_ty import_stmt_rule(Parser *p);
static stmt_ty import_name_rule(Parser *p);
static stmt_ty import_from_rule(Parser *p);
static asdl_alias_seq* import_from_targets_rule(Parser *p);
static asdl_alias_seq* import_from_as_names_rule(Parser *p);
static alias_ty import_from_as_name_rule(Parser *p);
static asdl_alias_seq* dotted_as_names_rule(Parser *p);
static alias_ty dotted_as_name_rule(Parser *p);
static expr_ty dotted_name_rule(Parser *p);
static asdl_stmt_seq* block_rule(Parser *p);
static asdl_expr_seq* decorators_rule(Parser *p);
static stmt_ty class_def_rule(Parser *p);
static stmt_ty class_def_raw_rule(Parser *p);
static stmt_ty function_def_rule(Parser *p);
static stmt_ty function_def_raw_rule(Parser *p);
static arguments_ty params_rule(Parser *p);
static arguments_ty parameters_rule(Parser *p);
static asdl_arg_seq* slash_no_default_rule(Parser *p);
static SlashWithDefault* slash_with_default_rule(Parser *p);
static StarEtc* star_etc_rule(Parser *p);
static arg_ty kwds_rule(Parser *p);
static arg_ty param_no_default_rule(Parser *p);
static arg_ty param_no_default_star_annotation_rule(Parser *p);
static NameDefaultPair* param_with_default_rule(Parser *p);
static NameDefaultPair* param_maybe_default_rule(Parser *p);
static arg_ty param_rule(Parser *p);
static arg_ty param_star_annotation_rule(Parser *p);
static expr_ty annotation_rule(Parser *p);
static expr_ty star_annotation_rule(Parser *p);
static expr_ty default_rule(Parser *p);
static stmt_ty if_stmt_rule(Parser *p);
static stmt_ty elif_stmt_rule(Parser *p);
static asdl_stmt_seq* else_block_rule(Parser *p);
static stmt_ty while_stmt_rule(Parser *p);
static stmt_ty for_stmt_rule(Parser *p);
static stmt_ty with_stmt_rule(Parser *p);
static withitem_ty with_item_rule(Parser *p);
static stmt_ty try_stmt_rule(Parser *p);
static excepthandler_ty except_block_rule(Parser *p);
static excepthandler_ty except_star_block_rule(Parser *p);
static asdl_stmt_seq* finally_block_rule(Parser *p);
static stmt_ty match_stmt_rule(Parser *p);
static expr_ty subject_expr_rule(Parser *p);
static match_case_ty case_block_rule(Parser *p);
static expr_ty guard_rule(Parser *p);
static pattern_ty patterns_rule(Parser *p);
static pattern_ty pattern_rule(Parser *p);
static pattern_ty as_pattern_rule(Parser *p);
static pattern_ty or_pattern_rule(Parser *p);
static pattern_ty closed_pattern_rule(Parser *p);
static pattern_ty literal_pattern_rule(Parser *p);
static expr_ty literal_expr_rule(Parser *p);
static expr_ty complex_number_rule(Parser *p);
static expr_ty signed_number_rule(Parser *p);
static expr_ty signed_real_number_rule(Parser *p);
static expr_ty real_number_rule(Parser *p);
static expr_ty imaginary_number_rule(Parser *p);
static pattern_ty capture_pattern_rule(Parser *p);
static expr_ty pattern_capture_target_rule(Parser *p);
static pattern_ty wildcard_pattern_rule(Parser *p);
static pattern_ty value_pattern_rule(Parser *p);
static expr_ty attr_rule(Parser *p);
static expr_ty name_or_attr_rule(Parser *p);
static pattern_ty group_pattern_rule(Parser *p);
static pattern_ty sequence_pattern_rule(Parser *p);
static asdl_seq* open_sequence_pattern_rule(Parser *p);
static asdl_seq* maybe_sequence_pattern_rule(Parser *p);
static pattern_ty maybe_star_pattern_rule(Parser *p);
static pattern_ty star_pattern_rule(Parser *p);
static pattern_ty mapping_pattern_rule(Parser *p);
static asdl_seq* items_pattern_rule(Parser *p);
static KeyPatternPair* key_value_pattern_rule(Parser *p);
static expr_ty double_star_pattern_rule(Parser *p);
static pattern_ty class_pattern_rule(Parser *p);
static asdl_pattern_seq* positional_patterns_rule(Parser *p);
static asdl_seq* keyword_patterns_rule(Parser *p);
static KeyPatternPair* keyword_pattern_rule(Parser *p);
static stmt_ty type_alias_rule(Parser *p);
static asdl_type_param_seq* type_params_rule(Parser *p);
static asdl_type_param_seq* type_param_seq_rule(Parser *p);
static type_param_ty type_param_rule(Parser *p);
static expr_ty type_param_bound_rule(Parser *p);
static expr_ty type_param_default_rule(Parser *p);
static expr_ty type_param_starred_default_rule(Parser *p);
static expr_ty expressions_rule(Parser *p);
static expr_ty expression_rule(Parser *p);
static expr_ty yield_expr_rule(Parser *p);
static expr_ty star_expressions_rule(Parser *p);
static expr_ty star_expression_rule(Parser *p);
static asdl_expr_seq* star_named_expressions_rule(Parser *p);
static expr_ty star_named_expression_rule(Parser *p);
static expr_ty assignment_expression_rule(Parser *p);
static expr_ty named_expression_rule(Parser *p);
static expr_ty disjunction_rule(Parser *p);
static expr_ty conjunction_rule(Parser *p);
static expr_ty inversion_rule(Parser *p);
static expr_ty comparison_rule(Parser *p);
static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
static CmpopExprPair* in_bitwise_or_rule(Parser *p);
static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
static CmpopExprPair* is_bitwise_or_rule(Parser *p);
static expr_ty bitwise_or_rule(Parser *p);
static expr_ty bitwise_xor_rule(Parser *p);
static expr_ty bitwise_and_rule(Parser *p);
static expr_ty shift_expr_rule(Parser *p);
static expr_ty sum_rule(Parser *p);
static expr_ty term_rule(Parser *p);
static expr_ty factor_rule(Parser *p);
static expr_ty power_rule(Parser *p);
static expr_ty await_primary_rule(Parser *p);
static expr_ty primary_rule(Parser *p);
static expr_ty slices_rule(Parser *p);
static expr_ty slice_rule(Parser *p);
static expr_ty atom_rule(Parser *p);
static expr_ty group_rule(Parser *p);
static expr_ty lambdef_rule(Parser *p);
static arguments_ty lambda_params_rule(Parser *p);
static arguments_ty lambda_parameters_rule(Parser *p);
static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p);
static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
static StarEtc* lambda_star_etc_rule(Parser *p);
static arg_ty lambda_kwds_rule(Parser *p);
static arg_ty lambda_param_no_default_rule(Parser *p);
static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
static arg_ty lambda_param_rule(Parser *p);
static expr_ty fstring_middle_rule(Parser *p);
static expr_ty fstring_replacement_field_rule(Parser *p);
static ResultTokenWithMetadata* fstring_conversion_rule(Parser *p);
static ResultTokenWithMetadata* fstring_full_format_spec_rule(Parser *p);
static expr_ty fstring_format_spec_rule(Parser *p);
static expr_ty fstring_rule(Parser *p);
static expr_ty string_rule(Parser *p);
static expr_ty strings_rule(Parser *p);
static expr_ty list_rule(Parser *p);
static expr_ty tuple_rule(Parser *p);
static expr_ty set_rule(Parser *p);
static expr_ty dict_rule(Parser *p);
static asdl_seq* double_starred_kvpairs_rule(Parser *p);
static KeyValuePair* double_starred_kvpair_rule(Parser *p);
static KeyValuePair* kvpair_rule(Parser *p);
static asdl_comprehension_seq* for_if_clauses_rule(Parser *p);
static comprehension_ty for_if_clause_rule(Parser *p);
static expr_ty listcomp_rule(Parser *p);
static expr_ty setcomp_rule(Parser *p);
static expr_ty genexp_rule(Parser *p);
static expr_ty dictcomp_rule(Parser *p);
static expr_ty arguments_rule(Parser *p);
static expr_ty args_rule(Parser *p);
static asdl_seq* kwargs_rule(Parser *p);
static expr_ty starred_expression_rule(Parser *p);
static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
static expr_ty star_targets_rule(Parser *p);
static asdl_expr_seq* star_targets_list_seq_rule(Parser *p);
static asdl_expr_seq* star_targets_tuple_seq_rule(Parser *p);
static expr_ty star_target_rule(Parser *p);
static expr_ty target_with_star_atom_rule(Parser *p);
static expr_ty star_atom_rule(Parser *p);
static expr_ty single_target_rule(Parser *p);
static expr_ty single_subscript_attribute_target_rule(Parser *p);
static expr_ty t_primary_rule(Parser *p);
static void *t_lookahead_rule(Parser *p);
static asdl_expr_seq* del_targets_rule(Parser *p);
static expr_ty del_target_rule(Parser *p);
static expr_ty del_t_atom_rule(Parser *p);
static asdl_expr_seq* type_expressions_rule(Parser *p);
static Token* func_type_comment_rule(Parser *p);
static void *invalid_arguments_rule(Parser *p);
static void *invalid_kwarg_rule(Parser *p);
static expr_ty expression_without_invalid_rule(Parser *p);
static void *invalid_legacy_expression_rule(Parser *p);
static void *invalid_type_param_rule(Parser *p);
static void *invalid_expression_rule(Parser *p);
static void *invalid_named_expression_rule(Parser *p);
static void *invalid_assignment_rule(Parser *p);
static expr_ty invalid_ann_assign_target_rule(Parser *p);
static void *invalid_del_stmt_rule(Parser *p);
static void *invalid_block_rule(Parser *p);
static void *invalid_comprehension_rule(Parser *p);
static void *invalid_dict_comprehension_rule(Parser *p);
static void *invalid_parameters_rule(Parser *p);
static void *invalid_default_rule(Parser *p);
static void *invalid_star_etc_rule(Parser *p);
static void *invalid_kwds_rule(Parser *p);
static void *invalid_parameters_helper_rule(Parser *p);
static void *invalid_lambda_parameters_rule(Parser *p);
static void *invalid_lambda_parameters_helper_rule(Parser *p);
static void *invalid_lambda_star_etc_rule(Parser *p);
static void *invalid_lambda_kwds_rule(Parser *p);
static void *invalid_double_type_comments_rule(Parser *p);
static void *invalid_with_item_rule(Parser *p);
static void *invalid_for_if_clause_rule(Parser *p);
static void *invalid_for_target_rule(Parser *p);
static void *invalid_group_rule(Parser *p);
static void *invalid_import_rule(Parser *p);
static void *invalid_import_from_targets_rule(Parser *p);
static void *invalid_with_stmt_rule(Parser *p);
static void *invalid_with_stmt_indent_rule(Parser *p);
static void *invalid_try_stmt_rule(Parser *p);
static void *invalid_except_stmt_rule(Parser *p);
static void *invalid_except_star_stmt_rule(Parser *p);
static void *invalid_finally_stmt_rule(Parser *p);
static void *invalid_except_stmt_indent_rule(Parser *p);
static void *invalid_except_star_stmt_indent_rule(Parser *p);
static void *invalid_match_stmt_rule(Parser *p);
static void *invalid_case_block_rule(Parser *p);
static void *invalid_as_pattern_rule(Parser *p);
static void *invalid_class_pattern_rule(Parser *p);
static asdl_pattern_seq* invalid_class_argument_pattern_rule(Parser *p);
static void *invalid_if_stmt_rule(Parser *p);
static void *invalid_elif_stmt_rule(Parser *p);
static void *invalid_else_stmt_rule(Parser *p);
static void *invalid_while_stmt_rule(Parser *p);
static void *invalid_for_stmt_rule(Parser *p);
static void *invalid_def_raw_rule(Parser *p);
static void *invalid_class_def_raw_rule(Parser *p);
static void *invalid_double_starred_kvpairs_rule(Parser *p);
static void *invalid_kvpair_rule(Parser *p);
static void *invalid_starred_expression_unpacking_rule(Parser *p);
static void *invalid_starred_expression_rule(Parser *p);
static void *invalid_replacement_field_rule(Parser *p);
static void *invalid_conversion_character_rule(Parser *p);
static void *invalid_arithmetic_rule(Parser *p);
static void *invalid_factor_rule(Parser *p);
static void *invalid_type_params_rule(Parser *p);
static asdl_seq *_loop0_1_rule(Parser *p);
static asdl_seq *_loop1_2_rule(Parser *p);
static asdl_seq *_loop0_3_rule(Parser *p);
static asdl_seq *_gather_4_rule(Parser *p);
static void *_tmp_5_rule(Parser *p);
static void *_tmp_6_rule(Parser *p);
static void *_tmp_7_rule(Parser *p);
static void *_tmp_8_rule(Parser *p);
static void *_tmp_9_rule(Parser *p);
static void *_tmp_10_rule(Parser *p);
static void *_tmp_11_rule(Parser *p);
static asdl_seq *_loop1_12_rule(Parser *p);
static void *_tmp_13_rule(Parser *p);
static asdl_seq *_loop0_14_rule(Parser *p);
static asdl_seq *_gather_15_rule(Parser *p);
static void *_tmp_16_rule(Parser *p);
static void *_tmp_17_rule(Parser *p);
static asdl_seq *_loop0_18_rule(Parser *p);
static asdl_seq *_loop1_19_rule(Parser *p);
static asdl_seq *_loop0_20_rule(Parser *p);
static asdl_seq *_gather_21_rule(Parser *p);
static void *_tmp_22_rule(Parser *p);
static asdl_seq *_loop0_23_rule(Parser *p);
static asdl_seq *_gather_24_rule(Parser *p);
static asdl_seq *_loop1_25_rule(Parser *p);
static void *_tmp_26_rule(Parser *p);
static void *_tmp_27_rule(Parser *p);
static asdl_seq *_loop0_28_rule(Parser *p);
static asdl_seq *_loop0_29_rule(Parser *p);
static asdl_seq *_loop1_30_rule(Parser *p);
static asdl_seq *_loop1_31_rule(Parser *p);
static asdl_seq *_loop0_32_rule(Parser *p);
static asdl_seq *_loop1_33_rule(Parser *p);
static asdl_seq *_loop0_34_rule(Parser *p);
static asdl_seq *_gather_35_rule(Parser *p);
static void *_tmp_36_rule(Parser *p);
static asdl_seq *_loop1_37_rule(Parser *p);
static asdl_seq *_loop1_38_rule(Parser *p);
static asdl_seq *_loop1_39_rule(Parser *p);
static asdl_seq *_loop0_40_rule(Parser *p);
static asdl_seq *_gather_41_rule(Parser *p);
static void *_tmp_42_rule(Parser *p);
static void *_tmp_43_rule(Parser *p);
static asdl_seq *_loop0_44_rule(Parser *p);
static asdl_seq *_gather_45_rule(Parser *p);
static asdl_seq *_loop0_46_rule(Parser *p);
static asdl_seq *_gather_47_rule(Parser *p);
static void *_tmp_48_rule(Parser *p);
static asdl_seq *_loop0_49_rule(Parser *p);
static asdl_seq *_gather_50_rule(Parser *p);
static asdl_seq *_loop0_51_rule(Parser *p);
static asdl_seq *_gather_52_rule(Parser *p);
static asdl_seq *_loop0_53_rule(Parser *p);
static asdl_seq *_gather_54_rule(Parser *p);
static asdl_seq *_loop1_55_rule(Parser *p);
static asdl_seq *_loop1_56_rule(Parser *p);
static asdl_seq *_loop0_57_rule(Parser *p);
static asdl_seq *_gather_58_rule(Parser *p);
static asdl_seq *_loop1_59_rule(Parser *p);
static asdl_seq *_loop1_60_rule(Parser *p);
static asdl_seq *_loop1_61_rule(Parser *p);
static void *_tmp_62_rule(Parser *p);
static asdl_seq *_loop0_63_rule(Parser *p);
static asdl_seq *_gather_64_rule(Parser *p);
static void *_tmp_65_rule(Parser *p);
static void *_tmp_66_rule(Parser *p);
static void *_tmp_67_rule(Parser *p);
static void *_tmp_68_rule(Parser *p);
static void *_tmp_69_rule(Parser *p);
static void *_tmp_70_rule(Parser *p);
static asdl_seq *_loop0_71_rule(Parser *p);
static asdl_seq *_loop0_72_rule(Parser *p);
static asdl_seq *_loop1_73_rule(Parser *p);
static asdl_seq *_loop1_74_rule(Parser *p);
static asdl_seq *_loop0_75_rule(Parser *p);
static asdl_seq *_loop1_76_rule(Parser *p);
static asdl_seq *_loop0_77_rule(Parser *p);
static asdl_seq *_loop0_78_rule(Parser *p);
static asdl_seq *_loop1_79_rule(Parser *p);
static void *_tmp_80_rule(Parser *p);
static asdl_seq *_loop0_81_rule(Parser *p);
static asdl_seq *_gather_82_rule(Parser *p);
static asdl_seq *_loop1_83_rule(Parser *p);
static asdl_seq *_loop0_84_rule(Parser *p);
static void *_tmp_85_rule(Parser *p);
static asdl_seq *_loop0_86_rule(Parser *p);
static asdl_seq *_gather_87_rule(Parser *p);
static void *_tmp_88_rule(Parser *p);
static asdl_seq *_loop0_89_rule(Parser *p);
static asdl_seq *_gather_90_rule(Parser *p);
static asdl_seq *_loop0_91_rule(Parser *p);
static asdl_seq *_gather_92_rule(Parser *p);
static asdl_seq *_loop0_93_rule(Parser *p);
static asdl_seq *_loop0_94_rule(Parser *p);
static asdl_seq *_gather_95_rule(Parser *p);
static asdl_seq *_loop1_96_rule(Parser *p);
static void *_tmp_97_rule(Parser *p);
static asdl_seq *_loop0_98_rule(Parser *p);
static asdl_seq *_gather_99_rule(Parser *p);
static asdl_seq *_loop0_100_rule(Parser *p);
static asdl_seq *_gather_101_rule(Parser *p);
static void *_tmp_102_rule(Parser *p);
static void *_tmp_103_rule(Parser *p);
static asdl_seq *_loop0_104_rule(Parser *p);
static asdl_seq *_gather_105_rule(Parser *p);
static void *_tmp_106_rule(Parser *p);
static void *_tmp_107_rule(Parser *p);
static void *_tmp_108_rule(Parser *p);
static void *_tmp_109_rule(Parser *p);
static void *_tmp_110_rule(Parser *p);
static void *_tmp_111_rule(Parser *p);
static void *_tmp_112_rule(Parser *p);
static void *_tmp_113_rule(Parser *p);
static void *_tmp_114_rule(Parser *p);
static asdl_seq *_loop0_115_rule(Parser *p);
static asdl_seq *_loop0_116_rule(Parser *p);
static void *_tmp_117_rule(Parser *p);
static void *_tmp_118_rule(Parser *p);
static void *_tmp_119_rule(Parser *p);
static void *_tmp_120_rule(Parser *p);
static void *_tmp_121_rule(Parser *p);
static void *_tmp_122_rule(Parser *p);
static void *_tmp_123_rule(Parser *p);
static void *_tmp_124_rule(Parser *p);
static void *_tmp_125_rule(Parser *p);
static asdl_seq *_loop0_126_rule(Parser *p);
static asdl_seq *_gather_127_rule(Parser *p);
static void *_tmp_128_rule(Parser *p);
static void *_tmp_129_rule(Parser *p);
static void *_tmp_130_rule(Parser *p);
static void *_tmp_131_rule(Parser *p);
static asdl_seq *_loop0_132_rule(Parser *p);
static asdl_seq *_gather_133_rule(Parser *p);
static asdl_seq *_loop0_134_rule(Parser *p);
static asdl_seq *_gather_135_rule(Parser *p);
static asdl_seq *_loop0_136_rule(Parser *p);
static asdl_seq *_gather_137_rule(Parser *p);
static void *_tmp_138_rule(Parser *p);
static asdl_seq *_loop0_139_rule(Parser *p);
static void *_tmp_140_rule(Parser *p);
static void *_tmp_141_rule(Parser *p);
static void *_tmp_142_rule(Parser *p);
static void *_tmp_143_rule(Parser *p);
static void *_tmp_144_rule(Parser *p);
static void *_tmp_145_rule(Parser *p);
static void *_tmp_146_rule(Parser *p);
static void *_tmp_147_rule(Parser *p);
static void *_tmp_148_rule(Parser *p);
static void *_tmp_149_rule(Parser *p);
static void *_tmp_150_rule(Parser *p);
static void *_tmp_151_rule(Parser *p);
static void *_tmp_152_rule(Parser *p);
static void *_tmp_153_rule(Parser *p);
static void *_tmp_154_rule(Parser *p);
static void *_tmp_155_rule(Parser *p);
static void *_tmp_156_rule(Parser *p);
static void *_tmp_157_rule(Parser *p);
static void *_tmp_158_rule(Parser *p);
static void *_tmp_159_rule(Parser *p);
static void *_tmp_160_rule(Parser *p);
static void *_tmp_161_rule(Parser *p);
static void *_tmp_162_rule(Parser *p);
static void *_tmp_163_rule(Parser *p);
static void *_tmp_164_rule(Parser *p);
static asdl_seq *_loop0_165_rule(Parser *p);
static void *_tmp_166_rule(Parser *p);
static void *_tmp_167_rule(Parser *p);
static void *_tmp_168_rule(Parser *p);
static void *_tmp_169_rule(Parser *p);
// file: statements? $
static mod_ty
file_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
mod_ty _res = NULL;
int _mark = p->mark;
{ // statements? $
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $"));
void *a;
Token * endmarker_var;
if (
(a = statements_rule(p), !p->error_indicator) // statements?
&&
(endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
)
{
D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $"));
_res = _PyPegen_make_module ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// interactive: statement_newline
static mod_ty
interactive_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
mod_ty _res = NULL;
int _mark = p->mark;
{ // statement_newline
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline"));
asdl_stmt_seq* a;
if (
(a = statement_newline_rule(p)) // statement_newline
)
{
D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline"));
_res = _PyAST_Interactive ( a , p -> arena );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// eval: expressions NEWLINE* $
static mod_ty
eval_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
mod_ty _res = NULL;
int _mark = p->mark;
{ // expressions NEWLINE* $
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
asdl_seq * _loop0_1_var;
expr_ty a;
Token * endmarker_var;
if (
(a = expressions_rule(p)) // expressions
&&
(_loop0_1_var = _loop0_1_rule(p)) // NEWLINE*
&&
(endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
)
{
D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
_res = _PyAST_Expression ( a , p -> arena );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
static mod_ty
func_type_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
mod_ty _res = NULL;
int _mark = p->mark;
{ // '(' type_expressions? ')' '->' expression NEWLINE* $
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
Token * _literal;
Token * _literal_1;
Token * _literal_2;
asdl_seq * _loop0_1_var;
void *a;
expr_ty b;
Token * endmarker_var;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = type_expressions_rule(p), !p->error_indicator) // type_expressions?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
&&
(_literal_2 = _PyPegen_expect_token(p, 51)) // token='->'
&&
(b = expression_rule(p)) // expression
&&
(_loop0_1_var = _loop0_1_rule(p)) // NEWLINE*
&&
(endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
)
{
D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
_res = _PyAST_FunctionType ( a , b , p -> arena );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// statements: statement+
static asdl_stmt_seq*
statements_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_stmt_seq* _res = NULL;
int _mark = p->mark;
{ // statement+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
asdl_seq * a;
if (
(a = _loop1_2_rule(p)) // statement+
)
{
D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
_res = ( asdl_stmt_seq* ) _PyPegen_seq_flatten ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// statement: compound_stmt | simple_stmts
static asdl_stmt_seq*
statement_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_stmt_seq* _res = NULL;
int _mark = p->mark;
{ // compound_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
stmt_ty a;
if (
(a = compound_stmt_rule(p)) // compound_stmt
)
{
D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
_res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt"));
}
{ // simple_stmts
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
asdl_stmt_seq* a;
if (
(a = (asdl_stmt_seq*)simple_stmts_rule(p)) // simple_stmts
)
{
D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// statement_newline: compound_stmt NEWLINE | simple_stmts | NEWLINE | $
static asdl_stmt_seq*
statement_newline_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_stmt_seq* _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // compound_stmt NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
stmt_ty a;
Token * newline_var;
if (
(a = compound_stmt_rule(p)) // compound_stmt
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
_res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE"));
}
{ // simple_stmts
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
asdl_stmt_seq* simple_stmts_var;
if (
(simple_stmts_var = simple_stmts_rule(p)) // simple_stmts
)
{
D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
_res = simple_stmts_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts"));
}
{ // NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
Token * newline_var;
if (
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , CHECK ( stmt_ty , _PyAST_Pass ( EXTRA ) ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
}
{ // $
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$"));
Token * endmarker_var;
if (
(endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
)
{
D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
_res = _PyPegen_interactive_exit ( p );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// simple_stmts: simple_stmt !';' NEWLINE | ';'.simple_stmt+ ';'? NEWLINE
static asdl_stmt_seq*
simple_stmts_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_stmt_seq* _res = NULL;
int _mark = p->mark;
{ // simple_stmt !';' NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE"));
stmt_ty a;
Token * newline_var;
if (
(a = simple_stmt_rule(p)) // simple_stmt
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE"));
_res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt !';' NEWLINE"));
}
{ // ';'.simple_stmt+ ';'? NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_stmt_seq* a;
Token * newline_var;
if (
(a = (asdl_stmt_seq*)_gather_4_rule(p)) // ';'.simple_stmt+
&&
(_opt_var = _PyPegen_expect_token(p, 13), !p->error_indicator) // ';'?
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// simple_stmt:
// | assignment
// | &"type" type_alias
// | star_expressions
// | &'return' return_stmt
// | &('import' | 'from') import_stmt
// | &'raise' raise_stmt
// | 'pass'
// | &'del' del_stmt
// | &'yield' yield_stmt
// | &'assert' assert_stmt
// | 'break'
// | 'continue'
// | &'global' global_stmt
// | &'nonlocal' nonlocal_stmt
static stmt_ty
simple_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
if (_PyPegen_is_memoized(p, simple_stmt_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // assignment
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment"));
stmt_ty assignment_var;
if (
(assignment_var = assignment_rule(p)) // assignment
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment"));
_res = assignment_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment"));
}
{ // &"type" type_alias
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&\"type\" type_alias"));
stmt_ty type_alias_var;
if (
_PyPegen_lookahead_with_string(1, _PyPegen_expect_soft_keyword, p, "type")
&&
(type_alias_var = type_alias_rule(p)) // type_alias
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&\"type\" type_alias"));
_res = type_alias_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&\"type\" type_alias"));
}
{ // star_expressions
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
expr_ty e;
if (
(e = star_expressions_rule(p)) // star_expressions
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Expr ( e , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
}
{ // &'return' return_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
stmt_ty return_stmt_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 522) // token='return'
&&
(return_stmt_var = return_stmt_rule(p)) // return_stmt
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
_res = return_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt"));
}
{ // &('import' | 'from') import_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
stmt_ty import_stmt_var;
if (
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_5_rule, p)
&&
(import_stmt_var = import_stmt_rule(p)) // import_stmt
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
_res = import_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt"));
}
{ // &'raise' raise_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
stmt_ty raise_stmt_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 525) // token='raise'
&&
(raise_stmt_var = raise_stmt_rule(p)) // raise_stmt
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
_res = raise_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt"));
}
{ // 'pass'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 504)) // token='pass'
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Pass ( EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'"));
}
{ // &'del' del_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
stmt_ty del_stmt_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 613) // token='del'
&&
(del_stmt_var = del_stmt_rule(p)) // del_stmt
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
_res = del_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt"));
}
{ // &'yield' yield_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
stmt_ty yield_stmt_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 580) // token='yield'
&&
(yield_stmt_var = yield_stmt_rule(p)) // yield_stmt
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
_res = yield_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt"));
}
{ // &'assert' assert_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
stmt_ty assert_stmt_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 529) // token='assert'
&&
(assert_stmt_var = assert_stmt_rule(p)) // assert_stmt
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
_res = assert_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt"));
}
{ // 'break'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 508)) // token='break'
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Break ( EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'"));
}
{ // 'continue'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 509)) // token='continue'
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Continue ( EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'"));
}
{ // &'global' global_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
stmt_ty global_stmt_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 526) // token='global'
&&
(global_stmt_var = global_stmt_rule(p)) // global_stmt
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
_res = global_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt"));
}
{ // &'nonlocal' nonlocal_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
stmt_ty nonlocal_stmt_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 527) // token='nonlocal'
&&
(nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt
)
{
D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
_res = nonlocal_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, simple_stmt_type, _res);
p->level--;
return _res;
}
// compound_stmt:
// | &('def' | '@' | 'async') function_def
// | &'if' if_stmt
// | &('class' | '@') class_def
// | &('with' | 'async') with_stmt
// | &('for' | 'async') for_stmt
// | &'try' try_stmt
// | &'while' while_stmt
// | match_stmt
static stmt_ty
compound_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
{ // &('def' | '@' | 'async') function_def
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | 'async') function_def"));
stmt_ty function_def_var;
if (
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_6_rule, p)
&&
(function_def_var = function_def_rule(p)) // function_def
)
{
D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | 'async') function_def"));
_res = function_def_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | 'async') function_def"));
}
{ // &'if' if_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
stmt_ty if_stmt_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 668) // token='if'
&&
(if_stmt_var = if_stmt_rule(p)) // if_stmt
)
{
D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
_res = if_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt"));
}
{ // &('class' | '@') class_def
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
stmt_ty class_def_var;
if (
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_7_rule, p)
&&
(class_def_var = class_def_rule(p)) // class_def
)
{
D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
_res = class_def_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def"));
}
{ // &('with' | 'async') with_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | 'async') with_stmt"));
stmt_ty with_stmt_var;
if (
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_8_rule, p)
&&
(with_stmt_var = with_stmt_rule(p)) // with_stmt
)
{
D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | 'async') with_stmt"));
_res = with_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | 'async') with_stmt"));
}
{ // &('for' | 'async') for_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | 'async') for_stmt"));
stmt_ty for_stmt_var;
if (
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_9_rule, p)
&&
(for_stmt_var = for_stmt_rule(p)) // for_stmt
)
{
D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | 'async') for_stmt"));
_res = for_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | 'async') for_stmt"));
}
{ // &'try' try_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
stmt_ty try_stmt_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 642) // token='try'
&&
(try_stmt_var = try_stmt_rule(p)) // try_stmt
)
{
D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
_res = try_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt"));
}
{ // &'while' while_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
stmt_ty while_stmt_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 673) // token='while'
&&
(while_stmt_var = while_stmt_rule(p)) // while_stmt
)
{
D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
_res = while_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt"));
}
{ // match_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "match_stmt"));
stmt_ty match_stmt_var;
if (
(match_stmt_var = match_stmt_rule(p)) // match_stmt
)
{
D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "match_stmt"));
_res = match_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "match_stmt"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// assignment:
// | NAME ':' expression ['=' annotated_rhs]
// | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
// | ((star_targets '='))+ annotated_rhs !'=' TYPE_COMMENT?
// | single_target augassign ~ annotated_rhs
// | invalid_assignment
static stmt_ty
assignment_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // NAME ':' expression ['=' annotated_rhs]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
Token * _literal;
expr_ty a;
expr_ty b;
void *c;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = expression_rule(p)) // expression
&&
(c = _tmp_10_rule(p), !p->error_indicator) // ['=' annotated_rhs]
)
{
D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotation syntax is" , _PyAST_AnnAssign ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
}
{ // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
Token * _literal;
void *a;
expr_ty b;
void *c;
if (
(a = _tmp_11_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = expression_rule(p)) // expression
&&
(c = _tmp_10_rule(p), !p->error_indicator) // ['=' annotated_rhs]
)
{
D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotations syntax is" , _PyAST_AnnAssign ( a , b , c , 0 , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
}
{ // ((star_targets '='))+ annotated_rhs !'=' TYPE_COMMENT?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ annotated_rhs !'=' TYPE_COMMENT?"));
asdl_expr_seq* a;
expr_ty b;
void *tc;
if (
(a = (asdl_expr_seq*)_loop1_12_rule(p)) // ((star_targets '='))+
&&
(b = annotated_rhs_rule(p)) // annotated_rhs
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
)
{
D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ annotated_rhs !'=' TYPE_COMMENT?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ annotated_rhs !'=' TYPE_COMMENT?"));
}
{ // single_target augassign ~ annotated_rhs
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ annotated_rhs"));
int _cut_var = 0;
expr_ty a;
AugOperator* b;
expr_ty c;
if (
(a = single_target_rule(p)) // single_target
&&
(b = augassign_rule(p)) // augassign
&&
(_cut_var = 1)
&&
(c = annotated_rhs_rule(p)) // annotated_rhs
)
{
D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ annotated_rhs"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_AugAssign ( a , b -> kind , c , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ annotated_rhs"));
if (_cut_var) {
p->level--;
return NULL;
}
}
if (p->call_invalid_rules) { // invalid_assignment
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
void *invalid_assignment_var;
if (
(invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment
)
{
D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
_res = invalid_assignment_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// annotated_rhs: yield_expr | star_expressions
static expr_ty
annotated_rhs_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // yield_expr
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
expr_ty yield_expr_var;
if (
(yield_expr_var = yield_expr_rule(p)) // yield_expr
)
{
D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
_res = yield_expr_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
}
{ // star_expressions
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
expr_ty star_expressions_var;
if (
(star_expressions_var = star_expressions_rule(p)) // star_expressions
)
{
D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
_res = star_expressions_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// augassign:
// | '+='
// | '-='
// | '*='
// | '@='
// | '/='
// | '%='
// | '&='
// | '|='
// | '^='
// | '<<='
// | '>>='
// | '**='
// | '//='
static AugOperator*
augassign_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
AugOperator* _res = NULL;
int _mark = p->mark;
{ // '+='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 36)) // token='+='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
_res = _PyPegen_augoperator ( p , Add );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='"));
}
{ // '-='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 37)) // token='-='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
_res = _PyPegen_augoperator ( p , Sub );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='"));
}
{ // '*='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 38)) // token='*='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
_res = _PyPegen_augoperator ( p , Mult );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='"));
}
{ // '@='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 50)) // token='@='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
_res = CHECK_VERSION ( AugOperator* , 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='"));
}
{ // '/='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 39)) // token='/='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
_res = _PyPegen_augoperator ( p , Div );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='"));
}
{ // '%='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 40)) // token='%='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
_res = _PyPegen_augoperator ( p , Mod );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='"));
}
{ // '&='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 41)) // token='&='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
_res = _PyPegen_augoperator ( p , BitAnd );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='"));
}
{ // '|='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 42)) // token='|='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
_res = _PyPegen_augoperator ( p , BitOr );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='"));
}
{ // '^='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 43)) // token='^='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
_res = _PyPegen_augoperator ( p , BitXor );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='"));
}
{ // '<<='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 44)) // token='<<='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
_res = _PyPegen_augoperator ( p , LShift );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='"));
}
{ // '>>='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 45)) // token='>>='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
_res = _PyPegen_augoperator ( p , RShift );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='"));
}
{ // '**='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 46)) // token='**='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
_res = _PyPegen_augoperator ( p , Pow );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='"));
}
{ // '//='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 48)) // token='//='
)
{
D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
_res = _PyPegen_augoperator ( p , FloorDiv );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// return_stmt: 'return' star_expressions?
static stmt_ty
return_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'return' star_expressions?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
Token * _keyword;
void *a;
if (
(_keyword = _PyPegen_expect_token(p, 522)) // token='return'
&&
(a = star_expressions_rule(p), !p->error_indicator) // star_expressions?
)
{
D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Return ( a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// raise_stmt: 'raise' expression ['from' expression] | 'raise'
static stmt_ty
raise_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'raise' expression ['from' expression]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
Token * _keyword;
expr_ty a;
void *b;
if (
(_keyword = _PyPegen_expect_token(p, 525)) // token='raise'
&&
(a = expression_rule(p)) // expression
&&
(b = _tmp_13_rule(p), !p->error_indicator) // ['from' expression]
)
{
D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Raise ( a , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
}
{ // 'raise'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 525)) // token='raise'
)
{
D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Raise ( NULL , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// global_stmt: 'global' ','.NAME+
static stmt_ty
global_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'global' ','.NAME+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
Token * _keyword;
asdl_expr_seq* a;
if (
(_keyword = _PyPegen_expect_token(p, 526)) // token='global'
&&
(a = (asdl_expr_seq*)_gather_15_rule(p)) // ','.NAME+
)
{
D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Global ( CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// nonlocal_stmt: 'nonlocal' ','.NAME+
static stmt_ty
nonlocal_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'nonlocal' ','.NAME+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
Token * _keyword;
asdl_expr_seq* a;
if (
(_keyword = _PyPegen_expect_token(p, 527)) // token='nonlocal'
&&
(a = (asdl_expr_seq*)_gather_15_rule(p)) // ','.NAME+
)
{
D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Nonlocal ( CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
static stmt_ty
del_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'del' del_targets &(';' | NEWLINE)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
Token * _keyword;
asdl_expr_seq* a;
if (
(_keyword = _PyPegen_expect_token(p, 613)) // token='del'
&&
(a = del_targets_rule(p)) // del_targets
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_16_rule, p)
)
{
D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Delete ( a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
}
if (p->call_invalid_rules) { // invalid_del_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
void *invalid_del_stmt_var;
if (
(invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt
)
{
D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
_res = invalid_del_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// yield_stmt: yield_expr
static stmt_ty
yield_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // yield_expr
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
expr_ty y;
if (
(y = yield_expr_rule(p)) // yield_expr
)
{
D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Expr ( y , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// assert_stmt: 'assert' expression [',' expression]
static stmt_ty
assert_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'assert' expression [',' expression]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
Token * _keyword;
expr_ty a;
void *b;
if (
(_keyword = _PyPegen_expect_token(p, 529)) // token='assert'
&&
(a = expression_rule(p)) // expression
&&
(b = _tmp_17_rule(p), !p->error_indicator) // [',' expression]
)
{
D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Assert ( a , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// import_stmt: invalid_import | import_name | import_from
static stmt_ty
import_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->call_invalid_rules) { // invalid_import
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import"));
void *invalid_import_var;
if (
(invalid_import_var = invalid_import_rule(p)) // invalid_import
)
{
D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import"));
_res = invalid_import_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import"));
}
{ // import_name
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name"));
stmt_ty import_name_var;
if (
(import_name_var = import_name_rule(p)) // import_name
)
{
D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name"));
_res = import_name_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name"));
}
{ // import_from
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from"));
stmt_ty import_from_var;
if (
(import_from_var = import_from_rule(p)) // import_from
)
{
D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from"));
_res = import_from_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// import_name: 'import' dotted_as_names
static stmt_ty
import_name_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'import' dotted_as_names
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
Token * _keyword;
asdl_alias_seq* a;
if (
(_keyword = _PyPegen_expect_token(p, 622)) // token='import'
&&
(a = dotted_as_names_rule(p)) // dotted_as_names
)
{
D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Import ( a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// import_from:
// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
// | 'from' (('.' | '...'))+ 'import' import_from_targets
static stmt_ty
import_from_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
Token * _keyword;
Token * _keyword_1;
asdl_seq * a;
expr_ty b;
asdl_alias_seq* c;
if (
(_keyword = _PyPegen_expect_token(p, 621)) // token='from'
&&
(a = _loop0_18_rule(p)) // (('.' | '...'))*
&&
(b = dotted_name_rule(p)) // dotted_name
&&
(_keyword_1 = _PyPegen_expect_token(p, 622)) // token='import'
&&
(c = import_from_targets_rule(p)) // import_from_targets
)
{
D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
}
{ // 'from' (('.' | '...'))+ 'import' import_from_targets
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
Token * _keyword;
Token * _keyword_1;
asdl_seq * a;
asdl_alias_seq* b;
if (
(_keyword = _PyPegen_expect_token(p, 621)) // token='from'
&&
(a = _loop1_19_rule(p)) // (('.' | '...'))+
&&
(_keyword_1 = _PyPegen_expect_token(p, 622)) // token='import'
&&
(b = import_from_targets_rule(p)) // import_from_targets
)
{
D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// import_from_targets:
// | '(' import_from_as_names ','? ')'
// | import_from_as_names !','
// | '*'
// | invalid_import_from_targets
static asdl_alias_seq*
import_from_targets_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_alias_seq* _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '(' import_from_as_names ','? ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
Token * _literal;
Token * _literal_1;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_alias_seq* a;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = import_from_as_names_rule(p)) // import_from_as_names
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'"));
}
{ // import_from_as_names !','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
asdl_alias_seq* import_from_as_names_var;
if (
(import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
)
{
D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
_res = import_from_as_names_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','"));
}
{ // '*'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
)
{
D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = ( asdl_alias_seq* ) _PyPegen_singleton_seq ( p , CHECK ( alias_ty , _PyPegen_alias_for_star ( p , EXTRA ) ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
}
if (p->call_invalid_rules) { // invalid_import_from_targets
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
void *invalid_import_from_targets_var;
if (
(invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets
)
{
D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
_res = invalid_import_from_targets_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// import_from_as_names: ','.import_from_as_name+
static asdl_alias_seq*
import_from_as_names_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_alias_seq* _res = NULL;
int _mark = p->mark;
{ // ','.import_from_as_name+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
asdl_alias_seq* a;
if (
(a = (asdl_alias_seq*)_gather_21_rule(p)) // ','.import_from_as_name+
)
{
D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// import_from_as_name: NAME ['as' NAME]
static alias_ty
import_from_as_name_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
alias_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // NAME ['as' NAME]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
expr_ty a;
void *b;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
(b = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
)
{
D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// dotted_as_names: ','.dotted_as_name+
static asdl_alias_seq*
dotted_as_names_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_alias_seq* _res = NULL;
int _mark = p->mark;
{ // ','.dotted_as_name+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
asdl_alias_seq* a;
if (
(a = (asdl_alias_seq*)_gather_24_rule(p)) // ','.dotted_as_name+
)
{
D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// dotted_as_name: dotted_name ['as' NAME]
static alias_ty
dotted_as_name_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
alias_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // dotted_name ['as' NAME]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
expr_ty a;
void *b;
if (
(a = dotted_name_rule(p)) // dotted_name
&&
(b = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
)
{
D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// Left-recursive
// dotted_name: dotted_name '.' NAME | NAME
static expr_ty dotted_name_raw(Parser *);
static expr_ty
dotted_name_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
int _resmark = p->mark;
while (1) {
int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res);
if (tmpvar_0) {
p->level--;
return _res;
}
p->mark = _mark;
void *_raw = dotted_name_raw(p);
if (p->error_indicator) {
p->level--;
return NULL;
}
if (_raw == NULL || p->mark <= _resmark)
break;
_resmark = p->mark;
_res = _raw;
}
p->mark = _resmark;
p->level--;
return _res;
}
static expr_ty
dotted_name_raw(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // dotted_name '.' NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = dotted_name_rule(p)) // dotted_name
&&
(_literal = _PyPegen_expect_token(p, 23)) // token='.'
&&
(b = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
_res = _PyPegen_join_names_with_dot ( p , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME"));
}
{ // NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
expr_ty name_var;
if (
(name_var = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
_res = name_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// block: NEWLINE INDENT statements DEDENT | simple_stmts | invalid_block
static asdl_stmt_seq*
block_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_stmt_seq* _res = NULL;
if (_PyPegen_is_memoized(p, block_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
{ // NEWLINE INDENT statements DEDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
asdl_stmt_seq* a;
Token * dedent_var;
Token * indent_var;
Token * newline_var;
if (
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
(indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
&&
(a = statements_rule(p)) // statements
&&
(dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
)
{
D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
}
{ // simple_stmts
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
asdl_stmt_seq* simple_stmts_var;
if (
(simple_stmts_var = simple_stmts_rule(p)) // simple_stmts
)
{
D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
_res = simple_stmts_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts"));
}
if (p->call_invalid_rules) { // invalid_block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
void *invalid_block_var;
if (
(invalid_block_var = invalid_block_rule(p)) // invalid_block
)
{
D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
_res = invalid_block_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, block_type, _res);
p->level--;
return _res;
}
// decorators: (('@' named_expression NEWLINE))+
static asdl_expr_seq*
decorators_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_expr_seq* _res = NULL;
int _mark = p->mark;
{ // (('@' named_expression NEWLINE))+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
asdl_expr_seq* a;
if (
(a = (asdl_expr_seq*)_loop1_25_rule(p)) // (('@' named_expression NEWLINE))+
)
{
D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// class_def: decorators class_def_raw | class_def_raw
static stmt_ty
class_def_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
{ // decorators class_def_raw
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
asdl_expr_seq* a;
stmt_ty b;
if (
(a = decorators_rule(p)) // decorators
&&
(b = class_def_raw_rule(p)) // class_def_raw
)
{
D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
_res = _PyPegen_class_def_decorators ( p , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
}
{ // class_def_raw
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
stmt_ty class_def_raw_var;
if (
(class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
)
{
D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
_res = class_def_raw_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// class_def_raw:
// | invalid_class_def_raw
// | 'class' NAME type_params? ['(' arguments? ')'] ':' block
static stmt_ty
class_def_raw_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_class_def_raw
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw"));
void *invalid_class_def_raw_var;
if (
(invalid_class_def_raw_var = invalid_class_def_raw_rule(p)) // invalid_class_def_raw
)
{
D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw"));
_res = invalid_class_def_raw_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_class_def_raw"));
}
{ // 'class' NAME type_params? ['(' arguments? ')'] ':' block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' block"));
Token * _keyword;
Token * _literal;
expr_ty a;
void *b;
asdl_stmt_seq* c;
void *t;
if (
(_keyword = _PyPegen_expect_token(p, 685)) // token='class'
&&
(a = _PyPegen_name_token(p)) // NAME
&&
(t = type_params_rule(p), !p->error_indicator) // type_params?
&&
(b = _tmp_26_rule(p), !p->error_indicator) // ['(' arguments? ')']
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(c = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' block"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , t , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' block"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// function_def: decorators function_def_raw | function_def_raw
static stmt_ty
function_def_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
{ // decorators function_def_raw
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
asdl_expr_seq* d;
stmt_ty f;
if (
(d = decorators_rule(p)) // decorators
&&
(f = function_def_raw_rule(p)) // function_def_raw
)
{
D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
_res = _PyPegen_function_def_decorators ( p , d , f );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
}
{ // function_def_raw
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
stmt_ty function_def_raw_var;
if (
(function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
)
{
D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
_res = function_def_raw_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// function_def_raw:
// | invalid_def_raw
// | 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block
// | 'async' 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block
static stmt_ty
function_def_raw_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_def_raw
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_def_raw"));
void *invalid_def_raw_var;
if (
(invalid_def_raw_var = invalid_def_raw_rule(p)) // invalid_def_raw
)
{
D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_def_raw"));
_res = invalid_def_raw_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_def_raw"));
}
{ // 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block"));
Token * _keyword;
Token * _literal;
Token * _literal_1;
Token * _literal_2;
void *a;
asdl_stmt_seq* b;
expr_ty n;
void *params;
void *t;
void *tc;
if (
(_keyword = _PyPegen_expect_token(p, 683)) // token='def'
&&
(n = _PyPegen_name_token(p)) // NAME
&&
(t = type_params_rule(p), !p->error_indicator) // type_params?
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(params = params_rule(p), !p->error_indicator) // params?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
&&
(a = _tmp_27_rule(p), !p->error_indicator) // ['->' expression]
&&
(_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
&&
(tc = func_type_comment_rule(p), !p->error_indicator) // func_type_comment?
&&
(b = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , t , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block"));
}
{ // 'async' 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async' 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block"));
Token * _keyword;
Token * _keyword_1;
Token * _literal;
Token * _literal_1;
Token * _literal_2;
void *a;
asdl_stmt_seq* b;
expr_ty n;
void *params;
void *t;
void *tc;
if (
(_keyword = _PyPegen_expect_token(p, 682)) // token='async'
&&
(_keyword_1 = _PyPegen_expect_token(p, 683)) // token='def'
&&
(n = _PyPegen_name_token(p)) // NAME
&&
(t = type_params_rule(p), !p->error_indicator) // type_params?
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(params = params_rule(p), !p->error_indicator) // params?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
&&
(a = _tmp_27_rule(p), !p->error_indicator) // ['->' expression]
&&
(_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
&&
(tc = func_type_comment_rule(p), !p->error_indicator) // func_type_comment?
&&
(b = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async' 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( stmt_ty , 5 , "Async functions are" , _PyAST_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , t , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async' 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// params: invalid_parameters | parameters
static arguments_ty
params_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arguments_ty _res = NULL;
int _mark = p->mark;
if (p->call_invalid_rules) { // invalid_parameters
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
void *invalid_parameters_var;
if (
(invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
)
{
D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
_res = invalid_parameters_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
}
{ // parameters
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
arguments_ty parameters_var;
if (
(parameters_var = parameters_rule(p)) // parameters
)
{
D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
_res = parameters_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// parameters:
// | slash_no_default param_no_default* param_with_default* star_etc?
// | slash_with_default param_with_default* star_etc?
// | param_no_default+ param_with_default* star_etc?
// | param_with_default+ star_etc?
// | star_etc
static arguments_ty
parameters_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arguments_ty _res = NULL;
int _mark = p->mark;
{ // slash_no_default param_no_default* param_with_default* star_etc?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
asdl_arg_seq* a;
asdl_arg_seq* b;
asdl_seq * c;
void *d;
if (
(a = slash_no_default_rule(p)) // slash_no_default
&&
(b = (asdl_arg_seq*)_loop0_28_rule(p)) // param_no_default*
&&
(c = _loop0_29_rule(p)) // param_with_default*
&&
(d = star_etc_rule(p), !p->error_indicator) // star_etc?
)
{
D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
_res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , a , NULL , b , c , d ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
}
{ // slash_with_default param_with_default* star_etc?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
SlashWithDefault* a;
asdl_seq * b;
void *c;
if (
(a = slash_with_default_rule(p)) // slash_with_default
&&
(b = _loop0_29_rule(p)) // param_with_default*
&&
(c = star_etc_rule(p), !p->error_indicator) // star_etc?
)
{
D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
_res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
}
{ // param_no_default+ param_with_default* star_etc?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
asdl_arg_seq* a;
asdl_seq * b;
void *c;
if (
(a = (asdl_arg_seq*)_loop1_30_rule(p)) // param_no_default+
&&
(b = _loop0_29_rule(p)) // param_with_default*
&&
(c = star_etc_rule(p), !p->error_indicator) // star_etc?
)
{
D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
_res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
}
{ // param_with_default+ star_etc?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
asdl_seq * a;
void *b;
if (
(a = _loop1_31_rule(p)) // param_with_default+
&&
(b = star_etc_rule(p), !p->error_indicator) // star_etc?
)
{
D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
_res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
}
{ // star_etc
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
StarEtc* a;
if (
(a = star_etc_rule(p)) // star_etc
)
{
D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
_res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
static asdl_arg_seq*
slash_no_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_arg_seq* _res = NULL;
int _mark = p->mark;
{ // param_no_default+ '/' ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
Token * _literal;
Token * _literal_1;
asdl_arg_seq* a;
if (
(a = (asdl_arg_seq*)_loop1_30_rule(p)) // param_no_default+
&&
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
}
{ // param_no_default+ '/' &')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
Token * _literal;
asdl_arg_seq* a;
if (
(a = (asdl_arg_seq*)_loop1_30_rule(p)) // param_no_default+
&&
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
)
{
D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// slash_with_default:
// | param_no_default* param_with_default+ '/' ','
// | param_no_default* param_with_default+ '/' &')'
static SlashWithDefault*
slash_with_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
SlashWithDefault* _res = NULL;
int _mark = p->mark;
{ // param_no_default* param_with_default+ '/' ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
Token * _literal;
Token * _literal_1;
asdl_seq * a;
asdl_seq * b;
if (
(a = _loop0_28_rule(p)) // param_no_default*
&&
(b = _loop1_31_rule(p)) // param_with_default+
&&
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
_res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
}
{ // param_no_default* param_with_default+ '/' &')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
Token * _literal;
asdl_seq * a;
asdl_seq * b;
if (
(a = _loop0_28_rule(p)) // param_no_default*
&&
(b = _loop1_31_rule(p)) // param_with_default+
&&
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
)
{
D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
_res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// star_etc:
// | invalid_star_etc
// | '*' param_no_default param_maybe_default* kwds?
// | '*' param_no_default_star_annotation param_maybe_default* kwds?
// | '*' ',' param_maybe_default+ kwds?
// | kwds
static StarEtc*
star_etc_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
StarEtc* _res = NULL;
int _mark = p->mark;
if (p->call_invalid_rules) { // invalid_star_etc
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
void *invalid_star_etc_var;
if (
(invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
)
{
D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
_res = invalid_star_etc_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
}
{ // '*' param_no_default param_maybe_default* kwds?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
Token * _literal;
arg_ty a;
asdl_seq * b;
void *c;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = param_no_default_rule(p)) // param_no_default
&&
(b = _loop0_32_rule(p)) // param_maybe_default*
&&
(c = kwds_rule(p), !p->error_indicator) // kwds?
)
{
D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
_res = _PyPegen_star_etc ( p , a , b , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
}
{ // '*' param_no_default_star_annotation param_maybe_default* kwds?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default_star_annotation param_maybe_default* kwds?"));
Token * _literal;
arg_ty a;
asdl_seq * b;
void *c;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = param_no_default_star_annotation_rule(p)) // param_no_default_star_annotation
&&
(b = _loop0_32_rule(p)) // param_maybe_default*
&&
(c = kwds_rule(p), !p->error_indicator) // kwds?
)
{
D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default_star_annotation param_maybe_default* kwds?"));
_res = _PyPegen_star_etc ( p , a , b , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default_star_annotation param_maybe_default* kwds?"));
}
{ // '*' ',' param_maybe_default+ kwds?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
Token * _literal;
Token * _literal_1;
asdl_seq * b;
void *c;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
(b = _loop1_33_rule(p)) // param_maybe_default+
&&
(c = kwds_rule(p), !p->error_indicator) // kwds?
)
{
D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
_res = _PyPegen_star_etc ( p , NULL , b , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
}
{ // kwds
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
arg_ty a;
if (
(a = kwds_rule(p)) // kwds
)
{
D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
_res = _PyPegen_star_etc ( p , NULL , NULL , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// kwds: invalid_kwds | '**' param_no_default
static arg_ty
kwds_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arg_ty _res = NULL;
int _mark = p->mark;
if (p->call_invalid_rules) { // invalid_kwds
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwds"));
void *invalid_kwds_var;
if (
(invalid_kwds_var = invalid_kwds_rule(p)) // invalid_kwds
)
{
D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwds"));
_res = invalid_kwds_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwds"));
}
{ // '**' param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
Token * _literal;
arg_ty a;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(a = param_no_default_rule(p)) // param_no_default
)
{
D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
static arg_ty
param_no_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arg_ty _res = NULL;
int _mark = p->mark;
{ // param ',' TYPE_COMMENT?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
Token * _literal;
arg_ty a;
void *tc;
if (
(a = param_rule(p)) // param
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
)
{
D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
_res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
}
{ // param TYPE_COMMENT? &')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
arg_ty a;
void *tc;
if (
(a = param_rule(p)) // param
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
)
{
D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
_res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// param_no_default_star_annotation:
// | param_star_annotation ',' TYPE_COMMENT?
// | param_star_annotation TYPE_COMMENT? &')'
static arg_ty
param_no_default_star_annotation_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arg_ty _res = NULL;
int _mark = p->mark;
{ // param_star_annotation ',' TYPE_COMMENT?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> param_no_default_star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_star_annotation ',' TYPE_COMMENT?"));
Token * _literal;
arg_ty a;
void *tc;
if (
(a = param_star_annotation_rule(p)) // param_star_annotation
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
)
{
D(fprintf(stderr, "%*c+ param_no_default_star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_star_annotation ',' TYPE_COMMENT?"));
_res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s param_no_default_star_annotation[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_star_annotation ',' TYPE_COMMENT?"));
}
{ // param_star_annotation TYPE_COMMENT? &')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> param_no_default_star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_star_annotation TYPE_COMMENT? &')'"));
arg_ty a;
void *tc;
if (
(a = param_star_annotation_rule(p)) // param_star_annotation
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
)
{
D(fprintf(stderr, "%*c+ param_no_default_star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_star_annotation TYPE_COMMENT? &')'"));
_res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s param_no_default_star_annotation[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_star_annotation TYPE_COMMENT? &')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
static NameDefaultPair*
param_with_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
NameDefaultPair* _res = NULL;
int _mark = p->mark;
{ // param default ',' TYPE_COMMENT?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
Token * _literal;
arg_ty a;
expr_ty c;
void *tc;
if (
(a = param_rule(p)) // param
&&
(c = default_rule(p)) // default
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
)
{
D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
_res = _PyPegen_name_default_pair ( p , a , c , tc );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
}
{ // param default TYPE_COMMENT? &')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
arg_ty a;
expr_ty c;
void *tc;
if (
(a = param_rule(p)) // param
&&
(c = default_rule(p)) // default
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
)
{
D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
_res = _PyPegen_name_default_pair ( p , a , c , tc );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// param_maybe_default:
// | param default? ',' TYPE_COMMENT?
// | param default? TYPE_COMMENT? &')'
static NameDefaultPair*
param_maybe_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
NameDefaultPair* _res = NULL;
int _mark = p->mark;
{ // param default? ',' TYPE_COMMENT?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
Token * _literal;
arg_ty a;
void *c;
void *tc;
if (
(a = param_rule(p)) // param
&&
(c = default_rule(p), !p->error_indicator) // default?
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
)
{
D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
_res = _PyPegen_name_default_pair ( p , a , c , tc );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
}
{ // param default? TYPE_COMMENT? &')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
arg_ty a;
void *c;
void *tc;
if (
(a = param_rule(p)) // param
&&
(c = default_rule(p), !p->error_indicator) // default?
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
)
{
D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
_res = _PyPegen_name_default_pair ( p , a , c , tc );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// param: NAME annotation?
static arg_ty
param_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arg_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // NAME annotation?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
expr_ty a;
void *b;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
(b = annotation_rule(p), !p->error_indicator) // annotation?
)
{
D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// param_star_annotation: NAME star_annotation
static arg_ty
param_star_annotation_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arg_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // NAME star_annotation
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> param_star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME star_annotation"));
expr_ty a;
expr_ty b;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
(b = star_annotation_rule(p)) // star_annotation
)
{
D(fprintf(stderr, "%*c+ param_star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME star_annotation"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s param_star_annotation[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME star_annotation"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// annotation: ':' expression
static expr_ty
annotation_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // ':' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(a = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// star_annotation: ':' star_expression
static expr_ty
star_annotation_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // ':' star_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' star_expression"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(a = star_expression_rule(p)) // star_expression
)
{
D(fprintf(stderr, "%*c+ star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' star_expression"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_annotation[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' star_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// default: '=' expression | invalid_default
static expr_ty
default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // '=' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 22)) // token='='
&&
(a = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
}
if (p->call_invalid_rules) { // invalid_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_default"));
void *invalid_default_var;
if (
(invalid_default_var = invalid_default_rule(p)) // invalid_default
)
{
D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_default"));
_res = invalid_default_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_default"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// if_stmt:
// | invalid_if_stmt
// | 'if' named_expression ':' block elif_stmt
// | 'if' named_expression ':' block else_block?
static stmt_ty
if_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_if_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_if_stmt"));
void *invalid_if_stmt_var;
if (
(invalid_if_stmt_var = invalid_if_stmt_rule(p)) // invalid_if_stmt
)
{
D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_if_stmt"));
_res = invalid_if_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_if_stmt"));
}
{ // 'if' named_expression ':' block elif_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
Token * _keyword;
Token * _literal;
expr_ty a;
asdl_stmt_seq* b;
stmt_ty c;
if (
(_keyword = _PyPegen_expect_token(p, 668)) // token='if'
&&
(a = named_expression_rule(p)) // named_expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = block_rule(p)) // block
&&
(c = elif_stmt_rule(p)) // elif_stmt
)
{
D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq* , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
}
{ // 'if' named_expression ':' block else_block?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
Token * _keyword;
Token * _literal;
expr_ty a;
asdl_stmt_seq* b;
void *c;
if (
(_keyword = _PyPegen_expect_token(p, 668)) // token='if'
&&
(a = named_expression_rule(p)) // named_expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = block_rule(p)) // block
&&
(c = else_block_rule(p), !p->error_indicator) // else_block?
)
{
D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_If ( a , b , c , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// elif_stmt:
// | invalid_elif_stmt
// | 'elif' named_expression ':' block elif_stmt
// | 'elif' named_expression ':' block else_block?
static stmt_ty
elif_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_elif_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_elif_stmt"));
void *invalid_elif_stmt_var;
if (
(invalid_elif_stmt_var = invalid_elif_stmt_rule(p)) // invalid_elif_stmt
)
{
D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_elif_stmt"));
_res = invalid_elif_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_elif_stmt"));
}
{ // 'elif' named_expression ':' block elif_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
Token * _keyword;
Token * _literal;
expr_ty a;
asdl_stmt_seq* b;
stmt_ty c;
if (
(_keyword = _PyPegen_expect_token(p, 670)) // token='elif'
&&
(a = named_expression_rule(p)) // named_expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = block_rule(p)) // block
&&
(c = elif_stmt_rule(p)) // elif_stmt
)
{
D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq* , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
}
{ // 'elif' named_expression ':' block else_block?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
Token * _keyword;
Token * _literal;
expr_ty a;
asdl_stmt_seq* b;
void *c;
if (
(_keyword = _PyPegen_expect_token(p, 670)) // token='elif'
&&
(a = named_expression_rule(p)) // named_expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = block_rule(p)) // block
&&
(c = else_block_rule(p), !p->error_indicator) // else_block?
)
{
D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_If ( a , b , c , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// else_block: invalid_else_stmt | 'else' &&':' block
static asdl_stmt_seq*
else_block_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_stmt_seq* _res = NULL;
int _mark = p->mark;
if (p->call_invalid_rules) { // invalid_else_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_else_stmt"));
void *invalid_else_stmt_var;
if (
(invalid_else_stmt_var = invalid_else_stmt_rule(p)) // invalid_else_stmt
)
{
D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_else_stmt"));
_res = invalid_else_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_else_stmt"));
}
{ // 'else' &&':' block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' &&':' block"));
Token * _keyword;
Token * _literal;
asdl_stmt_seq* b;
if (
(_keyword = _PyPegen_expect_token(p, 671)) // token='else'
&&
(_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
&&
(b = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' &&':' block"));
_res = b;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' &&':' block"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// while_stmt: invalid_while_stmt | 'while' named_expression ':' block else_block?
static stmt_ty
while_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_while_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_while_stmt"));
void *invalid_while_stmt_var;
if (
(invalid_while_stmt_var = invalid_while_stmt_rule(p)) // invalid_while_stmt
)
{
D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_while_stmt"));
_res = invalid_while_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_while_stmt"));
}
{ // 'while' named_expression ':' block else_block?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
Token * _keyword;
Token * _literal;
expr_ty a;
asdl_stmt_seq* b;
void *c;
if (
(_keyword = _PyPegen_expect_token(p, 673)) // token='while'
&&
(a = named_expression_rule(p)) // named_expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = block_rule(p)) // block
&&
(c = else_block_rule(p), !p->error_indicator) // else_block?
)
{
D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_While ( a , b , c , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// for_stmt:
// | invalid_for_stmt
// | 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
// | 'async' 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
// | invalid_for_target
static stmt_ty
for_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_for_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_stmt"));
void *invalid_for_stmt_var;
if (
(invalid_for_stmt_var = invalid_for_stmt_rule(p)) // invalid_for_stmt
)
{
D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_stmt"));
_res = invalid_for_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_stmt"));
}
{ // 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
int _cut_var = 0;
Token * _keyword;
Token * _keyword_1;
Token * _literal;
asdl_stmt_seq* b;
void *el;
expr_ty ex;
expr_ty t;
void *tc;
if (
(_keyword = _PyPegen_expect_token(p, 678)) // token='for'
&&
(t = star_targets_rule(p)) // star_targets
&&
(_keyword_1 = _PyPegen_expect_token(p, 679)) // token='in'
&&
(_cut_var = 1)
&&
(ex = star_expressions_rule(p)) // star_expressions
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
&&
(b = block_rule(p)) // block
&&
(el = else_block_rule(p), !p->error_indicator) // else_block?
)
{
D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
if (_cut_var) {
p->level--;
return NULL;
}
}
{ // 'async' 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async' 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
int _cut_var = 0;
Token * _keyword;
Token * _keyword_1;
Token * _keyword_2;
Token * _literal;
asdl_stmt_seq* b;
void *el;
expr_ty ex;
expr_ty t;
void *tc;
if (
(_keyword = _PyPegen_expect_token(p, 682)) // token='async'
&&
(_keyword_1 = _PyPegen_expect_token(p, 678)) // token='for'
&&
(t = star_targets_rule(p)) // star_targets
&&
(_keyword_2 = _PyPegen_expect_token(p, 679)) // token='in'
&&
(_cut_var = 1)
&&
(ex = star_expressions_rule(p)) // star_expressions
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
&&
(b = block_rule(p)) // block
&&
(el = else_block_rule(p), !p->error_indicator) // else_block?
)
{
D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async' 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( stmt_ty , 5 , "Async for loops are" , _PyAST_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async' 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
if (_cut_var) {
p->level--;
return NULL;
}
}
if (p->call_invalid_rules) { // invalid_for_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
void *invalid_for_target_var;
if (
(invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
)
{
D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
_res = invalid_for_target_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// with_stmt:
// | invalid_with_stmt_indent
// | 'with' '(' ','.with_item+ ','? ')' ':' TYPE_COMMENT? block
// | 'with' ','.with_item+ ':' TYPE_COMMENT? block
// | 'async' 'with' '(' ','.with_item+ ','? ')' ':' block
// | 'async' 'with' ','.with_item+ ':' TYPE_COMMENT? block
// | invalid_with_stmt
static stmt_ty
with_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_with_stmt_indent
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt_indent"));
void *invalid_with_stmt_indent_var;
if (
(invalid_with_stmt_indent_var = invalid_with_stmt_indent_rule(p)) // invalid_with_stmt_indent
)
{
D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt_indent"));
_res = invalid_with_stmt_indent_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_stmt_indent"));
}
{ // 'with' '(' ','.with_item+ ','? ')' ':' TYPE_COMMENT? block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' TYPE_COMMENT? block"));
Token * _keyword;
Token * _literal;
Token * _literal_1;
Token * _literal_2;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_withitem_seq* a;
asdl_stmt_seq* b;
void *tc;
if (
(_keyword = _PyPegen_expect_token(p, 633)) // token='with'
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = (asdl_withitem_seq*)_gather_35_rule(p)) // ','.with_item+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
&&
(_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
&&
(b = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' TYPE_COMMENT? block"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' TYPE_COMMENT? block"));
}
{ // 'with' ','.with_item+ ':' TYPE_COMMENT? block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
Token * _keyword;
Token * _literal;
asdl_withitem_seq* a;
asdl_stmt_seq* b;
void *tc;
if (
(_keyword = _PyPegen_expect_token(p, 633)) // token='with'
&&
(a = (asdl_withitem_seq*)_gather_35_rule(p)) // ','.with_item+
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
&&
(b = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
}
{ // 'async' 'with' '(' ','.with_item+ ','? ')' ':' block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async' 'with' '(' ','.with_item+ ','? ')' ':' block"));
Token * _keyword;
Token * _keyword_1;
Token * _literal;
Token * _literal_1;
Token * _literal_2;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_withitem_seq* a;
asdl_stmt_seq* b;
if (
(_keyword = _PyPegen_expect_token(p, 682)) // token='async'
&&
(_keyword_1 = _PyPegen_expect_token(p, 633)) // token='with'
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = (asdl_withitem_seq*)_gather_35_rule(p)) // ','.with_item+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
&&
(_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async' 'with' '(' ','.with_item+ ','? ')' ':' block"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NULL , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async' 'with' '(' ','.with_item+ ','? ')' ':' block"));
}
{ // 'async' 'with' ','.with_item+ ':' TYPE_COMMENT? block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async' 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
Token * _keyword;
Token * _keyword_1;
Token * _literal;
asdl_withitem_seq* a;
asdl_stmt_seq* b;
void *tc;
if (
(_keyword = _PyPegen_expect_token(p, 682)) // token='async'
&&
(_keyword_1 = _PyPegen_expect_token(p, 633)) // token='with'
&&
(a = (asdl_withitem_seq*)_gather_35_rule(p)) // ','.with_item+
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT?
&&
(b = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async' 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async' 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
}
if (p->call_invalid_rules) { // invalid_with_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt"));
void *invalid_with_stmt_var;
if (
(invalid_with_stmt_var = invalid_with_stmt_rule(p)) // invalid_with_stmt
)
{
D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt"));
_res = invalid_with_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_stmt"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// with_item:
// | expression 'as' star_target &(',' | ')' | ':')
// | invalid_with_item
// | expression
static withitem_ty
with_item_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
withitem_ty _res = NULL;
int _mark = p->mark;
{ // expression 'as' star_target &(',' | ')' | ':')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
Token * _keyword;
expr_ty e;
expr_ty t;
if (
(e = expression_rule(p)) // expression
&&
(_keyword = _PyPegen_expect_token(p, 666)) // token='as'
&&
(t = star_target_rule(p)) // star_target
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_36_rule, p)
)
{
D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
_res = _PyAST_withitem ( e , t , p -> arena );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
}
if (p->call_invalid_rules) { // invalid_with_item
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
void *invalid_with_item_var;
if (
(invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item
)
{
D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
_res = invalid_with_item_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
}
{ // expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
expr_ty e;
if (
(e = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
_res = _PyAST_withitem ( e , NULL , p -> arena );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// try_stmt:
// | invalid_try_stmt
// | 'try' &&':' block finally_block
// | 'try' &&':' block except_block+ else_block? finally_block?
// | 'try' &&':' block except_star_block+ else_block? finally_block?
static stmt_ty
try_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_try_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_try_stmt"));
void *invalid_try_stmt_var;
if (
(invalid_try_stmt_var = invalid_try_stmt_rule(p)) // invalid_try_stmt
)
{
D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_try_stmt"));
_res = invalid_try_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_try_stmt"));
}
{ // 'try' &&':' block finally_block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block"));
Token * _keyword;
Token * _literal;
asdl_stmt_seq* b;
asdl_stmt_seq* f;
if (
(_keyword = _PyPegen_expect_token(p, 642)) // token='try'
&&
(_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
&&
(b = block_rule(p)) // block
&&
(f = finally_block_rule(p)) // finally_block
)
{
D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Try ( b , NULL , NULL , f , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block finally_block"));
}
{ // 'try' &&':' block except_block+ else_block? finally_block?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?"));
Token * _keyword;
Token * _literal;
asdl_stmt_seq* b;
void *el;
asdl_excepthandler_seq* ex;
void *f;
if (
(_keyword = _PyPegen_expect_token(p, 642)) // token='try'
&&
(_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
&&
(b = block_rule(p)) // block
&&
(ex = (asdl_excepthandler_seq*)_loop1_37_rule(p)) // except_block+
&&
(el = else_block_rule(p), !p->error_indicator) // else_block?
&&
(f = finally_block_rule(p), !p->error_indicator) // finally_block?
)
{
D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Try ( b , ex , el , f , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?"));
}
{ // 'try' &&':' block except_star_block+ else_block? finally_block?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_block?"));
Token * _keyword;
Token * _literal;
asdl_stmt_seq* b;
void *el;
asdl_excepthandler_seq* ex;
void *f;
if (
(_keyword = _PyPegen_expect_token(p, 642)) // token='try'
&&
(_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
&&
(b = block_rule(p)) // block
&&
(ex = (asdl_excepthandler_seq*)_loop1_38_rule(p)) // except_star_block+
&&
(el = else_block_rule(p), !p->error_indicator) // else_block?
&&
(f = finally_block_rule(p), !p->error_indicator) // finally_block?
)
{
D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_block?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( stmt_ty , 11 , "Exception groups are" , _PyAST_TryStar ( b , ex , el , f , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_block?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// except_block:
// | invalid_except_stmt_indent
// | 'except' expression ['as' NAME] ':' block
// | 'except' ':' block
// | invalid_except_stmt
static excepthandler_ty
except_block_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
excepthandler_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_except_stmt_indent
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt_indent"));
void *invalid_except_stmt_indent_var;
if (
(invalid_except_stmt_indent_var = invalid_except_stmt_indent_rule(p)) // invalid_except_stmt_indent
)
{
D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt_indent"));
_res = invalid_except_stmt_indent_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_stmt_indent"));
}
{ // 'except' expression ['as' NAME] ':' block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
Token * _keyword;
Token * _literal;
asdl_stmt_seq* b;
expr_ty e;
void *t;
if (
(_keyword = _PyPegen_expect_token(p, 663)) // token='except'
&&
(e = expression_rule(p)) // expression
&&
(t = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
}
{ // 'except' ':' block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
Token * _keyword;
Token * _literal;
asdl_stmt_seq* b;
if (
(_keyword = _PyPegen_expect_token(p, 663)) // token='except'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_ExceptHandler ( NULL , NULL , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
}
if (p->call_invalid_rules) { // invalid_except_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt"));
void *invalid_except_stmt_var;
if (
(invalid_except_stmt_var = invalid_except_stmt_rule(p)) // invalid_except_stmt
)
{
D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt"));
_res = invalid_except_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_stmt"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// except_star_block:
// | invalid_except_star_stmt_indent
// | 'except' '*' expression ['as' NAME] ':' block
// | invalid_except_star_stmt
static excepthandler_ty
except_star_block_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
excepthandler_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_except_star_stmt_indent
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt_indent"));
void *invalid_except_star_stmt_indent_var;
if (
(invalid_except_star_stmt_indent_var = invalid_except_star_stmt_indent_rule(p)) // invalid_except_star_stmt_indent
)
{
D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt_indent"));
_res = invalid_except_star_stmt_indent_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_star_stmt_indent"));
}
{ // 'except' '*' expression ['as' NAME] ':' block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' block"));
Token * _keyword;
Token * _literal;
Token * _literal_1;
asdl_stmt_seq* b;
expr_ty e;
void *t;
if (
(_keyword = _PyPegen_expect_token(p, 663)) // token='except'
&&
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(e = expression_rule(p)) // expression
&&
(t = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
&&
(_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' block"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] ':' block"));
}
if (p->call_invalid_rules) { // invalid_except_star_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt"));
void *invalid_except_star_stmt_var;
if (
(invalid_except_star_stmt_var = invalid_except_star_stmt_rule(p)) // invalid_except_star_stmt
)
{
D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt"));
_res = invalid_except_star_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_star_stmt"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// finally_block: invalid_finally_stmt | 'finally' &&':' block
static asdl_stmt_seq*
finally_block_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_stmt_seq* _res = NULL;
int _mark = p->mark;
if (p->call_invalid_rules) { // invalid_finally_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_finally_stmt"));
void *invalid_finally_stmt_var;
if (
(invalid_finally_stmt_var = invalid_finally_stmt_rule(p)) // invalid_finally_stmt
)
{
D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_finally_stmt"));
_res = invalid_finally_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_finally_stmt"));
}
{ // 'finally' &&':' block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' &&':' block"));
Token * _keyword;
Token * _literal;
asdl_stmt_seq* a;
if (
(_keyword = _PyPegen_expect_token(p, 659)) // token='finally'
&&
(_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
&&
(a = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' &&':' block"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' &&':' block"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// match_stmt:
// | "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT
// | invalid_match_stmt
static stmt_ty
match_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT"));
expr_ty _keyword;
Token * _literal;
asdl_match_case_seq* cases;
Token * dedent_var;
Token * indent_var;
Token * newline_var;
expr_ty subject;
if (
(_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"'
&&
(subject = subject_expr_rule(p)) // subject_expr
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
(indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
&&
(cases = (asdl_match_case_seq*)_loop1_39_rule(p)) // case_block+
&&
(dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
)
{
D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( stmt_ty , 10 , "Pattern matching is" , _PyAST_Match ( subject , cases , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT"));
}
if (p->call_invalid_rules) { // invalid_match_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt"));
void *invalid_match_stmt_var;
if (
(invalid_match_stmt_var = invalid_match_stmt_rule(p)) // invalid_match_stmt
)
{
D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt"));
_res = invalid_match_stmt_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_match_stmt"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// subject_expr: star_named_expression ',' star_named_expressions? | named_expression
static expr_ty
subject_expr_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // star_named_expression ',' star_named_expressions?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
Token * _literal;
expr_ty value;
void *values;
if (
(value = star_named_expression_rule(p)) // star_named_expression
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(values = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions?
)
{
D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
}
{ // named_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
expr_ty named_expression_var;
if (
(named_expression_var = named_expression_rule(p)) // named_expression
)
{
D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
_res = named_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// case_block: invalid_case_block | "case" patterns guard? ':' block
static match_case_ty
case_block_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
match_case_ty _res = NULL;
int _mark = p->mark;
if (p->call_invalid_rules) { // invalid_case_block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_case_block"));
void *invalid_case_block_var;
if (
(invalid_case_block_var = invalid_case_block_rule(p)) // invalid_case_block
)
{
D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_case_block"));
_res = invalid_case_block_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_case_block"));
}
{ // "case" patterns guard? ':' block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block"));
expr_ty _keyword;
Token * _literal;
asdl_stmt_seq* body;
void *guard;
pattern_ty pattern;
if (
(_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"'
&&
(pattern = patterns_rule(p)) // patterns
&&
(guard = guard_rule(p), !p->error_indicator) // guard?
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(body = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block"));
_res = _PyAST_match_case ( pattern , guard , body , p -> arena );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' block"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// guard: 'if' named_expression
static expr_ty
guard_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // 'if' named_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> guard[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression"));
Token * _keyword;
expr_ty guard;
if (
(_keyword = _PyPegen_expect_token(p, 668)) // token='if'
&&
(guard = named_expression_rule(p)) // named_expression
)
{
D(fprintf(stderr, "%*c+ guard[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression"));
_res = guard;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s guard[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// patterns: open_sequence_pattern | pattern
static pattern_ty
patterns_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // open_sequence_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern"));
asdl_pattern_seq* patterns;
if (
(patterns = (asdl_pattern_seq*)open_sequence_pattern_rule(p)) // open_sequence_pattern
)
{
D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchSequence ( patterns , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "open_sequence_pattern"));
}
{ // pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern"));
pattern_ty pattern_var;
if (
(pattern_var = pattern_rule(p)) // pattern
)
{
D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern"));
_res = pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// pattern: as_pattern | or_pattern
static pattern_ty
pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
{ // as_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "as_pattern"));
pattern_ty as_pattern_var;
if (
(as_pattern_var = as_pattern_rule(p)) // as_pattern
)
{
D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "as_pattern"));
_res = as_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "as_pattern"));
}
{ // or_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern"));
pattern_ty or_pattern_var;
if (
(or_pattern_var = or_pattern_rule(p)) // or_pattern
)
{
D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern"));
_res = or_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// as_pattern: or_pattern 'as' pattern_capture_target | invalid_as_pattern
static pattern_ty
as_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // or_pattern 'as' pattern_capture_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' pattern_capture_target"));
Token * _keyword;
pattern_ty pattern;
expr_ty target;
if (
(pattern = or_pattern_rule(p)) // or_pattern
&&
(_keyword = _PyPegen_expect_token(p, 666)) // token='as'
&&
(target = pattern_capture_target_rule(p)) // pattern_capture_target
)
{
D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' pattern_capture_target"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchAs ( pattern , target -> v . Name . id , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' pattern_capture_target"));
}
if (p->call_invalid_rules) { // invalid_as_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_as_pattern"));
void *invalid_as_pattern_var;
if (
(invalid_as_pattern_var = invalid_as_pattern_rule(p)) // invalid_as_pattern
)
{
D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_as_pattern"));
_res = invalid_as_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_as_pattern"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// or_pattern: '|'.closed_pattern+
static pattern_ty
or_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '|'.closed_pattern+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+"));
asdl_pattern_seq* patterns;
if (
(patterns = (asdl_pattern_seq*)_gather_41_rule(p)) // '|'.closed_pattern+
)
{
D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = asdl_seq_LEN ( patterns ) == 1 ? asdl_seq_GET ( patterns , 0 ) : _PyAST_MatchOr ( patterns , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|'.closed_pattern+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// closed_pattern:
// | literal_pattern
// | capture_pattern
// | wildcard_pattern
// | value_pattern
// | group_pattern
// | sequence_pattern
// | mapping_pattern
// | class_pattern
static pattern_ty
closed_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
if (_PyPegen_is_memoized(p, closed_pattern_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
{ // literal_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern"));
pattern_ty literal_pattern_var;
if (
(literal_pattern_var = literal_pattern_rule(p)) // literal_pattern
)
{
D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern"));
_res = literal_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern"));
}
{ // capture_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "capture_pattern"));
pattern_ty capture_pattern_var;
if (
(capture_pattern_var = capture_pattern_rule(p)) // capture_pattern
)
{
D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "capture_pattern"));
_res = capture_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "capture_pattern"));
}
{ // wildcard_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "wildcard_pattern"));
pattern_ty wildcard_pattern_var;
if (
(wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern
)
{
D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "wildcard_pattern"));
_res = wildcard_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "wildcard_pattern"));
}
{ // value_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern"));
pattern_ty value_pattern_var;
if (
(value_pattern_var = value_pattern_rule(p)) // value_pattern
)
{
D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern"));
_res = value_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern"));
}
{ // group_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group_pattern"));
pattern_ty group_pattern_var;
if (
(group_pattern_var = group_pattern_rule(p)) // group_pattern
)
{
D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group_pattern"));
_res = group_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group_pattern"));
}
{ // sequence_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sequence_pattern"));
pattern_ty sequence_pattern_var;
if (
(sequence_pattern_var = sequence_pattern_rule(p)) // sequence_pattern
)
{
D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sequence_pattern"));
_res = sequence_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sequence_pattern"));
}
{ // mapping_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "mapping_pattern"));
pattern_ty mapping_pattern_var;
if (
(mapping_pattern_var = mapping_pattern_rule(p)) // mapping_pattern
)
{
D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "mapping_pattern"));
_res = mapping_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "mapping_pattern"));
}
{ // class_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_pattern"));
pattern_ty class_pattern_var;
if (
(class_pattern_var = class_pattern_rule(p)) // class_pattern
)
{
D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_pattern"));
_res = class_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_pattern"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, closed_pattern_type, _res);
p->level--;
return _res;
}
// literal_pattern:
// | signed_number !('+' | '-')
// | complex_number
// | strings
// | 'None'
// | 'True'
// | 'False'
static pattern_ty
literal_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // signed_number !('+' | '-')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
expr_ty value;
if (
(value = signed_number_rule(p)) // signed_number
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_42_rule, p)
)
{
D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchValue ( value , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number !('+' | '-')"));
}
{ // complex_number
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "complex_number"));
expr_ty value;
if (
(value = complex_number_rule(p)) // complex_number
)
{
D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "complex_number"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchValue ( value , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "complex_number"));
}
{ // strings
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "strings"));
expr_ty value;
if (
(value = strings_rule(p)) // strings
)
{
D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "strings"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchValue ( value , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "strings"));
}
{ // 'None'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 611)) // token='None'
)
{
D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchSingleton ( Py_None , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
}
{ // 'True'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 610)) // token='True'
)
{
D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchSingleton ( Py_True , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
}
{ // 'False'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 612)) // token='False'
)
{
D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchSingleton ( Py_False , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// literal_expr:
// | signed_number !('+' | '-')
// | complex_number
// | strings
// | 'None'
// | 'True'
// | 'False'
static expr_ty
literal_expr_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // signed_number !('+' | '-')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
expr_ty signed_number_var;
if (
(signed_number_var = signed_number_rule(p)) // signed_number
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_42_rule, p)
)
{
D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
_res = signed_number_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number !('+' | '-')"));
}
{ // complex_number
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "complex_number"));
expr_ty complex_number_var;
if (
(complex_number_var = complex_number_rule(p)) // complex_number
)
{
D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "complex_number"));
_res = complex_number_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "complex_number"));
}
{ // strings
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "strings"));
expr_ty strings_var;
if (
(strings_var = strings_rule(p)) // strings
)
{
D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "strings"));
_res = strings_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "strings"));
}
{ // 'None'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 611)) // token='None'
)
{
D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Constant ( Py_None , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
}
{ // 'True'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 610)) // token='True'
)
{
D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Constant ( Py_True , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
}
{ // 'False'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 612)) // token='False'
)
{
D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Constant ( Py_False , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// complex_number:
// | signed_real_number '+' imaginary_number
// | signed_real_number '-' imaginary_number
static expr_ty
complex_number_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // signed_real_number '+' imaginary_number
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> complex_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_real_number '+' imaginary_number"));
Token * _literal;
expr_ty imag;
expr_ty real;
if (
(real = signed_real_number_rule(p)) // signed_real_number
&&
(_literal = _PyPegen_expect_token(p, 14)) // token='+'
&&
(imag = imaginary_number_rule(p)) // imaginary_number
)
{
D(fprintf(stderr, "%*c+ complex_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_real_number '+' imaginary_number"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( real , Add , imag , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s complex_number[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_real_number '+' imaginary_number"));
}
{ // signed_real_number '-' imaginary_number
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> complex_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_real_number '-' imaginary_number"));
Token * _literal;
expr_ty imag;
expr_ty real;
if (
(real = signed_real_number_rule(p)) // signed_real_number
&&
(_literal = _PyPegen_expect_token(p, 15)) // token='-'
&&
(imag = imaginary_number_rule(p)) // imaginary_number
)
{
D(fprintf(stderr, "%*c+ complex_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_real_number '-' imaginary_number"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( real , Sub , imag , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s complex_number[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_real_number '-' imaginary_number"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// signed_number: NUMBER | '-' NUMBER
static expr_ty
signed_number_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // NUMBER
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
expr_ty number_var;
if (
(number_var = _PyPegen_number_token(p)) // NUMBER
)
{
D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
_res = number_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
}
{ // '-' NUMBER
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' NUMBER"));
Token * _literal;
expr_ty number;
if (
(_literal = _PyPegen_expect_token(p, 15)) // token='-'
&&
(number = _PyPegen_number_token(p)) // NUMBER
)
{
D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' NUMBER"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_UnaryOp ( USub , number , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' NUMBER"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// signed_real_number: real_number | '-' real_number
static expr_ty
signed_real_number_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // real_number
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> signed_real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "real_number"));
expr_ty real_number_var;
if (
(real_number_var = real_number_rule(p)) // real_number
)
{
D(fprintf(stderr, "%*c+ signed_real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "real_number"));
_res = real_number_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s signed_real_number[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "real_number"));
}
{ // '-' real_number
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> signed_real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' real_number"));
Token * _literal;
expr_ty real;
if (
(_literal = _PyPegen_expect_token(p, 15)) // token='-'
&&
(real = real_number_rule(p)) // real_number
)
{
D(fprintf(stderr, "%*c+ signed_real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' real_number"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_UnaryOp ( USub , real , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s signed_real_number[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' real_number"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// real_number: NUMBER
static expr_ty
real_number_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // NUMBER
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
expr_ty real;
if (
(real = _PyPegen_number_token(p)) // NUMBER
)
{
D(fprintf(stderr, "%*c+ real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
_res = _PyPegen_ensure_real ( p , real );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s real_number[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// imaginary_number: NUMBER
static expr_ty
imaginary_number_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // NUMBER
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> imaginary_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
expr_ty imag;
if (
(imag = _PyPegen_number_token(p)) // NUMBER
)
{
D(fprintf(stderr, "%*c+ imaginary_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
_res = _PyPegen_ensure_imaginary ( p , imag );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s imaginary_number[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// capture_pattern: pattern_capture_target
static pattern_ty
capture_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // pattern_capture_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> capture_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern_capture_target"));
expr_ty target;
if (
(target = pattern_capture_target_rule(p)) // pattern_capture_target
)
{
D(fprintf(stderr, "%*c+ capture_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern_capture_target"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchAs ( NULL , target -> v . Name . id , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s capture_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern_capture_target"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// pattern_capture_target: !"_" NAME !('.' | '(' | '=')
static expr_ty
pattern_capture_target_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // !"_" NAME !('.' | '(' | '=')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> pattern_capture_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')"));
expr_ty name;
if (
_PyPegen_lookahead_with_string(0, _PyPegen_expect_soft_keyword, p, "_")
&&
(name = _PyPegen_name_token(p)) // NAME
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_43_rule, p)
)
{
D(fprintf(stderr, "%*c+ pattern_capture_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')"));
_res = _PyPegen_set_expr_context ( p , name , Store );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s pattern_capture_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// wildcard_pattern: "_"
static pattern_ty
wildcard_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // "_"
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> wildcard_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"_\""));
expr_ty _keyword;
if (
(_keyword = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"'
)
{
D(fprintf(stderr, "%*c+ wildcard_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"_\""));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchAs ( NULL , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s wildcard_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"_\""));
}
_res = NULL;
done:
p->level--;
return _res;
}
// value_pattern: attr !('.' | '(' | '=')
static pattern_ty
value_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // attr !('.' | '(' | '=')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')"));
expr_ty attr;
if (
(attr = attr_rule(p)) // attr
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_43_rule, p)
)
{
D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchValue ( attr , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr !('.' | '(' | '=')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// Left-recursive
// attr: name_or_attr '.' NAME
static expr_ty attr_raw(Parser *);
static expr_ty
attr_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, attr_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
int _resmark = p->mark;
while (1) {
int tmpvar_1 = _PyPegen_update_memo(p, _mark, attr_type, _res);
if (tmpvar_1) {
p->level--;
return _res;
}
p->mark = _mark;
void *_raw = attr_raw(p);
if (p->error_indicator) {
p->level--;
return NULL;
}
if (_raw == NULL || p->mark <= _resmark)
break;
_resmark = p->mark;
_res = _raw;
}
p->mark = _resmark;
p->level--;
return _res;
}
static expr_ty
attr_raw(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // name_or_attr '.' NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME"));
Token * _literal;
expr_ty attr;
expr_ty value;
if (
(value = name_or_attr_rule(p)) // name_or_attr
&&
(_literal = _PyPegen_expect_token(p, 23)) // token='.'
&&
(attr = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Attribute ( value , attr -> v . Name . id , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s attr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// Left-recursive
// name_or_attr: attr | NAME
static expr_ty
name_or_attr_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // attr
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr"));
expr_ty attr_var;
if (
(attr_var = attr_rule(p)) // attr
)
{
D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr"));
_res = attr_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr"));
}
{ // NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
expr_ty name_var;
if (
(name_var = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
_res = name_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// group_pattern: '(' pattern ')'
static pattern_ty
group_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
{ // '(' pattern ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'"));
Token * _literal;
Token * _literal_1;
pattern_ty pattern;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(pattern = pattern_rule(p)) // pattern
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'"));
_res = pattern;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern ')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// sequence_pattern: '[' maybe_sequence_pattern? ']' | '(' open_sequence_pattern? ')'
static pattern_ty
sequence_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '[' maybe_sequence_pattern? ']'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'"));
Token * _literal;
Token * _literal_1;
void *patterns;
if (
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(patterns = maybe_sequence_pattern_rule(p), !p->error_indicator) // maybe_sequence_pattern?
&&
(_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
)
{
D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchSequence ( patterns , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' maybe_sequence_pattern? ']'"));
}
{ // '(' open_sequence_pattern? ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'"));
Token * _literal;
Token * _literal_1;
void *patterns;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(patterns = open_sequence_pattern_rule(p), !p->error_indicator) // open_sequence_pattern?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchSequence ( patterns , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' open_sequence_pattern? ')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// open_sequence_pattern: maybe_star_pattern ',' maybe_sequence_pattern?
static asdl_seq*
open_sequence_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq* _res = NULL;
int _mark = p->mark;
{ // maybe_star_pattern ',' maybe_sequence_pattern?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> open_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?"));
Token * _literal;
pattern_ty pattern;
void *patterns;
if (
(pattern = maybe_star_pattern_rule(p)) // maybe_star_pattern
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(patterns = maybe_sequence_pattern_rule(p), !p->error_indicator) // maybe_sequence_pattern?
)
{
D(fprintf(stderr, "%*c+ open_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?"));
_res = _PyPegen_seq_insert_in_front ( p , pattern , patterns );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s open_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// maybe_sequence_pattern: ','.maybe_star_pattern+ ','?
static asdl_seq*
maybe_sequence_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq* _res = NULL;
int _mark = p->mark;
{ // ','.maybe_star_pattern+ ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> maybe_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_seq * patterns;
if (
(patterns = _gather_45_rule(p)) // ','.maybe_star_pattern+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ maybe_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?"));
_res = patterns;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s maybe_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.maybe_star_pattern+ ','?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// maybe_star_pattern: star_pattern | pattern
static pattern_ty
maybe_star_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
{ // star_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_pattern"));
pattern_ty star_pattern_var;
if (
(star_pattern_var = star_pattern_rule(p)) // star_pattern
)
{
D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_pattern"));
_res = star_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_pattern"));
}
{ // pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern"));
pattern_ty pattern_var;
if (
(pattern_var = pattern_rule(p)) // pattern
)
{
D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern"));
_res = pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// star_pattern: '*' pattern_capture_target | '*' wildcard_pattern
static pattern_ty
star_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
if (_PyPegen_is_memoized(p, star_pattern_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '*' pattern_capture_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' pattern_capture_target"));
Token * _literal;
expr_ty target;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(target = pattern_capture_target_rule(p)) // pattern_capture_target
)
{
D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' pattern_capture_target"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchStar ( target -> v . Name . id , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' pattern_capture_target"));
}
{ // '*' wildcard_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' wildcard_pattern"));
Token * _literal;
pattern_ty wildcard_pattern_var;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern
)
{
D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' wildcard_pattern"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchStar ( NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' wildcard_pattern"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, star_pattern_type, _res);
p->level--;
return _res;
}
// mapping_pattern:
// | '{' '}'
// | '{' double_star_pattern ','? '}'
// | '{' items_pattern ',' double_star_pattern ','? '}'
// | '{' items_pattern ','? '}'
static pattern_ty
mapping_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '{' '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '}'"));
Token * _literal;
Token * _literal_1;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '}'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchMapping ( NULL , NULL , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '}'"));
}
{ // '{' double_star_pattern ','? '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_star_pattern ','? '}'"));
Token * _literal;
Token * _literal_1;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty rest;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(rest = double_star_pattern_rule(p)) // double_star_pattern
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_star_pattern ','? '}'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchMapping ( NULL , NULL , rest -> v . Name . id , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_star_pattern ','? '}'"));
}
{ // '{' items_pattern ',' double_star_pattern ','? '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'"));
Token * _literal;
Token * _literal_1;
Token * _literal_2;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_seq* items;
expr_ty rest;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(items = items_pattern_rule(p)) // items_pattern
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
(rest = double_star_pattern_rule(p)) // double_star_pattern
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(_literal_2 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchMapping ( CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , items ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , items ) ) , rest -> v . Name . id , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'"));
}
{ // '{' items_pattern ','? '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ','? '}'"));
Token * _literal;
Token * _literal_1;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_seq* items;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(items = items_pattern_rule(p)) // items_pattern
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ','? '}'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchMapping ( CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , items ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , items ) ) , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern ','? '}'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// items_pattern: ','.key_value_pattern+
static asdl_seq*
items_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq* _res = NULL;
int _mark = p->mark;
{ // ','.key_value_pattern+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> items_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+"));
asdl_seq * _gather_47_var;
if (
(_gather_47_var = _gather_47_rule(p)) // ','.key_value_pattern+
)
{
D(fprintf(stderr, "%*c+ items_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+"));
_res = _gather_47_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s items_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.key_value_pattern+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// key_value_pattern: (literal_expr | attr) ':' pattern
static KeyPatternPair*
key_value_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
KeyPatternPair* _res = NULL;
int _mark = p->mark;
{ // (literal_expr | attr) ':' pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_expr | attr) ':' pattern"));
Token * _literal;
void *key;
pattern_ty pattern;
if (
(key = _tmp_48_rule(p)) // literal_expr | attr
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(pattern = pattern_rule(p)) // pattern
)
{
D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_expr | attr) ':' pattern"));
_res = _PyPegen_key_pattern_pair ( p , key , pattern );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_expr | attr) ':' pattern"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// double_star_pattern: '**' pattern_capture_target
static expr_ty
double_star_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // '**' pattern_capture_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> double_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' pattern_capture_target"));
Token * _literal;
expr_ty target;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(target = pattern_capture_target_rule(p)) // pattern_capture_target
)
{
D(fprintf(stderr, "%*c+ double_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' pattern_capture_target"));
_res = target;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s double_star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' pattern_capture_target"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// class_pattern:
// | name_or_attr '(' ')'
// | name_or_attr '(' positional_patterns ','? ')'
// | name_or_attr '(' keyword_patterns ','? ')'
// | name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'
// | invalid_class_pattern
static pattern_ty
class_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
pattern_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // name_or_attr '(' ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'"));
Token * _literal;
Token * _literal_1;
expr_ty cls;
if (
(cls = name_or_attr_rule(p)) // name_or_attr
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchClass ( cls , NULL , NULL , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ')'"));
}
{ // name_or_attr '(' positional_patterns ','? ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'"));
Token * _literal;
Token * _literal_1;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty cls;
asdl_pattern_seq* patterns;
if (
(cls = name_or_attr_rule(p)) // name_or_attr
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(patterns = positional_patterns_rule(p)) // positional_patterns
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchClass ( cls , patterns , NULL , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'"));
}
{ // name_or_attr '(' keyword_patterns ','? ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'"));
Token * _literal;
Token * _literal_1;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty cls;
asdl_seq* keywords;
if (
(cls = name_or_attr_rule(p)) // name_or_attr
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(keywords = keyword_patterns_rule(p)) // keyword_patterns
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchClass ( cls , NULL , CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , keywords ) ) ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , keywords ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'"));
}
{ // name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'"));
Token * _literal;
Token * _literal_1;
Token * _literal_2;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty cls;
asdl_seq* keywords;
asdl_pattern_seq* patterns;
if (
(cls = name_or_attr_rule(p)) // name_or_attr
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(patterns = positional_patterns_rule(p)) // positional_patterns
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
(keywords = keyword_patterns_rule(p)) // keyword_patterns
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(_literal_2 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_MatchClass ( cls , patterns , CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , keywords ) ) ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , keywords ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'"));
}
if (p->call_invalid_rules) { // invalid_class_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_class_pattern"));
void *invalid_class_pattern_var;
if (
(invalid_class_pattern_var = invalid_class_pattern_rule(p)) // invalid_class_pattern
)
{
D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_class_pattern"));
_res = invalid_class_pattern_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_class_pattern"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// positional_patterns: ','.pattern+
static asdl_pattern_seq*
positional_patterns_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_pattern_seq* _res = NULL;
int _mark = p->mark;
{ // ','.pattern+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> positional_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+"));
asdl_pattern_seq* args;
if (
(args = (asdl_pattern_seq*)_gather_50_rule(p)) // ','.pattern+
)
{
D(fprintf(stderr, "%*c+ positional_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+"));
_res = args;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s positional_patterns[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// keyword_patterns: ','.keyword_pattern+
static asdl_seq*
keyword_patterns_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq* _res = NULL;
int _mark = p->mark;
{ // ','.keyword_pattern+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> keyword_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+"));
asdl_seq * _gather_52_var;
if (
(_gather_52_var = _gather_52_rule(p)) // ','.keyword_pattern+
)
{
D(fprintf(stderr, "%*c+ keyword_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+"));
_res = _gather_52_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s keyword_patterns[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.keyword_pattern+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// keyword_pattern: NAME '=' pattern
static KeyPatternPair*
keyword_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
KeyPatternPair* _res = NULL;
int _mark = p->mark;
{ // NAME '=' pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern"));
Token * _literal;
expr_ty arg;
pattern_ty value;
if (
(arg = _PyPegen_name_token(p)) // NAME
&&
(_literal = _PyPegen_expect_token(p, 22)) // token='='
&&
(value = pattern_rule(p)) // pattern
)
{
D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern"));
_res = _PyPegen_key_pattern_pair ( p , arg , value );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' pattern"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// type_alias: "type" NAME type_params? '=' expression
static stmt_ty
type_alias_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // "type" NAME type_params? '=' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_alias[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"type\" NAME type_params? '=' expression"));
expr_ty _keyword;
Token * _literal;
expr_ty b;
expr_ty n;
void *t;
if (
(_keyword = _PyPegen_expect_soft_keyword(p, "type")) // soft_keyword='"type"'
&&
(n = _PyPegen_name_token(p)) // NAME
&&
(t = type_params_rule(p), !p->error_indicator) // type_params?
&&
(_literal = _PyPegen_expect_token(p, 22)) // token='='
&&
(b = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ type_alias[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"type\" NAME type_params? '=' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( stmt_ty , 12 , "Type statement is" , _PyAST_TypeAlias ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , n , Store ) ) , t , b , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_alias[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"type\" NAME type_params? '=' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// type_params: invalid_type_params | '[' type_param_seq ']'
static asdl_type_param_seq*
type_params_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_type_param_seq* _res = NULL;
int _mark = p->mark;
if (p->call_invalid_rules) { // invalid_type_params
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_type_params"));
void *invalid_type_params_var;
if (
(invalid_type_params_var = invalid_type_params_rule(p)) // invalid_type_params
)
{
D(fprintf(stderr, "%*c+ type_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_type_params"));
_res = invalid_type_params_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_params[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_type_params"));
}
{ // '[' type_param_seq ']'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' type_param_seq ']'"));
Token * _literal;
Token * _literal_1;
asdl_type_param_seq* t;
if (
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(t = type_param_seq_rule(p)) // type_param_seq
&&
(_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
)
{
D(fprintf(stderr, "%*c+ type_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' type_param_seq ']'"));
_res = CHECK_VERSION ( asdl_type_param_seq* , 12 , "Type parameter lists are" , t );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_params[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' type_param_seq ']'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// type_param_seq: ','.type_param+ ','?
static asdl_type_param_seq*
type_param_seq_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_type_param_seq* _res = NULL;
int _mark = p->mark;
{ // ','.type_param+ ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_param_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.type_param+ ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_type_param_seq* a;
if (
(a = (asdl_type_param_seq*)_gather_54_rule(p)) // ','.type_param+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ type_param_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.type_param+ ','?"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_param_seq[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.type_param+ ','?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// type_param:
// | NAME type_param_bound? type_param_default?
// | invalid_type_param
// | '*' NAME type_param_starred_default?
// | '**' NAME type_param_default?
static type_param_ty
type_param_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
type_param_ty _res = NULL;
if (_PyPegen_is_memoized(p, type_param_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // NAME type_param_bound? type_param_default?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME type_param_bound? type_param_default?"));
expr_ty a;
void *b;
void *c;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
(b = type_param_bound_rule(p), !p->error_indicator) // type_param_bound?
&&
(c = type_param_default_rule(p), !p->error_indicator) // type_param_default?
)
{
D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME type_param_bound? type_param_default?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_TypeVar ( a -> v . Name . id , b , c , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME type_param_bound? type_param_default?"));
}
if (p->call_invalid_rules) { // invalid_type_param
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_type_param"));
void *invalid_type_param_var;
if (
(invalid_type_param_var = invalid_type_param_rule(p)) // invalid_type_param
)
{
D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_type_param"));
_res = invalid_type_param_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_type_param"));
}
{ // '*' NAME type_param_starred_default?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' NAME type_param_starred_default?"));
Token * _literal;
expr_ty a;
void *b;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = _PyPegen_name_token(p)) // NAME
&&
(b = type_param_starred_default_rule(p), !p->error_indicator) // type_param_starred_default?
)
{
D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' NAME type_param_starred_default?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_TypeVarTuple ( a -> v . Name . id , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' NAME type_param_starred_default?"));
}
{ // '**' NAME type_param_default?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' NAME type_param_default?"));
Token * _literal;
expr_ty a;
void *b;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(a = _PyPegen_name_token(p)) // NAME
&&
(b = type_param_default_rule(p), !p->error_indicator) // type_param_default?
)
{
D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' NAME type_param_default?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_ParamSpec ( a -> v . Name . id , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' NAME type_param_default?"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, type_param_type, _res);
p->level--;
return _res;
}
// type_param_bound: ':' expression
static expr_ty
type_param_bound_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // ':' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_param_bound[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
Token * _literal;
expr_ty e;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(e = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ type_param_bound[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
_res = e;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_param_bound[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// type_param_default: '=' expression
static expr_ty
type_param_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // '=' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_param_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
Token * _literal;
expr_ty e;
if (
(_literal = _PyPegen_expect_token(p, 22)) // token='='
&&
(e = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ type_param_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
_res = CHECK_VERSION ( expr_ty , 13 , "Type parameter defaults are" , e );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_param_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// type_param_starred_default: '=' star_expression
static expr_ty
type_param_starred_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // '=' star_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_param_starred_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' star_expression"));
Token * _literal;
expr_ty e;
if (
(_literal = _PyPegen_expect_token(p, 22)) // token='='
&&
(e = star_expression_rule(p)) // star_expression
)
{
D(fprintf(stderr, "%*c+ type_param_starred_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' star_expression"));
_res = CHECK_VERSION ( expr_ty , 13 , "Type parameter defaults are" , e );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_param_starred_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' star_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// expressions: expression ((',' expression))+ ','? | expression ',' | expression
static expr_ty
expressions_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // expression ((',' expression))+ ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty a;
asdl_seq * b;
if (
(a = expression_rule(p)) // expression
&&
(b = _loop1_55_rule(p)) // ((',' expression))+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
}
{ // expression ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
Token * _literal;
expr_ty a;
if (
(a = expression_rule(p)) // expression
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
}
{ // expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
expr_ty expression_var;
if (
(expression_var = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
_res = expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// expression:
// | invalid_expression
// | invalid_legacy_expression
// | disjunction 'if' disjunction 'else' expression
// | disjunction
// | lambdef
static expr_ty
expression_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, expression_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_expression"));
void *invalid_expression_var;
if (
(invalid_expression_var = invalid_expression_rule(p)) // invalid_expression
)
{
D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_expression"));
_res = invalid_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_expression"));
}
if (p->call_invalid_rules) { // invalid_legacy_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_legacy_expression"));
void *invalid_legacy_expression_var;
if (
(invalid_legacy_expression_var = invalid_legacy_expression_rule(p)) // invalid_legacy_expression
)
{
D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_legacy_expression"));
_res = invalid_legacy_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_legacy_expression"));
}
{ // disjunction 'if' disjunction 'else' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
Token * _keyword;
Token * _keyword_1;
expr_ty a;
expr_ty b;
expr_ty c;
if (
(a = disjunction_rule(p)) // disjunction
&&
(_keyword = _PyPegen_expect_token(p, 668)) // token='if'
&&
(b = disjunction_rule(p)) // disjunction
&&
(_keyword_1 = _PyPegen_expect_token(p, 671)) // token='else'
&&
(c = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_IfExp ( b , a , c , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
}
{ // disjunction
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
expr_ty disjunction_var;
if (
(disjunction_var = disjunction_rule(p)) // disjunction
)
{
D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
_res = disjunction_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
}
{ // lambdef
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
expr_ty lambdef_var;
if (
(lambdef_var = lambdef_rule(p)) // lambdef
)
{
D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
_res = lambdef_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, expression_type, _res);
p->level--;
return _res;
}
// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
static expr_ty
yield_expr_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'yield' 'from' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
Token * _keyword;
Token * _keyword_1;
expr_ty a;
if (
(_keyword = _PyPegen_expect_token(p, 580)) // token='yield'
&&
(_keyword_1 = _PyPegen_expect_token(p, 621)) // token='from'
&&
(a = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_YieldFrom ( a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
}
{ // 'yield' star_expressions?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
Token * _keyword;
void *a;
if (
(_keyword = _PyPegen_expect_token(p, 580)) // token='yield'
&&
(a = star_expressions_rule(p), !p->error_indicator) // star_expressions?
)
{
D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Yield ( a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// star_expressions:
// | star_expression ((',' star_expression))+ ','?
// | star_expression ','
// | star_expression
static expr_ty
star_expressions_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // star_expression ((',' star_expression))+ ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty a;
asdl_seq * b;
if (
(a = star_expression_rule(p)) // star_expression
&&
(b = _loop1_56_rule(p)) // ((',' star_expression))+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
}
{ // star_expression ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
Token * _literal;
expr_ty a;
if (
(a = star_expression_rule(p)) // star_expression
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','"));
}
{ // star_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
expr_ty star_expression_var;
if (
(star_expression_var = star_expression_rule(p)) // star_expression
)
{
D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
_res = star_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// star_expression: '*' bitwise_or | expression
static expr_ty
star_expression_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '*' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Starred ( a , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
}
{ // expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
expr_ty expression_var;
if (
(expression_var = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
_res = expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, star_expression_type, _res);
p->level--;
return _res;
}
// star_named_expressions: ','.star_named_expression+ ','?
static asdl_expr_seq*
star_named_expressions_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_expr_seq* _res = NULL;
int _mark = p->mark;
{ // ','.star_named_expression+ ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_expr_seq* a;
if (
(a = (asdl_expr_seq*)_gather_58_rule(p)) // ','.star_named_expression+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// star_named_expression: '*' bitwise_or | named_expression
static expr_ty
star_named_expression_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '*' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Starred ( a , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
}
{ // named_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
expr_ty named_expression_var;
if (
(named_expression_var = named_expression_rule(p)) // named_expression
)
{
D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
_res = named_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// assignment_expression: NAME ':=' ~ expression
static expr_ty
assignment_expression_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // NAME ':=' ~ expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> assignment_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
int _cut_var = 0;
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
(_literal = _PyPegen_expect_token(p, 53)) // token=':='
&&
(_cut_var = 1)
&&
(b = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ assignment_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( expr_ty , 8 , "Assignment expressions are" , _PyAST_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s assignment_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
if (_cut_var) {
p->level--;
return NULL;
}
}
_res = NULL;
done:
p->level--;
return _res;
}
// named_expression: assignment_expression | invalid_named_expression | expression !':='
static expr_ty
named_expression_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // assignment_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
expr_ty assignment_expression_var;
if (
(assignment_expression_var = assignment_expression_rule(p)) // assignment_expression
)
{
D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
_res = assignment_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression"));
}
if (p->call_invalid_rules) { // invalid_named_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
void *invalid_named_expression_var;
if (
(invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression
)
{
D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
_res = invalid_named_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
}
{ // expression !':='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
expr_ty expression_var;
if (
(expression_var = expression_rule(p)) // expression
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
)
{
D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
_res = expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// disjunction: conjunction (('or' conjunction))+ | conjunction
static expr_ty
disjunction_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // conjunction (('or' conjunction))+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
expr_ty a;
asdl_seq * b;
if (
(a = conjunction_rule(p)) // conjunction
&&
(b = _loop1_59_rule(p)) // (('or' conjunction))+
)
{
D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BoolOp ( Or , CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+"));
}
{ // conjunction
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
expr_ty conjunction_var;
if (
(conjunction_var = conjunction_rule(p)) // conjunction
)
{
D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
_res = conjunction_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, disjunction_type, _res);
p->level--;
return _res;
}
// conjunction: inversion (('and' inversion))+ | inversion
static expr_ty
conjunction_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // inversion (('and' inversion))+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
expr_ty a;
asdl_seq * b;
if (
(a = inversion_rule(p)) // inversion
&&
(b = _loop1_60_rule(p)) // (('and' inversion))+
)
{
D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BoolOp ( And , CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+"));
}
{ // inversion
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
expr_ty inversion_var;
if (
(inversion_var = inversion_rule(p)) // inversion
)
{
D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
_res = inversion_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, conjunction_type, _res);
p->level--;
return _res;
}
// inversion: 'not' inversion | comparison
static expr_ty
inversion_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'not' inversion
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
Token * _keyword;
expr_ty a;
if (
(_keyword = _PyPegen_expect_token(p, 687)) // token='not'
&&
(a = inversion_rule(p)) // inversion
)
{
D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_UnaryOp ( Not , a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion"));
}
{ // comparison
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
expr_ty comparison_var;
if (
(comparison_var = comparison_rule(p)) // comparison
)
{
D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
_res = comparison_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, inversion_type, _res);
p->level--;
return _res;
}
// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
static expr_ty
comparison_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // bitwise_or compare_op_bitwise_or_pair+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
expr_ty a;
asdl_seq * b;
if (
(a = bitwise_or_rule(p)) // bitwise_or
&&
(b = _loop1_61_rule(p)) // compare_op_bitwise_or_pair+
)
{
D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Compare ( a , CHECK ( asdl_int_seq* , _PyPegen_get_cmpops ( p , b ) ) , CHECK ( asdl_expr_seq* , _PyPegen_get_exprs ( p , b ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
}
{ // bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
expr_ty bitwise_or_var;
if (
(bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
_res = bitwise_or_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// compare_op_bitwise_or_pair:
// | eq_bitwise_or
// | noteq_bitwise_or
// | lte_bitwise_or
// | lt_bitwise_or
// | gte_bitwise_or
// | gt_bitwise_or
// | notin_bitwise_or
// | in_bitwise_or
// | isnot_bitwise_or
// | is_bitwise_or
static CmpopExprPair*
compare_op_bitwise_or_pair_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
CmpopExprPair* _res = NULL;
int _mark = p->mark;
{ // eq_bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
CmpopExprPair* eq_bitwise_or_var;
if (
(eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or
)
{
D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
_res = eq_bitwise_or_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or"));
}
{ // noteq_bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
CmpopExprPair* noteq_bitwise_or_var;
if (
(noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or
)
{
D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
_res = noteq_bitwise_or_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or"));
}
{ // lte_bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
CmpopExprPair* lte_bitwise_or_var;
if (
(lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or
)
{
D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
_res = lte_bitwise_or_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or"));
}
{ // lt_bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
CmpopExprPair* lt_bitwise_or_var;
if (
(lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or
)
{
D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
_res = lt_bitwise_or_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or"));
}
{ // gte_bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
CmpopExprPair* gte_bitwise_or_var;
if (
(gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or
)
{
D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
_res = gte_bitwise_or_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or"));
}
{ // gt_bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
CmpopExprPair* gt_bitwise_or_var;
if (
(gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or
)
{
D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
_res = gt_bitwise_or_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or"));
}
{ // notin_bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
CmpopExprPair* notin_bitwise_or_var;
if (
(notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or
)
{
D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
_res = notin_bitwise_or_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or"));
}
{ // in_bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
CmpopExprPair* in_bitwise_or_var;
if (
(in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or
)
{
D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
_res = in_bitwise_or_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or"));
}
{ // isnot_bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
CmpopExprPair* isnot_bitwise_or_var;
if (
(isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or
)
{
D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
_res = isnot_bitwise_or_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or"));
}
{ // is_bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
CmpopExprPair* is_bitwise_or_var;
if (
(is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or
)
{
D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
_res = is_bitwise_or_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// eq_bitwise_or: '==' bitwise_or
static CmpopExprPair*
eq_bitwise_or_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
CmpopExprPair* _res = NULL;
int _mark = p->mark;
{ // '==' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 27)) // token='=='
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
_res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// noteq_bitwise_or: ('!=') bitwise_or
static CmpopExprPair*
noteq_bitwise_or_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
CmpopExprPair* _res = NULL;
int _mark = p->mark;
{ // ('!=') bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
void *_tmp_62_var;
expr_ty a;
if (
(_tmp_62_var = _tmp_62_rule(p)) // '!='
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
_res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lte_bitwise_or: '<=' bitwise_or
static CmpopExprPair*
lte_bitwise_or_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
CmpopExprPair* _res = NULL;
int _mark = p->mark;
{ // '<=' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 29)) // token='<='
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
_res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lt_bitwise_or: '<' bitwise_or
static CmpopExprPair*
lt_bitwise_or_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
CmpopExprPair* _res = NULL;
int _mark = p->mark;
{ // '<' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 20)) // token='<'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
_res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// gte_bitwise_or: '>=' bitwise_or
static CmpopExprPair*
gte_bitwise_or_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
CmpopExprPair* _res = NULL;
int _mark = p->mark;
{ // '>=' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 30)) // token='>='
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
_res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// gt_bitwise_or: '>' bitwise_or
static CmpopExprPair*
gt_bitwise_or_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
CmpopExprPair* _res = NULL;
int _mark = p->mark;
{ // '>' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 21)) // token='>'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
_res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// notin_bitwise_or: 'not' 'in' bitwise_or
static CmpopExprPair*
notin_bitwise_or_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
CmpopExprPair* _res = NULL;
int _mark = p->mark;
{ // 'not' 'in' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
Token * _keyword;
Token * _keyword_1;
expr_ty a;
if (
(_keyword = _PyPegen_expect_token(p, 687)) // token='not'
&&
(_keyword_1 = _PyPegen_expect_token(p, 679)) // token='in'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
_res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// in_bitwise_or: 'in' bitwise_or
static CmpopExprPair*
in_bitwise_or_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
CmpopExprPair* _res = NULL;
int _mark = p->mark;
{ // 'in' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
Token * _keyword;
expr_ty a;
if (
(_keyword = _PyPegen_expect_token(p, 679)) // token='in'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
_res = _PyPegen_cmpop_expr_pair ( p , In , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// isnot_bitwise_or: 'is' 'not' bitwise_or
static CmpopExprPair*
isnot_bitwise_or_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
CmpopExprPair* _res = NULL;
int _mark = p->mark;
{ // 'is' 'not' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
Token * _keyword;
Token * _keyword_1;
expr_ty a;
if (
(_keyword = _PyPegen_expect_token(p, 589)) // token='is'
&&
(_keyword_1 = _PyPegen_expect_token(p, 687)) // token='not'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
_res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// is_bitwise_or: 'is' bitwise_or
static CmpopExprPair*
is_bitwise_or_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
CmpopExprPair* _res = NULL;
int _mark = p->mark;
{ // 'is' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
Token * _keyword;
expr_ty a;
if (
(_keyword = _PyPegen_expect_token(p, 589)) // token='is'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
_res = _PyPegen_cmpop_expr_pair ( p , Is , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// Left-recursive
// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
static expr_ty bitwise_or_raw(Parser *);
static expr_ty
bitwise_or_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
int _resmark = p->mark;
while (1) {
int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
if (tmpvar_2) {
p->level--;
return _res;
}
p->mark = _mark;
void *_raw = bitwise_or_raw(p);
if (p->error_indicator) {
p->level--;
return NULL;
}
if (_raw == NULL || p->mark <= _resmark)
break;
_resmark = p->mark;
_res = _raw;
}
p->mark = _resmark;
p->level--;
return _res;
}
static expr_ty
bitwise_or_raw(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // bitwise_or '|' bitwise_xor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = bitwise_or_rule(p)) // bitwise_or
&&
(_literal = _PyPegen_expect_token(p, 18)) // token='|'
&&
(b = bitwise_xor_rule(p)) // bitwise_xor
)
{
D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , BitOr , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor"));
}
{ // bitwise_xor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
expr_ty bitwise_xor_var;
if (
(bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor
)
{
D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
_res = bitwise_xor_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// Left-recursive
// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
static expr_ty bitwise_xor_raw(Parser *);
static expr_ty
bitwise_xor_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
int _resmark = p->mark;
while (1) {
int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
if (tmpvar_3) {
p->level--;
return _res;
}
p->mark = _mark;
void *_raw = bitwise_xor_raw(p);
if (p->error_indicator) {
p->level--;
return NULL;
}
if (_raw == NULL || p->mark <= _resmark)
break;
_resmark = p->mark;
_res = _raw;
}
p->mark = _resmark;
p->level--;
return _res;
}
static expr_ty
bitwise_xor_raw(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // bitwise_xor '^' bitwise_and
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = bitwise_xor_rule(p)) // bitwise_xor
&&
(_literal = _PyPegen_expect_token(p, 32)) // token='^'
&&
(b = bitwise_and_rule(p)) // bitwise_and
)
{
D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , BitXor , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and"));
}
{ // bitwise_and
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
expr_ty bitwise_and_var;
if (
(bitwise_and_var = bitwise_and_rule(p)) // bitwise_and
)
{
D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
_res = bitwise_and_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// Left-recursive
// bitwise_and: bitwise_and '&' shift_expr | shift_expr
static expr_ty bitwise_and_raw(Parser *);
static expr_ty
bitwise_and_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
int _resmark = p->mark;
while (1) {
int tmpvar_4 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
if (tmpvar_4) {
p->level--;
return _res;
}
p->mark = _mark;
void *_raw = bitwise_and_raw(p);
if (p->error_indicator) {
p->level--;
return NULL;
}
if (_raw == NULL || p->mark <= _resmark)
break;
_resmark = p->mark;
_res = _raw;
}
p->mark = _resmark;
p->level--;
return _res;
}
static expr_ty
bitwise_and_raw(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // bitwise_and '&' shift_expr
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = bitwise_and_rule(p)) // bitwise_and
&&
(_literal = _PyPegen_expect_token(p, 19)) // token='&'
&&
(b = shift_expr_rule(p)) // shift_expr
)
{
D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , BitAnd , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr"));
}
{ // shift_expr
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
expr_ty shift_expr_var;
if (
(shift_expr_var = shift_expr_rule(p)) // shift_expr
)
{
D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
_res = shift_expr_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// Left-recursive
// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | invalid_arithmetic | sum
static expr_ty shift_expr_raw(Parser *);
static expr_ty
shift_expr_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
int _resmark = p->mark;
while (1) {
int tmpvar_5 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
if (tmpvar_5) {
p->level--;
return _res;
}
p->mark = _mark;
void *_raw = shift_expr_raw(p);
if (p->error_indicator) {
p->level--;
return NULL;
}
if (_raw == NULL || p->mark <= _resmark)
break;
_resmark = p->mark;
_res = _raw;
}
p->mark = _resmark;
p->level--;
return _res;
}
static expr_ty
shift_expr_raw(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // shift_expr '<<' sum
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = shift_expr_rule(p)) // shift_expr
&&
(_literal = _PyPegen_expect_token(p, 33)) // token='<<'
&&
(b = sum_rule(p)) // sum
)
{
D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , LShift , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
}
{ // shift_expr '>>' sum
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = shift_expr_rule(p)) // shift_expr
&&
(_literal = _PyPegen_expect_token(p, 34)) // token='>>'
&&
(b = sum_rule(p)) // sum
)
{
D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , RShift , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum"));
}
if (p->call_invalid_rules) { // invalid_arithmetic
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arithmetic"));
void *invalid_arithmetic_var;
if (
(invalid_arithmetic_var = invalid_arithmetic_rule(p)) // invalid_arithmetic
)
{
D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arithmetic"));
_res = invalid_arithmetic_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arithmetic"));
}
{ // sum
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
expr_ty sum_var;
if (
(sum_var = sum_rule(p)) // sum
)
{
D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
_res = sum_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// Left-recursive
// sum: sum '+' term | sum '-' term | term
static expr_ty sum_raw(Parser *);
static expr_ty
sum_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, sum_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
int _resmark = p->mark;
while (1) {
int tmpvar_6 = _PyPegen_update_memo(p, _mark, sum_type, _res);
if (tmpvar_6) {
p->level--;
return _res;
}
p->mark = _mark;
void *_raw = sum_raw(p);
if (p->error_indicator) {
p->level--;
return NULL;
}
if (_raw == NULL || p->mark <= _resmark)
break;
_resmark = p->mark;
_res = _raw;
}
p->mark = _resmark;
p->level--;
return _res;
}
static expr_ty
sum_raw(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // sum '+' term
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = sum_rule(p)) // sum
&&
(_literal = _PyPegen_expect_token(p, 14)) // token='+'
&&
(b = term_rule(p)) // term
)
{
D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , Add , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
}
{ // sum '-' term
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = sum_rule(p)) // sum
&&
(_literal = _PyPegen_expect_token(p, 15)) // token='-'
&&
(b = term_rule(p)) // term
)
{
D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , Sub , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term"));
}
{ // term
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
expr_ty term_var;
if (
(term_var = term_rule(p)) // term
)
{
D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
_res = term_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// Left-recursive
// term:
// | term '*' factor
// | term '/' factor
// | term '//' factor
// | term '%' factor
// | term '@' factor
// | invalid_factor
// | factor
static expr_ty term_raw(Parser *);
static expr_ty
term_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, term_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
int _resmark = p->mark;
while (1) {
int tmpvar_7 = _PyPegen_update_memo(p, _mark, term_type, _res);
if (tmpvar_7) {
p->level--;
return _res;
}
p->mark = _mark;
void *_raw = term_raw(p);
if (p->error_indicator) {
p->level--;
return NULL;
}
if (_raw == NULL || p->mark <= _resmark)
break;
_resmark = p->mark;
_res = _raw;
}
p->mark = _resmark;
p->level--;
return _res;
}
static expr_ty
term_raw(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // term '*' factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = term_rule(p)) // term
&&
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(b = factor_rule(p)) // factor
)
{
D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , Mult , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
}
{ // term '/' factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = term_rule(p)) // term
&&
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
&&
(b = factor_rule(p)) // factor
)
{
D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , Div , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
}
{ // term '//' factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = term_rule(p)) // term
&&
(_literal = _PyPegen_expect_token(p, 47)) // token='//'
&&
(b = factor_rule(p)) // factor
)
{
D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , FloorDiv , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
}
{ // term '%' factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = term_rule(p)) // term
&&
(_literal = _PyPegen_expect_token(p, 24)) // token='%'
&&
(b = factor_rule(p)) // factor
)
{
D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , Mod , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
}
{ // term '@' factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = term_rule(p)) // term
&&
(_literal = _PyPegen_expect_token(p, 49)) // token='@'
&&
(b = factor_rule(p)) // factor
)
{
D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( expr_ty , 5 , "The '@' operator is" , _PyAST_BinOp ( a , MatMult , b , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor"));
}
if (p->call_invalid_rules) { // invalid_factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_factor"));
void *invalid_factor_var;
if (
(invalid_factor_var = invalid_factor_rule(p)) // invalid_factor
)
{
D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_factor"));
_res = invalid_factor_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_factor"));
}
{ // factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
expr_ty factor_var;
if (
(factor_var = factor_rule(p)) // factor
)
{
D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
_res = factor_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// factor: '+' factor | '-' factor | '~' factor | power
static expr_ty
factor_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, factor_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '+' factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 14)) // token='+'
&&
(a = factor_rule(p)) // factor
)
{
D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_UnaryOp ( UAdd , a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
}
{ // '-' factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 15)) // token='-'
&&
(a = factor_rule(p)) // factor
)
{
D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_UnaryOp ( USub , a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
}
{ // '~' factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 31)) // token='~'
&&
(a = factor_rule(p)) // factor
)
{
D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_UnaryOp ( Invert , a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor"));
}
{ // power
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
expr_ty power_var;
if (
(power_var = power_rule(p)) // power
)
{
D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
_res = power_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, factor_type, _res);
p->level--;
return _res;
}
// power: await_primary '**' factor | await_primary
static expr_ty
power_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // await_primary '**' factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = await_primary_rule(p)) // await_primary
&&
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(b = factor_rule(p)) // factor
)
{
D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_BinOp ( a , Pow , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor"));
}
{ // await_primary
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
expr_ty await_primary_var;
if (
(await_primary_var = await_primary_rule(p)) // await_primary
)
{
D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
_res = await_primary_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// await_primary: 'await' primary | primary
static expr_ty
await_primary_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'await' primary
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'await' primary"));
Token * _keyword;
expr_ty a;
if (
(_keyword = _PyPegen_expect_token(p, 590)) // token='await'
&&
(a = primary_rule(p)) // primary
)
{
D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'await' primary"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = CHECK_VERSION ( expr_ty , 5 , "Await expressions are" , _PyAST_Await ( a , EXTRA ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'await' primary"));
}
{ // primary
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
expr_ty primary_var;
if (
(primary_var = primary_rule(p)) // primary
)
{
D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
_res = primary_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, await_primary_type, _res);
p->level--;
return _res;
}
// Left-recursive
// primary:
// | primary '.' NAME
// | primary genexp
// | primary '(' arguments? ')'
// | primary '[' slices ']'
// | atom
static expr_ty primary_raw(Parser *);
static expr_ty
primary_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, primary_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
int _resmark = p->mark;
while (1) {
int tmpvar_8 = _PyPegen_update_memo(p, _mark, primary_type, _res);
if (tmpvar_8) {
p->level--;
return _res;
}
p->mark = _mark;
void *_raw = primary_raw(p);
if (p->error_indicator) {
p->level--;
return NULL;
}
if (_raw == NULL || p->mark <= _resmark)
break;
_resmark = p->mark;
_res = _raw;
}
p->mark = _resmark;
p->level--;
return _res;
}
static expr_ty
primary_raw(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // primary '.' NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = primary_rule(p)) // primary
&&
(_literal = _PyPegen_expect_token(p, 23)) // token='.'
&&
(b = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
}
{ // primary genexp
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
expr_ty a;
expr_ty b;
if (
(a = primary_rule(p)) // primary
&&
(b = genexp_rule(p)) // genexp
)
{
D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Call ( a , CHECK ( asdl_expr_seq* , ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
}
{ // primary '(' arguments? ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
Token * _literal;
Token * _literal_1;
expr_ty a;
void *b;
if (
(a = primary_rule(p)) // primary
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(b = arguments_rule(p), !p->error_indicator) // arguments?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
}
{ // primary '[' slices ']'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
Token * _literal;
Token * _literal_1;
expr_ty a;
expr_ty b;
if (
(a = primary_rule(p)) // primary
&&
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(b = slices_rule(p)) // slices
&&
(_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
)
{
D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Subscript ( a , b , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
}
{ // atom
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
expr_ty atom_var;
if (
(atom_var = atom_rule(p)) // atom
)
{
D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
_res = atom_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// slices: slice !',' | ','.(slice | starred_expression)+ ','?
static expr_ty
slices_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // slice !','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
expr_ty a;
if (
(a = slice_rule(p)) // slice
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
)
{
D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
}
{ // ','.(slice | starred_expression)+ ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(slice | starred_expression)+ ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_expr_seq* a;
if (
(a = (asdl_expr_seq*)_gather_64_rule(p)) // ','.(slice | starred_expression)+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(slice | starred_expression)+ ','?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Tuple ( a , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(slice | starred_expression)+ ','?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// slice: expression? ':' expression? [':' expression?] | named_expression
static expr_ty
slice_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // expression? ':' expression? [':' expression?]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
Token * _literal;
void *a;
void *b;
void *c;
if (
(a = expression_rule(p), !p->error_indicator) // expression?
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = expression_rule(p), !p->error_indicator) // expression?
&&
(c = _tmp_65_rule(p), !p->error_indicator) // [':' expression?]
)
{
D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Slice ( a , b , c , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
}
{ // named_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
expr_ty a;
if (
(a = named_expression_rule(p)) // named_expression
)
{
D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// atom:
// | NAME
// | 'True'
// | 'False'
// | 'None'
// | &(STRING | FSTRING_START) strings
// | NUMBER
// | &'(' (tuple | group | genexp)
// | &'[' (list | listcomp)
// | &'{' (dict | set | dictcomp | setcomp)
// | '...'
static expr_ty
atom_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
expr_ty name_var;
if (
(name_var = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
_res = name_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
}
{ // 'True'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 610)) // token='True'
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Constant ( Py_True , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
}
{ // 'False'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 612)) // token='False'
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Constant ( Py_False , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
}
{ // 'None'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 611)) // token='None'
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Constant ( Py_None , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
}
{ // &(STRING | FSTRING_START) strings
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&(STRING | FSTRING_START) strings"));
expr_ty strings_var;
if (
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_66_rule, p)
&&
(strings_var = strings_rule(p)) // strings
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&(STRING | FSTRING_START) strings"));
_res = strings_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&(STRING | FSTRING_START) strings"));
}
{ // NUMBER
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
expr_ty number_var;
if (
(number_var = _PyPegen_number_token(p)) // NUMBER
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
_res = number_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
}
{ // &'(' (tuple | group | genexp)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
void *_tmp_67_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='('
&&
(_tmp_67_var = _tmp_67_rule(p)) // tuple | group | genexp
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
_res = _tmp_67_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
}
{ // &'[' (list | listcomp)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
void *_tmp_68_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='['
&&
(_tmp_68_var = _tmp_68_rule(p)) // list | listcomp
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
_res = _tmp_68_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
}
{ // &'{' (dict | set | dictcomp | setcomp)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
void *_tmp_69_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{'
&&
(_tmp_69_var = _tmp_69_rule(p)) // dict | set | dictcomp | setcomp
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
_res = _tmp_69_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
}
{ // '...'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 52)) // token='...'
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Constant ( Py_Ellipsis , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// group: '(' (yield_expr | named_expression) ')' | invalid_group
static expr_ty
group_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // '(' (yield_expr | named_expression) ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
Token * _literal;
Token * _literal_1;
void *a;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = _tmp_70_rule(p)) // yield_expr | named_expression
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
}
if (p->call_invalid_rules) { // invalid_group
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
void *invalid_group_var;
if (
(invalid_group_var = invalid_group_rule(p)) // invalid_group
)
{
D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
_res = invalid_group_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lambdef: 'lambda' lambda_params? ':' expression
static expr_ty
lambdef_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // 'lambda' lambda_params? ':' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
Token * _keyword;
Token * _literal;
void *a;
expr_ty b;
if (
(_keyword = _PyPegen_expect_token(p, 609)) // token='lambda'
&&
(a = lambda_params_rule(p), !p->error_indicator) // lambda_params?
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lambda_params: invalid_lambda_parameters | lambda_parameters
static arguments_ty
lambda_params_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arguments_ty _res = NULL;
int _mark = p->mark;
if (p->call_invalid_rules) { // invalid_lambda_parameters
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
void *invalid_lambda_parameters_var;
if (
(invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
)
{
D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
_res = invalid_lambda_parameters_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
}
{ // lambda_parameters
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
arguments_ty lambda_parameters_var;
if (
(lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
)
{
D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
_res = lambda_parameters_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lambda_parameters:
// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
// | lambda_param_with_default+ lambda_star_etc?
// | lambda_star_etc
static arguments_ty
lambda_parameters_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arguments_ty _res = NULL;
int _mark = p->mark;
{ // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
asdl_arg_seq* a;
asdl_arg_seq* b;
asdl_seq * c;
void *d;
if (
(a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
&&
(b = (asdl_arg_seq*)_loop0_71_rule(p)) // lambda_param_no_default*
&&
(c = _loop0_72_rule(p)) // lambda_param_with_default*
&&
(d = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc?
)
{
D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
_res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , a , NULL , b , c , d ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
}
{ // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
SlashWithDefault* a;
asdl_seq * b;
void *c;
if (
(a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
&&
(b = _loop0_72_rule(p)) // lambda_param_with_default*
&&
(c = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc?
)
{
D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
_res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
}
{ // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
asdl_arg_seq* a;
asdl_seq * b;
void *c;
if (
(a = (asdl_arg_seq*)_loop1_73_rule(p)) // lambda_param_no_default+
&&
(b = _loop0_72_rule(p)) // lambda_param_with_default*
&&
(c = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc?
)
{
D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
_res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
}
{ // lambda_param_with_default+ lambda_star_etc?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
asdl_seq * a;
void *b;
if (
(a = _loop1_74_rule(p)) // lambda_param_with_default+
&&
(b = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc?
)
{
D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
_res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
}
{ // lambda_star_etc
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
StarEtc* a;
if (
(a = lambda_star_etc_rule(p)) // lambda_star_etc
)
{
D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
_res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lambda_slash_no_default:
// | lambda_param_no_default+ '/' ','
// | lambda_param_no_default+ '/' &':'
static asdl_arg_seq*
lambda_slash_no_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_arg_seq* _res = NULL;
int _mark = p->mark;
{ // lambda_param_no_default+ '/' ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
Token * _literal;
Token * _literal_1;
asdl_arg_seq* a;
if (
(a = (asdl_arg_seq*)_loop1_73_rule(p)) // lambda_param_no_default+
&&
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
}
{ // lambda_param_no_default+ '/' &':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
Token * _literal;
asdl_arg_seq* a;
if (
(a = (asdl_arg_seq*)_loop1_73_rule(p)) // lambda_param_no_default+
&&
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
)
{
D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lambda_slash_with_default:
// | lambda_param_no_default* lambda_param_with_default+ '/' ','
// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
static SlashWithDefault*
lambda_slash_with_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
SlashWithDefault* _res = NULL;
int _mark = p->mark;
{ // lambda_param_no_default* lambda_param_with_default+ '/' ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
Token * _literal;
Token * _literal_1;
asdl_seq * a;
asdl_seq * b;
if (
(a = _loop0_71_rule(p)) // lambda_param_no_default*
&&
(b = _loop1_74_rule(p)) // lambda_param_with_default+
&&
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
_res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
}
{ // lambda_param_no_default* lambda_param_with_default+ '/' &':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
Token * _literal;
asdl_seq * a;
asdl_seq * b;
if (
(a = _loop0_71_rule(p)) // lambda_param_no_default*
&&
(b = _loop1_74_rule(p)) // lambda_param_with_default+
&&
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
)
{
D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
_res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lambda_star_etc:
// | invalid_lambda_star_etc
// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
// | lambda_kwds
static StarEtc*
lambda_star_etc_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
StarEtc* _res = NULL;
int _mark = p->mark;
if (p->call_invalid_rules) { // invalid_lambda_star_etc
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
void *invalid_lambda_star_etc_var;
if (
(invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
)
{
D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
_res = invalid_lambda_star_etc_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
}
{ // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
Token * _literal;
arg_ty a;
asdl_seq * b;
void *c;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = lambda_param_no_default_rule(p)) // lambda_param_no_default
&&
(b = _loop0_75_rule(p)) // lambda_param_maybe_default*
&&
(c = lambda_kwds_rule(p), !p->error_indicator) // lambda_kwds?
)
{
D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
_res = _PyPegen_star_etc ( p , a , b , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
}
{ // '*' ',' lambda_param_maybe_default+ lambda_kwds?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
Token * _literal;
Token * _literal_1;
asdl_seq * b;
void *c;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
(b = _loop1_76_rule(p)) // lambda_param_maybe_default+
&&
(c = lambda_kwds_rule(p), !p->error_indicator) // lambda_kwds?
)
{
D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
_res = _PyPegen_star_etc ( p , NULL , b , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
}
{ // lambda_kwds
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
arg_ty a;
if (
(a = lambda_kwds_rule(p)) // lambda_kwds
)
{
D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
_res = _PyPegen_star_etc ( p , NULL , NULL , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lambda_kwds: invalid_lambda_kwds | '**' lambda_param_no_default
static arg_ty
lambda_kwds_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arg_ty _res = NULL;
int _mark = p->mark;
if (p->call_invalid_rules) { // invalid_lambda_kwds
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_kwds"));
void *invalid_lambda_kwds_var;
if (
(invalid_lambda_kwds_var = invalid_lambda_kwds_rule(p)) // invalid_lambda_kwds
)
{
D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_kwds"));
_res = invalid_lambda_kwds_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_kwds"));
}
{ // '**' lambda_param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
Token * _literal;
arg_ty a;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(a = lambda_param_no_default_rule(p)) // lambda_param_no_default
)
{
D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lambda_param_no_default: lambda_param ',' | lambda_param &':'
static arg_ty
lambda_param_no_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arg_ty _res = NULL;
int _mark = p->mark;
{ // lambda_param ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
Token * _literal;
arg_ty a;
if (
(a = lambda_param_rule(p)) // lambda_param
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
}
{ // lambda_param &':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
arg_ty a;
if (
(a = lambda_param_rule(p)) // lambda_param
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
)
{
D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
static NameDefaultPair*
lambda_param_with_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
NameDefaultPair* _res = NULL;
int _mark = p->mark;
{ // lambda_param default ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
Token * _literal;
arg_ty a;
expr_ty c;
if (
(a = lambda_param_rule(p)) // lambda_param
&&
(c = default_rule(p)) // default
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
_res = _PyPegen_name_default_pair ( p , a , c , NULL );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
}
{ // lambda_param default &':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
arg_ty a;
expr_ty c;
if (
(a = lambda_param_rule(p)) // lambda_param
&&
(c = default_rule(p)) // default
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
)
{
D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
_res = _PyPegen_name_default_pair ( p , a , c , NULL );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
static NameDefaultPair*
lambda_param_maybe_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
NameDefaultPair* _res = NULL;
int _mark = p->mark;
{ // lambda_param default? ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
Token * _literal;
arg_ty a;
void *c;
if (
(a = lambda_param_rule(p)) // lambda_param
&&
(c = default_rule(p), !p->error_indicator) // default?
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
_res = _PyPegen_name_default_pair ( p , a , c , NULL );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
}
{ // lambda_param default? &':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
arg_ty a;
void *c;
if (
(a = lambda_param_rule(p)) // lambda_param
&&
(c = default_rule(p), !p->error_indicator) // default?
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
)
{
D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
_res = _PyPegen_name_default_pair ( p , a , c , NULL );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// lambda_param: NAME
static arg_ty
lambda_param_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
arg_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
expr_ty a;
if (
(a = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// fstring_middle: fstring_replacement_field | FSTRING_MIDDLE
static expr_ty
fstring_middle_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // fstring_replacement_field
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> fstring_middle[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field"));
expr_ty fstring_replacement_field_var;
if (
(fstring_replacement_field_var = fstring_replacement_field_rule(p)) // fstring_replacement_field
)
{
D(fprintf(stderr, "%*c+ fstring_middle[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field"));
_res = fstring_replacement_field_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s fstring_middle[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_replacement_field"));
}
{ // FSTRING_MIDDLE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> fstring_middle[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE"));
Token * t;
if (
(t = _PyPegen_expect_token(p, FSTRING_MIDDLE)) // token='FSTRING_MIDDLE'
)
{
D(fprintf(stderr, "%*c+ fstring_middle[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE"));
_res = _PyPegen_constant_from_token ( p , t );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s fstring_middle[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_MIDDLE"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// fstring_replacement_field:
// | '{' annotated_rhs '='? fstring_conversion? fstring_full_format_spec? '}'
// | invalid_replacement_field
static expr_ty
fstring_replacement_field_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '{' annotated_rhs '='? fstring_conversion? fstring_full_format_spec? '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? fstring_full_format_spec? '}'"));
Token * _literal;
expr_ty a;
void *conversion;
void *debug_expr;
void *format;
Token * rbrace;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(a = annotated_rhs_rule(p)) // annotated_rhs
&&
(debug_expr = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='?
&&
(conversion = fstring_conversion_rule(p), !p->error_indicator) // fstring_conversion?
&&
(format = fstring_full_format_spec_rule(p), !p->error_indicator) // fstring_full_format_spec?
&&
(rbrace = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? fstring_full_format_spec? '}'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyPegen_formatted_value ( p , a , debug_expr , conversion , format , rbrace , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? fstring_full_format_spec? '}'"));
}
if (p->call_invalid_rules) { // invalid_replacement_field
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_replacement_field"));
void *invalid_replacement_field_var;
if (
(invalid_replacement_field_var = invalid_replacement_field_rule(p)) // invalid_replacement_field
)
{
D(fprintf(stderr, "%*c+ fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_replacement_field"));
_res = invalid_replacement_field_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_replacement_field"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// fstring_conversion: "!" NAME
static ResultTokenWithMetadata*
fstring_conversion_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
ResultTokenWithMetadata* _res = NULL;
int _mark = p->mark;
{ // "!" NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> fstring_conversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"!\" NAME"));
expr_ty conv;
Token * conv_token;
if (
(conv_token = _PyPegen_expect_token(p, 54)) // token='!'
&&
(conv = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ fstring_conversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"!\" NAME"));
_res = _PyPegen_check_fstring_conversion ( p , conv_token , conv );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s fstring_conversion[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"!\" NAME"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// fstring_full_format_spec: ':' fstring_format_spec*
static ResultTokenWithMetadata*
fstring_full_format_spec_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
ResultTokenWithMetadata* _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // ':' fstring_format_spec*
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> fstring_full_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' fstring_format_spec*"));
Token * colon;
asdl_seq * spec;
if (
(colon = _PyPegen_expect_token(p, 11)) // token=':'
&&
(spec = _loop0_77_rule(p)) // fstring_format_spec*
)
{
D(fprintf(stderr, "%*c+ fstring_full_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' fstring_format_spec*"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyPegen_setup_full_format_spec ( p , colon , ( asdl_expr_seq* ) spec , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s fstring_full_format_spec[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' fstring_format_spec*"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// fstring_format_spec: FSTRING_MIDDLE | fstring_replacement_field
static expr_ty
fstring_format_spec_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // FSTRING_MIDDLE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> fstring_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE"));
Token * t;
if (
(t = _PyPegen_expect_token(p, FSTRING_MIDDLE)) // token='FSTRING_MIDDLE'
)
{
D(fprintf(stderr, "%*c+ fstring_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE"));
_res = _PyPegen_decoded_constant_from_token ( p , t );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s fstring_format_spec[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_MIDDLE"));
}
{ // fstring_replacement_field
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> fstring_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field"));
expr_ty fstring_replacement_field_var;
if (
(fstring_replacement_field_var = fstring_replacement_field_rule(p)) // fstring_replacement_field
)
{
D(fprintf(stderr, "%*c+ fstring_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field"));
_res = fstring_replacement_field_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s fstring_format_spec[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_replacement_field"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// fstring: FSTRING_START fstring_middle* FSTRING_END
static expr_ty
fstring_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // FSTRING_START fstring_middle* FSTRING_END
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_START fstring_middle* FSTRING_END"));
Token * a;
asdl_seq * b;
Token * c;
if (
(a = _PyPegen_expect_token(p, FSTRING_START)) // token='FSTRING_START'
&&
(b = _loop0_78_rule(p)) // fstring_middle*
&&
(c = _PyPegen_expect_token(p, FSTRING_END)) // token='FSTRING_END'
)
{
D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_START fstring_middle* FSTRING_END"));
_res = _PyPegen_joined_str ( p , a , ( asdl_expr_seq* ) b , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_START fstring_middle* FSTRING_END"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// string: STRING
static expr_ty
string_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // STRING
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> string[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
Token* s;
if (
(s = (Token*)_PyPegen_string_token(p)) // STRING
)
{
D(fprintf(stderr, "%*c+ string[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING"));
_res = _PyPegen_constant_from_string ( p , s );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s string[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// strings: ((fstring | string))+
static expr_ty
strings_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, strings_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // ((fstring | string))+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((fstring | string))+"));
asdl_expr_seq* a;
if (
(a = (asdl_expr_seq*)_loop1_79_rule(p)) // ((fstring | string))+
)
{
D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((fstring | string))+"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyPegen_concatenate_strings ( p , a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((fstring | string))+"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, strings_type, _res);
p->level--;
return _res;
}
// list: '[' star_named_expressions? ']'
static expr_ty
list_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '[' star_named_expressions? ']'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
Token * _literal;
Token * _literal_1;
void *a;
if (
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(a = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions?
&&
(_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
)
{
D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_List ( a , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
static expr_ty
tuple_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '(' [star_named_expression ',' star_named_expressions?] ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
Token * _literal;
Token * _literal_1;
void *a;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = _tmp_80_rule(p), !p->error_indicator) // [star_named_expression ',' star_named_expressions?]
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Tuple ( a , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// set: '{' star_named_expressions '}'
static expr_ty
set_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '{' star_named_expressions '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
Token * _literal;
Token * _literal_1;
asdl_expr_seq* a;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(a = star_named_expressions_rule(p)) // star_named_expressions
&&
(_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Set ( a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' star_named_expressions '}'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// dict: '{' double_starred_kvpairs? '}' | '{' invalid_double_starred_kvpairs '}'
static expr_ty
dict_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '{' double_starred_kvpairs? '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
Token * _literal;
Token * _literal_1;
void *a;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(a = double_starred_kvpairs_rule(p), !p->error_indicator) // double_starred_kvpairs?
&&
(_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Dict ( CHECK ( asdl_expr_seq* , _PyPegen_get_keys ( p , a ) ) , CHECK ( asdl_expr_seq* , _PyPegen_get_values ( p , a ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
}
{ // '{' invalid_double_starred_kvpairs '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
Token * _literal;
Token * _literal_1;
void *invalid_double_starred_kvpairs_var;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(invalid_double_starred_kvpairs_var = invalid_double_starred_kvpairs_rule(p)) // invalid_double_starred_kvpairs
&&
(_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
_res = _PyPegen_dummy_name(p, _literal, invalid_double_starred_kvpairs_var, _literal_1);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// double_starred_kvpairs: ','.double_starred_kvpair+ ','?
static asdl_seq*
double_starred_kvpairs_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq* _res = NULL;
int _mark = p->mark;
{ // ','.double_starred_kvpair+ ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_seq * a;
if (
(a = _gather_82_rule(p)) // ','.double_starred_kvpair+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// double_starred_kvpair: '**' bitwise_or | kvpair
static KeyValuePair*
double_starred_kvpair_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
KeyValuePair* _res = NULL;
int _mark = p->mark;
{ // '**' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
_res = _PyPegen_key_value_pair ( p , NULL , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
}
{ // kvpair
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
KeyValuePair* kvpair_var;
if (
(kvpair_var = kvpair_rule(p)) // kvpair
)
{
D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
_res = kvpair_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// kvpair: expression ':' expression
static KeyValuePair*
kvpair_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
KeyValuePair* _res = NULL;
int _mark = p->mark;
{ // expression ':' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = expression_rule(p)) // expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
_res = _PyPegen_key_value_pair ( p , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// for_if_clauses: for_if_clause+
static asdl_comprehension_seq*
for_if_clauses_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_comprehension_seq* _res = NULL;
int _mark = p->mark;
{ // for_if_clause+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
asdl_comprehension_seq* a;
if (
(a = (asdl_comprehension_seq*)_loop1_83_rule(p)) // for_if_clause+
)
{
D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// for_if_clause:
// | 'async' 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
// | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
// | invalid_for_if_clause
// | invalid_for_target
static comprehension_ty
for_if_clause_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
comprehension_ty _res = NULL;
int _mark = p->mark;
{ // 'async' 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async' 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
int _cut_var = 0;
Token * _keyword;
Token * _keyword_1;
Token * _keyword_2;
expr_ty a;
expr_ty b;
asdl_expr_seq* c;
if (
(_keyword = _PyPegen_expect_token(p, 682)) // token='async'
&&
(_keyword_1 = _PyPegen_expect_token(p, 678)) // token='for'
&&
(a = star_targets_rule(p)) // star_targets
&&
(_keyword_2 = _PyPegen_expect_token(p, 679)) // token='in'
&&
(_cut_var = 1)
&&
(b = disjunction_rule(p)) // disjunction
&&
(c = (asdl_expr_seq*)_loop0_84_rule(p)) // (('if' disjunction))*
)
{
D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async' 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
_res = CHECK_VERSION ( comprehension_ty , 6 , "Async comprehensions are" , _PyAST_comprehension ( a , b , c , 1 , p -> arena ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async' 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
if (_cut_var) {
p->level--;
return NULL;
}
}
{ // 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
int _cut_var = 0;
Token * _keyword;
Token * _keyword_1;
expr_ty a;
expr_ty b;
asdl_expr_seq* c;
if (
(_keyword = _PyPegen_expect_token(p, 678)) // token='for'
&&
(a = star_targets_rule(p)) // star_targets
&&
(_keyword_1 = _PyPegen_expect_token(p, 679)) // token='in'
&&
(_cut_var = 1)
&&
(b = disjunction_rule(p)) // disjunction
&&
(c = (asdl_expr_seq*)_loop0_84_rule(p)) // (('if' disjunction))*
)
{
D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
_res = _PyAST_comprehension ( a , b , c , 0 , p -> arena );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
if (_cut_var) {
p->level--;
return NULL;
}
}
if (p->call_invalid_rules) { // invalid_for_if_clause
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_if_clause"));
void *invalid_for_if_clause_var;
if (
(invalid_for_if_clause_var = invalid_for_if_clause_rule(p)) // invalid_for_if_clause
)
{
D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_if_clause"));
_res = invalid_for_if_clause_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_if_clause"));
}
if (p->call_invalid_rules) { // invalid_for_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
void *invalid_for_target_var;
if (
(invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
)
{
D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
_res = invalid_for_target_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension
static expr_ty
listcomp_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '[' named_expression for_if_clauses ']'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
Token * _literal;
Token * _literal_1;
expr_ty a;
asdl_comprehension_seq* b;
if (
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(a = named_expression_rule(p)) // named_expression
&&
(b = for_if_clauses_rule(p)) // for_if_clauses
&&
(_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
)
{
D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_ListComp ( a , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
}
if (p->call_invalid_rules) { // invalid_comprehension
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
void *invalid_comprehension_var;
if (
(invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
)
{
D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
_res = invalid_comprehension_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// setcomp: '{' named_expression for_if_clauses '}' | invalid_comprehension
static expr_ty
setcomp_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '{' named_expression for_if_clauses '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
Token * _literal;
Token * _literal_1;
expr_ty a;
asdl_comprehension_seq* b;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(a = named_expression_rule(p)) // named_expression
&&
(b = for_if_clauses_rule(p)) // for_if_clauses
&&
(_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_SetComp ( a , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
}
if (p->call_invalid_rules) { // invalid_comprehension
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
void *invalid_comprehension_var;
if (
(invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
)
{
D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
_res = invalid_comprehension_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// genexp:
// | '(' (assignment_expression | expression !':=') for_if_clauses ')'
// | invalid_comprehension
static expr_ty
genexp_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '(' (assignment_expression | expression !':=') for_if_clauses ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'"));
Token * _literal;
Token * _literal_1;
void *a;
asdl_comprehension_seq* b;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = _tmp_85_rule(p)) // assignment_expression | expression !':='
&&
(b = for_if_clauses_rule(p)) // for_if_clauses
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_GeneratorExp ( a , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'"));
}
if (p->call_invalid_rules) { // invalid_comprehension
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
void *invalid_comprehension_var;
if (
(invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
)
{
D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
_res = invalid_comprehension_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
static expr_ty
dictcomp_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '{' kvpair for_if_clauses '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
Token * _literal;
Token * _literal_1;
KeyValuePair* a;
asdl_comprehension_seq* b;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(a = kvpair_rule(p)) // kvpair
&&
(b = for_if_clauses_rule(p)) // for_if_clauses
&&
(_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_DictComp ( a -> key , a -> value , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
}
if (p->call_invalid_rules) { // invalid_dict_comprehension
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
void *invalid_dict_comprehension_var;
if (
(invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
)
{
D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
_res = invalid_dict_comprehension_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// arguments: args ','? &')' | invalid_arguments
static expr_ty
arguments_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
{ // args ','? &')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty a;
if (
(a = args_rule(p)) // args
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
)
{
D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
}
if (p->call_invalid_rules) { // invalid_arguments
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
void *invalid_arguments_var;
if (
(invalid_arguments_var = invalid_arguments_rule(p)) // invalid_arguments
)
{
D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
_res = invalid_arguments_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arguments"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, arguments_type, _res);
p->level--;
return _res;
}
// args:
// | ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]
// | kwargs
static expr_ty
args_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]"));
asdl_expr_seq* a;
void *b;
if (
(a = (asdl_expr_seq*)_gather_87_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+
&&
(b = _tmp_88_rule(p), !p->error_indicator) // [',' kwargs]
)
{
D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]"));
}
{ // kwargs
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
asdl_seq* a;
if (
(a = kwargs_rule(p)) // kwargs
)
{
D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( asdl_expr_seq* , _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( asdl_keyword_seq* , _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// kwargs:
// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
// | ','.kwarg_or_starred+
// | ','.kwarg_or_double_starred+
static asdl_seq*
kwargs_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq* _res = NULL;
int _mark = p->mark;
{ // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
Token * _literal;
asdl_seq * a;
asdl_seq * b;
if (
(a = _gather_90_rule(p)) // ','.kwarg_or_starred+
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(b = _gather_92_rule(p)) // ','.kwarg_or_double_starred+
)
{
D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
_res = _PyPegen_join_sequences ( p , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
}
{ // ','.kwarg_or_starred+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
asdl_seq * _gather_90_var;
if (
(_gather_90_var = _gather_90_rule(p)) // ','.kwarg_or_starred+
)
{
D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
_res = _gather_90_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
}
{ // ','.kwarg_or_double_starred+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
asdl_seq * _gather_92_var;
if (
(_gather_92_var = _gather_92_rule(p)) // ','.kwarg_or_double_starred+
)
{
D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
_res = _gather_92_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// starred_expression:
// | invalid_starred_expression_unpacking
// | '*' expression
// | invalid_starred_expression
static expr_ty
starred_expression_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_starred_expression_unpacking
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_starred_expression_unpacking"));
void *invalid_starred_expression_unpacking_var;
if (
(invalid_starred_expression_unpacking_var = invalid_starred_expression_unpacking_rule(p)) // invalid_starred_expression_unpacking
)
{
D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_starred_expression_unpacking"));
_res = invalid_starred_expression_unpacking_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_starred_expression_unpacking"));
}
{ // '*' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Starred ( a , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
}
if (p->call_invalid_rules) { // invalid_starred_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_starred_expression"));
void *invalid_starred_expression_var;
if (
(invalid_starred_expression_var = invalid_starred_expression_rule(p)) // invalid_starred_expression
)
{
D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_starred_expression"));
_res = invalid_starred_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_starred_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// kwarg_or_starred: invalid_kwarg | NAME '=' expression | starred_expression
static KeywordOrStarred*
kwarg_or_starred_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
KeywordOrStarred* _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_kwarg
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
void *invalid_kwarg_var;
if (
(invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
)
{
D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
_res = invalid_kwarg_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
}
{ // NAME '=' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
(_literal = _PyPegen_expect_token(p, 22)) // token='='
&&
(b = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
}
{ // starred_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
expr_ty a;
if (
(a = starred_expression_rule(p)) // starred_expression
)
{
D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
_res = _PyPegen_keyword_or_starred ( p , a , 0 );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// kwarg_or_double_starred: invalid_kwarg | NAME '=' expression | '**' expression
static KeywordOrStarred*
kwarg_or_double_starred_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
KeywordOrStarred* _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
if (p->call_invalid_rules) { // invalid_kwarg
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
void *invalid_kwarg_var;
if (
(invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
)
{
D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
_res = invalid_kwarg_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
}
{ // NAME '=' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
(_literal = _PyPegen_expect_token(p, 22)) // token='='
&&
(b = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
}
{ // '**' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(a = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( NULL , a , EXTRA ) ) , 1 );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// star_targets: star_target !',' | star_target ((',' star_target))* ','?
static expr_ty
star_targets_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // star_target !','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
expr_ty a;
if (
(a = star_target_rule(p)) // star_target
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
)
{
D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
}
{ // star_target ((',' star_target))* ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty a;
asdl_seq * b;
if (
(a = star_target_rule(p)) // star_target
&&
(b = _loop0_93_rule(p)) // ((',' star_target))*
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// star_targets_list_seq: ','.star_target+ ','?
static asdl_expr_seq*
star_targets_list_seq_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_expr_seq* _res = NULL;
int _mark = p->mark;
{ // ','.star_target+ ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_targets_list_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_expr_seq* a;
if (
(a = (asdl_expr_seq*)_gather_95_rule(p)) // ','.star_target+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ star_targets_list_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_targets_list_seq[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// star_targets_tuple_seq: star_target ((',' star_target))+ ','? | star_target ','
static asdl_expr_seq*
star_targets_tuple_seq_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_expr_seq* _res = NULL;
int _mark = p->mark;
{ // star_target ((',' star_target))+ ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty a;
asdl_seq * b;
if (
(a = star_target_rule(p)) // star_target
&&
(b = _loop1_96_rule(p)) // ((',' star_target))+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?"));
_res = ( asdl_expr_seq* ) _PyPegen_seq_insert_in_front ( p , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))+ ','?"));
}
{ // star_target ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ','"));
Token * _literal;
expr_ty a;
if (
(a = star_target_rule(p)) // star_target
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ','"));
_res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ','"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// star_target: '*' (!'*' star_target) | target_with_star_atom
static expr_ty
star_target_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // '*' (!'*' star_target)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
Token * _literal;
void *a;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = _tmp_97_rule(p)) // !'*' star_target
)
{
D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Starred ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
}
{ // target_with_star_atom
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target_with_star_atom"));
expr_ty target_with_star_atom_var;
if (
(target_with_star_atom_var = target_with_star_atom_rule(p)) // target_with_star_atom
)
{
D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target_with_star_atom"));
_res = target_with_star_atom_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target_with_star_atom"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, star_target_type, _res);
p->level--;
return _res;
}
// target_with_star_atom:
// | t_primary '.' NAME !t_lookahead
// | t_primary '[' slices ']' !t_lookahead
// | star_atom
static expr_ty
target_with_star_atom_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, target_with_star_atom_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // t_primary '.' NAME !t_lookahead
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = t_primary_rule(p)) // t_primary
&&
(_literal = _PyPegen_expect_token(p, 23)) // token='.'
&&
(b = _PyPegen_name_token(p)) // NAME
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) t_lookahead_rule, p)
)
{
D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
}
{ // t_primary '[' slices ']' !t_lookahead
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Token * _literal;
Token * _literal_1;
expr_ty a;
expr_ty b;
if (
(a = t_primary_rule(p)) // t_primary
&&
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(b = slices_rule(p)) // slices
&&
(_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) t_lookahead_rule, p)
)
{
D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Subscript ( a , b , Store , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
}
{ // star_atom
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
expr_ty star_atom_var;
if (
(star_atom_var = star_atom_rule(p)) // star_atom
)
{
D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
_res = star_atom_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, target_with_star_atom_type, _res);
p->level--;
return _res;
}
// star_atom:
// | NAME
// | '(' target_with_star_atom ')'
// | '(' star_targets_tuple_seq? ')'
// | '[' star_targets_list_seq? ']'
static expr_ty
star_atom_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
expr_ty a;
if (
(a = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
_res = _PyPegen_set_expr_context ( p , a , Store );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
}
{ // '(' target_with_star_atom ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'"));
Token * _literal;
Token * _literal_1;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = target_with_star_atom_rule(p)) // target_with_star_atom
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'"));
_res = _PyPegen_set_expr_context ( p , a , Store );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target_with_star_atom ')'"));
}
{ // '(' star_targets_tuple_seq? ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'"));
Token * _literal;
Token * _literal_1;
void *a;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = star_targets_tuple_seq_rule(p), !p->error_indicator) // star_targets_tuple_seq?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Tuple ( a , Store , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_tuple_seq? ')'"));
}
{ // '[' star_targets_list_seq? ']'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'"));
Token * _literal;
Token * _literal_1;
void *a;
if (
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(a = star_targets_list_seq_rule(p), !p->error_indicator) // star_targets_list_seq?
&&
(_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
)
{
D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_List ( a , Store , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_list_seq? ']'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
static expr_ty
single_target_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // single_subscript_attribute_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
expr_ty single_subscript_attribute_target_var;
if (
(single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
)
{
D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
_res = single_subscript_attribute_target_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
}
{ // NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
expr_ty a;
if (
(a = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
_res = _PyPegen_set_expr_context ( p , a , Store );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
}
{ // '(' single_target ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
Token * _literal;
Token * _literal_1;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = single_target_rule(p)) // single_target
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// single_subscript_attribute_target:
// | t_primary '.' NAME !t_lookahead
// | t_primary '[' slices ']' !t_lookahead
static expr_ty
single_subscript_attribute_target_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // t_primary '.' NAME !t_lookahead
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = t_primary_rule(p)) // t_primary
&&
(_literal = _PyPegen_expect_token(p, 23)) // token='.'
&&
(b = _PyPegen_name_token(p)) // NAME
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) t_lookahead_rule, p)
)
{
D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
}
{ // t_primary '[' slices ']' !t_lookahead
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Token * _literal;
Token * _literal_1;
expr_ty a;
expr_ty b;
if (
(a = t_primary_rule(p)) // t_primary
&&
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(b = slices_rule(p)) // slices
&&
(_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) t_lookahead_rule, p)
)
{
D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Subscript ( a , b , Store , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// Left-recursive
// t_primary:
// | t_primary '.' NAME &t_lookahead
// | t_primary '[' slices ']' &t_lookahead
// | t_primary genexp &t_lookahead
// | t_primary '(' arguments? ')' &t_lookahead
// | atom &t_lookahead
static expr_ty t_primary_raw(Parser *);
static expr_ty
t_primary_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
int _resmark = p->mark;
while (1) {
int tmpvar_9 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
if (tmpvar_9) {
p->level--;
return _res;
}
p->mark = _mark;
void *_raw = t_primary_raw(p);
if (p->error_indicator) {
p->level--;
return NULL;
}
if (_raw == NULL || p->mark <= _resmark)
break;
_resmark = p->mark;
_res = _raw;
}
p->mark = _resmark;
p->level--;
return _res;
}
static expr_ty
t_primary_raw(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // t_primary '.' NAME &t_lookahead
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = t_primary_rule(p)) // t_primary
&&
(_literal = _PyPegen_expect_token(p, 23)) // token='.'
&&
(b = _PyPegen_name_token(p)) // NAME
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) t_lookahead_rule, p)
)
{
D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
}
{ // t_primary '[' slices ']' &t_lookahead
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
Token * _literal;
Token * _literal_1;
expr_ty a;
expr_ty b;
if (
(a = t_primary_rule(p)) // t_primary
&&
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(b = slices_rule(p)) // slices
&&
(_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) t_lookahead_rule, p)
)
{
D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Subscript ( a , b , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
}
{ // t_primary genexp &t_lookahead
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
expr_ty a;
expr_ty b;
if (
(a = t_primary_rule(p)) // t_primary
&&
(b = genexp_rule(p)) // genexp
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) t_lookahead_rule, p)
)
{
D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Call ( a , CHECK ( asdl_expr_seq* , ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
}
{ // t_primary '(' arguments? ')' &t_lookahead
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
Token * _literal;
Token * _literal_1;
expr_ty a;
void *b;
if (
(a = t_primary_rule(p)) // t_primary
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(b = arguments_rule(p), !p->error_indicator) // arguments?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) t_lookahead_rule, p)
)
{
D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
}
{ // atom &t_lookahead
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
expr_ty a;
if (
(a = atom_rule(p)) // atom
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) t_lookahead_rule, p)
)
{
D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// t_lookahead: '(' | '[' | '.'
static void *
t_lookahead_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '('
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
)
{
D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
}
{ // '['
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 9)) // token='['
)
{
D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
}
{ // '.'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 23)) // token='.'
)
{
D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// del_targets: ','.del_target+ ','?
static asdl_expr_seq*
del_targets_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_expr_seq* _res = NULL;
int _mark = p->mark;
{ // ','.del_target+ ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_expr_seq* a;
if (
(a = (asdl_expr_seq*)_gather_99_rule(p)) // ','.del_target+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// del_target:
// | t_primary '.' NAME !t_lookahead
// | t_primary '[' slices ']' !t_lookahead
// | del_t_atom
static expr_ty
del_target_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // t_primary '.' NAME !t_lookahead
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = t_primary_rule(p)) // t_primary
&&
(_literal = _PyPegen_expect_token(p, 23)) // token='.'
&&
(b = _PyPegen_name_token(p)) // NAME
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) t_lookahead_rule, p)
)
{
D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Attribute ( a , b -> v . Name . id , Del , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
}
{ // t_primary '[' slices ']' !t_lookahead
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Token * _literal;
Token * _literal_1;
expr_ty a;
expr_ty b;
if (
(a = t_primary_rule(p)) // t_primary
&&
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(b = slices_rule(p)) // slices
&&
(_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) t_lookahead_rule, p)
)
{
D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Subscript ( a , b , Del , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
}
{ // del_t_atom
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
expr_ty del_t_atom_var;
if (
(del_t_atom_var = del_t_atom_rule(p)) // del_t_atom
)
{
D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
_res = del_t_atom_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, del_target_type, _res);
p->level--;
return _res;
}
// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
static expr_ty
del_t_atom_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
expr_ty a;
if (
(a = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
_res = _PyPegen_set_expr_context ( p , a , Del );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
}
{ // '(' del_target ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
Token * _literal;
Token * _literal_1;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = del_target_rule(p)) // del_target
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
_res = _PyPegen_set_expr_context ( p , a , Del );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
}
{ // '(' del_targets? ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
Token * _literal;
Token * _literal_1;
void *a;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = del_targets_rule(p), !p->error_indicator) // del_targets?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_Tuple ( a , Del , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
}
{ // '[' del_targets? ']'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
Token * _literal;
Token * _literal_1;
void *a;
if (
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(a = del_targets_rule(p), !p->error_indicator) // del_targets?
&&
(_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
)
{
D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_List ( a , Del , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// type_expressions:
// | ','.expression+ ',' '*' expression ',' '**' expression
// | ','.expression+ ',' '*' expression
// | ','.expression+ ',' '**' expression
// | '*' expression ',' '**' expression
// | '*' expression
// | '**' expression
// | ','.expression+
static asdl_expr_seq*
type_expressions_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_expr_seq* _res = NULL;
int _mark = p->mark;
{ // ','.expression+ ',' '*' expression ',' '**' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
Token * _literal;
Token * _literal_1;
Token * _literal_2;
Token * _literal_3;
asdl_seq * a;
expr_ty b;
expr_ty c;
if (
(a = _gather_101_rule(p)) // ','.expression+
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
&&
(b = expression_rule(p)) // expression
&&
(_literal_2 = _PyPegen_expect_token(p, 12)) // token=','
&&
(_literal_3 = _PyPegen_expect_token(p, 35)) // token='**'
&&
(c = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
_res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq* , _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
}
{ // ','.expression+ ',' '*' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
Token * _literal;
Token * _literal_1;
asdl_seq * a;
expr_ty b;
if (
(a = _gather_101_rule(p)) // ','.expression+
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
&&
(b = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
_res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
}
{ // ','.expression+ ',' '**' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
Token * _literal;
Token * _literal_1;
asdl_seq * a;
expr_ty b;
if (
(a = _gather_101_rule(p)) // ','.expression+
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(_literal_1 = _PyPegen_expect_token(p, 35)) // token='**'
&&
(b = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
_res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
}
{ // '*' expression ',' '**' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
Token * _literal;
Token * _literal_1;
Token * _literal_2;
expr_ty a;
expr_ty b;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = expression_rule(p)) // expression
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
(_literal_2 = _PyPegen_expect_token(p, 35)) // token='**'
&&
(b = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
_res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq* , _PyPegen_singleton_seq ( p , a ) ) , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
}
{ // '*' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
_res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
}
{ // '**' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
Token * _literal;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(a = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
_res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
}
{ // ','.expression+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
asdl_expr_seq* a;
if (
(a = (asdl_expr_seq*)_gather_101_rule(p)) // ','.expression+
)
{
D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// func_type_comment:
// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
// | invalid_double_type_comments
// | TYPE_COMMENT
static Token*
func_type_comment_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
Token* _res = NULL;
int _mark = p->mark;
{ // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
Token * newline_var;
Token * t;
if (
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
(t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_102_rule, p)
)
{
D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
_res = t;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
}
if (p->call_invalid_rules) { // invalid_double_type_comments
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
void *invalid_double_type_comments_var;
if (
(invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
)
{
D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
_res = invalid_double_type_comments_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
}
{ // TYPE_COMMENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
Token * type_comment_var;
if (
(type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
)
{
D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
_res = type_comment_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_arguments:
// | ((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+
// | expression for_if_clauses ',' [args | expression for_if_clauses]
// | NAME '=' expression for_if_clauses
// | [(args ',')] NAME '=' &(',' | ')')
// | args for_if_clauses
// | args ',' expression for_if_clauses
// | args ',' args
static void *
invalid_arguments_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+"));
asdl_seq * _gather_105_var;
void *_tmp_103_var;
Token * a;
if (
(_tmp_103_var = _tmp_103_rule(p)) // (','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs
&&
(a = _PyPegen_expect_token(p, 12)) // token=','
&&
(_gather_105_var = _gather_105_rule(p)) // ','.(starred_expression !'=')+
)
{
D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+"));
_res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "iterable argument unpacking follows keyword argument unpacking" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+"));
}
{ // expression for_if_clauses ',' [args | expression for_if_clauses]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
Token * _literal;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty a;
asdl_comprehension_seq* b;
if (
(a = expression_rule(p)) // expression
&&
(b = for_if_clauses_rule(p)) // for_if_clauses
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(_opt_var = _tmp_106_rule(p), !p->error_indicator) // [args | expression for_if_clauses]
)
{
D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , _PyPegen_get_last_comprehension_item ( PyPegen_last_item ( b , comprehension_ty ) ) , "Generator expression must be parenthesized" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
}
{ // NAME '=' expression for_if_clauses
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
expr_ty a;
Token * b;
expr_ty expression_var;
asdl_comprehension_seq* for_if_clauses_var;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
(b = _PyPegen_expect_token(p, 22)) // token='='
&&
(expression_var = expression_rule(p)) // expression
&&
(for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
)
{
D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression for_if_clauses"));
}
{ // [(args ',')] NAME '=' &(',' | ')')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[(args ',')] NAME '=' &(',' | ')')"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty a;
Token * b;
if (
(_opt_var = _tmp_107_rule(p), !p->error_indicator) // [(args ',')]
&&
(a = _PyPegen_name_token(p)) // NAME
&&
(b = _PyPegen_expect_token(p, 22)) // token='='
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_108_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(args ',')] NAME '=' &(',' | ')')"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expected argument value expression" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[(args ',')] NAME '=' &(',' | ')')"));
}
{ // args for_if_clauses
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
expr_ty a;
asdl_comprehension_seq* b;
if (
(a = args_rule(p)) // args
&&
(b = for_if_clauses_rule(p)) // for_if_clauses
)
{
D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
_res = _PyPegen_nonparen_genexp_in_call ( p , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
}
{ // args ',' expression for_if_clauses
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
Token * _literal;
expr_ty a;
expr_ty args_var;
asdl_comprehension_seq* b;
if (
(args_var = args_rule(p)) // args
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(a = expression_rule(p)) // expression
&&
(b = for_if_clauses_rule(p)) // for_if_clauses
)
{
D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , _PyPegen_get_last_comprehension_item ( PyPegen_last_item ( b , comprehension_ty ) ) , "Generator expression must be parenthesized" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
}
{ // args ',' args
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
Token * _literal;
expr_ty a;
expr_ty args_var;
if (
(a = args_rule(p)) // args
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(args_var = args_rule(p)) // args
)
{
D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
_res = _PyPegen_arguments_parsing_error ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_kwarg:
// | ('True' | 'False' | 'None') '='
// | NAME '=' expression for_if_clauses
// | !(NAME '=') expression '='
// | '**' expression '=' expression
static void *
invalid_kwarg_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ('True' | 'False' | 'None') '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('True' | 'False' | 'None') '='"));
Token* a;
Token * b;
if (
(a = (Token*)_tmp_109_rule(p)) // 'True' | 'False' | 'None'
&&
(b = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('True' | 'False' | 'None') '='"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to %s" , PyBytes_AS_STRING ( a -> bytes ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('True' | 'False' | 'None') '='"));
}
{ // NAME '=' expression for_if_clauses
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
expr_ty a;
Token * b;
expr_ty expression_var;
asdl_comprehension_seq* for_if_clauses_var;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
(b = _PyPegen_expect_token(p, 22)) // token='='
&&
(expression_var = expression_rule(p)) // expression
&&
(for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
)
{
D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression for_if_clauses"));
}
{ // !(NAME '=') expression '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(NAME '=') expression '='"));
expr_ty a;
Token * b;
if (
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_110_rule, p)
&&
(a = expression_rule(p)) // expression
&&
(b = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME '=') expression '='"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expression cannot contain assignment, perhaps you meant \"==\"?" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(NAME '=') expression '='"));
}
{ // '**' expression '=' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression '=' expression"));
Token * _literal;
Token * a;
expr_ty b;
expr_ty expression_var;
if (
(a = _PyPegen_expect_token(p, 35)) // token='**'
&&
(expression_var = expression_rule(p)) // expression
&&
(_literal = _PyPegen_expect_token(p, 22)) // token='='
&&
(b = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression '=' expression"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to keyword argument unpacking" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression '=' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// expression_without_invalid:
// | disjunction 'if' disjunction 'else' expression
// | disjunction
// | lambdef
static expr_ty
expression_without_invalid_rule(Parser *p)
{
int _prev_call_invalid = p->call_invalid_rules;
p->call_invalid_rules = 0;
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->call_invalid_rules = _prev_call_invalid;
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
p->call_invalid_rules = _prev_call_invalid;
p->level--;
return NULL;
}
int _start_lineno = p->tokens[_mark]->lineno;
UNUSED(_start_lineno); // Only used by EXTRA macro
int _start_col_offset = p->tokens[_mark]->col_offset;
UNUSED(_start_col_offset); // Only used by EXTRA macro
{ // disjunction 'if' disjunction 'else' expression
if (p->error_indicator) {
p->call_invalid_rules = _prev_call_invalid;
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
Token * _keyword;
Token * _keyword_1;
expr_ty a;
expr_ty b;
expr_ty c;
if (
(a = disjunction_rule(p)) // disjunction
&&
(_keyword = _PyPegen_expect_token(p, 668)) // token='if'
&&
(b = disjunction_rule(p)) // disjunction
&&
(_keyword_1 = _PyPegen_expect_token(p, 671)) // token='else'
&&
(c = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
p->call_invalid_rules = _prev_call_invalid;
p->level--;
return NULL;
}
int _end_lineno = _token->end_lineno;
UNUSED(_end_lineno); // Only used by EXTRA macro
int _end_col_offset = _token->end_col_offset;
UNUSED(_end_col_offset); // Only used by EXTRA macro
_res = _PyAST_IfExp ( b , a , c , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->call_invalid_rules = _prev_call_invalid;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
}
{ // disjunction
if (p->error_indicator) {
p->call_invalid_rules = _prev_call_invalid;
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
expr_ty disjunction_var;
if (
(disjunction_var = disjunction_rule(p)) // disjunction
)
{
D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
_res = disjunction_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
}
{ // lambdef
if (p->error_indicator) {
p->call_invalid_rules = _prev_call_invalid;
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
expr_ty lambdef_var;
if (
(lambdef_var = lambdef_rule(p)) // lambdef
)
{
D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
_res = lambdef_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
}
_res = NULL;
done:
p->call_invalid_rules = _prev_call_invalid;
p->level--;
return _res;
}
// invalid_legacy_expression: NAME !'(' star_expressions
static void *
invalid_legacy_expression_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // NAME !'(' star_expressions
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_legacy_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME !'(' star_expressions"));
expr_ty a;
expr_ty b;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 7) // token='('
&&
(b = star_expressions_rule(p)) // star_expressions
)
{
D(fprintf(stderr, "%*c+ invalid_legacy_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME !'(' star_expressions"));
_res = _PyPegen_check_legacy_stmt ( p , a ) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Missing parentheses in call to '%U'. Did you mean %U(...)?" , a -> v . Name . id , a -> v . Name . id ) : NULL;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_legacy_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME !'(' star_expressions"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_type_param: '*' NAME ':' expression | '**' NAME ':' expression
static void *
invalid_type_param_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '*' NAME ':' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' NAME ':' expression"));
Token * _literal;
expr_ty a;
Token * colon;
expr_ty e;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = _PyPegen_name_token(p)) // NAME
&&
(colon = _PyPegen_expect_token(p, 11)) // token=':'
&&
(e = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ invalid_type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' NAME ':' expression"));
_res = RAISE_SYNTAX_ERROR_STARTING_FROM ( colon , e -> kind == Tuple_kind ? "cannot use constraints with TypeVarTuple" : "cannot use bound with TypeVarTuple" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_type_param[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' NAME ':' expression"));
}
{ // '**' NAME ':' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' NAME ':' expression"));
Token * _literal;
expr_ty a;
Token * colon;
expr_ty e;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(a = _PyPegen_name_token(p)) // NAME
&&
(colon = _PyPegen_expect_token(p, 11)) // token=':'
&&
(e = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ invalid_type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' NAME ':' expression"));
_res = RAISE_SYNTAX_ERROR_STARTING_FROM ( colon , e -> kind == Tuple_kind ? "cannot use constraints with ParamSpec" : "cannot use bound with ParamSpec" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_type_param[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' NAME ':' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_expression:
// | !(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid
// | disjunction 'if' disjunction !('else' | ':')
// | 'lambda' lambda_params? ':' &FSTRING_MIDDLE
static void *
invalid_expression_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // !(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid"));
expr_ty a;
expr_ty b;
if (
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_111_rule, p)
&&
(a = disjunction_rule(p)) // disjunction
&&
(b = expression_without_invalid_rule(p)) // expression_without_invalid
)
{
D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid"));
_res = _PyPegen_check_legacy_stmt ( p , a ) ? NULL : p -> tokens [p -> mark - 1] -> level == 0 ? NULL : RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Perhaps you forgot a comma?" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid"));
}
{ // disjunction 'if' disjunction !('else' | ':')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')"));
Token * _keyword;
expr_ty a;
expr_ty b;
if (
(a = disjunction_rule(p)) // disjunction
&&
(_keyword = _PyPegen_expect_token(p, 668)) // token='if'
&&
(b = disjunction_rule(p)) // disjunction
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_112_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expected 'else' after 'if' expression" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')"));
}
{ // 'lambda' lambda_params? ':' &FSTRING_MIDDLE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' &FSTRING_MIDDLE"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * a;
Token * b;
if (
(a = _PyPegen_expect_token(p, 609)) // token='lambda'
&&
(_opt_var = lambda_params_rule(p), !p->error_indicator) // lambda_params?
&&
(b = _PyPegen_expect_token(p, 11)) // token=':'
&&
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, FSTRING_MIDDLE) // token=FSTRING_MIDDLE
)
{
D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' &FSTRING_MIDDLE"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "f-string: lambda expressions are not allowed without parentheses" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' &FSTRING_MIDDLE"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_named_expression:
// | expression ':=' expression
// | NAME '=' bitwise_or !('=' | ':=')
// | !(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')
static void *
invalid_named_expression_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
if (_PyPegen_is_memoized(p, invalid_named_expression_type, &_res)) {
p->level--;
return _res;
}
int _mark = p->mark;
{ // expression ':=' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
Token * _literal;
expr_ty a;
expr_ty expression_var;
if (
(a = expression_rule(p)) // expression
&&
(_literal = _PyPegen_expect_token(p, 53)) // token=':='
&&
(expression_var = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
}
{ // NAME '=' bitwise_or !('=' | ':=')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')"));
Token * _literal;
expr_ty a;
expr_ty b;
if (
(a = _PyPegen_name_token(p)) // NAME
&&
(_literal = _PyPegen_expect_token(p, 22)) // token='='
&&
(b = bitwise_or_rule(p)) // bitwise_or
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_113_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')"));
}
{ // !(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')"));
expr_ty a;
Token * b;
expr_ty bitwise_or_var;
if (
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_114_rule, p)
&&
(a = bitwise_or_rule(p)) // bitwise_or
&&
(b = _PyPegen_expect_token(p, 22)) // token='='
&&
(bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_113_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot assign to %s here. Maybe you meant '==' instead of '='?" , _PyPegen_get_expr_name ( a ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')"));
}
_res = NULL;
done:
_PyPegen_insert_memo(p, _mark, invalid_named_expression_type, _res);
p->level--;
return _res;
}
// invalid_assignment:
// | invalid_ann_assign_target ':' expression
// | star_named_expression ',' star_named_expressions* ':' expression
// | expression ':' expression
// | ((star_targets '='))* star_expressions '='
// | ((star_targets '='))* yield_expr '='
// | star_expressions augassign annotated_rhs
static void *
invalid_assignment_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // invalid_ann_assign_target ':' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
Token * _literal;
expr_ty a;
expr_ty expression_var;
if (
(a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(expression_var = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not %s) can be annotated" , _PyPegen_get_expr_name ( a ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression"));
}
{ // star_named_expression ',' star_named_expressions* ':' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
Token * _literal;
Token * _literal_1;
asdl_seq * _loop0_115_var;
expr_ty a;
expr_ty expression_var;
if (
(a = star_named_expression_rule(p)) // star_named_expression
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(_loop0_115_var = _loop0_115_rule(p)) // star_named_expressions*
&&
(_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
&&
(expression_var = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
}
{ // expression ':' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
Token * _literal;
expr_ty a;
expr_ty expression_var;
if (
(a = expression_rule(p)) // expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(expression_var = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
}
{ // ((star_targets '='))* star_expressions '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
Token * _literal;
asdl_seq * _loop0_116_var;
expr_ty a;
if (
(_loop0_116_var = _loop0_116_rule(p)) // ((star_targets '='))*
&&
(a = star_expressions_rule(p)) // star_expressions
&&
(_literal = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
_res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
}
{ // ((star_targets '='))* yield_expr '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
Token * _literal;
asdl_seq * _loop0_116_var;
expr_ty a;
if (
(_loop0_116_var = _loop0_116_rule(p)) // ((star_targets '='))*
&&
(a = yield_expr_rule(p)) // yield_expr
&&
(_literal = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
}
{ // star_expressions augassign annotated_rhs
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign annotated_rhs"));
expr_ty a;
expr_ty annotated_rhs_var;
AugOperator* augassign_var;
if (
(a = star_expressions_rule(p)) // star_expressions
&&
(augassign_var = augassign_rule(p)) // augassign
&&
(annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs
)
{
D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign annotated_rhs"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign annotated_rhs"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
static expr_ty
invalid_ann_assign_target_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
expr_ty _res = NULL;
int _mark = p->mark;
{ // list
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
expr_ty list_var;
if (
(list_var = list_rule(p)) // list
)
{
D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
_res = list_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
}
{ // tuple
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
expr_ty tuple_var;
if (
(tuple_var = tuple_rule(p)) // tuple
)
{
D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
_res = tuple_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
}
{ // '(' invalid_ann_assign_target ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
Token * _literal;
Token * _literal_1;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_del_stmt: 'del' star_expressions
static void *
invalid_del_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'del' star_expressions
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
Token * _keyword;
expr_ty a;
if (
(_keyword = _PyPegen_expect_token(p, 613)) // token='del'
&&
(a = star_expressions_rule(p)) // star_expressions
)
{
D(fprintf(stderr, "%*c+ invalid_del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
_res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_block: NEWLINE !INDENT
static void *
invalid_block_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
Token * newline_var;
if (
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_comprehension:
// | ('[' | '(' | '{') starred_expression for_if_clauses
// | ('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses
// | ('[' | '{') star_named_expression ',' for_if_clauses
static void *
invalid_comprehension_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ('[' | '(' | '{') starred_expression for_if_clauses
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
void *_tmp_117_var;
expr_ty a;
asdl_comprehension_seq* for_if_clauses_var;
if (
(_tmp_117_var = _tmp_117_rule(p)) // '[' | '(' | '{'
&&
(a = starred_expression_rule(p)) // starred_expression
&&
(for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
)
{
D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
}
{ // ('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses"));
Token * _literal;
void *_tmp_118_var;
expr_ty a;
asdl_expr_seq* b;
asdl_comprehension_seq* for_if_clauses_var;
if (
(_tmp_118_var = _tmp_118_rule(p)) // '[' | '{'
&&
(a = star_named_expression_rule(p)) // star_named_expression
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(b = star_named_expressions_rule(p)) // star_named_expressions
&&
(for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
)
{
D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , PyPegen_last_item ( b , expr_ty ) , "did you forget parentheses around the comprehension target?" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses"));
}
{ // ('[' | '{') star_named_expression ',' for_if_clauses
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses"));
void *_tmp_118_var;
expr_ty a;
Token * b;
asdl_comprehension_seq* for_if_clauses_var;
if (
(_tmp_118_var = _tmp_118_rule(p)) // '[' | '{'
&&
(a = star_named_expression_rule(p)) // star_named_expression
&&
(b = _PyPegen_expect_token(p, 12)) // token=','
&&
(for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
)
{
D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "did you forget parentheses around the comprehension target?" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
static void *
invalid_dict_comprehension_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '{' '**' bitwise_or for_if_clauses '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
Token * _literal;
Token * _literal_1;
Token * a;
expr_ty bitwise_or_var;
asdl_comprehension_seq* for_if_clauses_var;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(a = _PyPegen_expect_token(p, 35)) // token='**'
&&
(bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
&&
(for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
&&
(_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_parameters:
// | "/" ','
// | (slash_no_default | slash_with_default) param_maybe_default* '/'
// | slash_no_default? param_no_default* invalid_parameters_helper param_no_default
// | param_no_default* '(' param_no_default+ ','? ')'
// | [(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'
// | param_maybe_default+ '/' '*'
static void *
invalid_parameters_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // "/" ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"/\" ','"));
Token * _literal;
Token * a;
if (
(a = _PyPegen_expect_token(p, 17)) // token='/'
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"/\" ','"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "at least one argument must precede /" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"/\" ','"));
}
{ // (slash_no_default | slash_with_default) param_maybe_default* '/'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(slash_no_default | slash_with_default) param_maybe_default* '/'"));
asdl_seq * _loop0_32_var;
void *_tmp_119_var;
Token * a;
if (
(_tmp_119_var = _tmp_119_rule(p)) // slash_no_default | slash_with_default
&&
(_loop0_32_var = _loop0_32_rule(p)) // param_maybe_default*
&&
(a = _PyPegen_expect_token(p, 17)) // token='/'
)
{
D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(slash_no_default | slash_with_default) param_maybe_default* '/'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ may appear only once" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(slash_no_default | slash_with_default) param_maybe_default* '/'"));
}
{ // slash_no_default? param_no_default* invalid_parameters_helper param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default? param_no_default* invalid_parameters_helper param_no_default"));
asdl_seq * _loop0_28_var;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
arg_ty a;
void *invalid_parameters_helper_var;
if (
(_opt_var = slash_no_default_rule(p), !p->error_indicator) // slash_no_default?
&&
(_loop0_28_var = _loop0_28_rule(p)) // param_no_default*
&&
(invalid_parameters_helper_var = invalid_parameters_helper_rule(p)) // invalid_parameters_helper
&&
(a = param_no_default_rule(p)) // param_no_default
)
{
D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default? param_no_default* invalid_parameters_helper param_no_default"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameter without a default follows parameter with a default" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default? param_no_default* invalid_parameters_helper param_no_default"));
}
{ // param_no_default* '(' param_no_default+ ','? ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* '(' param_no_default+ ','? ')'"));
asdl_seq * _loop0_28_var;
asdl_seq * _loop1_30_var;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * a;
Token * b;
if (
(_loop0_28_var = _loop0_28_rule(p)) // param_no_default*
&&
(a = _PyPegen_expect_token(p, 7)) // token='('
&&
(_loop1_30_var = _loop1_30_rule(p)) // param_no_default+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(b = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* '(' param_no_default+ ','? ')'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Function parameters cannot be parenthesized" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* '(' param_no_default+ ','? ')'"));
}
{ // [(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'"));
Token * _literal;
asdl_seq * _loop0_32_var;
asdl_seq * _loop0_32_var_1;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_tmp_120_var;
Token * a;
if (
(_opt_var = _tmp_119_rule(p), !p->error_indicator) // [(slash_no_default | slash_with_default)]
&&
(_loop0_32_var = _loop0_32_rule(p)) // param_maybe_default*
&&
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_tmp_120_var = _tmp_120_rule(p)) // ',' | param_no_default
&&
(_loop0_32_var_1 = _loop0_32_rule(p)) // param_maybe_default*
&&
(a = _PyPegen_expect_token(p, 17)) // token='/'
)
{
D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ must be ahead of *" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'"));
}
{ // param_maybe_default+ '/' '*'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default+ '/' '*'"));
Token * _literal;
asdl_seq * _loop1_33_var;
Token * a;
if (
(_loop1_33_var = _loop1_33_rule(p)) // param_maybe_default+
&&
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
&&
(a = _PyPegen_expect_token(p, 16)) // token='*'
)
{
D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_maybe_default+ '/' '*'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected comma between / and *" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default+ '/' '*'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_default: '=' &(')' | ',')
static void *
invalid_default_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '=' &(')' | ',')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' &(')' | ',')"));
Token * a;
if (
(a = _PyPegen_expect_token(p, 22)) // token='='
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_121_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' &(')' | ',')"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected default value expression" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_default[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' &(')' | ',')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_star_etc:
// | '*' (')' | ',' (')' | '**'))
// | '*' ',' TYPE_COMMENT
// | '*' param '='
// | '*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')
static void *
invalid_star_etc_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '*' (')' | ',' (')' | '**'))
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
void *_tmp_122_var;
Token * a;
if (
(a = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_tmp_122_var = _tmp_122_rule(p)) // ')' | ',' (')' | '**')
)
{
D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "named arguments must follow bare *" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
}
{ // '*' ',' TYPE_COMMENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
Token * _literal;
Token * _literal_1;
Token * type_comment_var;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
(type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
)
{
D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
_res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
}
{ // '*' param '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param '='"));
Token * _literal;
Token * a;
arg_ty param_var;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(param_var = param_rule(p)) // param
&&
(a = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param '='"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-positional argument cannot have default value" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param '='"));
}
{ // '*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')"));
Token * _literal;
asdl_seq * _loop0_32_var;
void *_tmp_123_var;
void *_tmp_123_var_1;
Token * a;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_tmp_123_var = _tmp_123_rule(p)) // param_no_default | ','
&&
(_loop0_32_var = _loop0_32_rule(p)) // param_maybe_default*
&&
(a = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_tmp_123_var_1 = _tmp_123_rule(p)) // param_no_default | ','
)
{
D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "* argument may appear only once" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_kwds: '**' param '=' | '**' param ',' param | '**' param ',' ('*' | '**' | '/')
static void *
invalid_kwds_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '**' param '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param '='"));
Token * _literal;
Token * a;
arg_ty param_var;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(param_var = param_rule(p)) // param
&&
(a = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param '='"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-keyword argument cannot have default value" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_kwds[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param '='"));
}
{ // '**' param ',' param
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param ',' param"));
Token * _literal;
Token * _literal_1;
arg_ty a;
arg_ty param_var;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(param_var = param_rule(p)) // param
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
(a = param_rule(p)) // param
)
{
D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param ',' param"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_kwds[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param ',' param"));
}
{ // '**' param ',' ('*' | '**' | '/')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param ',' ('*' | '**' | '/')"));
Token * _literal;
Token * _literal_1;
Token* a;
arg_ty param_var;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(param_var = param_rule(p)) // param
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
(a = (Token*)_tmp_124_rule(p)) // '*' | '**' | '/'
)
{
D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param ',' ('*' | '**' | '/')"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_kwds[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param ',' ('*' | '**' | '/')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_parameters_helper: slash_with_default | param_with_default+
static void *
invalid_parameters_helper_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // slash_with_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
SlashWithDefault* a;
if (
(a = slash_with_default_rule(p)) // slash_with_default
)
{
D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
_res = _PyPegen_singleton_seq ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
}
{ // param_with_default+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
asdl_seq * _loop1_31_var;
if (
(_loop1_31_var = _loop1_31_rule(p)) // param_with_default+
)
{
D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
_res = _loop1_31_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_lambda_parameters:
// | "/" ','
// | (lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'
// | lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default
// | lambda_param_no_default* '(' ','.lambda_param+ ','? ')'
// | [(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'
// | lambda_param_maybe_default+ '/' '*'
static void *
invalid_lambda_parameters_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // "/" ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"/\" ','"));
Token * _literal;
Token * a;
if (
(a = _PyPegen_expect_token(p, 17)) // token='/'
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"/\" ','"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "at least one argument must precede /" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"/\" ','"));
}
{ // (lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'"));
asdl_seq * _loop0_75_var;
void *_tmp_125_var;
Token * a;
if (
(_tmp_125_var = _tmp_125_rule(p)) // lambda_slash_no_default | lambda_slash_with_default
&&
(_loop0_75_var = _loop0_75_rule(p)) // lambda_param_maybe_default*
&&
(a = _PyPegen_expect_token(p, 17)) // token='/'
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ may appear only once" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'"));
}
{ // lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default"));
asdl_seq * _loop0_71_var;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
arg_ty a;
void *invalid_lambda_parameters_helper_var;
if (
(_opt_var = lambda_slash_no_default_rule(p), !p->error_indicator) // lambda_slash_no_default?
&&
(_loop0_71_var = _loop0_71_rule(p)) // lambda_param_no_default*
&&
(invalid_lambda_parameters_helper_var = invalid_lambda_parameters_helper_rule(p)) // invalid_lambda_parameters_helper
&&
(a = lambda_param_no_default_rule(p)) // lambda_param_no_default
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameter without a default follows parameter with a default" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default"));
}
{ // lambda_param_no_default* '(' ','.lambda_param+ ','? ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* '(' ','.lambda_param+ ','? ')'"));
asdl_seq * _gather_127_var;
asdl_seq * _loop0_71_var;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * a;
Token * b;
if (
(_loop0_71_var = _loop0_71_rule(p)) // lambda_param_no_default*
&&
(a = _PyPegen_expect_token(p, 7)) // token='('
&&
(_gather_127_var = _gather_127_rule(p)) // ','.lambda_param+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(b = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* '(' ','.lambda_param+ ','? ')'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Lambda expression parameters cannot be parenthesized" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* '(' ','.lambda_param+ ','? ')'"));
}
{ // [(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'"));
Token * _literal;
asdl_seq * _loop0_75_var;
asdl_seq * _loop0_75_var_1;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_tmp_128_var;
Token * a;
if (
(_opt_var = _tmp_125_rule(p), !p->error_indicator) // [(lambda_slash_no_default | lambda_slash_with_default)]
&&
(_loop0_75_var = _loop0_75_rule(p)) // lambda_param_maybe_default*
&&
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_tmp_128_var = _tmp_128_rule(p)) // ',' | lambda_param_no_default
&&
(_loop0_75_var_1 = _loop0_75_rule(p)) // lambda_param_maybe_default*
&&
(a = _PyPegen_expect_token(p, 17)) // token='/'
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ must be ahead of *" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'"));
}
{ // lambda_param_maybe_default+ '/' '*'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default+ '/' '*'"));
Token * _literal;
asdl_seq * _loop1_76_var;
Token * a;
if (
(_loop1_76_var = _loop1_76_rule(p)) // lambda_param_maybe_default+
&&
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
&&
(a = _PyPegen_expect_token(p, 16)) // token='*'
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default+ '/' '*'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected comma between / and *" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default+ '/' '*'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_lambda_parameters_helper:
// | lambda_slash_with_default
// | lambda_param_with_default+
static void *
invalid_lambda_parameters_helper_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // lambda_slash_with_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
SlashWithDefault* a;
if (
(a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
_res = _PyPegen_singleton_seq ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
}
{ // lambda_param_with_default+
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
asdl_seq * _loop1_74_var;
if (
(_loop1_74_var = _loop1_74_rule(p)) // lambda_param_with_default+
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
_res = _loop1_74_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_lambda_star_etc:
// | '*' (':' | ',' (':' | '**'))
// | '*' lambda_param '='
// | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')
static void *
invalid_lambda_star_etc_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '*' (':' | ',' (':' | '**'))
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
Token * _literal;
void *_tmp_129_var;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_tmp_129_var = _tmp_129_rule(p)) // ':' | ',' (':' | '**')
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
_res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
}
{ // '*' lambda_param '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param '='"));
Token * _literal;
Token * a;
arg_ty lambda_param_var;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(lambda_param_var = lambda_param_rule(p)) // lambda_param
&&
(a = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param '='"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-positional argument cannot have default value" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param '='"));
}
{ // '*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')"));
Token * _literal;
asdl_seq * _loop0_75_var;
void *_tmp_130_var;
void *_tmp_130_var_1;
Token * a;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_tmp_130_var = _tmp_130_rule(p)) // lambda_param_no_default | ','
&&
(_loop0_75_var = _loop0_75_rule(p)) // lambda_param_maybe_default*
&&
(a = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_tmp_130_var_1 = _tmp_130_rule(p)) // lambda_param_no_default | ','
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "* argument may appear only once" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_lambda_kwds:
// | '**' lambda_param '='
// | '**' lambda_param ',' lambda_param
// | '**' lambda_param ',' ('*' | '**' | '/')
static void *
invalid_lambda_kwds_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '**' lambda_param '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param '='"));
Token * _literal;
Token * a;
arg_ty lambda_param_var;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(lambda_param_var = lambda_param_rule(p)) // lambda_param
&&
(a = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param '='"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-keyword argument cannot have default value" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param '='"));
}
{ // '**' lambda_param ',' lambda_param
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' lambda_param"));
Token * _literal;
Token * _literal_1;
arg_ty a;
arg_ty lambda_param_var;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(lambda_param_var = lambda_param_rule(p)) // lambda_param
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
(a = lambda_param_rule(p)) // lambda_param
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' lambda_param"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param ',' lambda_param"));
}
{ // '**' lambda_param ',' ('*' | '**' | '/')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' ('*' | '**' | '/')"));
Token * _literal;
Token * _literal_1;
Token* a;
arg_ty lambda_param_var;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
(lambda_param_var = lambda_param_rule(p)) // lambda_param
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
(a = (Token*)_tmp_124_rule(p)) // '*' | '**' | '/'
)
{
D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' ('*' | '**' | '/')"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param ',' ('*' | '**' | '/')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
static void *
invalid_double_type_comments_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
Token * indent_var;
Token * newline_var;
Token * newline_var_1;
Token * type_comment_var;
Token * type_comment_var_1;
if (
(type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
(type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
&&
(newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
(indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
)
{
D(fprintf(stderr, "%*c+ invalid_double_type_comments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
_res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_with_item: expression 'as' expression &(',' | ')' | ':')
static void *
invalid_with_item_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // expression 'as' expression &(',' | ')' | ':')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')"));
Token * _keyword;
expr_ty a;
expr_ty expression_var;
if (
(expression_var = expression_rule(p)) // expression
&&
(_keyword = _PyPegen_expect_token(p, 666)) // token='as'
&&
(a = expression_rule(p)) // expression
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_36_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')"));
_res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_for_if_clause: 'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in'
static void *
invalid_for_if_clause_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in'"));
Token * _keyword;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_tmp_131_var;
if (
(_opt_var = _PyPegen_expect_token(p, 682), !p->error_indicator) // 'async'?
&&
(_keyword = _PyPegen_expect_token(p, 678)) // token='for'
&&
(_tmp_131_var = _tmp_131_rule(p)) // bitwise_or ((',' bitwise_or))* ','?
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 679) // token='in'
)
{
D(fprintf(stderr, "%*c+ invalid_for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in'"));
_res = RAISE_SYNTAX_ERROR ( "'in' expected after for-loop variables" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_for_target: 'async'? 'for' star_expressions
static void *
invalid_for_target_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'async'? 'for' star_expressions
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_expressions"));
Token * _keyword;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty a;
if (
(_opt_var = _PyPegen_expect_token(p, 682), !p->error_indicator) // 'async'?
&&
(_keyword = _PyPegen_expect_token(p, 678)) // token='for'
&&
(a = star_expressions_rule(p)) // star_expressions
)
{
D(fprintf(stderr, "%*c+ invalid_for_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_expressions"));
_res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'for' star_expressions"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_group: '(' starred_expression ')' | '(' '**' expression ')'
static void *
invalid_group_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '(' starred_expression ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
Token * _literal;
Token * _literal_1;
expr_ty a;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = starred_expression_rule(p)) // starred_expression
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use starred expression here" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
}
{ // '(' '**' expression ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' '**' expression ')'"));
Token * _literal;
Token * _literal_1;
Token * a;
expr_ty expression_var;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = _PyPegen_expect_token(p, 35)) // token='**'
&&
(expression_var = expression_rule(p)) // expression
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' '**' expression ')'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use double starred expression here" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' '**' expression ')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_import: 'import' ','.dotted_name+ 'from' dotted_name | 'import' NEWLINE
static void *
invalid_import_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'import' ','.dotted_name+ 'from' dotted_name
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_import[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' ','.dotted_name+ 'from' dotted_name"));
asdl_seq * _gather_133_var;
Token * _keyword;
Token * a;
expr_ty dotted_name_var;
if (
(a = _PyPegen_expect_token(p, 622)) // token='import'
&&
(_gather_133_var = _gather_133_rule(p)) // ','.dotted_name+
&&
(_keyword = _PyPegen_expect_token(p, 621)) // token='from'
&&
(dotted_name_var = dotted_name_rule(p)) // dotted_name
)
{
D(fprintf(stderr, "%*c+ invalid_import[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' ','.dotted_name+ 'from' dotted_name"));
_res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "Did you mean to use 'from ... import ...' instead?" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_import[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' ','.dotted_name+ 'from' dotted_name"));
}
{ // 'import' NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_import[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' NEWLINE"));
Token * _keyword;
Token * token;
if (
(_keyword = _PyPegen_expect_token(p, 622)) // token='import'
&&
(token = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_import[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' NEWLINE"));
_res = RAISE_SYNTAX_ERROR_STARTING_FROM ( token , "Expected one or more names after 'import'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_import[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' NEWLINE"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_import_from_targets: import_from_as_names ',' NEWLINE | NEWLINE
static void *
invalid_import_from_targets_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // import_from_as_names ',' NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE"));
Token * _literal;
asdl_alias_seq* import_from_as_names_var;
Token * newline_var;
if (
(import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ',' NEWLINE"));
}
{ // NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
Token * token;
if (
(token = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
_res = RAISE_SYNTAX_ERROR_STARTING_FROM ( token , "Expected one or more names after 'import'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_with_stmt:
// | 'async'? 'with' ','.(expression ['as' star_target])+ NEWLINE
// | 'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE
static void *
invalid_with_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'async'? 'with' ','.(expression ['as' star_target])+ NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ NEWLINE"));
asdl_seq * _gather_135_var;
Token * _keyword;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * newline_var;
if (
(_opt_var = _PyPegen_expect_token(p, 682), !p->error_indicator) // 'async'?
&&
(_keyword = _PyPegen_expect_token(p, 633)) // token='with'
&&
(_gather_135_var = _gather_135_rule(p)) // ','.(expression ['as' star_target])+
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "expected ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ NEWLINE"));
}
{ // 'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE"));
asdl_seq * _gather_137_var;
Token * _keyword;
Token * _literal;
Token * _literal_1;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_opt_var_1;
UNUSED(_opt_var_1); // Silence compiler warnings
Token * newline_var;
if (
(_opt_var = _PyPegen_expect_token(p, 682), !p->error_indicator) // 'async'?
&&
(_keyword = _PyPegen_expect_token(p, 633)) // token='with'
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(_gather_137_var = _gather_137_rule(p)) // ','.(expressions ['as' star_target])+
&&
(_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "expected ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_with_stmt_indent:
// | 'async'? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT
// | 'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT
static void *
invalid_with_stmt_indent_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'async'? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_with_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT"));
asdl_seq * _gather_135_var;
Token * _literal;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * a;
Token * newline_var;
if (
(_opt_var = _PyPegen_expect_token(p, 682), !p->error_indicator) // 'async'?
&&
(a = _PyPegen_expect_token(p, 633)) // token='with'
&&
(_gather_135_var = _gather_135_rule(p)) // ','.(expression ['as' star_target])+
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_with_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_with_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT"));
}
{ // 'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_with_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT"));
asdl_seq * _gather_137_var;
Token * _literal;
Token * _literal_1;
Token * _literal_2;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_opt_var_1;
UNUSED(_opt_var_1); // Silence compiler warnings
Token * a;
Token * newline_var;
if (
(_opt_var = _PyPegen_expect_token(p, 682), !p->error_indicator) // 'async'?
&&
(a = _PyPegen_expect_token(p, 633)) // token='with'
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(_gather_137_var = _gather_137_rule(p)) // ','.(expressions ['as' star_target])+
&&
(_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
&&
(_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_with_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_with_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_try_stmt:
// | 'try' ':' NEWLINE !INDENT
// | 'try' ':' block !('except' | 'finally')
// | 'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'
// | 'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'
static void *
invalid_try_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'try' ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' NEWLINE !INDENT"));
Token * _literal;
Token * a;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 642)) // token='try'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'try' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' NEWLINE !INDENT"));
}
{ // 'try' ':' block !('except' | 'finally')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')"));
Token * _keyword;
Token * _literal;
asdl_stmt_seq* block_var;
if (
(_keyword = _PyPegen_expect_token(p, 642)) // token='try'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(block_var = block_rule(p)) // block
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_138_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')"));
_res = RAISE_SYNTAX_ERROR ( "expected 'except' or 'finally' block" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block !('except' | 'finally')"));
}
{ // 'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'"));
Token * _keyword;
Token * _literal;
Token * _literal_1;
asdl_seq * _loop0_139_var;
asdl_seq * _loop1_37_var;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * a;
Token * b;
expr_ty expression_var;
if (
(_keyword = _PyPegen_expect_token(p, 642)) // token='try'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(_loop0_139_var = _loop0_139_rule(p)) // block*
&&
(_loop1_37_var = _loop1_37_rule(p)) // except_block+
&&
(a = _PyPegen_expect_token(p, 663)) // token='except'
&&
(b = _PyPegen_expect_token(p, 16)) // token='*'
&&
(expression_var = expression_rule(p)) // expression
&&
(_opt_var = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
&&
(_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot have both 'except' and 'except*' on the same 'try'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'"));
}
{ // 'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'"));
Token * _keyword;
Token * _literal;
Token * _literal_1;
asdl_seq * _loop0_139_var;
asdl_seq * _loop1_38_var;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * a;
if (
(_keyword = _PyPegen_expect_token(p, 642)) // token='try'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(_loop0_139_var = _loop0_139_rule(p)) // block*
&&
(_loop1_38_var = _loop1_38_rule(p)) // except_star_block+
&&
(a = _PyPegen_expect_token(p, 663)) // token='except'
&&
(_opt_var = _tmp_140_rule(p), !p->error_indicator) // [expression ['as' NAME]]
&&
(_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot have both 'except' and 'except*' on the same 'try'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_except_stmt:
// | 'except' expression ',' expressions ['as' NAME] ':'
// | 'except' expression ['as' NAME] NEWLINE
// | 'except' NEWLINE
// | 'except' expression 'as' expression
static void *
invalid_except_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'except' expression ',' expressions ['as' NAME] ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'"));
Token * _keyword;
Token * _literal;
Token * _literal_1;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty a;
expr_ty expressions_var;
if (
(_keyword = _PyPegen_expect_token(p, 663)) // token='except'
&&
(a = expression_rule(p)) // expression
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(expressions_var = expressions_rule(p)) // expressions
&&
(_opt_var = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
&&
(_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'"));
_res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "multiple exception types must be parenthesized" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'"));
}
{ // 'except' expression ['as' NAME] NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] NEWLINE"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * a;
expr_ty expression_var;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 663)) // token='except'
&&
(expression_var = expression_rule(p)) // expression
&&
(_opt_var = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "expected ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] NEWLINE"));
}
{ // 'except' NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' NEWLINE"));
Token * a;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 663)) // token='except'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "expected ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' NEWLINE"));
}
{ // 'except' expression 'as' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression 'as' expression"));
Token * _keyword;
Token * _keyword_1;
expr_ty a;
expr_ty expression_var;
if (
(_keyword = _PyPegen_expect_token(p, 663)) // token='except'
&&
(expression_var = expression_rule(p)) // expression
&&
(_keyword_1 = _PyPegen_expect_token(p, 666)) // token='as'
&&
(a = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression 'as' expression"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use except statement with %s" , _PyPegen_get_expr_name ( a ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression 'as' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_except_star_stmt:
// | 'except' '*' expression ',' expressions ['as' NAME] ':'
// | 'except' '*' expression ['as' NAME] NEWLINE
// | 'except' '*' (NEWLINE | ':')
// | 'except' '*' expression 'as' expression
static void *
invalid_except_star_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'except' '*' expression ',' expressions ['as' NAME] ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ',' expressions ['as' NAME] ':'"));
Token * _keyword;
Token * _literal;
Token * _literal_1;
Token * _literal_2;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty a;
expr_ty expressions_var;
if (
(_keyword = _PyPegen_expect_token(p, 663)) // token='except'
&&
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(a = expression_rule(p)) // expression
&&
(_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
(expressions_var = expressions_rule(p)) // expressions
&&
(_opt_var = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
&&
(_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ',' expressions ['as' NAME] ':'"));
_res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "multiple exception types must be parenthesized" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ',' expressions ['as' NAME] ':'"));
}
{ // 'except' '*' expression ['as' NAME] NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE"));
Token * _literal;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * a;
expr_ty expression_var;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 663)) // token='except'
&&
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(expression_var = expression_rule(p)) // expression
&&
(_opt_var = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "expected ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE"));
}
{ // 'except' '*' (NEWLINE | ':')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')"));
Token * _literal;
void *_tmp_141_var;
Token * a;
if (
(a = _PyPegen_expect_token(p, 663)) // token='except'
&&
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(_tmp_141_var = _tmp_141_rule(p)) // NEWLINE | ':'
)
{
D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')"));
_res = RAISE_SYNTAX_ERROR ( "expected one or more exception types" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' (NEWLINE | ':')"));
}
{ // 'except' '*' expression 'as' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression 'as' expression"));
Token * _keyword;
Token * _keyword_1;
Token * _literal;
expr_ty a;
expr_ty expression_var;
if (
(_keyword = _PyPegen_expect_token(p, 663)) // token='except'
&&
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(expression_var = expression_rule(p)) // expression
&&
(_keyword_1 = _PyPegen_expect_token(p, 666)) // token='as'
&&
(a = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression 'as' expression"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use except* statement with %s" , _PyPegen_get_expr_name ( a ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression 'as' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_finally_stmt: 'finally' ':' NEWLINE !INDENT
static void *
invalid_finally_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'finally' ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_finally_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT"));
Token * _literal;
Token * a;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 659)) // token='finally'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_finally_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'finally' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_finally_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_except_stmt_indent:
// | 'except' expression ['as' NAME] ':' NEWLINE !INDENT
// | 'except' ':' NEWLINE !INDENT
static void *
invalid_except_stmt_indent_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'except' expression ['as' NAME] ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT"));
Token * _literal;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * a;
expr_ty expression_var;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 663)) // token='except'
&&
(expression_var = expression_rule(p)) // expression
&&
(_opt_var = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT"));
}
{ // 'except' ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT"));
Token * _literal;
Token * a;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 663)) // token='except'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_except_star_stmt_indent:
// | 'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT
static void *
invalid_except_star_stmt_indent_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_except_star_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT"));
Token * _literal;
Token * _literal_1;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * a;
expr_ty expression_var;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 663)) // token='except'
&&
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
(expression_var = expression_rule(p)) // expression
&&
(_opt_var = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
&&
(_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_except_star_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except*' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_except_star_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_match_stmt:
// | "match" subject_expr NEWLINE
// | "match" subject_expr ':' NEWLINE !INDENT
static void *
invalid_match_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // "match" subject_expr NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr NEWLINE"));
expr_ty _keyword;
Token * newline_var;
expr_ty subject_expr_var;
if (
(_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"'
&&
(subject_expr_var = subject_expr_rule(p)) // subject_expr
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr NEWLINE"));
_res = CHECK_VERSION ( void* , 10 , "Pattern matching is" , RAISE_SYNTAX_ERROR ( "expected ':'" ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr NEWLINE"));
}
{ // "match" subject_expr ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT"));
Token * _literal;
expr_ty a;
Token * newline_var;
expr_ty subject;
if (
(a = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"'
&&
(subject = subject_expr_rule(p)) // subject_expr
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'match' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_case_block:
// | "case" patterns guard? NEWLINE
// | "case" patterns guard? ':' NEWLINE !INDENT
static void *
invalid_case_block_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // "case" patterns guard? NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? NEWLINE"));
expr_ty _keyword;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * newline_var;
pattern_ty patterns_var;
if (
(_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"'
&&
(patterns_var = patterns_rule(p)) // patterns
&&
(_opt_var = guard_rule(p), !p->error_indicator) // guard?
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "expected ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? NEWLINE"));
}
{ // "case" patterns guard? ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT"));
Token * _literal;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty a;
Token * newline_var;
pattern_ty patterns_var;
if (
(a = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"'
&&
(patterns_var = patterns_rule(p)) // patterns
&&
(_opt_var = guard_rule(p), !p->error_indicator) // guard?
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'case' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_as_pattern: or_pattern 'as' "_" | or_pattern 'as' expression
static void *
invalid_as_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // or_pattern 'as' "_"
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' \"_\""));
Token * _keyword;
expr_ty a;
pattern_ty or_pattern_var;
if (
(or_pattern_var = or_pattern_rule(p)) // or_pattern
&&
(_keyword = _PyPegen_expect_token(p, 666)) // token='as'
&&
(a = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"'
)
{
D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' \"_\""));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use '_' as a target" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' \"_\""));
}
{ // or_pattern 'as' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' expression"));
Token * _keyword;
expr_ty a;
pattern_ty or_pattern_var;
if (
(or_pattern_var = or_pattern_rule(p)) // or_pattern
&&
(_keyword = _PyPegen_expect_token(p, 666)) // token='as'
&&
(a = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' expression"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use %s as pattern target" , _PyPegen_get_expr_name ( a ) );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_class_pattern: name_or_attr '(' invalid_class_argument_pattern
static void *
invalid_class_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // name_or_attr '(' invalid_class_argument_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern"));
Token * _literal;
asdl_pattern_seq* a;
expr_ty name_or_attr_var;
if (
(name_or_attr_var = name_or_attr_rule(p)) // name_or_attr
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(a = invalid_class_argument_pattern_rule(p)) // invalid_class_argument_pattern
)
{
D(fprintf(stderr, "%*c+ invalid_class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( PyPegen_first_item ( a , pattern_ty ) , PyPegen_last_item ( a , pattern_ty ) , "positional patterns follow keyword patterns" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_class_argument_pattern:
// | [positional_patterns ','] keyword_patterns ',' positional_patterns
static asdl_pattern_seq*
invalid_class_argument_pattern_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_pattern_seq* _res = NULL;
int _mark = p->mark;
{ // [positional_patterns ','] keyword_patterns ',' positional_patterns
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_class_argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns"));
Token * _literal;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
asdl_pattern_seq* a;
asdl_seq* keyword_patterns_var;
if (
(_opt_var = _tmp_142_rule(p), !p->error_indicator) // [positional_patterns ',']
&&
(keyword_patterns_var = keyword_patterns_rule(p)) // keyword_patterns
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(a = positional_patterns_rule(p)) // positional_patterns
)
{
D(fprintf(stderr, "%*c+ invalid_class_argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_class_argument_pattern[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_if_stmt:
// | 'if' named_expression NEWLINE
// | 'if' named_expression ':' NEWLINE !INDENT
static void *
invalid_if_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'if' named_expression NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression NEWLINE"));
Token * _keyword;
expr_ty named_expression_var;
Token * newline_var;
if (
(_keyword = _PyPegen_expect_token(p, 668)) // token='if'
&&
(named_expression_var = named_expression_rule(p)) // named_expression
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "expected ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression NEWLINE"));
}
{ // 'if' named_expression ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT"));
Token * _literal;
Token * a;
expr_ty a_1;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 668)) // token='if'
&&
(a_1 = named_expression_rule(p)) // named_expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'if' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_elif_stmt:
// | 'elif' named_expression NEWLINE
// | 'elif' named_expression ':' NEWLINE !INDENT
static void *
invalid_elif_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'elif' named_expression NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression NEWLINE"));
Token * _keyword;
expr_ty named_expression_var;
Token * newline_var;
if (
(_keyword = _PyPegen_expect_token(p, 670)) // token='elif'
&&
(named_expression_var = named_expression_rule(p)) // named_expression
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "expected ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression NEWLINE"));
}
{ // 'elif' named_expression ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT"));
Token * _literal;
Token * a;
expr_ty named_expression_var;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 670)) // token='elif'
&&
(named_expression_var = named_expression_rule(p)) // named_expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'elif' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_else_stmt: 'else' ':' NEWLINE !INDENT
static void *
invalid_else_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'else' ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_else_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' NEWLINE !INDENT"));
Token * _literal;
Token * a;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 671)) // token='else'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_else_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'else' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_else_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_while_stmt:
// | 'while' named_expression NEWLINE
// | 'while' named_expression ':' NEWLINE !INDENT
static void *
invalid_while_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'while' named_expression NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression NEWLINE"));
Token * _keyword;
expr_ty named_expression_var;
Token * newline_var;
if (
(_keyword = _PyPegen_expect_token(p, 673)) // token='while'
&&
(named_expression_var = named_expression_rule(p)) // named_expression
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "expected ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression NEWLINE"));
}
{ // 'while' named_expression ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT"));
Token * _literal;
Token * a;
expr_ty named_expression_var;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 673)) // token='while'
&&
(named_expression_var = named_expression_rule(p)) // named_expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'while' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_for_stmt:
// | 'async'? 'for' star_targets 'in' star_expressions NEWLINE
// | 'async'? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT
static void *
invalid_for_stmt_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'async'? 'for' star_targets 'in' star_expressions NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_targets 'in' star_expressions NEWLINE"));
Token * _keyword;
Token * _keyword_1;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * newline_var;
expr_ty star_expressions_var;
expr_ty star_targets_var;
if (
(_opt_var = _PyPegen_expect_token(p, 682), !p->error_indicator) // 'async'?
&&
(_keyword = _PyPegen_expect_token(p, 678)) // token='for'
&&
(star_targets_var = star_targets_rule(p)) // star_targets
&&
(_keyword_1 = _PyPegen_expect_token(p, 679)) // token='in'
&&
(star_expressions_var = star_expressions_rule(p)) // star_expressions
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_targets 'in' star_expressions NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "expected ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'for' star_targets 'in' star_expressions NEWLINE"));
}
{ // 'async'? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT"));
Token * _keyword;
Token * _literal;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
Token * a;
Token * newline_var;
expr_ty star_expressions_var;
expr_ty star_targets_var;
if (
(_opt_var = _PyPegen_expect_token(p, 682), !p->error_indicator) // 'async'?
&&
(a = _PyPegen_expect_token(p, 678)) // token='for'
&&
(star_targets_var = star_targets_rule(p)) // star_targets
&&
(_keyword = _PyPegen_expect_token(p, 679)) // token='in'
&&
(star_expressions_var = star_expressions_rule(p)) // star_expressions
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'for' statement on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_def_raw:
// | 'async'? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT
// | 'async'? 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block
static void *
invalid_def_raw_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'async'? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT"));
Token * _literal;
Token * _literal_1;
Token * _literal_2;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_opt_var_1;
UNUSED(_opt_var_1); // Silence compiler warnings
void *_opt_var_2;
UNUSED(_opt_var_2); // Silence compiler warnings
void *_opt_var_3;
UNUSED(_opt_var_3); // Silence compiler warnings
Token * a;
expr_ty name_var;
Token * newline_var;
if (
(_opt_var = _PyPegen_expect_token(p, 682), !p->error_indicator) // 'async'?
&&
(a = _PyPegen_expect_token(p, 683)) // token='def'
&&
(name_var = _PyPegen_name_token(p)) // NAME
&&
(_opt_var_1 = type_params_rule(p), !p->error_indicator) // type_params?
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(_opt_var_2 = params_rule(p), !p->error_indicator) // params?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
&&
(_opt_var_3 = _tmp_27_rule(p), !p->error_indicator) // ['->' expression]
&&
(_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after function definition on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT"));
}
{ // 'async'? 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block"));
Token * _keyword;
Token * _literal;
Token * _literal_1;
Token * _literal_2;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_opt_var_1;
UNUSED(_opt_var_1); // Silence compiler warnings
void *_opt_var_2;
UNUSED(_opt_var_2); // Silence compiler warnings
void *_opt_var_3;
UNUSED(_opt_var_3); // Silence compiler warnings
void *_opt_var_4;
UNUSED(_opt_var_4); // Silence compiler warnings
asdl_stmt_seq* block_var;
expr_ty name_var;
if (
(_opt_var = _PyPegen_expect_token(p, 682), !p->error_indicator) // 'async'?
&&
(_keyword = _PyPegen_expect_token(p, 683)) // token='def'
&&
(name_var = _PyPegen_name_token(p)) // NAME
&&
(_opt_var_1 = type_params_rule(p), !p->error_indicator) // type_params?
&&
(_literal = _PyPegen_expect_forced_token(p, 7, "(")) // forced_token='('
&&
(_opt_var_2 = params_rule(p), !p->error_indicator) // params?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
&&
(_opt_var_3 = _tmp_27_rule(p), !p->error_indicator) // ['->' expression]
&&
(_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
&&
(_opt_var_4 = func_type_comment_rule(p), !p->error_indicator) // func_type_comment?
&&
(block_var = block_rule(p)) // block
)
{
D(fprintf(stderr, "%*c+ invalid_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block"));
_res = _PyPegen_dummy_name(p, _opt_var, _keyword, name_var, _opt_var_1, _literal, _opt_var_2, _literal_1, _opt_var_3, _literal_2, _opt_var_4, block_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_class_def_raw:
// | 'class' NAME type_params? ['(' arguments? ')'] NEWLINE
// | 'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT
static void *
invalid_class_def_raw_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'class' NAME type_params? ['(' arguments? ')'] NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] NEWLINE"));
Token * _keyword;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_opt_var_1;
UNUSED(_opt_var_1); // Silence compiler warnings
expr_ty name_var;
Token * newline_var;
if (
(_keyword = _PyPegen_expect_token(p, 685)) // token='class'
&&
(name_var = _PyPegen_name_token(p)) // NAME
&&
(_opt_var = type_params_rule(p), !p->error_indicator) // type_params?
&&
(_opt_var_1 = _tmp_26_rule(p), !p->error_indicator) // ['(' arguments? ')']
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ invalid_class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] NEWLINE"));
_res = RAISE_SYNTAX_ERROR ( "expected ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] NEWLINE"));
}
{ // 'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT"));
Token * _literal;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_opt_var_1;
UNUSED(_opt_var_1); // Silence compiler warnings
Token * a;
expr_ty name_var;
Token * newline_var;
if (
(a = _PyPegen_expect_token(p, 685)) // token='class'
&&
(name_var = _PyPegen_name_token(p)) // NAME
&&
(_opt_var = type_params_rule(p), !p->error_indicator) // type_params?
&&
(_opt_var_1 = _tmp_26_rule(p), !p->error_indicator) // ['(' arguments? ')']
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
)
{
D(fprintf(stderr, "%*c+ invalid_class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT"));
_res = RAISE_INDENTATION_ERROR ( "expected an indented block after class definition on line %d" , a -> lineno );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_double_starred_kvpairs:
// | ','.double_starred_kvpair+ ',' invalid_kvpair
// | expression ':' '*' bitwise_or
// | expression ':' &('}' | ',')
static void *
invalid_double_starred_kvpairs_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ','.double_starred_kvpair+ ',' invalid_kvpair
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair"));
asdl_seq * _gather_82_var;
Token * _literal;
void *invalid_kvpair_var;
if (
(_gather_82_var = _gather_82_rule(p)) // ','.double_starred_kvpair+
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(invalid_kvpair_var = invalid_kvpair_rule(p)) // invalid_kvpair
)
{
D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair"));
_res = _PyPegen_dummy_name(p, _gather_82_var, _literal, invalid_kvpair_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair"));
}
{ // expression ':' '*' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
Token * _literal;
Token * a;
expr_ty bitwise_or_var;
expr_ty expression_var;
if (
(expression_var = expression_rule(p)) // expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(a = _PyPegen_expect_token(p, 16)) // token='*'
&&
(bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
_res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' '*' bitwise_or"));
}
{ // expression ':' &('}' | ',')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
Token * a;
expr_ty expression_var;
if (
(expression_var = expression_rule(p)) // expression
&&
(a = _PyPegen_expect_token(p, 11)) // token=':'
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_143_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' &('}' | ',')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_kvpair:
// | expression !(':')
// | expression ':' '*' bitwise_or
// | expression ':' &('}' | ',')
static void *
invalid_kvpair_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // expression !(':')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !(':')"));
expr_ty a;
if (
(a = expression_rule(p)) // expression
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11) // token=(':')
)
{
D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !(':')"));
_res = RAISE_ERROR_KNOWN_LOCATION ( p , PyExc_SyntaxError , a -> lineno , a -> end_col_offset - 1 , a -> end_lineno , - 1 , "':' expected after dictionary key" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !(':')"));
}
{ // expression ':' '*' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
Token * _literal;
Token * a;
expr_ty bitwise_or_var;
expr_ty expression_var;
if (
(expression_var = expression_rule(p)) // expression
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(a = _PyPegen_expect_token(p, 16)) // token='*'
&&
(bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
_res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' '*' bitwise_or"));
}
{ // expression ':' &('}' | ',')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
Token * a;
expr_ty expression_var;
if (
(expression_var = expression_rule(p)) // expression
&&
(a = _PyPegen_expect_token(p, 11)) // token=':'
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_143_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' &('}' | ',')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_starred_expression_unpacking: '*' expression '=' expression
static void *
invalid_starred_expression_unpacking_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '*' expression '=' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_starred_expression_unpacking[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression '=' expression"));
Token * _literal;
Token * a;
expr_ty b;
expr_ty expression_var;
if (
(a = _PyPegen_expect_token(p, 16)) // token='*'
&&
(expression_var = expression_rule(p)) // expression
&&
(_literal = _PyPegen_expect_token(p, 22)) // token='='
&&
(b = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ invalid_starred_expression_unpacking[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression '=' expression"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to iterable argument unpacking" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_starred_expression_unpacking[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression '=' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_starred_expression: '*'
static void *
invalid_starred_expression_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '*'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
)
{
D(fprintf(stderr, "%*c+ invalid_starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
_res = RAISE_SYNTAX_ERROR ( "Invalid star expression" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_replacement_field:
// | '{' '='
// | '{' '!'
// | '{' ':'
// | '{' '}'
// | '{' !annotated_rhs
// | '{' annotated_rhs !('=' | '!' | ':' | '}')
// | '{' annotated_rhs '=' !('!' | ':' | '}')
// | '{' annotated_rhs '='? invalid_conversion_character
// | '{' annotated_rhs '='? ['!' NAME] !(':' | '}')
// | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'
// | '{' annotated_rhs '='? ['!' NAME] !'}'
static void *
invalid_replacement_field_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '{' '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '='"));
Token * _literal;
Token * a;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(a = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '='"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '='" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '='"));
}
{ // '{' '!'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '!'"));
Token * _literal;
Token * a;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(a = _PyPegen_expect_token(p, 54)) // token='!'
)
{
D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '!'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '!'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '!'"));
}
{ // '{' ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' ':'"));
Token * _literal;
Token * a;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(a = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' ':'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before ':'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' ':'"));
}
{ // '{' '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '}'"));
Token * _literal;
Token * a;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(a = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '}'"));
_res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '}'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '}'"));
}
{ // '{' !annotated_rhs
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' !annotated_rhs"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) annotated_rhs_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' !annotated_rhs"));
_res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting a valid expression after '{'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' !annotated_rhs"));
}
{ // '{' annotated_rhs !('=' | '!' | ':' | '}')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs !('=' | '!' | ':' | '}')"));
Token * _literal;
expr_ty annotated_rhs_var;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_144_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs !('=' | '!' | ':' | '}')"));
_res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '=', or '!', or ':', or '}'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs !('=' | '!' | ':' | '}')"));
}
{ // '{' annotated_rhs '=' !('!' | ':' | '}')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '=' !('!' | ':' | '}')"));
Token * _literal;
Token * _literal_1;
expr_ty annotated_rhs_var;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs
&&
(_literal_1 = _PyPegen_expect_token(p, 22)) // token='='
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_145_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '=' !('!' | ':' | '}')"));
_res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '!', or ':', or '}'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '=' !('!' | ':' | '}')"));
}
{ // '{' annotated_rhs '='? invalid_conversion_character
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? invalid_conversion_character"));
Token * _literal;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty annotated_rhs_var;
void *invalid_conversion_character_var;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs
&&
(_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='?
&&
(invalid_conversion_character_var = invalid_conversion_character_rule(p)) // invalid_conversion_character
)
{
D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? invalid_conversion_character"));
_res = _PyPegen_dummy_name(p, _literal, annotated_rhs_var, _opt_var, invalid_conversion_character_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? invalid_conversion_character"));
}
{ // '{' annotated_rhs '='? ['!' NAME] !(':' | '}')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !(':' | '}')"));
Token * _literal;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_opt_var_1;
UNUSED(_opt_var_1); // Silence compiler warnings
expr_ty annotated_rhs_var;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs
&&
(_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='?
&&
(_opt_var_1 = _tmp_146_rule(p), !p->error_indicator) // ['!' NAME]
&&
_PyPegen_lookahead(0, (void *(*)(Parser *)) _tmp_147_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !(':' | '}')"));
_res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting ':' or '}'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !(':' | '}')"));
}
{ // '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'"));
Token * _literal;
Token * _literal_1;
asdl_seq * _loop0_77_var;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_opt_var_1;
UNUSED(_opt_var_1); // Silence compiler warnings
expr_ty annotated_rhs_var;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs
&&
(_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='?
&&
(_opt_var_1 = _tmp_146_rule(p), !p->error_indicator) // ['!' NAME]
&&
(_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
&&
(_loop0_77_var = _loop0_77_rule(p)) // fstring_format_spec*
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 26) // token='}'
)
{
D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'"));
_res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '}', or format specs" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'"));
}
{ // '{' annotated_rhs '='? ['!' NAME] !'}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !'}'"));
Token * _literal;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
void *_opt_var_1;
UNUSED(_opt_var_1); // Silence compiler warnings
expr_ty annotated_rhs_var;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
(annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs
&&
(_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='?
&&
(_opt_var_1 = _tmp_146_rule(p), !p->error_indicator) // ['!' NAME]
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 26) // token='}'
)
{
D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !'}'"));
_res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '}'" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_replacement_field[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !'}'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_conversion_character: '!' &(':' | '}') | '!' !NAME
static void *
invalid_conversion_character_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '!' &(':' | '}')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_conversion_character[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' &(':' | '}')"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 54)) // token='!'
&&
_PyPegen_lookahead(1, (void *(*)(Parser *)) _tmp_147_rule, p)
)
{
D(fprintf(stderr, "%*c+ invalid_conversion_character[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' &(':' | '}')"));
_res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: missing conversion character" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_conversion_character[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' &(':' | '}')"));
}
{ // '!' !NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_conversion_character[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' !NAME"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 54)) // token='!'
&&
_PyPegen_lookahead_with_name(0, _PyPegen_name_token, p)
)
{
D(fprintf(stderr, "%*c+ invalid_conversion_character[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' !NAME"));
_res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: invalid conversion character" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_conversion_character[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' !NAME"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_arithmetic: sum ('+' | '-' | '*' | '/' | '%' | '//' | '@') 'not' inversion
static void *
invalid_arithmetic_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // sum ('+' | '-' | '*' | '/' | '%' | '//' | '@') 'not' inversion
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_arithmetic[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum ('+' | '-' | '*' | '/' | '%' | '//' | '@') 'not' inversion"));
void *_tmp_148_var;
Token * a;
expr_ty b;
expr_ty sum_var;
if (
(sum_var = sum_rule(p)) // sum
&&
(_tmp_148_var = _tmp_148_rule(p)) // '+' | '-' | '*' | '/' | '%' | '//' | '@'
&&
(a = _PyPegen_expect_token(p, 687)) // token='not'
&&
(b = inversion_rule(p)) // inversion
)
{
D(fprintf(stderr, "%*c+ invalid_arithmetic[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum ('+' | '-' | '*' | '/' | '%' | '//' | '@') 'not' inversion"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "'not' after an operator must be parenthesized" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_arithmetic[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum ('+' | '-' | '*' | '/' | '%' | '//' | '@') 'not' inversion"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_factor: ('+' | '-' | '~') 'not' factor
static void *
invalid_factor_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ('+' | '-' | '~') 'not' factor
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('+' | '-' | '~') 'not' factor"));
void *_tmp_149_var;
Token * a;
expr_ty b;
if (
(_tmp_149_var = _tmp_149_rule(p)) // '+' | '-' | '~'
&&
(a = _PyPegen_expect_token(p, 687)) // token='not'
&&
(b = factor_rule(p)) // factor
)
{
D(fprintf(stderr, "%*c+ invalid_factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('+' | '-' | '~') 'not' factor"));
_res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "'not' after an operator must be parenthesized" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_factor[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('+' | '-' | '~') 'not' factor"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// invalid_type_params: '[' ']'
static void *
invalid_type_params_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '[' ']'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> invalid_type_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' ']'"));
Token * _literal;
Token * token;
if (
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
(token = _PyPegen_expect_token(p, 10)) // token=']'
)
{
D(fprintf(stderr, "%*c+ invalid_type_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' ']'"));
_res = RAISE_SYNTAX_ERROR_STARTING_FROM ( token , "Type parameter list cannot be empty" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s invalid_type_params[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' ']'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_1: NEWLINE
static asdl_seq *
_loop0_1_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
Token * newline_var;
while (
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
_res = newline_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_2: statement
static asdl_seq *
_loop1_2_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // statement
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
asdl_stmt_seq* statement_var;
while (
(statement_var = statement_rule(p)) // statement
)
{
_res = statement_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_2[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_3: ';' simple_stmt
static asdl_seq *
_loop0_3_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ';' simple_stmt
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' simple_stmt"));
Token * _literal;
stmt_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 13)) // token=';'
&&
(elem = simple_stmt_rule(p)) // simple_stmt
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_3[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' simple_stmt"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_4: simple_stmt _loop0_3
static asdl_seq *
_gather_4_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // simple_stmt _loop0_3
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_3"));
stmt_ty elem;
asdl_seq * seq;
if (
(elem = simple_stmt_rule(p)) // simple_stmt
&&
(seq = _loop0_3_rule(p)) // _loop0_3
)
{
D(fprintf(stderr, "%*c+ _gather_4[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_3"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_4[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt _loop0_3"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_5: 'import' | 'from'
static void *
_tmp_5_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'import'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 622)) // token='import'
)
{
D(fprintf(stderr, "%*c+ _tmp_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_5[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
}
{ // 'from'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 621)) // token='from'
)
{
D(fprintf(stderr, "%*c+ _tmp_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_5[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_6: 'def' | '@' | 'async'
static void *
_tmp_6_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'def'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 683)) // token='def'
)
{
D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_6[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
}
{ // '@'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 49)) // token='@'
)
{
D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_6[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
}
{ // 'async'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 682)) // token='async'
)
{
D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_6[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_7: 'class' | '@'
static void *
_tmp_7_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'class'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 685)) // token='class'
)
{
D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_7[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
}
{ // '@'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 49)) // token='@'
)
{
D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_7[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_8: 'with' | 'async'
static void *
_tmp_8_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'with'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 633)) // token='with'
)
{
D(fprintf(stderr, "%*c+ _tmp_8[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_8[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
}
{ // 'async'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 682)) // token='async'
)
{
D(fprintf(stderr, "%*c+ _tmp_8[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_8[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_9: 'for' | 'async'
static void *
_tmp_9_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'for'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 678)) // token='for'
)
{
D(fprintf(stderr, "%*c+ _tmp_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_9[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
}
{ // 'async'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 682)) // token='async'
)
{
D(fprintf(stderr, "%*c+ _tmp_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_9[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_10: '=' annotated_rhs
static void *
_tmp_10_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '=' annotated_rhs
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
Token * _literal;
expr_ty d;
if (
(_literal = _PyPegen_expect_token(p, 22)) // token='='
&&
(d = annotated_rhs_rule(p)) // annotated_rhs
)
{
D(fprintf(stderr, "%*c+ _tmp_10[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
_res = d;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_10[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_11: '(' single_target ')' | single_subscript_attribute_target
static void *
_tmp_11_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '(' single_target ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
Token * _literal;
Token * _literal_1;
expr_ty b;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(b = single_target_rule(p)) // single_target
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ _tmp_11[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
_res = b;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_11[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
}
{ // single_subscript_attribute_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
expr_ty single_subscript_attribute_target_var;
if (
(single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
)
{
D(fprintf(stderr, "%*c+ _tmp_11[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
_res = single_subscript_attribute_target_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_11[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop1_12: (star_targets '=')
static asdl_seq *
_loop1_12_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // (star_targets '=')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
void *_tmp_150_var;
while (
(_tmp_150_var = _tmp_150_rule(p)) // star_targets '='
)
{
_res = _tmp_150_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_12[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _tmp_13: 'from' expression
static void *
_tmp_13_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'from' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
Token * _keyword;
expr_ty z;
if (
(_keyword = _PyPegen_expect_token(p, 621)) // token='from'
&&
(z = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ _tmp_13[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression"));
_res = z;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_13[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_14: ',' NAME
static asdl_seq *
_loop0_14_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
Token * _literal;
expr_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = _PyPegen_name_token(p)) // NAME
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_14[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_15: NAME _loop0_14
static asdl_seq *
_gather_15_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // NAME _loop0_14
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_14"));
expr_ty elem;
asdl_seq * seq;
if (
(elem = _PyPegen_name_token(p)) // NAME
&&
(seq = _loop0_14_rule(p)) // _loop0_14
)
{
D(fprintf(stderr, "%*c+ _gather_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_14"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_15[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_14"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_16: ';' | NEWLINE
static void *
_tmp_16_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ';'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 13)) // token=';'
)
{
D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
}
{ // NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
Token * newline_var;
if (
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
_res = newline_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_17: ',' expression
static void *
_tmp_17_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ',' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Token * _literal;
expr_ty z;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(z = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
_res = z;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_18: ('.' | '...')
static asdl_seq *
_loop0_18_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ('.' | '...')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
void *_tmp_151_var;
while (
(_tmp_151_var = _tmp_151_rule(p)) // '.' | '...'
)
{
_res = _tmp_151_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_18[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_19: ('.' | '...')
static asdl_seq *
_loop1_19_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ('.' | '...')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
void *_tmp_151_var;
while (
(_tmp_151_var = _tmp_151_rule(p)) // '.' | '...'
)
{
_res = _tmp_151_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_19[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_20: ',' import_from_as_name
static asdl_seq *
_loop0_20_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' import_from_as_name
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name"));
Token * _literal;
alias_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = import_from_as_name_rule(p)) // import_from_as_name
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_20[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_21: import_from_as_name _loop0_20
static asdl_seq *
_gather_21_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // import_from_as_name _loop0_20
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_20"));
alias_ty elem;
asdl_seq * seq;
if (
(elem = import_from_as_name_rule(p)) // import_from_as_name
&&
(seq = _loop0_20_rule(p)) // _loop0_20
)
{
D(fprintf(stderr, "%*c+ _gather_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_20"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_21[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_20"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_22: 'as' NAME
static void *
_tmp_22_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'as' NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Token * _keyword;
expr_ty z;
if (
(_keyword = _PyPegen_expect_token(p, 666)) // token='as'
&&
(z = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ _tmp_22[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
_res = z;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_22[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_23: ',' dotted_as_name
static asdl_seq *
_loop0_23_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' dotted_as_name
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name"));
Token * _literal;
alias_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = dotted_as_name_rule(p)) // dotted_as_name
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_23[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_24: dotted_as_name _loop0_23
static asdl_seq *
_gather_24_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // dotted_as_name _loop0_23
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_23"));
alias_ty elem;
asdl_seq * seq;
if (
(elem = dotted_as_name_rule(p)) // dotted_as_name
&&
(seq = _loop0_23_rule(p)) // _loop0_23
)
{
D(fprintf(stderr, "%*c+ _gather_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_23"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_24[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_23"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop1_25: ('@' named_expression NEWLINE)
static asdl_seq *
_loop1_25_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ('@' named_expression NEWLINE)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)"));
void *_tmp_152_var;
while (
(_tmp_152_var = _tmp_152_rule(p)) // '@' named_expression NEWLINE
)
{
_res = _tmp_152_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_25[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _tmp_26: '(' arguments? ')'
static void *
_tmp_26_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '(' arguments? ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Token * _literal;
Token * _literal_1;
void *z;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
(z = arguments_rule(p), !p->error_indicator) // arguments?
&&
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ _tmp_26[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
_res = z;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_26[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_27: '->' expression
static void *
_tmp_27_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '->' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
Token * _literal;
expr_ty z;
if (
(_literal = _PyPegen_expect_token(p, 51)) // token='->'
&&
(z = expression_rule(p)) // expression
)
{
D(fprintf(stderr, "%*c+ _tmp_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
_res = z;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_27[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_28: param_no_default
static asdl_seq *
_loop0_28_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
arg_ty param_no_default_var;
while (
(param_no_default_var = param_no_default_rule(p)) // param_no_default
)
{
_res = param_no_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_29: param_with_default
static asdl_seq *
_loop0_29_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // param_with_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
NameDefaultPair* param_with_default_var;
while (
(param_with_default_var = param_with_default_rule(p)) // param_with_default
)
{
_res = param_with_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_29[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_30: param_no_default
static asdl_seq *
_loop1_30_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
arg_ty param_no_default_var;
while (
(param_no_default_var = param_no_default_rule(p)) // param_no_default
)
{
_res = param_no_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_30[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_31: param_with_default
static asdl_seq *
_loop1_31_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // param_with_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
NameDefaultPair* param_with_default_var;
while (
(param_with_default_var = param_with_default_rule(p)) // param_with_default
)
{
_res = param_with_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_31[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_32: param_maybe_default
static asdl_seq *
_loop0_32_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // param_maybe_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
NameDefaultPair* param_maybe_default_var;
while (
(param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
)
{
_res = param_maybe_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_32[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_33: param_maybe_default
static asdl_seq *
_loop1_33_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // param_maybe_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
NameDefaultPair* param_maybe_default_var;
while (
(param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
)
{
_res = param_maybe_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_33[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_34: ',' with_item
static asdl_seq *
_loop0_34_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' with_item
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Token * _literal;
withitem_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = with_item_rule(p)) // with_item
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_35: with_item _loop0_34
static asdl_seq *
_gather_35_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // with_item _loop0_34
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_34"));
withitem_ty elem;
asdl_seq * seq;
if (
(elem = with_item_rule(p)) // with_item
&&
(seq = _loop0_34_rule(p)) // _loop0_34
)
{
D(fprintf(stderr, "%*c+ _gather_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_34"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_35[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_34"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_36: ',' | ')' | ':'
static void *
_tmp_36_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ _tmp_36[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_36[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
}
{ // ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ _tmp_36[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_36[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
}
{ // ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ _tmp_36[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_36[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop1_37: except_block
static asdl_seq *
_loop1_37_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // except_block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
excepthandler_ty except_block_var;
while (
(except_block_var = except_block_rule(p)) // except_block
)
{
_res = except_block_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_37[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_38: except_star_block
static asdl_seq *
_loop1_38_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // except_star_block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_star_block"));
excepthandler_ty except_star_block_var;
while (
(except_star_block_var = except_star_block_rule(p)) // except_star_block
)
{
_res = except_star_block_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_38[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_star_block"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_39: case_block
static asdl_seq *
_loop1_39_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // case_block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block"));
match_case_ty case_block_var;
while (
(case_block_var = case_block_rule(p)) // case_block
)
{
_res = case_block_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_39[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "case_block"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_40: '|' closed_pattern
static asdl_seq *
_loop0_40_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // '|' closed_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern"));
Token * _literal;
pattern_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 18)) // token='|'
&&
(elem = closed_pattern_rule(p)) // closed_pattern
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' closed_pattern"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_41: closed_pattern _loop0_40
static asdl_seq *
_gather_41_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // closed_pattern _loop0_40
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_40"));
pattern_ty elem;
asdl_seq * seq;
if (
(elem = closed_pattern_rule(p)) // closed_pattern
&&
(seq = _loop0_40_rule(p)) // _loop0_40
)
{
D(fprintf(stderr, "%*c+ _gather_41[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_40"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_40"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_42: '+' | '-'
static void *
_tmp_42_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '+'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 14)) // token='+'
)
{
D(fprintf(stderr, "%*c+ _tmp_42[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_42[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'"));
}
{ // '-'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 15)) // token='-'
)
{
D(fprintf(stderr, "%*c+ _tmp_42[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_42[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_43: '.' | '(' | '='
static void *
_tmp_43_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '.'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 23)) // token='.'
)
{
D(fprintf(stderr, "%*c+ _tmp_43[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_43[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
}
{ // '('
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
)
{
D(fprintf(stderr, "%*c+ _tmp_43[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_43[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
}
{ // '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ _tmp_43[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_43[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_44: ',' maybe_star_pattern
static asdl_seq *
_loop0_44_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' maybe_star_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' maybe_star_pattern"));
Token * _literal;
pattern_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = maybe_star_pattern_rule(p)) // maybe_star_pattern
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' maybe_star_pattern"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_45: maybe_star_pattern _loop0_44
static asdl_seq *
_gather_45_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // maybe_star_pattern _loop0_44
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_44"));
pattern_ty elem;
asdl_seq * seq;
if (
(elem = maybe_star_pattern_rule(p)) // maybe_star_pattern
&&
(seq = _loop0_44_rule(p)) // _loop0_44
)
{
D(fprintf(stderr, "%*c+ _gather_45[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_44"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern _loop0_44"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_46: ',' key_value_pattern
static asdl_seq *
_loop0_46_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' key_value_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern"));
Token * _literal;
KeyPatternPair* elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = key_value_pattern_rule(p)) // key_value_pattern
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_47: key_value_pattern _loop0_46
static asdl_seq *
_gather_47_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // key_value_pattern _loop0_46
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_46"));
KeyPatternPair* elem;
asdl_seq * seq;
if (
(elem = key_value_pattern_rule(p)) // key_value_pattern
&&
(seq = _loop0_46_rule(p)) // _loop0_46
)
{
D(fprintf(stderr, "%*c+ _gather_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_46"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_47[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_46"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_48: literal_expr | attr
static void *
_tmp_48_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // literal_expr
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_expr"));
expr_ty literal_expr_var;
if (
(literal_expr_var = literal_expr_rule(p)) // literal_expr
)
{
D(fprintf(stderr, "%*c+ _tmp_48[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_expr"));
_res = literal_expr_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_48[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_expr"));
}
{ // attr
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr"));
expr_ty attr_var;
if (
(attr_var = attr_rule(p)) // attr
)
{
D(fprintf(stderr, "%*c+ _tmp_48[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr"));
_res = attr_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_48[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_49: ',' pattern
static asdl_seq *
_loop0_49_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern"));
Token * _literal;
pattern_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = pattern_rule(p)) // pattern
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_49[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_50: pattern _loop0_49
static asdl_seq *
_gather_50_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // pattern _loop0_49
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_49"));
pattern_ty elem;
asdl_seq * seq;
if (
(elem = pattern_rule(p)) // pattern
&&
(seq = _loop0_49_rule(p)) // _loop0_49
)
{
D(fprintf(stderr, "%*c+ _gather_50[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_49"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_50[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_49"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_51: ',' keyword_pattern
static asdl_seq *
_loop0_51_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' keyword_pattern
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern"));
Token * _literal;
KeyPatternPair* elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = keyword_pattern_rule(p)) // keyword_pattern
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_51[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_52: keyword_pattern _loop0_51
static asdl_seq *
_gather_52_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // keyword_pattern _loop0_51
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_51"));
KeyPatternPair* elem;
asdl_seq * seq;
if (
(elem = keyword_pattern_rule(p)) // keyword_pattern
&&
(seq = _loop0_51_rule(p)) // _loop0_51
)
{
D(fprintf(stderr, "%*c+ _gather_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_51"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_52[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_51"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_53: ',' type_param
static asdl_seq *
_loop0_53_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' type_param
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' type_param"));
Token * _literal;
type_param_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = type_param_rule(p)) // type_param
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_53[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' type_param"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_54: type_param _loop0_53
static asdl_seq *
_gather_54_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // type_param _loop0_53
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "type_param _loop0_53"));
type_param_ty elem;
asdl_seq * seq;
if (
(elem = type_param_rule(p)) // type_param
&&
(seq = _loop0_53_rule(p)) // _loop0_53
)
{
D(fprintf(stderr, "%*c+ _gather_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "type_param _loop0_53"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_54[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "type_param _loop0_53"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop1_55: (',' expression)
static asdl_seq *
_loop1_55_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // (',' expression)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
void *_tmp_17_var;
while (
(_tmp_17_var = _tmp_17_rule(p)) // ',' expression
)
{
_res = _tmp_17_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_55[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_56: (',' star_expression)
static asdl_seq *
_loop1_56_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // (',' star_expression)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
void *_tmp_153_var;
while (
(_tmp_153_var = _tmp_153_rule(p)) // ',' star_expression
)
{
_res = _tmp_153_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_56[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_57: ',' star_named_expression
static asdl_seq *
_loop0_57_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' star_named_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression"));
Token * _literal;
expr_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = star_named_expression_rule(p)) // star_named_expression
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_58: star_named_expression _loop0_57
static asdl_seq *
_gather_58_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // star_named_expression _loop0_57
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_57"));
expr_ty elem;
asdl_seq * seq;
if (
(elem = star_named_expression_rule(p)) // star_named_expression
&&
(seq = _loop0_57_rule(p)) // _loop0_57
)
{
D(fprintf(stderr, "%*c+ _gather_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_57"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_58[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_57"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop1_59: ('or' conjunction)
static asdl_seq *
_loop1_59_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ('or' conjunction)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
void *_tmp_154_var;
while (
(_tmp_154_var = _tmp_154_rule(p)) // 'or' conjunction
)
{
_res = _tmp_154_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_60: ('and' inversion)
static asdl_seq *
_loop1_60_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ('and' inversion)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
void *_tmp_155_var;
while (
(_tmp_155_var = _tmp_155_rule(p)) // 'and' inversion
)
{
_res = _tmp_155_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_61: compare_op_bitwise_or_pair
static asdl_seq *
_loop1_61_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // compare_op_bitwise_or_pair
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair"));
CmpopExprPair* compare_op_bitwise_or_pair_var;
while (
(compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
)
{
_res = compare_op_bitwise_or_pair_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _tmp_62: '!='
static void *
_tmp_62_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '!='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
Token * tok;
if (
(tok = _PyPegen_expect_token(p, 28)) // token='!='
)
{
D(fprintf(stderr, "%*c+ _tmp_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
_res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_62[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_63: ',' (slice | starred_expression)
static asdl_seq *
_loop0_63_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' (slice | starred_expression)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (slice | starred_expression)"));
Token * _literal;
void *elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = _tmp_156_rule(p)) // slice | starred_expression
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (slice | starred_expression)"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_64: (slice | starred_expression) _loop0_63
static asdl_seq *
_gather_64_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // (slice | starred_expression) _loop0_63
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(slice | starred_expression) _loop0_63"));
void *elem;
asdl_seq * seq;
if (
(elem = _tmp_156_rule(p)) // slice | starred_expression
&&
(seq = _loop0_63_rule(p)) // _loop0_63
)
{
D(fprintf(stderr, "%*c+ _gather_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(slice | starred_expression) _loop0_63"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_64[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(slice | starred_expression) _loop0_63"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_65: ':' expression?
static void *
_tmp_65_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ':' expression?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Token * _literal;
void *d;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(d = expression_rule(p), !p->error_indicator) // expression?
)
{
D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
_res = d;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_66: STRING | FSTRING_START
static void *
_tmp_66_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // STRING
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
expr_ty string_var;
if (
(string_var = _PyPegen_string_token(p)) // STRING
)
{
D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING"));
_res = string_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
}
{ // FSTRING_START
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_START"));
Token * fstring_start_var;
if (
(fstring_start_var = _PyPegen_expect_token(p, FSTRING_START)) // token='FSTRING_START'
)
{
D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_START"));
_res = fstring_start_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_START"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_67: tuple | group | genexp
static void *
_tmp_67_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // tuple
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
expr_ty tuple_var;
if (
(tuple_var = tuple_rule(p)) // tuple
)
{
D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
_res = tuple_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
}
{ // group
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
expr_ty group_var;
if (
(group_var = group_rule(p)) // group
)
{
D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
_res = group_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
}
{ // genexp
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
expr_ty genexp_var;
if (
(genexp_var = genexp_rule(p)) // genexp
)
{
D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
_res = genexp_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_68: list | listcomp
static void *
_tmp_68_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // list
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
expr_ty list_var;
if (
(list_var = list_rule(p)) // list
)
{
D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
_res = list_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
}
{ // listcomp
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
expr_ty listcomp_var;
if (
(listcomp_var = listcomp_rule(p)) // listcomp
)
{
D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
_res = listcomp_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_69: dict | set | dictcomp | setcomp
static void *
_tmp_69_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // dict
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
expr_ty dict_var;
if (
(dict_var = dict_rule(p)) // dict
)
{
D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
_res = dict_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
}
{ // set
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
expr_ty set_var;
if (
(set_var = set_rule(p)) // set
)
{
D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
_res = set_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
}
{ // dictcomp
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
expr_ty dictcomp_var;
if (
(dictcomp_var = dictcomp_rule(p)) // dictcomp
)
{
D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
_res = dictcomp_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
}
{ // setcomp
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
expr_ty setcomp_var;
if (
(setcomp_var = setcomp_rule(p)) // setcomp
)
{
D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
_res = setcomp_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_70: yield_expr | named_expression
static void *
_tmp_70_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // yield_expr
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
expr_ty yield_expr_var;
if (
(yield_expr_var = yield_expr_rule(p)) // yield_expr
)
{
D(fprintf(stderr, "%*c+ _tmp_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
_res = yield_expr_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_70[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
}
{ // named_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
expr_ty named_expression_var;
if (
(named_expression_var = named_expression_rule(p)) // named_expression
)
{
D(fprintf(stderr, "%*c+ _tmp_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
_res = named_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_70[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_71: lambda_param_no_default
static asdl_seq *
_loop0_71_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // lambda_param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
arg_ty lambda_param_no_default_var;
while (
(lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
)
{
_res = lambda_param_no_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_72: lambda_param_with_default
static asdl_seq *
_loop0_72_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // lambda_param_with_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
NameDefaultPair* lambda_param_with_default_var;
while (
(lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
)
{
_res = lambda_param_with_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_72[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_73: lambda_param_no_default
static asdl_seq *
_loop1_73_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // lambda_param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
arg_ty lambda_param_no_default_var;
while (
(lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
)
{
_res = lambda_param_no_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_73[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_74: lambda_param_with_default
static asdl_seq *
_loop1_74_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // lambda_param_with_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
NameDefaultPair* lambda_param_with_default_var;
while (
(lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
)
{
_res = lambda_param_with_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_74[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_75: lambda_param_maybe_default
static asdl_seq *
_loop0_75_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // lambda_param_maybe_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
NameDefaultPair* lambda_param_maybe_default_var;
while (
(lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
)
{
_res = lambda_param_maybe_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_75[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_76: lambda_param_maybe_default
static asdl_seq *
_loop1_76_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // lambda_param_maybe_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
NameDefaultPair* lambda_param_maybe_default_var;
while (
(lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
)
{
_res = lambda_param_maybe_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_76[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_77: fstring_format_spec
static asdl_seq *
_loop0_77_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // fstring_format_spec
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_format_spec"));
expr_ty fstring_format_spec_var;
while (
(fstring_format_spec_var = fstring_format_spec_rule(p)) // fstring_format_spec
)
{
_res = fstring_format_spec_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_format_spec"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_78: fstring_middle
static asdl_seq *
_loop0_78_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // fstring_middle
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_middle"));
expr_ty fstring_middle_var;
while (
(fstring_middle_var = fstring_middle_rule(p)) // fstring_middle
)
{
_res = fstring_middle_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_middle"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop1_79: (fstring | string)
static asdl_seq *
_loop1_79_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // (fstring | string)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(fstring | string)"));
void *_tmp_157_var;
while (
(_tmp_157_var = _tmp_157_rule(p)) // fstring | string
)
{
_res = _tmp_157_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(fstring | string)"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _tmp_80: star_named_expression ',' star_named_expressions?
static void *
_tmp_80_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // star_named_expression ',' star_named_expressions?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
Token * _literal;
expr_ty y;
void *z;
if (
(y = star_named_expression_rule(p)) // star_named_expression
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(z = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions?
)
{
D(fprintf(stderr, "%*c+ _tmp_80[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
_res = _PyPegen_seq_insert_in_front ( p , y , z );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_80[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_81: ',' double_starred_kvpair
static asdl_seq *
_loop0_81_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' double_starred_kvpair
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair"));
Token * _literal;
KeyValuePair* elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_81[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_82: double_starred_kvpair _loop0_81
static asdl_seq *
_gather_82_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // double_starred_kvpair _loop0_81
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_81"));
KeyValuePair* elem;
asdl_seq * seq;
if (
(elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
&&
(seq = _loop0_81_rule(p)) // _loop0_81
)
{
D(fprintf(stderr, "%*c+ _gather_82[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_81"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_82[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_81"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop1_83: for_if_clause
static asdl_seq *
_loop1_83_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // for_if_clause
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause"));
comprehension_ty for_if_clause_var;
while (
(for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
)
{
_res = for_if_clause_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_84: ('if' disjunction)
static asdl_seq *
_loop0_84_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ('if' disjunction)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
void *_tmp_158_var;
while (
(_tmp_158_var = _tmp_158_rule(p)) // 'if' disjunction
)
{
_res = _tmp_158_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _tmp_85: assignment_expression | expression !':='
static void *
_tmp_85_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // assignment_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
expr_ty assignment_expression_var;
if (
(assignment_expression_var = assignment_expression_rule(p)) // assignment_expression
)
{
D(fprintf(stderr, "%*c+ _tmp_85[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
_res = assignment_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_85[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression"));
}
{ // expression !':='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
expr_ty expression_var;
if (
(expression_var = expression_rule(p)) // expression
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
)
{
D(fprintf(stderr, "%*c+ _tmp_85[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
_res = expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_85[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_86: ',' (starred_expression | (assignment_expression | expression !':=') !'=')
static asdl_seq *
_loop0_86_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' (starred_expression | (assignment_expression | expression !':=') !'=')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')"));
Token * _literal;
void *elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = _tmp_159_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'='
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_87:
// | (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_86
static asdl_seq *
_gather_87_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_86
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_86"));
void *elem;
asdl_seq * seq;
if (
(elem = _tmp_159_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'='
&&
(seq = _loop0_86_rule(p)) // _loop0_86
)
{
D(fprintf(stderr, "%*c+ _gather_87[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_86"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_87[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_86"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_88: ',' kwargs
static void *
_tmp_88_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ',' kwargs
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
Token * _literal;
asdl_seq* k;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(k = kwargs_rule(p)) // kwargs
)
{
D(fprintf(stderr, "%*c+ _tmp_88[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
_res = k;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_88[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_89: ',' kwarg_or_starred
static asdl_seq *
_loop0_89_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' kwarg_or_starred
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
Token * _literal;
KeywordOrStarred* elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_89[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_90: kwarg_or_starred _loop0_89
static asdl_seq *
_gather_90_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // kwarg_or_starred _loop0_89
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_89"));
KeywordOrStarred* elem;
asdl_seq * seq;
if (
(elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
&&
(seq = _loop0_89_rule(p)) // _loop0_89
)
{
D(fprintf(stderr, "%*c+ _gather_90[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_89"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_90[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_89"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_91: ',' kwarg_or_double_starred
static asdl_seq *
_loop0_91_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' kwarg_or_double_starred
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
Token * _literal;
KeywordOrStarred* elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_92: kwarg_or_double_starred _loop0_91
static asdl_seq *
_gather_92_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // kwarg_or_double_starred _loop0_91
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_91"));
KeywordOrStarred* elem;
asdl_seq * seq;
if (
(elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
&&
(seq = _loop0_91_rule(p)) // _loop0_91
)
{
D(fprintf(stderr, "%*c+ _gather_92[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_91"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_92[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_91"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_93: (',' star_target)
static asdl_seq *
_loop0_93_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // (',' star_target)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
void *_tmp_160_var;
while (
(_tmp_160_var = _tmp_160_rule(p)) // ',' star_target
)
{
_res = _tmp_160_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_93[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_94: ',' star_target
static asdl_seq *
_loop0_94_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' star_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Token * _literal;
expr_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = star_target_rule(p)) // star_target
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_95: star_target _loop0_94
static asdl_seq *
_gather_95_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // star_target _loop0_94
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_94"));
expr_ty elem;
asdl_seq * seq;
if (
(elem = star_target_rule(p)) // star_target
&&
(seq = _loop0_94_rule(p)) // _loop0_94
)
{
D(fprintf(stderr, "%*c+ _gather_95[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_94"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_95[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_94"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop1_96: (',' star_target)
static asdl_seq *
_loop1_96_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // (',' star_target)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
void *_tmp_160_var;
while (
(_tmp_160_var = _tmp_160_rule(p)) // ',' star_target
)
{
_res = _tmp_160_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
p->level--;
return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _tmp_97: !'*' star_target
static void *
_tmp_97_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // !'*' star_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
expr_ty star_target_var;
if (
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
&&
(star_target_var = star_target_rule(p)) // star_target
)
{
D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
_res = star_target_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_98: ',' del_target
static asdl_seq *
_loop0_98_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' del_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
Token * _literal;
expr_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = del_target_rule(p)) // del_target
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_99: del_target _loop0_98
static asdl_seq *
_gather_99_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // del_target _loop0_98
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_98"));
expr_ty elem;
asdl_seq * seq;
if (
(elem = del_target_rule(p)) // del_target
&&
(seq = _loop0_98_rule(p)) // _loop0_98
)
{
D(fprintf(stderr, "%*c+ _gather_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_98"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_99[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_98"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_100: ',' expression
static asdl_seq *
_loop0_100_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Token * _literal;
expr_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = expression_rule(p)) // expression
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_101: expression _loop0_100
static asdl_seq *
_gather_101_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // expression _loop0_100
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_100"));
expr_ty elem;
asdl_seq * seq;
if (
(elem = expression_rule(p)) // expression
&&
(seq = _loop0_100_rule(p)) // _loop0_100
)
{
D(fprintf(stderr, "%*c+ _gather_101[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_100"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_101[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_100"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_102: NEWLINE INDENT
static void *
_tmp_102_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // NEWLINE INDENT
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
Token * indent_var;
Token * newline_var;
if (
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
&&
(indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
)
{
D(fprintf(stderr, "%*c+ _tmp_102[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
_res = _PyPegen_dummy_name(p, newline_var, indent_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_103:
// | (','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)
// | kwargs
static void *
_tmp_103_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // (','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)"));
void *_tmp_161_var;
if (
(_tmp_161_var = _tmp_161_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs
)
{
D(fprintf(stderr, "%*c+ _tmp_103[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)"));
_res = _tmp_161_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_103[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)"));
}
{ // kwargs
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
asdl_seq* kwargs_var;
if (
(kwargs_var = kwargs_rule(p)) // kwargs
)
{
D(fprintf(stderr, "%*c+ _tmp_103[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
_res = kwargs_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_103[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_104: ',' (starred_expression !'=')
static asdl_seq *
_loop0_104_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' (starred_expression !'=')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression !'=')"));
Token * _literal;
void *elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = _tmp_162_rule(p)) // starred_expression !'='
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression !'=')"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_105: (starred_expression !'=') _loop0_104
static asdl_seq *
_gather_105_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // (starred_expression !'=') _loop0_104
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression !'=') _loop0_104"));
void *elem;
asdl_seq * seq;
if (
(elem = _tmp_162_rule(p)) // starred_expression !'='
&&
(seq = _loop0_104_rule(p)) // _loop0_104
)
{
D(fprintf(stderr, "%*c+ _gather_105[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression !'=') _loop0_104"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_105[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression !'=') _loop0_104"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_106: args | expression for_if_clauses
static void *
_tmp_106_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // args
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
expr_ty args_var;
if (
(args_var = args_rule(p)) // args
)
{
D(fprintf(stderr, "%*c+ _tmp_106[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
_res = args_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_106[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
}
{ // expression for_if_clauses
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
expr_ty expression_var;
asdl_comprehension_seq* for_if_clauses_var;
if (
(expression_var = expression_rule(p)) // expression
&&
(for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
)
{
D(fprintf(stderr, "%*c+ _tmp_106[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
_res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_106[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_107: args ','
static void *
_tmp_107_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // args ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','"));
Token * _literal;
expr_ty args_var;
if (
(args_var = args_rule(p)) // args
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ _tmp_107[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','"));
_res = _PyPegen_dummy_name(p, args_var, _literal);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_107[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_108: ',' | ')'
static void *
_tmp_108_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ _tmp_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
}
{ // ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ _tmp_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_109: 'True' | 'False' | 'None'
static void *
_tmp_109_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'True'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 610)) // token='True'
)
{
D(fprintf(stderr, "%*c+ _tmp_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_109[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
}
{ // 'False'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 612)) // token='False'
)
{
D(fprintf(stderr, "%*c+ _tmp_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_109[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
}
{ // 'None'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 611)) // token='None'
)
{
D(fprintf(stderr, "%*c+ _tmp_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_109[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_110: NAME '='
static void *
_tmp_110_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // NAME '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '='"));
Token * _literal;
expr_ty name_var;
if (
(name_var = _PyPegen_name_token(p)) // NAME
&&
(_literal = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '='"));
_res = _PyPegen_dummy_name(p, name_var, _literal);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '='"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_111: NAME STRING | SOFT_KEYWORD
static void *
_tmp_111_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // NAME STRING
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME STRING"));
expr_ty name_var;
expr_ty string_var;
if (
(name_var = _PyPegen_name_token(p)) // NAME
&&
(string_var = _PyPegen_string_token(p)) // STRING
)
{
D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME STRING"));
_res = _PyPegen_dummy_name(p, name_var, string_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME STRING"));
}
{ // SOFT_KEYWORD
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD"));
expr_ty soft_keyword_var;
if (
(soft_keyword_var = _PyPegen_soft_keyword_token(p)) // SOFT_KEYWORD
)
{
D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD"));
_res = soft_keyword_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "SOFT_KEYWORD"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_112: 'else' | ':'
static void *
_tmp_112_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'else'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 671)) // token='else'
)
{
D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else'"));
}
{ // ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_113: '=' | ':='
static void *
_tmp_113_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
}
{ // ':='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 53)) // token=':='
)
{
D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':='"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_114: list | tuple | genexp | 'True' | 'None' | 'False'
static void *
_tmp_114_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // list
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
expr_ty list_var;
if (
(list_var = list_rule(p)) // list
)
{
D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
_res = list_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
}
{ // tuple
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
expr_ty tuple_var;
if (
(tuple_var = tuple_rule(p)) // tuple
)
{
D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
_res = tuple_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
}
{ // genexp
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
expr_ty genexp_var;
if (
(genexp_var = genexp_rule(p)) // genexp
)
{
D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
_res = genexp_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
}
{ // 'True'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 610)) // token='True'
)
{
D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
}
{ // 'None'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 611)) // token='None'
)
{
D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
}
{ // 'False'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 612)) // token='False'
)
{
D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_115: star_named_expressions
static asdl_seq *
_loop0_115_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // star_named_expressions
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions"));
asdl_expr_seq* star_named_expressions_var;
while (
(star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions
)
{
_res = star_named_expressions_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_115[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _loop0_116: (star_targets '=')
static asdl_seq *
_loop0_116_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // (star_targets '=')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
void *_tmp_150_var;
while (
(_tmp_150_var = _tmp_150_rule(p)) // star_targets '='
)
{
_res = _tmp_150_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _tmp_117: '[' | '(' | '{'
static void *
_tmp_117_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '['
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 9)) // token='['
)
{
D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
}
{ // '('
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 7)) // token='('
)
{
D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
}
{ // '{'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
)
{
D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_118: '[' | '{'
static void *
_tmp_118_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '['
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 9)) // token='['
)
{
D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
}
{ // '{'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
)
{
D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_119: slash_no_default | slash_with_default
static void *
_tmp_119_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // slash_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default"));
asdl_arg_seq* slash_no_default_var;
if (
(slash_no_default_var = slash_no_default_rule(p)) // slash_no_default
)
{
D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default"));
_res = slash_no_default_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default"));
}
{ // slash_with_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
SlashWithDefault* slash_with_default_var;
if (
(slash_with_default_var = slash_with_default_rule(p)) // slash_with_default
)
{
D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
_res = slash_with_default_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_120: ',' | param_no_default
static void *
_tmp_120_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
}
{ // param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
arg_ty param_no_default_var;
if (
(param_no_default_var = param_no_default_rule(p)) // param_no_default
)
{
D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default"));
_res = param_no_default_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_121: ')' | ','
static void *
_tmp_121_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
}
{ // ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_122: ')' | ',' (')' | '**')
static void *
_tmp_122_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
}
{ // ',' (')' | '**')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
Token * _literal;
void *_tmp_163_var;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(_tmp_163_var = _tmp_163_rule(p)) // ')' | '**'
)
{
D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
_res = _PyPegen_dummy_name(p, _literal, _tmp_163_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_123: param_no_default | ','
static void *
_tmp_123_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
arg_ty param_no_default_var;
if (
(param_no_default_var = param_no_default_rule(p)) // param_no_default
)
{
D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default"));
_res = param_no_default_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
}
{ // ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_124: '*' | '**' | '/'
static void *
_tmp_124_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '*'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
)
{
D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
}
{ // '**'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
)
{
D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
}
{ // '/'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
)
{
D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_125: lambda_slash_no_default | lambda_slash_with_default
static void *
_tmp_125_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // lambda_slash_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default"));
asdl_arg_seq* lambda_slash_no_default_var;
if (
(lambda_slash_no_default_var = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
)
{
D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default"));
_res = lambda_slash_no_default_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default"));
}
{ // lambda_slash_with_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
SlashWithDefault* lambda_slash_with_default_var;
if (
(lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
)
{
D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
_res = lambda_slash_with_default_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_126: ',' lambda_param
static asdl_seq *
_loop0_126_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' lambda_param
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' lambda_param"));
Token * _literal;
arg_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = lambda_param_rule(p)) // lambda_param
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' lambda_param"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_127: lambda_param _loop0_126
static asdl_seq *
_gather_127_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // lambda_param _loop0_126
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param _loop0_126"));
arg_ty elem;
asdl_seq * seq;
if (
(elem = lambda_param_rule(p)) // lambda_param
&&
(seq = _loop0_126_rule(p)) // _loop0_126
)
{
D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param _loop0_126"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param _loop0_126"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_128: ',' | lambda_param_no_default
static void *
_tmp_128_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
}
{ // lambda_param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
arg_ty lambda_param_no_default_var;
if (
(lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
)
{
D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
_res = lambda_param_no_default_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_129: ':' | ',' (':' | '**')
static void *
_tmp_129_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
}
{ // ',' (':' | '**')
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
Token * _literal;
void *_tmp_164_var;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(_tmp_164_var = _tmp_164_rule(p)) // ':' | '**'
)
{
D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
_res = _PyPegen_dummy_name(p, _literal, _tmp_164_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_130: lambda_param_no_default | ','
static void *
_tmp_130_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // lambda_param_no_default
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
arg_ty lambda_param_no_default_var;
if (
(lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
)
{
D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
_res = lambda_param_no_default_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
}
{ // ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_131: bitwise_or ((',' bitwise_or))* ','?
static void *
_tmp_131_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // bitwise_or ((',' bitwise_or))* ','?
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or ((',' bitwise_or))* ','?"));
asdl_seq * _loop0_165_var;
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty bitwise_or_var;
if (
(bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
&&
(_loop0_165_var = _loop0_165_rule(p)) // ((',' bitwise_or))*
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
{
D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or ((',' bitwise_or))* ','?"));
_res = _PyPegen_dummy_name(p, bitwise_or_var, _loop0_165_var, _opt_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or ((',' bitwise_or))* ','?"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_132: ',' dotted_name
static asdl_seq *
_loop0_132_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' dotted_name
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_name"));
Token * _literal;
expr_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = dotted_name_rule(p)) // dotted_name
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_name"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_133: dotted_name _loop0_132
static asdl_seq *
_gather_133_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // dotted_name _loop0_132
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name _loop0_132"));
expr_ty elem;
asdl_seq * seq;
if (
(elem = dotted_name_rule(p)) // dotted_name
&&
(seq = _loop0_132_rule(p)) // _loop0_132
)
{
D(fprintf(stderr, "%*c+ _gather_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name _loop0_132"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_133[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name _loop0_132"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_134: ',' (expression ['as' star_target])
static asdl_seq *
_loop0_134_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' (expression ['as' star_target])
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])"));
Token * _literal;
void *elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = _tmp_166_rule(p)) // expression ['as' star_target]
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expression ['as' star_target])"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_135: (expression ['as' star_target]) _loop0_134
static asdl_seq *
_gather_135_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // (expression ['as' star_target]) _loop0_134
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_134"));
void *elem;
asdl_seq * seq;
if (
(elem = _tmp_166_rule(p)) // expression ['as' star_target]
&&
(seq = _loop0_134_rule(p)) // _loop0_134
)
{
D(fprintf(stderr, "%*c+ _gather_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_134"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_135[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_134"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_136: ',' (expressions ['as' star_target])
static asdl_seq *
_loop0_136_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // ',' (expressions ['as' star_target])
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])"));
Token * _literal;
void *elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(elem = _tmp_167_rule(p)) // expressions ['as' star_target]
)
{
_res = elem;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
PyMem_Free(_children);
p->level--;
return NULL;
}
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_136[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expressions ['as' star_target])"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _gather_137: (expressions ['as' star_target]) _loop0_136
static asdl_seq *
_gather_137_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
asdl_seq * _res = NULL;
int _mark = p->mark;
{ // (expressions ['as' star_target]) _loop0_136
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _gather_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_136"));
void *elem;
asdl_seq * seq;
if (
(elem = _tmp_167_rule(p)) // expressions ['as' star_target]
&&
(seq = _loop0_136_rule(p)) // _loop0_136
)
{
D(fprintf(stderr, "%*c+ _gather_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_136"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_137[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_136"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_138: 'except' | 'finally'
static void *
_tmp_138_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'except'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 663)) // token='except'
)
{
D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except'"));
}
{ // 'finally'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 659)) // token='finally'
)
{
D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_139: block
static asdl_seq *
_loop0_139_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // block
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "block"));
asdl_stmt_seq* block_var;
while (
(block_var = block_rule(p)) // block
)
{
_res = block_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "block"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _tmp_140: expression ['as' NAME]
static void *
_tmp_140_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // expression ['as' NAME]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' NAME]"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty expression_var;
if (
(expression_var = expression_rule(p)) // expression
&&
(_opt_var = _tmp_22_rule(p), !p->error_indicator) // ['as' NAME]
)
{
D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' NAME]"));
_res = _PyPegen_dummy_name(p, expression_var, _opt_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' NAME]"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_141: NEWLINE | ':'
static void *
_tmp_141_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
Token * newline_var;
if (
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
_res = newline_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
}
{ // ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_142: positional_patterns ','
static void *
_tmp_142_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // positional_patterns ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "positional_patterns ','"));
Token * _literal;
asdl_pattern_seq* positional_patterns_var;
if (
(positional_patterns_var = positional_patterns_rule(p)) // positional_patterns
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "positional_patterns ','"));
_res = _PyPegen_dummy_name(p, positional_patterns_var, _literal);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "positional_patterns ','"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_143: '}' | ','
static void *
_tmp_143_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'"));
}
{ // ','
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_144: '=' | '!' | ':' | '}'
static void *
_tmp_144_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
}
{ // '!'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 54)) // token='!'
)
{
D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!'"));
}
{ // ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
}
{ // '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_145: '!' | ':' | '}'
static void *
_tmp_145_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '!'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 54)) // token='!'
)
{
D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!'"));
}
{ // ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
}
{ // '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_146: '!' NAME
static void *
_tmp_146_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '!' NAME
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' NAME"));
Token * _literal;
expr_ty name_var;
if (
(_literal = _PyPegen_expect_token(p, 54)) // token='!'
&&
(name_var = _PyPegen_name_token(p)) // NAME
)
{
D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' NAME"));
_res = _PyPegen_dummy_name(p, _literal, name_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' NAME"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_147: ':' | '}'
static void *
_tmp_147_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
}
{ // '}'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 26)) // token='}'
)
{
D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_148: '+' | '-' | '*' | '/' | '%' | '//' | '@'
static void *
_tmp_148_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '+'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 14)) // token='+'
)
{
D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'"));
}
{ // '-'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 15)) // token='-'
)
{
D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'"));
}
{ // '*'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
)
{
D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
}
{ // '/'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 17)) // token='/'
)
{
D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/'"));
}
{ // '%'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 24)) // token='%'
)
{
D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%'"));
}
{ // '//'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 47)) // token='//'
)
{
D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//'"));
}
{ // '@'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 49)) // token='@'
)
{
D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_149: '+' | '-' | '~'
static void *
_tmp_149_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '+'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 14)) // token='+'
)
{
D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'"));
}
{ // '-'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 15)) // token='-'
)
{
D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'"));
}
{ // '~'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 31)) // token='~'
)
{
D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_150: star_targets '='
static void *
_tmp_150_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // star_targets '='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Token * _literal;
expr_ty z;
if (
(z = star_targets_rule(p)) // star_targets
&&
(_literal = _PyPegen_expect_token(p, 22)) // token='='
)
{
D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
_res = z;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_151: '.' | '...'
static void *
_tmp_151_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '.'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 23)) // token='.'
)
{
D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
}
{ // '...'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 52)) // token='...'
)
{
D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_152: '@' named_expression NEWLINE
static void *
_tmp_152_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // '@' named_expression NEWLINE
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
Token * _literal;
expr_ty f;
Token * newline_var;
if (
(_literal = _PyPegen_expect_token(p, 49)) // token='@'
&&
(f = named_expression_rule(p)) // named_expression
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
{
D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
_res = f;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_153: ',' star_expression
static void *
_tmp_153_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ',' star_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Token * _literal;
expr_ty c;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(c = star_expression_rule(p)) // star_expression
)
{
D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
_res = c;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_154: 'or' conjunction
static void *
_tmp_154_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'or' conjunction
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Token * _keyword;
expr_ty c;
if (
(_keyword = _PyPegen_expect_token(p, 581)) // token='or'
&&
(c = conjunction_rule(p)) // conjunction
)
{
D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
_res = c;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_155: 'and' inversion
static void *
_tmp_155_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'and' inversion
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Token * _keyword;
expr_ty c;
if (
(_keyword = _PyPegen_expect_token(p, 582)) // token='and'
&&
(c = inversion_rule(p)) // inversion
)
{
D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
_res = c;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_156: slice | starred_expression
static void *
_tmp_156_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // slice
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice"));
expr_ty slice_var;
if (
(slice_var = slice_rule(p)) // slice
)
{
D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice"));
_res = slice_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice"));
}
{ // starred_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
expr_ty starred_expression_var;
if (
(starred_expression_var = starred_expression_rule(p)) // starred_expression
)
{
D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
_res = starred_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_157: fstring | string
static void *
_tmp_157_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // fstring
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring"));
expr_ty fstring_var;
if (
(fstring_var = fstring_rule(p)) // fstring
)
{
D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "fstring"));
_res = fstring_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring"));
}
{ // string
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "string"));
expr_ty string_var;
if (
(string_var = string_rule(p)) // string
)
{
D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "string"));
_res = string_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "string"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_158: 'if' disjunction
static void *
_tmp_158_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'if' disjunction
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
Token * _keyword;
expr_ty z;
if (
(_keyword = _PyPegen_expect_token(p, 668)) // token='if'
&&
(z = disjunction_rule(p)) // disjunction
)
{
D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
_res = z;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_159: starred_expression | (assignment_expression | expression !':=') !'='
static void *
_tmp_159_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // starred_expression
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
expr_ty starred_expression_var;
if (
(starred_expression_var = starred_expression_rule(p)) // starred_expression
)
{
D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
_res = starred_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
}
{ // (assignment_expression | expression !':=') !'='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
void *_tmp_85_var;
if (
(_tmp_85_var = _tmp_85_rule(p)) // assignment_expression | expression !':='
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
)
{
D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
_res = _tmp_85_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_160: ',' star_target
static void *
_tmp_160_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ',' star_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Token * _literal;
expr_ty c;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(c = star_target_rule(p)) // star_target
)
{
D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
_res = c;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
return NULL;
}
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_161:
// | ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs
static void *
_tmp_161_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs"));
asdl_seq * _gather_87_var;
Token * _literal;
asdl_seq* kwargs_var;
if (
(_gather_87_var = _gather_87_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(kwargs_var = kwargs_rule(p)) // kwargs
)
{
D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs"));
_res = _PyPegen_dummy_name(p, _gather_87_var, _literal, kwargs_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_162: starred_expression !'='
static void *
_tmp_162_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // starred_expression !'='
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression !'='"));
expr_ty starred_expression_var;
if (
(starred_expression_var = starred_expression_rule(p)) // starred_expression
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
)
{
D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression !'='"));
_res = starred_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression !'='"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_163: ')' | '**'
static void *
_tmp_163_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ')'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 8)) // token=')'
)
{
D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
}
{ // '**'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
)
{
D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_164: ':' | '**'
static void *
_tmp_164_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ':'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
)
{
D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
}
{ // '**'
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 35)) // token='**'
)
{
D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
_res = _literal;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _loop0_165: (',' bitwise_or)
static asdl_seq *
_loop0_165_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void *_res = NULL;
int _mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
{ // (',' bitwise_or)
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _loop0_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' bitwise_or)"));
void *_tmp_168_var;
while (
(_tmp_168_var = _tmp_168_rule(p)) // ',' bitwise_or
)
{
_res = _tmp_168_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
_children = _new_children;
}
_children[_n++] = _res;
_mark = p->mark;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_165[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' bitwise_or)"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
p->level--;
return NULL;
}
for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
p->level--;
return _seq;
}
// _tmp_166: expression ['as' star_target]
static void *
_tmp_166_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // expression ['as' star_target]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty expression_var;
if (
(expression_var = expression_rule(p)) // expression
&&
(_opt_var = _tmp_169_rule(p), !p->error_indicator) // ['as' star_target]
)
{
D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]"));
_res = _PyPegen_dummy_name(p, expression_var, _opt_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_167: expressions ['as' star_target]
static void *
_tmp_167_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // expressions ['as' star_target]
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
expr_ty expressions_var;
if (
(expressions_var = expressions_rule(p)) // expressions
&&
(_opt_var = _tmp_169_rule(p), !p->error_indicator) // ['as' star_target]
)
{
D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]"));
_res = _PyPegen_dummy_name(p, expressions_var, _opt_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_168: ',' bitwise_or
static void *
_tmp_168_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // ',' bitwise_or
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' bitwise_or"));
Token * _literal;
expr_ty bitwise_or_var;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
(bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
)
{
D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' bitwise_or"));
_res = _PyPegen_dummy_name(p, _literal, bitwise_or_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' bitwise_or"));
}
_res = NULL;
done:
p->level--;
return _res;
}
// _tmp_169: 'as' star_target
static void *
_tmp_169_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
_Pypegen_stack_overflow(p);
}
if (p->error_indicator) {
p->level--;
return NULL;
}
void * _res = NULL;
int _mark = p->mark;
{ // 'as' star_target
if (p->error_indicator) {
p->level--;
return NULL;
}
D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
Token * _keyword;
expr_ty star_target_var;
if (
(_keyword = _PyPegen_expect_token(p, 666)) // token='as'
&&
(star_target_var = star_target_rule(p)) // star_target
)
{
D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
_res = _PyPegen_dummy_name(p, _keyword, star_target_var);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target"));
}
_res = NULL;
done:
p->level--;
return _res;
}
void *
_PyPegen_parse(Parser *p)
{
// Initialize keywords
p->keywords = reserved_keywords;
p->n_keyword_lists = n_keyword_lists;
p->soft_keywords = soft_keywords;
// Run parser
void *result = NULL;
if (p->start_rule == Py_file_input) {
result = file_rule(p);
} else if (p->start_rule == Py_single_input) {
result = interactive_rule(p);
} else if (p->start_rule == Py_eval_input) {
result = eval_rule(p);
} else if (p->start_rule == Py_func_type_input) {
result = func_type_rule(p);
}
return result;
}