blob: 1705ebd456b5ff99b7a9311bad9562e36dcf7ed7 [file] [log] [blame]
// @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__
# define MAXSTACK 4000
#else
# define MAXSTACK 6000
#endif
static const int n_keyword_lists = 9;
static KeywordToken *reserved_keywords[] = {
(KeywordToken[]) {{NULL, -1}},
(KeywordToken[]) {{NULL, -1}},
(KeywordToken[]) {
{"if", 642},
{"as", 640},
{"in", 651},
{"or", 574},
{"is", 582},
{NULL, -1},
},
(KeywordToken[]) {
{"del", 604},
{"def", 652},
{"for", 650},
{"try", 624},
{"and", 575},
{"not", 581},
{NULL, -1},
},
(KeywordToken[]) {
{"from", 608},
{"pass", 504},
{"with", 615},
{"elif", 644},
{"else", 645},
{"None", 602},
{"True", 601},
{NULL, -1},
},
(KeywordToken[]) {
{"raise", 522},
{"yield", 573},
{"break", 508},
{"class", 654},
{"while", 647},
{"False", 603},
{NULL, -1},
},
(KeywordToken[]) {
{"return", 519},
{"import", 607},
{"assert", 526},
{"global", 523},
{"except", 637},
{"lambda", 600},
{NULL, -1},
},
(KeywordToken[]) {
{"finally", 633},
{NULL, -1},
},
(KeywordToken[]) {
{"continue", 509},
{"nonlocal", 524},
{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 fstring_type 1004
#define statements_type 1005
#define statement_type 1006
#define statement_newline_type 1007
#define simple_stmts_type 1008
#define simple_stmt_type 1009
#define compound_stmt_type 1010
#define assignment_type 1011
#define annotated_rhs_type 1012
#define augassign_type 1013
#define return_stmt_type 1014
#define raise_stmt_type 1015
#define global_stmt_type 1016
#define nonlocal_stmt_type 1017
#define del_stmt_type 1018
#define yield_stmt_type 1019
#define assert_stmt_type 1020
#define import_stmt_type 1021
#define import_name_type 1022
#define import_from_type 1023
#define import_from_targets_type 1024
#define import_from_as_names_type 1025
#define import_from_as_name_type 1026
#define dotted_as_names_type 1027
#define dotted_as_name_type 1028
#define dotted_name_type 1029 // Left-recursive
#define block_type 1030
#define decorators_type 1031
#define class_def_type 1032
#define class_def_raw_type 1033
#define function_def_type 1034
#define function_def_raw_type 1035
#define params_type 1036
#define parameters_type 1037
#define slash_no_default_type 1038
#define slash_with_default_type 1039
#define star_etc_type 1040
#define kwds_type 1041
#define param_no_default_type 1042
#define param_no_default_star_annotation_type 1043
#define param_with_default_type 1044
#define param_maybe_default_type 1045
#define param_type 1046
#define param_star_annotation_type 1047
#define annotation_type 1048
#define star_annotation_type 1049
#define default_type 1050
#define if_stmt_type 1051
#define elif_stmt_type 1052
#define else_block_type 1053
#define while_stmt_type 1054
#define for_stmt_type 1055
#define with_stmt_type 1056
#define with_item_type 1057
#define try_stmt_type 1058
#define except_block_type 1059
#define except_star_block_type 1060
#define finally_block_type 1061
#define match_stmt_type 1062
#define subject_expr_type 1063
#define case_block_type 1064
#define guard_type 1065
#define patterns_type 1066
#define pattern_type 1067
#define as_pattern_type 1068
#define or_pattern_type 1069
#define closed_pattern_type 1070
#define literal_pattern_type 1071
#define literal_expr_type 1072
#define complex_number_type 1073
#define signed_number_type 1074
#define signed_real_number_type 1075
#define real_number_type 1076
#define imaginary_number_type 1077
#define capture_pattern_type 1078
#define pattern_capture_target_type 1079
#define wildcard_pattern_type 1080
#define value_pattern_type 1081
#define attr_type 1082 // Left-recursive
#define name_or_attr_type 1083 // Left-recursive
#define group_pattern_type 1084
#define sequence_pattern_type 1085
#define open_sequence_pattern_type 1086
#define maybe_sequence_pattern_type 1087
#define maybe_star_pattern_type 1088
#define star_pattern_type 1089
#define mapping_pattern_type 1090
#define items_pattern_type 1091
#define key_value_pattern_type 1092
#define double_star_pattern_type 1093
#define class_pattern_type 1094
#define positional_patterns_type 1095
#define keyword_patterns_type 1096
#define keyword_pattern_type 1097
#define type_alias_type 1098
#define type_params_type 1099
#define type_param_seq_type 1100
#define type_param_type 1101
#define type_param_bound_type 1102
#define expressions_type 1103
#define expression_type 1104
#define yield_expr_type 1105
#define star_expressions_type 1106
#define star_expression_type 1107
#define star_named_expressions_type 1108
#define star_named_expression_type 1109
#define assignment_expression_type 1110
#define named_expression_type 1111
#define disjunction_type 1112
#define conjunction_type 1113
#define inversion_type 1114
#define comparison_type 1115
#define compare_op_bitwise_or_pair_type 1116
#define eq_bitwise_or_type 1117
#define noteq_bitwise_or_type 1118
#define lte_bitwise_or_type 1119
#define lt_bitwise_or_type 1120
#define gte_bitwise_or_type 1121
#define gt_bitwise_or_type 1122
#define notin_bitwise_or_type 1123
#define in_bitwise_or_type 1124
#define isnot_bitwise_or_type 1125
#define is_bitwise_or_type 1126
#define bitwise_or_type 1127 // Left-recursive
#define bitwise_xor_type 1128 // Left-recursive
#define bitwise_and_type 1129 // Left-recursive
#define shift_expr_type 1130 // Left-recursive
#define sum_type 1131 // Left-recursive
#define term_type 1132 // Left-recursive
#define factor_type 1133
#define power_type 1134
#define await_primary_type 1135
#define primary_type 1136 // Left-recursive
#define slices_type 1137
#define slice_type 1138
#define atom_type 1139
#define group_type 1140
#define lambdef_type 1141
#define lambda_params_type 1142
#define lambda_parameters_type 1143
#define lambda_slash_no_default_type 1144
#define lambda_slash_with_default_type 1145
#define lambda_star_etc_type 1146
#define lambda_kwds_type 1147
#define lambda_param_no_default_type 1148
#define lambda_param_with_default_type 1149
#define lambda_param_maybe_default_type 1150
#define lambda_param_type 1151
#define fstring_middle_type 1152
#define fstring_replacement_field_type 1153
#define fstring_conversion_type 1154
#define fstring_full_format_spec_type 1155
#define fstring_format_spec_type 1156
#define string_type 1157
#define strings_type 1158
#define list_type 1159
#define tuple_type 1160
#define set_type 1161
#define dict_type 1162
#define double_starred_kvpairs_type 1163
#define double_starred_kvpair_type 1164
#define kvpair_type 1165
#define for_if_clauses_type 1166
#define for_if_clause_type 1167
#define listcomp_type 1168
#define setcomp_type 1169
#define genexp_type 1170
#define dictcomp_type 1171
#define arguments_type 1172
#define args_type 1173
#define kwargs_type 1174
#define starred_expression_type 1175
#define kwarg_or_starred_type 1176
#define kwarg_or_double_starred_type 1177
#define star_targets_type 1178
#define star_targets_list_seq_type 1179
#define star_targets_tuple_seq_type 1180
#define star_target_type 1181
#define target_with_star_atom_type 1182
#define star_atom_type 1183
#define single_target_type 1184
#define single_subscript_attribute_target_type 1185
#define t_primary_type 1186 // Left-recursive
#define t_lookahead_type 1187
#define del_targets_type 1188
#define del_target_type 1189
#define del_t_atom_type 1190
#define type_expressions_type 1191
#define func_type_comment_type 1192
#define invalid_arguments_type 1193
#define invalid_kwarg_type 1194
#define expression_without_invalid_type 1195
#define invalid_legacy_expression_type 1196
#define invalid_expression_type 1197
#define invalid_named_expression_type 1198
#define invalid_assignment_type 1199
#define invalid_ann_assign_target_type 1200
#define invalid_del_stmt_type 1201
#define invalid_block_type 1202
#define invalid_comprehension_type 1203
#define invalid_dict_comprehension_type 1204
#define invalid_parameters_type 1205
#define invalid_default_type 1206
#define invalid_star_etc_type 1207
#define invalid_kwds_type 1208
#define invalid_parameters_helper_type 1209
#define invalid_lambda_parameters_type 1210
#define invalid_lambda_parameters_helper_type 1211
#define invalid_lambda_star_etc_type 1212
#define invalid_lambda_kwds_type 1213
#define invalid_double_type_comments_type 1214
#define invalid_with_item_type 1215
#define invalid_for_target_type 1216
#define invalid_group_type 1217
#define invalid_import_type 1218
#define invalid_import_from_targets_type 1219
#define invalid_with_stmt_type 1220
#define invalid_with_stmt_indent_type 1221
#define invalid_try_stmt_type 1222
#define invalid_except_stmt_type 1223
#define invalid_finally_stmt_type 1224
#define invalid_except_stmt_indent_type 1225
#define invalid_except_star_stmt_indent_type 1226
#define invalid_match_stmt_type 1227
#define invalid_case_block_type 1228
#define invalid_as_pattern_type 1229
#define invalid_class_pattern_type 1230
#define invalid_class_argument_pattern_type 1231
#define invalid_if_stmt_type 1232
#define invalid_elif_stmt_type 1233
#define invalid_else_stmt_type 1234
#define invalid_while_stmt_type 1235
#define invalid_for_stmt_type 1236
#define invalid_def_raw_type 1237
#define invalid_class_def_raw_type 1238
#define invalid_double_starred_kvpairs_type 1239
#define invalid_kvpair_type 1240
#define invalid_starred_expression_type 1241
#define invalid_replacement_field_type 1242
#define invalid_conversion_character_type 1243
#define _loop0_1_type 1244
#define _loop0_2_type 1245
#define _loop0_3_type 1246
#define _loop1_4_type 1247
#define _loop0_6_type 1248
#define _gather_5_type 1249
#define _tmp_7_type 1250
#define _tmp_8_type 1251
#define _tmp_9_type 1252
#define _tmp_10_type 1253
#define _tmp_11_type 1254
#define _tmp_12_type 1255
#define _tmp_13_type 1256
#define _tmp_14_type 1257
#define _loop1_15_type 1258
#define _tmp_16_type 1259
#define _tmp_17_type 1260
#define _tmp_18_type 1261
#define _loop0_20_type 1262
#define _gather_19_type 1263
#define _loop0_22_type 1264
#define _gather_21_type 1265
#define _tmp_23_type 1266
#define _tmp_24_type 1267
#define _loop0_25_type 1268
#define _loop1_26_type 1269
#define _loop0_28_type 1270
#define _gather_27_type 1271
#define _tmp_29_type 1272
#define _loop0_31_type 1273
#define _gather_30_type 1274
#define _tmp_32_type 1275
#define _loop1_33_type 1276
#define _tmp_34_type 1277
#define _tmp_35_type 1278
#define _tmp_36_type 1279
#define _loop0_37_type 1280
#define _loop0_38_type 1281
#define _loop0_39_type 1282
#define _loop1_40_type 1283
#define _loop0_41_type 1284
#define _loop1_42_type 1285
#define _loop1_43_type 1286
#define _loop1_44_type 1287
#define _loop0_45_type 1288
#define _loop1_46_type 1289
#define _loop0_47_type 1290
#define _loop1_48_type 1291
#define _loop0_49_type 1292
#define _loop0_50_type 1293
#define _loop1_51_type 1294
#define _loop0_53_type 1295
#define _gather_52_type 1296
#define _loop0_55_type 1297
#define _gather_54_type 1298
#define _loop0_57_type 1299
#define _gather_56_type 1300
#define _loop0_59_type 1301
#define _gather_58_type 1302
#define _tmp_60_type 1303
#define _loop1_61_type 1304
#define _loop1_62_type 1305
#define _tmp_63_type 1306
#define _tmp_64_type 1307
#define _loop1_65_type 1308
#define _loop0_67_type 1309
#define _gather_66_type 1310
#define _tmp_68_type 1311
#define _tmp_69_type 1312
#define _tmp_70_type 1313
#define _tmp_71_type 1314
#define _loop0_73_type 1315
#define _gather_72_type 1316
#define _loop0_75_type 1317
#define _gather_74_type 1318
#define _tmp_76_type 1319
#define _loop0_78_type 1320
#define _gather_77_type 1321
#define _loop0_80_type 1322
#define _gather_79_type 1323
#define _loop0_82_type 1324
#define _gather_81_type 1325
#define _loop1_83_type 1326
#define _loop1_84_type 1327
#define _loop0_86_type 1328
#define _gather_85_type 1329
#define _loop1_87_type 1330
#define _loop1_88_type 1331
#define _loop1_89_type 1332
#define _tmp_90_type 1333
#define _loop0_92_type 1334
#define _gather_91_type 1335
#define _tmp_93_type 1336
#define _tmp_94_type 1337
#define _tmp_95_type 1338
#define _tmp_96_type 1339
#define _tmp_97_type 1340
#define _tmp_98_type 1341
#define _loop0_99_type 1342
#define _loop0_100_type 1343
#define _loop0_101_type 1344
#define _loop1_102_type 1345
#define _loop0_103_type 1346
#define _loop1_104_type 1347
#define _loop1_105_type 1348
#define _loop1_106_type 1349
#define _loop0_107_type 1350
#define _loop1_108_type 1351
#define _loop0_109_type 1352
#define _loop1_110_type 1353
#define _loop0_111_type 1354
#define _loop1_112_type 1355
#define _tmp_113_type 1356
#define _loop0_114_type 1357
#define _loop1_115_type 1358
#define _tmp_116_type 1359
#define _loop0_118_type 1360
#define _gather_117_type 1361
#define _loop1_119_type 1362
#define _loop0_120_type 1363
#define _loop0_121_type 1364
#define _tmp_122_type 1365
#define _loop0_124_type 1366
#define _gather_123_type 1367
#define _tmp_125_type 1368
#define _loop0_127_type 1369
#define _gather_126_type 1370
#define _loop0_129_type 1371
#define _gather_128_type 1372
#define _loop0_131_type 1373
#define _gather_130_type 1374
#define _loop0_133_type 1375
#define _gather_132_type 1376
#define _loop0_134_type 1377
#define _loop0_136_type 1378
#define _gather_135_type 1379
#define _loop1_137_type 1380
#define _tmp_138_type 1381
#define _loop0_140_type 1382
#define _gather_139_type 1383
#define _loop0_142_type 1384
#define _gather_141_type 1385
#define _loop0_144_type 1386
#define _gather_143_type 1387
#define _loop0_146_type 1388
#define _gather_145_type 1389
#define _loop0_148_type 1390
#define _gather_147_type 1391
#define _tmp_149_type 1392
#define _tmp_150_type 1393
#define _tmp_151_type 1394
#define _tmp_152_type 1395
#define _tmp_153_type 1396
#define _tmp_154_type 1397
#define _tmp_155_type 1398
#define _tmp_156_type 1399
#define _tmp_157_type 1400
#define _tmp_158_type 1401
#define _tmp_159_type 1402
#define _tmp_160_type 1403
#define _loop0_161_type 1404
#define _loop0_162_type 1405
#define _loop0_163_type 1406
#define _tmp_164_type 1407
#define _tmp_165_type 1408
#define _tmp_166_type 1409
#define _tmp_167_type 1410
#define _tmp_168_type 1411
#define _loop0_169_type 1412
#define _loop0_170_type 1413
#define _loop0_171_type 1414
#define _loop1_172_type 1415
#define _tmp_173_type 1416
#define _loop0_174_type 1417
#define _tmp_175_type 1418
#define _loop0_176_type 1419
#define _loop1_177_type 1420
#define _tmp_178_type 1421
#define _tmp_179_type 1422
#define _tmp_180_type 1423
#define _loop0_181_type 1424
#define _tmp_182_type 1425
#define _tmp_183_type 1426
#define _loop1_184_type 1427
#define _tmp_185_type 1428
#define _loop0_186_type 1429
#define _loop0_187_type 1430
#define _loop0_188_type 1431
#define _loop0_190_type 1432
#define _gather_189_type 1433
#define _tmp_191_type 1434
#define _loop0_192_type 1435
#define _tmp_193_type 1436
#define _loop0_194_type 1437
#define _loop1_195_type 1438
#define _loop1_196_type 1439
#define _tmp_197_type 1440
#define _tmp_198_type 1441
#define _loop0_199_type 1442
#define _tmp_200_type 1443
#define _tmp_201_type 1444
#define _tmp_202_type 1445
#define _loop0_204_type 1446
#define _gather_203_type 1447
#define _loop0_206_type 1448
#define _gather_205_type 1449
#define _loop0_208_type 1450
#define _gather_207_type 1451
#define _loop0_210_type 1452
#define _gather_209_type 1453
#define _tmp_211_type 1454
#define _loop0_212_type 1455
#define _loop1_213_type 1456
#define _tmp_214_type 1457
#define _loop0_215_type 1458
#define _loop1_216_type 1459
#define _tmp_217_type 1460
#define _tmp_218_type 1461
#define _tmp_219_type 1462
#define _tmp_220_type 1463
#define _tmp_221_type 1464
#define _tmp_222_type 1465
#define _tmp_223_type 1466
#define _tmp_224_type 1467
#define _tmp_225_type 1468
#define _tmp_226_type 1469
#define _loop0_228_type 1470
#define _gather_227_type 1471
#define _tmp_229_type 1472
#define _tmp_230_type 1473
#define _tmp_231_type 1474
#define _tmp_232_type 1475
#define _tmp_233_type 1476
#define _tmp_234_type 1477
#define _tmp_235_type 1478
#define _tmp_236_type 1479
#define _tmp_237_type 1480
#define _tmp_238_type 1481
#define _tmp_239_type 1482
#define _tmp_240_type 1483
#define _tmp_241_type 1484
#define _loop0_242_type 1485
#define _tmp_243_type 1486
#define _tmp_244_type 1487
#define _tmp_245_type 1488
#define _tmp_246_type 1489
#define _tmp_247_type 1490
#define _tmp_248_type 1491
#define _tmp_249_type 1492
#define _tmp_250_type 1493
#define _tmp_251_type 1494
#define _tmp_252_type 1495
#define _tmp_253_type 1496
#define _tmp_254_type 1497
#define _tmp_255_type 1498
#define _tmp_256_type 1499
#define _tmp_257_type 1500
#define _tmp_258_type 1501
#define _tmp_259_type 1502
#define _tmp_260_type 1503
#define _tmp_261_type 1504
#define _tmp_262_type 1505
#define _tmp_263_type 1506
#define _tmp_264_type 1507
#define _tmp_265_type 1508
#define _tmp_266_type 1509
#define _tmp_267_type 1510
#define _tmp_268_type 1511
#define _tmp_269_type 1512
#define _tmp_270_type 1513
#define _tmp_271_type 1514
#define _tmp_272_type 1515
#define _tmp_273_type 1516
#define _tmp_274_type 1517
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 expr_ty fstring_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 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 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_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_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_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_rule(Parser *p);
static void *invalid_replacement_field_rule(Parser *p);
static void *invalid_conversion_character_rule(Parser *p);
static asdl_seq *_loop0_1_rule(Parser *p);
static asdl_seq *_loop0_2_rule(Parser *p);
static asdl_seq *_loop0_3_rule(Parser *p);
static asdl_seq *_loop1_4_rule(Parser *p);
static asdl_seq *_loop0_6_rule(Parser *p);
static asdl_seq *_gather_5_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 void *_tmp_12_rule(Parser *p);
static void *_tmp_13_rule(Parser *p);
static void *_tmp_14_rule(Parser *p);
static asdl_seq *_loop1_15_rule(Parser *p);
static void *_tmp_16_rule(Parser *p);
static void *_tmp_17_rule(Parser *p);
static void *_tmp_18_rule(Parser *p);
static asdl_seq *_loop0_20_rule(Parser *p);
static asdl_seq *_gather_19_rule(Parser *p);
static asdl_seq *_loop0_22_rule(Parser *p);
static asdl_seq *_gather_21_rule(Parser *p);
static void *_tmp_23_rule(Parser *p);
static void *_tmp_24_rule(Parser *p);
static asdl_seq *_loop0_25_rule(Parser *p);
static asdl_seq *_loop1_26_rule(Parser *p);
static asdl_seq *_loop0_28_rule(Parser *p);
static asdl_seq *_gather_27_rule(Parser *p);
static void *_tmp_29_rule(Parser *p);
static asdl_seq *_loop0_31_rule(Parser *p);
static asdl_seq *_gather_30_rule(Parser *p);
static void *_tmp_32_rule(Parser *p);
static asdl_seq *_loop1_33_rule(Parser *p);
static void *_tmp_34_rule(Parser *p);
static void *_tmp_35_rule(Parser *p);
static void *_tmp_36_rule(Parser *p);
static asdl_seq *_loop0_37_rule(Parser *p);
static asdl_seq *_loop0_38_rule(Parser *p);
static asdl_seq *_loop0_39_rule(Parser *p);
static asdl_seq *_loop1_40_rule(Parser *p);
static asdl_seq *_loop0_41_rule(Parser *p);
static asdl_seq *_loop1_42_rule(Parser *p);
static asdl_seq *_loop1_43_rule(Parser *p);
static asdl_seq *_loop1_44_rule(Parser *p);
static asdl_seq *_loop0_45_rule(Parser *p);
static asdl_seq *_loop1_46_rule(Parser *p);
static asdl_seq *_loop0_47_rule(Parser *p);
static asdl_seq *_loop1_48_rule(Parser *p);
static asdl_seq *_loop0_49_rule(Parser *p);
static asdl_seq *_loop0_50_rule(Parser *p);
static asdl_seq *_loop1_51_rule(Parser *p);
static asdl_seq *_loop0_53_rule(Parser *p);
static asdl_seq *_gather_52_rule(Parser *p);
static asdl_seq *_loop0_55_rule(Parser *p);
static asdl_seq *_gather_54_rule(Parser *p);
static asdl_seq *_loop0_57_rule(Parser *p);
static asdl_seq *_gather_56_rule(Parser *p);
static asdl_seq *_loop0_59_rule(Parser *p);
static asdl_seq *_gather_58_rule(Parser *p);
static void *_tmp_60_rule(Parser *p);
static asdl_seq *_loop1_61_rule(Parser *p);
static asdl_seq *_loop1_62_rule(Parser *p);
static void *_tmp_63_rule(Parser *p);
static void *_tmp_64_rule(Parser *p);
static asdl_seq *_loop1_65_rule(Parser *p);
static asdl_seq *_loop0_67_rule(Parser *p);
static asdl_seq *_gather_66_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 void *_tmp_71_rule(Parser *p);
static asdl_seq *_loop0_73_rule(Parser *p);
static asdl_seq *_gather_72_rule(Parser *p);
static asdl_seq *_loop0_75_rule(Parser *p);
static asdl_seq *_gather_74_rule(Parser *p);
static void *_tmp_76_rule(Parser *p);
static asdl_seq *_loop0_78_rule(Parser *p);
static asdl_seq *_gather_77_rule(Parser *p);
static asdl_seq *_loop0_80_rule(Parser *p);
static asdl_seq *_gather_79_rule(Parser *p);
static asdl_seq *_loop0_82_rule(Parser *p);
static asdl_seq *_gather_81_rule(Parser *p);
static asdl_seq *_loop1_83_rule(Parser *p);
static asdl_seq *_loop1_84_rule(Parser *p);
static asdl_seq *_loop0_86_rule(Parser *p);
static asdl_seq *_gather_85_rule(Parser *p);
static asdl_seq *_loop1_87_rule(Parser *p);
static asdl_seq *_loop1_88_rule(Parser *p);
static asdl_seq *_loop1_89_rule(Parser *p);
static void *_tmp_90_rule(Parser *p);
static asdl_seq *_loop0_92_rule(Parser *p);
static asdl_seq *_gather_91_rule(Parser *p);
static void *_tmp_93_rule(Parser *p);
static void *_tmp_94_rule(Parser *p);
static void *_tmp_95_rule(Parser *p);
static void *_tmp_96_rule(Parser *p);
static void *_tmp_97_rule(Parser *p);
static void *_tmp_98_rule(Parser *p);
static asdl_seq *_loop0_99_rule(Parser *p);
static asdl_seq *_loop0_100_rule(Parser *p);
static asdl_seq *_loop0_101_rule(Parser *p);
static asdl_seq *_loop1_102_rule(Parser *p);
static asdl_seq *_loop0_103_rule(Parser *p);
static asdl_seq *_loop1_104_rule(Parser *p);
static asdl_seq *_loop1_105_rule(Parser *p);
static asdl_seq *_loop1_106_rule(Parser *p);
static asdl_seq *_loop0_107_rule(Parser *p);
static asdl_seq *_loop1_108_rule(Parser *p);
static asdl_seq *_loop0_109_rule(Parser *p);
static asdl_seq *_loop1_110_rule(Parser *p);
static asdl_seq *_loop0_111_rule(Parser *p);
static asdl_seq *_loop1_112_rule(Parser *p);
static void *_tmp_113_rule(Parser *p);
static asdl_seq *_loop0_114_rule(Parser *p);
static asdl_seq *_loop1_115_rule(Parser *p);
static void *_tmp_116_rule(Parser *p);
static asdl_seq *_loop0_118_rule(Parser *p);
static asdl_seq *_gather_117_rule(Parser *p);
static asdl_seq *_loop1_119_rule(Parser *p);
static asdl_seq *_loop0_120_rule(Parser *p);
static asdl_seq *_loop0_121_rule(Parser *p);
static void *_tmp_122_rule(Parser *p);
static asdl_seq *_loop0_124_rule(Parser *p);
static asdl_seq *_gather_123_rule(Parser *p);
static void *_tmp_125_rule(Parser *p);
static asdl_seq *_loop0_127_rule(Parser *p);
static asdl_seq *_gather_126_rule(Parser *p);
static asdl_seq *_loop0_129_rule(Parser *p);
static asdl_seq *_gather_128_rule(Parser *p);
static asdl_seq *_loop0_131_rule(Parser *p);
static asdl_seq *_gather_130_rule(Parser *p);
static asdl_seq *_loop0_133_rule(Parser *p);
static asdl_seq *_gather_132_rule(Parser *p);
static asdl_seq *_loop0_134_rule(Parser *p);
static asdl_seq *_loop0_136_rule(Parser *p);
static asdl_seq *_gather_135_rule(Parser *p);
static asdl_seq *_loop1_137_rule(Parser *p);
static void *_tmp_138_rule(Parser *p);
static asdl_seq *_loop0_140_rule(Parser *p);
static asdl_seq *_gather_139_rule(Parser *p);
static asdl_seq *_loop0_142_rule(Parser *p);
static asdl_seq *_gather_141_rule(Parser *p);
static asdl_seq *_loop0_144_rule(Parser *p);
static asdl_seq *_gather_143_rule(Parser *p);
static asdl_seq *_loop0_146_rule(Parser *p);
static asdl_seq *_gather_145_rule(Parser *p);
static asdl_seq *_loop0_148_rule(Parser *p);
static asdl_seq *_gather_147_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 asdl_seq *_loop0_161_rule(Parser *p);
static asdl_seq *_loop0_162_rule(Parser *p);
static asdl_seq *_loop0_163_rule(Parser *p);
static void *_tmp_164_rule(Parser *p);
static void *_tmp_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 asdl_seq *_loop0_169_rule(Parser *p);
static asdl_seq *_loop0_170_rule(Parser *p);
static asdl_seq *_loop0_171_rule(Parser *p);
static asdl_seq *_loop1_172_rule(Parser *p);
static void *_tmp_173_rule(Parser *p);
static asdl_seq *_loop0_174_rule(Parser *p);
static void *_tmp_175_rule(Parser *p);
static asdl_seq *_loop0_176_rule(Parser *p);
static asdl_seq *_loop1_177_rule(Parser *p);
static void *_tmp_178_rule(Parser *p);
static void *_tmp_179_rule(Parser *p);
static void *_tmp_180_rule(Parser *p);
static asdl_seq *_loop0_181_rule(Parser *p);
static void *_tmp_182_rule(Parser *p);
static void *_tmp_183_rule(Parser *p);
static asdl_seq *_loop1_184_rule(Parser *p);
static void *_tmp_185_rule(Parser *p);
static asdl_seq *_loop0_186_rule(Parser *p);
static asdl_seq *_loop0_187_rule(Parser *p);
static asdl_seq *_loop0_188_rule(Parser *p);
static asdl_seq *_loop0_190_rule(Parser *p);
static asdl_seq *_gather_189_rule(Parser *p);
static void *_tmp_191_rule(Parser *p);
static asdl_seq *_loop0_192_rule(Parser *p);
static void *_tmp_193_rule(Parser *p);
static asdl_seq *_loop0_194_rule(Parser *p);
static asdl_seq *_loop1_195_rule(Parser *p);
static asdl_seq *_loop1_196_rule(Parser *p);
static void *_tmp_197_rule(Parser *p);
static void *_tmp_198_rule(Parser *p);
static asdl_seq *_loop0_199_rule(Parser *p);
static void *_tmp_200_rule(Parser *p);
static void *_tmp_201_rule(Parser *p);
static void *_tmp_202_rule(Parser *p);
static asdl_seq *_loop0_204_rule(Parser *p);
static asdl_seq *_gather_203_rule(Parser *p);
static asdl_seq *_loop0_206_rule(Parser *p);
static asdl_seq *_gather_205_rule(Parser *p);
static asdl_seq *_loop0_208_rule(Parser *p);
static asdl_seq *_gather_207_rule(Parser *p);
static asdl_seq *_loop0_210_rule(Parser *p);
static asdl_seq *_gather_209_rule(Parser *p);
static void *_tmp_211_rule(Parser *p);
static asdl_seq *_loop0_212_rule(Parser *p);
static asdl_seq *_loop1_213_rule(Parser *p);
static void *_tmp_214_rule(Parser *p);
static asdl_seq *_loop0_215_rule(Parser *p);
static asdl_seq *_loop1_216_rule(Parser *p);
static void *_tmp_217_rule(Parser *p);
static void *_tmp_218_rule(Parser *p);
static void *_tmp_219_rule(Parser *p);
static void *_tmp_220_rule(Parser *p);
static void *_tmp_221_rule(Parser *p);
static void *_tmp_222_rule(Parser *p);
static void *_tmp_223_rule(Parser *p);
static void *_tmp_224_rule(Parser *p);
static void *_tmp_225_rule(Parser *p);
static void *_tmp_226_rule(Parser *p);
static asdl_seq *_loop0_228_rule(Parser *p);
static asdl_seq *_gather_227_rule(Parser *p);
static void *_tmp_229_rule(Parser *p);
static void *_tmp_230_rule(Parser *p);
static void *_tmp_231_rule(Parser *p);
static void *_tmp_232_rule(Parser *p);
static void *_tmp_233_rule(Parser *p);
static void *_tmp_234_rule(Parser *p);
static void *_tmp_235_rule(Parser *p);
static void *_tmp_236_rule(Parser *p);
static void *_tmp_237_rule(Parser *p);
static void *_tmp_238_rule(Parser *p);
static void *_tmp_239_rule(Parser *p);
static void *_tmp_240_rule(Parser *p);
static void *_tmp_241_rule(Parser *p);
static asdl_seq *_loop0_242_rule(Parser *p);
static void *_tmp_243_rule(Parser *p);
static void *_tmp_244_rule(Parser *p);
static void *_tmp_245_rule(Parser *p);
static void *_tmp_246_rule(Parser *p);
static void *_tmp_247_rule(Parser *p);
static void *_tmp_248_rule(Parser *p);
static void *_tmp_249_rule(Parser *p);
static void *_tmp_250_rule(Parser *p);
static void *_tmp_251_rule(Parser *p);
static void *_tmp_252_rule(Parser *p);
static void *_tmp_253_rule(Parser *p);
static void *_tmp_254_rule(Parser *p);
static void *_tmp_255_rule(Parser *p);
static void *_tmp_256_rule(Parser *p);
static void *_tmp_257_rule(Parser *p);
static void *_tmp_258_rule(Parser *p);
static void *_tmp_259_rule(Parser *p);
static void *_tmp_260_rule(Parser *p);
static void *_tmp_261_rule(Parser *p);
static void *_tmp_262_rule(Parser *p);
static void *_tmp_263_rule(Parser *p);
static void *_tmp_264_rule(Parser *p);
static void *_tmp_265_rule(Parser *p);
static void *_tmp_266_rule(Parser *p);
static void *_tmp_267_rule(Parser *p);
static void *_tmp_268_rule(Parser *p);
static void *_tmp_269_rule(Parser *p);
static void *_tmp_270_rule(Parser *p);
static void *_tmp_271_rule(Parser *p);
static void *_tmp_272_rule(Parser *p);
static void *_tmp_273_rule(Parser *p);
static void *_tmp_274_rule(Parser *p);
// file: statements? $
static mod_ty
file_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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_2_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_2_var = _loop0_2_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;
}
// fstring: FSTRING_START fstring_middle* FSTRING_END
static expr_ty
fstring_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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_3_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;
}
// statements: statement+
static asdl_stmt_seq*
statements_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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_4_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) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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_5_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) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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, 519) // 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, _tmp_7_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, 522) // 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, 604) // 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, 573) // 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, 526) // 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, 523) // 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, 524) // 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) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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, _tmp_8_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, 642) // 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, _tmp_9_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, _tmp_10_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, _tmp_11_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, 624) // 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, 647) // 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 '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
// | single_target augassign ~ (yield_expr | star_expressions)
// | invalid_assignment
static stmt_ty
assignment_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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_12_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_13_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = expression_rule(p)) // expression
&&
(c = _tmp_14_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 '='))+ (yield_expr | star_expressions) !'=' 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 '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
asdl_expr_seq* a;
void *b;
void *tc;
if (
(a = (asdl_expr_seq*)_loop1_15_rule(p)) // ((star_targets '='))+
&&
(b = _tmp_16_rule(p)) // yield_expr | star_expressions
&&
_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 '='))+ (yield_expr | star_expressions) !'=' 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 '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
}
{ // single_target augassign ~ (yield_expr | star_expressions)
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 ~ (yield_expr | star_expressions)"));
int _cut_var = 0;
expr_ty a;
AugOperator* b;
void *c;
if (
(a = single_target_rule(p)) // single_target
&&
(b = augassign_rule(p)) // augassign
&&
(_cut_var = 1)
&&
(c = _tmp_17_rule(p)) // yield_expr | star_expressions
)
{
D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | 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_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 ~ (yield_expr | star_expressions)"));
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) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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) {
p->error_indicator = 1;
PyErr_NoMemory();
}
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->